/* Tach Tactical Cobalt. Tokens and rules mirror DESIGN.md exactly. */

@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-400-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-600-latin.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-700-latin.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-400-700-latin.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

/* Dark is the base; light applies when the system asks for it or the
   person chose it. A chosen theme (data-theme) always wins. */
:root {
  color-scheme: dark;
  --bg-canvas: #080B12; --bg-surface: #0E131E; --bg-elevated: #141B2B; --bg-hover: #192236; --bg-code: #06090F;
  --border: rgba(148, 163, 184, 0.14); --border-strong: rgba(148, 163, 184, 0.28);
  --text: #F1F5F9; --text-muted: #94A3B8; --text-dim: #7A8AA1;
  --cobalt: #3B82F6; --cobalt-strong: #2563EB; --cobalt-soft: rgba(59, 130, 246, 0.14); --cobalt-border: rgba(59, 130, 246, 0.36);
  --emerald: #10B981; --emerald-soft: rgba(16, 185, 129, 0.14);
  --amber: #F59E0B; --warn-soft: rgba(245, 158, 11, 0.14);
  --rose: #F43F5E; --rose-soft: rgba(244, 63, 94, 0.14);
  --cyan: #06B6D4; --violet: #8B5CF6;
  --chart-1: #3B82F6; --chart-2: #06B6D4; --chart-3: #10B981; --chart-4: #8B5CF6; --chart-5: #F59E0B; --chart-6: #F43F5E;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-pop: 0 14px 36px rgba(2, 6, 23, 0.55);

  --r-card: 8px; --r-ctrl: 6px; --r-seg: 4px; --r-swatch: 2px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px; --s16: 64px;
  --font-display: "Barlow Condensed", "IBM Plex Sans", -apple-system, sans-serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #F4F6FA; --bg-surface: #FFFFFF; --bg-elevated: #F8FAFC; --bg-hover: #EEF2F7; --bg-code: #F1F5F9;
  --border: rgba(15, 23, 42, 0.11); --border-strong: rgba(15, 23, 42, 0.24);
  --text: #0F172A; --text-muted: #475569; --text-dim: #5F6F86;
  --cobalt: #2563EB; --cobalt-strong: #2563EB; --cobalt-soft: rgba(37, 99, 235, 0.10); --cobalt-border: rgba(37, 99, 235, 0.32);
  --emerald: #046C4E; --emerald-soft: rgba(5, 150, 105, 0.10);
  --amber: #9A4A07; --warn-soft: rgba(217, 119, 6, 0.11);
  --rose: #BE123C; --rose-soft: rgba(225, 29, 72, 0.10);
  --cyan: #0891B2; --violet: #7C3AED;
  --chart-1: #2563EB; --chart-2: #0891B2; --chart-3: #059669; --chart-4: #7C3AED; --chart-5: #D97706; --chart-6: #E11D48;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-pop: 0 14px 34px rgba(15, 23, 42, 0.14);
}
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    color-scheme: light;
    --bg-canvas: #F4F6FA; --bg-surface: #FFFFFF; --bg-elevated: #F8FAFC; --bg-hover: #EEF2F7; --bg-code: #F1F5F9;
    --border: rgba(15, 23, 42, 0.11); --border-strong: rgba(15, 23, 42, 0.24);
    --text: #0F172A; --text-muted: #475569; --text-dim: #5F6F86;
    --cobalt: #2563EB; --cobalt-strong: #2563EB; --cobalt-soft: rgba(37, 99, 235, 0.10); --cobalt-border: rgba(37, 99, 235, 0.32);
    --emerald: #046C4E; --emerald-soft: rgba(5, 150, 105, 0.10);
    --amber: #9A4A07; --warn-soft: rgba(217, 119, 6, 0.11);
    --rose: #BE123C; --rose-soft: rgba(225, 29, 72, 0.10);
    --cyan: #0891B2; --violet: #7C3AED;
    --chart-1: #2563EB; --chart-2: #0891B2; --chart-3: #059669; --chart-4: #7C3AED; --chart-5: #D97706; --chart-6: #E11D48;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-pop: 0 14px 34px rgba(15, 23, 42, 0.14);
  }
}

* { box-sizing: border-box; }
/* Page stylesheets size text in rem; this sets 1rem so their 0.9375rem is
   the 13.5px body size. */
html { font-size: 90%; background: var(--bg-canvas); }
body {
  margin: 0; background: var(--bg-canvas); color: var(--text);
  font: 400 13.5px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overflow-x: clip;
}
a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.defs { position: absolute; width: 0; height: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── Top bar: mark, two or three destinations, a few 32px controls ── */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1280px; margin: 0 auto; min-height: 52px; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-link { display: inline-flex; align-items: center; color: var(--text); flex: none; }
.brand-link:hover { opacity: 0.88; }
.brand-wordmark { height: 26px; width: auto; display: block; }
.brand-wordmark .rule { stroke: var(--cobalt); stroke-width: 4; }
.primary-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav-tab {
  height: 32px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  border: 1px solid transparent; border-radius: var(--r-ctrl); white-space: nowrap;
}
.nav-tab:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.nav-tab.is-active { color: var(--text); font-weight: 600; background: var(--bg-elevated); border-color: var(--border-strong); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }

/* Uniform 32px controls. No stadium pills anywhere. */
.tach-seg-group { display: inline-flex; align-items: center; height: 32px; padding: 3px; gap: 2px; background: var(--bg-canvas); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.tach-seg-btn {
  height: 24px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center;
  font: 500 11.5px var(--font-mono); color: var(--text-muted);
  border: 0; border-radius: var(--r-seg); background: transparent; cursor: pointer; white-space: nowrap;
}
.tach-seg-btn:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.tach-seg-btn.is-active, .tach-seg-btn[aria-current] { color: var(--text); background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--cobalt-border); }
.tach-ctrl {
  height: 32px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-canvas); border: 1px solid var(--border); border-radius: var(--r-ctrl);
  color: var(--text); font: 500 12.5px var(--font-sans); cursor: pointer; white-space: nowrap;
}
.tach-ctrl:hover { background: var(--bg-hover); border-color: var(--border-strong); text-decoration: none; }
.tach-icon-btn {
  width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-canvas); border: 1px solid var(--border); border-radius: var(--r-ctrl);
  color: var(--text-muted); cursor: pointer; flex: none;
}
.tach-icon-btn:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border-strong); text-decoration: none; }
.tach-icon-btn.is-active { border-color: var(--cobalt-border); color: var(--cobalt); }
.tach-led { display: inline-block; width: 7px; height: 7px; border-radius: var(--r-swatch); background: var(--text-dim); flex: none; }
.tach-led.is-live { background: var(--emerald); box-shadow: 0 0 0 2px var(--emerald-soft); }
.tach-led.is-warn { background: var(--amber); box-shadow: 0 0 0 2px var(--warn-soft); }
.tach-led.is-bad { background: var(--rose); box-shadow: 0 0 0 2px color-mix(in srgb, var(--rose) 22%, transparent); }
.collector-status { max-width: 220px; font: 500 12px var(--font-mono); }
.collector-status .state.is-live { color: var(--emerald); font-weight: 600; }
.collector-status .state.is-warn { color: var(--amber); font-weight: 600; }
.theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-moon { display: none; }
html[data-theme="light"] .theme-icon-sun { display: block; }
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .theme-icon-moon { display: none; }
  html:not([data-theme="dark"]) .theme-icon-sun { display: block; }
}

/* The person's own pages open under their name. */
details.who { position: relative; flex: none; }
details.who summary { list-style: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
details.who summary::-webkit-details-marker { display: none; }
details.who[open] summary { background: var(--bg-hover); border-color: var(--border-strong); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 200px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--r-card); box-shadow: var(--shadow-pop);
}
.menu a, .menu button.link {
  display: flex; align-items: center; width: 100%; height: 32px; padding: 0 10px; margin: 0;
  border-radius: var(--r-ctrl); color: var(--text); font: 500 12.5px var(--font-sans); text-align: left; text-decoration: none;
}
.menu a:hover, .menu a[aria-current], .menu button.link:hover { background: var(--bg-hover); text-decoration: none; }
.menu form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border); }
button.link { background: none; border: 0; padding: 0; margin-left: var(--s2); color: var(--cobalt); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* One line down to a phone. There the name gives way first, then the
   status text; the tabs scroll sideways before anything wraps. */
@media (max-width: 860px) {
  .topbar-inner { padding: 8px 16px; }
  .topbar-left { gap: 10px; }
  .primary-nav { overflow-x: auto; scrollbar-width: none; }
  .collector-status .host { display: none; }
}
@media (max-width: 560px) {
  details.who summary { max-width: 84px; }
  .nav-tab { padding: 0 8px; }
  .collector-status { display: none; }
}

/* ── Page shell and head: what, whose, when, on one line ── */
.page { max-width: 1280px; margin: 0 auto; padding: 0 20px 44px; }
@media (max-width: 40rem) { .page { padding: 0 16px 32px; } }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; padding: 20px 0 0; }
.head > * { flex: 0 0 100%; }
.head > h1, .head > .title { flex: 1 1 auto; }
.head > .sub, .head > .tags { flex: 0 0 auto; }
.head h1 { margin: 0; font: 700 28px/1.05 var(--font-display); letter-spacing: 0.02em; }
/* Whose it is, or which part: a plain label after a rule, never a second
   word in the title's own face. */
.head .whose { display: inline-block; margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--border-strong); color: var(--text-muted); font: 500 13.5px/20px var(--font-sans); letter-spacing: 0; vertical-align: 3px; }
.head .whose::first-letter { text-transform: uppercase; }
.head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
.head .tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stepper {
  display: inline-flex; align-items: center; height: 32px; background: var(--bg-canvas);
  border: 1px solid var(--border); border-radius: var(--r-ctrl); color: var(--text); font: 500 12px var(--font-mono); white-space: nowrap;
}
.stepper a, .stepper .off { width: 28px; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 15px; }
.stepper a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.stepper .off { color: var(--border-strong); }
.presets { display: inline-flex; align-items: center; height: 32px; padding: 3px; gap: 2px; background: var(--bg-canvas); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.presets a { height: 24px; padding: 0 9px; display: inline-flex; align-items: center; font: 500 11.5px var(--font-mono); color: var(--text-muted); border-radius: var(--r-seg); white-space: nowrap; }
.presets a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.presets a[aria-current] { color: var(--text); background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--cobalt-border); }

/* ── Panels: every section is a card ── */
section { margin-top: var(--s4); padding: var(--s4); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); min-width: 0; }
section section { margin-top: var(--s4); padding: 0; background: none; border: 0; box-shadow: none; }
h2 { margin: 0 0 var(--s3); font: 600 13px/1.3 var(--font-sans); letter-spacing: 0.01em; color: var(--text); }
h2 .aside, .panel-sub { margin-left: var(--s2); font-weight: 400; font-size: 12px; color: var(--text-muted); }
p.note { margin: var(--s2) 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s4); }
.grid-2 > section, .grid-3 > section { margin-top: 0; }
@media (max-width: 980px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ── Figures and the four big numbers ── */
.fig { font: 400 12.5px/1.5 var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fig-total { font: 700 32px/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: var(--s4); }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: minmax(0, 1fr); } }
.kpi-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 6px; align-items: center; padding: 14px 16px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); min-width: 0; }
.kpi-label { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.kpi-val { font: 700 34px/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap; }
.kpi-val small { font: 500 13px var(--font-sans); letter-spacing: 0; color: var(--text-muted); margin-left: 4px; }
/* The line under a figure is never cut short: it goes to a second line
   between its parts, and a part with a figure in it stays whole. */
.kpi-sub { grid-column: 1 / -1; font: 400 12px/1.5 var(--font-mono); color: var(--text-muted); }
.kpi-sub span { white-space: nowrap; }
.kpi-sub a { font-family: var(--font-sans); }
.kpi-card.is-bad .kpi-val, .kpi-card.is-bad .kpi-label { color: var(--rose); }
.kpi-card.is-empty .kpi-val { color: var(--text-dim); }
.legend-swatch { width: 8px; height: 8px; border-radius: var(--r-swatch); display: inline-block; flex: none; }
.c-cobalt { background: var(--cobalt); color: var(--cobalt); }
.c-cyan { background: var(--cyan); color: var(--cyan); }
.c-emerald { background: var(--emerald); color: var(--emerald); }
.c-violet { background: var(--violet); color: var(--violet); }
.c-rose { background: var(--rose); color: var(--rose); }
svg.c-cobalt, svg.c-cyan, svg.c-emerald, svg.c-violet, svg.c-rose { background: none; }

/* A ring: one share of one whole. Square caps. */
.ring { width: 52px; height: 52px; grid-row: 2; grid-column: 2; }
.ring .track { fill: none; stroke: var(--border-strong); stroke-width: 7; }
.ring .arc { fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: butt; }

/* ── Tables ── */
table.ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.ledger th, .ledger td { padding: 8px 10px; text-align: left; vertical-align: baseline; border-top: 1px solid var(--border); }
.ledger th:first-child, .ledger td:first-child { padding-left: 0; }
.ledger th:last-child, .ledger td:last-child { padding-right: 0; }
.ledger thead th { border-top: 0; padding-top: 0; color: var(--text-muted); font: 600 11px/1.45 var(--font-sans); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.ledger tbody:first-child tr:first-child td { border-top: 0; }
.ledger td.fig, .ledger th.fig { text-align: right; }
.ledger td.kind { color: var(--text-muted); font-size: 12px; white-space: nowrap; width: 1%; }
.ledger td.aside { color: var(--text-muted); font: 400 12px var(--font-mono); text-align: right; white-space: nowrap; width: 1%; }
.ledger tr.sub td { border-top: 0; padding-top: 0; color: var(--text-muted); font-size: 12px; }
.ledger tr.total td { border-top: 1px solid var(--border-strong); font-weight: 600; }
.ledger .desc { overflow-wrap: anywhere; }
.ledger .meta { color: var(--text-muted); font-size: 12px; }
.ledger.breakdown th.fig, .ledger.breakdown td.fig { width: 6.5rem; }
@media (max-width: 40rem) { .ledger.breakdown th.fig, .ledger.breakdown td.fig { width: 4.5rem; } .ledger td.aside { display: none; } }
.ledger.cols { table-layout: fixed; }
.ledger.cols col.c-kind { width: 7.5rem; }
.ledger.cols col.c-aside { width: 9.5rem; }
.ledger.cols col.c-fig { width: 8rem; }
@media (max-width: 40rem) {
  .ledger.cols col.c-kind { width: 5.5rem; }
  .ledger.cols col.c-aside { width: 1px; }
  .ledger.cols col.c-fig { width: 6.5rem; }
  .ledger.cols td.aside { display: table-cell; padding: 0; font-size: 0; overflow: hidden; }
}

/* ── Kinds of money, each with its own mark ── */
.sw { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: var(--r-swatch); vertical-align: 0; }
.sw.billed { background: var(--cobalt); }
.sw.seats { background: var(--violet); }
.sw.estimated { background: var(--cyan); }
.sw.notional, .sw.list { background: radial-gradient(var(--emerald) 1.1px, transparent 1.3px) 0 0 / 4px 4px; outline: 1px solid var(--emerald); outline-offset: -1px; }
.sw.unpriced { background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 2px, var(--amber) 2px, var(--amber) 3px); outline: 1px solid var(--amber); outline-offset: -1px; }
.sw.unobserved { background: repeating-linear-gradient(45deg, var(--rose-soft), var(--rose-soft) 2px, var(--rose) 2px, var(--rose) 3px); outline: 1px solid var(--rose); outline-offset: -1px; }
.pat-ink, .pat-on { fill: var(--emerald); }
.pat-off { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.pat-amber { stroke: var(--amber); stroke-width: 1.5; }
.pat-red { stroke: var(--rose); stroke-width: 2; }
.unknown { color: var(--amber); font: 400 12.5px/1.5 var(--font-mono); }
.red { color: var(--rose); }
.amber { color: var(--amber); }
.green { color: var(--emerald); }

/* Tags: a fact in two or three words. */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: var(--r-seg); border: 1px solid var(--border); background: var(--bg-elevated); font: 500 11px var(--font-mono); color: var(--text-muted); white-space: nowrap; }
.tag-warn { border-color: rgba(245, 158, 11, 0.38); background: var(--warn-soft); color: var(--amber); }
.tag-bad { border-color: rgba(244, 63, 94, 0.42); background: var(--rose-soft); color: var(--rose); }
.tag-ok { border-color: rgba(16, 185, 129, 0.35); background: var(--emerald-soft); color: var(--emerald); }

.tags.row { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--s3) 0 0; }
.tags.row + form, .tags.row + table, .tags.row + details { margin-top: var(--s4); }
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: var(--s3) 0 0; }
.actions-row .spacer { flex: 1; }

/* A hint: the sentence someone may want once, on hover or focus. */
.hint {
  display: inline-flex; position: relative; width: 16px; height: 16px; margin-left: 6px; align-items: center; justify-content: center;
  vertical-align: 1px; border: 1px solid var(--border-strong); border-radius: var(--r-seg); color: var(--text-muted);
  font: 600 10px/1 var(--font-mono); letter-spacing: 0; text-transform: none; cursor: help;
}
.hint::before { content: "?"; }
.hint:hover, .hint:focus { color: var(--text); border-color: var(--cobalt-border); background: var(--cobalt-soft); }
.hint:hover::after, .hint:focus::after {
  content: attr(aria-label); position: absolute; z-index: 30; top: 22px; left: -8px; width: min(24rem, 72vw); padding: 8px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--r-ctrl); box-shadow: var(--shadow-pop);
  color: var(--text); font: 400 12px/1.45 var(--font-sans); text-align: left; white-space: normal;
}
.hint.left:hover::after, .hint.left:focus::after { left: auto; right: -8px; }

/* The Depth meter: four steps, lit as far as collection goes. */
.depth-meter { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.depth-meter li {
  flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-ctrl); background: var(--bg-canvas);
  color: var(--text-dim); font: 600 11px var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase;
}
.depth-meter li.is-on { background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.35); color: var(--emerald); }
details.fold { border-top: 1px solid var(--border); }
details.fold:first-of-type { border-top: 0; }
details.fold > summary { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 0; cursor: pointer; font-weight: 600; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
/* A drawn chevron that turns when the fold opens. */
details.fold > summary::before { content: ""; flex: none; width: 6px; height: 6px; margin: 0 3px 0 2px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: rotate(-45deg); }
details.fold[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
details.fold > summary:hover::before { border-color: var(--text); }
details.fold > summary:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; border-radius: var(--r-seg); }
/* A fold's name, then what it holds in plain weight, then its status. */
details.fold > summary .name { flex: none; min-width: 4.5rem; }
details.fold > summary .meta { flex: 1 1 0; min-width: 0; color: var(--text-muted); font-weight: 400; }
details.fold > summary .spacer { flex: 1; }
details.fold > summary .name + .meta + .spacer { display: none; }
@media (max-width: 600px) {
  details.fold > summary { flex-wrap: wrap; row-gap: 2px; }
  details.fold > summary .meta { flex: 1 0 100%; order: 3; padding-left: 26px; }
  details.fold > summary .name { flex: 1 1 auto; }
}
details.fold > :not(summary) { margin-bottom: var(--s3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s3); align-items: end; }
.form-grid .wide2 { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 420px) { .form-grid .wide2 { grid-column: 1 / -1; } }

.tags.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px var(--s4); }
.ledger td.led { width: 1%; padding-right: 0; }
h2 .tag { margin-left: 6px; vertical-align: 1px; }
/* A long tag in a table wraps instead of pushing the page sideways. */
.ledger td .tag { height: auto; min-height: 22px; padding-block: 2px; white-space: normal; }
.ledger td code { overflow-wrap: anywhere; }
@media (max-width: 30rem) { .ledger.money-seats th:nth-child(4), .ledger.money-seats td:nth-child(4), .setup .ledger th:nth-child(2), .setup .ledger td:nth-child(2) { display: none; } }

/* Seats: twenty dots are the whole fee. */
/* Who, the dots, the figure in one row; in a narrow panel the dots drop
   to their own line under the name and figure. */
.grid-2 > section, .grid-3 > section { container-type: inline-size; }
.seat-list { display: grid; grid-template-columns: minmax(0, 1fr) 240px auto; grid-auto-flow: row dense; column-gap: var(--s4); row-gap: 10px; align-items: center; }
.seat-list .dots { grid-column: 2; }
.seat-list .fig { grid-column: 3; white-space: nowrap; text-align: right; }
.seat-list .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-list .who small { color: var(--text-muted); font-size: 12px; margin-left: 4px; }
.seat-list .is-idle { color: var(--amber); }
.dots { display: block; width: 240px; height: 12px; }
.dots .cover { fill: var(--bg-surface); }
@container (max-width: 500px) {
  .seat-list { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .seat-list .fig { grid-column: 2; }
  .seat-list .dots { grid-column: 1 / -1; margin-bottom: 8px; }
}

/* Share bars: one row, one bar, one figure. */
.share { display: block; width: 100%; height: 5px; margin-top: 5px; border-radius: var(--r-swatch); }
.share rect { fill: var(--cobalt); }
.share.no-price rect { fill: url(#hatch); }
.vendor-bars { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--s3); row-gap: 8px; align-items: center; }
.vendor-bars svg { display: block; width: 100%; height: 6px; }
.vendor-bars rect { fill: var(--rose); }
.vendor-bars rect.ok { fill: var(--emerald); }

/* The daily chart. */
.days { display: block; width: 100%; height: auto; }
.days .axis { stroke: var(--border); stroke-width: 1; }
.days .bar-list { fill: var(--cobalt); }
.days .bar-none { fill: url(#hatch); }
.days text { fill: var(--text-dim); font: 400 10px var(--font-mono); }

/* Notes that something is missing. */
.gap { margin-top: var(--s3); padding: 10px 14px; border-radius: var(--r-ctrl); border: 1px solid rgba(244, 63, 94, 0.42); background: var(--rose-soft); font-size: 12.5px; }
.gap.unknown-gap { border-color: rgba(245, 158, 11, 0.38); background: var(--warn-soft); }
.gap p { margin: 0; font-weight: 600; }
.gap ul { margin: var(--s1) 0 0; padding-left: var(--s4); color: var(--text-muted); font-size: 12px; }
.notice { margin: var(--s2) 0 0; color: var(--text-muted); }
.command {
  display: inline-block; margin-top: var(--s2); padding: 9px 12px; background: var(--bg-code);
  border: 1px solid var(--border-strong); border-radius: var(--r-ctrl); font: 400 12.5px/1.5 var(--font-mono); color: var(--text); overflow-wrap: anywhere;
}
.foot { margin-top: var(--s6); color: var(--text-dim); font: 400 11.5px var(--font-mono); }

/* ── Buttons and fields, all 32px ── */
.btn {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-ctrl); border: 1px solid var(--border-strong); background: var(--bg-elevated);
  color: var(--text); font: 500 12.5px var(--font-sans); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn.primary { background: var(--cobalt-strong); border-color: var(--cobalt-strong); color: #FFFFFF; }
.btn.primary:hover { filter: brightness(1.08); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  height: 32px; padding: 0 10px; border-radius: var(--r-ctrl); border: 1px solid var(--border-strong);
  background-color: var(--bg-canvas); color: var(--text); font: 400 13px var(--font-sans); min-width: 0; max-width: 100%;
}
textarea { height: auto; padding: 8px 10px; line-height: 1.45; }
select {
  -webkit-appearance: none; appearance: none; padding: 0 30px 0 10px; font-weight: 500; font-size: 12.5px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px 12px;
}
select option { background: var(--bg-surface); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cobalt-border); outline-offset: 0; border-color: var(--cobalt); }

/* ── Sign-in and other single-purpose sheets ── */
.sheet { max-width: 460px; margin: 48px auto 0; padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.sheet.setup { max-width: 780px; }
.sheet h1 { margin: 0 0 var(--s3); font: 700 28px/1.05 var(--font-display); letter-spacing: 0.02em; }
.sheet p { margin: 0 0 var(--s3); }
.sheet form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s4); }
.code { font: 500 28px/1.1 var(--font-mono); letter-spacing: 0.08em; }

@media print {
  :root, html[data-theme="dark"], html[data-theme="light"] {
    color-scheme: light;
    --bg-canvas: #FFFFFF; --bg-surface: #FFFFFF; --bg-elevated: #FFFFFF; --bg-hover: #FFFFFF; --bg-code: #FFFFFF;
    --border: #BBBBBB; --border-strong: #777777; --text: #000000; --text-muted: #333333; --text-dim: #555555;
    --shadow-card: none; --shadow-pop: none;
  }
  .topbar, .head .sub { display: none; }
  .page { max-width: none; padding: 0; }
  section { break-inside: avoid; }
  .ledger tr { break-inside: avoid; }
}
