/* Headwaters appearance tokens: Light, Dark and System for both portals,
 * and device appearance for the customer onboarding wizard.
 *
 * SEMANTIC, NOT BRAND. tokens.css holds the nine brand colours and is NOT
 * redefined here or anywhere: the same brand token is used as a surface in one
 * place and as text in another (--white is the page ground AND the text on a
 * forest button), so remapping it for dark would invert half its uses. Every
 * colour position in an app stylesheet points at a --c-* token below instead,
 * and only these change with the appearance.
 *
 * WHO LOADS THIS. The Compliance Portal, review portal and customer wizard.
 * The wizard follows the device only and never sets data-appearance. Changes
 * to existing values reach customers at the Onboarding Portal's next pin bump.
 *
 * HOW THE MODE IS CHOSEN. theme-boot.js (loaded first, in <head>) sets
 * data-appearance="light" or "dark" on <html> for an explicit choice and leaves
 * it off for System. So:
 *   - no attribute, OS light  -> :root (light)
 *   - no attribute, OS dark   -> the prefers-color-scheme block (dark)
 *   - data-appearance="dark"  -> the forced-dark block, whatever the OS says
 *   - data-appearance="light" -> :root, and the media block's :not() excludes it
 * Print is always light.
 *
 * THE FOUR BLOCKS MUST CARRY THE SAME TOKEN LIST, the two dark ones the same
 * values, and print the light values. test/theme.test.js fails on any drift,
 * and on any text or control pairing from the token inventory
 * (partner-portal artifacts/ui-refresh/token-inventory.md, mirrored in
 * test/contrast-pairs.json) that falls below WCAG AA in either mode, except
 * explicitly recorded legacy wizard light pairs (Eric, 2026-10-31).
 *
 * A NEW COLOUR goes in all four blocks and in the inventory. Distinct light
 * values stay distinct tokens even when they look alike; collapsing two is a
 * visible change and has to be decided, not tidied.
 */

/* ---------- light: the default, and what an explicit Light choice gets ---------- */
:root {
  color-scheme: light;
  /* Surfaces */
  --c-bg: #E8E8DE;
  --c-surface: #FFFFFF;
  --c-surface-2: #F7F8F5;
  --c-surface-3: #F6F7F3;
  --c-surface-soft: #FCFCF8;
  --c-surface-memo: #FAFAF4;
  --c-surface-inverse: #144835;
  --c-tile: #FFFFFF;
  --c-tile-plain: #EFEFEA;
  --c-tile-plain-line: #DEDED4;
  --c-input: #FFFFFF;
  --c-input-readonly: #E8E8DE;
  /* Text */
  --c-text: #10231B;
  --c-text-2: #41584D;
  --c-text-muted: #566A60;
  --c-text-faint: #8A968F;
  --c-text-inverse: #FFFFFF;
  --c-accent-text: #144835;
  --c-section-label: #6D7029;
  /* Lines */
  --c-line: #E8E8DE;
  --c-line-strong: #D6D6C8;
  --c-line-faint: #F0F1EC;
  /* Accent */
  --c-accent: #144835;
  --c-accent-hover: #0E3728;
  --c-on-accent: #FFFFFF;
  /* Danger */
  --c-danger: #B3261E;
  --c-danger-hover: #8A211B;
  --c-on-danger: #FFFFFF;
  --c-danger-line: #E3B3AC;
  --c-danger-soft: #FBE2DE;
  --c-danger-bg: #FEF6F4;
  /* States */
  --c-hover: #F3F5F1;
  --c-hover-strong: #E8E8DE;
  --c-hover-line: #0047C7;
  --c-selected: #E6EEE7;
  --c-selected-fg: #144835;
  --c-focus: #0047C7;
  --c-link: #0047C7;
  /* Pips and alerts */
  --c-pip: #BA4C27;
  --c-pip-fg: #FFFFFF;
  --c-pip-quiet-bg: #E8E8DE;
  --c-pip-quiet-fg: #41584D;
  --c-alert-text: #A8431F;
  --c-toast-err: #BA4C27;
  /* Status: ok */
  --c-ok-bg: #E4EFE2;
  --c-ok-fg: #1F6B3F;
  --c-ok-line: #C5DCC2;
  /* Status: warn (data-quality banners) */
  --c-warn-bg: #FCF3D8;
  --c-warn-fg: #6E5200;
  --c-warn-line: #E9D9A2;
  /* Status: fact / expiring (one pair, item 301) */
  --c-fact-bg: #FCF3D8;
  --c-fact-fg: #8A6100;
  --c-fact-line: #E9D9A2;
  /* Status: info */
  --c-info-bg: #E3EBFB;
  --c-info-fg: #0047C7;
  --c-info-line: #C9D8F8;
  --c-info-soft: #F4F7FF;
  --c-note-fg: #1D3A7A;
  --c-fresh-bg: #EEF3FD;
  /* Status: hold (orange) */
  --c-hold-bg: #FBE7DC;
  --c-hold-fg: #A8431F;
  --c-hold-line: #EEC3AC;
  --c-hold-strong: #7A3419;
  --c-hold-accent: #BA4C27;
  --c-hold-field-bg: #FDF1EB;
  --c-hold-field-fg: #8E3A1D;
  --c-hold-soft: #FBEDE3;
  --c-hold-memo: #FBF1EC;
  /* Status: inactive */
  --c-inactive-bg: #ECECE4;
  --c-inactive-fg: #566A60;
  --c-inactive-line: #DCDCD2;
  /* Status: neutral */
  --c-neutral-bg: #E8E8DE;
  --c-neutral-fg: #41584D;
  --c-neutral-line: #D6D6C8;
  /* Status: cda / clones */
  --c-cda-bg: #EDF0DC;
  --c-cda-fg: #5E6317;
  --c-cda-line: #D9DDB5;
  /* Status: declined / expired */
  --c-declined-bg: #F6DEDA;
  --c-declined-fg: #8E2C1B;
  --c-declined-line: #E8B9B1;
  /* Status: archived statement (red, items 320/320b) */
  --c-archived-statement-bg: #FEF6F4;
  --c-archived-statement-fg: #8E2C1B;
  --c-archived-statement-line: #B3261E;
  /* Status: archived badge (grey row marker) */
  --c-archived-badge-bg: #E7E7E1;
  --c-archived-badge-fg: #5E5E56;
  --c-archived-badge-line: #D3D3CB;
  /* Review portal states (used from P3) */
  --c-review-bg: #FFFDA6;
  --c-review-fg: #5A571C;
  --c-failure: #8C2F1A;
  --c-failure-bg: #FBECE8;
  --c-blocker-bg: #FBEAE7;
  --c-blocker-line: #C0392B;
  --c-blocker-fg: #7A1F12;
  --c-tick-fg: #FFFFFF;
  --c-tick-pass: #144835;
  --c-tick-flag: #BA4C27;
  --c-tick-manual: #0047C7;
  --c-tick-unavailable: #7D8781;
  --c-tick-na-bg: #D6D6C8;
  --c-tick-na-fg: #4B5A52;
  /* Diff */
  --c-diff-del-fg: #9E5B4A;
  --c-diff-ins-fg: #1F6B3F;
  /* Spinner */
  --c-spinner: #0047C7;
  /* Elevation and overlays */
  --c-shadow-card: 0 1px 2px rgba(16,35,27,.06), 0 4px 14px rgba(16,35,27,.05);
  --c-shadow-menu: 0 8px 24px rgba(16,35,27,.18);
  --c-shadow-toast: 0 8px 26px rgba(16,35,27,.28);
  --c-shadow-modal: 0 20px 60px rgba(16,35,27,.3);
  --c-shadow-dialog: 0 10px 40px rgba(0,0,0,.3);
  --c-overlay: rgba(16,35,27,.42);
  --c-overlay-strong: rgba(16,35,27,.55);
  --c-overlay-busy: rgba(16,35,27,.72);
  --c-on-overlay: #FFFFFF;
  --c-on-overlay-2: rgba(255,255,255,.7);
  --c-on-overlay-link: rgba(255,255,255,.85);
  /* Chrome: the green header (deleted in P2 for CP, P3 for RP) */
  --c-chrome-bg: #144835;
  --c-chrome-fg: #E8E8DE;
  --c-chrome-fg-2: #C9D6CE;
  --c-chrome-fg-strong: #FFFFFF;
  --c-chrome-line: rgba(232,232,222,.3);
  --c-chrome-line-2: rgba(232,232,222,.35);
  --c-chrome-line-soft: rgba(232,232,222,.2);
  --c-chrome-hover: rgba(255,255,255,.08);
  --c-chrome-on: rgba(255,255,255,.14);
  --c-chrome-btn: rgba(255,255,255,.12);
  --c-chrome-btn-line: rgba(255,255,255,.2);
  --c-chrome-btn-hover: rgba(255,255,255,.2);
  --c-chrome-btn-hover-line: rgba(255,255,255,.35);
  /* Email preview: stays light in every mode (the email is what the recipient sees) */
  --c-preview-bg: #FFFFFF;
  --c-preview-surface: #FAFAF4;
  --c-preview-text: #10231B;
  --c-preview-line: #D6D6C8;
  /* Customer wizard (OP#62) */
  --c-wizard-primary: #0047C7;
  --c-on-wizard-primary: #FFFFFF;
  --c-control-line: #7C8C82;
  --c-drop-line: #7C8C82;
  /* Eric, 2026-10-31: retain b8306eb light colours; dark stays as built. */
  --c-wizard-control-line: #D6D6C8;
  --c-wizard-drop-line: #D6D6C8;
  --c-wizard-text-muted: #6B7E74;
  --c-wizard-section-label: #898D36;
  --c-wizard-inactive-bg: #D6D6C8;
  --c-wizard-inactive-fg: #8A8A7E;
  --c-wizard-ok-fg: #144835;
  --c-wizard-hold-fg: #BA4C27;
  --c-wizard-hold-strong: #7A2F12;
  --c-wizard-failure: #B4472F;
  --c-wizard-failure-bg: #FBECE9;
  --c-wizard-info-soft: #EDF2F7;
  --c-wizard-supp-ok-fg: #3F6C51;
  --c-wizard-supp-ok-bg: #EEF4F0;
  --c-wizard-review-line: #DEDB8E;
  --c-wizard-legal-text: #28362F;
  --c-wizard-intent-implied: #FFFFFF;
}

/* ---------- dark, chosen explicitly ---------- */
:root[data-appearance="dark"] {
  color-scheme: dark;
  /* Surfaces */
  --c-bg: #101A16;
  --c-surface: #18251F;
  --c-surface-2: #1D2B24;
  --c-surface-3: #1C2923;
  --c-surface-soft: #1B2822;
  --c-surface-memo: #1B2822;
  --c-surface-inverse: #CFE3D2;
  --c-tile: #18251F;
  --c-tile-plain: #151F1A;
  --c-tile-plain-line: #2A3831;
  --c-input: #111C17;
  --c-input-readonly: #1F2C26;
  /* Text */
  --c-text: #E6EEE7;
  --c-text-2: #C3D0C7;
  --c-text-muted: #A2B3A7;
  --c-text-faint: #6F8177;
  --c-text-inverse: #10231B;
  --c-accent-text: #B9D8BC;
  --c-section-label: #C9CC85;
  /* Lines */
  --c-line: #26352E;
  --c-line-strong: #33443B;
  --c-line-faint: #213029;
  /* Accent */
  --c-accent: #B9D8BC;
  --c-accent-hover: #CFE5D1;
  --c-on-accent: #10231B;
  /* Danger */
  --c-danger: #F28B82;
  --c-danger-hover: #F6A9A2;
  --c-on-danger: #2A0D0A;
  --c-danger-line: #6B2E28;
  --c-danger-soft: #3A1A17;
  --c-danger-bg: #2A1614;
  /* States */
  --c-hover: #1F2E27;
  --c-hover-strong: #26352E;
  --c-hover-line: #8FB4FF;
  --c-selected: #2B4134;
  --c-selected-fg: #B9D8BC;
  --c-focus: #8FB4FF;
  --c-link: #8FB4FF;
  /* Pips and alerts */
  --c-pip: #BA4C27;
  --c-pip-fg: #FFFFFF;
  --c-pip-quiet-bg: #26352E;
  --c-pip-quiet-fg: #C3D0C7;
  --c-alert-text: #F0A07A;
  --c-toast-err: #F0A07A;
  /* Status: ok */
  --c-ok-bg: #1F3A2A;
  --c-ok-fg: #A8DCB5;
  --c-ok-line: #2F5A40;
  /* Status: warn (data-quality banners) */
  --c-warn-bg: #3A3020;
  --c-warn-fg: #F2DCA8;
  --c-warn-line: #5C4D2A;
  /* Status: fact / expiring (one pair, item 301) */
  --c-fact-bg: #3A3020;
  --c-fact-fg: #EDD197;
  --c-fact-line: #5C4D2A;
  /* Status: info */
  --c-info-bg: #1C2A4A;
  --c-info-fg: #A9C4FF;
  --c-info-line: #2E4574;
  --c-info-soft: #16213A;
  --c-note-fg: #BFD2FF;
  --c-fresh-bg: #172340;
  /* Status: hold (orange) */
  --c-hold-bg: #3F2419;
  --c-hold-fg: #F3A888;
  --c-hold-line: #6B3A26;
  --c-hold-strong: #F6C1A8;
  --c-hold-accent: #E08A63;
  --c-hold-field-bg: #3A2218;
  --c-hold-field-fg: #F6B89C;
  --c-hold-soft: #3A2419;
  --c-hold-memo: #33201A;
  /* Status: inactive */
  --c-inactive-bg: #242D28;
  --c-inactive-fg: #A2B3A7;
  --c-inactive-line: #34403A;
  /* Status: neutral */
  --c-neutral-bg: #26332D;
  --c-neutral-fg: #C3D0C7;
  --c-neutral-line: #33443B;
  /* Status: cda / clones */
  --c-cda-bg: #2E3219;
  --c-cda-fg: #D7DC98;
  --c-cda-line: #4A5028;
  /* Status: declined / expired */
  --c-declined-bg: #3D1D19;
  --c-declined-fg: #F2A79C;
  --c-declined-line: #6B2E28;
  /* Status: archived statement (red, items 320/320b) */
  --c-archived-statement-bg: #2E1715;
  --c-archived-statement-fg: #F5B0A8;
  --c-archived-statement-line: #F28B82;
  /* Status: archived badge (grey row marker) */
  --c-archived-badge-bg: #2A2D2A;
  --c-archived-badge-fg: #B3B8B2;
  --c-archived-badge-line: #3C403C;
  /* Review portal states (used from P3) */
  --c-review-bg: #3F3D1A;
  --c-review-fg: #EDE9A0;
  --c-failure: #F29C88;
  --c-failure-bg: #34191A;
  --c-blocker-bg: #3A1714;
  --c-blocker-line: #E0776A;
  --c-blocker-fg: #F5B3A8;
  --c-tick-fg: #10231B;
  --c-tick-pass: #B9D8BC;
  --c-tick-flag: #F0A07A;
  --c-tick-manual: #8FB4FF;
  --c-tick-unavailable: #9AA39D;
  --c-tick-na-bg: #33443B;
  --c-tick-na-fg: #C3D0C7;
  /* Diff */
  --c-diff-del-fg: #E59B8A;
  --c-diff-ins-fg: #8FD3A4;
  /* Spinner */
  --c-spinner: #8FB4FF;
  /* Elevation and overlays */
  --c-shadow-card: none;
  --c-shadow-menu: 0 8px 24px rgba(0,0,0,.5);
  --c-shadow-toast: 0 8px 26px rgba(0,0,0,.55);
  --c-shadow-modal: 0 20px 60px rgba(0,0,0,.6);
  --c-shadow-dialog: 0 10px 40px rgba(0,0,0,.6);
  --c-overlay: rgba(0,0,0,.6);
  --c-overlay-strong: rgba(0,0,0,.65);
  --c-overlay-busy: rgba(0,0,0,.78);
  --c-on-overlay: #FFFFFF;
  --c-on-overlay-2: rgba(255,255,255,.7);
  --c-on-overlay-link: rgba(255,255,255,.85);
  /* Chrome: the green header (deleted in P2 for CP, P3 for RP) */
  --c-chrome-bg: #0F2A20;
  --c-chrome-fg: #E8E8DE;
  --c-chrome-fg-2: #C9D6CE;
  --c-chrome-fg-strong: #FFFFFF;
  --c-chrome-line: rgba(232,232,222,.3);
  --c-chrome-line-2: rgba(232,232,222,.35);
  --c-chrome-line-soft: rgba(232,232,222,.2);
  --c-chrome-hover: rgba(255,255,255,.08);
  --c-chrome-on: rgba(255,255,255,.14);
  --c-chrome-btn: rgba(255,255,255,.12);
  --c-chrome-btn-line: rgba(255,255,255,.2);
  --c-chrome-btn-hover: rgba(255,255,255,.2);
  --c-chrome-btn-hover-line: rgba(255,255,255,.35);
  /* Email preview: stays light in every mode (the email is what the recipient sees) */
  --c-preview-bg: #FFFFFF;
  --c-preview-surface: #FAFAF4;
  --c-preview-text: #10231B;
  --c-preview-line: #D6D6C8;
  /* Customer wizard (OP#62) */
  --c-wizard-primary: #8FB4FF;
  --c-on-wizard-primary: #10231B;
  --c-control-line: #71867A;
  --c-drop-line: #71867A;
  /* Eric, 2026-10-31: retain b8306eb light colours; dark stays as built. */
  --c-wizard-control-line: #71867A;
  --c-wizard-drop-line: #71867A;
  --c-wizard-text-muted: #A2B3A7;
  --c-wizard-section-label: #C9CC85;
  --c-wizard-inactive-bg: #242D28;
  --c-wizard-inactive-fg: #A2B3A7;
  --c-wizard-ok-fg: #A8DCB5;
  --c-wizard-hold-fg: #F3A888;
  --c-wizard-hold-strong: #F6C1A8;
  --c-wizard-failure: #F29C88;
  --c-wizard-failure-bg: #34191A;
  --c-wizard-info-soft: #16213A;
  --c-wizard-supp-ok-fg: #A8DCB5;
  --c-wizard-supp-ok-bg: #1F3A2A;
  --c-wizard-review-line: #5C4D2A;
  --c-wizard-legal-text: #C3D0C7;
  --c-wizard-intent-implied: #1F2C26;
}

/* ---------- dark, following the OS (System, the default preference) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-appearance="light"]) {
    color-scheme: dark;
    /* Surfaces */
    --c-bg: #101A16;
    --c-surface: #18251F;
    --c-surface-2: #1D2B24;
    --c-surface-3: #1C2923;
    --c-surface-soft: #1B2822;
    --c-surface-memo: #1B2822;
    --c-surface-inverse: #CFE3D2;
    --c-tile: #18251F;
    --c-tile-plain: #151F1A;
    --c-tile-plain-line: #2A3831;
    --c-input: #111C17;
    --c-input-readonly: #1F2C26;
    /* Text */
    --c-text: #E6EEE7;
    --c-text-2: #C3D0C7;
    --c-text-muted: #A2B3A7;
    --c-text-faint: #6F8177;
    --c-text-inverse: #10231B;
    --c-accent-text: #B9D8BC;
    --c-section-label: #C9CC85;
    /* Lines */
    --c-line: #26352E;
    --c-line-strong: #33443B;
    --c-line-faint: #213029;
    /* Accent */
    --c-accent: #B9D8BC;
    --c-accent-hover: #CFE5D1;
    --c-on-accent: #10231B;
    /* Danger */
    --c-danger: #F28B82;
    --c-danger-hover: #F6A9A2;
    --c-on-danger: #2A0D0A;
    --c-danger-line: #6B2E28;
    --c-danger-soft: #3A1A17;
    --c-danger-bg: #2A1614;
    /* States */
    --c-hover: #1F2E27;
    --c-hover-strong: #26352E;
    --c-hover-line: #8FB4FF;
    --c-selected: #2B4134;
    --c-selected-fg: #B9D8BC;
    --c-focus: #8FB4FF;
    --c-link: #8FB4FF;
    /* Pips and alerts */
    --c-pip: #BA4C27;
    --c-pip-fg: #FFFFFF;
    --c-pip-quiet-bg: #26352E;
    --c-pip-quiet-fg: #C3D0C7;
    --c-alert-text: #F0A07A;
    --c-toast-err: #F0A07A;
    /* Status: ok */
    --c-ok-bg: #1F3A2A;
    --c-ok-fg: #A8DCB5;
    --c-ok-line: #2F5A40;
    /* Status: warn (data-quality banners) */
    --c-warn-bg: #3A3020;
    --c-warn-fg: #F2DCA8;
    --c-warn-line: #5C4D2A;
    /* Status: fact / expiring (one pair, item 301) */
    --c-fact-bg: #3A3020;
    --c-fact-fg: #EDD197;
    --c-fact-line: #5C4D2A;
    /* Status: info */
    --c-info-bg: #1C2A4A;
    --c-info-fg: #A9C4FF;
    --c-info-line: #2E4574;
    --c-info-soft: #16213A;
    --c-note-fg: #BFD2FF;
    --c-fresh-bg: #172340;
    /* Status: hold (orange) */
    --c-hold-bg: #3F2419;
    --c-hold-fg: #F3A888;
    --c-hold-line: #6B3A26;
    --c-hold-strong: #F6C1A8;
    --c-hold-accent: #E08A63;
    --c-hold-field-bg: #3A2218;
    --c-hold-field-fg: #F6B89C;
    --c-hold-soft: #3A2419;
    --c-hold-memo: #33201A;
    /* Status: inactive */
    --c-inactive-bg: #242D28;
    --c-inactive-fg: #A2B3A7;
    --c-inactive-line: #34403A;
    /* Status: neutral */
    --c-neutral-bg: #26332D;
    --c-neutral-fg: #C3D0C7;
    --c-neutral-line: #33443B;
    /* Status: cda / clones */
    --c-cda-bg: #2E3219;
    --c-cda-fg: #D7DC98;
    --c-cda-line: #4A5028;
    /* Status: declined / expired */
    --c-declined-bg: #3D1D19;
    --c-declined-fg: #F2A79C;
    --c-declined-line: #6B2E28;
    /* Status: archived statement (red, items 320/320b) */
    --c-archived-statement-bg: #2E1715;
    --c-archived-statement-fg: #F5B0A8;
    --c-archived-statement-line: #F28B82;
    /* Status: archived badge (grey row marker) */
    --c-archived-badge-bg: #2A2D2A;
    --c-archived-badge-fg: #B3B8B2;
    --c-archived-badge-line: #3C403C;
    /* Review portal states (used from P3) */
    --c-review-bg: #3F3D1A;
    --c-review-fg: #EDE9A0;
    --c-failure: #F29C88;
    --c-failure-bg: #34191A;
    --c-blocker-bg: #3A1714;
    --c-blocker-line: #E0776A;
    --c-blocker-fg: #F5B3A8;
    --c-tick-fg: #10231B;
    --c-tick-pass: #B9D8BC;
    --c-tick-flag: #F0A07A;
    --c-tick-manual: #8FB4FF;
    --c-tick-unavailable: #9AA39D;
    --c-tick-na-bg: #33443B;
    --c-tick-na-fg: #C3D0C7;
    /* Diff */
    --c-diff-del-fg: #E59B8A;
    --c-diff-ins-fg: #8FD3A4;
    /* Spinner */
    --c-spinner: #8FB4FF;
    /* Elevation and overlays */
    --c-shadow-card: none;
    --c-shadow-menu: 0 8px 24px rgba(0,0,0,.5);
    --c-shadow-toast: 0 8px 26px rgba(0,0,0,.55);
    --c-shadow-modal: 0 20px 60px rgba(0,0,0,.6);
    --c-shadow-dialog: 0 10px 40px rgba(0,0,0,.6);
    --c-overlay: rgba(0,0,0,.6);
    --c-overlay-strong: rgba(0,0,0,.65);
    --c-overlay-busy: rgba(0,0,0,.78);
    --c-on-overlay: #FFFFFF;
    --c-on-overlay-2: rgba(255,255,255,.7);
    --c-on-overlay-link: rgba(255,255,255,.85);
    /* Chrome: the green header (deleted in P2 for CP, P3 for RP) */
    --c-chrome-bg: #0F2A20;
    --c-chrome-fg: #E8E8DE;
    --c-chrome-fg-2: #C9D6CE;
    --c-chrome-fg-strong: #FFFFFF;
    --c-chrome-line: rgba(232,232,222,.3);
    --c-chrome-line-2: rgba(232,232,222,.35);
    --c-chrome-line-soft: rgba(232,232,222,.2);
    --c-chrome-hover: rgba(255,255,255,.08);
    --c-chrome-on: rgba(255,255,255,.14);
    --c-chrome-btn: rgba(255,255,255,.12);
    --c-chrome-btn-line: rgba(255,255,255,.2);
    --c-chrome-btn-hover: rgba(255,255,255,.2);
    --c-chrome-btn-hover-line: rgba(255,255,255,.35);
    /* Email preview: stays light in every mode (the email is what the recipient sees) */
    --c-preview-bg: #FFFFFF;
    --c-preview-surface: #FAFAF4;
    --c-preview-text: #10231B;
    --c-preview-line: #D6D6C8;
    /* Customer wizard (OP#62) */
    --c-wizard-primary: #8FB4FF;
    --c-on-wizard-primary: #10231B;
    --c-control-line: #71867A;
    --c-drop-line: #71867A;
    /* Eric, 2026-10-31: retain b8306eb light colours; dark stays as built. */
    --c-wizard-control-line: #71867A;
    --c-wizard-drop-line: #71867A;
    --c-wizard-text-muted: #A2B3A7;
    --c-wizard-section-label: #C9CC85;
    --c-wizard-inactive-bg: #242D28;
    --c-wizard-inactive-fg: #A2B3A7;
    --c-wizard-ok-fg: #A8DCB5;
    --c-wizard-hold-fg: #F3A888;
    --c-wizard-hold-strong: #F6C1A8;
    --c-wizard-failure: #F29C88;
    --c-wizard-failure-bg: #34191A;
    --c-wizard-info-soft: #16213A;
    --c-wizard-supp-ok-fg: #A8DCB5;
    --c-wizard-supp-ok-bg: #1F3A2A;
    --c-wizard-review-line: #5C4D2A;
    --c-wizard-legal-text: #C3D0C7;
    --c-wizard-intent-implied: #1F2C26;
  }
}

/* ---------- print: always light, whatever the screen was showing ----------
   Listed after both dark blocks and with selectors that tie or beat them, so
   source order decides it. */
@media print {
  :root, :root[data-appearance="dark"], :root:not([data-appearance="light"]) {
    color-scheme: light;
    /* Surfaces */
    --c-bg: #E8E8DE;
    --c-surface: #FFFFFF;
    --c-surface-2: #F7F8F5;
    --c-surface-3: #F6F7F3;
    --c-surface-soft: #FCFCF8;
    --c-surface-memo: #FAFAF4;
    --c-surface-inverse: #144835;
    --c-tile: #FFFFFF;
    --c-tile-plain: #EFEFEA;
    --c-tile-plain-line: #DEDED4;
    --c-input: #FFFFFF;
    --c-input-readonly: #E8E8DE;
    /* Text */
    --c-text: #10231B;
    --c-text-2: #41584D;
    --c-text-muted: #566A60;
    --c-text-faint: #8A968F;
    --c-text-inverse: #FFFFFF;
    --c-accent-text: #144835;
    --c-section-label: #6D7029;
    /* Lines */
    --c-line: #E8E8DE;
    --c-line-strong: #D6D6C8;
    --c-line-faint: #F0F1EC;
    /* Accent */
    --c-accent: #144835;
    --c-accent-hover: #0E3728;
    --c-on-accent: #FFFFFF;
    /* Danger */
    --c-danger: #B3261E;
    --c-danger-hover: #8A211B;
    --c-on-danger: #FFFFFF;
    --c-danger-line: #E3B3AC;
    --c-danger-soft: #FBE2DE;
    --c-danger-bg: #FEF6F4;
    /* States */
    --c-hover: #F3F5F1;
    --c-hover-strong: #E8E8DE;
    --c-hover-line: #0047C7;
    --c-selected: #E6EEE7;
    --c-selected-fg: #144835;
    --c-focus: #0047C7;
    --c-link: #0047C7;
    /* Pips and alerts */
    --c-pip: #BA4C27;
    --c-pip-fg: #FFFFFF;
    --c-pip-quiet-bg: #E8E8DE;
    --c-pip-quiet-fg: #41584D;
    --c-alert-text: #A8431F;
    --c-toast-err: #BA4C27;
    /* Status: ok */
    --c-ok-bg: #E4EFE2;
    --c-ok-fg: #1F6B3F;
    --c-ok-line: #C5DCC2;
    /* Status: warn (data-quality banners) */
    --c-warn-bg: #FCF3D8;
    --c-warn-fg: #6E5200;
    --c-warn-line: #E9D9A2;
    /* Status: fact / expiring (one pair, item 301) */
    --c-fact-bg: #FCF3D8;
    --c-fact-fg: #8A6100;
    --c-fact-line: #E9D9A2;
    /* Status: info */
    --c-info-bg: #E3EBFB;
    --c-info-fg: #0047C7;
    --c-info-line: #C9D8F8;
    --c-info-soft: #F4F7FF;
    --c-note-fg: #1D3A7A;
    --c-fresh-bg: #EEF3FD;
    /* Status: hold (orange) */
    --c-hold-bg: #FBE7DC;
    --c-hold-fg: #A8431F;
    --c-hold-line: #EEC3AC;
    --c-hold-strong: #7A3419;
    --c-hold-accent: #BA4C27;
    --c-hold-field-bg: #FDF1EB;
    --c-hold-field-fg: #8E3A1D;
    --c-hold-soft: #FBEDE3;
    --c-hold-memo: #FBF1EC;
    /* Status: inactive */
    --c-inactive-bg: #ECECE4;
    --c-inactive-fg: #566A60;
    --c-inactive-line: #DCDCD2;
    /* Status: neutral */
    --c-neutral-bg: #E8E8DE;
    --c-neutral-fg: #41584D;
    --c-neutral-line: #D6D6C8;
    /* Status: cda / clones */
    --c-cda-bg: #EDF0DC;
    --c-cda-fg: #5E6317;
    --c-cda-line: #D9DDB5;
    /* Status: declined / expired */
    --c-declined-bg: #F6DEDA;
    --c-declined-fg: #8E2C1B;
    --c-declined-line: #E8B9B1;
    /* Status: archived statement (red, items 320/320b) */
    --c-archived-statement-bg: #FEF6F4;
    --c-archived-statement-fg: #8E2C1B;
    --c-archived-statement-line: #B3261E;
    /* Status: archived badge (grey row marker) */
    --c-archived-badge-bg: #E7E7E1;
    --c-archived-badge-fg: #5E5E56;
    --c-archived-badge-line: #D3D3CB;
    /* Review portal states (used from P3) */
    --c-review-bg: #FFFDA6;
    --c-review-fg: #5A571C;
    --c-failure: #8C2F1A;
    --c-failure-bg: #FBECE8;
    --c-blocker-bg: #FBEAE7;
    --c-blocker-line: #C0392B;
    --c-blocker-fg: #7A1F12;
    --c-tick-fg: #FFFFFF;
    --c-tick-pass: #144835;
    --c-tick-flag: #BA4C27;
    --c-tick-manual: #0047C7;
    --c-tick-unavailable: #7D8781;
    --c-tick-na-bg: #D6D6C8;
    --c-tick-na-fg: #4B5A52;
    /* Diff */
    --c-diff-del-fg: #9E5B4A;
    --c-diff-ins-fg: #1F6B3F;
    /* Spinner */
    --c-spinner: #0047C7;
    /* Elevation and overlays */
    --c-shadow-card: 0 1px 2px rgba(16,35,27,.06), 0 4px 14px rgba(16,35,27,.05);
    --c-shadow-menu: 0 8px 24px rgba(16,35,27,.18);
    --c-shadow-toast: 0 8px 26px rgba(16,35,27,.28);
    --c-shadow-modal: 0 20px 60px rgba(16,35,27,.3);
    --c-shadow-dialog: 0 10px 40px rgba(0,0,0,.3);
    --c-overlay: rgba(16,35,27,.42);
    --c-overlay-strong: rgba(16,35,27,.55);
    --c-overlay-busy: rgba(16,35,27,.72);
    --c-on-overlay: #FFFFFF;
    --c-on-overlay-2: rgba(255,255,255,.7);
    --c-on-overlay-link: rgba(255,255,255,.85);
    /* Chrome: the green header (deleted in P2 for CP, P3 for RP) */
    --c-chrome-bg: #144835;
    --c-chrome-fg: #E8E8DE;
    --c-chrome-fg-2: #C9D6CE;
    --c-chrome-fg-strong: #FFFFFF;
    --c-chrome-line: rgba(232,232,222,.3);
    --c-chrome-line-2: rgba(232,232,222,.35);
    --c-chrome-line-soft: rgba(232,232,222,.2);
    --c-chrome-hover: rgba(255,255,255,.08);
    --c-chrome-on: rgba(255,255,255,.14);
    --c-chrome-btn: rgba(255,255,255,.12);
    --c-chrome-btn-line: rgba(255,255,255,.2);
    --c-chrome-btn-hover: rgba(255,255,255,.2);
    --c-chrome-btn-hover-line: rgba(255,255,255,.35);
    /* Email preview: stays light in every mode (the email is what the recipient sees) */
    --c-preview-bg: #FFFFFF;
    --c-preview-surface: #FAFAF4;
    --c-preview-text: #10231B;
    --c-preview-line: #D6D6C8;
    /* Customer wizard (OP#62) */
    --c-wizard-primary: #0047C7;
    --c-on-wizard-primary: #FFFFFF;
    --c-control-line: #7C8C82;
    --c-drop-line: #7C8C82;
    /* Eric, 2026-10-31: retain b8306eb light colours; dark stays as built. */
    --c-wizard-control-line: #D6D6C8;
    --c-wizard-drop-line: #D6D6C8;
    --c-wizard-text-muted: #6B7E74;
    --c-wizard-section-label: #898D36;
    --c-wizard-inactive-bg: #D6D6C8;
    --c-wizard-inactive-fg: #8A8A7E;
    --c-wizard-ok-fg: #144835;
    --c-wizard-hold-fg: #BA4C27;
    --c-wizard-hold-strong: #7A2F12;
    --c-wizard-failure: #B4472F;
    --c-wizard-failure-bg: #FBECE9;
    --c-wizard-info-soft: #EDF2F7;
    --c-wizard-supp-ok-fg: #3F6C51;
    --c-wizard-supp-ok-bg: #EEF4F0;
    --c-wizard-review-line: #DEDB8E;
    --c-wizard-legal-text: #28362F;
    --c-wizard-intent-implied: #FFFFFF;
  }
}

/* ---------- shared components, re-pointed at the tokens ----------
 *
 * drop.css and spinner.css are NOT edited. These rules come after them in
 * both portals and the customer wizard, so they win at the same specificity.
 * The wizard follows the device only and never sets data-appearance; its own
 * resting drop-zone outline uses --c-wizard-drop-line. In light the rules below keep
 * the existing paint except for contrast-corrected `.drop .small` text.
 */
.drop { border-color: var(--c-line-strong); background: var(--c-surface); }
.drop:hover, .drop.over { border-color: var(--c-hover-line); background: var(--c-info-soft); }
.drop .big { color: var(--c-accent-text); }
.drop .small { color: var(--c-text-muted); }

.hwspin { background: var(--c-spinner); }
/* On the full-screen working overlay, which is dark in both modes. */
.hwspin.on-dark { background: var(--c-on-overlay); }
