/* Design tokens. Colours live only here. app.css and public.css consume them.
   Dark theme overrides colours (and the two shadows) and nothing else: typography, spacing,
   radii and breakpoints stay the same. prefers-color-scheme is the default until the visitor
   chooses; [data-theme="light"|"dark"] on <html> is the remembered choice (theme-early.js).
   Stage 3 took away the per-page [data-dark-ready] guard: every screen of the shell paints
   with these tokens and nothing else, so the theme is global. The public pages (/login,
   /register, /privacy) carry data-theme="light" in their own markup instead, deliberately --
   the login art was drawn for a light screen (docs/DESIGN_SYSTEM.md).
   Fixed breakpoints are repeated as literals in app.css media queries, because a custom
   property cannot be read from a media query. --tint-members / --edge-members have a pair in
   both themes: the light one came with #162 (the consist card's members section), the dark one
   with #164.

   Palette "B + accent from C" (owner brief 13.11.2026, Phoenix TMS rebrand). The menu is dark
   in BOTH themes, so it has its own --side-* family instead of borrowing --ink / --muted, and
   the top bar moved off --side-bg onto --top-bg (on a near-black bar the breadcrumb, which is
   --ink, would have been invisible).

   Three values are NOT the hex the brief named, because the brief also asks for >= 4.5:1 on
   every text and button pair and those three miss it (tests/test_token_contrast.py has the
   figures):
     --accent light      #C2610F -> #A9540A   white-on-accent was 4.19:1, link on --bg 3.88:1
     --chip-ok-fg light  #1E7F4F -> #1C7849   4.38:1 on its own background
     --chip-notice-fg    #8A6A00 -> #876700   4.47:1 on its own background
   Max confirmed all three on 13.11.2026, with the measured ratios in front of him: the >= 4.5:1
   check wins over the exact hex. White text on #C2610F cannot reach 4.5:1 on any background, so
   an accent that carries a button label had to be a step darker.
   Nothing else moved: the dark theme passes the brief's hexes as given.

   Follow-up 14.11.2026 (owner brief, "make the data blocks stand out"): the page background
   went a step darker in both themes and the blocks got a border and a shadow of their own.
   --card-line is a step darker than --line, which is still the divider inside a block (table
   rules, fieldsets, the section bars). The shadow is two layers so the lift reads at both
   distances; dark has none, because on a dark page a shadow only muddies the edge and the
   card already separates by lightness. Measured after the change (same arithmetic as
   tests/test_token_contrast.py):
     light --muted on --bg   5.34:1 -> 4.92:1   still over 4.5:1, left as it is
     light --accent on --bg  4.91:1 -> 4.53:1   the narrowest pair in the file
     light --ink on --bg    14.63:1 -> 13.49:1
     dark  every --bg pair rises, the background moved away from the text
   The card now stands off the page by 1.17:1 light (was 1.08:1) and 1.16:1 dark (was 1.12:1).

   Follow-up 2, 14.11.2026 (owner brief, "the blocks need volume and the tables need reading"):
   the block shadow went up to two deeper layers and came back in the dark theme, --line went
   a step darker so a row divider is visible, and a table inside a block got four surfaces of
   its own (--table-head-bg, --row-alt, --row-hover, --filters-bg). NOTE: --line light is now
   #D9DBDF, the same value as --card-line, and the two were already equal in the dark theme --
   so the two tokens now hold the same colour everywhere. They are kept apart because they
   answer different questions (the outline of a block vs a divider inside it) and the owner may
   move one without the other; nothing in the product depends on them being equal.
   Measured on the new surfaces, both themes, every pair over 4.5:1; the tightest is --accent
   on --row-hover at 4.57:1 light. The figures are in docs/DESIGN_SYSTEM.md.

   Follow-up 3, 14.11.2026 (owner brief, the form fields): one 40px well for every field, with
   --field-bg, --field-line and --field-shadow. The brief named one inset value,
   rgb(16 24 40 / 6%); at 6% of a near-black blue it is invisible on a dark field, so the dark
   block uses rgb(0 0 0 / 30%) for the same effect. Text in a field clears AA easily (15.80:1
   light, 14.64:1 dark); the boundary does not reach the 3:1 that WCAG 1.4.11 asks of a
   control, but it went from 1.39:1 to 1.61:1 light and 1.29:1 to 1.52:1 dark, and the focused
   state -- an --accent boundary at 5.30:1 light, 7.58:1 dark, plus a 3px --accent-soft ring --
   is the one that carries meaning.

   Follow-up 4, 14.11.2026: the owner settled the boundary and merged the two that drew it.
   --field-line light went #C9CCD1 -> #B4B8BE (1.61:1 -> 1.99:1 on a card) and dark took the
   old --control-border value, #3A3F46 -> #434950 (1.52:1 -> 1.78:1), so both themes moved the
   same way. --control-border is now an alias of --field-line: one line bounds a button and a
   field alike. 3:1 is deliberately NOT the target -- it would need about #91959B on a white
   card, which turns a form into a wireframe. */
:root { --top-h:56px; --accent:#A9540A; --accent-hover:#8E4A08; --accent-soft:#FDEBDB; --ink:#1F2328;
        --muted:#62666D; --line:#D9DBDF; --bg:#ECEDEF; --card:#FFFFFF; --top-bg:#FFFFFF;
        /* the data blocks (.card, .sheet, .panel). --line stays the divider INSIDE a block;
           the outline of the block itself is --card-line, one step darker, plus a shadow. */
        --card-line:#D9DBDF;
        --card-shadow:0 1px 3px rgb(16 24 40 / 10%), 0 8px 24px rgb(16 24 40 / 8%);
        /* a table inside a block: the header strip, the zebra, the row under the pointer, and
           the filter strip above the table. --row-hover light is the same value as
           --accent-soft on purpose (the owner asked for it); dark goes its own way, because a
           warm fill on a dark row reads as a selection, not as a hover. */
        --table-head-bg:#F3F4F6; --row-alt:#FAFAFB; --row-hover:#FDEBDB; --filters-bg:#F7F8F9;
        /* a form field. --field-bg light is the same white as --card on purpose (owner brief
           14.11.2026): on a white card a field is told apart by its boundary and the inset
           hairline, not by a fill; inside a fieldset, which is --filters-bg, the white well
           does stand out. --field-line is a step darker than --card-line, because a control
           boundary has to be found, not merely noticed. */
        --field-bg:#FFFFFF; --field-line:#B4B8BE;
        --field-shadow:inset 0 1px 2px rgb(16 24 40 / 6%);
        /* the brand colour is one value in both themes: the logo and large decorative accents
           only, never a button with white text on it (3.0:1 on white). It clears 3:1 on both
           menu backgrounds, which is where the mark actually sits. */
        --brand:#E76C23;
        /* the menu: dark in both themes, so its text, rules and hover are its own tokens */
        --side-bg:#1F2328; --side-ink:#E6E7E9; --side-muted:#A9AEB6; --side-line:#30343A;
        --side-hover:#2A2F36; --side-active-bg:#3B2A1A; --side-active-fg:#F59E42;
        --chip-overdue-fg:#B42318; --chip-overdue-bg:#FDE7E5;
        --chip-notice-fg:#876700; --chip-notice-bg:#FBF1C7;
        --chip-todo-fg:#4A5361; --chip-todo-bg:#ECEDEF;
        --chip-ok-fg:#1C7849; --chip-ok-bg:#E3F4EA;
        --chip-info-fg:#1D5FBF; --chip-info-bg:#E3EDFB;
        /* section tints of the .sheet component (app.css): a quiet background plus the colour
           of the left bar, one pair per section flavour (ui_sections.SECTION_KINDS). Kept close
           to --bg so several sections side by side read as one card, not as four alerts. */
        --tint-members:#FBF6F0; --edge-members:#C98A3C;
        --tint-trip:#F2F5FC; --edge-trip:#7E9BD4;
        --tint-logist:#F6F3FB; --edge-logist:#9A8CC9;
        --tint-cards:#FDF4E6; --edge-cards:#D79A3C;
        --tint-docs:#F1F7F2; --edge-docs:#6FA982;
        /* status of a box: ready (green), check (yellow), error (red), neutral. Light values
           match the chips so an old chip and a new status pill are the same colour. */
        --status-ready-fg:var(--chip-ok-fg); --status-ready-bg:var(--chip-ok-bg);
        --status-check-fg:var(--chip-notice-fg); --status-check-bg:var(--chip-notice-bg);
        --status-error-fg:var(--chip-overdue-fg); --status-error-bg:var(--chip-overdue-bg);
        --status-neutral-fg:var(--chip-todo-fg); --status-neutral-bg:var(--chip-todo-bg);
        --on-accent:#FFFFFF; --danger:#b00020;
        /* A button and a field are bounded by the same line, so --control-border is now an
           alias and --field-line is the value. The alias stays because login.css and
           calendar.css still name it, and neither is in scope here; nothing in app.css uses
           it any more. Drop it once those two are moved over. */
        --control-border:var(--field-line);
        /* the soft notice box of the card pages (.pf-hint) */
        --hint-bg:#FFF9EB; --hint-edge:#F1DFB0;
        /* text over a fixed dark scrim (the avatar overlay): the same in both themes */
        --on-scrim:#fff;
        /* the pins of the telemetry map, and the ring and letter on them (--on-scrim). One
           value for both themes, like --brand above: the Leaflet tiles come from our own
           server and are light whatever the theme, so a dark-theme pin would be a pastel dot
           on a light map (1.4-2.3:1 against its white ring). These are the light values of the
           chip families, which is also what the legend on a card wants. --pin-other is a light
           pin, so --pin-stale draws its outline and its letter instead of --on-scrim. */
        --pin-drive:#1C7849; --pin-stop:#1D5FBF; --pin-service:#876700;
        --pin-offline:#B42318; --pin-stale:#4A5361; --pin-other:#ECEDEF;
        --role-logist-fg:#2B4C9B; --role-logist-bg:#E8EEFB;
        --role-driver-fg:#1E6B3A; --role-driver-bg:#E6F4EA;
        --coverage-track:#BFE3CB; --coverage-gap-a:#D3D5D8; --coverage-gap-b:#EDEEF0;
        --attn-line:#EAEBED; --period-track:#EAEBED;
        --font-sans:Manrope, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
        --text-xs:0.75rem; --text-sm:0.875rem; --text-md:1rem;
        --text-lg:1.125rem; --text-xl:1.5rem; --text-2xl:1.75rem;
        --weight-regular:400; --weight-semibold:600; --weight-bold:700; --weight-black:800;
        --leading-tight:1.25; --leading-body:1.5;
        --space-4:4px; --space-8:8px; --space-12:12px;
        --space-16:16px; --space-24:24px; --space-32:32px;
        --radius-sm:8px; --radius-md:10px; --radius-lg:12px;
        --radius-xl:16px; --radius-pill:999px;
        --shadow-sm:0 1px 3px rgb(30 42 68 / 15%);
        --shadow-md:0 6px 20px color-mix(in srgb, var(--ink) 12%, transparent);
        /* phone 375 is the reference width, not a min-width switch */
        --bp-phone:375px; --bp-tablet:768px; --bp-laptop:1280px; --bp-wide:1600px;
        color-scheme:light; }

/* The two blocks below list the same custom properties. tests/test_design_system.py fails
   if they drift, and tests/test_token_contrast.py fails if a colour token in :root has no
   pair here (--brand and --on-scrim are the two deliberate exceptions: one value each). */
:root[data-theme="dark"] {
        color-scheme:dark;
        --accent:#F59E42; --accent-hover:#FFB366; --accent-soft:#3B2A1A; --ink:#E8E9EB;
        --muted:#9BA0A8; --line:#30343A; --bg:#101215; --card:#1E2125; --top-bg:#1E2125;
        --card-line:#30343A;
        --card-shadow:0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
        --table-head-bg:#23272C; --row-alt:#22252A; --row-hover:#2A2F35; --filters-bg:#191C20;
        --field-bg:#16181B; --field-line:#434950;
        --field-shadow:inset 0 1px 2px rgb(0 0 0 / 30%);
        --side-bg:#0E1013; --side-ink:#C9CCD1; --side-muted:#9BA0A8; --side-line:#30343A;
        --side-hover:#181B20; --side-active-bg:#3B2A1A; --side-active-fg:#F59E42;
        --chip-overdue-fg:#FF8A7A; --chip-overdue-bg:#42201C;
        --chip-notice-fg:#F2CF5B; --chip-notice-bg:#3A3214;
        --chip-todo-fg:#D5D8DE; --chip-todo-bg:#2C3138;
        --chip-ok-fg:#5FD08F; --chip-ok-bg:#16352A;
        --chip-info-fg:#7DB0FF; --chip-info-bg:#1A2B45;
        --tint-members:#2E261C; --edge-members:#E0A15A;
        --tint-trip:#1E2636; --edge-trip:#8EADD8;
        --tint-logist:#2A2436; --edge-logist:#B0A0DC;
        --tint-cards:#332818; --edge-cards:#E0B15A;
        --tint-docs:#1C2C22; --edge-docs:#8FCA9F;
        --status-ready-fg:var(--chip-ok-fg); --status-ready-bg:var(--chip-ok-bg);
        --status-check-fg:var(--chip-notice-fg); --status-check-bg:var(--chip-notice-bg);
        --status-error-fg:var(--chip-overdue-fg); --status-error-bg:var(--chip-overdue-bg);
        --status-neutral-fg:var(--chip-todo-fg); --status-neutral-bg:var(--chip-todo-bg);
        --on-accent:#141619; --danger:#FFB4AB; --control-border:var(--field-line);
        --hint-bg:#2E2516; --hint-edge:#5A4A2A;
        --role-logist-fg:#C5D4FF; --role-logist-bg:#243056;
        --role-driver-fg:#8FD7A8; --role-driver-bg:#1C3A28;
        --coverage-track:#1E4A30; --coverage-gap-a:#434950; --coverage-gap-b:#2A2E34;
        --attn-line:#30343A; --period-track:#2A2E34;
        --shadow-sm:0 1px 3px rgb(0 0 0 / 40%);
        --shadow-md:0 8px 24px rgb(0 0 0 / 45%); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
        color-scheme:dark;
        --accent:#F59E42; --accent-hover:#FFB366; --accent-soft:#3B2A1A; --ink:#E8E9EB;
        --muted:#9BA0A8; --line:#30343A; --bg:#101215; --card:#1E2125; --top-bg:#1E2125;
        --card-line:#30343A;
        --card-shadow:0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
        --table-head-bg:#23272C; --row-alt:#22252A; --row-hover:#2A2F35; --filters-bg:#191C20;
        --field-bg:#16181B; --field-line:#434950;
        --field-shadow:inset 0 1px 2px rgb(0 0 0 / 30%);
        --side-bg:#0E1013; --side-ink:#C9CCD1; --side-muted:#9BA0A8; --side-line:#30343A;
        --side-hover:#181B20; --side-active-bg:#3B2A1A; --side-active-fg:#F59E42;
        --chip-overdue-fg:#FF8A7A; --chip-overdue-bg:#42201C;
        --chip-notice-fg:#F2CF5B; --chip-notice-bg:#3A3214;
        --chip-todo-fg:#D5D8DE; --chip-todo-bg:#2C3138;
        --chip-ok-fg:#5FD08F; --chip-ok-bg:#16352A;
        --chip-info-fg:#7DB0FF; --chip-info-bg:#1A2B45;
        --tint-members:#2E261C; --edge-members:#E0A15A;
        --tint-trip:#1E2636; --edge-trip:#8EADD8;
        --tint-logist:#2A2436; --edge-logist:#B0A0DC;
        --tint-cards:#332818; --edge-cards:#E0B15A;
        --tint-docs:#1C2C22; --edge-docs:#8FCA9F;
        --status-ready-fg:var(--chip-ok-fg); --status-ready-bg:var(--chip-ok-bg);
        --status-check-fg:var(--chip-notice-fg); --status-check-bg:var(--chip-notice-bg);
        --status-error-fg:var(--chip-overdue-fg); --status-error-bg:var(--chip-overdue-bg);
        --status-neutral-fg:var(--chip-todo-fg); --status-neutral-bg:var(--chip-todo-bg);
        --on-accent:#141619; --danger:#FFB4AB; --control-border:var(--field-line);
        --hint-bg:#2E2516; --hint-edge:#5A4A2A;
        --role-logist-fg:#C5D4FF; --role-logist-bg:#243056;
        --role-driver-fg:#8FD7A8; --role-driver-bg:#1C3A28;
        --coverage-track:#1E4A30; --coverage-gap-a:#434950; --coverage-gap-b:#2A2E34;
        --attn-line:#30343A; --period-track:#2A2E34;
        --shadow-sm:0 1px 3px rgb(0 0 0 / 40%);
        --shadow-md:0 8px 24px rgb(0 0 0 / 45%); }
}
