/* Task Board — "shop job board": stage columns like service bays, each topped with a
   colored wire. One bold element (the wires); everything else stays quiet. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --bay: #eef1f5;
  --ticket: #ffffff;
  --ink: #18202b;
  --muted: #5b6676;
  --line: #d9dee6;
  --line-strong: #b9c1cd;
  --hover: #f5f7fa;
  --focus: #2d6bea;
  --wire-backlog: #8a94a6;
  --wire-ready: #2d6bea;
  --wire-progress: #e8a00b;
  --wire-review: #8b5cf6;
  --wire-done: #19a15f;
  --wire-blocked: #e5484d;
  --blocked-bg: #fdecec;
  --warn-bg: #fff6e0;
  --warn-ink: #8a5a00;
  --radius-card: 10px;
  --radius-sheet: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bay: #10151d;
  --ticket: #18202b;
  --ink: #e8edf3;
  --muted: #96a1b1;
  --line: #2a3442;
  --line-strong: #3b4757;
  --hover: #1e2834;
  --focus: #6c9cff;
  --wire-backlog: #8a94a6;
  --wire-ready: #5b8cff;
  --wire-progress: #f2b632;
  --wire-review: #a78bfa;
  --wire-done: #34c27f;
  --wire-blocked: #ff6b6f;
  --blocked-bg: #3a1d20;
  --warn-bg: #3a2f14;
  --warn-ink: #f2cf7a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bay);
  color: var(--ink);
  font-family: "Archivo", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  font-stretch: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.muted { color: var(--muted); }

/* Buttons */
button, .button-like {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--ticket);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
button:hover:not(:disabled), .button-like:hover { background: var(--hover); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--ink); color: var(--ticket); border-color: var(--ink); }
button.primary:hover:not(:disabled) { background: var(--ink); opacity: .88; }
.icon-button { min-width: 40px; justify-content: center; padding: 8px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  background: var(--ticket);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.board-name {
  margin: 0; flex: 1; min-width: 0;
  font-size: 22px; font-weight: 750; font-stretch: 118%;
  letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.search input {
  width: 240px; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bay);
}
.menu { position: relative; }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -7px; } .menu-icon::after { top: 7px; }
#menu-button { min-width: 40px; justify-content: center; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); width: 260px;
  background: var(--ticket); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 6px; display: grid; gap: 2px;
  box-shadow: 0 12px 32px rgba(24, 32, 43, .16);
}
.menu-who { margin: 6px 10px 8px; font-size: 13px; color: var(--muted); }
.menu-item {
  width: 100%; border: 0; border-radius: 8px; background: transparent;
  justify-content: space-between; font-weight: 500; text-align: left;
}
.theme-row select { border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 6px; background: var(--ticket); }

main { padding: 18px 24px 48px; max-width: 1600px; margin: 0 auto; }

/* What needs you */
.focus { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.focus-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.focus-chip {
  min-height: 36px; border-radius: 999px; padding: 6px 14px;
  font-weight: 600; font-size: 14px; background: var(--ticket);
}
.focus-chip .count { font-weight: 800; font-stretch: 112%; }
.focus-chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.focus-chip.blocked .count { color: var(--wire-blocked); }
.focus-chip.review .count { color: var(--wire-review); }
.focus-chip.calm { color: var(--muted); border-style: dashed; cursor: default; }
.sync { margin: 0; font-size: 13px; color: var(--muted); }
.sync.stale { color: var(--wire-blocked); font-weight: 600; }

/* Category chips */
.categories { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.categories:empty { display: none; }
.cat {
  flex: none; min-height: 34px; padding: 5px 12px; border-radius: 999px;
  font-weight: 500; font-size: 14px; background: transparent; border-color: var(--line-strong);
}
.cat[aria-pressed="true"] { background: var(--ink); color: var(--ticket); border-color: var(--ink); }
.cat .n { color: var(--muted); font-size: 12px; }
.cat[aria-pressed="true"] .n { color: inherit; opacity: .7; }

/* Board: stage columns */
.lane-tabs { display: none; }
.board {
  display: grid;
  grid-template-columns: repeat(var(--lanes, 5), minmax(220px, 1fr));
  gap: 14px; align-items: start;
}
.lane { min-width: 0; }
.lane-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 2px 10px; position: relative;
}
.lane-head::after {
  /* The wire: one colored run with a terminal at the end. */
  content: ""; position: absolute; left: 0; right: 10px; bottom: 0; height: 4px;
  border-radius: 4px; background: var(--wire);
}
.lane-head::before {
  content: ""; position: absolute; right: 0; bottom: -3px; width: 10px; height: 10px;
  border-radius: 3px; background: var(--wire);
}
.lane-head h2 { margin: 0; font-size: 14px; font-weight: 700; font-stretch: 112%; }
.lane-head .n { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lane-cards { display: grid; gap: 8px; margin-top: 12px; }
.lane-empty { margin: 6px 2px; font-size: 13px; color: var(--muted); }

.tone-backlog { --wire: var(--wire-backlog); }
.tone-progress { --wire: var(--wire-progress); }
.tone-review { --wire: var(--wire-review); }
.tone-done { --wire: var(--wire-done); }
.tone-ready { --wire: var(--wire-ready); }

/* Ticket */
.card {
  display: block; width: 100%; text-align: left; min-height: 0;
  padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--ticket); font-weight: 400;
}
.card:hover:not(:disabled) { border-color: var(--line-strong); background: var(--ticket); }
.card.is-blocked { border-color: color-mix(in srgb, var(--wire-blocked) 55%, var(--line)); }
.card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; min-height: 0; }
.tag { font-size: 12px; font-weight: 600; color: var(--muted); }
.flag {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--blocked-bg); color: var(--wire-blocked);
}
.card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 650; line-height: 1.3; }
.card .next {
  margin: 0; font-size: 13px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--bay); border: 1px solid var(--line-strong);
  font-size: 11px; font-weight: 700; color: var(--ink);
}
.card-foot .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot .meta-icon { white-space: nowrap; }
.stale-dot { color: var(--warn-ink); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* Detail sheet */
dialog.sheet {
  width: min(640px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; padding: 0 24px 32px;
  border: 0; border-left: 1px solid var(--line);
  background: var(--ticket); color: var(--ink);
}
dialog.sheet.narrow { width: min(480px, 100vw); }
dialog::backdrop { background: rgba(16, 21, 29, .45); }
.sheet-top {
  position: sticky; top: 0; z-index: 2; background: var(--ticket);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.kicker { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.detail-title { margin: 6px 0 4px; font-size: 26px; line-height: 1.15; font-weight: 750; font-stretch: 112%; letter-spacing: -.01em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--muted); font-size: 14px; margin: 6px 0 14px; }
.detail-meta .person { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.stage-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
}
.stage-chip::before { content: ""; width: 10px; height: 4px; border-radius: 2px; background: var(--wire); }

.quick-status { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.stage-btn {
  min-height: 36px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  border-radius: 999px; position: relative;
}
.stage-btn[aria-pressed="true"] {
  background: var(--wire); border-color: var(--wire); color: #fff; opacity: 1; cursor: default;
}
.tone-progress .stage-btn[aria-pressed="true"], .stage-btn.tone-progress[aria-pressed="true"] { color: #1d1500; }
.stage-btn.flag-toggle[aria-pressed="true"] { background: var(--blocked-bg); color: var(--wire-blocked); border-color: var(--wire-blocked); cursor: pointer; }
#quick-error { color: var(--wire-blocked); font-size: 13px; margin: 4px 0 0; }
#quick-error:empty { display: none; }

.next-box {
  margin: 16px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--bay); border-left: 4px solid var(--wire);
}
.next-box .label { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 4px; }
.next-box p { margin: 0; font-size: 16px; font-weight: 550; }
.blocker-box { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--blocked-bg); }
.blocker-box p { margin: 0; }
.outcome { font-size: 15px; margin: 0 0 16px; max-width: 62ch; }
.section { margin: 22px 0; }
.section h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; font-stretch: 108%; }
.section ul { margin: 0; padding-left: 18px; }
.section li { margin: 3px 0; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.section li.none { color: var(--muted); list-style: none; margin-left: -18px; }
details.more { border-top: 1px solid var(--line); padding: 10px 0; }
details.more summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

.audit { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit p { margin: 2px 0; color: var(--muted); }
.audit pre { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bay); padding: 8px; border-radius: 8px; }

/* Code links */
.code-links ul { list-style: none; padding: 0; margin: 0; }
.code-links li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.code-links .kind { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 6px; }
.code-meta { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.code-meta.warn { color: var(--warn-ink); }
.pill { display: inline-block; font-size: 12px; font-weight: 650; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 8px; line-height: 1.6; }
.state-merged { border-color: var(--wire-review); color: var(--wire-review); }
.state-open, .ci-passing { border-color: var(--wire-done); color: var(--wire-done); }
.state-closed, .ci-failing { border-color: var(--wire-blocked); color: var(--wire-blocked); }
.ci-pending, .state-draft { border-color: var(--wire-progress); color: var(--warn-ink); }
.code-warning { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }

/* Forms */
.field { display: grid; gap: 6px; margin: 14px 0; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 9px 11px; font-weight: 400;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--ticket);
}
.field textarea { min-height: 88px; resize: vertical; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: center; margin: 14px 0; font-weight: 600; }
.check input { width: 20px; height: 20px; }
.form-error { color: var(--wire-blocked); font-size: 14px; }
.form-error:empty { display: none; }
.conflict { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.conflict pre { white-space: pre-wrap; font-size: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--ticket); padding: 10px 16px; border-radius: 10px;
  font-weight: 600; font-size: 14px; display: none; z-index: 20; max-width: calc(100vw - 32px);
}

/* Sign-in page */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: 100%; max-width: 380px; }
.signin-card h1 { font-size: 34px; font-weight: 780; font-stretch: 120%; letter-spacing: -.015em; margin: 0 0 4px; line-height: 1.05; }
.signin-wires { display: flex; gap: 4px; margin: 0 0 22px; }
.signin-wires span { height: 4px; flex: 1; border-radius: 4px; background: var(--wire); }
.signin-card .primary { width: 100%; justify-content: center; min-height: 46px; margin-top: 6px; }
.signin-card .muted { font-size: 13px; margin-top: 18px; }
.consent h1 { font-size: 28px; }
.consent .row { flex-wrap: nowrap; }
.consent .row button { flex: 1; justify-content: center; min-height: 46px; margin-top: 6px; }
.consent .access { border: 0; padding: 0; }
.consent .access legend { padding: 0; margin-bottom: 6px; }
.consent .access label { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 4px 0; }
.consent .access input { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--ink, currentColor); }
.consent code { overflow-wrap: anywhere; }

/* Phone: one stage at a time */
@media (max-width: 760px) {
  .topbar { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .topbar-tools { display: contents; }
  #new-task { white-space: nowrap; }
  .board-name { font-size: 19px; }
  .search { order: 3; flex-basis: 100%; }
  .search input { width: 100%; }
  main { padding: 14px 16px 40px; }
  .lane-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
  .lane-tab {
    flex: none; min-height: 38px; border-radius: 999px; padding: 6px 12px; font-size: 14px;
    border-color: var(--line-strong); background: transparent; font-weight: 600;
  }
  .lane-tab::before { content: ""; width: 10px; height: 4px; border-radius: 2px; background: var(--wire); }
  .lane-tab[aria-selected="true"] { background: var(--ticket); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
  .board { display: block; }
  .lane { display: none; }
  .lane.is-current { display: block; }
  .lane-head { display: none; }
  .lane-cards { margin-top: 0; }
  dialog.sheet { width: 100vw; border-left: 0; padding: 0 16px 28px; }
  .two-up { grid-template-columns: 1fr; gap: 0; }
  .detail-title { font-size: 23px; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .board { grid-template-columns: repeat(var(--lanes, 5), minmax(240px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Checklists, inline next action */
.count-note { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; font-stretch: 100%; }
ul.ticks { list-style: none; padding-left: 0; }
.section ul.ticks li.none { margin-left: 0; }
.tick-item label { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.tick-item input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--wire-done); }
.tick-item input:checked + span { color: var(--muted); }
li.met { color: var(--muted); }
.add-step { display: flex; gap: 6px; margin-top: 8px; }
.add-step input { flex: 1; min-width: 0; min-height: 38px; padding: 7px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; background: transparent; }
.add-step button { min-height: 38px; }
.next-box.editable { padding: 10px 12px 12px 16px; }
.next-text {
  display: block; width: 100%; text-align: left; min-height: 0; padding: 4px 6px; margin-left: -6px;
  border: 1px dashed transparent; background: transparent; font-size: 16px; font-weight: 550; border-radius: 6px;
}
.next-text:hover:not(:disabled) { border-color: var(--line-strong); background: transparent; }
#next-input { width: 100%; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--ticket); resize: vertical; }
.row.tight { margin: 8px 0 0; gap: 8px; }
.small { font-size: 12px; }
.progress-note { font-variant-numeric: tabular-nums; }
.show-all { width: 100%; justify-content: center; background: transparent; border-style: dashed; color: var(--muted); }

/* Quick add and drag-and-drop */
.quick-add-open {
  width: 100%; justify-content: flex-start; min-height: 38px; padding: 7px 12px;
  background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); font-weight: 600;
}
.quick-add-open::before { content: "+"; font-size: 16px; line-height: 1; }
.quick-add-open:hover:not(:disabled) { color: var(--ink); background: var(--ticket); }
.quick-add-form input {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--wire); border-radius: 8px; background: var(--ticket);
  box-shadow: 0 0 0 1px var(--wire);
}
.quick-add-hint { margin: 4px 2px 0; font-size: 12px; color: var(--muted); }
.card[draggable="true"] { cursor: grab; }
.card.is-dragging { opacity: .45; }
body.dragging .lane { border-radius: 12px; outline: 2px dashed transparent; outline-offset: 4px; }
body.dragging .lane.drop-ok { outline-color: var(--wire); background: color-mix(in srgb, var(--wire) 7%, transparent); }
@media (prefers-reduced-motion: no-preference) { .lane { transition: background .12s ease; } }
