/* Layout: a single scanning column — summary strip, filter bar, then ranked rows. Rows are dense lines, not cards. */
:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --fg: #1d2421;
  --muted: #5d6963;
  --line: #dde2de;
  --accent: #1f6b5c;
  --accent-soft: #e2efeb;
  --crit: #b3321f;
  --crit-soft: #f8e4df;
  --warn: #8a5a00;
  --warn-soft: #f6ecd4;
  --calm: #4b5b8a;
  --calm-soft: #e6e9f3;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-label: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --surface: #1a201d; --fg: #e4e9e6; --muted: #98a59f; --line: #2c3531;
    --accent: #6cc3ad; --accent-soft: #1d3530; --crit: #f08a76; --crit-soft: #3a211c;
    --warn: #e2b55c; --warn-soft: #352b17; --calm: #a5b3e0; --calm-soft: #232a3d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1a201d; --fg: #e4e9e6; --muted: #98a59f; --line: #2c3531;
  --accent: #6cc3ad; --accent-soft: #1d3530; --crit: #f08a76; --crit-soft: #3a211c;
  --warn: #e2b55c; --warn-soft: #352b17; --calm: #a5b3e0; --calm-soft: #232a3d; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; padding-inline: 16px; padding-block: 20px 48px; }
.wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 18px; }
header.top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
h1 { font-family: var(--font-label); font-weight: 600; font-size: 22px; letter-spacing: 0.01em; margin: 0; text-wrap: balance; }
.meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button, .btn { font: 500 13px var(--font-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, .btn:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button[aria-pressed="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }

.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.stage { padding: 10px 12px; border-right: 1px solid var(--line); display: grid; gap: 2px; cursor: pointer; text-align: left; border-radius: 0; border-top: 0; border-bottom: 0; border-left: 0; background: transparent; }
.stage:last-child { border-right: 0; }
.stage .n { font: 500 20px var(--font-data); font-variant-numeric: tabular-nums; }
.stage .l { font: 600 11px var(--font-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: normal; }
.stage[aria-pressed="true"] { background: var(--accent-soft); color: var(--fg); }
.stage[aria-pressed="true"] .l { color: var(--accent); }

.callouts { display: flex; flex-wrap: wrap; gap: 8px; }
.callout { font-size: 13px; padding: 6px 10px; border-radius: 6px; }
.callout.crit { background: var(--crit-soft); color: var(--crit); }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.calm { background: var(--calm-soft); color: var(--calm); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filters .lbl { font: 600 11px var(--font-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 4px; }
.filters .count { font-family: var(--font-data); font-size: 11.5px; color: inherit; opacity: 0.75; }

.queue { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.row { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 0 14px; padding: 12px 14px 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.stripe { border-radius: 0 3px 3px 0; }
.t0 .stripe { background: var(--crit); }
.t1 .stripe { background: var(--warn); }
.t2 .stripe { background: var(--calm); }
.t3 .stripe, .t4 .stripe { background: var(--line); }
.main { min-width: 0; display: grid; gap: 4px; }
.line1 { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.name { font-weight: 600; font-size: 15px; color: var(--fg); text-decoration: none; }
.name:hover { color: var(--accent); text-decoration: underline; }
.pill { font: 600 11px var(--font-label); text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.reason { font-size: 12.5px; font-weight: 500; }
.t0 .reason { color: var(--crit); } .t1 .reason { color: var(--warn); } .t2 .reason { color: var(--calm); } .t3 .reason, .t4 .reason { color: var(--muted); }
.action { font-size: 14px; overflow-wrap: anywhere; }
.action.empty { color: var(--muted); font-style: italic; }
.owners { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-right: 6px; }
.owner { font: 600 11px var(--font-label); letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--fg); }
.owner.me { border-color: var(--accent); color: var(--accent); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 12.5px; }
.facts b { font-weight: 500; color: var(--fg); font-family: var(--font-data); font-size: 12px; font-variant-numeric: tabular-nums; }
.side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.empty-state, .err { padding: 28px 18px; text-align: center; color: var(--muted); }
.err { color: var(--crit); }
.skel { padding: 14px; color: var(--muted); }
footer { color: var(--muted); font-size: 12px; max-width: 72ch; display: grid; gap: 4px; }
.name { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-family: var(--font-body); }

/* File panel */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.35); z-index: 10; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); border-left: 1px solid var(--line); z-index: 11; overflow-y: auto; padding-inline: 20px; padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 18px; align-content: start; }
.panel h2 { margin: 0; font: 600 20px var(--font-label); text-wrap: balance; }
.p-head { display: grid; gap: 6px; }
.p-head .row-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.p-sec { display: grid; gap: 8px; }
.p-sec h3 { margin: 0; font: 600 11px var(--font-label); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--font-data); font-size: 12.5px; overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
textarea { width: 100%; min-height: 64px; font: 14px var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; resize: vertical; }
.na-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.note { font-size: 12.5px; color: var(--muted); }
.note.ok { color: var(--accent); } .note.bad { color: var(--crit); }
.steps { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.step label { cursor: pointer; }
.step .who { font: 12px var(--font-data); color: var(--muted); text-align: right; }
.step.done label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.progress { font: 12px var(--font-data); color: var(--muted); }
.ready { background: var(--accent-soft); color: var(--fg); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.earlier { font-size: 12.5px; color: var(--muted); display: grid; gap: 2px; }
.feed { display: grid; gap: 10px; }
.feed .u { font-size: 13px; display: grid; gap: 2px; }
.feed .u .by { font: 11.5px var(--font-data); color: var(--muted); }
.feed .u .tx { overflow-wrap: anywhere; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 8px; font-size: 13px; z-index: 20; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px); }
.toast button { background: transparent; color: var(--bg); border-color: var(--bg); }

@media (max-width: 640px) {
  .row { grid-template-columns: 5px minmax(0, 1fr); }
  .side { grid-column: 2; flex-direction: row; align-items: center; margin-top: 8px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) { .row { transition: background 0.15s; } .row:hover { background: var(--bg); } }

/* Sign-in and connect screens */
.gate { max-width: 460px; margin: 10vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: grid; gap: 14px; }
.gate h1 { font-size: 22px; }
.gate p { margin: 0; color: var(--muted); }
.gate ol { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.gate input[type=password] { width: 100%; font: 14px var(--font-data); padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.who-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select { font: 13px var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; max-width: 100%; }
.sms textarea { margin: 8px 0 4px; }
.sms-body { white-space: pre-wrap; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
