/* ============================================================================
   tokens.css — SINGLE SOURCE OF TRUTH for every color in the dashboard.
   ----------------------------------------------------------------------------
   HOW THIS WORKS
   • Load this file BEFORE app.css. Every other stylesheet / canvas draw resolves
     color ONLY through these tokens (CSS via var(); canvas via the MP.palette
     bridge in theme.js). No raw hex/rgba should survive outside this file.
   • :root            = DARK theme.
   • :root[data-theme="light"] = LIGHT theme.
   • theme.js flips data-theme on <html> and repaints canvases.

   PALETTE "Stone, Ochre, Harbour" (owner approved 2026-10-24, t9 palette p1).
   Every source named in a comment below is a real, measured reference; the
   list + method + derivations live outside the repo in
   worktrees/t9-archive/palette/refs/references.md. The SYSTEM is small on
   purpose (one calm product, not a rainbow):
     • stone neutrals (hue ~75)            --bg-* --border-* --text-* --neut
     • ONE accent, ochre, + its tints       --accent --accent-dim/glow/hover/active
     • up / down for real price + P&L ONLY  --green --red (+ -dim, -soft)
     • ONE warning                           --amber
     • SIX categorical hues                  --cat-1 … --cat-6 (series, sectors,
       avatars, event classes), plus two deeper tints --azure / --violet
     • ramps built from up/down via color-mix (heat, sentiment tiers).
   Older names (--champagne, --jade, --seafoam, --series-*, --avatar-* …) stay
   as ALIASES into that set so nothing breaks; see the dated alias blocks.
   Canvas code reads tokens through theme.js probes, which can't parse a
   color-mix() result, so an alias a script reads is always var(--hex-token).
   ============================================================================ */

:root {
  /* ─────────────────────────── BASE — BACKGROUNDS ─────────────────────────── */
  /* Warm stone, hue ~75: Monaco night water #57534f / Monte Carlo dome
     #5e5c58 darkened to Linear / Hebbia surface depths (L 0.17 to 0.26). */
  --bg-primary:     #110f0d;   /* night stone, near Hebbia #0e0b0b   */
  --bg-secondary:   #151311;
  --bg-tertiary:    #1c1a18;
  --bg-elevated:    #24211e;   /* raised card, near Hebbia #262626   */
  --bg-hover:       #1a1815;
  --bg-intel:       #0d0c0a;   /* intel strip                       */
  /* Data table rows, EVERY table in the app (66-table.css .mpt-*, and each
     ad hoc table): three steps, never equal. Base row = the table's own
     background; --bg-stripe = the even row, one quiet step up; --bg-row-hover
     = the row under the pointer, a clear step above the stripe;
     --bg-row-sel = the selected row, one more step (plus its inset ring).
     tests/core/test_table_row_hover_tokens.py fails a table hover or zebra
     rule that uses any other colour, or these tokens collapsing together. */
  --bg-stripe:      #181613;
  --bg-row-hover:   #272522;
  --bg-row-sel:     #312f2b;

  /* Near-black canvas backdrops — DARKER than --bg-primary. Every
     chart/indicator/sentiment/tape canvas fills with this. */
  --chart-bg:       #0d0c0a;   /* (light: cream #fdfaf6)            */
  --bg-sink:        #0a0907;   /* sidebar gradient terminus         */

  /* Panel gaps (owner 2026-10-16, v2 10-17, TradingView style): every
     panel of the logged in app meets its neighbour at this one gap, and the
     strip shows this gutter colour. ONE size, ONE colour, used by
     css/app/79-panel-gaps.css (the panel system) and the workspace grid.
     Dark: the gutter is LIGHTER than every panel surface (--chart-bg,
     --bg-primary, --bg-secondary, --bg-tertiary) so the seam is visible but
     quiet, as on TradingView. Mirrored in eva's tokens.css. */
  --panel-gap:      3px;
  --panel-gap-bg:   #2c2a26;

  /* Lower graph-pane "cards" — a 95%-opaque surface that lifts each
     oscillator/sentiment pane off the near-black chart canvas. In dark the
     wet-slate --bg-elevated already reads lighter than --chart-bg; the light
     override (below) can't go lighter than the cream canvas, so it steps a
     touch DOWN + leans on the ring/shadow instead. */
  --graph-card-bg:     color-mix(in srgb, var(--bg-tertiary) 80%, transparent);
  --graph-card-ring:   var(--border-default);
  --graph-card-shadow: var(--shadow-pop);

  /* ───────────────────────────── BASE — BORDERS ───────────────────────────── */
  --border-subtle:  #272522;   /* stone; Linear border #23252a step  */
  --border-default: #35322e;   /* Hebbia border #323232, warmed      */
  --border-strong:  #484440;
  /* sidebar edge + dividers: the default line at about half strength
     (owner, 2026-09-28: the panel's lines read too heavy) */
  --border-sidebar: color-mix(in srgb, var(--border-default) 55%, transparent);
  /* plan tag (sidebar profile + account menu, 39-sidenav.css .snv-tier):
     a hairline marker, never a loud pill. Tone carries the tier: muted for
     the free and entry plans, a quiet champagne hint for the top paid plan,
     full ink for staff. (owner, 2026-09-29) */
  --tier-ink:       var(--text-muted);
  --tier-ink-mid:   var(--text-secondary);
  --tier-ring:      var(--border-default);
  --tier-top-ink:   var(--champagne);
  --tier-top-ring:  color-mix(in srgb, var(--champagne) 34%, transparent);
  --tier-top-tint:  color-mix(in srgb, var(--champagne) 7%, transparent);
  --tier-staff-ink: var(--text-primary);
  --tier-staff-ring: var(--border-strong);
  --tier-dot:       var(--border-strong);
  --tier-top-dot:   radial-gradient(circle at 35% 30%, var(--champagne-hi, var(--champagne)) 0%, var(--champagne) 55%, color-mix(in srgb, var(--champagne) 70%, #000) 100%);
  /* neutral overlay hairline — expressed off text so it INVERTS in light */
  --border-pane:    color-mix(in srgb, var(--text-primary) 16%, transparent);

  /* ────────────────────────────── BASE — TEXT ─────────────────────────────── */
  /* Ink: Genoa plaster cream #eae4d7 / Hebbia #eceded, kept on stone hue.
     Contrast (2026-10-24, worst dark surface #24211e): primary 13.3:1,
     secondary 8.6:1, muted 5.5:1. */
  --text-primary:   #ede9e4;   /* plaster ivory                     */
  --text-secondary: #c2bdb7;
  --text-muted:     #9c9792;   /* 4.5:1+ on every dark surface      */
  /* --text-xmuted MARKS ABSENCE ONLY. It FAILS WCAG contrast in BOTH themes —
     measured on --bg-tertiary: 2.42:1 dark (#5b5753 on #1c1a18), 1.85:1 light
     (#afaaa3 on #ebe5de); on --bg-elevated 2.24:1 dark / 2.22:1 light. Both are
     under the 3:1 non-text floor (WCAG 1.4.11), let alone 4.5:1 body text.
     THE RULE: it may only render "there is nothing here yet" markers — the `…`
     awaiting-fetch placeholder, the `·` unscored/no-data dot, a disabled glyph.
     It may NEVER carry a value, a label, a timestamp, a count, or any state the
     user has to read. Reaching for it as a third grey ships illegible data; use
     --text-muted (the lowest legible grey) instead. Value intentionally left as
     is — illegibility IS the semantic here. */
  --text-xmuted:    #5b5753;
  --text-bright:    #f8f6f4;   /* brighter-than-primary hover ink   */
  /* Rank identity (10-admin-pages.css .role-*), four tones that never
     collide: stone, harbour blue, the ochre accent, the warning amber.
     (2026-10-24: knight was --accent and banneret --champagne; once the
     accent became ochre those two would have matched.) */
  --rank-squire:    #b3ada6;   /* squire rank / paused-status, stone 7.2:1 */
  --rank-contender: var(--cat-1);   /* competition guest: sage, Knight's rank, no AI */
  --rank-knight:    var(--cat-4);
  --rank-banneret:  var(--accent);
  --rank-warden:    var(--amber);
  /* Ink that sits ON an accent/green/red fill. INVERTS opposite to text: dark
     in dark theme (light ochre/teal fills take dark ink, 8.9:1 on ochre),
     light in light theme (deep fills take cream ink). */
  --on-accent:      #14110d;   /* light theme overrides to cream    */
  --on-accent-bright: #ffffff; /* white label sites — constant both themes */

  /* ───────────────────────────── ACCENT — ochre ──────────────────────────── */
  /* Portofino facade ochre #d59c58, lightened (L 0.733 to 0.771, C 0.109 to
     0.115): 7.6:1 on the worst dark surface. Light: #934e1e. */
  --accent:         #e5a65f;
  --accent-dim:     color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-glow:    color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-warm:    var(--accent);
  --accent-warm-dim: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-hover:   color-mix(in srgb, var(--accent) 86%, #ffffff);  /* lift  */
  --accent-active:  color-mix(in srgb, var(--accent) 88%, #000000);  /* press */
  /* Hex tints of the accent for code that can't take color-mix (canvas). */
  --accent-hi:      #eeb97b;   /* lighter ochre highlight           */
  --accent-pale:    #f5e1c8;   /* pale ochre cream outline          */

  /* ────────────────────── CHAMPAGNE — now the accent ─────────────────────── */
  /* 2026-10-24: the brass family folded into the ONE accent. Kept as names
     because ~110 rules and the indicator picker use them. */
  --champagne:      var(--accent);
  --champagne-dim:  color-mix(in srgb, var(--champagne) 10%, transparent);
  --champagne-ring: color-mix(in srgb, var(--champagne) 30%, transparent);
  --champagne-fill: var(--accent);
  --champagne-hi:   var(--accent-hi);
  --champagne-bright: var(--accent-pale);

  /* ─────────────────── MARKET SEMANTICS — P&L ONLY ───────────────────────── */
  /* Only genuine up/down may use these. Decorative colour uses --accent. */
  /* Up: Portofino awning #04928e / TradingView #22ab94, lightened (L 0.761,
     C 0.125, h 182): 7.9:1 on the worst dark surface. Light: #01716d. */
  --green:          #34cbb7;
  --green-dim:      color-mix(in srgb, var(--green) 12%, transparent);
  --green-soft:     #99e2d5;   /* light P&L text/tag tint           */
  /* Down: Linear #eb5757, a hair less chroma (C 0.183 to 0.175): 4.55:1 on
     the worst dark surface #24211e. Light: #a1252a. */
  --red:            #e65a58;
  --red-dim:        color-mix(in srgb, var(--red) 12%, transparent);
  --red-soft:       #f4b0ab;   /* light P&L text/tag tint           */
  --neut:           #908b86;   /* stone neutral marker (flat, unchanged) */
  /* Warning, the ONE: Bloomberg amber field #f5d670, toned down (L 0.882 to
     0.851). Yellow on purpose so it never reads as the ochre accent. */
  --amber:          #e2d05e;

  /* ─────────────────── MATERIAL EXTRAS ───────────────────────────────────── */
  /* Portofino white hull in shade #425a6b: the one cool stone, used for
     "Unknown" segments, low bands and quiet chrome. */
  --slate:          #425a6b;
  /* Cash slice in the wallet's allocation bar + donut: Ligurian shutter
     green #044f4d, lifted. Deep enough to read apart from the first
     holding (--avatar-3 = --cat-1 sage) where the donut wraps around. */
  --cash:           #209385;

  /* ───────────────── CANDLE SESSION COLOURS (chart panes) ────────────────── */
  /* Extended hours and closed session bars (2026-11-19, D9): the theme's own
     up / down mixed into --chart-bg, so the direction still reads at a
     glance. Extended = 55% colour, closed = 40%. Contrast on --chart-bg
     #0d0c0a: ext up 3.56:1, ext down 2.40:1, closed up 2.40:1, closed down
     1.79:1 (regular --green 9.66, --red 5.56; the old single stone tints
     were 1.04 to 1.36). Plain hex: LightweightCharts reads them. */
  --candle-ext-up:        #227569;
  --candle-ext-down:      #843735;
  --candle-closed-up:     #1d584f;
  --candle-closed-down:   #642b29;

  /* ───────────────── WARN SURFACES / TOAST ───────────────────────────────── */
  --warn-surface:   #372d0c;   /* alert-banner deep amber bg (amber 8.7:1 on it) */
  --warn-border:    #5b4c1a;
  --toast-warn-bg:  #f1e7cf;   /* cream warn-toast surface          */
  --toast-warn-fg:  #3a2e16;

  /* ── SEMANTIC ALIASES (2026-10-24, palette p1) ─────────────────────────────
     Status, severity, sentiment tiers and the old Côte d'Azur material names
     now point at up / down / the warning / stone / the accent. */
  --status-ok:      var(--green);   /* service-health healthy            */
  --status-warn:    var(--amber);   /* degraded (== severity-high)       */
  --severity-critical: var(--red);
  --severity-moderate: var(--amber);
  /* severity-low reuses --text-muted */
  --neut-bright:    var(--text-muted);   /* lighter neutral (posture/vol) */
  --sentiment-neutral: var(--neut);      /* green-gray-red midpoint       */
  --seg-neutral:    #3c3832;             /* solid neutral segment fill    */
  /* Grok 5-step tier ramp: the cautious steps are up/down eased to stone
     (CSS only; no script reads these). */
  --tier-cbull:     color-mix(in srgb, var(--green) 62%, var(--neut));
  --tier-cbear:     color-mix(in srgb, var(--red) 62%, var(--neut));
  --warm-hint:      var(--amber);   /* interval-mismatch hint            */
  --seafoam:        var(--cat-4);   /* info/crosshair, rule-level band   */
  --terracotta:     var(--accent);  /* squeeze tier-high garnish         */
  --oxblood:        var(--red);     /* short/sell tags (unused)          */
  --racing:         var(--cash);    /* brand surfaces (unused)           */

  /* ─────────── CATEGORICAL — the SIX identity hues (2026-10-24) ──────────── */
  /* Series, sectors, avatars, event classes, link groups. NOT semantic: never
     up/down, never warning. Each is a Riviera material lifted for a dark
     ground; the lightness spread is deliberate so pairs survive colour
     blindness (min OKLab ΔE among the six, x100: normal 9.0, deuteranopia 6.6,
     protanopia 3.3 sage/sand; the old jewel ramp was 7.4 / 2.9 / 4.4).
     Every one is 5.2:1+ on the worst dark surface, so it may carry text.
     Colour is still REINFORCEMENT; pair it with a label. */
  --cat-1:          #a4d1ac;   /* sage: Rapallo shutter green #375746, lifted   */
  --cat-2:          #e9d1a0;   /* sand: Genoa plaster #eae4d7 x ochre #e8b669   */
  --cat-3:          #cf8794;   /* rose: Portofino salmon facade #d1a499, deeper */
  --cat-4:          #9bc3e5;   /* harbour blue: Portofino sky #6d9cd1, lifted   */
  --cat-5:          #90985e;   /* olive: Portofino olive hillside #303929, lifted */
  --cat-6:          #a592cf;   /* lavender: hue gap filler (no photo source)    */
  /* Two deeper tints of the blue and lavender hues (not new hues) so the
     indicator picker's Azure / Violet swatches stay distinct from Ice / Orchid. */
  --azure:          #6197cd;   /* neutral not-up price/order lines   */
  --violet:         #9784ce;   /* split marker                       */

  /* ── CATEGORICAL ALIASES (2026-10-24, palette p1) ──────────────────────────
     The old jewel ramp, the research ramp, feed tags, compare series and
     avatars were ~40 separate hexes. They now all point INTO the six
     --cat-* hues (+ --azure/--violet tints, + stone for slots past six), so
     every chart, ring and tag speaks one palette. Names kept so indicator
     presets (analysis/indicator_meta.py COLOR_TOKENS), saved user styles and
     every var() keep working. All are plain var() to a hex token: canvas
     code reads them through theme.js. */
  /* Indicator picker / jewel names */
  --ice-steel:      var(--cat-4);
  --jade:           var(--cat-1);
  --orchid:         var(--cat-6);
  --rose:           var(--cat-3);
  --sage:           var(--cat-5);
  --bronze:         var(--cat-2);
  --gold:           var(--amber);     /* alert line / attention = the warning */
  --info-blue:      var(--azure);     /* data-viz blue / EDGAR-positive     */
  --indigo:         var(--violet);    /* news-chains button                 */

  /* Research event classes. Same six hues; the light block overrides the
     --cat-* values, so these follow. Colour is REINFORCEMENT; the encoding is
     the text chip at a fixed row position. Ordinal magnitude/severity uses
     --amber / --azure, NOT this ramp; price direction uses --green/--red. */
  --rsx-cat-1:      var(--cat-1);
  --rsx-cat-2:      var(--cat-2);
  --rsx-cat-3:      var(--cat-3);
  --rsx-cat-4:      var(--cat-4);
  --rsx-cat-5:      var(--cat-5);
  --rsx-cat-6:      var(--cat-6);

  /* News feed tags */
  --feed-google:    var(--cat-3);
  --feed-finnhub:   var(--cat-4);
  --feed-yahoo:     var(--cat-6);
  --feed-globe:     var(--cat-1);
  --feed-wire:      var(--cat-2);
  --feed-sec:       var(--cat-4);   /* sec_edgar — shares the blue        */

  /* Compare series (8 slots): the six hues, then the two deeper tints. */
  --series-1: var(--cat-2); --series-2: var(--cat-6); --series-3: var(--cat-4); --series-4: var(--cat-3);
  --series-5: var(--cat-1); --series-6: var(--cat-5); --series-7: var(--azure); --series-8: var(--violet);

  /* Avatars + the holdings donut / sector ring slots. Slot 7 is stone, not a
     seventh hue. */
  --avatar-1: var(--cat-2); --avatar-2: var(--cat-4); --avatar-3: var(--cat-1); --avatar-4: var(--cat-6);
  --avatar-5: var(--cat-3); --avatar-6: var(--cat-5); --avatar-7: var(--neut);

  /* Workspaces link groups 1 to 4 (49-workspace.css): the filled chip in a
     pane header; ink is --on-accent. T9 fix c (2026-10-24): no sage or
     olive (they read as the up green, which is reserved for up / down);
     blue, sand, rose, lavender, each readable under --on-accent ink in
     both themes. */
  --wks-link-1:     var(--cat-4);
  --wks-link-2:     var(--cat-2);
  --wks-link-3:     var(--cat-3);
  --wks-link-4:     var(--cat-6);

  /* Drawing engine */
  --draw-ink:       var(--azure);   /* default stroke/handles             */
  --fib-amber:      var(--accent);
  --fib-crimson:    var(--cat-3);
  /* Drawing palette (2026-11-20, the drawing style bar, drawing.js COLOR_TOK
     and its fib level colours). A drawing stores a NAME (style.c "red"), the
     canvas reads these through the MP bridge, so a coloured drawing follows
     the theme. Every entry is a plain var() to a hex token the light block
     already re-tunes for cream (4.5:1+ on every light surface, see the
     --cat-* note there), so the same read on both themes. red, green,
     blue, amber and orange are the chat's chart.draw_edit names and keep
     their own tokens (--red, --green, --info-blue, --amber, --accent-warm). */
  --draw-sage:      var(--cat-1);
  --draw-sky:       var(--cat-4);
  --draw-violet:    var(--violet);
  --draw-rose:      var(--cat-3);
  --draw-gray:      var(--neut);
  --draw-contrast:  var(--text-primary);

  /* ───────────────── EVA-SPECIFIC ────────────────────────────────────────── */
  --eva-rose:       #ff90be;   /* Eva ambient scene glow (alphas via mix) */
  --glow-warm:      #ff9b4b;   /* warm stage-light bloom */
  --graph-link:     #504b45;   /* partner-graph connector stroke (stone) */
  --graph-pulse:    #938e87;   /* electron pulse (stone) */
  /* AI chat empty screen ambience (44-research-chat.css AMBIENT), the /chat
     page and the side panel alike: --rch-sun (below) at --rch-amb-k;
     --rch-amb-leaf scales the leaves' peak opacity per theme. */
  --rch-amb-leaf:   1.3;
  --rch-amb-k:      0.55;
  /* The sign up page's BRIDGE backdrop light (home.css .welcome-eva
     .welcome-light + .tree-glow), verbatim: soft rose from the bottom right
     and a faint rose bloom at the left centre (owner 2026-10-05). */
  --rch-sun: radial-gradient(ellipse 135% 125% at 98% 104%,
    rgba(255, 176, 206, 0.34) 0%, rgba(255, 150, 190, 0.23) 16%,
    rgba(255, 135, 178, 0.13) 36%, rgba(250, 165, 200, 0.06) 58%,
    rgba(0, 0, 0, 0) 82%),
    radial-gradient(ellipse 52% 44% at 30% 48%,
    rgba(255, 178, 208, 0.07) 0%, rgba(255, 150, 190, 0.03) 38%,
    rgba(0, 0, 0, 0) 68%);
  /* Its mirror into the bottom LEFT corner (Home, Option C 2026-10-06), so
     both lower corners of the /chat page glow; painted over --rch-sun by
     44-research-chat.css on the page only (the side panel keeps one light). */
  --rch-sun-l: radial-gradient(ellipse 95% 85% at 0% 106%,
    rgba(255, 176, 206, 0.30) 0%, rgba(255, 150, 190, 0.17) 22%,
    rgba(255, 135, 178, 0.07) 46%, rgba(0, 0, 0, 0) 72%);
  --rch-hello-ink:  #ece4d4;   /* warm ivory */       /* pale petals read as mud below ~0.45 on night ink */
  /* The right edge's ONE clock (2026-10-05): the Chat Bot panel's slide,
     the .main margin, the fixed right column (44-research-chat.css) and
     dock-glide's chart layers (14-chart-extras.css .dg-sync) all read these
     two, so they cannot drift. Same 220ms glide as the Key Stats dock and
     the trade drawer (--ease-glide, 01-base.css). */
  --rch-slide:      220ms;
  --rch-ease:       var(--ease-glide, cubic-bezier(0.33, 0.66, 0.08, 1));
  /* AI chat accent (2026-10-05, owner: "use our own old money type colors",
     no green around the chat). Since 2026-10-24 the app accent IS ochre, so
     these simply follow it (44-research-chat.css re points --accent* at these
     inside the chat); green and red stay for price up / down only. Ochre on
     night ink 7.6:1+. */
  --rch-accent:        var(--champagne);                                   /* = --accent */
  --rch-accent-hover:  var(--champagne-hi);
  --rch-accent-active: color-mix(in srgb, var(--champagne) 86%, #000000);
  --rch-on-accent:     #14110b;                                            /* ink on ochre 8.9:1 */
  --rch-accent-dim:    color-mix(in srgb, var(--champagne) 11%, transparent);
  --rch-accent-glow:   color-mix(in srgb, var(--champagne) 20%, transparent);
  /* The empty /chat composer's halo: champagne, the warm corner light and a
     breath of rose (44-research-chat.css .rch-glow). Night: a lamp glow. */
  --rch-glow-a:     color-mix(in srgb, var(--champagne) 34%, transparent);
  --rch-glow-b:     color-mix(in srgb, var(--glow-warm) 22%, transparent);
  --rch-glow-c:     color-mix(in srgb, var(--eva-rose) 13%, transparent);

  /* ───────────────── MAP (eva map_v2) — purple/cyan brand ─────────────────── */
  --map-accent:        #a78bfa;
  --map-suppliers:     #7dd3fc;
  --map-suppliers-text:#bae6fd;
  --map-customers:     #c4b5fd;
  --map-customers-text:#ddd6fe;
  --map-fallback-bg:   #2a1f4a;

  /* ───────────────── SHADOWS / GLOWS (theme-aware) ───────────────────────── */
  /* Dark-tuned by default; the light block softens them so cream surfaces
     don't carry a black smear. Chrome/overlays reference these, never raw rgba. */
  /* Chart-label ink halo — lifts the OHLC + indicator readouts off the candles.
     Dark: black glow behind light ink. Light: faint cream halo behind dark ink. */
  --chart-label-halo: 0 1px 4px rgba(0,0,0,.95), 0 0 10px rgba(0,0,0,.7);
  /* Floating chrome drop shadows. Dark: deep black; light: soft stone-ink. */
  --shadow-pop:  0 8px 24px rgba(0,0,0,.45);  /* header buttons (Graphs, view)  */
  --shadow-rail: 0 8px 32px rgba(0,0,0,.5);   /* left draw rail + its flyout     */
  --shadow-lift: 0 12px 30px -12px rgba(0,0,0,.45);  /* card hover lift */
  --shadow-tile: 0 1px 4px rgba(0,0,0,.35);          /* logo tile edge */
  /* Scale steps added 2026-07-25 (shadow migration). The dark value of each is
     byte-identical to the most-used raw literal it replaces, so dark does not
     move; the light value is the same soft stone-ink treatment as the four
     above. Ordered by blur radius: hairline < pop < rail < menu < modal.
     --shadow-edge is the horizontal twin of --shadow-sheet for LEFT-edge
     drawers (positive x-offset), where a downward token would break the look. */
  --shadow-hairline: 0 1px 6px rgba(0,0,0,.4);    /* chart trade pills / tags   */
  --shadow-menu:  0 14px 36px rgba(0,0,0,.55);    /* context menus, flyouts     */
  --shadow-modal: 0 24px 64px rgba(0,0,0,.55);    /* modal cards, big popovers  */
  --shadow-edge:  8px 0 24px rgba(0,0,0,.35);     /* left-edge drawers          */

  /* ───────────────── CONSTANTS (theme-neutral) ───────────────────────────── */
  --logo-plate:     #ffffff;   /* white backing behind ticker/publisher logos */
  --brand-x:        #1d9bf0;   /* Twitter/X verified badge (third-party) */
  /* Cavalry knight plume + shield: the red of the original mark and the sidebar knight
     (knight1_poster.webp / old knight_mark_dark.webp, sampled ~#b02541). Theme neutral like the
     logo itself: 9:1 on the light page, decorative on the dark one (the mark is aria-hidden). */
  --brand-crimson:  #b02541;
  --scrim-black:    rgba(0,0,0,0.4);  /* input scrim over glass panels */
  /* Shadow / scrim ink for color-mix alphas in drop-shadows and veils
     (2026-10-24: replaces raw rgba(0,0,0,a) in stylesheets). Black in dark,
     stone ink in light (overridden below), like the --shadow-* scale. */
  --shadow-ink:     #000000;
  /* Video letterbox: black in both themes, as every media player does. */
  --media-bg:       #000000;
  /* Crosshair value pill: the sub-pane .cross-tag (11-panes-axis.css) AND
     every LightweightCharts crosshair label (fed as labelBackgroundColor,
     palette p2 2026-10-24; was LWC's cool default #4c525e). A mid stone
     that reads apart from the candles; white ink (--on-accent-bright, and
     LWC's own contrast pick) 7.7:1 on it. Light overrides below. */
  --crosshair-label: #57524c;
  /* Mobile trade-ticket sheet: left-edge drop + the one-sided spread scrim that
     dims the page behind it. Same values in both themes (matches the shipped
     look byte for byte — tokenized from the last hardcoded shadows). */
  --shadow-sheet:   -12px 0 32px rgba(0,0,0,.45);
  --scrim-sheet:    rgba(10,9,7,.55);
  /* Behind a centred dialog (the Settings panel, 113-settings.css). */
  --scrim-dialog:   color-mix(in srgb, var(--shadow-ink) 66%, transparent);
  /* Phone layout (77-phone.css, 2026-10-14): the bottom sheets' upward cast
     and a dropped panel's (the chart's More tools) downward one. Same values
     in both themes, like --shadow-sheet. */
  --shadow-sheet-up: 0 -16px 40px -12px rgba(0,0,0,.45);
  --shadow-drop:     0 12px 24px -12px rgba(0,0,0,.35);

  /* Fixed light-invert hover set (view dropdown) — intentionally does NOT flip */
  --menu-invert-desc: #69645d;

}

/* ============================================================================
   LIGHT — plaster cream, stone ink, deep ochre / teal / garnet
   Only tokens that DIFFER from dark are overridden. Derived tokens (color-mix
   off a base) and aliases (var() to a base) auto-track and need no override:
   the categorical aliases follow the light --cat-* values below.
   ============================================================================ */
:root[data-theme="light"] {
  /* Genoa plaster cream #eae4d7 / Monaco tower stone #d2c3b5, on stone hue. */
  --bg-primary:     #f7f3ed;   /* plaster cream            */
  --bg-secondary:   #f2eee7;
  --bg-tertiary:    #ebe5de;   /* travertine, the darkest light surface */
  --bg-elevated:    #fdfaf6;   /* cards float lighter      */
  --bg-hover:       #eee9e2;
  --bg-intel:       #f4efe9;
  --bg-stripe:      #f0ebe5;
  --bg-row-hover:   #e3ddd5;
  --bg-row-sel:     #dbd3c9;
  --chart-bg:       #fdfaf6;   /* light chart canvas = cream */
  --bg-sink:        #ebe5de;
  /* Panel gutter on cream: a greyer stone, darker than --bg-sink. */
  --panel-gap-bg:   #d8d3cd;

  /* Cards can't float lighter than the cream canvas, so step a hair down to
     limestone + a real border/shadow so each pane still reads as a panel. */
  --graph-card-bg:     color-mix(in srgb, var(--bg-tertiary) 80%, transparent);
  --graph-card-ring:   var(--border-default);
  --graph-card-shadow: var(--shadow-pop);

  --border-subtle:  #e3ddd5;   /* limestone */
  --border-default: #d3cdc4;
  --border-strong:  #b7b0a6;
  --border-sidebar: color-mix(in srgb, var(--border-default) 55%, transparent);
  /* plan tag (sidebar profile + account menu, 39-sidenav.css .snv-tier):
     a hairline marker, never a loud pill. Tone carries the tier: muted for
     the free and entry plans, a quiet champagne hint for the top paid plan,
     full ink for staff. (owner, 2026-09-29) */
  --tier-ink:       var(--text-muted);
  --tier-ink-mid:   var(--text-secondary);
  --tier-ring:      var(--border-default);
  --tier-top-ink:   var(--champagne);
  --tier-top-ring:  color-mix(in srgb, var(--champagne) 34%, transparent);
  --tier-top-tint:  color-mix(in srgb, var(--champagne) 7%, transparent);
  --tier-staff-ink: var(--text-primary);
  --tier-staff-ring: var(--border-strong);
  --tier-dot:       var(--border-strong);
  --tier-top-dot:   radial-gradient(circle at 35% 30%, var(--champagne-hi, var(--champagne)) 0%, var(--champagne) 55%, color-mix(in srgb, var(--champagne) 70%, #000) 100%);

  /* Ink on cream; contrast on --bg-tertiary #ebe5de (the binding surface):
     primary 12.8:1, secondary 7.4:1, muted 4.7:1. */
  --text-primary:   #24211c;   /* stone ink, near Hebbia light #27272b */
  --text-secondary: #4c4741;
  --text-muted:     #69645d;   /* 4.5:1+ on every light surface */
  --text-xmuted:    #afaaa3;
  --text-bright:    #14110d;
  --rank-squire:    #69645d;   /* 4.7:1 on tertiary */
  --on-accent:      #fdfaf6;   /* cream ink on deep fills: 6.0:1 on accent, 5.6:1 on green */

  /* Accent: Portofino ochre #d59c58 darkened (L 0.733 to 0.499) and pulled
     toward Monaco roof terracotta (h 70 to 52): 5.0:1 on every light surface. */
  --accent:         #934e1e;
  /* Up: Portofino awning #04928e darkened (L 0.596 to 0.495). #017470 measured
     4.4985:1 on #ebe5de, so one step darker: 4.69:1 on every light surface. */
  --green:          #01716d;
  --green-soft:     var(--green);   /* on cream the "soft" tint must stay readable */
  /* Down: Linear #eb5757 darkened (L 0.653 to 0.469): 5.97:1 worst case. */
  --red:            #a1252a;
  --red-soft:       var(--red);
  --neut:           #79746d;   /* marker only, never body text (3.7:1) */
  --amber:          #7a5f13;   /* 4.8:1 on every light surface */

  --cash:           #00605c;   /* deep shutter green, darkened for cream */
  /* --slate identical to dark (already contrast on cream) */
  --seg-neutral:    #d3cdc4;
  /* Crosshair pill on cream: a mid stone a step lighter than the ink, white
     text 5.7:1 (LWC picks white on it too). */
  --crosshair-label: #6b665f;

  /* The six categorical hues on cream: same hues, darkened until each clears
     4.5:1 on every light surface (worst case on #ebe5de shown). Lightness
     spread kept for colour blindness (min OKLab ΔE x100 among the six:
     normal 8.6, deuteranopia 4.9, protanopia 5.6). --cat-2 sits much darker
     ON PURPOSE (7.8:1). Every --rsx-cat-*, --wks-link-*, avatar, series and
     feed tag follows through the aliases in the dark block. */
  --cat-1:          #2c5c38;   /* sage      6.2:1 */
  --cat-2:          #594012;   /* sand      7.8:1 */
  --cat-3:          #a6455c;   /* rose      4.6:1 */
  --cat-4:          #356890;   /* blue      4.8:1 */
  --cat-5:          #626614;   /* olive     4.9:1 */
  --cat-6:          #553d80;   /* lavender  7.1:1 */
  --azure:          #124a7b;   /* deeper blue tint      7.3:1 */
  --violet:         #41246c;   /* deeper lavender tint  9.2:1 */

  /* Warn surfaces read inverted on light — dark ink on amber cream */
  --warn-surface:   #f1e7cf;
  --warn-border:    #cbb98a;

  /* Candle session colours on cream: the same 55% / 40% mixes into
     --chart-bg #fdfaf6. Contrast: ext up 2.40:1, ext down 2.80:1, closed
     up 1.85:1, closed down 2.05:1 (regular --green 5.63, --red 7.17; the
     old stone tints were 1.16 to 1.52). */
  --candle-ext-up:        #72afab;
  --candle-ext-down:      #ca8586;
  --candle-closed-up:     #98c3bf;
  --candle-closed-down:   #d8a5a4;

  /* Shadows: black glows/smears read as dirty smudges on cream. Swap them for a
     faint cream halo (chart labels) and soft stone-ink drop shadows (chrome). */
  --chart-label-halo: 0 1px 2px rgba(253,250,246,.92), 0 0 5px rgba(253,250,246,.7);
  --shadow-pop:  0 4px 14px rgba(36,33,28,.12);
  --shadow-rail: 0 1px 4px rgba(36,33,28,.06);
  --shadow-lift: 0 10px 24px -12px rgba(36,33,28,.18);
  --shadow-tile: 0 1px 3px rgba(36,33,28,.15);
  --shadow-hairline: 0 1px 3px rgba(36,33,28,.10);
  --shadow-menu:  0 6px 20px rgba(36,33,28,.14);
  --shadow-modal: 0 12px 32px rgba(36,33,28,.16);
  --shadow-edge:  4px 0 16px rgba(36,33,28,.08);
  --shadow-ink:   #24211c;
  --scrim-dialog: color-mix(in srgb, var(--shadow-ink) 26%, transparent);
  /* AI chat ambience on cream: the rose light at full strength, normal
     blend; leaves a touch lighter. */
  --rch-amb-leaf:   0.85;
  --rch-amb-k:      1;
  --rch-amb-blend:  normal;
  --rch-hello-ink:  #2b2620;   /* warm ink */
  /* Chat accent on cream = the app accent (#934e1e, 5.0:1 on every light
     surface); hover/press step darker on the same hue. */
  --rch-accent:        var(--accent);
  --rch-accent-hover:  #7c4014;
  --rch-accent-active: #6e360b;
  --rch-on-accent:     #fdfaf6;                                            /* cream on ochre 6.0:1 */
  --rch-accent-dim:    color-mix(in srgb, var(--accent) 9%, transparent);
  --rch-accent-glow:   color-mix(in srgb, var(--accent) 16%, transparent);
  /* Halo on cream: soft peach and champagne, never neon. */
  --rch-glow-a:     color-mix(in srgb, #c9a46a 34%, transparent);
  --rch-glow-b:     color-mix(in srgb, var(--glow-warm) 18%, transparent);
  --rch-glow-c:     color-mix(in srgb, var(--eva-rose) 11%, transparent);
}
