/* ABC Hub. Brand tokens are copied from the SEO hub (warm brown, copper, cream). System fonts only, no web fonts.
   Grid arithmetic (desktop, content width W): rows A and B are a 12-column grid with a 16px gap, 5 + 7 columns, so
   both cards end on the same left and right edges as the full-width cards under them. */

:root {
  --page: #FBF7F0;
  --ink: #3A2614;
  --ink-soft: #6F5440;
  --band: #F1E8D9;
  --card: #F3EBDD;
  --raised: #FFFDF9;
  --line: #E3D6C2;
  --line-strong: #CDBBA2;
  --p1: #5C3A1E;
  --p1-ink: #F8F0E4;
  --p2: #E6CBB0;
  --p2-ink: #3A2614;
  --gold: #C9A96E;
  --accent: #B07A4E;
  --good: #25673A;
  --good-bg: #E1EEE1;
  --good-bar: #4A9462;
  --warn: #7A4B0A;
  --warn-bg: #F6E8CC;
  --warn-bar: #D9A233;
  --bad: #A5321F;
  --bad-bg: #F3DAD3;
  --bad-bar: #C4452F;
  --mid: #5E4E3F;
  --mid-bg: #E8DFD0;
  --active: #EFE4D2;
  --grid: #E9DDCA;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --gap: 16px;
  --radius: 12px;
  --radius-control: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #1C130B;
    --ink: #F3E9DB;
    --ink-soft: #BBA187;
    --band: #271A10;
    --card: #271A10;
    --raised: #241911;
    --line: #3A2B1F;
    --line-strong: #5A4432;
    --p1: #E2B98C;
    --p1-ink: #2A1A0C;
    --p2: #5A3C25;
    --p2-ink: #F3E9DB;
    --gold: #C9A96E;
    --accent: #D49A6A;
    --good: #7CC795;
    --good-bg: #1F3326;
    --good-bar: #5FAE79;
    --warn: #E3B05A;
    --warn-bg: #3A2E16;
    --warn-bar: #D9A233;
    --bad: #EE8A78;
    --bad-bg: #402420;
    --bad-bar: #D9604A;
    --mid: #C9B49C;
    --mid-bg: #3A2C20;
    --active: #33241A;
    --grid: #33261B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: var(--p1); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }
.dim { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell: sidebar and canvas ---------- */

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 4px 8px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand .words { display: flex; flex-direction: column; line-height: 18px; }
.brand b { font-size: 16px; font-weight: 650; }
.brand small { font-size: 12px; color: var(--ink-soft); }
.logo { display: block; width: 116px; height: auto; flex: none; }

.nav { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px;
  border-radius: var(--radius-control);
  color: var(--ink-soft); text-decoration: none; font-size: 14px;
}
.nav a:hover { background: var(--band); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--active); color: var(--ink); font-weight: 600; }
.nav svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.who { font-size: 12px; color: var(--ink-soft); padding: 0 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: transparent; color: var(--ink); text-decoration: none;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--band); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--p1); border-color: var(--p1); color: var(--p1-ink); }
.btn-primary:hover { background: var(--p1); color: var(--p1-ink); filter: brightness(1.12); }
.btn-small { height: 28px; padding: 0 10px; font-size: 12px; }

.main { padding: 20px 32px 64px; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- status strip ---------- */

.strip {
  display: flex; flex-wrap: wrap; align-items: stretch;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius);
}
.strip-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 52px; }
.strip-item + .strip-item { border-left: 1px solid var(--line); }
.strip-item .k { color: var(--ink-soft); }
.strip-item .v { font-weight: 600; }
.strip-item.grow { margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--mid); }
.dot.up { background: var(--good-bar); }
.dot.down { background: var(--bad-bar); }
.dot.warn { background: var(--warn-bar); }

/* ---------- title row ---------- */

.title-row { display: flex; flex-direction: column; gap: 4px; padding: 12px 0 4px; }
h1 { font-size: 24px; line-height: 30px; font-weight: 650; letter-spacing: -0.01em; }
.finding { font-size: 15px; line-height: 22px; color: var(--ink-soft); }
.finding b { color: var(--ink); font-weight: 600; }

/* ---------- cards and grid ---------- */

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: 1 / -1; }

.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { font-size: 16px; line-height: 22px; font-weight: 650; }
.card-head.stack { flex-direction: column; align-items: flex-start; gap: 6px; }
.card-head .meta { font-size: 12px; color: var(--ink-soft); }

/* needs a human */

.lead { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: -2px 0 12px; }
.lead-fig { display: flex; flex-direction: column; }
.lead .big { font-size: 40px; line-height: 44px; font-weight: 650; color: var(--accent); }
.lead .big.zero { color: var(--ink); }
.lead .cap { color: var(--ink-soft); font-size: 13px; line-height: 18px; }

.queue { display: flex; flex-direction: column; }
.queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 56px; }
.queue li:first-child { border-top: 0; }
.queue .why { font-weight: 550; }
.queue .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink-soft); font-size: 12px; line-height: 18px; margin-top: 2px; }
.queue-more { margin-top: 10px; align-self: flex-start; }
.card-note { margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--ink-soft); }

/* period figures: one card split by hairlines */

.periods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 -20px -4px; flex: 1; }
.period { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.period + .period { border-left: 1px solid var(--line); }
.period .label { color: var(--ink-soft); font-size: 13px; }
.period .figure { font-size: 30px; line-height: 34px; font-weight: 650; }
.period .figure small { font-size: 13px; font-weight: 400; color: var(--ink-soft); margin-left: 4px; }
.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; white-space: nowrap; justify-content: space-between; gap: 10px; align-items: baseline; padding: 6px 0; min-height: 32px; }
.kv dt { color: var(--ink-soft); }
.kv dd { font-weight: 550; }
.kv dd.zero { color: var(--ink-soft); font-weight: 400; }

/* chart */

.chart-wrap { position: relative; flex: 1; min-height: 220px; }
.chart-wrap svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-soft); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sw-written, .bar-written { fill: var(--good-bar); background: var(--good-bar); }
.sw-held, .bar-held { fill: var(--warn-bar); background: var(--warn-bar); }
.sw-verify, .bar-verify { fill: var(--accent); background: var(--accent); }
.sw-error, .bar-error { fill: var(--bad-bar); background: var(--bad-bar); }
.sw-dry, .bar-dry { fill: var(--line-strong); background: var(--line-strong); }
.bar-hit { fill: transparent; }
.bar-hit:hover { fill: var(--band); opacity: 0.6; }
.ax-grid { stroke: var(--grid); stroke-width: 1; }
.ax-base { stroke: var(--line-strong); stroke-width: 1.5; }
.ax-text { fill: var(--ink-soft); font-size: 11px; font-family: var(--font); }
.ax-text.num { font-variant-numeric: tabular-nums; }

/* tables */

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 400; color: var(--ink-soft); padding: 0 0 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 8px 0; border-bottom: 1px solid var(--line); height: 38px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
th + th, td + td { padding-left: 12px; }
td .chip { margin-left: 8px; }

/* chips */

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; flex: none; }
.chip.written, .chip.done { background: var(--good-bg); color: var(--good); }
.chip.held { background: var(--warn-bg); color: var(--warn); }
.chip.writtenVerify { background: var(--p2); color: var(--p2-ink); }
.chip.skipped, .chip.other { background: var(--mid-bg); color: var(--mid); }
.chip.error { background: var(--bad-bg); color: var(--bad); }
.chip.wouldWrite, .chip.wouldWriteVerify, .chip.dryRun { background: transparent; color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* timeline */

.timeline { display: flex; flex-direction: column; }
.tl-head, .tl-row { display: grid; grid-template-columns: 116px minmax(200px, 1.1fr) 212px minmax(0, 2fr) 72px; gap: 16px; align-items: center; }
.tl-head { font-size: 12px; color: var(--ink-soft); padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
.tl-row { padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.tl-row .when { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tl-row .what b { font-weight: 550; display: block; }
.tl-row .what .sub { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-soft); line-height: 18px; }
.tl-row .reason { min-width: 0; }
.tl-row .cost { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.tl-head .cost { text-align: right; }
.more-row { display: flex; align-items: center; gap: 12px; padding-top: 14px; }

/* empty and error states */

.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-control); padding: 16px; color: var(--ink-soft); text-align: left; min-height: 38px; }
.error-card { border-color: var(--bad-bar); }
.error-card p { color: var(--ink); }
.skel { display: block; height: 20px; border-radius: 4px; background: var(--band); }

/* ---------- login ---------- */

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.login .brand { padding: 0; align-items: center; text-align: center; }
.login .logo { width: 168px; }
.login-card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login h1 { font-size: 20px; line-height: 26px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink-soft); }
.field input {
  height: 40px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--page); border: 1px solid var(--line-strong); border-radius: var(--radius-control);
}
.login .btn-primary { height: 40px; font-size: 15px; }
.form-error { color: var(--bad); background: var(--bad-bg); border-radius: var(--radius-control); padding: 10px 12px; font-size: 13px; }
.login-foot { font-size: 12px; color: var(--ink-soft); }

/* ---------- narrower screens ---------- */

@media (max-width: 1100px) {
  .span-5, .span-7 { grid-column: 1 / -1; }
  .main { padding-inline: 24px; }
}

@media (max-width: 860px) {
  .tl-head { display: none; }
  .tl-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "what chip" "reason reason" "when cost"; gap: 6px 12px; padding: 12px 0; }
  .tl-row .what { grid-area: what; }
  .tl-row .chipcell { grid-area: chip; justify-self: end; }
  .tl-row .reason { grid-area: reason; }
  .tl-row .when { grid-area: when; font-size: 12px; }
  .tl-row .cost { grid-area: cost; font-size: 12px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 5; height: auto;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--page);
  }
  .brand { padding: 0; flex: none; }
  .brand { flex-direction: row; align-items: center; }
  .brand .words { display: none; }
  .logo { width: 58px; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav a { flex: none; height: 36px; }
  .side-foot { margin: 0; flex-direction: row; align-items: center; padding: 0; flex: none; }
  .who { display: none; }
  .btn { height: 36px; }
  .main { padding: 12px 16px 48px; }
  .strip { flex-direction: column; }
  .strip-item { padding: 8px 16px; min-height: 40px; flex-wrap: wrap; gap: 2px 10px; }
  .queue li > .dim { font-size: 12px; }
  th + th, td + td { padding-left: 8px; }
  td .chip { display: flex; width: max-content; margin: 2px 0 0; height: 20px; }
  td { height: 44px; }
  .strip-item + .strip-item { border-left: 0; border-top: 1px solid var(--line); }
  .strip-item.grow { margin-left: 0; }
  .periods { grid-template-columns: minmax(0, 1fr); margin: 0 -20px; }
  .period { padding: 14px 20px; }
  .period + .period { border-left: 0; border-top: 1px solid var(--line); }
  .period:first-child { padding-top: 0; }
  .lead .big { font-size: 34px; line-height: 38px; }
  .queue li { grid-template-columns: minmax(0, 1fr); }
  .queue li .btn { justify-self: start; }
  .card { padding: 16px; }
  .periods { margin-inline: -16px; }
  .period { padding-inline: 16px; }
  .chart-wrap { min-height: 190px; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a { transition: background-color 120ms ease, color 120ms ease; }
}
