/* ── Scale tokens: everything that is not a colour ─────────────────────────
   Layer 1 of DESIGN.md §1 for non-colour values. Themes never override
   these. Loaded before every other stylesheet (see the page templates). */

/* Stacking order: one ladder for every layer that can overlap another.
   Local z-indexes inside a component (1-12: sticky cells, resizers) stay
   literal; anything that floats over the page takes a rung from here.
   lib/dialogs.js mirrors the order for Escape handling
   (menu < drawer < modal < sheet). */
:root {
    --z-header:     100;   /* sticky header */
    --z-modal:      200;   /* centred modals: annotate, wide (negotiation, wizard), column picker */
    --z-drawer:     500;   /* device / user drawer */
    --z-menu:       900;   /* settings menu, pulse panel */
    --z-overlay:    999;   /* sync overlay, skip link */
    --z-tooltip:   1100;   /* chart tooltips */
    --z-net-pill:  1150;   /* "connection lost" pill */
    --z-shortcuts: 1200;   /* keyboard cheat sheet */
    --z-tour:      1300;   /* first-run tour */
    --z-palette:   2000;   /* command palette */
    --z-login:     9999;   /* sign-in overlay: above everything but toasts */
    --z-toast:    10000;
}

:root {
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Type scale. Numeric names: --fs-12 is 12px. Every font-size resolves
       to one of these. The named roles (DESIGN.md §3, revamp G1) are what
       components should reach for. */
    --fs-10: 10px;
    --fs-11: 11px;
    --fs-12: 12px;
    --fs-13: 13px;
    --fs-14: 14px;
    --fs-15: 15px;
    --fs-16: 16px;
    --fs-18: 18px;
    --fs-20: 20px;
    --fs-24: 24px;
    --fs-28: 28px;
    --fs-30: 30px;
    --fs-label:   var(--fs-12);   /* field labels, table headers: sentence case, weight 500 */
    --fs-small:   var(--fs-13);
    --fs-body:    var(--fs-14);
    --fs-section: var(--fs-16);
    --fs-title:   var(--fs-20);   /* drawer and dialog titles */
    --fs-page:    var(--fs-24);   /* page titles (one-row page header) */
    --fs-kpi:     var(--fs-20);   /* numbers in the status strip and KPI tiles */

    /* Spacing: an 8px rhythm with 4px half-steps. */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --gutter: 24px;          /* main column padding, desktop */
    --gutter-sm: 16px;       /* main column padding, phones */
    --topbar-h: 52px;        /* the sticky top bar; other sticky bars sit below it */

    /* Radius: 8 controls, 12 cards, 16 drawer and dialogs, pill. --radius-xs
       is for marks too small for 8 (checkboxes, kbd chips, source tags),
       where 8px would turn a square into a circle. */
    --radius-xs:   4px;
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-pill: 999px;

    /* Density: compact is the default (DESIGN.md §0, version D). */
    --row-h:             40px;
    --row-h-comfortable: 56px;
    --control-h:         34px;
    --touch-target:      44px;

    /* Motion: only to explain a state change (DESIGN.md §8). */
    --ease-out:  cubic-bezier(.2, .8, .2, 1);
    --ease:      var(--ease-out);
    --dur-fast:  0.1s;
    --dur-med:   0.15s;
    --dur-slow:  0.2s;
    --dur-enter: 0.22s;
    --dur-exit:  0.16s;

    --thead-top: 52px;   /* updated by updateStickyOffsets() */
}
