/* tokens.css -- every colour on the site, once, in a light and a dark
   value (playbooks/colour-and-contrast.md; Nikita, 2026-10-17). Every
   stylesheet uses var(--c-...); no colour is written anywhere else, which
   tools/check-colours.mjs enforces. Every place one token is drawn on
   another is listed in tools/contrast-pairs.json and measured in both
   themes by tools/check-contrast.mjs: text 4.5:1, shapes 3:1 (WCAG 2.2
   AA). The build refuses to package on a failure.

   The theme: data-theme on <html> from the s4x_theme cookie the server
   reads (light or dark), or none to follow the computer, so a page is
   drawn in its colours from the first byte. The dark set is written
   twice, for a chosen Dark and for a computer set to dark;
   tools/check-dark-blocks.mjs keeps the two identical.

   Internal site: colours are chosen for legibility, not to a brand
   palette. Solids that carry white text sit where white reaches 4.5:1
   and the dark page still gives the shape 3:1. */

:root {
    --c-canvas:         #F0F2F5;  /* page behind cards */
    --c-surface:        #FFFFFF;  /* cards, tables, menus, inputs */
    --c-surface-alt:    #F7F8FA;  /* zebra rows, hover, subtle panels */
    --c-surface-sunk:   #ECEEF1;  /* light table heads, filter bars, chips */
    --c-line:           #DFE2E6;  /* hairlines between rows */
    --c-line-strong:    #8A9099;  /* input and control borders (3:1) */
    --c-ink:            #2B2D31;  /* body text */
    --c-ink-muted:      #55595F;  /* secondary text */
    --c-ink-faint:      #62676E;  /* hints, dashes, empty values (AA) */
    --c-link:           #19428A;  /* links */
    --c-bar:            #19428A;  /* site header bar */
    --c-on-bar:         #FFFFFF;  /* text on the bar */
    --c-bar-mark:       #5FB4E6;  /* current-page underline on the bar (3:1) */
    --c-head:           #2A2D36;  /* dark table heads, dark panels */
    --c-head-deep:      #181921;  /* darker band, totals */
    --c-on-head:        #FFFFFF;  /* text on head */
    --c-on-head-muted:  #B9BCC6;  /* secondary text on head */
    --c-head-line:      #3D4251;  /* lines inside heads */
    --c-on-solid:       #FFFFFF;  /* text on any solid colour */
    --c-brand-red:      #CF1E2E;  /* CE red as a solid */
    --c-brand-red-ink:  #B3192A;  /* CE red as text */
    --c-green-solid:    #3D7D38;  /* Discover green buttons */
    --c-green-ink:      #2F6B2B;  /* Discover green as text */
    --c-plum:           #682145;  /* plum text */
    --c-plum-solid:     #682145;  /* plum solid */
    --c-pos-ink:        #1B6E3F;  /* good, up */
    --c-pos-tint:       #E6F4EA;  /* good background */
    --c-pos-solid:      #2E7D32;  /* good solid */
    --c-neg-ink:        #B3261E;  /* bad, down */
    --c-neg-tint:       #FDECEA;  /* bad background */
    --c-neg-solid:      #C0392B;  /* bad solid */
    --c-warn-ink:       #8A5300;  /* warning text */
    --c-warn-tint:      #FFF3CD;  /* warning background */
    --c-warn-solid:     #B35900;  /* warning solid */
    --c-info-ink:       #1F5C99;  /* information text */
    --c-info-tint:      #E7F1FB;  /* information background */
    --c-info-solid:     #2F6FB5;  /* information solid */
    --c-off-ink:        #383D41;  /* neutral badge text */
    --c-off-tint:       #E2E3E5;  /* neutral badge background */
    --c-gold-solid:     #8A6100;  /* gold accent solid */
    --c-teal-solid:     #1F7A5C;  /* teal accent solid */
    --c-pos-on-head:    #7EDB9F;  /* good on a dark head */
    --c-neg-on-head:    #FF8A80;  /* bad on a dark head */
    --c-warn-on-head:   #FFB28A;  /* warning on a dark head */
    --c-info-on-head:   #9CC8FF;  /* information on a dark head */
    --c-accent-on-head: #5FB4E6;  /* links and sort marks on a dark head */
    --c-head-raised:    #3A3F52;  /* hover or band on a dark head */
    --c-grey-solid:     #5F6368;  /* neutral solid (counts, disabled) */
    --c-chart-1:        #CF1E2E;  /* chart: funnel */
    --c-chart-2:        #2A2D36;  /* chart: revenue */
    --c-chart-3:        #3A9E5F;  /* chart: farming */
    --c-overlay:        rgba(0, 0, 0, .45);
    --c-bar-hover:      rgba(255, 255, 255, .12);
    --c-shadow-soft:    rgba(0, 0, 0, .08);
    --c-shadow-pop:     rgba(0, 0, 0, .18);
    color-scheme: light;

    /* Earlier names, kept so nothing outside these files breaks. New
       work uses the --c- names. */
    --s4x-canvas: var(--c-surface);
    --s4x-surface: var(--c-surface);
    --s4x-fill: var(--c-surface-sunk);
    --s4x-border: var(--c-line);
    --s4x-text: var(--c-ink);
    --s4x-blue: var(--c-bar);
    --s4x-accent: var(--c-bar-mark);
    --s4x-ce-red: var(--c-brand-red);
    --sx-blue: var(--c-bar);
    --sx-light-blue: var(--c-bar-mark);
    --sx-charcoal: var(--c-ink);
    --sx-white: var(--c-surface);
    --fill: var(--c-surface-sunk);
    --border: var(--c-line);
    --ok-bg: var(--c-pos-tint);
    --ok-fg: var(--c-pos-ink);
    --warn-bg: var(--c-warn-tint);
    --warn-fg: var(--c-warn-ink);
    --err-bg: var(--c-neg-tint);
    --err-fg: var(--c-neg-ink);
    --off-bg: var(--c-off-tint);
    --off-fg: var(--c-off-ink);
}

:root[data-theme="dark"] {
    --c-canvas:         #121417;  /* page behind cards */
    --c-surface:        #1B1E23;  /* cards, tables, menus, inputs */
    --c-surface-alt:    #21252B;  /* zebra rows, hover, subtle panels */
    --c-surface-sunk:   #282C33;  /* light table heads, filter bars, chips */
    --c-line:           #363B43;  /* hairlines between rows */
    --c-line-strong:    #6B727C;  /* input and control borders (3:1) */
    --c-ink:            #E4E6EA;  /* body text */
    --c-ink-muted:      #B4B9C1;  /* secondary text */
    --c-ink-faint:      #959BA4;  /* hints, dashes, empty values (AA) */
    --c-link:           #8DB4FF;  /* links */
    --c-bar:            #132F63;  /* site header bar */
    --c-on-bar:         #F2F4F7;  /* text on the bar */
    --c-bar-mark:       #5FB4E6;  /* current-page underline on the bar (3:1) */
    --c-head:           #0E1013;  /* dark table heads, dark panels */
    --c-head-deep:      #08090B;  /* darker band, totals */
    --c-on-head:        #E4E6EA;  /* text on head */
    --c-on-head-muted:  #9AA0AA;  /* secondary text on head */
    --c-head-line:      #2A2E36;  /* lines inside heads */
    --c-on-solid:       #FFFFFF;  /* text on any solid colour */
    --c-brand-red:      #CE1E2E;  /* CE red as a solid */
    --c-brand-red-ink:  #FF8A93;  /* CE red as text */
    --c-green-solid:    #3A7735;  /* Discover green buttons */
    --c-green-ink:      #8FD487;  /* Discover green as text */
    --c-plum:           #E6A3C4;  /* plum text */
    --c-plum-solid:     #B33E78;  /* plum solid */
    --c-pos-ink:        #7EDB9F;  /* good, up */
    --c-pos-tint:       #17301F;  /* good background */
    --c-pos-solid:      #2C7830;  /* good solid */
    --c-neg-ink:        #FF8A80;  /* bad, down */
    --c-neg-tint:       #3A1C1F;  /* bad background */
    --c-neg-solid:      #BF392B;  /* bad solid */
    --c-warn-ink:       #F2B35A;  /* warning text */
    --c-warn-tint:      #3A2E14;  /* warning background */
    --c-warn-solid:     #A65300;  /* warning solid */
    --c-info-ink:       #86BBFF;  /* information text */
    --c-info-tint:      #172A42;  /* information background */
    --c-info-solid:     #2D6BAF;  /* information solid */
    --c-off-ink:        #C9CDD2;  /* neutral badge text */
    --c-off-tint:       #30343A;  /* neutral badge background */
    --c-gold-solid:     #8B6200;  /* gold accent solid */
    --c-teal-solid:     #1E775A;  /* teal accent solid */
    --c-pos-on-head:    #7EDB9F;  /* good on a dark head */
    --c-neg-on-head:    #FF8A80;  /* bad on a dark head */
    --c-warn-on-head:   #FFB28A;  /* warning on a dark head */
    --c-info-on-head:   #9CC8FF;  /* information on a dark head */
    --c-accent-on-head: #5FB4E6;  /* links and sort marks on a dark head */
    --c-head-raised:    #262A33;  /* hover or band on a dark head */
    --c-grey-solid:     #6B7079;  /* neutral solid (counts, disabled) */
    --c-chart-1:        #FF6B76;  /* chart: funnel */
    --c-chart-2:        #9DB2D6;  /* chart: revenue */
    --c-chart-3:        #5CC47F;  /* chart: farming */
    --c-overlay:        rgba(0, 0, 0, .65);
    --c-bar-hover:      rgba(255, 255, 255, .10);
    --c-shadow-soft:    rgba(0, 0, 0, .45);
    --c-shadow-pop:     rgba(0, 0, 0, .65);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --c-canvas:         #121417;  /* page behind cards */
        --c-surface:        #1B1E23;  /* cards, tables, menus, inputs */
        --c-surface-alt:    #21252B;  /* zebra rows, hover, subtle panels */
        --c-surface-sunk:   #282C33;  /* light table heads, filter bars, chips */
        --c-line:           #363B43;  /* hairlines between rows */
        --c-line-strong:    #6B727C;  /* input and control borders (3:1) */
        --c-ink:            #E4E6EA;  /* body text */
        --c-ink-muted:      #B4B9C1;  /* secondary text */
        --c-ink-faint:      #959BA4;  /* hints, dashes, empty values (AA) */
        --c-link:           #8DB4FF;  /* links */
        --c-bar:            #132F63;  /* site header bar */
        --c-on-bar:         #F2F4F7;  /* text on the bar */
        --c-bar-mark:       #5FB4E6;  /* current-page underline on the bar (3:1) */
        --c-head:           #0E1013;  /* dark table heads, dark panels */
        --c-head-deep:      #08090B;  /* darker band, totals */
        --c-on-head:        #E4E6EA;  /* text on head */
        --c-on-head-muted:  #9AA0AA;  /* secondary text on head */
        --c-head-line:      #2A2E36;  /* lines inside heads */
        --c-on-solid:       #FFFFFF;  /* text on any solid colour */
        --c-brand-red:      #CE1E2E;  /* CE red as a solid */
        --c-brand-red-ink:  #FF8A93;  /* CE red as text */
        --c-green-solid:    #3A7735;  /* Discover green buttons */
        --c-green-ink:      #8FD487;  /* Discover green as text */
        --c-plum:           #E6A3C4;  /* plum text */
        --c-plum-solid:     #B33E78;  /* plum solid */
        --c-pos-ink:        #7EDB9F;  /* good, up */
        --c-pos-tint:       #17301F;  /* good background */
        --c-pos-solid:      #2C7830;  /* good solid */
        --c-neg-ink:        #FF8A80;  /* bad, down */
        --c-neg-tint:       #3A1C1F;  /* bad background */
        --c-neg-solid:      #BF392B;  /* bad solid */
        --c-warn-ink:       #F2B35A;  /* warning text */
        --c-warn-tint:      #3A2E14;  /* warning background */
        --c-warn-solid:     #A65300;  /* warning solid */
        --c-info-ink:       #86BBFF;  /* information text */
        --c-info-tint:      #172A42;  /* information background */
        --c-info-solid:     #2D6BAF;  /* information solid */
        --c-off-ink:        #C9CDD2;  /* neutral badge text */
        --c-off-tint:       #30343A;  /* neutral badge background */
        --c-gold-solid:     #8B6200;  /* gold accent solid */
        --c-teal-solid:     #1E775A;  /* teal accent solid */
        --c-pos-on-head:    #7EDB9F;  /* good on a dark head */
        --c-neg-on-head:    #FF8A80;  /* bad on a dark head */
        --c-warn-on-head:   #FFB28A;  /* warning on a dark head */
        --c-info-on-head:   #9CC8FF;  /* information on a dark head */
        --c-accent-on-head: #5FB4E6;  /* links and sort marks on a dark head */
        --c-head-raised:    #262A33;  /* hover or band on a dark head */
        --c-grey-solid:     #6B7079;  /* neutral solid (counts, disabled) */
        --c-chart-1:        #FF6B76;  /* chart: funnel */
        --c-chart-2:        #9DB2D6;  /* chart: revenue */
        --c-chart-3:        #5CC47F;  /* chart: farming */
        --c-overlay:        rgba(0, 0, 0, .65);
        --c-bar-hover:      rgba(255, 255, 255, .10);
        --c-shadow-soft:    rgba(0, 0, 0, .45);
        --c-shadow-pop:     rgba(0, 0, 0, .65);
        color-scheme: dark;
    }
}
