/* ============================================================================
   theme-token-bridge.css
   [2026-09-11]  Load AFTER command-center.css / bds.css, BEFORE theme-shell.css.

   ---------------------------------------------------------------------------
   THE PROBLEM THIS SOLVES - WHY DARK MODE WAS HALF-APPLIED
   ---------------------------------------------------------------------------
   On the FSM dashboard in Dark, the DataTable went dark but the page ground,
   the KPI tiles, the tab strip and their text stayed light - so the numbers
   read as near-invisible pale grey on pale blue.

   That is not a selector problem and it cannot be fixed by adding selectors.
   This application does not paint those surfaces with literal colours; it
   paints them with its OWN design tokens, and it does so a lot:

       --cc-*    448 consumption sites     55 declarations
       --bds-*   305 consumption sites     50 declarations
       --bz-*    578                      135   (this feature's own scale)
       --lg-*     52                       75   (sign-in only)

   Of those, only `--bz-*` had a dark palette. `--cc-*` had one too, but it
   lives in command-center-theme.css, which is loaded by exactly ONE view -
   Areas/MYSHOP/Views/CommandCenter/_CommandCenter.cshtml. Every other page
   that consumes `--cc-*` - FSMDashboard, the Nudge Engine screens, anything
   pulling fsm-dashboard-cc.css - loaded the LIGHT definitions from
   command-center.css `:root` and nothing that overrode them.

   `--bds-*` had no dark palette at all, anywhere, despite 305 uses.

   So in Dark: --cc-page-bg stayed #F8FAFC, --cc-card-bg stayed #FFFFFF,
   --cc-text stayed #0F172A and --bds-ink stayed #0F172A. The page was
   *correctly* rendering its tokens; the tokens were simply still light.

   ---------------------------------------------------------------------------
   WHY A TOKEN BRIDGE IS THE RIGHT ARCHITECTURE, NOT A WORKAROUND
   ---------------------------------------------------------------------------
   This is how Fluent and Material actually implement dark mode: you do not
   re-select the elements, you re-point the semantic tokens they already read.

   Consequences that matter here:

     * ONE rule reaches 753 consumption sites. The alternative - selector
       overrides - would mean chasing every class in 37 stylesheets, and would
       miss every screen written after today.
     * NO !important is needed anywhere in this file. Tokens are declared on
       `:root` (specificity 0,1,0); this file declares them on
       `:root[data-bz-theme="dark"]` (0,2,0), which wins on specificity
       regardless of load order. Contrast that with the previous approach,
       where theme-shell.css needed !important and then outranked
       purpose-built page CSS - see Docs/Theme-System.md 13.4.
     * It CANNOT break Standard. Custom properties do nothing until something
       reads them, and these blocks only match when the attribute is present.
     * Inherited, so a token flips for descendants of <html> - i.e. everything,
       including markup injected later by DevExpress or a partial load.

   ---------------------------------------------------------------------------
   THE ONE RULE FOR EDITING THIS FILE: COLOUR ONLY
   ---------------------------------------------------------------------------
   Only colour, wash and shadow tokens appear below. Deliberately NOT bridged:

       --cc-radius --cc-radius-sm --cc-sidebar-w --cc-sidebar-w-mini
       --cc-header-h --cc-font
       --bds-space-1..8 --bds-radius-* --bds-t-* --bds-w-* --bds-ls-*
       --bds-font --bds-font-icon --bds-ease --bds-speed

   Those are METRICS. A theme that changes a width, a radius scale or a type
   size changes layout, and layout must be identical in all three appearances -
   otherwise switching theme reflows the page and, on DevExpress screens,
   desynchronises JavaScript-measured grid columns.

   `--lg-*` is deliberately absent: login-modern.css already ships light AND
   dark values for it under [data-theme="dark"], and bz-theme.js sets
   data-theme="dark" for Dark, so the sign-in screen is already token-correct.

   Values are written as var(--bz-*) rather than literals so the two systems
   cannot drift: there is one palette, declared in design-system.css, and this
   file only re-points the older namespaces onto it.

   ASCII-only. Chrome 59 floor (custom properties: 49+).
   ============================================================================ */

/* ===========================================================================
   1. DARK - COMMAND CENTER / FSM DASHBOARD / NUDGE ENGINE NAMESPACE
   --------------------------------------------------------------------------- */
:root[data-bz-theme="dark"] {
    /* Brand. Lightened: #2563EB fails contrast on a dark ground. */
    --cc-primary:   var(--bz-primary);
    --cc-deep:      var(--bz-primary-600);

    /* Surfaces. --cc-page-bg is what fsm-dashboard-cc.css paints the page
       canvas with, so this single line is what turns that whole screen dark. */
    --cc-page-bg:   var(--bz-bg);
    --cc-card-bg:   var(--bz-surface);
    --cc-border:    var(--bz-border);

    /* Ink. --cc-text at #0F172A on a dark card was the invisible KPI number. */
    --cc-text:      var(--bz-text);
    --cc-text-2:    var(--bz-muted);

    /* Status. Moved to 400-level tints for the same contrast reason as brand.
       The WASH tokens are the important half: a status wash designed as a
       near-white tint (#ECFDF5, #FFFBEB, #FEF2F2, #EFF6FF) becomes a glaring
       white block on a dark card, which is what makes a half-converted dark
       mode look broken. They become low-alpha veils of the same hue instead,
       so the semantic colour survives without the brightness. */
    --cc-green:     var(--bz-success);
    --cc-green-bg:  rgba(74, 222, 128, .12);
    --cc-amber:     var(--bz-warning);
    --cc-amber-bg:  rgba(251, 191, 36, .12);
    --cc-red:       var(--bz-danger);
    --cc-red-bg:    rgba(248, 113, 113, .12);
    --cc-info-bg:   rgba(96, 165, 250, .14);

    /* Elevation. A light-theme shadow is a dark translucent drop, which is
       invisible on a dark surface - it needs to be deeper, not tinted. */
    --cc-shadow:    0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .34);
    --cc-hover-bg:  var(--bz-surface-2);

    /* [2026-09-11] --bz-app-bg is declared in ftsNewScreen.css :root as #FFFFFF
       and read by `body { background: var(--bz-app-bg) }`. It had no dark
       variant. theme-shell.css sets background-IMAGE on body, so the gradient
       covered it and nothing looked wrong - but the background-COLOR underneath
       stayed white, which shows as a flash before the gradient paints and
       wherever the gradient is not drawn. Bridged so the two agree. */
    --bz-app-bg:    var(--bz-bg);
}

/* ===========================================================================
   2. DARK - BDS NAMESPACE (bds.css)
   305 consumption sites and no dark palette anywhere before this.
   --------------------------------------------------------------------------- */
:root[data-bz-theme="dark"] {
    --bds-ink:          var(--bz-text);
    --bds-ink-2:        var(--bz-muted);
    --bds-ink-3:        #7C8BA1;   /* the third ink must stay BELOW ink-2 in
                                      contrast, or the hierarchy inverts */

    --bds-surface:      var(--bz-surface);
    --bds-canvas:       var(--bz-bg);
    --bds-hover:        var(--bz-surface-2);

    --bds-line:         var(--bz-border);
    --bds-line-2:       var(--bz-border-2);

    --bds-blue:         var(--bz-primary);
    --bds-blue-deep:    var(--bz-primary-600);
    --bds-blue-wash:    rgba(96, 165, 250, .14);
    --bds-blue-ring:    var(--bz-ring);

    --bds-green:        var(--bz-success);
    --bds-green-deep:   var(--bz-success-ink);
    --bds-green-wash:   rgba(74, 222, 128, .12);

    --bds-amber:        var(--bz-warning);
    --bds-amber-deep:   var(--bz-warning-ink);
    --bds-amber-wash:   rgba(251, 191, 36, .12);

    --bds-red:          var(--bz-danger);
    --bds-red-deep:     var(--bz-danger-ink);
    --bds-red-wash:     rgba(248, 113, 113, .12);

    --bds-shadow-1:     0 1px 2px rgba(0, 0, 0, .38), 0 1px 3px rgba(0, 0, 0, .30);
    --bds-shadow-2:     0 4px 6px -1px rgba(0, 0, 0, .42), 0 2px 4px -2px rgba(0, 0, 0, .32);
    --bds-shadow-3:     0 10px 15px -3px rgba(0, 0, 0, .50), 0 4px 6px -4px rgba(0, 0, 0, .34);
}

/* ===========================================================================
   3. MODERN - a RESTRAINED bridge, on purpose
   ---------------------------------------------------------------------------
   Modern deliberately changes very little here, and that is the correct
   answer rather than timidity: --cc-primary is ALREADY #2563EB and so is
   --bds-blue, which is exactly Modern's --bz-primary. The brand and every
   status colour in both namespaces already match the Modern palette, so
   re-pointing them would be a no-op dressed up as work.

   What Modern does change is the three things that made it read as "Standard
   with rounder corners":

     1. the neutral grey canvas (#F8FAFC) becomes the Modern blue-tinted wash,
        so the page ground stops fighting the themed chrome around it;
     2. hairlines pick up the faint blue cast instead of neutral slate;
     3. elevation gains a brand cast rather than grey.

   No status colour, no ink and no metric moves, so nothing can regress.
   --------------------------------------------------------------------------- */
:root[data-bz-theme="nextgen"] {
    --cc-page-bg:   var(--bz-bg);
    --cc-border:    var(--bz-border);
    --cc-shadow:    var(--bz-shadow-sm);
    --cc-hover-bg:  var(--bz-bg-2);

    --bds-canvas:   var(--bz-bg);
    --bds-hover:    var(--bz-bg-2);
    --bds-line:     var(--bz-border);
    --bds-line-2:   var(--bz-border-2);

    --bds-shadow-1: var(--bz-shadow-sm);
    --bds-shadow-2: var(--bz-shadow);
    --bds-shadow-3: var(--bz-shadow-lg);

    /* See the dark block - same reasoning, Nextgen's tinted canvas. */
    --bz-app-bg:    var(--bz-bg);
}
