/* Docket. Themes and colors are tokens on :root; nothing below hard-codes a color. */

:root {
  --bg: #0f1218; --panel: #171b24; --panel2: #1d2230; --text: #e9ecf3; --muted: #8d97ab; --line: #2a3142; --danger: #ff9a8a;
  --accent: #5b9bff; --accent-ink: #07101f; --shadow: 0 1px 2px rgba(0,0,0,.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --col: 640px;
  --st-inbox: #9aa4b8; --st-active: #4cc38a; --st-waiting: #f0b429; --st-parked: #8b7cf6; --st-done: #5b9bff; --st-archived: #6b7385;
  --ok: #4cc38a; --warn: #f0b429; --bad: #ff7a6b;
  color-scheme: dark;
}
:root[data-theme="light"] { --bg: #f3f4f7; --panel: #ffffff; --panel2: #e9ecf2; --text: #161a22; --muted: #5d667a; --line: #d5dae4; --danger: #c2392b; --accent: #2f6fdd; --accent-ink: #ffffff; --shadow: 0 1px 2px rgba(20,30,50,.12); --st-inbox: #6b7589; --st-active: #1f9d62; --st-waiting: #b7791f; --st-parked: #6f5ce0; --st-done: #2f6fdd; --st-archived: #8a92a3; --ok: #1f9d62; --warn: #b7791f; --bad: #c2392b; color-scheme: light; }
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] { --bg: #f3f4f7; --panel: #ffffff; --panel2: #e9ecf2; --text: #161a22; --muted: #5d667a; --line: #d5dae4; --danger: #c2392b; --accent: #2f6fdd; --accent-ink: #ffffff; --shadow: 0 1px 2px rgba(20,30,50,.12); --st-inbox: #6b7589; --st-active: #1f9d62; --st-waiting: #b7791f; --st-parked: #6f5ce0; --st-done: #2f6fdd; --st-archived: #8a92a3; --ok: #1f9d62; --warn: #b7791f; --bad: #c2392b; color-scheme: light; }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-boot { padding: 2rem; color: var(--muted); }
.app-icon { flex: none; }

/* page frame: a centered column that works from a phone up */
.app-page.wide { max-width: 1180px; }
.app-page { max-width: var(--col); margin: 0 auto; padding: 0 16px 48px; padding-bottom: max(48px, env(safe-area-inset-bottom)); }
.app-bar { display: flex; align-items: center; gap: .75rem; min-height: 3.25rem; padding-top: max(.5rem, env(safe-area-inset-top)); }
.app-bar h1 { flex: 1; margin: 0; font-size: 1.15rem; }
.app-bar .app-back { display: inline-flex; align-items: center; gap: .3em; color: var(--muted); text-decoration: none; }
.app-bar .app-back:hover { color: var(--text); }

/* buttons */
.app-btn { display: inline-flex; align-items: center; gap: .4em; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: .45em .8em; cursor: pointer; min-height: 2.4rem; }
.app-btn:hover { background: var(--panel2); }
.app-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.app-btn.primary:hover { filter: brightness(1.08); }
.app-btn.danger { color: var(--danger); }
.app-btn:disabled { opacity: .4; cursor: default; }
.app-btn.icon-only { padding: .4em; width: 2.4rem; justify-content: center; }

/* forms */
.app-form { display: flex; gap: .5rem; margin: .5rem 0 1rem; }
.app-form input[type=text] { flex: 1; min-width: 0; padding: .55em .75em; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.field { margin: .9rem 0; }
.field-label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field select { padding: .45em .6em; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.hint { margin: .3rem 0 0; color: var(--muted); font-size: .85rem; }

/* the list */
.app-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.app-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.app-row input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.app-row .app-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.app-row.done .app-text { color: var(--muted); text-decoration: line-through; }
.app-empty { color: var(--muted); text-align: center; padding: 2rem 1rem; border: 1px dashed var(--line); border-radius: 10px; }

/* settings */
.app-section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .25rem 1rem 1rem; margin: 1rem 0; }
.app-section h2 { font-size: 1rem; margin: .9rem 0 .25rem; }
.app-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.app-version { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 1.5rem; }

/* toast: one line at the bottom, with an optional action (Undo) */
#app-toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%); display: flex; align-items: center; gap: .75rem; max-width: calc(100% - 32px); padding: .6rem .9rem; background: var(--text); color: var(--bg); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.35); transition: transform .2s; z-index: 10; }
#app-toast.show { transform: translate(-50%, 0); }
#app-toast button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---- Docket ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem; overflow-x: auto; }
.tab { padding: .55em .9em; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.banner { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .55rem .8rem; margin: 0 0 .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); font-size: .9rem; }
.banner.mock { border-style: dashed; }
.banner span { flex: 1; min-width: 14rem; }
.app-btn.link, button.link { border: 0; background: transparent; padding: 0; min-height: 0; text-decoration: underline; cursor: pointer; color: var(--accent); text-align: left; }
.app-btn.link:hover { background: transparent; }

.add-form { display: grid; grid-template-columns: 1.4fr 1.4fr 1fr auto; gap: .5rem; margin: .25rem 0; }
.add-form input, .add-form select, .filters select, .note-row select, .app-dialog input, .app-dialog select, .app-dialog textarea, .note-form textarea, .app-settings input[type=text], .app-settings input[type=number], .batch select { min-width: 0; padding: .5em .65em; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); width: 100%; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0; }
.filters select { width: auto; }
.check { display: inline-flex; align-items: center; gap: .3em; color: var(--muted); font-size: .9rem; }
.batch { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .5rem .7rem; margin: .25rem 0 .5rem; border: 1px solid var(--accent); border-radius: 10px; background: var(--panel); position: sticky; top: 0; z-index: 3; }
.batch select { width: auto; }
.sweep { margin: .5rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: .4rem .8rem; }
.sweep summary { cursor: pointer; font-weight: 600; }
.sweep-list { list-style: none; margin: .5rem 0 .25rem; padding: 0; display: grid; gap: .3rem; font-size: .92rem; }
.sweep-list .rule-contradiction { color: var(--bad); }

.columns { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: .75rem; align-items: start; }
@media (min-width: 900px) { .columns { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
.col h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .5rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; }
.col h2::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; background: var(--st-inbox); }
.col-active h2::before { background: var(--st-active); } .col-waiting h2::before { background: var(--st-waiting); } .col-parked h2::before { background: var(--st-parked); } .col-done h2::before { background: var(--st-done); } .col-archived h2::before { background: var(--st-archived); }
.count { font-weight: 400; }
.cards, .notes { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.card { display: flex; gap: .5rem; align-items: flex-start; padding: .55rem .6rem; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--st-inbox); border-radius: 10px; box-shadow: var(--shadow); }
.card.st-active { border-left-color: var(--st-active); } .card.st-waiting { border-left-color: var(--st-waiting); } .card.st-parked { border-left-color: var(--st-parked); } .card.st-done { border-left-color: var(--st-done); } .card.st-archived { border-left-color: var(--st-archived); }
.card.picked { outline: 2px solid var(--accent); }
.card .pick { margin-top: .3rem; accent-color: var(--accent); }
.card-body { flex: 1; min-width: 0; }
.card-title { display: block; text-align: left; width: 100%; border: 0; background: transparent; padding: 0; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.card-title:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-top: .25rem; }
.chip { font-size: .72rem; padding: .08em .5em; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); }
.chip.project { --c: hsl(var(--hue) 60% 55%); color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.chip.unfiled { border-style: dashed; color: var(--muted); }
.chip.sample { border-style: dashed; }
.ago { font-size: .75rem; color: var(--muted); margin-left: auto; }
.next { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.next.none { color: var(--warn); }
.card .open { align-self: flex-start; min-height: 2rem; width: 2rem; }
.app-empty.small { padding: .8rem; font-size: .85rem; }

.app-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 1rem; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.app-dialog::backdrop { background: rgba(0,0,0,.55); }
.dlg-head { display: flex; align-items: center; gap: .5rem; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.app-dialog .field { display: block; margin: .6rem 0; }

.note-form { display: grid; gap: .5rem; }
.note-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; }
.note { padding: .7rem .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.note.done { opacity: .75; }
.note-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.earlier { margin-top: 1rem; } .earlier summary { cursor: pointer; color: var(--muted); }

.map-controls { display: flex; gap: .4rem; margin: .5rem 0; flex-wrap: wrap; }
.map-stage { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.map-svg { display: block; width: 100%; height: min(68vh, 640px); min-height: 360px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-svg:active { cursor: grabbing; }
.region-label { font-size: 15px; font-weight: 700; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; pointer-events: none; }
.node { cursor: pointer; }
.node .dot { fill: var(--st-inbox); stroke: var(--bg); stroke-width: 2; }
.node.st-active .dot { fill: var(--st-active); } .node.st-waiting .dot { fill: var(--st-waiting); } .node.st-parked .dot { fill: var(--st-parked); } .node.st-done .dot { fill: var(--st-done); } .node.st-archived .dot { fill: var(--st-archived); }
.node.s-claude-code-web .dot { stroke: var(--text); stroke-width: 3; }
.node.s-claude-cli .dot { stroke: var(--text); stroke-width: 3; stroke-dasharray: 3 2; }
.node.pinned .dot { stroke: var(--accent); stroke-width: 3; }
.node .halo { fill: none; stroke: var(--warn); stroke-width: 2; opacity: .85; }
.node:hover .dot, .node:focus-visible .dot { stroke: var(--accent); }
.node:focus-visible { outline: none; }
.node .node-label { font-size: 11px; fill: var(--text); display: none; pointer-events: none; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.show-labels .node .node-label { display: block; }
.node.dragging { opacity: .8; }
.legend { list-style: none; display: flex; gap: .9rem; flex-wrap: wrap; margin: .6rem 0 0; padding: 0; font-size: .82rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { width: .8rem; height: .8rem; border-radius: 50%; background: var(--st-inbox); display: inline-block; }
.swatch.st-active { background: var(--st-active); } .swatch.st-waiting { background: var(--st-waiting); } .swatch.st-parked { background: var(--st-parked); } .swatch.st-done { background: var(--st-done); }
.swatch.halo-key { background: transparent; border: 2px solid var(--warn); }

.scenarios { display: grid; gap: .5rem; margin: .75rem 0; }
@media (min-width: 800px) { .scenarios { grid-template-columns: 1fr 1fr; } }
.scenario { text-align: left; display: grid; gap: .25rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }
.scenario:hover { border-color: var(--accent); }
.scenario span { color: var(--muted); font-size: .85rem; }
.lab-log { list-style: none; margin: .75rem 0; padding: 0; display: grid; gap: .3rem; }
.lab-log li { display: flex; gap: .6rem; padding: .4rem .6rem; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: .92rem; }
.lab-log .who { flex: none; width: 4.5rem; font-weight: 700; color: var(--muted); font-size: .8rem; text-transform: uppercase; padding-top: .1rem; }
.lab-log .l-good { border-left: 4px solid var(--ok); } .lab-log .l-warn { border-left: 4px solid var(--warn); } .lab-log .l-bad { border-left: 4px solid var(--bad); }
.lab-table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: .5rem 0; background: var(--panel); }
.lab-table th, .lab-table td { padding: .35rem .6rem; border: 1px solid var(--line); text-align: left; }
.held { padding: .7rem .9rem; border: 1px solid var(--warn); border-radius: 10px; background: var(--panel); margin-top: .75rem; }
.held h3 { margin: 0 0 .4rem; font-size: 1rem; }
.rules { margin: 1.25rem 0; } .rules summary { cursor: pointer; font-weight: 600; } .rules li { margin: .6rem 0; }
.app-settings input[type=number] { width: 7rem; }

@media (max-width: 720px) {
  .add-form { grid-template-columns: 1fr; }
  .note-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
