/* ============================================================================
   OJUDS — Shared UI Theme  (theme.css)
   ----------------------------------------------------------------------------
   ONE file, linked by EVERY page. It does two things:

     1. Declares design tokens (CSS custom properties) for BOTH looks:
          - :root                      -> "classic" (the current look)  [DEFAULT]
          - :root[data-theme="dark"]   -> "dark" instrument look

     2. Applies the DARK skin to generic/base elements and common wrappers,
        scoped ENTIRELY under [data-theme="dark"].

   >>> KEY GUARANTEE <<<
   In "classic" mode (no data-theme, or data-theme="classic") this file adds
   NO visible rules. Linking it changes NOTHING until a user switches to dark.
   That is what makes adoption zero-risk and instantly reversible.

   Runtime switching is driven by the `data-theme` attribute on <html>,
   set by /js/theme-switch.js (and a no-flash inline snippet in <head>).
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------------- */
:root {
  /* Type (kept identical to the app's current stack so classic is unchanged) */
  --uds-font-ui:   'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --uds-font-mono: 'Consolas', 'SF Mono', 'Ubuntu Mono', Menlo, 'Courier New', monospace;

  /* Geometry (shared by both themes) */
  --uds-r:    10px;   /* card / container radius        */
  --uds-r-sm: 7px;    /* control radius                 */
  --uds-r-xs: 5px;    /* chip / small radius            */

  /* ---- CLASSIC palette = the current look (inert unless a token is used) ---- */
  --uds-bg:          #f0f0f0;
  --uds-surface-1:   #f8f9fa;
  --uds-surface-2:   #ffffff;
  --uds-surface-3:   #e9ecef;
  --uds-line:        #dee2e6;
  --uds-line-2:      #ced4da;

  --uds-text-hi:     #333333;
  --uds-text:        #495057;
  --uds-text-dim:    #6c757d;

  --uds-accent:      #007bff;
  --uds-accent-ink:  #ffffff;
  --uds-accent-soft: #e7f1ff;

  --uds-header-bg:   #2c3e50;
  --uds-header-line: #233140;
  --uds-header-text: #ffffff;
  --uds-header-dim:  #bdc3c7;

  --uds-ok:      #28a745;
  --uds-warn:    #ffc107;
  --uds-danger:  #dc3545;
  --uds-info:    #17a2b8;

  --uds-primary-bg:  #007bff;
  --uds-primary-ink: #ffffff;

  --uds-focus: rgba(0, 123, 255, .25);
  --uds-shadow: 0 2px 4px rgba(0, 0, 0, .10);
}

/* ---- DARK palette = the "instrument cluster" look ------------------------- */
:root[data-theme="dark"] {
  --uds-bg:          #0e1217;
  --uds-surface-1:   #161b22;
  --uds-surface-2:   #1c232c;
  --uds-surface-3:   #232c37;
  --uds-line:        #28313c;
  --uds-line-2:      #37424f;

  --uds-text-hi:     #eaf0f6;
  --uds-text:        #a7b4c2;
  --uds-text-dim:    #8392a3;

  --uds-accent:      #e0a458;   /* warm amber / copper — the single accent    */
  --uds-accent-ink:  #20160a;   /* dark ink for text on the amber             */
  --uds-accent-soft: #2a2114;

  --uds-header-bg:   #12171e;
  --uds-header-line: #28313c;
  --uds-header-text: #eaf0f6;
  --uds-header-dim:  #8999aa;

  --uds-ok:      #4fbf83;
  --uds-warn:    #e6b34c;
  --uds-danger:  #e5626d;
  --uds-info:    #5aa9e6;

  --uds-primary-bg:  #e0a458;
  --uds-primary-ink: #20160a;

  --uds-focus: rgba(224, 164, 88, .30);
  --uds-shadow: 0 8px 24px -12px rgba(0, 0, 0, .70);
}

/* ---- GENERATED TOKENISATION TIER (D2, 2026-07-29) -----------
   Tools/ThemeTokeniser/apply.py emitted these. Every CLASSIC value
   is exactly the literal it replaced, so classic cannot move. Every
   DARK value is derived by derive_dark(), whose bands are fitted to
   the hand-authored palette above (verified by `apply.py --calibrate`).
   The --uds-x- prefix marks the generated tier; D3 folds these into
   the semantic set. Do not hand-edit: re-run apply.py --emit-tokens. */
:root {
  --uds-x-ln-0f3460:           #0f3460;  /* line */
  --uds-x-ln-2a2a2a:           #2a2a2a;  /* line */
  --uds-x-ln-2c3e50:           #2c3e50;  /* line */
  --uds-x-ln-333333:           #333333;  /* line */
  --uds-x-ln-3498db:           #3498db;  /* line */
  --uds-x-ln-444444:           #444444;  /* line */
  --uds-x-ln-495057:           #495057;  /* line */
  --uds-x-ln-6c757d:           #6c757d;  /* line */
  --uds-x-ln-bdc3c7:           #bdc3c7;  /* line */
  --uds-x-ln-cccccc:           #cccccc;  /* line */
  --uds-x-ln-dddddd:           #dddddd;  /* line */
  --uds-x-ln-e74c3c:           #e74c3c;  /* line */
  --uds-x-ln-e9ecef:           #e9ecef;  /* line */
  --uds-x-ln-eeeeee:           #eeeeee;  /* line */
  --uds-x-ln-ffffff:           #ffffff;  /* line */
  --uds-x-bg-218838:           #218838;  /* surface */
  --uds-x-bg-27ae60:           #27ae60;  /* surface */
  --uds-x-bg-3498db:           #3498db;  /* surface */
  --uds-x-bg-6c757d:           #6c757d;  /* surface */
  --uds-x-bg-d4edda:           #d4edda;  /* surface */
  --uds-x-bg-dee2e6:           #dee2e6;  /* surface */
  --uds-x-bg-e74c3c:           #e74c3c;  /* surface */
  --uds-x-bg-f5f5f5:           #f5f5f5;  /* surface */
  --uds-x-bg-f8d7da:           #f8d7da;  /* surface */
  --uds-x-bg-fff3cd:           #fff3cd;  /* surface */
  --uds-x-fg-155724:           #155724;  /* text */
  --uds-x-fg-212529:           #212529;  /* text */
  --uds-x-fg-2c3e50:           #2c3e50;  /* text */
  --uds-x-fg-555555:           #555555;  /* text */
  --uds-x-fg-666666:           #666666;  /* text */
  --uds-x-fg-721c24:           #721c24;  /* text */
  --uds-x-fg-856404:           #856404;  /* text */
  --uds-x-fg-888888:           #888888;  /* text */
  --uds-x-fg-e74c3c:           #e74c3c;  /* text */
  --uds-x-bg-c82333:           #c82333;  /* surface */
  --uds-x-ln-555555:           #555555;  /* line */
  --uds-x-bg-00ff88:           #00ff88;  /* surface */
  --uds-x-bg-90ee90:           #90ee90;  /* surface */
  --uds-x-bg-bbdefb:           #bbdefb;  /* surface */
  --uds-x-bg-c3e6cb:           #c3e6cb;  /* surface */
  --uds-x-bg-c8e6c9:           #c8e6c9;  /* surface */
  --uds-x-bg-cce5ff:           #cce5ff;  /* surface */
  --uds-x-bg-cfe2ff:           #cfe2ff;  /* surface */
  --uds-x-bg-d0e0fa:           #d0e0fa;  /* surface */
  --uds-x-bg-d1ecf1:           #d1ecf1;  /* surface */
  --uds-x-bg-dcf8c6:           #dcf8c6;  /* surface */
  --uds-x-bg-e0e0e0:           #e0e0e0;  /* surface */
  --uds-x-bg-e2e3e5:           #e2e3e5;  /* surface */
  --uds-x-bg-e3f2fd:           #e3f2fd;  /* surface */
  --uds-x-bg-e5ddd5:           #e5ddd5;  /* surface */
  --uds-x-bg-e7f3ff:           #e7f3ff;  /* surface */
  --uds-x-bg-e8e8e8:           #e8e8e8;  /* surface */
  --uds-x-bg-e8f0fe:           #e8f0fe;  /* surface */
  --uds-x-bg-e8f5e9:           #e8f5e9;  /* surface */
  --uds-x-bg-e8f8f0:           #e8f8f0;  /* surface */
  --uds-x-bg-e9d8fd:           #e9d8fd;  /* surface */
  --uds-x-bg-ecf0f1:           #ecf0f1;  /* surface */
  --uds-x-bg-eeeeff:           #eeeeff;  /* surface */
  --uds-x-bg-eef2f7:           #eef2f7;  /* surface */
  --uds-x-bg-f0f2f5:           #f0f2f5;  /* surface */
  --uds-x-bg-f0f4f8:           #f0f4f8;  /* surface */
  --uds-x-bg-f0f4ff:           #f0f4ff;  /* surface */
  --uds-x-bg-f0f7ff:           #f0f7ff;  /* surface */
  --uds-x-bg-f0f8ff:           #f0f8ff;  /* surface */
  --uds-x-bg-f1f1f1:           #f1f1f1;  /* surface */
  --uds-x-bg-f5c6cb:           #f5c6cb;  /* surface */
  --uds-x-bg-f7f9fc:           #f7f9fc;  /* surface */
  --uds-x-bg-fafbfc:           #fafbfc;  /* surface */
  --uds-x-bg-fce4ec:           #fce4ec;  /* surface */
  --uds-x-bg-fdf2f2:           #fdf2f2;  /* surface */
  --uds-x-bg-fef8e8:           #fef8e8;  /* surface */
  --uds-x-bg-fef9e7:           #fef9e7;  /* surface */
  --uds-x-bg-fefefe:           #fefefe;  /* surface */
  --uds-x-bg-ffca2c:           #ffca2c;  /* surface */
  --uds-x-bg-ffe680:           #ffe680;  /* surface */
  --uds-x-bg-ffe69c:           #ffe69c;  /* surface */
  --uds-x-bg-ffe8a1:           #ffe8a1;  /* surface */
  --uds-x-bg-ffeeba:           #ffeeba;  /* surface */
  --uds-x-bg-ffeeee:           #ffeeee;  /* surface */
  /* D4 2026-07-31 — two literals crossed the token frequency floor (8 uses per
     hex+family) once blind spot 5 made 126 previously-invisible .style
     assignments countable: #2ecc71 went 7->8 and #c3e6cb went 6->8. The floor
     was undercounting BECAUSE of the blind spot, so these are a corrected
     count, not new policy. apply.py never writes theme.css (NEVER_TOUCH), so
     the pairs it planned have to be declared here by hand or every reference
     dangles. */
  --uds-x-bg-2ecc71:           #2ecc71;  /* surface */
  --uds-x-ln-c3e6cb:           #c3e6cb;  /* line */
  /* D4 2026-07-31 — <canvas> series ink for js/vaps-editor.js. var() does not
     resolve on a canvas, so these are read at DRAW TIME through
     vapsThemeColor(token, fallback); the classic value below IS the literal
     they replace, so the guarantee holds unchanged.
     TEXT family on purpose: a data curve must stay vivid. The line family
     would send #fd7e14 to #5a3617 (1.49:1) — a curve you cannot see.
     Mapped to generated tokens, NOT to --uds-accent/--uds-ok, because those
     dark values are #e0a458 and #4fbf83 — 1.06:1 against each other, which
     would collapse two of the three series into the same brightness. */
  --uds-x-fg-007bff:           #007bff;  /* text */
  --uds-x-fg-0056b3:           #0056b3;  /* text */

  /* D5 2026-08-01 — R8, inks stranded by a moving background.
     Each of these is a rare literal that scan.py left as "one-off literal"
     because the frequency floor returns BEFORE R7 is consulted, while the
     background of the same block HAD been tokenised. The background then
     followed the theme into dark and the ink stayed put: 12 of them were hard
     failures in dark while reading 6:1–9:1 in classic. Found by
     Tools/ThemeTokeniser/pairing.py. Classic values are the literals they
     replace, so the guarantee holds unchanged. */
  --uds-x-fg-004085:           #004085;  /* text */
  --uds-x-fg-0a3a72:           #0a3a72;  /* text */
  --uds-x-fg-0c5460:           #0c5460;  /* text */
  --uds-x-fg-1976d2:           #1976d2;  /* text */
  --uds-x-fg-2e7d32:           #2e7d32;  /* text */
  --uds-x-fg-34495e:           #34495e;  /* text */
  --uds-x-fg-383d41:           #383d41;  /* text */
  --uds-x-fg-553c9a:           #553c9a;  /* text */
  --uds-x-fg-883322:           #883322;  /* text */
  --uds-x-fg-c62828:           #c62828;  /* text */
  --uds-x-fg-cc3333:           #cc3333;  /* text */
}
:root[data-theme="dark"] {
  --uds-x-ln-0f3460:           #264262;  /* line */
  --uds-x-ln-2a2a2a:           #464646;  /* line */
  --uds-x-ln-2c3e50:           #38444f;  /* line */
  --uds-x-ln-333333:           #454545;  /* line */
  --uds-x-ln-3498db:           #213e51;  /* line */
  --uds-x-ln-444444:           #434343;  /* line */
  --uds-x-ln-495057:           #3d4144;  /* line */
  --uds-x-ln-6c757d:           #393c3e;  /* line */
  --uds-x-ln-bdc3c7:           #2e3133;  /* line */
  --uds-x-ln-cccccc:           #2f2f2f;  /* line */
  --uds-x-ln-dddddd:           #2c2c2c;  /* line */
  --uds-x-ln-e74c3c:           #51221d;  /* line */
  --uds-x-ln-e9ecef:           #262a2e;  /* line */
  --uds-x-ln-eeeeee:           #2a2a2a;  /* line */
  --uds-x-ln-ffffff:           #282828;  /* line */
  --uds-x-bg-218838:           #172e1c;  /* surface */
  --uds-x-bg-27ae60:           #152b1e;  /* surface */
  --uds-x-bg-3498db:           #111f27;  /* surface */
  --uds-x-bg-6c757d:           #1d1f20;  /* surface */
  --uds-x-bg-d4edda:           #0e1610;  /* surface */
  --uds-x-bg-dee2e6:           #101213;  /* surface */
  --uds-x-bg-e74c3c:           #27120f;  /* surface */
  --uds-x-bg-f5f5f5:           #0f0f0f;  /* surface */
  --uds-x-bg-f8d7da:           #170a0c;  /* surface */
  --uds-x-bg-fff3cd:           #1a1608;  /* surface */
  --uds-x-fg-155724:           #dff5e4;  /* text */
  --uds-x-fg-212529:           #f1f2f3;  /* text */
  --uds-x-fg-2c3e50:           #d1dae3;  /* text */
  --uds-x-fg-555555:           #adadad;  /* text */
  --uds-x-fg-666666:           #8c8c8c;  /* text */
  --uds-x-fg-721c24:           #e5acb2;  /* text */
  --uds-x-fg-856404:           #f5e1a6;  /* text */
  --uds-x-fg-888888:           #8a8a8a;  /* text */
  --uds-x-fg-e74c3c:           #de665a;  /* text */
  --uds-x-bg-c82333:           #2a1315;  /* surface */
  --uds-x-ln-555555:           #404040;  /* line */
  --uds-x-bg-00ff88:           #0d2d1e;  /* surface */
  --uds-x-bg-90ee90:           #0d1e0d;  /* surface */
  --uds-x-bg-bbdefb:           #09131b;  /* surface */
  --uds-x-bg-c3e6cb:           #0f1711;  /* surface */
  --uds-x-bg-c8e6c9:           #0f170f;  /* surface */
  --uds-x-bg-cce5ff:           #08111a;  /* surface */
  --uds-x-bg-cfe2ff:           #080f1a;  /* surface */
  --uds-x-bg-d0e0fa:           #0a0f19;  /* surface */
  --uds-x-bg-d1ecf1:           #0c1517;  /* surface */
  --uds-x-bg-dcf8c6:           #111a0a;  /* surface */
  --uds-x-bg-e0e0e0:           #121212;  /* surface */
  --uds-x-bg-e2e3e5:           #111112;  /* surface */
  --uds-x-bg-e3f2fd:           #081117;  /* surface */
  --uds-x-bg-e5ddd5:           #141210;  /* surface */
  --uds-x-bg-e7f3ff:           #070f18;  /* surface */
  --uds-x-bg-e8e8e8:           #111111;  /* surface */
  --uds-x-bg-e8f0fe:           #080d17;  /* surface */
  --uds-x-bg-e8f5e9:           #0d130d;  /* surface */
  --uds-x-bg-e8f8f0:           #0b1410;  /* surface */
  --uds-x-bg-e9d8fd:           #100819;  /* surface */
  --uds-x-bg-ecf0f1:           #0f1111;  /* surface */
  --uds-x-bg-eeeeff:           #070717;  /* surface */
  --uds-x-bg-eef2f7:           #0c0f13;  /* surface */
  --uds-x-bg-f0f2f5:           #0e0f11;  /* surface */
  --uds-x-bg-f0f4f8:           #0c0f12;  /* surface */
  --uds-x-bg-f0f4ff:           #070b17;  /* surface */
  --uds-x-bg-f0f7ff:           #070e17;  /* surface */
  --uds-x-bg-f0f8ff:           #070f17;  /* surface */
  --uds-x-bg-f1f1f1:           #101010;  /* surface */
  --uds-x-bg-f5c6cb:           #190b0d;  /* surface */
  --uds-x-bg-f7f9fc:           #0b0e12;  /* surface */
  --uds-x-bg-fafbfc:           #0d0f10;  /* surface */
  --uds-x-bg-fce4ec:           #17090e;  /* surface */
  --uds-x-bg-fdf2f2:           #150909;  /* surface */
  --uds-x-bg-fef8e8:           #171308;  /* surface */
  --uds-x-bg-fef9e7:           #171408;  /* surface */
  --uds-x-bg-fefefe:           #0e0e0e;  /* surface */
  --uds-x-bg-ffca2c:           #29220c;  /* surface */
  --uds-x-bg-ffe680:           #221d0a;  /* surface */
  --uds-x-bg-ffe69c:           #1f1909;  /* surface */
  --uds-x-bg-ffe8a1:           #1e1909;  /* surface */
  --uds-x-bg-ffeeba:           #1c1708;  /* surface */
  --uds-x-bg-ffeeee:           #170707;  /* surface */
  /* D4 2026-07-31 — frequency-floor pairs; see the classic block.
     Both derived by apply.py's derive_dark(), not hand-picked. */
  --uds-x-bg-2ecc71:           #13281c;  /* surface */
  --uds-x-ln-c3e6cb:           #223928;  /* line */
  /* D4 2026-07-31 — see the classic block. Derived by apply.py's derive_dark()
     on the text family, which lifts until 4.5:1 against --uds-surface-2.
     #007bff read 3.98:1 on the dark canvas and #0056b3 read 2.25:1 — the hover
     marker was all but invisible. These land at 4.56:1 and 5.86:1. */
  --uds-x-fg-007bff:           #2f8bee;  /* text */
  --uds-x-fg-0056b3:           #57a1f1;  /* text */

  /* D5 2026-08-01 — see the classic block. derive_dark() on the text family,
     which lifts each value until it clears 4.5:1 against --uds-surface-2. The
     backgrounds these sit on are darker still, so every pair clears the floor
     by more than that lift guarantees. */
  --uds-x-fg-004085:           #aad0f8;  /* text */
  --uds-x-fg-0a3a72:           #c0d8f4;  /* text */
  --uds-x-fg-0c5460:           #dcf4f8;  /* text */
  --uds-x-fg-1976d2:           #438fda;  /* text */
  --uds-x-fg-2e7d32:           #8ccd8f;  /* text */
  --uds-x-fg-34495e:           #b6c5d3;  /* text */
  --uds-x-fg-383d41:           #dbdddf;  /* text */
  --uds-x-fg-553c9a:           #9381c5;  /* text */
  --uds-x-fg-883322:           #d79183;  /* text */
  --uds-x-fg-c62828:           #d66b6b;  /* text */
  --uds-x-fg-cc3333:           #d06d6d;  /* text */
}

/* ===========================================================================
   1b. HEADER LAYOUT FIX (both themes)
   The header overflows when dev-role elements (Admin, Download Agent, user-info)
   are injected. These rules shrink/wrap items to keep it single-line on wide
   screens and wrapping gracefully on narrow ones.
   =========================================================================== */
.header-info {
  flex-wrap: wrap !important;
  gap: 8px !important;
  justify-content: flex-end;
}
.header-info .btn,
.header-nav .btn {
  padding: 4px 8px !important;
  font-size: 11px !important;
  white-space: nowrap;
}
.user-info {
  font-size: 12px !important;
  gap: 6px !important;
}
.header-title, .header h1 {
  font-size: 15px !important;
  white-space: nowrap;
}
.version-display {
  font-size: 10px !important;
}

/* ===========================================================================
   2. DARK SKIN — everything below is scoped to [data-theme="dark"] only.
      These rules give ANY page a coherent dark base. They use !important on
      color/background/border because they must override page-level inline
      styles and Bootstrap defaults. Classic mode is never touched.
   =========================================================================== */

/* ---- Ground + typography ------------------------------------------------- */
:root[data-theme="dark"] body {
  background: var(--uds-bg) !important;
  color: var(--uds-text) !important;
  font-family: var(--uds-font-ui);
}
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] h5,
:root[data-theme="dark"] h6 { color: var(--uds-text-hi) !important; }

:root[data-theme="dark"] a  { color: var(--uds-accent); }
:root[data-theme="dark"] hr { border-color: var(--uds-line) !important; }
:root[data-theme="dark"] ::selection { background: var(--uds-accent-soft); color: var(--uds-text-hi); }
:root[data-theme="dark"] small,
:root[data-theme="dark"] .text-muted { color: var(--uds-text-dim) !important; }

/* ---- Form controls ------------------------------------------------------- */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .form-control {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
  border: 1px solid var(--uds-line-2) !important;
  border-radius: var(--uds-r-sm);
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: var(--uds-text-dim) !important; }

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus,
:root[data-theme="dark"] .form-control:focus {
  border-color: var(--uds-accent) !important;
  box-shadow: 0 0 0 3px var(--uds-focus) !important;
  outline: none;
}
:root[data-theme="dark"] label { color: var(--uds-text-dim) !important; }

/* Native dropdown arrow recolor for <select> */
:root[data-theme="dark"] select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%23e0a458'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 11px center !important;
  padding-right: 30px !important;
}

/* ---- Buttons (base + Bootstrap-style variants) --------------------------- */
:root[data-theme="dark"] .btn { border-radius: var(--uds-r-sm); }
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn.btn-primary {
  background: var(--uds-primary-bg) !important;
  color: var(--uds-primary-ink) !important;
  border-color: transparent !important;
}
:root[data-theme="dark"] .btn-secondary {
  background: var(--uds-surface-3) !important;
  color: var(--uds-text-hi) !important;
  border: 1px solid var(--uds-line-2) !important;
}
:root[data-theme="dark"] .btn-success { background: var(--uds-ok) !important;     color: #05210f !important; border-color: transparent !important; }
:root[data-theme="dark"] .btn-danger  { background: var(--uds-danger) !important; color: #2a0b0f !important; border-color: transparent !important; }
:root[data-theme="dark"] .btn-warning { background: var(--uds-warn) !important;   color: #241a05 !important; border-color: transparent !important; }
:root[data-theme="dark"] .btn-info    { background: var(--uds-info) !important;   color: #04141f !important; border-color: transparent !important; }

/* ---- Tables -------------------------------------------------------------- */
:root[data-theme="dark"] table,
:root[data-theme="dark"] .table { color: var(--uds-text) !important; border-color: var(--uds-line) !important; }
:root[data-theme="dark"] th,
:root[data-theme="dark"] td { border-color: var(--uds-line) !important; }
:root[data-theme="dark"] thead th,
:root[data-theme="dark"] .table thead th {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-dim) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background: rgba(255,255,255,.02) !important; }
:root[data-theme="dark"] .table-hover tbody tr:hover { background: rgba(224,164,88,.06) !important; }

/* ---- Code / logs / pre --------------------------------------------------- */
:root[data-theme="dark"] pre,
:root[data-theme="dark"] code,
:root[data-theme="dark"] kbd {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
  border-color: var(--uds-line) !important;
  font-family: var(--uds-font-mono);
}

/* ---- Bootstrap surfaces (cards, modals, dropdowns, nav) ------------------ */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .dropdown-menu,
:root[data-theme="dark"] .list-group-item,
:root[data-theme="dark"] .popover {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .modal-footer,
:root[data-theme="dark"] .card-header,
:root[data-theme="dark"] .card-footer { border-color: var(--uds-line) !important; }
:root[data-theme="dark"] .modal-backdrop { background: #05070a !important; }
:root[data-theme="dark"] .dropdown-item { color: var(--uds-text) !important; }
:root[data-theme="dark"] .dropdown-item:hover { background: var(--uds-surface-3) !important; color: var(--uds-text-hi) !important; }
:root[data-theme="dark"] .nav-tabs { border-color: var(--uds-line) !important; }
:root[data-theme="dark"] .nav-tabs .nav-link { color: var(--uds-text-dim) !important; border-color: transparent !important; }
:root[data-theme="dark"] .nav-tabs .nav-link.active {
  color: var(--uds-accent) !important;
  background: transparent !important;
  border-bottom: 2px solid var(--uds-accent) !important;
}
:root[data-theme="dark"] .badge { color: #fff; }

/* ---- Scrollbars ---------------------------------------------------------- */
:root[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--uds-line-2); border-radius: 5px; }
:root[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
:root[data-theme="dark"] * { scrollbar-color: var(--uds-line-2) transparent; }

/* ===========================================================================
   3. KNOWN PAGE SHELLS
      A curated set of bespoke wrappers used by the self-styled pages
      (login, editors, policy pages). Add more blocks here using the same
      pattern when a page keeps a light card in dark mode.
      -- WORKED EXAMPLE: login.html --
   =========================================================================== */
:root[data-theme="dark"] .login-container,
:root[data-theme="dark"] .form-container,
:root[data-theme="dark"] .editor-panel,
:root[data-theme="dark"] .content-card {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border: 1px solid var(--uds-line) !important;
  box-shadow: var(--uds-shadow) !important;
}
/* login.html uses a full-page gradient on <body>; neutralise it in dark */
:root[data-theme="dark"] body.login-page,
:root[data-theme="dark"] .login-bg {
  background: radial-gradient(1200px 600px at 50% -10%, #1a222c, var(--uds-bg)) !important;
}
:root[data-theme="dark"] .login-header h1 { color: var(--uds-text-hi) !important; }
:root[data-theme="dark"] .login-header p  { color: var(--uds-text-dim) !important; }

/* ---- Admin pages -------------------------------------------------------- */
:root[data-theme="dark"] .admin-container,
:root[data-theme="dark"] .admin-content,
:root[data-theme="dark"] .stats-container,
:root[data-theme="dark"] .commands-panel {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .admin-container .sidebar,
:root[data-theme="dark"] .admin-container nav {
  background: var(--uds-surface-1) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Policy/legal pages (cookie, privacy, terms, license, manual, pricing) */
:root[data-theme="dark"] .container,
:root[data-theme="dark"] .content {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
  box-shadow: var(--uds-shadow) !important;
}
:root[data-theme="dark"] .warning-box {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line-2) !important;
}
:root[data-theme="dark"] .warning-box.danger {
  border-left-color: var(--uds-danger) !important;
}
:root[data-theme="dark"] .warning-box.info {
  border-left-color: var(--uds-info) !important;
}
:root[data-theme="dark"] .step-box {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .role-card {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Terms page --------------------------------------------------------- */
:root[data-theme="dark"] .terms-container,
:root[data-theme="dark"] .terms-content {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .checkbox-wrapper label { color: var(--uds-text) !important; }

/* ---- Issues page -------------------------------------------------------- */
:root[data-theme="dark"] .issues-container {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Messages page ------------------------------------------------------ */
:root[data-theme="dark"] .msg-container,
:root[data-theme="dark"] .msg-content {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .msg-header {
  background: var(--uds-surface-1) !important;
  border-color: var(--uds-line) !important;
}

/* ---- CCF editor / comparison -------------------------------------------- */
:root[data-theme="dark"] .ccf-editor-container,
:root[data-theme="dark"] .ccf-editor-header,
:root[data-theme="dark"] .data-grid-container,
:root[data-theme="dark"] .editor-group {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .editor-input,
:root[data-theme="dark"] .editor-label { color: var(--uds-text) !important; }

/* ---- VID / legacy-config editor toolbar + grid -------------------------- */
:root[data-theme="dark"] .toolbar {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .toolbar button {
  background: var(--uds-surface-3) !important;
  color: var(--uds-text-hi) !important;
  border-color: var(--uds-line-2) !important;
}
:root[data-theme="dark"] .toolbar button:hover { background: var(--uds-accent-soft) !important; }
:root[data-theme="dark"] .toolbar button.write-btn { background: var(--uds-danger) !important; }
:root[data-theme="dark"] .header-panel {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .grid-container {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
}

/* ---- VAPS editor -------------------------------------------------------- */
:root[data-theme="dark"] .vaps-header {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text-hi) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .chart-card,
:root[data-theme="dark"] .chart-container {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .chart-card canvas,
:root[data-theme="dark"] .chart-container canvas {
  background: var(--uds-surface-1) !important;
}
:root[data-theme="dark"] .vaps-tabs .tab,
:root[data-theme="dark"] .vaps-tab { color: var(--uds-text-dim) !important; border-bottom-color: transparent !important; }
:root[data-theme="dark"] .vaps-tabs .tab.active,
:root[data-theme="dark"] .vaps-tab.active { color: var(--uds-accent) !important; border-bottom-color: var(--uds-accent) !important; }
:root[data-theme="dark"] .vaps-status { color: var(--uds-text-dim) !important; }

/* ---- CCF editor (ccf-editor.html) --------------------------------------- */
:root[data-theme="dark"] .ccf-editor-container { background: var(--uds-bg) !important; color: var(--uds-text) !important; }
:root[data-theme="dark"] .search-section {
  background: var(--uds-surface-1) !important;
  border: 1px solid var(--uds-line) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .data-grid-container {
  background: var(--uds-surface-1) !important;
  border: 1px solid var(--uds-line) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .ccf-table thead { background: var(--uds-surface-2) !important; }
:root[data-theme="dark"] .ccf-table th {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-dim) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .ccf-table td { border-color: var(--uds-line) !important; color: var(--uds-text) !important; }
:root[data-theme="dark"] .ccf-table tbody tr:hover { background: var(--uds-surface-2) !important; }
:root[data-theme="dark"] .ccf-table tbody tr.selected { background: rgba(90, 169, 230, .12) !important; }
:root[data-theme="dark"] .ccf-table tbody tr.modified { background: rgba(79, 191, 131, .12) !important; }
:root[data-theme="dark"] .ccf-table tbody tr.section-header-row { background: var(--uds-surface-2) !important; color: var(--uds-accent) !important; }
:root[data-theme="dark"] .edit-controls {
  background: var(--uds-surface-1) !important;
  border: 1px solid var(--uds-line) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .edit-controls label { color: var(--uds-text) !important; }
/* CCF editor modal (confirmation popup) */
:root[data-theme="dark"] .ccf-editor-container .modal-content,
:root[data-theme="dark"] .ccf-editor-container .modal {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border: 1px solid var(--uds-line) !important;
}

/* ---- VBF browser -------------------------------------------------------- */
:root[data-theme="dark"] .vbf-file-item {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .vbf-file-item:hover { background: var(--uds-surface-2) !important; }
:root[data-theme="dark"] .search-box {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
  border-color: var(--uds-line-2) !important;
}

/* ---- Log browser / log viewer ------------------------------------------- */
:root[data-theme="dark"] .log-container {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .log-content {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
}
:root[data-theme="dark"] .tab-content {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
}

/* ---- Datalog ------------------------------------------------------------ */
:root[data-theme="dark"] .did-grid-container,
:root[data-theme="dark"] .live-values-container {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Script help -------------------------------------------------------- */
:root[data-theme="dark"] .command-box,
:root[data-theme="dark"] .v1-content {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- PSCM shell --------------------------------------------------------- */
:root[data-theme="dark"] .config-panel,
:root[data-theme="dark"] .memory-panel {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .code-gate-box,
:root[data-theme="dark"] .modal-box {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Chat popup --------------------------------------------------------- */
:root[data-theme="dark"] .chat-header {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
}
:root[data-theme="dark"] .chat-input-container {
  background: var(--uds-surface-1) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Console popup ------------------------------------------------------ */
:root[data-theme="dark"] .console-header {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
}
:root[data-theme="dark"] .console-input-container {
  background: var(--uds-surface-1) !important;
  border-color: var(--uds-line) !important;
}

/* ---- admin-version.html purple gradient → dark -------------------------- */
:root[data-theme="dark"] body[style*="667eea"],
:root[data-theme="dark"] body {
  background: var(--uds-bg) !important;
}

/* ---- CCF scripts container (admin) -------------------------------------- */
:root[data-theme="dark"] .ccf-scripts-container {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Switch container (admin-ccf-stats) --------------------------------- */
:root[data-theme="dark"] .switch-container,
:root[data-theme="dark"] .table-wrapper {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* ---- Chat popup (chat-popup.html) --------------------------------------- */
:root[data-theme="dark"] .chat-header { background: #161b22 !important; background-color: #161b22 !important; }
:root[data-theme="dark"] #chat-messages {
  background: var(--uds-bg) !important;
  background-color: var(--uds-bg) !important;
}
:root[data-theme="dark"] .message-outgoing {
  background: var(--uds-accent-soft) !important;
  background-color: var(--uds-accent-soft) !important;
  color: var(--uds-text-hi) !important;
}
:root[data-theme="dark"] .message-outgoing .msg-sender { color: var(--uds-accent) !important; }
:root[data-theme="dark"] .message-incoming {
  background: var(--uds-surface-2) !important;
  background-color: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
}
:root[data-theme="dark"] .message-incoming .msg-sender { color: var(--uds-info) !important; }
:root[data-theme="dark"] .chat-input-container {
  background: var(--uds-surface-1) !important;
  background-color: var(--uds-surface-1) !important;
  border-top-color: var(--uds-line) !important;
}
:root[data-theme="dark"] #chat-input {
  background: var(--uds-surface-2) !important;
  background-color: var(--uds-surface-2) !important;
  color: var(--uds-text-hi) !important;
  border-color: var(--uds-line-2) !important;
}
:root[data-theme="dark"] #chat-send-btn { background: var(--uds-accent) !important; color: var(--uds-accent-ink) !important; }

/* ---- VAPS editor (vaps-editor.html) ------------------------------------- */
:root[data-theme="dark"] .vaps-header {
  background: var(--uds-surface-1) !important;
  background-color: var(--uds-surface-1) !important;
  border-bottom-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .vaps-header h5 { color: var(--uds-text-hi) !important; }
:root[data-theme="dark"] .vaps-header .separator { background: var(--uds-line) !important; }
:root[data-theme="dark"] .vaps-body { background: var(--uds-bg) !important; background-color: var(--uds-bg) !important; }
:root[data-theme="dark"] .chart-card {
  background: var(--uds-surface-1) !important;
  background-color: var(--uds-surface-1) !important;
  border-color: var(--uds-line) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .nav-tabs {
  background: var(--uds-surface-1) !important;
  background-color: var(--uds-surface-1) !important;
  border-bottom-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .nav-tabs .nav-link { color: var(--uds-text-dim) !important; }
:root[data-theme="dark"] .nav-tabs .nav-link.active { color: var(--uds-accent) !important; border-bottom-color: var(--uds-accent) !important; }
:root[data-theme="dark"] .nav-tabs .nav-link:hover:not(.active) { color: var(--uds-text) !important; }
:root[data-theme="dark"] .chart-container {
  background: var(--uds-surface-1) !important;
  background-color: var(--uds-surface-1) !important;
}
:root[data-theme="dark"] .chart-canvas { background: var(--uds-surface-1) !important; background-color: var(--uds-surface-1) !important; }
:root[data-theme="dark"] .status-bar {
  background: var(--uds-surface-1) !important;
  background-color: var(--uds-surface-1) !important;
  border-top-color: var(--uds-line) !important;
  color: var(--uds-text-dim) !important;
}

/* ===========================================================================
   4. FLOATING THEME TOGGLE (injected by theme-switch.js if not already present)
   =========================================================================== */
/* Moved right -> left on 2026-07-28 (D1, Decision 3). At lower-right it sat on
   top of the CCF editor's Save button. Pages that own a real toolbar should set
   window.UDS_THEME_NO_FLOATING_BUTTON = true and UdsTheme.mount() their own
   button instead of relying on this floating one. Lower-left occupancy of all
   27 pages is probed by Tools/ThemeHarness/audit.js (cornerProbe) — re-run it
   before moving this again. */
.uds-theme-toggle {
  position: fixed; left: 16px; bottom: 16px; z-index: 99999;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 22px; cursor: pointer;
  font-family: var(--uds-font-ui); font-size: 13px; font-weight: 600;
  border: 1px solid var(--uds-line-2);
  background: var(--uds-surface-1); color: var(--uds-text-hi);
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.35);
}
.uds-theme-toggle:hover { border-color: var(--uds-accent); }
.uds-theme-toggle .uds-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--uds-accent); }

/* Toolbar-mounted variant (plan Decision 3, applied in D3).
   Deliberately NOT position:fixed -- that is exactly what distinguishes it from
   the floating button, both to a reader and to the harness corner probe, which
   now treats a non-fixed toggle as mounted and stops reporting a collision.

   TWO THINGS HERE ARE DELIBERATE AND BOTH WERE LEARNED THE HARD WAY.

   1. It carries its OWN colours rather than inheriting the toolbar's. The first
      version used `color: inherit` so one rule could serve the green chat
      header, the dark console header and the blue window header alike. On
      ccf-comparison that inherited `--uds-primary-ink`, whose dark value is
      near-black, onto the near-black dark header: 1.01:1, a hard failure the
      contrast detector caught immediately. A shared control cannot borrow a
      host page's foreground and stay readable. These are the floating button's
      own colours, already proven in both themes.

   2. The selector is ID-qualified. Host pages style their toolbars with rules
      like `.window-controls button { color: … }` -- specificity (0,1,1), in a
      page <style> block that loads AFTER this file, so a bare
      `.uds-theme-mounted` class loses on both counts. */
#uds-theme-toggle.uds-theme-mounted {
  display: inline-flex; align-items: center; gap: 6px;
  /* Sized to sit inside an existing toolbar without growing it. The first
     version was 2px taller than the tallest control in pscm-shell's
     .header-info, which pushed the whole page down by 2px -- a real classic
     layout change, for nothing. */
  padding: 2px 9px; border-radius: 12px; cursor: pointer;
  font-family: var(--uds-font-ui); font-size: 12px; font-weight: 600;
  line-height: 1.3;
  background: var(--uds-surface-1);
  color: var(--uds-text-hi);
  border: 1px solid var(--uds-line-2);
}
#uds-theme-toggle.uds-theme-mounted:hover { border-color: var(--uds-accent); }
#uds-theme-toggle.uds-theme-mounted .uds-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--uds-accent); flex-shrink: 0;
}

/* ===========================================================================
   5. D2 FOLLOW-UP — containers the tokenisation EXPOSED (2026-07-29)
      Tokenising a `color:` correctly makes the text follow the theme into
      dark. Where that text's background lives in a DIFFERENT rule, nothing
      static can pair them, so apply.py's R7 (which only sees the background
      declared in the same block) cannot protect it -- the text goes light and
      an untokenised ancestor stays light, or the reverse. The contrast
      detector found all 34 such cases; these rules close them.

      Every rule here is [data-theme="dark"]-scoped, so classic mode is
      unaffected by construction and the pixel-identical guarantee holds.
      Each is traceable to a finding in
      MD/2026-07-29_Theme_Tokenisation_Verification.md.
   =========================================================================== */

/* Centred popup box kept a white background while its text became light.
   10 findings across pickNgiSwFile / showCentered*Popup / ConnectionBroken. */
:root[data-theme="dark"] .popup-overlay > div {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}

/* privacy-policy: .legal-basis keeps a light #e8f4fd panel. 3 findings. */
:root[data-theme="dark"] .legal-basis {
  background: var(--uds-surface-2) !important;
  color: var(--uds-text) !important;
}

/* admin-version: light #f7f9fc panels under now-light headings. 2 findings. */
:root[data-theme="dark"] .current-version,
:root[data-theme="dark"] .update-form {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
}

/* .warning-box is darkened above, but its descendants kept dark literal ink
   (#0c5460 on #1c232c). 4 findings on license / manual / pricing. */
:root[data-theme="dark"] .warning-box strong,
:root[data-theme="dark"] .warning-box p,
:root[data-theme="dark"] .warning-box li { color: var(--uds-text) !important; }

/* .back-link carried #007bff as BOTH background and colour, so both resolved
   to the amber accent -- amber on amber, 1.0:1. 6 findings. */
:root[data-theme="dark"] .back-link {
  background: var(--uds-accent) !important;
  color: var(--uds-accent-ink) !important;
}

/* Maintenance dialog: inner panel kept #fff3cd / text kept #333. 3 findings. */
:root[data-theme="dark"] #maintenance-notification-overlay > div > div,
:root[data-theme="dark"] #maintenance-notification-overlay > div > div > div {
  background: var(--uds-surface-1) !important;
}
:root[data-theme="dark"] #maintenance-notification-overlay p,
:root[data-theme="dark"] #maintenance-notification-overlay strong,
:root[data-theme="dark"] #maintenance-notification-overlay h3 {
  color: var(--uds-text) !important;
}

/* ---- D2 FOLLOW-UP (2) — the last 4 cross-rule cases ---------------------
   Same shape as section 5: a JS-built panel keeps a white background while its
   heading correctly follows the theme into dark. These overlays name their own
   wrapper, so they can be targeted directly. `.hint` is the mirror case: dim
   grey ink (#586069) left on a now-dark surface at 2.71:1. */
:root[data-theme="dark"] .connection-progress-overlay > div > div,
:root[data-theme="dark"] .ecu-switch-overlay > div > div,
:root[data-theme="dark"] .sa-dialog,
:root[data-theme="dark"] .sd-retry-dialog {
  background: var(--uds-surface-1) !important;
  color: var(--uds-text) !important;
  border-color: var(--uds-line) !important;
}
:root[data-theme="dark"] .hint { color: var(--uds-text) !important; }

/* ---- D2 FOLLOW-UP (3) — secondary-button ink -----------------------------
   `background:#6c757d; color:white` split across two rules: the surface became
   a dark grey and the ink became --uds-*-ink (near-black), 1.07:1. R7 pairs a
   text site with its background only when both are declared in the SAME block,
   so a split pair is invisible to it. 3 findings. */
:root[data-theme="dark"] #cancel-btn,
:root[data-theme="dark"] #sd-giveup-btn,
:root[data-theme="dark"] .btn-cancel {
  color: var(--uds-text-hi) !important;
  background: var(--uds-surface-3) !important;
}

/* ---- D2 FOLLOW-UP (4) — pricing section rows ----------------------------
   #34495e ink on a row whose background darkened to #0c0f13: 2.07:1. Split
   across two rules, so R7 could not pair them. 1 finding. */
:root[data-theme="dark"] #pricing-body tr.section-row td {
  color: var(--uds-text-hi) !important;
}
