/* Surge Market brand layer for the lab's Easy, Pro and Mobile views (25 Nov 2026).
   Loaded last on /surge/ only; html carries data-brand="surge". Source: the Surge style system (tokens.css, README.md,
   components.md). It re-points the Trade Market roles, the Lumen/Tray layer and the radii at Surge values, so the
   shared components and layouts stay as they are. The repeated :root outranks Lumen's own theme blocks.
   Known departures from the Surge tokens, for AA contrast (WCAG 2.2): light secondary text #5B6A80 (Surge muted
   #6B7A90 is 4.4:1 on white), light up/down/amber text #087F57, #C9353A, #A15C00 (Surge #0E9F6E, #E5484D, #D97706
   are 3.2 to 3.9:1 as text). Fills (Buy, Sell, primary, dots, bars) keep the Surge colours. */

/* ---------- Roles: light ---------- */
:root:root:root[data-brand="surge"], :root:root:root[data-brand="surge"] [data-theme] {
  --sg-bg: #F5F7FB; --sg-surface: #FFFFFF; --sg-surface2: #F0F3F8; --sg-border: #E3E8F0; --sg-text: #0F2446; --sg-muted: #6B7A90; --sg-muted2: #8A98B0;
  --sg-blue: #176BFF; --sg-blue-soft: #EAF1FF; --sg-green: #0E9F6E; --sg-red: #E5484D; --sg-amber: #D97706; --sg-ink: #0F2446; --sg-on-ink: #FFFFFF;
  --tm-color-bg: var(--sg-bg); --tm-color-panel: var(--sg-surface); --tm-color-raised: var(--sg-surface);
  --tm-color-divider: var(--sg-border); --tm-color-divider-strong: #D5DCE7; --tm-color-border-control: var(--sg-muted2);
  --tm-color-text: var(--sg-text); --tm-color-text-secondary: #5B6A80; --tm-color-text-faint: var(--sg-muted2);
  --tm-color-primary: var(--sg-blue); --tm-color-primary-hover: var(--sg-blue); --tm-color-primary-pressed: var(--sg-blue); --tm-color-on-primary: #FFFFFF;
  --tm-color-primary-text: var(--sg-blue); --tm-color-primary-tint: var(--sg-blue-soft); --tm-color-primary-tint-strong: rgb(23 107 255 / 0.16); --tm-color-focus: var(--sg-blue);
  --tm-color-up: #087F57; --tm-color-on-up: #FFFFFF; --tm-color-up-tint: rgb(14 159 110 / 0.12);
  --tm-color-down: #C9353A; --tm-color-on-down: #FFFFFF; --tm-color-down-tint: rgb(229 72 77 / 0.12);
  --tm-color-warning: #A15C00; --tm-color-warning-tint: rgb(217 119 6 / 0.12);
  --tm-color-hover: var(--sg-surface2); --tm-color-pressed: rgb(15 36 70 / 0.08); --tm-color-scrim: rgb(5 12 26 / 0.55); --tm-color-skeleton: var(--sg-surface2);
  --tm-shadow-overlay: 0 16px 40px -12px rgb(0 0 0 / 0.4);
  --lk-canvas: var(--sg-bg); --lk-chrome: var(--sg-surface); --lk-content: var(--sg-surface); --lk-thead: var(--sg-surface2);
  --lk-well: var(--sg-surface); --lk-field-border: var(--sg-border); --lk-glass: var(--sg-surface); --lk-edge: var(--sg-border);
  --lk-key-top: var(--sg-surface); --lk-key-bottom: var(--sg-surface);
  --lk-float: 0 16px 40px -12px rgb(0 0 0 / 0.4);
}
/* ---------- Roles: dark ---------- */
:root:root:root[data-brand="surge"][data-theme="dark"], :root:root:root[data-brand="surge"] [data-theme="dark"] {
  --sg-bg: #0A1322; --sg-surface: #0F1B2D; --sg-surface2: #16213A; --sg-border: #1E2B40; --sg-text: #E6EDF7; --sg-muted: #8A98B0; --sg-muted2: #6B7A90;
  --sg-blue: #4D8DFF; --sg-blue-soft: rgb(23 107 255 / 0.18); --sg-green: #22C55E; --sg-red: #F0565B; --sg-amber: #F59E0B; --sg-ink: #E6EDF7; --sg-on-ink: #0A1322;
  --tm-color-divider-strong: #2A3A55; --tm-color-text-secondary: var(--sg-muted);
  --tm-color-primary: #176BFF; --tm-color-primary-hover: #176BFF; --tm-color-primary-pressed: #176BFF; /* white labels need the light blue fill (4.6:1) */
  --tm-color-primary-tint-strong: rgb(23 107 255 / 0.28);
  --tm-color-up: var(--sg-green); --tm-color-on-up: var(--sg-on-ink); --tm-color-up-tint: rgb(34 197 94 / 0.14);
  --tm-color-down: var(--sg-red); --tm-color-on-down: var(--sg-on-ink); --tm-color-down-tint: rgb(240 86 91 / 0.14);
  --tm-color-warning: var(--sg-amber); --tm-color-warning-tint: rgb(245 158 11 / 0.14);
  --tm-color-pressed: rgb(255 255 255 / 0.08); --tm-shadow-overlay: 0 16px 40px -12px rgb(0 0 0 / 0.6);
  --lk-float: 0 16px 40px -12px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}
/* ---------- Scale, type and the flat Surge surface (both themes) ---------- */
:root:root:root[data-brand="surge"], :root:root:root[data-brand="surge"] [data-theme] {
  --tm-font-family-geist: Manrope, system-ui, sans-serif; --tm-font-family-inter: Manrope, system-ui, sans-serif; --tm-font-ui: Manrope, system-ui, sans-serif;
  --tm-font-family-mono: "IBM Plex Mono", ui-monospace, monospace;
  --tm-font-weight-regular: 600; --tm-font-weight-medium: 700; --tm-font-weight-semibold: 800;
  --lk-r-xs: 7px; --lk-r-sm: 8px; --lk-r-md: 12px; --lk-r-lg: 16px; --lk-r-menu: 12px; --lk-r-control: 10px; --lk-r-button: 12px;
  --tm-radius-xs: 7px; --tm-radius-sm: 8px; --tm-radius-md: 12px; --tm-radius-lg: 18px;
  --lk-hi: transparent; --lk-hi-strong: transparent; --lk-shade: transparent; --lk-shade-in: transparent; --lk-grid: transparent;
  --lk-primary: #176BFF; --lk-buy: #0E9F6E; --lk-sell: #E5484D; --lk-on-trade: #FFFFFF; /* Surge fills; white labels 3.4 to 4.6:1, like Trade Market's known exception */
  --lk-unselected: var(--tm-color-text-secondary);
}
/* Lumen's light, sheen, rim, glow and noise off: Surge surfaces are flat with a 1px border (gradients only in its four places). */
:root:root:root:root[data-brand="surge"], :root:root:root:root[data-brand="surge"] [data-theme] {
  --lm-ambient: transparent; --lm-glow-up: transparent; --lm-glow-down: transparent; --lm-noise: none; --lm-hi: transparent;
  --lm-sheen: linear-gradient(transparent, transparent); --lm-rim: linear-gradient(var(--tm-color-divider), var(--tm-color-divider));
  --lm-edge: var(--tm-color-divider); --lm-edge-strong: var(--tm-color-divider); --lm-shadow: none; --lm-float: var(--lk-float);
  --lm-key: linear-gradient(var(--tm-color-panel), var(--tm-color-panel)); --lm-well-in: 0 0 transparent; --lm-knock: var(--tm-color-panel);
}
:root[data-brand="surge"] body { background: var(--tm-color-bg); font-family: var(--tm-font-ui); }

/* Tray cards become Surge cards: one flat surface, 1px border, no shadow; 16px corners on Easy, 12px on Pro. */
:root:root:root[data-brand="surge"] :is(.tm-dsk--v2, .tm-pro2) {
  --hc-out: var(--tm-color-panel); --hc-edge: var(--tm-color-divider); --hc-in: var(--tm-color-panel); --hc-in-edge: transparent;
  --hc-shadow: none; --hc-in-shadow: none; --hc-r: 10px;
  --_fld: var(--tm-color-panel); --_fld-edge: var(--tm-color-divider); --_fld-edge-hover: var(--tm-color-border-control); --_fld-shadow: none;
  --_pdisc: var(--sg-surface2); --_pring: transparent; --_wdisc: var(--sg-surface2);
}
:root:root:root[data-brand="surge"] .tm-pro2 { --hc-r: 6px; }

/* Wordmark: the Surge.market logo, 32px high, light and dark versions (assets/). The name stays for screen readers. */
:root[data-brand="surge"] .tm-wordmark {
  display: inline-block; width: 90px; height: 32px; flex: none; overflow: hidden; color: transparent; white-space: nowrap; text-indent: 100%;
  background: url(assets/logo-light.svg) left center / contain no-repeat;
}
:root[data-brand="surge"][data-theme="dark"] .tm-wordmark { background-image: url(assets/logo-dark.svg); }

/* Numbers and codes in IBM Plex Mono; labels and words stay Manrope. */
:root[data-brand="surge"] :is(.tm-num, .tm-mono, .tm-price, .tm-change, .tm-stat__value, .tm-kv dd, .tm-timeline__time, .tm-hold__val, .tm-qread__lo, .tm-qread__hi, .tm-amount input, .tm-book td, .tm-tape td) { font-family: var(--tm-font-family-mono); }
:root[data-brand="surge"] :is(.tm-change, .tm-price) .tm-secondary { font-family: var(--tm-font-ui); }

/* Table heads: small uppercase labels with letter-spacing (Surge). */
:root[data-brand="surge"] :is(.tm-dsk--v2, .tm-pro2) th { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11.5px; font-weight: 700; color: var(--tm-color-text-secondary); }

/* Lab bar: one look on this page, no Trade Market notes or design system link. */
:root[data-brand="surge"] .lab-bar :is(.lab-notes-btn, a[href="/design-system/"], .lab-tones-wrap, [data-lab="look"]),
:root[data-brand="surge"] .lab-bar .lab-ctl:has(#lab-dd-look, [data-lab="look"]) { display: none; }

/* Pro watchlist rows are 280px wide: the full code (JKH.N0000) already names the class, so the class badge goes there. */
:root[data-brand="surge"] .tm-pro2 .tm-mrail .tm-class { display: none; }
