/* Kanban Tracker — look taken from the Rails views (Tailwind v4 utilities):
   black page, gray-700 bordered columns, black cards with a 4px category border + coloured
   drop-shadow (Card#color_class), purple-900/60 "pills" for actions and counters. */
:root {
  --demo-h: 32px;
  --bg: #000;
  --ink: #fff;
  --gray-400: oklch(70.7% 0.022 261.325);
  --gray-500: oklch(55.1% 0.027 264.364);
  --gray-600: oklch(44.6% 0.03 256.802);
  --gray-700: oklch(37.3% 0.034 259.733);
  --gray-800: oklch(27.8% 0.033 256.848);
  --gray-900: oklch(21% 0.034 264.665);
  --purple-100: oklch(94.6% 0.033 307.174);
  --purple-500: oklch(62.7% 0.265 303.9);
  --purple-900: oklch(38.1% 0.176 304.987);
  --pink-500: oklch(65.6% 0.241 354.308);
  --orange-500: oklch(70.5% 0.213 47.604);
  --green-500: oklch(72.3% 0.219 149.579);
  --red-400: oklch(70.4% 0.191 22.216);
  --red-500: oklch(63.7% 0.237 25.331);
  --sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); overflow-x: hidden;
  padding-top: var(--demo-h); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .92em; }
.sp { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- demo bar (shared portfolio convention) ---- */
.demobar { position: fixed; top: 0; left: 0; right: 0; height: var(--demo-h); z-index: 100; display: flex; align-items: center;
  gap: 12px; padding: 0 14px; background: #1b1d22; color: #d6d9df; border-bottom: 1px solid #2c3038;
  font: 11px/1 var(--mono); white-space: nowrap; overflow: hidden; }
.demobar a { color: #d6d9df; font-weight: 700; }
.demobar a:hover { text-decoration: underline; }
.demobar .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.demobar .m { color: #8a909c; }
.demobar button { background: transparent; border: 1px solid #3a3f49; color: #d6d9df; border-radius: 4px; padding: 4px 9px;
  font: inherit; font-weight: 700; cursor: pointer; }
.demobar button:hover { border-color: #d6d9df; }

/* ---- app chrome ---- */
.appbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; max-width: 1536px; margin: 0 auto; }
.brand { font-weight: 700; color: var(--gray-400); letter-spacing: .01em; }
.brand:hover { color: var(--ink); }

/* The real "pill": bg-purple-900 opacity-60 text-purple-100 text-sm rounded-xl px-3 py-2 */
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--purple-900); opacity: .6; color: var(--purple-100);
  font-size: 14px; line-height: 20px; border-radius: 12px; padding: 8px 12px; border: 0; cursor: pointer; white-space: nowrap; }
.pill:hover, .pill:focus-visible, .pill[aria-expanded="true"] { opacity: .9; }
.pill.solid { opacity: .85; }
.pill.count { cursor: default; min-width: 34px; justify-content: center; }
.badge { background: var(--purple-500); color: #fff; border-radius: 999px; font-size: 11px; line-height: 16px; padding: 0 6px; }
.link { background: none; border: 0; color: var(--gray-400); cursor: pointer; padding: 2px 4px; }
.link:hover { color: var(--ink); text-decoration: underline; }

.container { max-width: 1536px; margin: 0 auto; padding: 40px 20px 120px; }

/* ---- boards#index ---- */
.boards { display: flex; gap: 16px; flex-wrap: wrap; }
.board-tile { border: 1px solid var(--gray-700); border-radius: 12px; padding: 40px 60px 44px; min-width: 260px; }
.board-tile h2 { font-size: 24px; font-weight: 400; margin: 0 0 6px; padding: 8px; }
.board-tile .meta { color: var(--gray-500); font-size: 14px; padding: 0 8px 18px; margin: 0; }
.board-tile .pill { margin-left: 8px; }
.lede { color: var(--gray-500); max-width: 640px; margin: 0 0 28px; font-size: 15px; }

/* ---- boards#show ---- */
.board-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.board-head h1 { font-size: 48px; line-height: 1; font-weight: 400; margin: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--gray-500); font-size: 13px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px;
  vertical-align: -1px; background: var(--c); }
.hint { color: var(--gray-600); font-size: 13px; margin: -12px 0 22px; }

.columns { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.column { flex: 0 0 300px; border: 1px solid var(--gray-700); border-radius: 12px; padding: 4px; min-height: 160px;
}
.column.drop-target { border-color: var(--purple-500); outline: 2px dashed var(--purple-500); outline-offset: 3px; background: color-mix(in oklch, var(--purple-900) 18%, transparent); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 16px 12px 4px 16px; }
.column-head h2 { font-size: 24px; font-weight: 400; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.column-add { display: flex; justify-content: flex-end; padding: 2px 12px 0; }
.column-empty { color: var(--gray-600); font-size: 14px; text-align: center; padding: 26px 12px; margin: 12px 16px;
  border: 1px dashed var(--gray-800); border-radius: 12px; }

/* card: border-l-4 border rounded-xl p-4 m-4 bg-black + color_class */
.card { --c: var(--gray-500); position: relative; background: #000; color: #fff; border: 1px solid var(--c); border-left-width: 4px;
  border-radius: 12px; padding: 16px; margin: 16px; filter: drop-shadow(0 4px 4px color-mix(in oklch, var(--c) 50%, transparent));
  cursor: grab; touch-action: pan-y; user-select: none; transition: transform .12s; }
.card:hover { transform: translateY(-1px); }
.card.dragging-src { opacity: .3; }
.card p { margin: 0; padding: 8px; }
.card .title { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .actions { display: flex; gap: 12px; }
.card .actions a, .card .actions button { color: #fff; background: none; border: 0; padding: 0; cursor: pointer; }
.card .actions a:hover, .card .actions button:hover { text-decoration: underline; }
.card .id { position: absolute; top: 10px; right: 12px; color: var(--gray-700); font: 12px var(--mono); }
.cat-backend { --c: var(--purple-500); }
.cat-frontend { --c: var(--pink-500); }
.cat-devops { --c: var(--orange-500); }
.cat-research { --c: var(--green-500); }
.cat-none { --c: var(--gray-500); }
.card.flash { animation: flash 1.1s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px color-mix(in oklch, var(--c) 70%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }

.drag-ghost { position: fixed; z-index: 90; pointer-events: none; width: 268px; margin: 0; cursor: grabbing;
  transform: rotate(2deg); }

/* ---- cards#new / cards#edit (shared _form partial) ---- */
.form-wrap { max-width: 720px; }
.form-wrap h2 { font-size: 36px; font-weight: 700; margin: 0; padding: 20px 0; }
.form { border: 1px solid var(--gray-700); border-radius: 12px; padding: 40px; }
.field { border: 1px solid var(--gray-700); border-radius: 12px; margin: 8px; padding: 8px; }
.field.has-error { border-color: var(--red-500); }
.field label, .field .lbl { display: block; padding: 8px 8px 4px; font-size: 12px; font-weight: 700; }
.field .ctl { padding: 4px 8px 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field input, .field textarea, .field select { background: var(--gray-900); color: #fff; border: 1px solid var(--gray-700); border-radius: 8px;
  padding: 8px 10px; font: 15px/1.4 var(--sans); }
.field input[type="text"], .field textarea { width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--purple-500); outline-offset: 0; border-color: transparent; }
.field.has-error input, .field.has-error textarea { border-color: var(--red-500); }
.counter { margin-left: auto; color: var(--gray-500); font: 12px var(--mono); }
.counter.over { color: var(--red-400); }
.form-actions { display: flex; align-items: center; gap: 16px; margin: 20px 8px 0; flex-wrap: wrap; }
.submit { background: var(--purple-900); opacity: .6; color: var(--purple-100); font-size: 14px; border: 0; border-radius: 12px; padding: 20px;
  cursor: pointer; flex: 1; text-align: left; }
.submit:hover, .submit:focus-visible { opacity: .9; }
.errors { border: 1px solid var(--red-500); background: color-mix(in oklch, var(--red-500) 12%, transparent); border-radius: 12px;
  margin: 8px 8px 16px; padding: 12px 16px; }
.errors h3 { margin: 0 0 6px; font-size: 15px; color: var(--red-400); }
.errors ul { margin: 0; padding-left: 20px; font-size: 14px; }

/* ---- log panel ---- */
.logpanel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; height: 280px; display: flex; flex-direction: column;
  background: #0b0b0d; border-top: 1px solid var(--gray-700); box-shadow: 0 -10px 30px rgba(0,0,0,.6); }
.logpanel[hidden] { display: none; }
.logpanel-head { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--gray-800);
  font-size: 13px; color: var(--gray-400); flex-wrap: wrap; }
.logpanel-head strong { color: #fff; font: 600 12px var(--mono); }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chk input { accent-color: var(--purple-500); }
.logbody { flex: 1; overflow: auto; margin: 0; padding: 10px 14px; font: 12px/1.55 var(--mono); color: var(--gray-400); white-space: pre-wrap;
  word-break: break-word; }
.logbody .start { color: #fff; }
.logbody .sql-l { color: #22d3ee; font-weight: 600; }
.logbody .sql { color: #93c5fd; }
.logbody .ok { color: var(--green-500); }
.logbody .redirect { color: #fbbf24; }
.logbody .note { color: #f0abfc; }
body.log-open .container { padding-bottom: 320px; }

/* ---- tour + toast ---- */
.tour { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.tour[hidden] { display: none; }
.tour-card { background: var(--gray-900); border: 1px solid var(--gray-700); border-radius: 14px; padding: 22px 24px; max-width: 440px; width: 100%; }
.tour-card h2 { margin: 4px 0 8px; font-size: 20px; }
.tour-card p { margin: 0; color: var(--gray-400); font-size: 15px; }
.tour-step { font: 12px var(--mono); color: var(--purple-500) !important; }
.tour-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 110; background: var(--gray-900); color: #fff;
  border: 1px solid var(--gray-700); border-radius: 10px; padding: 10px 16px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.log-open .toast { bottom: 300px; }

@media (max-width: 760px) {
  .demobar .m { display: none; }
  .demobar { gap: 8px; padding: 0 8px; }
  .container { padding: 20px 16px 100px; }
  .appbar { padding: 12px 16px; }
  .board-head h1 { font-size: 34px; }
  .columns { flex-direction: column; align-items: stretch; overflow: visible; }
  .column { flex: none; width: 100%; }
  .board-tile { padding: 28px 24px; width: 100%; min-width: 0; }
  .form { padding: 12px; }
  .field { margin: 6px 0; }
  .form-wrap h2 { font-size: 28px; }
  .logpanel { height: 46vh; }
  .logpanel-head .chk { order: 5; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
