/* ============================================================================
   tokens.css — Design tokens. Single source of truth for colour, type, radius,
   spacing and layout across the whole application.

   Loaded before every other stylesheet (see ctlmain.php) so any sheet can use
   these custom properties. Always reference them WITH a fallback equal to the
   token's current value, e.g. `color: var(--color-brand, #224487);` — that way
   a sheet loaded out of order, or viewed in isolation, still renders correctly.

   ── REDESIGN, 2026-10-08 ─────────────────────────────────────────────────────
   The app is moving to the design reviewed in Design/newstyle/newstyle.html
   (plan: Design/docs/REDESIGN_PLAN.md). Rohit chose "foundation first": the
   shared parts change app-wide in Phase 0, then screens are rebuilt one by one.
   So, unlike the staged indigo → navy move of 2026-08-18, the existing colour
   names below are RE-POINTED to the new palette in one stroke. Every sheet that
   reads a token changes colour now; colours written as raw hex in a module
   sheet keep their old value until that screen's phase rebuilds it. A screen
   that looks half-new on dev is expected until its turn.

   Contrast rules, measured (the prototype's style guide):
     · --color-cyan (#2BACCC) is 2.67:1 on white — marks, indicators and focus
       only, NEVER text. Cyan-coloured text uses --color-cyan-ink (5.76:1).
     · --color-text-faint (#8A97AD) is 2.95:1 — icons and decoration only.

   The 24 per-item nav icon colours (--icon-*) were removed with this change:
   the nav is mono now (Rohit, 2026-10-08).
   ============================================================================ */

:root {
    /* ========================================================================
       BRAND — navy and cyan, from Wex_Formulation_QC.html.
       ======================================================================== */
    --color-brand:          #224487;  /* navy — primary actions, selection, headings */
    --color-brand-hover:    #1b3a78;  /* hover on navy */
    --color-brand-active:   #16306a;  /* pressed / deep navy */
    --color-brand-contrast: #ffffff;  /* text ON navy (9.36:1) */
    --color-brand-accent:   #0B6F88;  /* links and cyan-coloured text */
    --color-brand-tint:     #E3F5FA;  /* selected row, active nav item */
    --color-brand-tint-2:   #F6F9FC;  /* hover row, table header */

    --color-cyan:           #2BACCC;  /* marks, indicators, focus ring — never text */
    --color-cyan-ink:       #0B6F88;  /* cyan-coloured text */
    --color-cyan-soft:      #E3F5FA;

    /* ========================================================================
       SURFACES
       ======================================================================== */
    --color-surface:       #ffffff;  /* cards, panels, table bodies */
    --color-page:          #EEF3F8;  /* the page behind the cards */
    --color-row:           #F6F9FC;  /* table headers, inputs at rest */
    --color-border:        #DDE6F0;  /* every hairline */
    --color-border-strong: #C9D5E4;  /* dividers that must read as a line */
    --color-input-border:  #CDD8E6;

    /* ========================================================================
       TEXT
       ======================================================================== */
    --color-text:        #15233F;  /* body copy and headings (15.6:1) */
    --color-text-2:      #2B3A55;  /* secondary emphasis */
    --color-text-muted:  #46536B;  /* captions, labels, hints, placeholders (7.75:1; 6.94:1 on the page) — darkened from #46536B, too light to read (Rohit, 2026-10-12) */
    --color-text-faint:  #8A97AD;  /* icons and decoration ONLY (2.95:1) */

    /* ========================================================================
       STATUS — RESERVED. These colours carry meaning and nothing decorative may
       borrow them; they always ship with a word or an icon, never colour alone.
       ======================================================================== */
    --color-success:      #16A34A;
    --color-success-bg:   #E6F4EA;
    --color-success-text: #166534;

    --color-danger:       #C2273A;
    --color-danger-hover: #A21F31;
    --color-danger-bg:    #FDE8EA;
    --color-danger-text:  #A61B2B;

    --color-warning:      #D97706;
    --color-warning-bg:   #FEF3C7;
    --color-warning-text: #92400E;

    --color-info:         #1AA0C2;
    --color-info-bg:      #E3F5FA;
    --color-info-text:    #0B6680;

    --color-inactive:      #94A3B8;
    --color-inactive-bg:   #EEF2F7;
    --color-inactive-text: #475569;

    /* ========================================================================
       CHART SERIES — validated with the dataviz validator: normal-vision
       ΔE 18.3, colour-blind ΔE 9.2, all ≥ 3:1 on white. Assign in this order;
       a seventh series folds into "Other". Water keeps its pale diluent colour.
       ======================================================================== */
    --series-1: #2A57B5;
    --series-2: #1AA0C2;
    --series-3: #7A5BD0;
    --series-4: #3F9B57;
    --series-5: #C2569A;
    --series-6: #B8752A;
    --series-other: #A3AEBF;
    --series-water: #BFE6F0;
    --chart-grid:   #E6EDF5;

    /* ========================================================================
       TYPE — bundled in fonts/, declared in css/ui/fonts.css.
       ======================================================================== */
    /* Noto Sans Devanagari second: Marathi letters only (the ? help). */
    --font-display: 'Sora', 'Noto Sans Devanagari', system-ui, sans-serif;
    --font-body:    'IBM Plex Sans', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    /* ========================================================================
       RADIUS
       ======================================================================== */
    --radius-sm:   7px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-pill: 999px;

    /* ========================================================================
       SPACING — a 4px scale. Use these rather than arbitrary pixel values so
       rhythm stays consistent between modules written months apart.
       ======================================================================== */
    --space-1:  4px;
    --space-2:  8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* ========================================================================
       ELEVATION — navy-tinted shadows
       ======================================================================== */
    --shadow-sm: 0 1px 2px rgba(21, 35, 63, 0.06);
    --shadow-md: 0 4px 12px rgba(21, 35, 63, 0.10);
    --shadow-lg: 0 12px 32px rgba(21, 35, 63, 0.16);

    /* ========================================================================
       LAYOUT — the shell (css/ui/nav.css, css/ui/layout.css)
       ======================================================================== */
    --nav-w:           240px;
    --nav-w-collapsed:  68px;
    --top-h:            60px;
    --page-pad-x:       24px;

    /* Side panels (css/ui/panel.css) — the replacement for every modal. */
    --panel-sm: 460px;
    --panel-md: 620px;
    --panel-lg: 800px;
    --panel-xl: 940px;

    /* Stacking: above every legacy modal (the highest is 10000). */
    --z-nav:    1000;
    --z-scrim: 20000;
    --z-panel: 20010;
    --z-toast: 20100;

    /* ========================================================================
       KEPT NAMES — older sheets read these. Re-pointed to the new palette.
       Do not use in new work: --color-bg-subtle → --color-row.
       ======================================================================== */
    --color-bg-subtle:        #F6F9FC;
    --color-row-hover:        #E3F5FA;
}
