/* ═══ Design tokens: the one token file (docs/UI_BRAND.md, on the layout of docs/UI_CONTROL_TOWER.md section 2) ═════
   Loaded first by index.html, before base.css. Light values on :root; the dark values are written twice and must stay
   identical (tests/ui_foundation.test.js compares them): under the prefers-color-scheme guard (no explicit choice) and
   under [data-theme="dark"] (the theme control sets data-theme on <html>).
   The Autowhat brand (autowhat.ai): white surfaces on an ice-turquoise page, turquoise as the one brand and action colour,
   turquoise-tinted hairlines and soft teal shadows; dark is a deep teal-navy with a brighter turquoise. The compact
   control-tower scale stays (13 px base, 12 px tables, caps labels, 29 px rows, 212 px sidebar, 44 px top bar).
   Three teals, three jobs: --brand / --accent-bright is the turquoise of the mark (#00a7c9: stripes, the logo tile,
   rules, decorative marks; never text, never white text on it); --accent is the deeper action teal (#087d93: buttons with
   white text at 4.8:1, focus rings, active edges); --accent-text the teal for words (links, eyebrows, the soft fills).
   Soft fills are the solid colour composited on the surface (so the contrast test can read them as hex); every text token
   passes WCAG AA on the fill it is used on (the measured table is in docs/UI_BRAND.md section 3).
   Fonts: Source Sans 3 300–700 (everything), IBM Plex Mono 400–600 (ids, table numbers, eyebrows), Noto Sans Devanagari
   (Hindi) and Newsreader 500 (the sign-in tagline only) come from the Google Fonts <link> in index.html; every family ends
   in a system stack, so a missing font still renders. */

:root {
  color-scheme: light;
  /* surfaces: the ice page, white cards, ice insets */
  --bg: #eef5f6;
  --bg-glow: radial-gradient(1100px 340px at 82% -90px, rgba(0, 167, 201, .11), transparent 70%), radial-gradient(700px 260px at -5% -60px, rgba(9, 187, 223, .06), transparent 70%);
  --surface: #ffffff;
  --surface-2: #f0f8fa;
  --surface-3: #dff0f4;
  --sel: #e2f4f8;
  --line: rgba(0, 140, 170, .16);
  --line-2: rgba(0, 105, 130, .30);
  /* the brand's ice steps (autowhat.ai bone, bone-2, bone-3): table heads, washes, the KPI's top light, empty states */
  --ice-1: #f2fbfd;
  --ice-2: #e3f6fa;
  --ice-3: #c9eef6;
  /* ink: teal-black, teal-grey. --muted is the meta text (AA on --bg, --surface and every tinted fill it sits on:
     --surface-2, --surface-3, --sel, the soft fills); --faint is never text (icons, axis lines, empty dots) */
  --ink: #1f2a2e;
  --ink-2: #4b585b;
  --muted: #4a6d73;
  --faint: #789fa5;
  /* human action: the deeper teal (white text 4.8:1); --accent-bright is the brand turquoise for non-text marks */
  --accent: #087d93;
  --accent-hover: #076a7d;
  --accent-ink: #ffffff;
  --on-accent: var(--accent-ink);
  --accent-text: #067087;
  --accent-soft: #e0f4f8;
  --accent-line: #a6dde9;
  --accent-bright: #00a7c9;
  --accent-shadow: 0 1px 2px rgba(6, 60, 72, .22), 0 6px 14px -6px rgba(8, 125, 147, .55);
  /* the brand motif: the eyebrow's teal words and the short rule under a heading */
  --eyebrow: var(--accent-text);
  --rule: var(--accent-bright);
  /* agent: only what the AI did, proposes, derived or noticed (violet: apart from the teal of a person's action) */
  --ai: #7357d9;
  --ai-text: #5a3fc0;
  --ai-soft: #f2effd;
  --ai-line: #d8cff7;
  /* state: solid / text / soft / line (the solid steps are the fixed status palette, the same in both themes) */
  --good: #0ca30c;
  --good-text: #0b7a0b;
  --good-soft: #e2f4e2;
  --good-line: #aadfaa;
  --warn: #fab219;
  --warn-text: #946100;
  --warn-soft: #fef4df;
  --warn-line: #fddc98;
  --crit: #d03b3b;
  --crit-text: #b42a2a;
  --crit-soft: #f9e7e7;
  --crit-line: #efbaba;
  --crit-ink: #ffffff;
  --block: #b42318;
  --block-ink: #ffffff;
  --info: #1d5fbf;
  --info-ink: #ffffff;
  --info-text: #1d5fbf;
  --info-soft: #e8eff9;
  --draft-line: #9bafb2;
  /* money */
  --money-in: var(--good-text);
  --money-out: var(--ink);
  --money-loss: var(--crit-text);
  /* brand: the turquoise of the mark. The logo tile, the sidebar's 3 px stripe and the phone '+' only, never status */
  --brand: #00a7c9;
  --brand-ink: #062f38; /* text and icons on --brand (5.0:1; white is 2.9:1): the same in both themes, as --brand is */
  /* charts: the brand's categorical series, turquoise first, in this fixed order (never cycled: a 9th series folds into
     "Other"). Validated with the dataviz checks on white and on the dark surface: every adjacent pair ≥ 10.7 ΔE under
     protan / deutan and ≥ 21 to normal vision, the first three apart in any pairing (docs/UI_BRAND.md section 6) */
  --s1: #0a9bba;
  --s2: #eb6834;
  --s3: #4a5fc1;
  --s4: #eda100;
  --s5: #d9569a;
  --s6: #2f9a3a;
  --s7: #7a3fb0;
  --s8: #e34948;
  --spark: var(--s1);
  --grid: #e3f1f4;
  --axis: #badbe1;
  /* map and video-wall chrome: the website's near-black teal (hue ~193°, the dark theme's own), the same in both themes */
  --map-bg: #06161b;
  --map-land: #0d242b;
  --map-line: #1d4550;
  /* type: Source Sans 3 for everything (titles and big numbers at 600 with tabular figures), Plex Mono for ids, numbers in
     tables and eyebrows; --font-cond is kept as an alias of --font-head for the sheets that still name it */
  --font-ui: "Source Sans 3", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-head: "Source Sans 3", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-cond: var(--font-head);
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  /* Source Sans 3 has a smaller x-height than Plex Sans (486 vs 516 units), so the scale sits half a pixel up to read the
     same at the same density */
  --fs-xs: 10.5px;
  --lh-xs: 14px;
  --fs-cap: 11px;
  --ls-cap: .06em;
  --ls-eyebrow: .12em;
  --fs-meta: 11px;
  --lh-meta: 15px;
  --fs-note: 11.5px; /* small buttons, segmented control, chips, tile subs, seg notes, mono ids in a table */
  --fs-small: 12px;
  --lh-small: 16px;
  --fs-table: 12px;
  --fs-body: 13px;
  --lh-body: 18px;
  --fs-title-row: 13px;
  --fs-h3: 13px;
  --lh-h3: 18px;
  --fs-mini: 14.5px; /* the value of a mini status tile */
  --lh-mini: 18px;
  --fs-topbar: 16px;
  --fs-h2: 22px;
  --lh-h2: 28px;
  --ls-title: -.015em;
  --fs-kpi: 23px;
  --lh-kpi: 26px;
  --fs-money-l: 22px;
  --lh-money-l: 26px;
  --fs-money-xl: 26px;
  --lh-money-xl: 30px;
  /* spacing (4-pt) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
  --gutter: 14px;
  --gap: 10px;
  /* density */
  --row-h: 30px;
  --row-h-dense: 29px;
  --row-h-cozy: 40px;
  --row-h-touch: 44px;
  --control-h: 28px;
  --control-h-sm: 24px;
  --control-h-xs: 20px;
  --control-h-touch: 44px;
  --nav-w: 212px;
  --nav-item-h: 30px;
  --topbar-h: 44px;
  /* radius: controls 6, cards 8, sheets 12, chips and the floating button round */
  --r-xs: 3px;
  --r-nav: 6px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-tile: 8px;
  --r-lg: 12px;
  --r-pill: 999px;
  /* elevation: soft teal shadows (autowhat.ai's rgba(6, 60, 72, …)) */
  --e1: 0 1px 2px rgba(6, 60, 72, .06), 0 4px 14px rgba(6, 60, 72, .06);
  --e1-hover: 0 2px 4px rgba(6, 60, 72, .07), 0 12px 28px -8px rgba(6, 60, 72, .22);
  --e2: 0 4px 10px rgba(6, 60, 72, .10), 0 18px 40px -8px rgba(6, 60, 72, .24);
  --e3: 0 18px 50px -10px rgba(6, 60, 72, .34);
  --shadow: var(--e1);
  --shadow-lg: var(--e3);
  --highlight: 0 0 #0000; /* a valid, invisible shadow: `var(--e1), var(--highlight)` must stay a valid list */
  /* motion */
  --t-fast: 120ms;
  --t-med: 180ms;
  --t-exit: 240ms;
  --t-sheet: 240ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* focus: the action teal (4.8:1 on white, 4.4:1 on the page) outside a surface gap */
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  /* the calm scale (docs/UI_PRO.md 1.3): forms, tasks and the record page opt in with the class "calm"; lists, the tower
     and the shell keep the control-tower scale above. Sizes, then neutrals mixed from the ink (they follow the theme, so
     they have no dark value), the two rings, the three shadows (these do have a dark value) and the column widths */
  --h-ctl: 38px;
  --h-ctl-sm: 32px;
  --h-row: 60px;
  --fs-ctl: 14px;
  --lh-ctl: 20px;
  --fs-sec: 15px;
  --lh-sec: 22px;
  --hair: color-mix(in srgb, var(--ink) 9%, var(--surface));
  --edge: color-mix(in srgb, var(--ink) 50%, var(--surface)); /* a control's border: 3.04:1 on white, 4.63:1 on the dark surface */
  --edge-2: color-mix(in srgb, var(--ink) 70%, var(--surface));
  --inset: color-mix(in srgb, var(--ink) 3.5%, var(--surface));
  --inset-2: color-mix(in srgb, var(--ink) 7%, var(--surface));
  --ring-ctl: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);
  --ring-crit: 0 0 0 3px var(--crit-soft);
  --e-card: 0 1px 2px rgba(6, 60, 72, .06);
  --e-pop: 0 0 0 1px var(--hair), 0 8px 28px -6px rgba(6, 60, 72, .28);
  --e-bar: 0 -6px 18px -12px rgba(6, 60, 72, .30);
  --w-form: 768px;
  --w-index: 196px;
  --w-aside: 360px;
  --w-list: 1040px;
  /* legacy aliases kept so the existing CSS keeps working */
  --serious: #ec835a;
  --serious-text: #a84a23;
  --serious-soft: #fcebe5;
  --brand-red: var(--brand);
}

/* dark: written twice, identical */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a171b;
    --bg-glow: radial-gradient(1100px 340px at 82% -90px, rgba(44, 198, 230, .10), transparent 70%), radial-gradient(700px 260px at -5% -60px, rgba(44, 198, 230, .05), transparent 70%);
    --surface: #0f2127;
    --surface-2: #142a31;
    --surface-3: #1b353d;
    --sel: #123b45;
    --line: rgba(140, 225, 240, .11);
    --line-2: rgba(140, 225, 240, .22);
    --ice-1: #0e2931;
    --ice-2: #0d313a;
    --ice-3: #0c3e4b;
    --ink: #e7f3f5;
    --ink-2: #b3c9cd;
    --muted: #8eabb0;
    --faint: #557a81;
    --accent: #22b5d3;
    --accent-hover: #4cc6df;
    --accent-ink: #04212a;
    --accent-text: #5ccde5;
    --accent-soft: #0f3842;
    --accent-line: #1f5d6b;
    --accent-bright: #2cc6e6;
    --accent-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 16px -6px rgba(34, 181, 211, .35);
    --ai: #a593f7;
    --ai-text: #b9abff;
    --ai-soft: #1e1d3d;
    --ai-line: #433b7f;
    --good-text: #3fc43f;
    --good-soft: #0f3623;
    --good-line: #1f5a35;
    --warn-text: #f5c04a;
    --warn-soft: #303525;
    --warn-line: #5f5222;
    --crit-text: #f27c7c;
    --crit-soft: #32262b;
    --crit-line: #5e3438;
    --block: #c4322a;
    --block-ink: #ffffff;
    --info: #7fb2ff;
    --info-ink: #0a171b;
    --info-text: #86b8ff;
    --info-soft: #1f3545;
    --draft-line: #5b7c84;
    --s1: #109fbe;
    --s2: #d95926;
    --s3: #6b6fdc;
    --s4: #c98500;
    --s5: #c94a8a;
    --s6: #3aa845;
    --s7: #9a6cd8;
    --s8: #e66767;
    --grid: #15313a;
    --axis: #22434d;
    --e1: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .28);
    --e1-hover: 0 2px 4px rgba(0, 0, 0, .40), 0 12px 28px -8px rgba(0, 0, 0, .50);
    --e2: 0 6px 16px rgba(0, 0, 0, .45);
    --e3: 0 16px 48px rgba(0, 0, 0, .60);
    --highlight: inset 0 1px 0 rgba(140, 225, 240, .05);
    --e-card: 0 1px 2px rgba(0, 0, 0, .35);
    --e-pop: 0 0 0 1px var(--hair), 0 8px 28px -6px rgba(0, 0, 0, .60);
    --e-bar: 0 -6px 18px -12px rgba(0, 0, 0, .60);
    --serious-text: #f0966f;
    --serious-soft: #30302f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a171b;
  --bg-glow: radial-gradient(1100px 340px at 82% -90px, rgba(44, 198, 230, .10), transparent 70%), radial-gradient(700px 260px at -5% -60px, rgba(44, 198, 230, .05), transparent 70%);
  --surface: #0f2127;
  --surface-2: #142a31;
  --surface-3: #1b353d;
  --sel: #123b45;
  --line: rgba(140, 225, 240, .11);
  --line-2: rgba(140, 225, 240, .22);
  --ice-1: #0e2931;
  --ice-2: #0d313a;
  --ice-3: #0c3e4b;
  --ink: #e7f3f5;
  --ink-2: #b3c9cd;
  --muted: #8eabb0;
  --faint: #557a81;
  --accent: #22b5d3;
  --accent-hover: #4cc6df;
  --accent-ink: #04212a;
  --accent-text: #5ccde5;
  --accent-soft: #0f3842;
  --accent-line: #1f5d6b;
  --accent-bright: #2cc6e6;
  --accent-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 16px -6px rgba(34, 181, 211, .35);
  --ai: #a593f7;
  --ai-text: #b9abff;
  --ai-soft: #1e1d3d;
  --ai-line: #433b7f;
  --good-text: #3fc43f;
  --good-soft: #0f3623;
  --good-line: #1f5a35;
  --warn-text: #f5c04a;
  --warn-soft: #303525;
  --warn-line: #5f5222;
  --crit-text: #f27c7c;
  --crit-soft: #32262b;
  --crit-line: #5e3438;
  --block: #c4322a;
  --block-ink: #ffffff;
  --info: #7fb2ff;
  --info-ink: #0a171b;
  --info-text: #86b8ff;
  --info-soft: #1f3545;
  --draft-line: #5b7c84;
  --s1: #109fbe;
  --s2: #d95926;
  --s3: #6b6fdc;
  --s4: #c98500;
  --s5: #c94a8a;
  --s6: #3aa845;
  --s7: #9a6cd8;
  --s8: #e66767;
  --grid: #15313a;
  --axis: #22434d;
  --e1: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .28);
  --e1-hover: 0 2px 4px rgba(0, 0, 0, .40), 0 12px 28px -8px rgba(0, 0, 0, .50);
  --e2: 0 6px 16px rgba(0, 0, 0, .45);
  --e3: 0 16px 48px rgba(0, 0, 0, .60);
  --highlight: inset 0 1px 0 rgba(140, 225, 240, .05);
  --e-card: 0 1px 2px rgba(0, 0, 0, .35);
  --e-pop: 0 0 0 1px var(--hair), 0 8px 28px -6px rgba(0, 0, 0, .60);
  --e-bar: 0 -6px 18px -12px rgba(0, 0, 0, .60);
  --serious-text: #f0966f;
  --serious-soft: #30302f;
}

/* phones: a 16 px gutter and touch-height controls (the calm scale too: 44 px controls, 16 px text); a coarse pointer
   gets touch-height rows */
@media (max-width: 767px) { :root { --gutter: 16px; --control-h: var(--control-h-touch); --h-ctl: var(--control-h-touch); --h-ctl-sm: 38px; --h-row: 64px; --fs-ctl: 16px; --lh-ctl: 22px; } }
@media (pointer: coarse) { :root { --row-h: var(--row-h-touch); } }
@media (prefers-reduced-motion: reduce) { :root { --t-fast: 0ms; --t-med: 0ms; --t-exit: 0ms; --t-sheet: 0ms; } }
