/* wa-design.css — WitAura / TokenOps design tokens (R-DESIGN + ADDENDUM).
   One sheet for landing, app, docs, PDF (print styles at end).
   Direction: the auditor's aesthetic — premium audit report. Calm, dense,
   numbers-first. Signature: the accountant's double rule under verified
   totals. Accent chosen once: deep teal. Dark mode deferred (BACKLOG). */

/* ============================================================
   ROLE TOKENS (R-DESIGN-TOKENS-2 §1 · values per R-LOOK-FINAL)
   The ONLY place a colour literal may appear. Components reference
   ROLES, so a mood is a value swap and never a component change.
   Enforced by tests/test_design_tokens.py.

   MOODS: "sanchaya" (warm light, DEFAULT) and "aura" (dark) both
   ship at launch. Identical token NAMES, different values — that
   symmetry is what makes the topbar toggle free.

   DEPTH IS SPLIT BY PURPOSE (R-LOOK-FINAL 1a/1b):
     --control-depth  soft paired-inset neumorphic depth. Controls and
                      widget chrome ONLY: buttons, inputs, toggles,
                      wizard steps, source cards, stat-chip chrome, nav.
     --lift-1/2/3     flat-crisp elevation for DATA surfaces. Tables,
                      charts, evidence expanders and every money figure
                      stay flat and high-contrast — dollars never sit
                      inside a soft shadow, because a bevel eats the
                      edge of a numeral and legibility of money is the
                      one thing this product cannot trade.
   ============================================================ */
:root,
[data-mood="sanchaya"] {
  --ground: #fafaf8;
  --surface: #ffffff;
  --surface-raised: #f4f4f0;
  --ink: #15171a;
  --ink-soft: #565b62;
  --rule: #e4e4dd;
  --rule-strong: #15171a;
  --accent: #0e6e5e;
  --accent-ink: #0a564a;
  --on-accent: #ffffff;
  --money: #15171a;
  --verified: #0e6e5e;  --verified-bg: #e4f1ee;  --verified-line: #c6e0da;
  --estimate: #8a5a0b;  --estimate-bg: #faf0de;  --estimate-line: #ecd9b0;
  --waste:    #b02f22;  --waste-bg:    #fbeae8;  --waste-line:    #f0cbc6;

  /* controls + widget chrome: soft, paired-inset (family constitution) */
  --control-depth:
    inset 0 1px 0 rgba(255,255,255,.92),
    inset 0 -1px 0 rgba(21,23,26,.07),
    0 1px 2px rgba(21,23,26,.05);
  --control-depth-pressed:
    inset 0 2px 4px rgba(21,23,26,.12),
    inset 0 -1px 0 rgba(255,255,255,.5);
  --control-depth-primary:
    inset 0 1px 0 rgba(255,255,255,.16),
    0 1px 3px rgba(21,23,26,.25);

  /* data surfaces: flat-crisp */
  --lift-1: 0 1px 2px rgba(21,23,26,.05);
  --lift-2: 0 1px 2px rgba(21,23,26,.05), 0 6px 18px -8px rgba(21,23,26,.12);
  --lift-3: 0 2px 4px rgba(21,23,26,.06), 0 18px 44px -14px rgba(21,23,26,.18);
  --inner-edge: inset 0 1px 0 rgba(255,255,255,.85);
  --accent-ring: rgba(14,110,94,.25);
  --accent-glow: rgba(14,110,94,.55);
  --veil: rgba(21,23,26,.45);
}

/* AURA — dark, ships at launch. Values only; no component knows. */
[data-mood="aura"] {
  --ground: #0a0c10;
  --surface: #111419;
  --surface-raised: #161a21;
  --ink: #e9edf3;
  --ink-soft: #98a2b0;
  --rule: #222833;
  --rule-strong: #e9edf3;
  --accent: #6f4ff5;   /* 5.11:1 with --on-accent; #7b5cff was 4.36 and failed AA */
  --accent-ink: #5a3ade;
  --on-accent: #ffffff;
  --money: #e9edf3;
  /* meanings never remap, only values (R-LOOK-FINAL 3a) */
  --verified: #4ade9b;  --verified-bg: #102a1e;  --verified-line: #1c4433;
  --estimate: #f5c661;  --estimate-bg: #2a2211;  --estimate-line: #4a3a1a;
  --waste:    #ff8b80;  --waste-bg:    #2c1512;  --waste-line:    #4d221d;

  --control-depth:
    inset 0 1px 0 rgba(255,255,255,.07),
    inset 0 -1px 0 rgba(0,0,0,.45),
    0 1px 2px rgba(0,0,0,.5);
  --control-depth-pressed:
    inset 0 2px 5px rgba(0,0,0,.55),
    inset 0 -1px 0 rgba(255,255,255,.05);
  --control-depth-primary:
    inset 0 1px 0 rgba(255,255,255,.14),
    0 1px 3px rgba(0,0,0,.6);

  /* in the dark a drop shadow is invisible; depth is a light edge */
  --lift-1: inset 0 1px 0 rgba(255,255,255,.04);
  --lift-2: inset 0 1px 0 rgba(255,255,255,.05), 0 14px 34px -20px #000;
  --lift-3: inset 0 1px 0 rgba(255,255,255,.06), 0 26px 60px -24px #000;
  --inner-edge: inset 0 1px 0 rgba(255,255,255,.05);
  --accent-ring: rgba(111,79,245,.32);
  --accent-glow: rgba(111,79,245,.6);
  --veil: rgba(0,0,0,.62);
}

/* mood-invariant: type, space, motion */
:root {
  --serif: "Charter", "Iowan Old Style", "Georgia", "Times New Roman", serif;
  --sans: "Inter", system-ui, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px;
  --content-max: 1100px;
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --t-fast: 150ms; --t-med: 250ms;

  /* legacy aliases — canonical names are the roles above. A NEW rule using
     one of these is a ux-reviewer finding. */
  --paper: var(--ground);
  --surface-tint: var(--surface-raised);
}


* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s3); }

h1, h2, h3 { font-family: var(--sans); font-weight: 600; margin: 0 0 var(--s2); }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
small, .muted { color: var(--ink-soft); }
a { color: var(--accent); }

/* Money is the most visually weighted object on every screen. */
/* .money / .money-hero / .money-lg / .money-sm / .total-rule are defined ONCE,
   in the COMPONENT KIT section below. They used to be declared here too, and
   the stale copy kept cascading its serif font-family onto every figure after
   R-LOOK-FINAL — money was still rendering in the superseded face. */

/* Cards: 1px border + layered lift; hover tiers up (ADDENDUM 2b) */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--lift-1), var(--inner-edge);
  padding: var(--s3);
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.card:hover { box-shadow: var(--lift-2), var(--inner-edge); transform: translateY(-1px); }
.tinted { background: var(--surface-tint); }

/* Badges — semantic only */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.badge-verified { color: var(--verified); background: var(--verified-bg); border-color: var(--verified-line); }
.badge-estimate { color: var(--estimate); background: var(--estimate-bg); border-color: var(--estimate-line); }
.badge-waste { color: var(--waste); background: var(--waste-bg); border-color: var(--waste-line); }
/* "needs more data" is not waste — keep red for real waste signals only
   (mockup-v3 ux gate f.3). */
.badge-neutral { color: var(--ink-soft); background: var(--surface-tint); border-color: var(--rule); }

/* Buttons */
.btn { font: 600 14px var(--sans); border-radius: var(--radius); cursor: pointer;
  box-shadow: var(--control-depth);
  padding: 8px 14px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.btn:active { transform: scale(0.98); box-shadow: var(--control-depth-pressed); }             /* micro-confirmation */
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent-ink); color: var(--on-accent);
  box-shadow: var(--control-depth-primary); }  /* the white neumorphic inset washed text on saturated fills */
.btn-primary:hover { background: var(--accent-ink); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }

/* Tables: dense but ordered; money right-aligned tabular */
table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th { text-align: left; font-weight: 600; color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-strong); padding: 6px 8px; }
.ledger td { border-bottom: 1px solid var(--rule); padding: 8px; }
.ledger td.money, .ledger th.money { text-align: right; }

/* Evidence expander: native details, springs open (ADDENDUM 2b) */
details.evidence > summary { cursor: pointer; color: var(--accent); font-weight: 600;
  list-style: none; }
details.evidence > summary::before { content: "▸ "; transition: transform var(--t-fast) var(--ease); }
details.evidence[open] > summary::before { content: "▾ "; }
details.evidence[open] > div { animation: spring-open var(--t-med) var(--ease); transform-origin: top; }
@keyframes spring-open { from { opacity: 0; transform: translateY(-4px) scaleY(0.98); }
  to { opacity: 1; transform: none; } }

/* Fix snippet: copyable */
.snippet { font-family: var(--mono); font-size: 13px; background: var(--surface-tint);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s2);
  overflow-x: auto; }

/* Count-up hero (ADDENDUM 2a): CSS-only, runs once, 600ms */
@property --n { syntax: "<integer>"; inherits: false; initial-value: 0; }
.countup { --target: 0; counter-reset: n var(--n); animation: countup 600ms var(--ease) forwards; }
.countup::after { content: counter(n); }
@keyframes countup { from { --n: 0; } to { --n: var(--target); } }

/* Pipeline theater (first-run + audit progress) */
.pipeline { display: flex; gap: var(--s2); align-items: center; }
.stage { flex: 1; text-align: center; padding: var(--s2); border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--surface); color: var(--ink-soft);
  font-size: 13px; font-weight: 600; }
.stage.done { color: var(--verified); border-color: var(--verified-line); background: var(--verified-bg); }
.stage.live { color: var(--accent); border-color: var(--accent);
  animation: stage-pulse 1.6s var(--ease) infinite; }
@keyframes stage-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-ring); }
  50% { box-shadow: 0 0 0 6px transparent; } }

/* htmx swap default (wired at V-D4): 150ms fade + 4px rise */
.swap-in { animation: swap-in var(--t-fast) var(--ease); }
@keyframes swap-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Focus + accessibility floor */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reduced motion: everything designed degrades to instant (ADDENDUM 2) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .countup { --n: var(--target); }
}

/* ---- APP SHELL (R-DESIGN-SHELL 2026-07-21) ---- */

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar { background: var(--surface-tint); border-right: 1px solid var(--rule);
  padding: var(--s3) 0; }
.sidebar .brand { font-weight: 700; padding: 0 var(--s3) var(--s3); }
.nav-group { margin-bottom: var(--s3); }
.nav-group > .label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); padding: 0 var(--s3) 6px; }
.nav-group a { display: block; padding: 7px var(--s3); color: var(--ink);
  text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.nav-group a:hover { background: rgba(28, 26, 23, 0.04); }
.nav-group a[aria-current="page"] { font-weight: 600; color: var(--accent-ink);
  background: var(--surface); border-left-color: var(--accent); }

.topbar { display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4); border-bottom: 1px solid var(--rule);
  background: var(--surface); }
.topbar .spacer { flex: 1; }
.freshness { font-size: 13px; color: var(--ink-soft); }
.freshness b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.plan-badge { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper); }
.main { padding: var(--s4); }

.sidebar-toggle { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--rule); }
  .sidebar.collapsed .nav-group { display: none; }
  .sidebar-toggle { display: inline-block; }
  .main { padding: var(--s3) var(--s2); }
}

/* ---- WIDGET GRID ---- */

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s3); }
.w-12 { grid-column: span 12; } .w-6 { grid-column: span 6; }
.w-4 { grid-column: span 4; } .w-8 { grid-column: span 8; }
@media (max-width: 860px) { .w-6, .w-4, .w-8 { grid-column: span 12; } }

.widget { background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--lift-1), var(--inner-edge);
  padding: var(--s3); display: flex; flex-direction: column;
  transition: box-shadow var(--t-fast) var(--ease); }
.widget:hover { box-shadow: var(--lift-2), var(--inner-edge); }
.widget > h2 { margin-bottom: 2px; }
/* "What this tells you" — mandatory one-liner on every widget */
.widget > .tells { font-size: 13px; color: var(--ink-soft); margin: 0 0 var(--s2); }
/* Provenance: determinism made visible — every number names its source */
.widget > .provenance { margin-top: auto; padding-top: var(--s2); font-size: 12px;
  color: var(--ink-soft); border-top: 1px solid var(--rule); }
.widget .provenance code { font-size: 11px; }
/* Empty states teach the next action — never a shimmer, never a spinner */
.empty { padding: var(--s3) 0; }
.empty p { margin: 0 0 var(--s2); color: var(--ink-soft); }

/* ---- PIPELINE RIBBON (W0, the holistic spine) ---- */

.ribbon { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; }
.ribbon .seg { padding: var(--s2) var(--s3); border-right: 1px solid var(--rule);
  position: relative; }
.ribbon .seg:last-child { border-right: none; }
.ribbon .seg .stage-name { font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); }
.ribbon .seg .stage-state { font-family: var(--sans); font-size: 19px; font-weight: 680;
  font-variant-numeric: tabular-nums; margin-top: 2px; }
.ribbon .seg .stage-note { font-size: 12px; color: var(--ink-soft); }
.ribbon .seg.active { background: var(--surface-tint); }
.ribbon .seg.active .stage-name { color: var(--accent-ink); }
.ribbon .seg.waiting .stage-state { color: var(--ink-soft); font-weight: 400; }
/* chevron seam: the strip reads left-to-right as one flow */
.ribbon .seg::after { content: ""; position: absolute; right: -7px; top: 50%;
  width: 12px; height: 12px; transform: translateY(-50%) rotate(45deg);
  border-top: 1px solid var(--rule); border-right: 1px solid var(--rule);
  background: inherit; z-index: 1; }
.ribbon .seg:last-child::after { display: none; }
@media (max-width: 860px) {
  .ribbon { grid-template-columns: 1fr; }
  .ribbon .seg { border-right: none; border-bottom: 1px solid var(--rule); }
  .ribbon .seg::after { display: none; }
}

/* ---- ICON SYSTEM (R-DESIGN-V3 §1a): one self-hosted stroke sprite ---- */
.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px; }
.i-lg { width: 20px; height: 20px; vertical-align: -4px; }
.nav-group a .i { margin-right: 10px; color: var(--ink-soft); }
.nav-group a[aria-current="page"] .i { color: var(--accent); }

/* ---- DENSITY PASS (§1c/§1d) ---- */
h1 { font-size: 22px; letter-spacing: -0.01em; }
.widget > h2, .widget-head h2 { font-size: 15px; font-weight: 600; }
.widget-head { display: flex; align-items: center; gap: var(--s1); margin-bottom: 2px; }
.widget-head h2 { margin: 0; flex: 1; }
.sidebar { padding: var(--s2) 0; }
.sidebar .brand { padding: 0 var(--s3) var(--s2); font-size: 15px; }
.nav-group { margin-bottom: var(--s2); }
.nav-group a { padding: 6px var(--s3); display: flex; align-items: center; }
.topbar { padding: 10px var(--s4); box-shadow: var(--lift-1); }
.provenance, .freshness, .meta { font-size: 12px; }

/* Stat chips: number-first row under the hero */
.chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); }
@media (max-width: 860px) { .chips { grid-template-columns: repeat(2, 1fr); } }
.chip { background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 10px var(--s2);
  box-shadow: var(--lift-1), var(--inner-edge); }
.chip .k { display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--ink-soft); font-weight: 600; }
.chip .v { font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 21px; font-weight: 700; margin-top: 2px; }
.chip .spark { display: block; margin-top: 4px; }

/* Sortable data table (findings list view) */
.ledger th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ledger th.sortable .i { opacity: 0.55; }
.ledger th[aria-sort] .i { opacity: 1; color: var(--accent); }
.ledger tbody tr { transition: background var(--t-fast) var(--ease); }
.ledger tbody tr:hover { background: var(--surface-tint); }
.ledger tbody tr.expanded { background: var(--surface-tint); }
.sev { font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 1px 7px; border-radius: 3px;
  border: 1px solid transparent; }
.sev-high { color: var(--waste); background: var(--waste-bg); border-color: var(--waste-line); }
.sev-med { color: var(--estimate); background: var(--estimate-bg); border-color: var(--estimate-line); }
.sev-low { color: var(--ink-soft); background: var(--surface-tint); border-color: var(--rule); }

/* Charts: real axes, gridlines, target bands (§1b) */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .axis-label { font: 10px var(--sans); fill: var(--ink-soft); }
.chart .area { opacity: 0.12; }
.chart .target-band { fill: var(--verified); opacity: 0.10; }
.chart .target-line { stroke: var(--verified); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .plot { fill: none; stroke-width: 2; stroke-linejoin: round; }
/* draw-in on first paint (ADDENDUM 2d) */
.chart .plot.draw { stroke-dasharray: 1000; stroke-dashoffset: 1000;
  animation: draw 900ms var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- HELP AFFORDANCES (§2b): "?" per widget ---- */
.help { position: relative; display: inline-flex; }
.help > summary { list-style: none; cursor: pointer; width: 20px; height: 20px;
  border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-soft);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.help > summary:hover { color: var(--accent); border-color: var(--accent); }
.help[open] > summary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.help-body { position: absolute; right: 0; top: 26px; z-index: 30; width: 300px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--lift-3); padding: var(--s2);
  font-size: 13px; text-align: left; animation: swap-in var(--t-fast) var(--ease); }
.help-body dt { font-weight: 600; margin-top: var(--s1); }
.help-body dt:first-child { margin-top: 0; }
.help-body dd { margin: 2px 0 0; color: var(--ink-soft); }

/* ---- GUIDED TOUR (§2a): spotlight + popover ---- */
.tour-veil { position: fixed; inset: 0; background: var(--veil);
  z-index: 40; }
.tour-spot { position: absolute; z-index: 41; border-radius: var(--radius);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 0 0 9999px var(--veil);
  pointer-events: none; }
.tour-pop { position: absolute; z-index: 42; width: 340px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--lift-3); padding: var(--s3); }
.tour-pop .step { font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); }
.tour-pop h3 { margin: 4px 0 var(--s1); font-size: 16px; }
.tour-pop p { margin: 0 0 var(--s2); font-size: 14px; color: var(--ink-soft); }
.tour-pop .row { display: flex; align-items: center; gap: var(--s1); }
.tour-pop .row .spacer { flex: 1; }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--rule); }
.tour-dots i.on { background: var(--accent); }

/* ---- WORKFLOW BREADCRUMBS (§2d) ---- */
.steps-bar { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.steps-bar .step-n { display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--rule); color: var(--ink-soft); }
.steps-bar .cur .step-n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps-bar .done .step-n { background: var(--verified-bg); border-color: var(--verified-line);
  color: var(--verified); }
.steps-bar .lbl { font-size: 13px; color: var(--ink-soft); }
.steps-bar .cur .lbl { color: var(--ink); font-weight: 600; }

/* Print = CFO-forwardable (report + statement inherit at WP-7) */
@media print {
  body { background: var(--surface); font-size: 12px; }
  .card { box-shadow: none; border-color: var(--rule-strong); break-inside: avoid; }
  .no-print { display: none !important; }
}


/* ============================================================
   v4 UNIFY — surfaces the design system had never reached.
   Added when /sources, /upload and /legal were brought onto the
   system; the app shell's own sidebar had been linking OUT of
   the design into base.html pages.
   ============================================================ */

/* The brand mark, shared by both shells. Previously the public shell drew a
   double-rule mark and the app sidebar rendered plain text, so the logo
   changed as a visitor crossed into the product (v4 ux gate f.1). ONE
   definition here rather than a copy per shell. */
.brand .mark {
  width: 16px; height: 16px; flex: 0 0 16px; display: inline-block;
  border: 1.5px solid var(--accent); border-bottom-width: 4px; border-radius: 2px;
}
.sidebar .brand { display: flex; align-items: center; gap: var(--s1); }

.page-h1 { font: 600 22px var(--sans); margin: 0 0 var(--s1); letter-spacing: -0.015em; }
.purpose-line { font-size: 14px; color: var(--ink-soft); max-width: 68ch; margin: 0 0 var(--s3); line-height: 1.6; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.addbar { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s3); }
.addbar-note { font-size: 13px; }
.inline-form { display: inline; }

.sources-table { width: 100%; border-collapse: collapse; }
.src-name { display: flex; align-items: center; gap: var(--s2); }
.src-name b { font-weight: 600; }
.src-name .sub { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-ok { background: var(--verified); }
.dot-warn { background: var(--estimate); }
.row-actions { text-align: right; white-space: nowrap; }

.drawer { background: var(--surface-tint); }
.drawer td { padding: var(--s3); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s3); font-size: 13px; margin: 0; }
.dl dt { color: var(--ink-soft); }
.dl dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* The counts-only promise, stated where the risk is felt rather than buried
   in the privacy policy (FR-22 discipline). */
.counts-note {
  font-size: 13px; color: var(--ink-soft); border-left: 2px solid var(--accent);
  padding-left: var(--s2); margin: var(--s3) 0 0; max-width: 68ch; line-height: 1.6;
}

/* Upload */
.drop {
  border: 1.5px dashed var(--rule); border-radius: var(--radius); background: var(--surface);
  padding: var(--s6) var(--s3); text-align: center;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.drop:hover, .drop:focus-within { border-color: var(--accent); background: var(--surface-tint); }
.drop h3 { font: 600 17px var(--sans); margin: 0 0 var(--s1); }
.drop p { color: var(--ink-soft); font-size: 14px; margin: 0 auto var(--s3); max-width: 44ch; line-height: 1.6; }
.limits { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: var(--s3); }
.limits span { padding-left: var(--s2); border-left: 1px solid var(--rule); }
.limits span:first-child { border-left: 0; padding-left: 0; }

@media (max-width: 720px) {
  .sources-table thead { display: none; }
  .sources-table td { display: block; border-bottom: 0; padding: 4px var(--s2); }
  .sources-table tr { display: block; border-bottom: 1px solid var(--rule); padding: var(--s2) 0; }
  .row-actions { text-align: left; }
}

/* ============================================================
   COMPONENT KIT (R-DESIGN-TOKENS-2 §3 · values per R-LOOK-FINAL)
   Every rule below references ROLE TOKENS only. Controls and widget
   chrome take --control-depth; data surfaces stay flat-crisp.
   ============================================================ */

/* ---- Surface ---- */
.widget { background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--lift-1); padding: var(--s3); }
.widget-raised { box-shadow: var(--lift-2); }
.widget-head { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--s2); }
.widget-head h2 { font: 600 15px var(--sans); margin: 0; letter-spacing: -.01em; }
.widget-meta { margin-left: auto; font: 500 12px var(--mono); color: var(--ink-soft); }

/* ---- Stat chip: widget chrome, so it carries control depth ---- */
.stat-card { background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: var(--s3); box-shadow: var(--control-depth); }
.stat-k { font: 600 12px var(--sans); color: var(--ink-soft); margin-bottom: 6px; }
.stat-v { font-size: 26px; font-weight: 640; letter-spacing: -.025em; }
.stat-m { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.tone-waste { color: var(--waste); }
.tone-verified { color: var(--verified); }

/* ---- Money: flat, crisp, tabular. Never inside a bevel. ---- */
.money { font-variant-numeric: tabular-nums; color: var(--money);
  letter-spacing: -.02em; box-shadow: none; }
.money-hero { font-size: 54px; font-weight: 660; line-height: 1.02; letter-spacing: -.035em; }
.money-lg { font-size: 26px; font-weight: 640; }
.money-sm { font-size: 17px; font-weight: 620; }

/* ---- SIGNATURE: the accountant's double rule ---- */
.total-rule { border-top: 1px solid var(--rule-strong);
  border-bottom: 3px double var(--rule-strong); height: 3px; margin: 10px 0 0; max-width: 320px; }
.savings-hero .cap { font: 600 12px var(--sans); color: var(--ink-soft); margin: 0 0 var(--s1); }
.hero-since { margin: var(--s2) 0 0; }
.hero-note { color: var(--ink-soft); font-size: 13px; margin: var(--s3) 0 0; line-height: 1.55; }

/* ---- SIGNATURE: the pipeline ribbon ---- */
.ribbon { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap;
  background: var(--surface-raised); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 10px var(--s2); box-shadow: var(--control-depth); }
.stage { display: inline-flex; align-items: center; gap: 8px; font: 600 12.5px var(--sans);
  color: var(--ink-soft); padding: 4px 10px; border-radius: 999px; }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }
.stage-done { color: var(--verified); }
.stage-done .stage-dot { opacity: 1; }
.stage-now { color: var(--accent); background: var(--surface); box-shadow: var(--control-depth); }
.stage-now .stage-dot { opacity: 1; }

/* ---- DataTable: flat-crisp, no depth ---- */
.ledger { width: 100%; border-collapse: collapse; box-shadow: none; }
.ledger th { font: 600 10px var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-soft); text-align: left; padding: 0 var(--s1) 9px; border-bottom: 1px solid var(--rule); }
.ledger th.r, .ledger td.r { text-align: right; }
.ledger td { padding: 11px var(--s1); border-bottom: 1px solid var(--rule); font-size: 14px; }
.ledger tbody tr:hover td { background: var(--surface-raised); }
.ledger td.r.money { font-weight: 640; }
.rt { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); }

/* ---- FindingCard, three renderers ---- */
.sev { display: inline-block; font: 700 9.5px var(--mono); letter-spacing: .06em;
  padding: 2px 6px; border-radius: 4px; margin-right: 10px; }
.sev-hi, .sev-high { color: var(--waste); background: var(--waste-bg); }
.sev-md, .sev-med { color: var(--estimate); background: var(--estimate-bg); }
.sev-lo, .sev-low { color: var(--ink-soft); background: var(--surface-raised); }
.finding-detail h4 { font: 600 13px var(--sans); margin: var(--s2) 0 4px; }
.finding-detail p { color: var(--ink-soft); font-size: 13.5px; margin: 0; line-height: 1.6; }
.finding-summary { display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid var(--rule); }
.fs-head { font-weight: 550; font-size: 14.5px; }
.finding-summary .money { margin-left: auto; }

/* ---- rows, source cards, alerts ---- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.row:last-of-type { border-bottom: 0; }
.row .grow { flex: 1; }
.row-t { font-weight: 550; font-size: 14.5px; }
.source-card { display: flex; align-items: center; gap: 12px; padding: var(--s2);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--control-depth); margin-bottom: var(--s1); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-ok { background: var(--verified); }
.dot-warn { background: var(--estimate); }
.dot-neutral { background: var(--ink-soft); }

/* ---- WizardSteps: control chrome ---- */
.steps-bar { display: flex; align-items: center; gap: var(--s2); list-style: none;
  padding: 0; margin: 0 0 var(--s4); flex-wrap: wrap; }
.steps-bar li { display: flex; align-items: center; gap: 8px; font: 600 12.5px var(--sans);
  color: var(--ink-soft); }
.step-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 700 11px var(--mono); background: var(--surface-raised); color: var(--ink-soft);
  box-shadow: var(--control-depth); }
.steps-bar .cur { color: var(--ink); }
.steps-bar .cur .step-n { background: var(--accent); color: var(--on-accent); }
.steps-bar .done .step-n { background: var(--verified-bg); color: var(--verified); }

/* ---- form primitives: controls, so they carry depth ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 var(--s3); }
.field label { font: 600 13.5px var(--sans); }
.field input, .field select { padding: 11px 13px; border: 1px solid var(--rule);
  border-radius: var(--radius); font: 15px var(--sans); background: var(--surface);
  color: var(--ink); box-shadow: var(--control-depth); }
.field input.money { text-align: right; font-variant-numeric: tabular-nums; }
.field input:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field .hint { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.field-bool label { display: flex; align-items: center; gap: 10px; font-weight: 500; }

/* ---- honest states ---- */
.empty { text-align: center; padding: var(--s6) var(--s3); }
.empty h3 { font: 600 17px var(--sans); margin: 0 0 var(--s1); }
.empty p { color: var(--ink-soft); font-size: 14px; max-width: 46ch; margin: 0 auto var(--s3); line-height: 1.6; }
.errorstate { border: 1px solid var(--waste-line); background: var(--waste-bg);
  border-radius: var(--radius); padding: var(--s3); }
.errorstate h3 { font: 600 15px var(--sans); margin: 0 0 6px; color: var(--waste); }
.errorstate p { color: var(--ink-soft); font-size: 14px; margin: 0 0 var(--s2); line-height: 1.6; }
/* money never shimmers — explicit words instead of a pulsing placeholder */
.computing { font: 500 14px var(--sans); color: var(--ink-soft); margin: var(--s2) 0; }
.skeleton { display: grid; gap: 8px; }
.skel-line { height: 11px; border-radius: 4px; background: var(--surface-raised); display: block; }
.skel-line:nth-child(2) { width: 82%; }
.skel-line:nth-child(3) { width: 64%; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ============================================================
   DESIGN AUDIT REMEDIATION (founder order 2026-07-26)
   F1 hero band · F2 chart craft · F6 stat scale · F9 field ·
   F10 mobile targets. Tokens only; hybrid depth law untouched.
   ============================================================ */

/* F6 — the stat scale. .stat-lg was consumed by widgets but never defined:
   values rendered at browser-default size (audit: "4 days" read as body
   text). Stat values sit on the money scale, flat and tabular. */
.stat-lg { font-family: var(--sans); font-size: 26px; font-weight: 680;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--money);
  margin: 2px 0 4px; }

/* F1 — the savings band: hero left, supporting stats right. The hero column
   distributes over the band's full height so neither side trails a void. */
.savings-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s4); align-items: stretch; }
.savings-grid > div:first-child { display: flex; flex-direction: column; }
.savings-grid > div:first-child > div:last-child { margin-top: auto; padding-top: var(--s3); }
.savings-side { display: grid; gap: var(--s2); }
.savings-side .stat-card { margin: 0; }
@media (max-width: 900px) { .savings-grid { grid-template-columns: 1fr; } }

/* F2 — chart craft: endpoint dot + value, area fill. Flat per the law. */
.plot-fill { opacity: .08; stroke: none; }
.plot-dot { stroke: var(--surface-raised); stroke-width: 1.5; }
.plot-end { font-weight: 700; fill: var(--ink); }

/* F9 — inline field: the one form control on the money surface must not
   read browser-default. */
input.field-inline { width: 8em; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 6px 8px; font: 600 13px var(--sans); text-align: right;
  font-variant-numeric: tabular-nums; background: var(--surface-raised);
  color: var(--ink); box-shadow: var(--control-depth); }
input.field-inline:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* F10 — mobile tap targets >= 44px (WCAG 2.5.8 / audit i). */
@media (max-width: 720px) {
  .nav-group a, .btn, .tour-tab { min-height: 44px; display: inline-flex;
    align-items: center; }
  .nav-group a { display: flex; }
}

/* Pipeline theater (R-PIPELINE-UI-SEQ carve-out): the in-flight stage reuses
   the A6 status pulse — a status indicator, not a transition. */
.ribbon .seg.live { background: var(--surface-tint); border-radius: var(--radius); }
.ribbon .seg.live .stage-name { color: var(--accent-ink);
  animation: stage-pulse 1.6s var(--ease) infinite; border-radius: var(--radius-sm); }
.theater-done { margin-top: var(--s3); }
.theater-rejects { margin-top: var(--s2); font-size: 13.5px; }
