@font-face {
  font-family: "FiraCode Nerd Font";
  src: url("fonts/FiraCodeNerdFont-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "FiraCode Nerd Font";
  src: url("fonts/FiraCodeNerdFont-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/**
 * Clustr — Material Design–inspired tokens + layout.
 * Color roles follow M3 surface/primary/outline patterns; themes override tokens.
 */

/* ========== Design tokens (M3-ish) ========== */
:root,
[data-theme="dark"] {
  --md-sys-color-surface: #12131a;
  --md-sys-color-surface-container: #191c26;
  --md-sys-color-surface-container-high: #202435;
  --md-sys-color-surface-container-highest: #272c3e;
  --md-sys-color-on-surface: #d8e2f7;
  --md-sys-color-on-surface-variant: #6277a8;
  --md-sys-color-primary: #78a8ff;
  --md-sys-color-on-primary: #111827;
  --md-sys-color-primary-container: #202d49;
  --md-sys-color-outline: #2c3348;
  --md-sys-color-outline-variant: #38415a;
  --md-sys-color-up: #45dc91;
  --md-sys-color-down: #ff7378;
  --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --md-sys-elevation-2: 0 2px 6px rgba(0, 0, 0, 0.4);
  --md-sys-shape-sm: 8px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --md-sys-rail-width: 80px;
  --font-sans: "Roboto", system-ui, -apple-system, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;

  /* legacy aliases used across components */
  --bg: var(--md-sys-color-surface);
  --panel: var(--md-sys-color-surface-container);
  --panel-2: var(--md-sys-color-surface-container-high);
  --border: var(--md-sys-color-outline);
  --text: var(--md-sys-color-on-surface);
  --text-meta: var(--md-sys-color-on-surface-variant);
  --accent: var(--md-sys-color-primary);
  --chip-bg: var(--md-sys-color-surface-container-high);
  --up: var(--md-sys-color-up);
  --down: var(--md-sys-color-down);
  --side-w: var(--md-sys-rail-width);
}

[data-theme="dark-blue"] {
  --md-sys-color-surface: #0b1220;
  --md-sys-color-surface-container: #111827;
  --md-sys-color-surface-container-high: #0f172a;
  --md-sys-color-on-surface: #e2e8f0;
  --md-sys-color-on-surface-variant: #94a3b8;
  --md-sys-color-primary: #38bdf8;
  --md-sys-color-outline: #1e293b;
}
[data-theme="synthwave84"] {
  --md-sys-color-surface: #262335;
  --md-sys-color-surface-container: #2a2139;
  --md-sys-color-surface-container-high: #241b2f;
  --md-sys-color-on-surface: #f8f8f2;
  --md-sys-color-on-surface-variant: #b0a8c8;
  --md-sys-color-primary: #36f9f6;
  --md-sys-color-outline: #495495;
  --md-sys-color-up: #72f1b8;
  --md-sys-color-down: #fe4450;
}
[data-theme="nord"] {
  --md-sys-color-surface: #2e3440;
  --md-sys-color-surface-container: #3b4252;
  --md-sys-color-surface-container-high: #434c5e;
  --md-sys-color-on-surface: #eceff4;
  --md-sys-color-on-surface-variant: #d8dee9;
  --md-sys-color-primary: #88c0d0;
  --md-sys-color-outline: #4c566a;
  --md-sys-color-up: #a3be8c;
  --md-sys-color-down: #bf616a;
}
[data-theme="one-dark"] {
  --md-sys-color-surface: #282c34;
  --md-sys-color-surface-container: #21252b;
  --md-sys-color-surface-container-high: #2c313a;
  --md-sys-color-on-surface: #abb2bf;
  --md-sys-color-on-surface-variant: #5c6370;
  --md-sys-color-primary: #61afef;
  --md-sys-color-outline: #3e4451;
}
[data-theme="tokyo-night"] {
  --md-sys-color-surface: #1a1b26;
  --md-sys-color-surface-container: #16161e;
  --md-sys-color-surface-container-high: #1f2335;
  --md-sys-color-on-surface: #c0caf5;
  --md-sys-color-on-surface-variant: #565f89;
  --md-sys-color-primary: #7aa2f7;
  --md-sys-color-outline: #292e42;
}
[data-theme="catppuccin"] {
  --md-sys-color-surface: #1e1e2e;
  --md-sys-color-surface-container: #181825;
  --md-sys-color-surface-container-high: #313244;
  --md-sys-color-on-surface: #cdd6f4;
  --md-sys-color-on-surface-variant: #a6adc8;
  --md-sys-color-primary: #cba6f7;
  --md-sys-color-outline: #45475a;
}
[data-theme="gruvbox"] {
  --md-sys-color-surface: #282828;
  --md-sys-color-surface-container: #3c3836;
  --md-sys-color-surface-container-high: #504945;
  --md-sys-color-on-surface: #ebdbb2;
  --md-sys-color-on-surface-variant: #a89984;
  --md-sys-color-primary: #fe8019;
  --md-sys-color-outline: #665c54;
}
[data-theme="monokai"] {
  --md-sys-color-surface: #272822;
  --md-sys-color-surface-container: #1e1f1c;
  --md-sys-color-surface-container-high: #3e3d32;
  --md-sys-color-on-surface: #f8f8f2;
  --md-sys-color-on-surface-variant: #75715e;
  --md-sys-color-primary: #a6e22e;
  --md-sys-color-outline: #49483e;
}
[data-theme="dracula"] {
  --md-sys-color-surface: #282a36;
  --md-sys-color-surface-container: #21222c;
  --md-sys-color-surface-container-high: #343746;
  --md-sys-color-on-surface: #f8f8f2;
  --md-sys-color-on-surface-variant: #6272a4;
  --md-sys-color-primary: #bd93f9;
  --md-sys-color-outline: #44475a;
}
[data-theme="matrix"] {
  --md-sys-color-surface: #020805;
  --md-sys-color-surface-container: #05140c;
  --md-sys-color-surface-container-high: #0a1f14;
  --md-sys-color-on-surface: #c8ffd4;
  --md-sys-color-on-surface-variant: #3d9b66;
  --md-sys-color-primary: #00ff6a;
  --md-sys-color-outline: #0d3b24;
}
[data-theme="solarized"] {
  --md-sys-color-surface: #002b36;
  --md-sys-color-surface-container: #073642;
  --md-sys-color-surface-container-high: #0a3d4a;
  --md-sys-color-on-surface: #839496;
  --md-sys-color-on-surface-variant: #586e75;
  --md-sys-color-primary: #268bd2;
  --md-sys-color-outline: #094858;
}
[data-theme="github-dark"] {
  --md-sys-color-surface: #0d1117;
  --md-sys-color-surface-container: #161b22;
  --md-sys-color-surface-container-high: #21262d;
  --md-sys-color-on-surface: #c9d1d9;
  --md-sys-color-on-surface-variant: #8b949e;
  --md-sys-color-primary: #58a6ff;
  --md-sys-color-outline: #30363d;
}
[data-theme="github-light"] {
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-container: #f6f8fa;
  --md-sys-color-surface-container-high: #eaeef2;
  --md-sys-color-on-surface: #24292f;
  --md-sys-color-on-surface-variant: #57606a;
  --md-sys-color-primary: #0969da;
  --md-sys-color-outline: #d0d7de;
  --md-sys-color-up: #1a7f37;
  --md-sys-color-down: #cf222e;
}
[data-theme="nord-light"] {
  --md-sys-color-surface: #eceff4;
  --md-sys-color-surface-container: #e5e9f0;
  --md-sys-color-surface-container-high: #d8dee9;
  --md-sys-color-on-surface: #2e3440;
  --md-sys-color-on-surface-variant: #4c566a;
  --md-sys-color-primary: #5e81ac;
  --md-sys-color-outline: #c5ccd6;
}
[data-theme="paper"] {
  --md-sys-color-surface: #faf8f5;
  --md-sys-color-surface-container: #f0ebe3;
  --md-sys-color-surface-container-high: #e8e0d5;
  --md-sys-color-on-surface: #1c1917;
  --md-sys-color-on-surface-variant: #78716c;
  --md-sys-color-primary: #c2410c;
  --md-sys-color-outline: #d6d3d1;
}

/* Aurora — polar night + green/cyan ribbons */
[data-theme="aurora"] {
  --md-sys-color-surface: #061018;
  --md-sys-color-surface-container: #0b1c28;
  --md-sys-color-surface-container-high: #122a38;
  --md-sys-color-on-surface: #e8fff6;
  --md-sys-color-on-surface-variant: #7eb8a8;
  --md-sys-color-primary: #5efcc1;
  --md-sys-color-outline: #1a3d4a;
  --md-sys-color-up: #7dffb3;
  --md-sys-color-down: #ff6b9d;
}

/* Volcanic — ash + lava */
[data-theme="volcanic"] {
  --md-sys-color-surface: #12080a;
  --md-sys-color-surface-container: #1c0d10;
  --md-sys-color-surface-container-high: #2a1216;
  --md-sys-color-on-surface: #ffe8e0;
  --md-sys-color-on-surface-variant: #c48a7a;
  --md-sys-color-primary: #ff4d1a;
  --md-sys-color-outline: #4a1c18;
  --md-sys-color-up: #ffb347;
  --md-sys-color-down: #ff2a55;
}

/* Neon lilac — purple fog + hot pink */
[data-theme="neon-lilac"] {
  --md-sys-color-surface: #14081f;
  --md-sys-color-surface-container: #1e0f2e;
  --md-sys-color-surface-container-high: #2a1740;
  --md-sys-color-on-surface: #f5e9ff;
  --md-sys-color-on-surface-variant: #b89ad4;
  --md-sys-color-primary: #ff4fd8;
  --md-sys-color-outline: #3d2458;
  --md-sys-color-up: #7dffb3;
  --md-sys-color-down: #ff6b9d;
}

/* Amber terminal — CRT phosphor gold */
[data-theme="amber-terminal"] {
  --md-sys-color-surface: #0c0a04;
  --md-sys-color-surface-container: #141008;
  --md-sys-color-surface-container-high: #1e180c;
  --md-sys-color-on-surface: #ffd27a;
  --md-sys-color-on-surface-variant: #b8924a;
  --md-sys-color-primary: #ffb000;
  --md-sys-color-outline: #3a2e12;
  --md-sys-color-up: #c8ff5a;
  --md-sys-color-down: #ff5a3a;
}

/* CRT Tube — green phosphor, bulging glass, scanlines */
[data-theme="crt"] {
  --md-sys-color-surface: #020904;
  --md-sys-color-surface-container: #06140a;
  --md-sys-color-surface-container-high: #0a1c10;
  --md-sys-color-on-surface: #b8ffb0;
  --md-sys-color-on-surface-variant: #5a9a58;
  --md-sys-color-primary: #39ff14;
  --md-sys-color-outline: #143818;
  --md-sys-color-up: #7dff5a;
  --md-sys-color-down: #ff5a3a;
}

/* —— Palette themes from moodboards —— */
[data-theme="kermit"] {
  --md-sys-color-surface: #e8f6f0;
  --md-sys-color-surface-container: #d5efe8;
  --md-sys-color-surface-container-high: #cde4ad;
  --md-sys-color-on-surface: #1a3a42;
  --md-sys-color-on-surface-variant: #3d6b72;
  --md-sys-color-primary: #75bde0;
  --md-sys-color-outline: #97dbae;
  --md-sys-color-up: #5a9e6e;
  --md-sys-color-down: #c45c5c;
}
html[data-theme="kermit"] body {
  background: linear-gradient(160deg, #75bde0 0%, #78d1d2 35%, #97dbae 70%, #cde4ad 100%);
  background-attachment: fixed;
}
html[data-theme="kermit"] .shell,
html[data-theme="kermit"] .main {
  background: transparent;
}
html[data-theme="kermit"] .md-card,
html[data-theme="kermit"] .nav-rail,
html[data-theme="kermit"] .mobile-topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}

[data-theme="coral-navy"] {
  --md-sys-color-surface: #ece6cd;
  --md-sys-color-surface-container: #e4dcc0;
  --md-sys-color-surface-container-high: #f9ac67;
  --md-sys-color-on-surface: #3a3f58;
  --md-sys-color-on-surface-variant: #5c6178;
  --md-sys-color-primary: #ee6a59;
  --md-sys-color-outline: #c8c0a8;
  --md-sys-color-up: #3a8f6a;
  --md-sys-color-down: #ee6a59;
}
html[data-theme="coral-navy"] body {
  background: linear-gradient(135deg, #ece6cd 0%, #f9ac67 55%, #ee6a59 100%);
  background-attachment: fixed;
}
html[data-theme="coral-navy"] .shell,
html[data-theme="coral-navy"] .main {
  background: transparent;
}
html[data-theme="coral-navy"] .md-card,
html[data-theme="coral-navy"] .nav-rail {
  background: rgba(236, 230, 205, 0.9);
  backdrop-filter: blur(8px);
}

[data-theme="charcoal-sand"] {
  --md-sys-color-surface: #d6cab0;
  --md-sys-color-surface-container: #c4b8a0;
  --md-sys-color-surface-container-high: #86817c;
  --md-sys-color-on-surface: #282726;
  --md-sys-color-on-surface-variant: #54504c;
  --md-sys-color-primary: #54504c;
  --md-sys-color-outline: #a89f90;
  --md-sys-color-up: #4a7a52;
  --md-sys-color-down: #8b3a3a;
}
html[data-theme="charcoal-sand"] body {
  background: linear-gradient(180deg, #d6cab0 0%, #86817c 50%, #54504c 100%);
  background-attachment: fixed;
}
html[data-theme="charcoal-sand"] .shell,
html[data-theme="charcoal-sand"] .main {
  background: transparent;
}
html[data-theme="charcoal-sand"] .md-card {
  background: rgba(214, 202, 176, 0.92);
}

[data-theme="berry-mint"] {
  --md-sys-color-surface: #eee2d1;
  --md-sys-color-surface-container: #e5d6c0;
  --md-sys-color-surface-container-high: #ff916b;
  --md-sys-color-on-surface: #3a1830;
  --md-sys-color-on-surface-variant: #6b3a50;
  --md-sys-color-primary: #c14364;
  --md-sys-color-outline: #d4c4b0;
  --md-sys-color-up: #2ca18c;
  --md-sys-color-down: #c14364;
}
html[data-theme="berry-mint"] body {
  background: linear-gradient(145deg, #eee2d1 0%, #ff916b 45%, #c14364 78%, #2ca18c 100%);
  background-attachment: fixed;
}
html[data-theme="berry-mint"] .shell,
html[data-theme="berry-mint"] .main {
  background: transparent;
}
html[data-theme="berry-mint"] .md-card {
  background: rgba(238, 226, 209, 0.9);
}

[data-theme="plum-cream"] {
  --md-sys-color-surface: #f8f4e9;
  --md-sys-color-surface-container: #f0e8d8;
  --md-sys-color-surface-container-high: #f8dac3;
  --md-sys-color-on-surface: #4e2e54;
  --md-sys-color-on-surface-variant: #6e4a72;
  --md-sys-color-primary: #954f75;
  --md-sys-color-outline: #e0d4c4;
  --md-sys-color-up: #5a8f6a;
  --md-sys-color-down: #954f75;
}
html[data-theme="plum-cream"] body {
  background: linear-gradient(160deg, #f8f4e9 0%, #f8dac3 40%, #954f75 100%);
  background-attachment: fixed;
}
html[data-theme="plum-cream"] .shell,
html[data-theme="plum-cream"] .main {
  background: transparent;
}
html[data-theme="plum-cream"] .md-card {
  background: rgba(248, 244, 233, 0.92);
}

[data-theme="forest-mist"] {
  --md-sys-color-surface: #f4f1e9;
  --md-sys-color-surface-container: #e8e4d8;
  --md-sys-color-surface-container-high: #b1d182;
  --md-sys-color-on-surface: #2b463c;
  --md-sys-color-on-surface-variant: #4a6a58;
  --md-sys-color-primary: #688f4e;
  --md-sys-color-outline: #c8d4b8;
  --md-sys-color-up: #688f4e;
  --md-sys-color-down: #a05050;
}
html[data-theme="forest-mist"] body {
  background: linear-gradient(165deg, #f4f1e9 0%, #b1d182 40%, #688f4e 75%, #2b463c 100%);
  background-attachment: fixed;
}
html[data-theme="forest-mist"] .shell,
html[data-theme="forest-mist"] .main {
  background: transparent;
}
html[data-theme="forest-mist"] .md-card {
  background: rgba(244, 241, 233, 0.9);
}

[data-theme="indigo-peach"] {
  --md-sys-color-surface: #0b0742;
  --md-sys-color-surface-container: #120c6e;
  --md-sys-color-surface-container-high: #5e72eb;
  --md-sys-color-on-surface: #fdeee6;
  --md-sys-color-on-surface-variant: #c8b8d8;
  --md-sys-color-primary: #ff9190;
  --md-sys-color-outline: #2a2460;
  --md-sys-color-up: #7dffb3;
  --md-sys-color-down: #ff9190;
}
html[data-theme="indigo-peach"] body {
  background: linear-gradient(135deg, #0b0742 0%, #120c6e 30%, #5e72eb 60%, #ff9190 85%, #fdc094 100%);
  background-attachment: fixed;
}
html[data-theme="indigo-peach"] .shell,
html[data-theme="indigo-peach"] .main {
  background: transparent;
}
html[data-theme="indigo-peach"] .md-card,
html[data-theme="indigo-peach"] .nav-rail {
  background: rgba(11, 7, 66, 0.78);
  backdrop-filter: blur(12px);
}

[data-theme="sea-foam"] {
  --md-sys-color-surface: #e0ecde;
  --md-sys-color-surface-container: #cde0c9;
  --md-sys-color-surface-container-high: #68b2a0;
  --md-sys-color-on-surface: #1a3a38;
  --md-sys-color-on-surface-variant: #3d6560;
  --md-sys-color-primary: #2c6975;
  --md-sys-color-outline: #a8c8c0;
  --md-sys-color-up: #2c6975;
  --md-sys-color-down: #c45c5c;
}
html[data-theme="sea-foam"] body {
  background: linear-gradient(180deg, #ffffff 0%, #e0ecde 30%, #cde0c9 55%, #68b2a0 80%, #2c6975 100%);
  background-attachment: fixed;
}
html[data-theme="sea-foam"] .shell,
html[data-theme="sea-foam"] .main {
  background: transparent;
}
html[data-theme="sea-foam"] .md-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

[data-theme="sunset-teal"] {
  --md-sys-color-surface: #1e3a42;
  --md-sys-color-surface-container: #264d59;
  --md-sys-color-surface-container-high: #43978d;
  --md-sys-color-on-surface: #fff6e8;
  --md-sys-color-on-surface-variant: #c8d8d0;
  --md-sys-color-primary: #f9ad6a;
  --md-sys-color-outline: #3a5c66;
  --md-sys-color-up: #43978d;
  --md-sys-color-down: #d46c4e;
}
html[data-theme="sunset-teal"] body {
  background: linear-gradient(120deg, #264d59 0%, #43978d 25%, #f9e07f 50%, #f9ad6a 75%, #d46c4e 100%);
  background-attachment: fixed;
}
html[data-theme="sunset-teal"] .shell,
html[data-theme="sunset-teal"] .main {
  background: transparent;
}
html[data-theme="sunset-teal"] .md-card,
html[data-theme="sunset-teal"] .nav-rail {
  background: rgba(38, 77, 89, 0.82);
  backdrop-filter: blur(10px);
}

/* DOS Amber — classic amber CRT terminal */
[data-theme="dos-amber"] {
  --md-sys-color-surface: #0c0a04;
  --md-sys-color-surface-container: #141008;
  --md-sys-color-surface-container-high: #1e180c;
  --md-sys-color-on-surface: #ffb000;
  --md-sys-color-on-surface-variant: #b88220;
  --md-sys-color-primary: #ffcc33;
  --md-sys-color-outline: #3a2e10;
  --md-sys-color-up: #c8ff5a;
  --md-sys-color-down: #ff5a3a;
  --font-sans: var(--font-mono);
}
html[data-theme="dos-amber"] body {
  background: #080604;
}
html[data-theme="dos-amber"] .md-card,
html[data-theme="dos-amber"] .nav-rail {
  border-color: #5a4010;
  box-shadow: inset 0 0 30px rgba(255, 176, 0, 0.06);
}
html[data-theme="dos-amber"] .brand,
html[data-theme="dos-amber"] .cluster-name {
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.55);
  letter-spacing: 0.04em;
}

/* VT220 — classic green phosphor terminal */
[data-theme="vt220"] {
  --md-sys-color-surface: #001a00;
  --md-sys-color-surface-container: #002400;
  --md-sys-color-surface-container-high: #003000;
  --md-sys-color-on-surface: #33ff33;
  --md-sys-color-on-surface-variant: #1aa01a;
  --md-sys-color-primary: #66ff66;
  --md-sys-color-outline: #0a3a0a;
  --md-sys-color-up: #66ff66;
  --md-sys-color-down: #ff4444;
  --font-sans: var(--font-mono);
}
html[data-theme="vt220"] body {
  background: #000e00;
}
html[data-theme="vt220"] .md-card,
html[data-theme="vt220"] .nav-rail {
  border-color: #145014;
  box-shadow: inset 0 0 30px rgba(0, 255, 0, 0.07);
}
html[data-theme="vt220"] .brand,
html[data-theme="vt220"] .cluster-name {
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.6);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.95em;
}

/* Midnight — deep navy dark */
[data-theme="midnight"] {
  --md-sys-color-surface: #070b14;
  --md-sys-color-surface-container: #0a0e18;
  --md-sys-color-surface-container-high: #121a2a;
  --md-sys-color-on-surface: #e2e8f0;
  --md-sys-color-on-surface-variant: #8b9bb4;
  --md-sys-color-primary: #5b8def;
  --md-sys-color-outline: #1c2438;
  --md-sys-color-up: #34d399;
  --md-sys-color-down: #f87171;
}

/* Slate — cool grey-teal dark */
[data-theme="slate"] {
  --md-sys-color-surface: #0c1014;
  --md-sys-color-surface-container: #0f1419;
  --md-sys-color-surface-container-high: #1a222b;
  --md-sys-color-on-surface: #e2e8ec;
  --md-sys-color-on-surface-variant: #8a9ba6;
  --md-sys-color-primary: #4db6ac;
  --md-sys-color-outline: #1e2830;
  --md-sys-color-up: #4db6ac;
  --md-sys-color-down: #ef9a9a;
}

/* Graphite — Material-style dark grey */
[data-theme="graphite"] {
  --md-sys-color-surface: #0e0e0e;
  --md-sys-color-surface-container: #121212;
  --md-sys-color-surface-container-high: #1e1e1e;
  --md-sys-color-on-surface: #e8e8e8;
  --md-sys-color-on-surface-variant: #9e9e9e;
  --md-sys-color-primary: #90caf9;
  --md-sys-color-outline: #2a2a2a;
  --md-sys-color-up: #81c784;
  --md-sys-color-down: #e57373;
}

/* Pure Black — OLED / true black */
[data-theme="pure-black"] {
  --font-sans: "FiraCode Nerd Font", "Fira Code", ui-monospace, monospace;
  --font-mono: "FiraCode Nerd Font", "Fira Code", ui-monospace, monospace;
  --md-sys-color-surface: #000000;
  --md-sys-color-surface-container: #000000;
  --md-sys-color-surface-container-high: #0a0a0a;
  --md-sys-color-on-surface: #f0f0f0;
  --md-sys-color-on-surface-variant: #888888;
  --md-sys-color-primary: #ffffff;
  --md-sys-color-outline: #1a1a1a;
  --md-sys-color-up: #00e676;
  --md-sys-color-down: #ff5252;
  --md-surface-container: var(--panel);
  --md-on-surface: var(--text);
  --md-on-surface-variant: var(--text-meta);
  --md-outline: var(--border);
  --md-primary: var(--accent);
}
html[data-theme="pure-black"] body,
html[data-theme="pure-black"] .shell,
html[data-theme="pure-black"] .main {
  background: #000;
}
html[data-theme="pure-black"] .md-card {
  background: #000;
  border-color: #1a1a1a;
}
html[data-theme="pure-black"] .nav-rail,
html[data-theme="pure-black"] .mobile-topbar {
  background: #000;
  border-color: #1a1a1a;
}
html[data-theme="pure-black"] 
/* TradingView chart — hidden by default */
.chart { margin-top: 8px; }
.chart.is-hidden { display: none !important; height: 0; margin: 0; padding: 0; overflow: hidden; }
.chart-name { font-size: 12px; color: var(--text-meta); margin-bottom: 6px; }
.chart iframe {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
}

.md-chart {
  background: #000;
  border-color: #1a1a1a;
}

/* CRT — dedicated overlay (body ::before was too easy to miss / blend away) */
.crt-overlay {
  display: none;
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

html[data-theme="crt"] {
  background: #000;
}

html[data-theme="crt"] body {
  background: #020804;
  overflow-x: hidden;
  color: #b8ffb0;
}

/* Show CRT scan overlay on related retro themes too */
html[data-screen-style="crt"] .crt-overlay {
  display: block;
  /* Scanlines */
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.35) 0px,
      rgba(0, 0, 0, 0.35) 1px,
      transparent 1px,
      transparent 3px
    );
  opacity: 0.55;
}

html[data-screen-style="crt"] .crt-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Vignette / tube edge */
  background: radial-gradient(
    ellipse 75% 70% at 50% 50%,
    transparent 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8);
}

html[data-screen-style="crt"] .crt-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 8%, transparent) 0%,
    transparent 30%,
    transparent 70%,
    rgba(0, 0, 0, 0.12) 100%
  );
  animation: crt-scan 8s linear infinite;
}

@keyframes crt-scan {
  0% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(4px);
    opacity: 0.7;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-screen-style="crt"] .crt-overlay::after {
    animation: none;
  }
}

.weekly-page { padding: 8px 4px 48px; }
.weekly-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin:12px 0 24px; }
.weekly-heading h1 { margin:4px 0 8px; }
.weekly-eyebrow { color:var(--md-primary,#76b7ff); font-size:11px; font-weight:800; letter-spacing:.14em; }
.weekly-range,.weekly-footnote { color:var(--md-on-surface-variant,#9eabc0); font-size:13px; }
.weekly-tabs { display:flex; gap:8px; padding:5px; border:1px solid var(--md-outline,#334155); border-radius:14px; background:var(--md-surface-container,#121b28); }
.weekly-tab { border:0; border-radius:10px; padding:10px 16px; color:var(--md-on-surface-variant,#aab7c8); background:transparent; font:inherit; font-weight:700; cursor:pointer; }
.weekly-tab.is-active { color:var(--md-sys-color-on-primary); background:var(--md-primary,#76b7ff); }
.weekly-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0 0 20px; }
.weekly-summary>div { padding:16px 18px; border:1px solid var(--md-outline,#29384a); border-radius:14px; background:var(--md-surface-container,#111a25); }
.weekly-ai-summary { margin:0 0 18px; }
.weekly-ai-heading { display:flex; justify-content:space-between; align-items:end; gap:16px; margin:0 0 10px; }
.weekly-ai-heading>div>span,.weekly-ai-digest-head { color:var(--md-primary,#76b7ff); font-size:10px; font-weight:800; letter-spacing:.13em; }
.weekly-ai-heading h2 { margin:4px 0 0; font-size:20px; }
.weekly-ai-heading>p { margin:0; color:var(--md-on-surface-variant,#9eabc0); font-size:12px; }
.weekly-ai-digest-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr)); gap:12px; }
.weekly-ai-digest { padding:16px 18px; border:1px solid var(--md-outline,#29384a); border-left:3px solid var(--md-primary,#76b7ff); border-radius:14px; background:var(--md-surface-container,#111a25); }
.weekly-ai-digest-head { display:flex; justify-content:space-between; gap:12px; }
.weekly-ai-digest h2 { margin:7px 0 8px; font-size:16px; }
.weekly-ai-digest p { margin:0; color:var(--md-on-surface-variant,#b2bfd0); line-height:1.65; }
.weekly-ai-digest small { display:block; margin-top:8px; color:var(--md-on-surface-variant,#9eabc0); }
.weekly-ai-digest-empty { border-left-color:var(--md-outline,#334155); }
.weekly-ai-empty { padding:16px 18px; border:1px dashed var(--md-outline,#334155); border-radius:14px; color:var(--md-on-surface-variant,#9eabc0); }
.weekly-ai-empty b { color:var(--md-on-surface,#e8edf4); }
.weekly-ai-empty p { margin:6px 0 0; }
.weekly-ai-cluster-note { margin:8px 2px 0; color:var(--md-on-surface-variant,#9eabc0); font-size:11px; }
.weekly-summary b { display:block; font-size:24px; color:var(--md-on-surface,#f4f7fb); }
.weekly-summary span { display:block; color:var(--md-on-surface-variant,#9eabc0); font-size:12px; margin-top:4px; }
.weekly-list { display:grid; gap:10px; }
.weekly-cluster { border:1px solid var(--md-outline,#29384a); border-left:3px solid var(--md-primary,#76b7ff); border-radius:14px; background:var(--md-surface-container,#111a25); }
.weekly-cluster-head { display:grid; grid-template-columns:76px minmax(0,1fr) auto auto; align-items:center; gap:16px; padding:16px; cursor:pointer; list-style:none; }
.weekly-cluster-head::-webkit-details-marker { display:none; }
.weekly-cluster-head:focus-visible { outline:2px solid var(--md-primary,#76b7ff); outline-offset:-4px; border-radius:12px; }
.weekly-cluster-expand { color:var(--md-on-surface-variant,#9eabc0); font-size:22px; line-height:1; transition:transform .18s ease; }
.weekly-cluster[open] .weekly-cluster-expand { transform:rotate(180deg); }
.weekly-cluster-score { display:grid; place-items:center; min-height:58px; border:1px solid currentColor; border-radius:12px; font-size:21px; font-weight:800; color:var(--md-on-surface,#e8edf4); }
.weekly-cluster-score.up,.weekly-change.up { color:var(--up); }
.weekly-cluster-score.down,.weekly-change.down { color:var(--down); }
.weekly-cluster-main h3 { margin:0 0 5px; }
.weekly-cluster-main p { margin:0 0 10px; color:var(--md-on-surface-variant,#9eabc0); font-size:13px; }
.weekly-cluster-summary { margin:0 0 10px; padding:11px 12px; border-left:2px solid var(--md-primary,#76b7ff); border-radius:0 9px 9px 0; background:transparent; }
.weekly-cluster-summary>div { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.weekly-cluster-summary>div>span { color:var(--md-primary,#76b7ff); font-size:9px; font-weight:800; letter-spacing:.1em; }
.weekly-cluster-summary small { color:var(--md-on-surface-variant,#9eabc0); font-size:10px; }
.weekly-cluster-main .weekly-cluster-summary p { margin:6px 0 0; color:var(--md-on-surface,#dce7f4); font-size:12px; line-height:1.55; }
.weekly-tickers { display:flex; flex-wrap:wrap; gap:6px; }
.weekly-tickers span { padding:4px 8px; border:1px solid var(--md-outline,#334155); border-radius:8px; font-size:11px; }
.weekly-change { font-size:19px; font-weight:800; }
.weekly-cluster-history { margin:0 16px 16px; padding:14px; border-top:1px solid var(--md-outline,#29384a); background:transparent; }
.weekly-cluster-history-title { margin:0 0 10px; color:var(--md-primary,#76b7ff); font-size:10px; font-weight:800; letter-spacing:.11em; }
.weekly-cluster-chart { margin:0 0 12px; padding:12px; border:0; border-radius:0; background:transparent; }
.weekly-cluster-chart>div { display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-bottom:8px; }
.weekly-cluster-chart>div>span { color:var(--md-primary,#76b7ff); font-size:10px; font-weight:800; letter-spacing:.1em; }
.weekly-cluster-chart>div>small,.weekly-cluster-chart-note { color:var(--md-on-surface-variant,#9eabc0); font-size:11px; }
.weekly-cluster-chart-note { margin:8px 0 0; line-height:1.45; }
.weekly-cluster-chart-canvas { display:block; width:100%; height:220px !important; max-height:220px !important; box-sizing:border-box; }
.weekly-cluster-chart { height:330px; max-height:330px; overflow:hidden; contain:layout size; position:relative; }
.weekly-cluster-entry { display:grid; grid-template-columns:48px minmax(0,1fr); gap:12px; padding:12px 0; border-top:1px solid color-mix(in srgb, var(--md-outline,#29384a) 70%, transparent); }
.weekly-cluster-entry:first-of-type { border-top:0; }
.weekly-cluster-entry-score { display:grid; place-items:center; min-height:36px; border:1px solid var(--md-outline,#334155); border-radius:9px; color:var(--md-on-surface,#e8edf4); font-size:14px; font-weight:800; }
.weekly-cluster-entry-score.up { color:var(--up); }
.weekly-cluster-entry-score.down { color:var(--down); }
.weekly-cluster-entry-meta { display:flex; flex-wrap:wrap; gap:8px; color:var(--md-on-surface-variant,#9eabc0); font-size:11px; }
.weekly-cluster-entry-meta time { color:var(--md-on-surface,#e8edf4); font-weight:700; }
.weekly-cluster-entry p { margin:5px 0 0; color:var(--md-on-surface,#dce7f4); font-size:12px; line-height:1.55; }
.weekly-empty { padding:28px; text-align:center; color:var(--md-on-surface-variant,#9eabc0); border:1px dashed var(--md-outline,#334155); border-radius:14px; }
.weekly-trend-panel { margin:0 0 26px; padding:18px; border:1px solid var(--md-outline,#29384a); border-radius:16px; background:var(--md-surface-container,#111a25); }
.weekly-trend-panel svg { display:block; width:100%; overflow:visible; }
.weekly-grid { stroke:var(--md-outline,#29384a); stroke-width:1; }
.weekly-axis { fill:var(--md-on-surface-variant,#9eabc0); font-size:11px; }
.weekly-volume { fill:var(--accent); }
.weekly-score-line { stroke:var(--up); stroke-width:3; }
.weekly-score-dot { fill:var(--up); }
.weekly-chart-legend { display:flex; flex-wrap:wrap; gap:20px; color:var(--md-on-surface-variant,#aab7c8); font-size:12px; margin:4px 0 12px; }
.weekly-chart-legend span { display:flex; align-items:center; gap:8px; }
.weekly-key-score,.weekly-key-volume { width:9px; height:9px; border-radius:50%; background:var(--up); }
.weekly-key-volume { background:var(--accent); }
@media(max-width:700px) { .weekly-heading { display:block; } .weekly-tabs { width:max-content; margin-top:16px; } .weekly-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; } .weekly-summary>div { padding:12px; } .weekly-summary b { font-size:20px; } .weekly-ai-heading { display:block; } .weekly-ai-heading>p { margin-top:6px; } .weekly-ai-digest-grid { grid-template-columns:1fr; } .weekly-cluster-head { grid-template-columns:56px minmax(0,1fr) auto; gap:12px; } .weekly-cluster-score { min-height:50px; font-size:18px; } .weekly-change { grid-column:2; } .weekly-cluster-expand { grid-column:3; grid-row:1; } .weekly-cluster-history { margin:0 12px 12px; padding:12px; } .weekly-cluster-chart>div { display:block; } .weekly-cluster-chart>div>small { display:block; margin-top:4px; } .weekly-cluster-summary>div { align-items:flex-start; flex-direction:column; gap:3px; } .weekly-trend-panel { padding:10px; overflow:hidden; } }
.account-page { min-height:calc(100vh - 120px); display:grid; place-items:center; padding:24px; }
.account-shell { width:min(100%,560px); padding:30px; border:1px solid var(--md-outline,#29384a); border-radius:20px; background:var(--md-surface-container,#111a25); box-shadow:0 24px 70px rgba(0,0,0,.22); }
.account-eyebrow { color:var(--md-primary,#76b7ff); font-size:11px; font-weight:800; letter-spacing:.14em; }
.account-shell h1 { margin:8px 0; }
.account-message { min-height:20px; color:#53d49a; font-size:13px; }
.account-form { display:grid; gap:14px; margin:22px 0 12px; }
.account-form label { display:grid; gap:7px; color:var(--md-on-surface-variant,#aab7c8); font-size:13px; }
.account-form input { min-height:46px; padding:10px 12px; border:1px solid var(--md-outline,#334155); border-radius:10px; color:var(--md-on-surface,#f4f7fb); background:var(--panel-2); font:inherit; }
.account-primary,.account-secondary,.account-actions button { min-height:42px; padding:9px 14px; border:1px solid var(--md-outline,#334155); border-radius:10px; color:var(--md-on-surface,#eef3fa); background:transparent; font:inherit; font-weight:700; cursor:pointer; }
.account-primary { color:var(--md-sys-color-on-primary); border-color:var(--accent); background:var(--accent); }
.account-actions { display:flex; flex-wrap:wrap; gap:8px; }
.account-plan-note,.account-plan p { color:var(--md-on-surface-variant,#9eabc0); font-size:13px; line-height:1.6; }
.account-profile { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 0; border-bottom:1px solid var(--md-outline,#29384a); }
.account-plan-badge { padding:5px 9px; border-radius:8px; color:#53d49a; border:1px solid currentColor; font-size:11px; font-weight:800; }
.account-profile > :first-child { min-width: 0; overflow-wrap: anywhere; }
.account-plan-badge { flex-shrink: 0; }
.app-brand-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.brand, .mobile-brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { display: block; width: 28px; height: 28px; flex: 0 0 28px; }
.page-brand-bar { margin-bottom: 12px; }
.page-brand-bar .app-brand-row { justify-content: space-between; }
.page-brand-bar .pro-badge { margin-left: auto; }
html[data-theme] .events-sort-trigger { display: none; }
html[data-theme] .page-brand-bar .brand { font-size: 18px; }
.top-app-bar .burger-btn { display: none; }
.pro-badge { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--design-chip-radius, 8px); background: var(--panel-2); color: var(--text); font-size: 11px; font-weight: 600; line-height: 18px; letter-spacing: 0; white-space: nowrap; }
.pro-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--up); }
.pro-badge[hidden] { display: none; }
.events-pro-badge { display: none; }
@media (max-width: 768px) {
  .top-app-bar .pro-badge { display: none; }
  .mobile-topbar .pro-badge { margin-left: auto; }
}
.account-plan { margin:18px 0; padding:18px 0 0; border:0; border-top:1px solid var(--md-outline,#29384a); border-radius:0; }
.account-plan h2 { margin:0 0 10px; }
.account-publish-market { display:grid; gap:7px; max-width:260px; margin:16px 0; color:var(--md-on-surface-variant,#aab7c8); font-size:13px; }
.account-publish-market select { min-height:42px; padding:8px 11px; border:1px solid var(--md-outline,#334155); border-radius:10px; color:var(--md-on-surface,#f4f7fb); background:var(--panel-2); font:inherit; }
.account-primary:disabled { opacity:.65; cursor:wait; }
.publish-console { min-height:180px; max-height:420px; overflow:auto; margin:14px 0 0; padding:14px; border:1px solid var(--md-outline,#334155); border-radius:10px; color:var(--text); background:var(--panel-2); font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
.publish-chart { display:block; width:100%; max-height:290px; margin:12px 0 0; }
@media(max-width:700px) { .account-page { padding:8px; } .account-shell { padding:22px 18px; } }

#adminView.account-page:not(.hidden) { display:block; min-height:calc(100vh - 120px); padding:18px 0 28px; }
#adminView .account-shell { width:100%; max-width:none; padding:22px clamp(16px,2.5vw,34px); }
#adminView .admin-plan { margin:16px 0 0; padding:16px; }
.admin-publish-head { display:grid; grid-template-columns:minmax(260px,1fr) auto auto; align-items:center; gap:12px 20px; }
.admin-publish-head h2 { margin:0 0 4px; }
.admin-publish-head p { margin:0; }
.admin-publish-head .account-plan-note { grid-column:1 / -1; margin:0; }
.admin-monitor-grid { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr); gap:16px; margin-top:16px; }
.admin-monitor-panel { min-width:0; padding:14px; border:1px solid var(--md-outline,#29384a); border-radius:12px; background:var(--panel); }
.admin-monitor-panel h3 { margin:0; }
.admin-monitor-panel .publish-chart { height:260px !important; max-height:none; margin:8px 0 0; }
.admin-monitor-panel .account-plan-note { margin:8px 0 0; }
.admin-source-panel { grid-column:1 / -1; }
.publish-source-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.publish-source-grid h4 { margin:12px 0 0; font-size:12px; }
.publish-source-list { max-height:240px; overflow:auto; margin:8px 0 0; color:var(--md-on-surface,#dce7f4); font:12px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace; white-space:pre-wrap; }
.admin-monitor-panel .publish-console { height:300px; min-height:0; max-height:calc(100vh - 310px); margin:8px 0 0; }
.admin-model-panel { grid-column:1 / -1; }
.publish-model-reply { min-height:54px; max-height:180px; overflow:auto; margin:8px 0 0; padding:12px; border:1px solid var(--md-outline,#334155); border-radius:10px; color:var(--text); background:var(--panel-2); font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
@media(max-width:900px) { .admin-monitor-grid,.publish-source-grid { grid-template-columns:1fr; } .admin-monitor-panel .publish-console { height:250px; max-height:40vh; } }
@media(max-width:700px) { #adminView.account-page { padding:8px 0 20px; } #adminView .account-shell { padding:20px 14px; } .admin-publish-head { grid-template-columns:1fr 1fr; } .admin-publish-head > div,.admin-publish-head .account-plan-note { grid-column:1 / -1; } }

html[data-theme="crt"] .brand,
html[data-theme="crt"] .mobile-brand,
html[data-theme="crt"] .cluster-name {
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.75), 0 0 2px #39ff14;
  letter-spacing: 0.06em;
}

html[data-theme="crt"] .md-card {
  background: rgba(6, 20, 10, 0.92);
  border-color: #1a4020;
  box-shadow: inset 0 0 24px rgba(0, 40, 10, 0.5), 0 0 12px rgba(57, 255, 20, 0.06);
}

html[data-theme="crt"] .nav-rail,
html[data-theme="crt"] .mobile-topbar {
  background: #041008;
  border-color: #1a4020;
}

html[data-theme="crt"] .nav-rail-btn.is-active {
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
  color: #39ff14;
}

html[data-theme="crt"] .md-chip,
html[data-theme="crt"] .stock-bubble {
  border-color: #2a5030;
  text-shadow: 0 0 4px rgba(57, 255, 20, 0.35);
}

/* Sync legacy vars when theme changes */
[data-theme] {
  --bg: var(--md-sys-color-surface);
  --panel: var(--md-sys-color-surface-container);
  --panel-2: var(--md-sys-color-surface-container-high);
  --border: var(--md-sys-color-outline);
  --text: var(--md-sys-color-on-surface);
  --text-meta: var(--md-sys-color-on-surface-variant);
  --accent: var(--md-sys-color-primary);
  --chip-bg: var(--md-sys-color-surface-container-high);
  --up: var(--md-sys-color-up);
  --down: var(--md-sys-color-down);
  --md-surface-container: var(--panel);
  --md-on-surface: var(--text);
  --md-on-surface-variant: var(--text-meta);
  --md-outline: var(--border);
  --md-primary: var(--accent);
}

/* ========== Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}
body { isolation: isolate; }

.tone-up,
.mover-up {
  color: var(--up) !important;
}
.tone-down,
.mover-down {
  color: var(--down) !important;
}

/* ========== Shell + nav rail ========== */
.shell {
  display: flex;
  min-height: 100vh;
}

.nav-rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--md-sys-rail-width);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 40;
}

.nav-rail-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  margin-bottom: 16px;
}
.nav-rail-wordmark { font: 700 18px/1 var(--font-sans); letter-spacing: -.04em; }

.nav-rail-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
  position: relative;
  flex: 1;
}

.nav-rail-list > #navAccount { margin-top: auto; }

.nav-rail-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 8px;
  position: relative;
}

.nav-rail-footer .theme-menu {
  left: calc(var(--md-sys-rail-width) + 8px);
  bottom: 8px;
  top: auto;
}

.nav-rail-btn {
  width: 64px;
  min-height: 56px;
  border: none;
  background: transparent;
  color: var(--text-meta);
  border-radius: var(--md-sys-shape-lg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav-rail-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}
.nav-rail-btn.is-active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.nav-rail-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav-rail-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.theme-menu {
  position: absolute;
  left: calc(var(--md-sys-rail-width) + 8px);
  bottom: 0;
  background: #121212;
  border: 1px solid #333;
  border-radius: var(--md-sys-shape-md);
  box-shadow: var(--md-sys-elevation-2);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  min-width: 200px;
  scrollbar-width: thin;
}
.theme-menu button {
  border: 1px solid transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--md-sys-shape-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-menu button::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--swatch-accent, #888);
}
.theme-menu button.is-active {
  outline: 2px solid #fff;
  outline-offset: 1px;
}
.theme-menu button:hover {
  filter: brightness(1.08);
}

/* Full theme preview colors on each menu item */
.theme-menu button[data-theme="dark"] {
  background: #0a0a0a; color: #eee; --swatch-accent: #f97316;
}
.theme-menu button[data-theme="clustr"] {
  background: #0a0a0a; color: #eee; --swatch-accent: #f97316;
}
.theme-menu-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}
.theme-menu-heading {
  margin: 2px 4px 4px;
  color: #aeb7c5;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.theme-menu button[data-theme="apple"] {
  background: linear-gradient(135deg, #f8f8f8, #dedee0); color: #29292c; --swatch-accent: #747478;
  border-color: #d6dbe5;
}
.theme-menu button[data-theme="apple-light"] {
  background: linear-gradient(135deg, #fff, #f2f2f7); color: #1c1c1e; --swatch-accent: #a6a6ad;
  border-color: #d6dbe5;
}
.theme-menu button[data-theme="material"] {
  background: linear-gradient(135deg, #fef7ff, #ede8f8); color: #1d1b20; --swatch-accent: #6750a4;
  border-color: #ddd6ed;
}
.theme-menu button[data-theme="material-light"] {
  background: linear-gradient(135deg, #fff, #f3edf7); color: #1d1b20; --swatch-accent: #6750a4;
  border-color: #ddd6ed;
}
.theme-menu button[data-theme="dark-blue"] {
  background: #0b1220; color: #e2e8f0; --swatch-accent: #38bdf8;
}
.theme-menu button[data-theme="synthwave84"] {
  background: #262335; color: #f8f8f2; --swatch-accent: #36f9f6;
}
.theme-menu button[data-theme="nord"] {
  background: #2e3440; color: #eceff4; --swatch-accent: #88c0d0;
}
.theme-menu button[data-theme="one-dark"] {
  background: #282c34; color: #abb2bf; --swatch-accent: #61afef;
}
.theme-menu button[data-theme="tokyo-night"] {
  background: #1a1b26; color: #c0caf5; --swatch-accent: #7aa2f7;
}
.theme-menu button[data-theme="catppuccin"] {
  background: #1e1e2e; color: #cdd6f4; --swatch-accent: #cba6f7;
}
.theme-menu button[data-theme="gruvbox"] {
  background: #282828; color: #ebdbb2; --swatch-accent: #fe8019;
}
.theme-menu button[data-theme="monokai"] {
  background: #272822; color: #f8f8f2; --swatch-accent: #a6e22e;
}
.theme-menu button[data-theme="dracula"] {
  background: #282a36; color: #f8f8f2; --swatch-accent: #bd93f9;
}
.theme-menu button[data-theme="matrix"] {
  background: #020805; color: #c8ffd4; --swatch-accent: #00ff6a;
}
.theme-menu button[data-theme="solarized"] {
  background: #002b36; color: #839496; --swatch-accent: #268bd2;
}
.theme-menu button[data-theme="github-dark"] {
  background: #0d1117; color: #c9d1d9; --swatch-accent: #58a6ff;
}
.theme-menu button[data-theme="github-light"] {
  background: #ffffff; color: #24292f; --swatch-accent: #0969da;
  border-color: #d0d7de;
}
.theme-menu button[data-theme="nord-light"] {
  background: #eceff4; color: #2e3440; --swatch-accent: #5e81ac;
}
.theme-menu button[data-theme="paper"] {
  background: #faf8f5; color: #1c1917; --swatch-accent: #c2410c;
  border-color: #d6d3d1;
}
.theme-menu button[data-theme="aurora"] {
  background: #061018; color: #e8fff6; --swatch-accent: #5efcc1;
}
.theme-menu button[data-theme="volcanic"] {
  background: #12080a; color: #ffe8e0; --swatch-accent: #ff4d1a;
}
.theme-menu button[data-theme="neon-lilac"] {
  background: #14081f; color: #f5e9ff; --swatch-accent: #ff4fd8;
}
.theme-menu button[data-theme="amber-terminal"] {
  background: #0c0a04; color: #ffd27a; --swatch-accent: #ffb000;
}
.theme-menu button[data-theme="crt"] {
  background: #020904; color: #b8ffb0; --swatch-accent: #39ff14;
}
.theme-menu button[data-theme="kermit"] {
  background: linear-gradient(90deg, #75bde0, #cde4ad); color: #1a3a42; --swatch-accent: #75bde0;
}
.theme-menu button[data-theme="coral-navy"] {
  background: linear-gradient(90deg, #ee6a59, #3a3f58); color: #fff; --swatch-accent: #f9ac67;
}
.theme-menu button[data-theme="charcoal-sand"] {
  background: linear-gradient(90deg, #282726, #d6cab0); color: #fff; --swatch-accent: #86817c;
}
.theme-menu button[data-theme="berry-mint"] {
  background: linear-gradient(90deg, #c14364, #2ca18c); color: #fff; --swatch-accent: #ff916b;
}
.theme-menu button[data-theme="plum-cream"] {
  background: linear-gradient(90deg, #4e2e54, #f8dac3); color: #fff; --swatch-accent: #954f75;
}
.theme-menu button[data-theme="forest-mist"] {
  background: linear-gradient(90deg, #2b463c, #b1d182); color: #fff; --swatch-accent: #688f4e;
}
.theme-menu button[data-theme="indigo-peach"] {
  background: linear-gradient(90deg, #0b0742, #ff9190); color: #fff; --swatch-accent: #5e72eb;
}
.theme-menu button[data-theme="sea-foam"] {
  background: linear-gradient(90deg, #2c6975, #e0ecde); color: #fff; --swatch-accent: #68b2a0;
}
.theme-menu button[data-theme="sunset-teal"] {
  background: linear-gradient(90deg, #264d59, #d46c4e); color: #fff; --swatch-accent: #f9ad6a;
}
.theme-menu button[data-theme="dos-amber"] {
  background: #0c0a04; color: #ffb000; --swatch-accent: #ffcc33;
}
.theme-menu button[data-theme="vt220"] {
  background: #001a00; color: #33ff33; --swatch-accent: #66ff66;
}
.theme-menu button[data-theme="midnight"] {
  background: #0a0e18; color: #c8d0e0; --swatch-accent: #5b8def;
}
.theme-menu button[data-theme="slate"] {
  background: #0f1419; color: #c5d0d8; --swatch-accent: #4db6ac;
}
.theme-menu button[data-theme="graphite"] {
  background: #121212; color: #e0e0e0; --swatch-accent: #90caf9;
}
.theme-menu button[data-theme="pure-black"] {
  background: #000; color: #e8e8e8; --swatch-accent: #ffffff;
}

.main {
  margin-left: var(--md-sys-rail-width);
  flex: 1;
  min-width: 0;
  padding: 0 24px 48px;
}

/* Shared edges for page content and its scope/sort controls. */
.main > :is(.view-toolbar, .page-brand-bar, .plan-access-banner, #status, #eventsView, #signalsView, #daysView, #weeklyView, #atlasView, #dashboardView, #connectionsView, #watchlistView, #stocksView, #polymarketView, #proFeatureView) {
  width: 100%;
  max-width: 1540px;
  margin-inline: auto;
  min-width: 0;
}
.main #dashboardView .dash-shell { max-width: none; padding-inline: 0; }
.main > :is(#weeklyView, #atlasView) { padding-inline: 0; }

/* ========== Top app bar ========== */
.top-app-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 12px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 20;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.tagline {
  color: var(--text-meta);
  font-size: 13px;
}
.publish-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, 55vw);
}
.meta {
  color: var(--text-meta);
  font-size: 12px;
  text-align: center;
  flex: 1;
  min-width: 0;
}
.md-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.md-btn--icon:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.md-btn--icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Lock scroll while intro runs */
html.boot-lock,
html.boot-lock body {
  overflow: hidden;
  height: 100%;
}

/* ========== Startup ========== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  transition: opacity 0.75s ease, visibility 0.75s ease, transform 0.75s ease;
}
.boot-screen.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.04);
}
.boot-screen.hidden {
  display: none !important;
}
.boot-screen:not(.boot-screen--glass) > * { visibility: hidden; }
.boot-screen:not(.boot-screen--glass)::after {
  content: '';
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: boot-spin 1s linear infinite;
}
.boot-screen--glass {
  isolation: isolate;
  transition: opacity 300ms ease, visibility 300ms ease, transform 300ms ease;
}
.boot-screen--glass.is-leaving { transform: scale(1.015); }
.boot-ambient {
  position: absolute;
  inset: -25%;
  z-index: -2;
  background: radial-gradient(ellipse at 30% 30%, color-mix(in srgb, var(--text) 12%, transparent), transparent 45%), radial-gradient(ellipse at 75% 65%, color-mix(in srgb, var(--text-meta) 18%, transparent), transparent 50%);
  animation: boot-ambient-drift 12s ease-in-out infinite alternate;
}
.boot-orbit {
  position: absolute;
  z-index: -1;
  width: min(780px, 110vw);
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--text) 7%, transparent);
  border-radius: 50%;
  animation: boot-spin 36s linear infinite;
}
.boot-orbit::after {
  content: '';
  position: absolute;
  top: 14%;
  left: 14%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 40%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--text) 20%, transparent);
}
.boot-orbit--inner { width: min(580px, 85vw); animation-direction: reverse; animation-duration: 24s; }
.app-halos { position: fixed; inset: 0; z-index: -1; display: flex; align-items: center; justify-content: center; overflow: hidden; pointer-events: none; }
.app-halos .boot-orbit { width: min(1200px, 110vw); opacity: .65; animation-duration: 240s; }
.app-halos .boot-orbit--inner { width: min(860px, 85vw); animation-duration: 360s; }
.boot-panel {
  position: relative;
  width: min(400px, calc(100vw - 40px));
  padding: 38px 32px 28px;
  text-align: center;
  animation: boot-reveal 600ms cubic-bezier(.16, 1, .3, 1) both;
}
.boot-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 24px;
  padding: 10px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
}
.boot-mark svg { display: block; width: 100%; height: 100%; }
.boot-dot { transform-box: fill-box; transform-origin: center; animation: boot-node-breathe 2.4s ease-in-out infinite; }
.boot-dot:nth-child(2) { animation-delay: 120ms; }
.boot-dot:nth-child(3) { animation-delay: 240ms; }
.boot-dot:nth-child(4) { animation-delay: 360ms; }
.boot-dot:nth-child(5) { animation-delay: 480ms; }
.boot-dot:nth-child(6) { animation-delay: 600ms; }
.boot-wordmark { margin: 0; font: 650 48px/1.1 var(--font-sans); letter-spacing: -.055em; color: var(--text); }
.boot-tagline { margin: 12px 0 30px; font-size: 14px; color: var(--text-meta); }
.boot-loader { position: relative; overflow: hidden; height: 3px; margin: 0 32px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.boot-loader span { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--text); animation: boot-loading-sweep 1.5s cubic-bezier(.4, 0, .2, 1) infinite; }
.boot-status { min-height: 20px; margin: 16px 0 24px; font-size: 12px; color: var(--text-meta); }
.boot-steps { display: flex; justify-content: center; gap: 20px; list-style: none; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--border); }
.boot-step { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 500; color: var(--text-meta); }
.boot-step::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--border); }
.boot-step.is-current { color: var(--text); }
.boot-step.is-current::before, .boot-step.is-complete::before { background: var(--text); }
.boot-caption { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); margin: 0; color: var(--text-meta); font-size: 9px; letter-spacing: .2em; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@keyframes boot-loading-sweep { from { transform: translateX(-110%); } to { transform: translateX(360%); } }
@keyframes boot-node-breathe { 0%, 100% { opacity: .45; transform: scale(.82); } 50% { opacity: 1; transform: scale(1); } }
@keyframes boot-ambient-drift { to { transform: translate3d(4%, -3%, 0) scale(1.08); } }
@keyframes boot-reveal { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) {
  .boot-panel { padding: 30px 24px 24px; }
  .boot-wordmark { font-size: 42px; }
  .boot-steps { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .boot-screen, .boot-screen--glass { transition: none; }
  .app-halos .boot-orbit { animation: none; }
  .boot-dot { animation: none; }
  .boot-screen:not(.boot-screen--glass)::after,
  .boot-screen--glass * { animation: none !important; }
  .boot-screen--glass.is-leaving { transform: none; }
  .boot-loader span { width: 100%; opacity: .5; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .boot-panel { background: var(--panel-2); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
.intro-bg {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(ellipse 55% 45% at 50% 40%, rgba(70, 120, 255, 0.2), transparent 62%),
    radial-gradient(ellipse 40% 35% at 15% 80%, rgba(40, 200, 140, 0.1), transparent 55%),
    radial-gradient(ellipse 35% 30% at 85% 20%, rgba(255, 140, 60, 0.1), transparent 50%),
    #05070d;
  animation: intro-bg-pulse 8s ease-in-out infinite alternate;
}
@keyframes intro-bg-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.intro-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  opacity: 0.5;
  animation: intro-grid-drift 20s linear infinite;
}
@keyframes intro-grid-drift {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}
.intro-charts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.intro-chart {
  position: absolute;
  width: min(200px, 28vw);
  padding: 10px 12px 8px;
  border-radius: 12px;
  background: rgba(12, 16, 28, 0.75);
  border: 1px solid rgba(120, 150, 200, 0.18);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(16px);
}
.boot-screen.is-live .intro-chart {
  animation: intro-card-in 0.7s ease forwards;
}
.intro-chart--a { top: 12%; left: 8%; animation-delay: 0.15s !important; }
.intro-chart--b { top: 18%; right: 7%; animation-delay: 0.35s !important; }
.intro-chart--c { bottom: 16%; left: 12%; animation-delay: 0.55s !important; }
.intro-chart svg {
  display: block;
  width: 100%;
  height: 48px;
}
.intro-spark {
  fill: none;
  stroke: #3dd68c;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
}
.boot-screen.is-live .intro-spark {
  animation: intro-draw 1.6s ease forwards 0.4s;
}
.intro-spark--down { stroke: #f07178; }
@keyframes intro-draw {
  to { stroke-dashoffset: 0; }
}
.intro-chart span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(200, 215, 240, 0.75);
}
@keyframes intro-card-in {
  to { opacity: 1; transform: translateY(0); }
}
.intro-events {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.intro-news {
  position: absolute;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(10, 14, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(12px);
  animation: intro-card-in 0.6s ease forwards;
  animation-delay: calc(0.5s + var(--i, 0) * 0.12s);
}
.intro-news:nth-child(1) { top: 28%; left: 4%; }
.intro-news:nth-child(2) { top: 42%; right: 5%; }
.intro-news:nth-child(3) { bottom: 28%; right: 10%; }
.intro-news:nth-child(4) { top: 58%; left: 6%; }
.intro-news:nth-child(5) { top: 10%; right: 28%; }
.intro-news:nth-child(6) { bottom: 12%; left: 36%; }
.intro-news-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7eb6ff;
  margin-bottom: 4px;
}
.intro-news-t {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(230, 236, 248, 0.92);
}
.intro-clusters {
  position: absolute;
  inset: 12% 10% 18%;
  pointer-events: none;
  opacity: 0;
}
.boot-screen.is-live .intro-clusters {
  animation: intro-card-in 0.9s ease 0.3s forwards;
}
.intro-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.intro-links line {
  stroke: rgba(120, 160, 255, 0.28);
  stroke-width: 0.35;
}
.intro-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(20, 28, 48, 0.85);
  border: 1px solid rgba(120, 150, 220, 0.25);
  color: rgba(210, 220, 240, 0.9);
  box-shadow: 0 0 24px rgba(70, 120, 255, 0.12);
}
.intro-node--core {
  background: linear-gradient(135deg, rgba(70, 120, 255, 0.35), rgba(40, 200, 160, 0.25));
  border-color: rgba(140, 180, 255, 0.45);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
  animation: intro-core-pulse 2.2s ease-in-out infinite;
}
@keyframes intro-core-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(70, 120, 255, 0.25); }
  50% { box-shadow: 0 0 36px rgba(70, 120, 255, 0.55); }
}
.intro-hero {
  position: relative;
  z-index: 5;
  text-align: center;
  width: min(480px, 90vw);
  padding: 28px 24px;
  border-radius: 20px;
  background: rgba(6, 10, 18, 0.55);
  border: 1px solid rgba(140, 160, 200, 0.16);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: intro-card-in 0.8s ease both;
}
.intro-brand {
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #fff, #9ec0ff 50%, #7dffc0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-line {
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 500;
  color: rgba(230, 236, 248, 0.95);
  margin-bottom: 8px;
  line-height: 1.35;
}
.intro-sub {
  font-size: 13px;
  color: rgba(160, 180, 210, 0.8);
  margin-bottom: 18px;
  min-height: 1.2em;
}
.intro-progress {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.intro-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8def, #5dffb0);
  box-shadow: 0 0 14px rgba(91, 141, 239, 0.55);
  transition: width 0.35s ease;
}
@media (max-width: 720px) {
  .intro-chart--c,
  .intro-news:nth-child(5),
  .intro-news:nth-child(6) {
    display: none;
  }
  .intro-clusters {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .intro-bg,
  .intro-grid,
  .intro-spark,
  .intro-node--core,
  .intro-chart,
  .intro-news,
  .intro-clusters,
  .intro-hero {
    animation: none !important;
  }
  .intro-chart,
  .intro-news,
  .intro-clusters {
    opacity: 1;
    transform: none;
  }
  .intro-spark {
    stroke-dashoffset: 0;
  }
}

.status {
  color: var(--text-meta);
  margin-bottom: 12px;
}
.empty-state {
  color: var(--text-meta);
}

/* ========== Material primitives ========== */
.md-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-lg);
  box-shadow: var(--md-sys-elevation-1);
  padding: 16px;
}
.md-card--outlined {
  box-shadow: none;
}
.md-btn {
  font: inherit;
  font-weight: 500;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  transition: background 0.15s, color 0.15s;
}
.md-btn--tonal {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.md-btn--tonal.is-active,
.md-btn--tonal:hover {
  background: color-mix(in srgb, var(--accent) 20%, var(--panel-2));
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.md-btn--text {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
}
.md-btn--text:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.md-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.md-chip--filter.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.md-chip--assist {
  cursor: default;
  font-size: 11px;
  padding: 4px 8px;
}
.chip-meta {
  color: var(--text-meta);
  font-size: 11px;
}
.md-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-meta);
  font-weight: 500;
}
.md-select {
  font: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-sm);
  padding: 8px 12px;
}
.md-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.md-link:hover {
  text-decoration: underline;
}

/* ========== Movers ========== */
.movers-strip {
  margin-bottom: 20px;
}
.movers-disclosure { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; cursor: pointer; list-style: none; }
.movers-disclosure::-webkit-details-marker { display: none; }
.movers-disclosure:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px; }
.movers-chevron { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-meta); transition: transform .2s ease; }
.movers-strip[open] .movers-chevron { transform: rotate(180deg); }
.movers-content { padding-top: 12px; }
.movers-content .movers-head { justify-content: flex-start; }
.movers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.movers-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}
.movers-toggles {
  display: flex;
  gap: 8px;
}
.movers-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.movers-empty {
  color: var(--text-meta);
}

/* ========== Clusters ========== */
.events-sort-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}
.events-sort-label {
  color: var(--text-meta);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.events-sort-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
@media (max-width: 520px) {
  .events-sort-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}
.events-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cluster-card {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.2s;
}
.cluster-card.is-visible {
  opacity: 1;
  transform: none;
}
.cluster-card.is-flash {
  box-shadow: 0 0 0 2px var(--accent);
}
.cluster-layout {
  display: block;
}
.cluster-layout:has(.stance-aside.is-open) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
}
.cluster-main {
  min-width: 0;
}
.stance-aside {
  display: none;
  min-width: 0;
}
.stance-aside.is-open {
  display: block;
  border-left: 1px solid var(--border);
  padding-left: 12px;
}
.stance-aside .stance-history-mount {
  margin-top: 0;
  max-width: none;
}
.cluster-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.cluster-top .stance-mount {
  flex: 0 1 auto;
  max-width: 280px;
}
.cluster-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
}
.cluster-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 74px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid currentColor;
  border-radius: 10px;
  background: var(--panel);
  white-space: nowrap;
}
.cluster-score--positive {
  color: var(--up);
}
.cluster-score--negative {
  color: var(--down);
}
.cluster-score--neutral {
  color: var(--text-meta);
}
.cluster-score-value {
  font: 700 22px/1 var(--font-mono);
}
.cluster-score-label {
  font: 700 9px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.cluster-news-ratings { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:0 0 10px; }
.cluster-news-ratings-label { color:var(--text-meta); font:700 10px var(--font-mono); letter-spacing:.08em; }
.cluster-news-rating { display:inline-grid; place-items:center; min-width:27px; padding:3px 6px; border:1px solid var(--border); border-radius:7px; font:700 11px var(--font-mono); }
.cluster-news-rating--positive { color:var(--up); border-color:color-mix(in srgb,var(--up) 45%,var(--border)); }
.cluster-news-rating--negative { color:var(--down); border-color:color-mix(in srgb,var(--down) 45%,var(--border)); }
.cluster-news-rating--neutral { color:var(--text-meta); }
.cluster-news-rating-more { color:var(--text-meta); font:11px var(--font-mono); }
.cluster-score--missing { color:var(--text-meta); border-style:dashed; }
.cluster-score--missing .cluster-score-meter { display:none; }
.cluster-news-ratings--missing { min-height:22px; }
.cluster-news-rating-missing { color:var(--text-meta); font:11px var(--font-mono); }
.cluster-score-meter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 54px;
  height: 4px;
}
.cluster-score-meter i {
  position: relative;
  display: block;
  height: 4px;
  background: var(--panel-2);
}
.cluster-score-meter i::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--w);
  background: currentColor;
  content: '';
}
.cluster-score-meter i:first-child::after {
  right: 0;
}
.cluster-score-meter i:last-child::after {
  left: 0;
}

html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0.005em;
}
html[data-theme="dark"] .nav-rail {
  background: #151821;
  border-color: var(--border);
}
html[data-theme="dark"] .nav-rail-btn.is-active {
  background: #202d49;
  color: var(--accent);
}
html[data-theme="dark"] .top-app-bar {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}
html[data-theme="dark"] .brand,
html[data-theme="dark"] .cluster-name {
  color: #dce7ff;
}
html[data-theme="dark"] .md-card,
html[data-theme="dark"] .cluster-card {
  background: var(--panel);
  border-color: var(--border);
}
html[data-theme="dark"] .cluster-card {
  padding: 18px;
}
html[data-theme="dark"] .md-btn--icon,
html[data-theme="dark"] .md-btn--tonal,
html[data-theme="dark"] .md-select,
html[data-theme="dark"] .md-chip {
  background-color: var(--panel-2);
  border-color: var(--border);
}
html[data-theme="dark"] .md-btn--tonal:hover,
html[data-theme="dark"] .md-btn--tonal.is-active,
html[data-theme="dark"] .md-btn--icon:hover:not(:disabled) {
  background-color: var(--md-sys-color-primary-container);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
html[data-theme="dark"] .movers-title,
html[data-theme="dark"] .price-bar-title {
  color: #dce7ff;
  font-weight: 600;
}
html[data-theme="dark"] .price-bar,
html[data-theme="dark"] .stance-history-panel {
  background: var(--panel-2);
}
html[data-theme="dark"] .price-bar {
  padding: 16px;
}
html[data-theme="dark"] .price-value {
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
}
html[data-theme="dark"] .md-chart {
  background: var(--panel);
}
html[data-theme="dark"] .article-grid > * {
  background: #151a24;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
html[data-theme="dark"] .article-title a {
  color: var(--text);
}
html[data-theme="dark"] .article-title a:hover {
  color: var(--accent);
}
html[data-theme="dark"] :focus-visible {
  outline-color: var(--accent);
}

html[data-theme="dark"] {
  --md-sys-color-surface: #090d13;
  --md-sys-color-surface-container: #101720;
  --md-sys-color-surface-container-high: #121c27;
  --md-sys-color-surface-container-highest: #1a2835;
  --md-sys-color-on-surface: #e6edf3;
  --md-sys-color-on-surface-variant: #99a8b4;
  --md-sys-color-primary: #7fe0cf;
  --md-sys-color-on-primary: #090d13;
  --md-sys-color-primary-container: #18363a;
  --md-sys-color-outline: #22313c;
  --md-sys-color-outline-variant: #29404a;
  --md-sys-color-up: #79d6a6;
  --md-sys-color-down: #f18d87;
  --font-sans: Inter, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Roboto Mono", Consolas, monospace;
}
html[data-theme="dark"] body {
  background-image: radial-gradient(ellipse at 60% -30%, rgba(47, 107, 105, .16), transparent 56%);
  letter-spacing: 0;
}
html[data-theme="dark"] .nav-rail {
  background: rgba(13, 19, 27, .82);
  border-color: var(--border);
}
html[data-theme="dark"] .nav-rail-btn {
  border-radius: 9px;
}
html[data-theme="dark"] .nav-rail-btn.is-active {
  background: rgba(127, 224, 207, .1);
  color: var(--accent);
}
html[data-theme="dark"] .top-app-bar {
  border-color: rgba(127, 224, 207, .18);
  backdrop-filter: blur(18px);
}
html[data-theme="dark"] .brand,
html[data-theme="dark"] .cluster-name,
html[data-theme="dark"] .movers-title,
html[data-theme="dark"] .price-bar-title {
  color: var(--text);
}
html[data-theme="dark"] .brand {
  letter-spacing: .08em;
}
html[data-theme="dark"] .md-card,
html[data-theme="dark"] .cluster-card {
  border-color: rgba(153, 168, 180, .13);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(20, 31, 43, .98), rgba(15, 23, 32, .98));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
html[data-theme="dark"] .cluster-card {
  border-left: 2px solid var(--border);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
html[data-theme="dark"] .cluster-card:hover {
  border-color: rgba(127, 224, 207, .34);
  background: #15212c;
}
html[data-theme="dark"] .md-btn--icon,
html[data-theme="dark"] .md-btn--tonal,
html[data-theme="dark"] .md-select,
html[data-theme="dark"] .md-chip,
html[data-theme="dark"] .stance-history-icon-btn {
  background: var(--panel);
  border-color: var(--border);
  border-radius: 8px;
}
html[data-theme="dark"] .md-btn--tonal:hover,
html[data-theme="dark"] .md-btn--tonal.is-active,
html[data-theme="dark"] .md-btn--icon:hover:not(:disabled),
html[data-theme="dark"] .stance-history-icon-btn:hover,
html[data-theme="dark"] .stance-history-icon-btn.is-open {
  background: rgba(127, 224, 207, .08);
  border-color: rgba(127, 224, 207, .34);
  color: var(--accent);
}
html[data-theme="dark"] .cluster-score {
  background: var(--panel);
  border-radius: 10px;
}
html[data-theme="dark"] .cluster-score--positive { color: var(--up); }
html[data-theme="dark"] .cluster-score--negative { color: var(--down); }
html[data-theme="dark"] .cluster-score--neutral { color: var(--text-meta); }
html[data-theme="dark"] .cluster-score-meter i { background: var(--md-sys-color-surface-container-highest); }
html[data-theme="dark"] .stance,
html[data-theme="dark"] .stance-history-panel,
html[data-theme="dark"] .price-bar {
  background: var(--panel);
  border-color: var(--border);
  border-radius: 10px;
}
html[data-theme="dark"] .price-value { color: var(--text); }
html[data-theme="dark"] .bubbles-scroll .md-chip,
html[data-theme="dark"] .stock-bubbles .md-chip {
  background: rgba(127, 224, 207, .045);
  border-color: rgba(127, 224, 207, .2);
  color: #c9e6e2;
}
html[data-theme="dark"] .md-chart {
  background: var(--panel);
  border-color: var(--border);
  border-radius: 10px;
}
html[data-theme="dark"] .article-grid > * {
  background: rgba(8, 13, 19, .48);
  border-color: var(--border);
  border-radius: 10px;
}
html[data-theme="dark"] .article-title,
html[data-theme="dark"] .article-title a { color: var(--text); }
html[data-theme="dark"] .article-title a:hover { color: var(--accent); }
html[data-theme="dark"] .article-rating--positive {
  background: rgba(121, 214, 166, .08);
  border-color: rgba(121, 214, 166, .4);
}
html[data-theme="dark"] .article-rating--negative {
  background: rgba(241, 141, 135, .08);
  border-color: rgba(241, 141, 135, .4);
}
.cluster-reason {
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.55;
}
.cluster-reason--preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.cluster-card.is-expanded .cluster-reason--preview {
  display: block;
  overflow: visible;
}
.cluster-card.is-expanded .cluster-layout,
.cluster-card.is-expanded .cluster-overview {
  display: block;
}
.cluster-card.is-expanded .cluster-stance-preview,
.cluster-card.is-expanded .stance-aside,
.cluster-card.is-expanded [data-stance-history] {
  display: none;
}
.cluster-card.is-expanded .cluster-summary {
  max-width: none;
}
.cluster-overview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cluster-top,
.cluster-summary { cursor: pointer; }
.cluster-overview { min-width: 0; cursor: pointer; }
.cluster-summary { min-width: 0; }
.cluster-context { display: none; }
.cluster-stance-preview { display: none; }
@media (min-width: 1024px) {
  .cluster-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 56px);
    align-items: center;
  }
  .cluster-overview .cluster-reason { margin: 0 0 14px; }
  .cluster-overview .cluster-reason--preview { -webkit-line-clamp: 3; }
  .cluster-stance-preview { display: block; min-width: 0; }
  .stance-mini { padding: 4px 0; color: var(--text-meta); }
  .stance-mini-head, .stance-mini-dates { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .stance-mini-head { font-size: 11px; }
  .stance-mini-head > :first-child { color: var(--text); font-weight: 500; }
  .stance-mini-head > :last-child, .stance-mini-dates { font-size: 10px; color: var(--text-meta); }
  .stance-mini-chart { display: block; width: 100%; height: 84px; margin: 4px 0; overflow: visible; }
  .stance-mini-grid { fill: none; stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
  .stance-mini-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .stance-mini-dot { fill: currentColor; }
  .stance-mini--positive .stance-mini-chart { color: var(--up); }
  .stance-mini--negative .stance-mini-chart { color: var(--down); }
  .stance-mini-empty { min-height: 84px; margin: 8px 0 0; display: flex; align-items: center; font-size: 12px; }
}
.cluster-overview-footer .cluster-news-ratings {
  margin: 0;
  min-width: 0;
}
.cluster-details {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.cluster-expand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-meta);
  font: 600 12px var(--font-sans);
  cursor: pointer;
}
.cluster-expand:hover,
.cluster-expand:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}
.cluster-expand-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  transition: transform .2s ease;
}
.cluster-expand[aria-expanded="true"] .cluster-expand-icon {
  transform: rotate(180deg);
}
@media (max-width: 620px) {
  .cluster-overview-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
.cluster-angle {
  color: var(--text-meta);
  font-size: 13px;
  margin-bottom: 4px;
}

.stance-wrap {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: flex-start;
  justify-content: flex-end;
  max-width: 360px;
}
.stance-history-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-meta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
}
.stance-history-icon-btn:hover,
.stance-history-icon-btn.is-open {
  color: var(--accent);
  border-color: var(--accent);
}
.stance-history-icon-btn.is-open {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-2));
}
.stance {
  border-radius: var(--md-sys-shape-md);
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12px;
}
.stance-title {
  font-weight: 500;
}
.stance-sub {
  color: var(--text-meta);
  margin-top: 2px;
}
.stance-constructive {
  border-color: color-mix(in srgb, var(--up) 40%, var(--border));
}
.stance-cautious {
  border-color: color-mix(in srgb, var(--down) 40%, var(--border));
}
.sector-default-sum {
  font-size: 11px;
  font-weight: 500;
}

/* Stance history (same cluster name across publishes) */
.stance-history-btn {
  margin-top: 8px;
  width: 100%;
  max-width: 280px;
}
.stance-history-mount {
  margin-top: 0;
  max-width: none;
}
.stance-history-panel {
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-md);
  background: var(--panel-2);
  padding: 12px;
  position: sticky;
  top: 72px;
}
.stance-history-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-meta);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stance-history-chart-wrap {
  margin-bottom: 8px;
  width: 100%;
  height: 240px !important;
  min-height: 240px !important;
  max-height: 240px !important;
  box-sizing: border-box;
  contain: layout size;
  overflow: hidden;
  position: relative;
}
.stance-history-canvas {
  position: absolute !important;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
}
.stance-history-line {
  stroke: var(--text-meta);
  stroke-width: 2;
}
.stance-price-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}
.stance-chart-legend {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text-meta);
  margin-top: 4px;
  margin-bottom: 8px;
}
.stance-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.stance-stat {
  background: var(--panel);
  border-radius: 8px;
  padding: 6px;
  text-align: center;
}
.stance-stat-k {
  font-size: 9px;
  color: var(--text-meta);
  text-transform: uppercase;
}
.stance-stat-v {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stance-stat-h {
  font-size: 9px;
  color: var(--text-meta);
}
.stance-insight {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text);
  margin: 0 0 8px;
}
.stance-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.stance-axis {
  fill: var(--text-meta);
  font-size: 9px;
}
.stance-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  margin-top: 8px;
}
.stance-history-list.is-collapsed,
.stance-history-list[hidden] {
  display: none !important;
}
.stance-toggle-history {
  margin-top: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-meta);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
}
.stance-toggle-history:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.stance-history-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}
.stance-history-ret {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 10px;
}
.stance-history-ret .muted {
  color: var(--text-meta);
  font-weight: 400;
}
.stance-history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-meta);
}
.stance-history-row.stance-constructive .stance-history-dot {
  background: var(--up);
}
.stance-history-row.stance-cautious .stance-history-dot {
  background: var(--down);
}
.stance-history-stance {
  text-transform: capitalize;
  font-weight: 500;
}
.stance-history-date {
  color: var(--text-meta);
  font-size: 10px;
}
.stance-history-empty {
  font-size: 12px;
  color: var(--text-meta);
  padding: 8px 0;
}

.stock-panel {
  margin: 16px 0 12px;
}
.stock-panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
  justify-content: flex-start;
}
.group-since-publish {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-meta);
  white-space: nowrap;
}
.group-since-publish.is-loading {
  opacity: 0.7;
}
.group-since-publish.tone-up .group-since-value {
  color: var(--up);
}
.group-since-publish.tone-down .group-since-value {
  color: var(--down);
}
.group-since-label {
  color: var(--text-meta);
}
.group-since-value {
  font-weight: 700;
  margin: 0 4px;
}
.group-since-hint {
  color: var(--text-meta);
  font-weight: 400;
}
.bubbles-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.price-bar {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-md);
  padding: 12px;
  margin-bottom: 12px;
}
.price-bar-title {
  font-weight: 500;
  margin-bottom: 8px;
}
.price-bar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
  .technical-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .technical-metrics div { display: grid; gap: 3px; }
  .technical-metrics span, .technical-metrics-note { color: var(--muted); font-size: 11px; }
  .technical-metrics strong { font-size: 13px; font-weight: 600; }
  .technical-metrics-note { margin-top: 10px; }
.price-label,
.price-sub {
  font-size: 11px;
  color: var(--text-meta);
}
.price-value {
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.md-chart {
  margin: 12px 0;
  border-radius: var(--md-sys-shape-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.chart-name {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-meta);
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}




/* Pure black — deeper black wash */

html[data-theme="pure-black"] 


html[data-theme="graphite"] 

html[data-theme="midnight"] 

html[data-theme="slate"] 

/* Retro / CRT — scanlines + phosphor tint on charts */
html[data-theme="crt"] .chart-overlay,
html[data-theme="matrix"] .chart-overlay,
html[data-theme="vt220"] 


html[data-theme="dos-amber"] .chart-overlay,
html[data-theme="amber-terminal"] 


/* Soft light-theme wash so charts don’t glare */
html[data-theme="github-light"] .chart-overlay,
html[data-theme="nord-light"] .chart-overlay,
html[data-theme="paper"] .chart-overlay,
html[data-theme="kermit"] .chart-overlay,
html[data-theme="sea-foam"] 


.related-clusters {
  margin: 12px 0;
}
.related-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.related-title {
  font-weight: 500;
}
.related-count {
  color: var(--text-meta);
  font-size: 12px;
}
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-item {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--md-sys-shape-sm);
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.related-item:hover {
  border-color: var(--accent);
}
.related-item-t {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
}
.related-item-s {
  font-size: 11px;
  color: var(--text-meta);
}
.related-impact { flex-shrink: 0; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-meta); }
.related-impact--constructive { color: var(--up); }
.related-impact--cautious { color: var(--down); }
.related-empty,
.stock-empty {
  color: var(--text-meta);
  font-size: 13px;
}

.article-category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 13px 0 3px;
  scrollbar-width: thin;
}
.article-category-tab {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-meta);
  font: 600 12px var(--font-sans);
  cursor: pointer;
}
.article-category-tab span { margin-left: 5px; opacity: .7; }
.article-category-tab:hover,
.article-category-tab.is-active {
  border-color: var(--accent);
  color: var(--accent);
}
.article-category-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.article-card[hidden] { display: none !important; }
.same-event { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--panel); font-size: 13px; }
.same-event summary { cursor: pointer; font-weight: 650; }
.same-event p, .same-event ul { margin: 8px 0 0; }
.same-event ul { padding-left: 18px; }
.same-event li + li { margin-top: 6px; }
.cluster-market-signals { margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.cluster-market-signals-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 9px; font-size: 12px; }
.cluster-market-signals-head span { color: var(--text-meta); }
.cluster-market-signals-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cluster-market-signal { display: grid; gap: 2px; min-width: 180px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; font-size: 11px; }
.cluster-market-signal strong { font-size: 15px; }
.cluster-market-signal small { color: var(--text-meta); }
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.article-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
}
.article-meta {
  font-size: 12px;
  color: var(--text-meta);
  margin-bottom: 6px;
}
.article-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.article-rating--positive {
  color: var(--up);
  border-color: color-mix(in srgb, var(--up) 45%, var(--border));
}
.article-rating--negative {
  color: var(--down);
  border-color: color-mix(in srgb, var(--down) 45%, var(--border));
}
.article-rating--neutral {
  color: var(--text-meta);
}
.article-impact-window {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.impact-timeline { margin: 12px 0; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border)); border-radius: var(--md-sys-shape-md); background: color-mix(in srgb, var(--panel-2) 82%, var(--accent) 5%); }
.impact-timeline-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.impact-timeline-head strong { color: var(--text); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.impact-timeline-head span { color: var(--text-meta); font-size: 10px; }
.impact-timeline-axis { display: flex; justify-content: space-between; margin: 0 66px 5px 108px; color: var(--text-meta); font-size: 9px; font-variant-numeric: tabular-nums; }
.impact-timeline-rows { display: grid; gap: 7px; }
.impact-timeline-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) 58px; align-items: center; gap: 8px; min-width: 0; }
.impact-timeline-label { overflow: hidden; color: var(--text-meta); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.impact-timeline-track { position: relative; display: block; height: 8px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--border) 70%, transparent); }
.impact-timeline-track::before { position: absolute; top: -2px; bottom: -2px; left: 0; border-left: 1px solid var(--text-meta); content: ''; opacity: .7; }
.impact-timeline-track i { position: absolute; top: 0; bottom: 0; left: var(--offset); width: var(--width); min-width: 3px; border-radius: 999px; background: var(--text-meta); box-shadow: 0 0 10px color-mix(in srgb, currentColor 35%, transparent); }
.impact-timeline-track .impact-timeline-bar--positive { background: var(--up); }
.impact-timeline-track .impact-timeline-bar--negative { background: var(--down); }
.impact-timeline-duration { color: var(--text-meta); font-size: 9px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.impact-timeline-empty { padding: 28px 12px; color: var(--text-meta); font-size: 12px; text-align: center; }
@media(max-width:700px) { .impact-timeline-head { display: block; } .impact-timeline-head span { display: block; margin-top: 3px; } .impact-timeline-axis { margin-left: 76px; margin-right: 0; } .impact-timeline-row { grid-template-columns: 68px minmax(0, 1fr); } .impact-timeline-duration { display: none; } }
.article-summary {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-meta);
}
.country-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 11px;
}

/* ========== Map ========== */
#mapView .map {
  height: min(52vh, 480px);
  width: 100%;
  border-radius: 0;
  border: 1px solid var(--border);
  margin: 0 -24px;
  width: calc(100% + 48px);
}
.leaflet-container {
  background: var(--bg) !important;
  font: inherit !important;
}
.map-count-bubble {
  background: transparent !important;
  border: none !important;
}
.count-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--accent);
  color: var(--md-sys-color-on-primary, #111);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  box-shadow: var(--md-sys-elevation-2);
}
.country-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.country-card {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--md-sys-shape-md);
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.country-card.is-active,
.country-card:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.c-name {
  font-weight: 500;
}
.c-count {
  font-size: 12px;
  color: var(--text-meta);
}
.country-articles {
  margin-top: 8px;
}
.country-articles-head {
  margin-bottom: 12px;
}

/* ========== Signal ========== */
.signal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.signal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.signal-status {
  color: var(--text-meta);
  font-size: 12px;
}
.signal-grid-head,
.signal-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.8fr 0.8fr 0.8fr 0.8fr 1.4fr;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}
.signal-grid-head {
  color: var(--text-meta);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.signal-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: var(--md-sys-shape-sm);
}
.signal-row:hover {
  background: var(--panel);
}
.signal-t {
  font-weight: 500;
}
.signal-s {
  font-size: 11px;
  color: var(--text-meta);
}
.signal-num {
  font-variant-numeric: tabular-nums;
}
.signal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ========== Days ========== */
.days-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.day-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--md-sys-shape-md);
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
}
.day-item.is-active,
.day-item:hover {
  border-color: var(--accent);
}
.day-t {
  font-weight: 500;
}
.day-s {
  font-size: 12px;
  color: var(--text-meta);
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .signal-grid-head {
    display: none;
  }
  .signal-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .price-bar-grid {
    grid-template-columns: 1fr;
  }
  #mapView .map {
    margin: 0;
    width: 100%;
    height: 40vh;
  }
}

/* Mobile sticky burger (hidden on desktop) */
.mobile-topbar {
  display: none;
}
.mobile-nav-close, .publish-meta-mobile { display: none; }
.nav-backdrop {
  display: none;
}
.burger-btn {
  border: none;
  background: var(--panel);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.burger-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}
.burger-lines span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
body.nav-open .burger-lines span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.nav-open .burger-lines span:nth-child(2) {
  opacity: 0;
}
body.nav-open .burger-lines span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 960px) {
  /* Stack main + history so the panel is never 0-width */
  .cluster-layout {
    display: flex;
    flex-direction: column;
  }
  .cluster-layout:has(.stance-aside.is-open) {
    grid-template-columns: unset;
    gap: 12px;
  }
  .stance-aside {
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
  .stance-aside.is-open {
    display: block;
    width: 100%;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 4px;
  }
  .stance-aside .stance-history-mount:not(.hidden) {
    display: block;
    width: 100%;
  }
  .stance-history-panel {
    position: static;
    width: 100%;
    max-width: 100%;
  }
  .stance-wrap {
    align-items: stretch;
    max-width: none;
    width: 100%;
  }
  .stance-history-btn {
    max-width: none;
    width: 100%;
    min-height: 44px;
  }
  .stance-stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 60;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-brand {
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
    font-size: 18px;
  }

  .nav-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 70;
    align-items: stretch;
    padding: 16px 8px;
    box-shadow: var(--md-sys-elevation-2);
  }
  body.nav-open .nav-rail {
    transform: translateX(0);
  }
  .nav-rail-btn {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 12px;
    min-height: 48px;
  }
  .nav-rail-label {
    display: inline !important;
  }
  .nav-rail-footer {
    align-items: stretch;
  }
  .nav-rail-footer .theme-menu {
    left: 8px;
    right: 8px;
    bottom: 64px;
    min-width: 0;
    max-height: min(50vh, 360px);
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 65;
  }
  .nav-backdrop[hidden] {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 0 12px 32px;
  }
  .top-app-bar-text .brand {
    display: none;
  }
  .publish-nav {
    max-width: 100%;
  }
  .cluster-top {
    flex-direction: column;
  }
  .stance-wrap {
    align-items: flex-start;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .nav-rail-label {
    display: inline;
  }
  .main {
    padding: 0 12px 32px;
  }
  .cluster-top {
    flex-direction: column;
  }
  .stance-wrap {
    align-items: flex-start;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cluster-card {
    transition: none;
  }
}


/* —— Cluster tankekart (mind map) —— */
#mindView {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 120px);
  max-height: calc(100dvh - 120px);
  min-height: 0;
  overflow: hidden;
}
#mindView.hidden {
  display: none !important;
}
.mindmap-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.mindmap-hint {
  font-size: 0.8rem;
  color: var(--text-meta);
}
.mindmap {
  width: 100%;
  height: calc(100dvh - 140px);
  max-height: calc(100dvh - 140px);
  min-height: 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%),
    var(--panel);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.mindmap-host {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.mindmap-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  min-height: 0;
}
.mindmap-canvas:active {
  cursor: grabbing;
}


/* Chart folder: Stance history (default) | TradingView */
.chart-folder {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}
.chart-folder-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 80%, #000);
}
.chart-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-meta);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.chart-tab:hover {
  color: var(--text);
}
.chart-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.chart-folder .chart {
  margin: 0;
  padding: 12px;
}
.chart-folder .chart.is-hidden {
  display: none !important;
}
.chart-folder .stance-history-panel {
  border: none;
  background: transparent;
  padding: 0;
  max-height: none;
  width: 100%;
}
.chart-folder .stance-history-chart-wrap,
.chart-folder .stance-history-chart {
  width: 100%;
}


/* Stock tankekart controls */
.tank-controls {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  flex: 0 0 auto;
}
.tank-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}
.tank-label {
  font-size: 0.72rem;
  color: var(--text-meta);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.tank-select {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 160px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.tank-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tank-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-meta);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
}
.tank-pill.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.tank-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-meta);
}
.mindmap-host {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}


/* Tank body split: canvas + article side list */
.tank-body {
  display: flex;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.tank-body .mindmap-canvas {
  flex: 1 1 62%;
  min-width: 0;
  min-height: 0;
  height: 100% !important;
  max-height: 100%;
}
.tank-side {
  flex: 0 0 min(38%, 420px);
  width: min(38%, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding: 10px 12px 16px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  min-height: 0;
  height: 100%;
  max-height: 100%;
  -webkit-overflow-scrolling: touch;
}
.tank-side-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.tank-side-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-meta);
  margin: 12px 0 6px;
  font-weight: 600;
}
.tank-side-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.tank-side-chip:hover {
  border-color: var(--accent);
}
.tank-art-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.tank-art-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.tank-art-title:hover { color: var(--accent); }
.tank-art-meta {
  font-size: 0.72rem;
  color: var(--text-meta);
  margin: 4px 0 6px;
}
.tank-art-bubbles { display: flex; flex-wrap: wrap; gap: 4px; }
.art-co-bubble {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-meta);
}
.art-co-bubble.up { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, var(--border)); }
.art-co-bubble.down { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, var(--border)); }
.tank-back {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.8rem;
}
.tank-back:disabled { opacity: 0.4; cursor: default; }
.tank-search {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 140px;
}
.btn-open-map {
  margin-left: 8px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.article-co-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

/* ========== System themes: Apple (default) and Google Material ========== */
html[data-theme="apple"] {
  --design-card-radius: 20px;
  --design-inset-radius: 12px;
  --design-control-radius: 10px;
  --design-chip-radius: 999px;
  --design-heading-weight: 650;
  --design-control-weight: 600;
  --design-body-size: 15px;
  --design-card-padding: 20px;
  --design-motion: 180ms ease-out;
  color-scheme: light;
  --md-sys-color-surface: #f2f2f7;
  --md-sys-color-surface-container: rgba(255, 255, 255, .78);
  --md-sys-color-surface-container-high: #ffffff;
  --md-sys-color-surface-container-highest: #e5e5ea;
  --md-sys-color-on-surface: #1c1c1e;
  --md-sys-color-on-surface-variant: #6e6e73;
  --md-sys-color-primary: #48484c;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #dedee2;
  --md-sys-color-outline: rgba(60, 60, 67, .18);
  --md-sys-color-outline-variant: rgba(60, 60, 67, .29);
  --md-sys-color-up: #16824a;
  --md-sys-color-down: #d70015;
  --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, .06);
  --md-sys-elevation-2: 0 8px 24px rgba(0, 0, 0, .14);
  --md-sys-shape-sm: 10px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="material"] {
  --design-card-radius: 12px;
  --design-inset-radius: 8px;
  --design-control-radius: 999px;
  --design-chip-radius: 8px;
  --design-heading-weight: 400;
  --design-control-weight: 500;
  --design-body-size: 16px;
  --design-card-padding: 24px;
  --design-motion: 250ms cubic-bezier(.2, 0, 0, 1);
  color-scheme: light;
  --md-sys-color-surface: #fef7ff;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-container-highest: #e6e0e9;
  --md-sys-color-on-surface: #1d1b20;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e9ddff;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  --md-sys-color-up: #176b3a;
  --md-sys-color-down: #ba1a1a;
  --md-sys-elevation-1: 0 1px 2px rgba(29, 27, 32, .18), 0 1px 3px rgba(29, 27, 32, .08);
  --md-sys-elevation-2: 0 3px 8px rgba(29, 27, 32, .18);
  --md-sys-shape-sm: 8px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --font-sans: Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Roboto Mono", "Courier New", monospace;
}

html[data-theme="apple"] body,
html[data-theme="material"] body {
  background-image: none;
  letter-spacing: 0;
}
html[data-theme="apple"] body { font-size: 15px; line-height: 1.45; }
html[data-theme="material"] body { font-size: 14px; line-height: 1.43; }

html[data-theme="apple"] .nav-rail {
  background: rgba(246, 246, 248, .82);
  border-color: rgba(60, 60, 67, .18);
  backdrop-filter: saturate(180%) blur(20px);
}
html[data-theme="apple"] .nav-rail-btn {
  min-height: 52px;
  border-radius: 12px;
  font-weight: 500;
}
html[data-theme="apple"] .nav-rail-btn.is-active {
  background: var(--md-sys-color-primary-container);
  color: var(--text);
}
html[data-theme="apple"] .top-app-bar {
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  background: rgba(242, 242, 247, .76);
  border-bottom: 1px solid rgba(60, 60, 67, .18);
  backdrop-filter: saturate(180%) blur(20px);
}
html[data-theme="apple"] .brand {
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
}
html[data-theme="apple"] .tagline { font-size: 13px; }
html[data-theme="apple"] .md-card,
html[data-theme="apple"] .cluster-card,
html[data-theme="apple"] .md-chart,
html[data-theme="apple"] .stance,
html[data-theme="apple"] .stance-history-panel,
html[data-theme="apple"] .price-bar,
html[data-theme="apple"] .article-grid > * {
  background: var(--panel);
  border-color: rgba(60, 60, 67, .16);
  border-radius: 14px;
  box-shadow: none;
}
html[data-theme="apple"] .cluster-card:hover {
  background: #fff;
  border-color: var(--md-sys-color-outline-variant);
}
html[data-theme="apple"] .md-btn,
html[data-theme="apple"] .md-btn--icon,
html[data-theme="apple"] .md-select,
html[data-theme="apple"] .stance-history-icon-btn {
  min-height: 36px;
  border-radius: 10px;
}
html[data-theme="apple"] .md-btn--tonal,
html[data-theme="apple"] .md-btn--icon,
html[data-theme="apple"] .md-select,
html[data-theme="apple"] .stance-history-icon-btn {
  background: rgba(118, 118, 128, .12);
  border-color: transparent;
}
html[data-theme="apple"] .md-btn--tonal.is-active,
html[data-theme="apple"] .md-btn--tonal:hover,
html[data-theme="apple"] .md-btn--icon:hover:not(:disabled),
html[data-theme="apple"] .stance-history-icon-btn:hover {
  background: var(--md-sys-color-primary-container);
  border-color: transparent;
  color: var(--accent);
}
html[data-theme="apple"] .md-chip {
  border-radius: 999px;
  background: rgba(118, 118, 128, .12);
  border-color: transparent;
  font-size: 12px;
}
html[data-theme="apple"] .md-chip--filter.is-selected {
  background: color-mix(in srgb, var(--text) 10%, var(--panel-2));
  border-color: color-mix(in srgb, var(--text) 28%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}
html[data-theme="apple"] .cluster-name,
html[data-theme="apple"] .movers-title,
html[data-theme="apple"] .price-bar-title {
  letter-spacing: -.018em;
}

html[data-theme="material"] .nav-rail {
  background: var(--md-sys-color-surface-container);
  border-color: transparent;
}
html[data-theme="material"] .nav-rail-btn {
  min-height: 56px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}
html[data-theme="material"] .nav-rail-btn.is-active {
  background: var(--md-sys-color-primary-container);
  color: #21005d;
}
html[data-theme="material"] .top-app-bar {
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  background: var(--md-sys-color-surface);
  border-bottom: 0;
  backdrop-filter: none;
}
html[data-theme="material"] .brand {
  color: var(--text);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0;
}
html[data-theme="material"] .tagline,
html[data-theme="material"] .md-label { font-size: 12px; }
html[data-theme="material"] .md-card,
html[data-theme="material"] .cluster-card,
html[data-theme="material"] .md-chart,
html[data-theme="material"] .stance,
html[data-theme="material"] .stance-history-panel,
html[data-theme="material"] .price-bar,
html[data-theme="material"] .article-grid > * {
  background: var(--panel);
  border-color: transparent;
  border-radius: 12px;
  box-shadow: none;
}
html[data-theme="material"] .cluster-card:hover {
  background: var(--md-sys-color-surface-container-high);
  border-color: transparent;
}
html[data-theme="material"] .md-btn,
html[data-theme="material"] .md-btn--icon,
html[data-theme="material"] .md-select,
html[data-theme="material"] .stance-history-icon-btn {
  min-height: 40px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
}
html[data-theme="material"] .md-btn--tonal,
html[data-theme="material"] .md-btn--icon,
html[data-theme="material"] .stance-history-icon-btn {
  background: var(--md-sys-color-surface-container-high);
  border-color: transparent;
}
html[data-theme="material"] .md-btn--tonal.is-active,
html[data-theme="material"] .md-btn--tonal:hover,
html[data-theme="material"] .md-btn--icon:hover:not(:disabled),
html[data-theme="material"] .stance-history-icon-btn:hover {
  background: var(--md-sys-color-primary-container);
  border-color: transparent;
  color: #21005d;
}
html[data-theme="material"] .md-chip {
  min-height: 32px;
  border-radius: 8px;
  background: transparent;
  border-color: var(--md-sys-color-outline);
  font-size: 12px;
  font-weight: 500;
}
html[data-theme="material"] .md-chip--filter.is-selected {
  background: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary-container);
  box-shadow: none;
  color: #21005d;
}

html[data-theme="apple"] :focus-visible,
html[data-theme="material"] :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
html[data-theme="apple"] .theme-menu,
html[data-theme="material"] .theme-menu {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: var(--md-sys-elevation-2);
}
html[data-theme="apple"] .theme-menu-heading,
html[data-theme="material"] .theme-menu-heading { color: var(--text-meta); }

@media (prefers-color-scheme: dark) {
  html[data-theme="apple"] {
    color-scheme: dark;
    --md-sys-color-surface: #171719;
    --md-sys-color-surface-container: rgba(28, 28, 30, .82);
    --md-sys-color-surface-container-high: #2c2c2e;
    --md-sys-color-surface-container-highest: #3a3a3c;
    --md-sys-color-on-surface: #f5f5f7;
    --md-sys-color-on-surface-variant: #98989d;
    --md-sys-color-primary: #e5e5e7;
    --md-sys-color-on-primary: #242426;
    --md-sys-color-primary-container: #454548;
    --md-sys-color-outline: rgba(84, 84, 88, .65);
    --md-sys-color-outline-variant: rgba(84, 84, 88, .45);
    --md-sys-color-up: #30d158;
    --md-sys-color-down: #ff453a;
  }
  html[data-theme="apple"] .nav-rail,
  html[data-theme="apple"] .top-app-bar { background: rgba(0, 0, 0, .76); }
  html[data-theme="apple"] .md-card,
  html[data-theme="apple"] .cluster-card,
  html[data-theme="apple"] .md-chart,
  html[data-theme="apple"] .stance,
  html[data-theme="apple"] .stance-history-panel,
  html[data-theme="apple"] .price-bar,
  html[data-theme="apple"] .article-grid > * { background: rgba(28, 28, 30, .88); }
  html[data-theme="apple"] .cluster-card:hover { background: #2c2c2e; }

  html[data-theme="material"] {
    color-scheme: dark;
    --md-sys-color-surface: #141218;
    --md-sys-color-surface-container: #211f26;
    --md-sys-color-surface-container-high: #2b2930;
    --md-sys-color-surface-container-highest: #36343b;
    --md-sys-color-on-surface: #e6e0e9;
    --md-sys-color-on-surface-variant: #cac4d0;
    --md-sys-color-primary: #d0bcff;
    --md-sys-color-on-primary: #381e72;
    --md-sys-color-primary-container: #4f378b;
    --md-sys-color-outline: #938f99;
    --md-sys-color-outline-variant: #49454f;
    --md-sys-color-up: #72dd9b;
    --md-sys-color-down: #ffb4ab;
  }
  html[data-theme="material"] .top-app-bar { background: var(--md-sys-color-surface); }
  html[data-theme="material"] .nav-rail-btn.is-active,
  html[data-theme="material"] .md-btn--tonal.is-active,
  html[data-theme="material"] .md-btn--tonal:hover,
  html[data-theme="material"] .md-btn--icon:hover:not(:disabled),
  html[data-theme="material"] .stance-history-icon-btn:hover,
  html[data-theme="material"] .md-chip--filter.is-selected { color: #e9ddff; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="apple"] *,
  html[data-theme="material"] * { transition-duration: .01ms !important; }
}

/* Shared coverage for components that predate the system theme tokens. */
html:is([data-theme="apple"], [data-theme="material"]) {
  --md-surface-container: var(--panel);
  --md-on-surface: var(--text);
  --md-on-surface-variant: var(--text-meta);
  --md-outline: var(--border);
  --md-primary: var(--accent);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(body, .pm-app) {
  font-family: var(--font-sans);
  font-size: var(--design-body-size);
  line-height: 1.5;
}
html:is([data-theme="apple"], [data-theme="material"]) :is(button, input, select, textarea, summary, .pm-back) {
  font-family: var(--font-sans);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(h1, h2, h3, .brand, .cluster-name, .pm-header h1, .pm-detail-head h2) {
  font-family: var(--font-sans);
  font-weight: var(--design-heading-weight);
  line-height: 1.25;
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.md-card, .cluster-card, .account-shell, .account-plan, .pm-browser, .pm-detail, .country-panel, .mindmap, .chart-folder) {
  border-radius: var(--design-card-radius);
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
  padding: var(--design-card-padding);
  box-shadow: var(--md-sys-elevation-1);
}
html:is([data-theme="apple"], [data-theme="material"]) .pm-browser { padding: 0; }
html:is([data-theme="apple"], [data-theme="material"]) :is(.stance, .stance-history-panel, .price-bar, .md-chart, .article-grid > *, .country-card, .related-item, .cluster-market-signals, .cluster-market-signal, .tank-art-card, .tank-side, .pm-outcome, .pm-info, .pm-warning) {
  border-radius: var(--design-inset-radius);
  background: var(--panel-2);
  border-color: var(--border);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.md-btn, .account-primary, .account-secondary, .account-actions button, .cluster-expand, .article-category-tab, .tank-back, .tank-pill, .tank-side-chip, .btn-open-map, .stance-toggle-history, .pm-secondary, .day-item) {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--design-control-radius);
  font-size: 14px;
  font-weight: var(--design-control-weight);
  line-height: 20px;
  color: var(--accent);
  background: var(--panel-2);
  border: 1px solid transparent;
  transition: background var(--design-motion), box-shadow var(--design-motion), color var(--design-motion);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.account-primary, .account-actions .account-primary) {
  background: var(--accent);
  color: var(--md-sys-color-on-primary);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.md-btn--icon, .stance-history-icon-btn, .burger-btn) {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--design-control-radius);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--design-inset-radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
  line-height: 24px;
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.md-chip, .art-co-bubble, .country-pill, .account-plan-badge, .pm-feed-prices span) {
  border-radius: var(--design-chip-radius);
  font-family: var(--font-sans);
  font-weight: var(--design-control-weight);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.cluster-score, .article-rating, .cluster-news-rating, .stance-stat) {
  border-radius: var(--design-inset-radius);
  background: var(--panel-2);
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.cluster-score-value, .cluster-score-label, .cluster-news-ratings-label, .cluster-news-rating, .cluster-news-rating-more, .article-rating, .price-value, .signal-num) {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}
html:is([data-theme="apple"], [data-theme="material"]) .cluster-score-value { font-size: 26px; font-weight: 600; }
html:is([data-theme="apple"], [data-theme="material"]) .cluster-name { font-size: 22px; }
html:is([data-theme="apple"], [data-theme="material"]) .cluster-reason { font-size: var(--design-body-size); line-height: 1.55; }
html:is([data-theme="apple"], [data-theme="material"]) .account-shell { padding: 32px; }
html:is([data-theme="apple"], [data-theme="material"]) .account-shell h1 { font-size: 28px; }
html:is([data-theme="apple"], [data-theme="material"]) :is(.account-form label, .account-plan-note, .account-plan p) { color: var(--text-meta); font-size: 14px; }
html:is([data-theme="apple"], [data-theme="material"]) :is(.account-eyebrow, .events-sort-label, .pm-eyebrow) { font-family: var(--font-sans); letter-spacing: .04em; font-weight: 600; }
html:is([data-theme="apple"], [data-theme="material"]) :is(.publish-console, .publish-model-reply, .publish-source-list) { font-family: var(--font-mono); background: var(--bg); color: var(--text); border-radius: var(--design-inset-radius); }
html:is([data-theme="apple"], [data-theme="material"]) .theme-menu button { min-height: 44px; border-radius: var(--design-control-radius); }
html:is([data-theme="apple"], [data-theme="material"]) .theme-menu button.is-active { outline-color: var(--accent); }
html:is([data-theme="apple"], [data-theme="material"]) :is(.article-category-tab.is-active, .tank-pill.is-on) { background: var(--md-sys-color-primary-container); color: var(--accent); }
html:is([data-theme="apple"], [data-theme="material"]) .chart-folder {
  padding: 12px;
}
html:is([data-theme="apple"], [data-theme="material"]) .chart-folder-tabs {
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px;
  border: 0;
  background: transparent;
}
html:is([data-theme="apple"], [data-theme="material"]) .chart-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--design-control-radius);
  background: transparent;
  color: var(--text-meta);
  font-size: 12px;
  font-weight: var(--design-control-weight);
  line-height: 20px;
}
html:is([data-theme="apple"], [data-theme="material"]) .chart-tab:hover {
  background: var(--panel-2);
  color: var(--text);
}
html:is([data-theme="apple"], [data-theme="material"]) .chart-tab.is-active {
  background: var(--md-sys-color-primary-container);
  color: var(--accent);
}
@media (pointer: coarse) {
  html:is([data-theme="apple"], [data-theme="material"]) .chart-tab { min-height: 44px; }
}
html:is([data-theme="apple"], [data-theme="material"]) :is(.md-btn, .account-primary, .account-secondary, .account-actions button, .cluster-expand, .pm-secondary):hover:not(:disabled) { filter: brightness(.96); box-shadow: var(--md-sys-elevation-1); }

html[data-theme="apple"] .events-list { gap: 16px; }
html[data-theme="apple"] .account-shell { border-radius: 24px; }
html[data-theme="apple"] .brand { font-weight: 700; letter-spacing: -.035em; }
html[data-theme="apple"] .account-shell h1 { letter-spacing: -.025em; }
html[data-theme="apple"] .events-sort-segmented { padding: 3px; gap: 2px; border-radius: 12px; background: var(--panel-2); }
html[data-theme="apple"] .events-sort-segmented .md-btn { min-height: 36px; background: transparent; box-shadow: none; color: var(--text-meta); }
html[data-theme="apple"] .events-sort-segmented .md-btn.is-active { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .16); }
html[data-theme="apple"] .pm-ranges { border-radius: 10px; }
html[data-theme="apple"] .pm-ranges button { min-height: 36px; border-radius: 7px; font-size: 12px; }
html[data-theme="apple"] .md-chip { min-height: 32px; }

html[data-theme="material"] .events-list { gap: 24px; }
html[data-theme="material"] .account-shell { border-radius: 28px; }
html[data-theme="material"] .account-shell h1 { font-size: 32px; letter-spacing: 0; }
html[data-theme="material"] .cluster-name { font-size: 24px; letter-spacing: 0; }
html[data-theme="material"] .nav-rail-btn { border-radius: 28px; }
html[data-theme="material"] .nav-rail-label { font-size: 12px; letter-spacing: .01em; }
html[data-theme="material"] :is(.account-form input, .pm-filters input, .pm-filters select, .md-select):not([type="checkbox"]) { min-height: 56px; border-radius: 4px 4px 0 0; border-width: 0 0 1px; background: var(--panel-2); }
html[data-theme="material"] .account-secondary { border-color: var(--border); background: transparent; }
html[data-theme="material"] .events-sort-segmented { gap: 0; }
html[data-theme="material"] .events-sort-segmented .md-btn { border-radius: 0; border: 1px solid var(--border); background: transparent; color: var(--text); }
html[data-theme="material"] .events-sort-segmented .md-btn:first-child { border-radius: 24px 0 0 24px; }
html[data-theme="material"] .events-sort-segmented .md-btn:last-child { border-radius: 0 24px 24px 0; }
html[data-theme="material"] .events-sort-segmented .md-btn + .md-btn { margin-left: -1px; }
html[data-theme="material"] .events-sort-segmented .md-btn.is-active { background: var(--md-sys-color-primary-container); }
html[data-theme="material"] .pm-ranges { border-radius: 999px; }
html[data-theme="material"] .pm-ranges button { min-height: 40px; border-radius: 999px; font-size: 12px; }

@media (max-width: 620px) {
  html:is([data-theme="apple"], [data-theme="material"]) .account-shell { padding: 24px 18px; }
  html:is([data-theme="apple"], [data-theme="material"]) .cluster-card { padding: 16px; }
  html[data-theme="material"] .events-sort-segmented { flex-wrap: nowrap; }
}

/* Liquid Glass belongs to the floating navigation and control layer. */
html[data-theme="apple"] {
  --design-control-radius: 999px;
  --glass-fill: rgba(255, 255, 255, .64);
  --glass-card: rgba(255, 255, 255, .1);
  --glass-sheen: linear-gradient(145deg, rgba(255, 255, 255, .07), transparent 65%);
  --glass-inset: rgba(255, 255, 255, .04);
  --glass-edge: rgba(255, 255, 255, .9);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(255, 255, 255, .3), 0 6px 24px rgba(30, 50, 80, .09);
  --md-sys-color-surface-container-high: rgba(255, 255, 255, .78);
}
html[data-theme="apple"] body {
  background-image: radial-gradient(ellipse at 10% 0%, rgba(180, 178, 174, .24), transparent 55%), radial-gradient(ellipse at 95% 35%, rgba(150, 150, 154, .16), transparent 50%);
  background-attachment: fixed;
}
html[data-theme="apple"] :is(.md-card, .cluster-card, .account-shell, .admin-monitor-panel, .pm-browser, .pm-detail, .movers-strip, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .country-panel, .mindmap, .chart-folder, .dash-metric, .dash-panel, .atlas-stats span, .atlas-matrix, .atlas-detail, .stocks-cluster, .stocks-browser) {
  background: var(--glass-sheen), var(--glass-card);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="apple"] :is(.md-chart, .stance, .stance-history-panel, .price-bar, .article-grid > *, .account-plan, .publish-console, .publish-model-reply, .country-card, .tank-art-card, .tank-side, .dash-trend-readout, .atlas-detail-panel, .atlas-detail-score, .stocks-tile, .stocks-search-tools) {
  background: var(--glass-inset);
}
html[data-theme="apple"] .cluster-card,
html[data-theme="apple"] .cluster-card:hover { background: var(--glass-sheen), color-mix(in srgb, var(--glass-card) 70%, transparent); }
html[data-theme="apple"] .article-grid > * { background: color-mix(in srgb, var(--glass-inset) 70%, transparent); }
html[data-theme="apple"] :is(.nav-rail, .top-app-bar, .mobile-topbar, .theme-menu, .events-sort-segmented, .publish-nav) {
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
html[data-theme="apple"] .nav-rail {
  top: 12px;
  bottom: 12px;
  left: 8px;
  width: calc(var(--md-sys-rail-width) - 8px);
  border-radius: 28px;
}
html[data-theme="apple"] .top-app-bar {
  top: 12px;
  margin: 12px 0 24px;
  padding: 12px 20px;
  border-radius: 24px;
}
html[data-theme="apple"] .publish-nav { padding: 4px; border-radius: 999px; }
html[data-theme="apple"] :is(.md-btn--icon, .stance-history-icon-btn, .cluster-expand, .account-secondary, .pm-secondary) {
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}
html[data-theme="apple"] .nav-rail-btn { width: 56px; border-radius: 22px; }
html[data-theme="apple"] button.cluster-expand {
  min-height: 32px;
  padding: 6px 8px;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--text-meta);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
}
html[data-theme="apple"] button.cluster-expand:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
  box-shadow: none;
  filter: none;
}
@media (pointer: coarse) {
  html[data-theme="apple"] button.cluster-expand { min-height: 44px; }
}
html[data-theme="apple"] .nav-rail-btn.is-active {
  background: color-mix(in srgb, var(--accent) 16%, var(--glass-fill));
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="apple"] {
    --glass-fill: rgba(28, 28, 30, .76);
    --glass-card: rgba(28, 28, 30, .48);
    --glass-sheen: linear-gradient(145deg, rgba(255, 255, 255, .04), transparent 65%);
    --glass-inset: rgba(20, 20, 22, .24);
    --glass-edge: rgba(255, 255, 255, .16);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(255, 255, 255, .04), 0 8px 24px rgba(0, 0, 0, .24);
    --md-sys-color-surface-container-high: rgba(44, 44, 46, .78);
  }
}
html[data-theme="apple"][data-color-mode="light"] {
  color-scheme: light;
  --md-sys-color-surface: #f2f2f7;
  --md-sys-color-surface-container: rgba(255, 255, 255, .78);
  --md-sys-color-surface-container-high: rgba(255, 255, 255, .78);
  --md-sys-color-surface-container-highest: #e5e5ea;
  --md-sys-color-on-surface: #1c1c1e;
  --md-sys-color-on-surface-variant: #6e6e73;
  --md-sys-color-primary: #48484c;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #dedee2;
  --md-sys-color-outline: rgba(60, 60, 67, .18);
  --md-sys-color-outline-variant: rgba(60, 60, 67, .29);
  --md-sys-color-up: #16824a;
  --md-sys-color-down: #d70015;
  --glass-fill: rgba(255, 255, 255, .64);
  --glass-card: rgba(255, 255, 255, .1);
  --glass-sheen: linear-gradient(145deg, rgba(255, 255, 255, .07), transparent 65%);
  --glass-inset: rgba(255, 255, 255, .04);
  --glass-edge: rgba(255, 255, 255, .9);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(255, 255, 255, .3), 0 6px 24px rgba(30, 50, 80, .09);
}
html[data-theme="material"][data-color-mode="light"] {
  color-scheme: light;
  --md-sys-color-surface: #fef7ff;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-container-highest: #e6e0e9;
  --md-sys-color-on-surface: #1d1b20;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e9ddff;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  --md-sys-color-up: #176b3a;
  --md-sys-color-down: #ba1a1a;
}
html[data-theme="material"][data-color-mode="light"] :is(.nav-rail-btn.is-active, .md-btn--tonal.is-active, .md-btn--tonal:hover, .md-btn--icon:hover:not(:disabled), .stance-history-icon-btn:hover, .md-chip--filter.is-selected) { color: #21005d; }
@media (max-width: 768px) {
  html[data-theme="apple"] .top-app-bar { top: 64px; padding: 12px; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  html[data-theme="apple"] { --glass-fill: var(--md-sys-color-surface-container-highest); --glass-card: var(--md-sys-color-surface-container-highest); --glass-inset: var(--md-sys-color-surface-container-highest); --glass-edge: var(--text-meta); }
  html[data-theme="apple"][data-color-mode="light"] { --glass-fill: var(--md-sys-color-surface-container-highest); --glass-card: var(--md-sys-color-surface-container-highest); --glass-inset: var(--md-sys-color-surface-container-highest); --glass-edge: var(--text-meta); }
  html[data-theme="apple"] :is(.md-card, .cluster-card, .account-shell, .pm-browser, .pm-detail, .movers-strip, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .country-panel, .mindmap, .chart-folder, .dash-metric, .dash-panel, .atlas-stats span, .atlas-matrix, .atlas-detail, .stocks-cluster, .stocks-browser, .md-chart, .stance, .stance-history-panel, .price-bar, .article-grid > *, .account-plan, .country-card, .tank-art-card, .tank-side, .dash-trend-readout, .atlas-detail-panel, .atlas-detail-score, .stocks-tile, .stocks-search-tools, .nav-rail, .top-app-bar, .mobile-topbar, .theme-menu, .events-sort-segmented, .publish-nav, .md-btn--icon, .stance-history-icon-btn, .cluster-expand, .account-secondary, .pm-secondary) {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  html[data-theme="apple"] :is(.cluster-card, .cluster-card:hover) { background: var(--glass-card); }
  html[data-theme="apple"] .article-grid > * { background: var(--glass-inset); }
}

/* Card structure: compact overview, balanced analysis, one stock/chart workspace. */
.events-list { width: 100%; }
.cluster-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; margin-bottom: 16px; }
.cluster-name { font-size: 20px; }
.cluster-reason { line-height: 1.6; }
.cluster-context { min-width: 0; font-size: 13px; color: var(--text-meta); }
.cluster-context h3 { margin: 0 0 10px; color: var(--text); font-size: 13px; font-weight: 600; }
.cluster-drivers { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.cluster-card.is-expanded .cluster-context { display: block; }
.cluster-layout:has(.stance-aside.is-open) .cluster-stance-preview { display: none; }
.cluster-layout:has(.stance-aside.is-open) .cluster-overview { display: block; }
.cluster-context .cluster-market-signals { margin-top: 14px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.cluster-card.is-expanded .cluster-overview { display: block; }
.cluster-card.is-expanded .cluster-summary { max-width: none; }
.cluster-card.is-expanded .cluster-reason { margin-bottom: 14px; }
.cluster-card.is-expanded .cluster-context { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.cluster-card.is-expanded .cluster-drivers { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.cluster-details { margin-top: 18px; padding-top: 16px; }
.stock-panel { margin: 0 0 14px; }
.stock-group-context { margin: 10px 0 12px; color: var(--text-meta); font-size: 13px; line-height: 1.5; }
.stock-panel-head { display: grid; grid-template-columns: auto minmax(0, 240px) minmax(0, 1fr); gap: 12px; }
.stock-panel-head .md-label { margin: 0; }
.stock-panel-head .stock-group-select { width: 100%; min-width: 0; }
.group-since-publish { margin-left: 0; white-space: normal; font-size: 11px; }
.stock-analysis { display: flex; flex-direction: column; gap: 14px; }
.stock-analysis > * { min-width: 0; }
.stock-analysis > .stock-sidebar, .stock-analysis > .chart-folder { width: 100%; }
.stock-sidebar { container-type: inline-size; }
.stock-sidebar .related-under-chart:has(.related-empty) { display: none; }
.stock-sidebar .related-under-chart:not(:empty) { margin-top: 12px; }
.stock-sidebar .price-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px; }
.stock-sidebar .price-bar-title { grid-column: 1 / -1; margin: 0; }
.stock-sidebar .price-bar-grid, .stock-sidebar .technical-metrics { display: contents; }
.stock-sidebar .price-cell, .stock-sidebar .technical-metrics > div { display: grid; grid-template-rows: 32px 22px 16px; gap: 2px; min-width: 0; align-content: start; }
.stock-sidebar .price-label, .stock-sidebar .technical-metrics span { line-height: 16px; }
.stock-sidebar .price-value, .stock-sidebar .technical-metrics strong { font-size: 15px; line-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-sidebar .technical-metrics-note, .stock-sidebar .quote-asof { grid-column: 1 / -1; margin: 0; }
.stock-analysis .price-bar, .stock-analysis .chart-folder { margin: 0; }
html[data-theme] button.md-btn.toggle-articles {
  margin: 12px 0 6px;
  background: #fff;
  color: #171717;
  border: 1px solid #d0d0d0;
}
html[data-theme] button.md-btn.toggle-articles:is(:hover, :focus-visible, :active) {
  background: #eee;
  color: #171717;
  border-color: #b5b5b5;
}
.price-bar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.technical-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.technical-metrics span, .technical-metrics-note, .quote-asof { color: var(--text-meta); font-size: 11px; }
.quote-asof { margin-top: 8px; }
.history-data-note { color: var(--text-meta); font-size: 11px; margin: 4px 0 10px; }
.technical-metrics strong { overflow-wrap: anywhere; }
.price-bar-mount:empty { display: none; }
/* Reuse the Trends sparkline in collapsed desktop News cards. */
.cluster-trend { max-width:440px;margin-inline:auto;color:var(--text-meta); }
.cluster-trend-head,.cluster-trend-dates { display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:11px; }
.cluster-trend-head strong { font-size:11px;font-weight:500;font-variant-numeric:tabular-nums; }
.cluster-trend .simple-line { width:100%;height:auto;min-height:0;max-height:none;margin:4px 0; }
.cluster-trend-dates,.cluster-trend-empty { font-size:10px;color:var(--text-meta); }
.weekly-velocity { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 11px; color: var(--text-meta); }
.weekly-velocity strong { color: var(--text); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.weekly-velocity--up strong { color: var(--up); }
.weekly-velocity--down strong { color: var(--down); }
@container (min-width: 640px) {
  .stock-sidebar .price-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (min-width: 1200px) {
  .stock-sidebar .price-bar { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .stock-panel-head { grid-template-columns: auto minmax(0, 1fr); }
  .stock-panel-head .group-since-publish { grid-column: 1 / -1; }
  .technical-metrics { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
@media (max-width: 768px) {
  .cluster-top { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .cluster-top .stance-mount { grid-column: 1 / -1; max-width: none; }
  .cluster-top .stance-wrap { justify-content: flex-start; }
  .cluster-card.is-expanded .cluster-overview { grid-template-columns: 1fr; gap: 18px; }
  .cluster-card.is-expanded .cluster-drivers { grid-template-columns: 1fr; }
  .stock-panel-head { grid-template-columns: minmax(0, 1fr) auto; }
  .stock-panel-head .md-label { grid-column: 1 / -1; }
  .group-since-publish { margin-left: 0; flex-basis: 100%; }
}

/* Phone layout takes precedence over desktop theme dimensions. */
@media (max-width: 768px) {
  html[data-theme] .main { margin-left: 0; width: 100%; padding: 0 12px calc(24px + env(safe-area-inset-bottom)); }
  html[data-theme] .mobile-topbar { min-height: 64px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 10px; }
  html[data-theme] .nav-rail { top: 0; bottom: 0; left: 0; width: min(300px, 86vw); padding: calc(16px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)); border-radius: 0 24px 24px 0; align-items: stretch; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  html[data-theme] body.nav-open { overflow: hidden; }
  html[data-theme] body.nav-open .nav-rail { transform: translateX(0); visibility: visible; transition-delay: 0s; }
  html[data-theme] .mobile-nav-close { position: absolute; display: inline-flex; align-items: center; justify-content: center; right: 12px; top: calc(12px + env(safe-area-inset-top)); }
  html[data-theme] .nav-rail-brand { align-self: flex-start; padding: 8px 12px; margin-bottom: 16px; }
  html[data-theme] .nav-rail-list { align-items: stretch; gap: 6px; overflow-y: auto; min-height: 0; }
  html[data-theme] .nav-rail-btn { width: 100%; min-height: 48px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 14px; }
  html[data-theme] .nav-rail-btn svg { flex: 0 0 24px; }
  html[data-theme] .nav-rail-label { font-size: 14px; }
  html[data-theme] .nav-rail-footer { align-items: stretch; padding: 8px 0 0; }
  html[data-theme] .nav-rail-footer .theme-menu { left: 0; right: 0; bottom: 60px; max-height: min(55dvh, 420px); }
  html[data-theme] .top-app-bar { position: static; min-height: 0; margin: 8px 0 16px; padding: 6px; border-radius: 18px; }
  html[data-theme] .top-app-bar-text { display: none; }
  html[data-theme] .publish-nav { width: 100%; max-width: none; min-width: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  html[data-theme] .meta { font-size: 12px; line-height: 1.4; }
  html[data-theme] :is(.md-btn--icon, .burger-btn) { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  html[data-theme] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { min-height: 48px; max-width: 100%; padding: 10px 12px; font-size: 16px; line-height: 24px; }
  .publish-meta-desktop { display: none; }
  .publish-meta-mobile { display: grid; gap: 2px; }
  .publish-meta-mobile > :last-child { font-size: 11px; }
  html[data-theme] .events-sort-bar { display: block; margin-bottom: 12px; }
  html[data-theme] .events-sort-label { display: block; margin-bottom: 6px; font-size: 10px; }
  html[data-theme] .events-sort-segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 2px; padding: 3px; }
  html[data-theme] .events-sort-segmented .md-btn { min-width: 0; min-height: 44px; padding: 8px 3px; font-size: 12px; }
  html[data-theme] .movers-strip { margin-bottom: 12px; padding: 12px 14px; }
  html[data-theme] .movers-disclosure { min-height: 44px; }
  html[data-theme] .movers-title { font-size: 14px; }
  html[data-theme] .movers-toggles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 6px; }
  html[data-theme] .movers-toggles .md-btn { min-height: 44px; padding: 8px 6px; font-size: 12px; }
  html[data-theme] .md-chip { min-height: 44px; padding: 8px 10px; font-size: 12px; }
  html[data-theme] .events-list { gap: 12px; }
  html[data-theme] .cluster-card { padding: 14px; }
  html[data-theme] .cluster-top { gap: 10px; align-items: start; margin-bottom: 12px; }
  html[data-theme] .cluster-name { font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
  html[data-theme] .cluster-score { min-width: 60px; padding: 8px; }
  html[data-theme] .cluster-score-value { font-size: 23px; }
  html[data-theme] .stance-wrap { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: none; gap: 8px; align-items: center; }
  html[data-theme] .cluster-card.is-expanded .stance-wrap { grid-template-columns: minmax(0, 1fr); }
  html[data-theme] .stance { min-width: 0; max-width: none; padding: 8px 10px; }
  html[data-theme] .stance-history-icon-btn { width: 44px; height: 44px; margin: 0; }
  html[data-theme] .cluster-reason { font-size: 14px; line-height: 1.6; }
  html[data-theme] .cluster-reason--preview { -webkit-line-clamp: 3; }
  html[data-theme] .cluster-overview-footer { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  html[data-theme] .cluster-overview-footer .cluster-news-ratings { flex: 1 1 150px; flex-wrap: wrap; }
  html[data-theme] button.cluster-expand { width: 44px; min-width: 44px; min-height: 44px; margin-left: auto; padding: 8px; justify-content: center; }
  html[data-theme] .cluster-expand > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  html[data-theme] .cluster-details { margin-top: 12px; padding-top: 12px; }
  html[data-theme] .stock-panel-head { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  html[data-theme] .stock-panel-head > * { grid-column: 1 / -1; min-width: 0; }
  html[data-theme] .stock-panel-head .md-label { font-size: 12px; }
  html[data-theme] .stock-panel-head .btn-open-map { justify-self: start; min-height: 44px; }
  html[data-theme] .group-since-publish { font-size: 12px; line-height: 1.5; }
  html[data-theme] .stock-sidebar .price-bar { padding: 12px; gap: 12px; }
  html[data-theme] .stock-sidebar .price-cell, html[data-theme] .stock-sidebar .technical-metrics > div { grid-template-rows: 32px 22px auto; }
  html[data-theme] .price-bar-title { font-size: 14px; line-height: 1.4; }
  html[data-theme] .technical-metrics-note, html[data-theme] .quote-asof { line-height: 1.5; }
  html[data-theme] .chart-folder { padding: 8px; }
  html[data-theme] .chart-folder-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 0 0 10px; }
  html[data-theme] .chart-tab { min-width: 0; min-height: 44px; padding: 7px 3px; font-size: 12px; line-height: 16px; white-space: normal; }
  html[data-theme] .chart-folder .chart { padding: 0; }
  html[data-theme] .stance-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html[data-theme] .stance-stat { padding: 8px 3px; overflow-wrap: anywhere; }
  html[data-theme] .stance-stat-k, html[data-theme] .stance-stat-h { font-size: 10px; line-height: 1.35; }
  html[data-theme] .stance-toggle-history, html[data-theme] .toggle-articles { min-height: 44px; width: 100%; }
  html[data-theme] .related-list, html[data-theme] .article-grid { grid-template-columns: minmax(0, 1fr); }
  html[data-theme] .related-item { min-height: 44px; }
  html[data-theme] .article-grid > *, html[data-theme] .cluster-market-signal { min-width: 0; max-width: 100%; padding: 12px; }
  html[data-theme] .article-title { line-height: 1.4; overflow-wrap: anywhere; }
  html[data-theme] .article-impact-window { white-space: normal; }
  html[data-theme] .article-category-tab { min-height: 44px; }
  html[data-theme] .account-page { display: block; min-height: 0; padding: 0 0 24px; }
  html[data-theme] :is(#accountView, #daysView) { padding-top: 12px; }
  html[data-theme] .account-shell { width: 100%; padding: 20px 16px; }
  html[data-theme] .account-shell h1 { font-size: 24px; margin: 8px 0 16px; }
  html[data-theme] .account-message:empty { display: none; }
  html[data-theme] .account-profile { padding: 12px 0; gap: 8px; font-size: 13px; flex-wrap: wrap; }
  html[data-theme] .account-plan { padding: 16px 12px; margin: 16px 0; }
  html[data-theme] .account-plan h2 { font-size: 20px; }
  html[data-theme] .account-actions { gap: 8px; flex-wrap: wrap; }
  html[data-theme] :is(.account-primary, .account-secondary, .account-actions button) { min-height: 44px; }
  html[data-theme] .account-plan :is(.account-primary, .account-secondary) { width: 100%; }
  html[data-theme] #accountContent > .account-secondary { width: 100%; min-height: 44px; }
  html[data-theme] .account-form input { width: 100%; min-width: 0; }
  html[data-theme] .weekly-heading h1 { font-size: 24px; }
  html[data-theme] .weekly-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  html[data-theme] .weekly-tab { min-height: 44px; padding: 8px; font-size: 13px; }
  html[data-theme] .weekly-cluster-head { padding: 12px; gap: 10px; grid-template-columns: 48px minmax(0, 1fr) 16px; }
  html[data-theme] .weekly-cluster-main h3 { font-size: 16px; overflow-wrap: anywhere; }
  html[data-theme] .weekly-cluster-history { margin: 0 8px 8px; padding: 8px; }
  html[data-theme] .weekly-cluster-entry { grid-template-columns: 40px minmax(0, 1fr); gap: 8px; }
  html[data-theme] .weekly-cluster-entry p { overflow-wrap: anywhere; }
  html[data-theme] .weekly-empty { padding: 16px; }
  html[data-theme] .day-item { align-items: start; padding: 12px; }
  html[data-theme] .day-item > :first-child { min-width: 0; overflow-wrap: anywhere; }
  html[data-theme] .day-s { flex-shrink: 0; font-size: 11px; }
  html[data-theme] .md-link, html[data-theme] .pm-feed-history { display: inline-flex; align-items: center; min-height: 44px; }
  html[data-theme] .tank-row { align-items: stretch; flex-wrap: wrap; }
  html[data-theme] .tank-row > .tank-label { flex: 1 1 100%; min-width: 0; flex-direction: column; align-items: stretch; gap: 6px; }
  html[data-theme] .tank-row :is(input, select) { width: 100%; min-width: 0; }
  html[data-theme] .tank-search { flex: 1 1 100%; min-width: 0; }
  html[data-theme] #mindView, html[data-theme] #mindView .mindmap, html[data-theme] #mindView .mindmap-host { height: auto; max-height: none; overflow: visible; }
  html[data-theme] #mindView .mindmap { padding: 0; }
  html[data-theme] .tank-body { flex-direction: column; height: auto; max-height: none; overflow: visible; }
  html[data-theme] .tank-body .mindmap-canvas { flex: 0 0 320px; height: 320px !important; max-height: none; }
  html[data-theme] .tank-side { width: 100%; flex: 0 0 auto; height: auto; max-height: none; overflow: visible; border-left: 0; border-top: 1px solid var(--border); padding: 12px; }
  html[data-theme] .tank-back, html[data-theme] .tank-pill, html[data-theme] .tank-side-chip { min-height: 44px; }
  html[data-theme] .tank-art-title { display: flex; align-items: center; min-height: 44px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme] .nav-rail { transition: none; }
}

@media (min-width: 769px) {
  html[data-theme] { --md-sys-rail-width: 136px; }
  html[data-theme] .nav-rail { top: 0; bottom: 0; left: 0; width: var(--md-sys-rail-width); padding: 8px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  html[data-theme] .nav-rail-brand { display: flex; width: calc(100% - 8px); gap: 8px; margin: 0 4px 8px; color: var(--text); }
  html[data-theme] .nav-rail-logo { width: 56px; height: 56px; flex: 0 0 56px; }
  html[data-theme] .nav-rail-wordmark { font-size: 22px; }
  html[data-theme] .nav-rail-list { gap: 2px; }
  html[data-theme] .nav-rail-btn { width: calc(100% - 16px); min-height: 44px; padding: 0 12px; flex-direction: row; justify-content: flex-start; gap: 12px; border-radius: 12px; }
  html[data-theme] .nav-rail-btn svg { flex: 0 0 24px; }
  html[data-theme] .nav-rail-label { font-size: 12px; }
  html[data-theme] .page-brand-bar .brand { display: none; }
  html[data-theme] .page-brand-bar:has(.pro-badge[hidden]) { display: none; }
  html[data-theme] .main:has(> #eventsView:not(.hidden)) .page-brand-bar { display: none; }
  html[data-theme] .events-sort-bar { min-height: 48px; }
  html[data-theme] .events-pro-badge:not([hidden]) { display: inline-flex; margin-left: auto; }
  html[data-theme] .main { padding-top: 20px; padding-bottom: 96px; }
  html[data-theme] .top-app-bar { position: fixed; top: auto; bottom: 20px; right: 24px; width: auto; max-width: calc(100vw - var(--md-sys-rail-width) - 48px); min-height: 0; margin: 0; padding: 8px 12px; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 8px 32px rgba(0, 0, 0, .2); }
  html[data-theme] .top-app-bar .publish-nav { width: 280px; max-width: none; min-width: 0; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  html[data-theme] .top-app-bar .meta { font-size: 11px; line-height: 1.4; }
  html[data-theme] .top-app-bar .publish-meta-desktop { display: none; }
  html[data-theme] .top-app-bar .publish-meta-mobile { display: grid; gap: 2px; }
}
@media (max-width: 768px) {
  html[data-theme] .main { padding-top: 12px; padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  html[data-theme] { touch-action: pan-x pan-y; }
  html[data-theme] .top-app-bar { position: fixed; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; margin: 0; padding: 6px 8px; display: flex; flex-direction: row; align-items: center; gap: 6px; border-radius: 999px; }
  html[data-theme] .top-app-bar .burger-btn { display: inline-flex; flex: 0 0 84px; width: 84px; min-width: 84px; height: 48px; padding: 0 10px; gap: 7px; border: 1px solid var(--accent); background: var(--accent); color: var(--md-sys-color-on-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
  html[data-theme] .top-app-bar .burger-label { font-size: 12px; font-weight: 800; line-height: 1; }
  html[data-theme] .top-app-bar .publish-nav { flex: 1 1 auto; width: auto; }
  html[data-theme] .publish-nav:has(.meta:empty) { display: none; }
  html[data-theme] .page-brand-bar { margin: 0 0 12px; padding: env(safe-area-inset-top) 4px 0; background: transparent; }
  html[data-theme] .page-brand-bar .app-brand-row { flex-wrap: nowrap; }
  html[data-theme] .events-sort-trigger { display: inline-flex; flex: 0 0 44px; background: transparent; border-color: transparent; box-shadow: none; }
  html[data-theme] .events-sort-trigger[aria-expanded="true"] { background: var(--panel-2); }
  html[data-theme] .main:not(:has(> #eventsView:not(.hidden))) .events-sort-trigger { display: none; }
  html[data-theme] .events-sort-bar { height: 0; margin: 0; }
  html[data-theme] .events-sort-label { display: none; }
  html[data-theme] .events-sort-segmented { display: none; }
  html[data-theme] .events-sort-segmented.is-open { position: fixed; bottom: calc(82px + env(safe-area-inset-bottom)); right: 12px; z-index: 45; display: grid; grid-template-columns: 1fr; width: min(240px, calc(100% - 24px)); padding: 6px; gap: 4px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); box-shadow: 0 8px 28px rgba(0,0,0,.24); }
  html[data-theme] .events-sort-segmented .md-btn { border-radius: 10px; margin: 0; text-align: left; justify-content: flex-start; padding: 10px 12px; }
  html[data-theme] .movers-strip { padding: 6px 12px; }
}
html[data-theme] .top-app-bar .publish-meta-mobile { display: block; white-space: nowrap; }
html[data-theme] .top-app-bar .meta { overflow: hidden; text-overflow: ellipsis; }
html[data-theme] .top-app-bar .publish-meta-mobile > :last-child { display: none; }
html[data-theme] .md-btn--icon { padding: 0; }
.md-btn--icon > svg { flex-shrink: 0; }
@media (max-width: 768px) {
  html[data-theme] .top-app-bar { transition: transform .2s ease, opacity .2s ease, visibility 0s; }
  html[data-theme] .top-app-bar.is-scroll-hidden { transform: translateY(calc(100% + 24px + env(safe-area-inset-bottom))); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .2s ease, opacity .2s ease, visibility 0s .2s; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme] .top-app-bar { transition: none; }
}

[data-theme="grassy-hill"] {
  color-scheme: light;
  --md-sys-color-surface: #dceefa;
  --md-sys-color-surface-container: rgba(255, 255, 255, .9);
  --md-sys-color-surface-container-high: rgba(236, 246, 255, .94);
  --md-sys-color-surface-container-highest: #d6e9fa;
  --md-sys-color-on-surface: #193955;
  --md-sys-color-on-surface-variant: #4a6580;
  --md-sys-color-primary: #2459ad;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-primary-container: #d2e4ff;
  --md-sys-color-outline: rgba(33, 82, 142, .34);
  --md-sys-color-outline-variant: #8baed3;
  --md-sys-color-up: #177a3f;
  --md-sys-color-down: #bd3440;
  --font-sans: Tahoma, Verdana, sans-serif;
}
[data-theme="aqua-classic"] {
  color-scheme: light;
  --md-sys-color-surface: #dceaf3;
  --md-sys-color-surface-container: rgba(248, 251, 254, .88);
  --md-sys-color-surface-container-high: rgba(226, 237, 247, .92);
  --md-sys-color-surface-container-highest: #d1e2f1;
  --md-sys-color-on-surface: #173149;
  --md-sys-color-on-surface-variant: #536a7e;
  --md-sys-color-primary: #1476b9;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-primary-container: #c8e8f9;
  --md-sys-color-outline: rgba(48, 98, 137, .34);
  --md-sys-color-outline-variant: #a3c5da;
  --md-sys-color-up: #13795b;
  --md-sys-color-down: #b33b55;
  --font-sans: "Lucida Grande", "Trebuchet MS", system-ui, sans-serif;
}
[data-theme="aurora-glass"] {
  color-scheme: light;
  --md-sys-color-surface: #dce8f4;
  --md-sys-color-surface-container: rgba(250, 253, 255, .94);
  --md-sys-color-surface-container-high: #e7f1fa;
  --md-sys-color-surface-container-highest: #d6e6f4;
  --md-sys-color-on-surface: #182b40;
  --md-sys-color-on-surface-variant: #4b6177;
  --md-sys-color-primary: #185a9c;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-primary-container: #c8e2fa;
  --md-sys-color-outline: #6d8cac;
  --md-sys-color-outline-variant: #b7cfe4;
  --md-sys-color-up: #23734b;
  --md-sys-color-down: #b83b4b;
  --font-sans: "Segoe UI", system-ui, sans-serif;
}
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"]) body {
  background: var(--bg) center / cover fixed no-repeat;
}
html[data-theme="grassy-hill"][data-wallpaper="on"] body { background-image: url("wallpapers/grassy-hill.png"); }
html[data-theme="aqua-classic"][data-wallpaper="on"] body { background-image: url("wallpapers/aqua-classic.png"); }
html[data-theme="aurora-glass"][data-wallpaper="on"] body { background-image: linear-gradient(rgba(220, 232, 244, .42), rgba(220, 232, 244, .42)), url("wallpapers/aurora-glass.png"); }
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"]) .app-halos { display: none; }
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"]) :is(.md-card, .cluster-card, .dash-panel, .dash-metric, .stocks-cluster, .stocks-browser, .atlas-matrix, .atlas-detail, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .pm-browser, .pm-detail, .account-shell, .country-panel) {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(8, 37, 71, .16), inset 0 1px 0 rgba(255, 255, 255, .35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"]) :is(.nav-rail, .top-app-bar, .mobile-topbar, .theme-menu) {
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(8, 37, 71, .2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
html[data-theme="grassy-hill"] :is(.nav-rail, .mobile-topbar) { background: linear-gradient(180deg, rgba(43, 100, 207, .96), rgba(18, 58, 153, .94)); }
html[data-theme="grassy-hill"] :is(.nav-rail-brand, .nav-rail-btn) { color: #eff6ff; }
html[data-theme="grassy-hill"] .nav-rail-btn.is-active { color: #fff; background: linear-gradient(#81bd52, #3d8528); border: 1px solid #c6dc87; box-shadow: inset 0 1px rgba(255, 255, 255, .55), 0 2px 5px rgba(0, 20, 70, .24); }
html[data-theme="grassy-hill"] .top-app-bar { background: linear-gradient(#3f85e2, #1c56b8 55%, #174397); color: #fff; }
html[data-theme="grassy-hill"] .theme-menu { background: linear-gradient(#fff, #d7eaff); }
html[data-theme="grassy-hill"] :is(.md-btn--tonal, .md-btn--icon, .day-item) { background: linear-gradient(#fff, #d7eaff); border: 1px solid #91b9e8; border-radius: 8px; }
html[data-theme="aqua-classic"] :is(.nav-rail, .mobile-topbar) { background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .32) 0 1px, transparent 1px 3px), linear-gradient(#f6f9fc, #b8cddd); }
html[data-theme="aqua-classic"] .nav-rail-btn.is-active { color: #fff; background: linear-gradient(#74c9f2, #1876bd 55%, #0a5a9f); box-shadow: inset 0 1px rgba(255, 255, 255, .75), 0 2px 6px rgba(10, 63, 108, .25); }
html[data-theme="aqua-classic"] :is(.top-app-bar, .theme-menu) { background: linear-gradient(#f7fbff, #c5d9e8 55%, #e8f1f7); }
html[data-theme="aqua-classic"] :is(.md-btn--tonal, .md-btn--icon, .day-item) { background: linear-gradient(#fff, #c9e5f5); border: 1px solid #82b8d8; border-radius: 10px; }
html[data-theme="aurora-glass"] :is(.nav-rail, .mobile-topbar, .top-app-bar) { background: linear-gradient(145deg, rgba(55, 104, 157, .88), rgba(10, 32, 72, .9)); color: #f0f7ff; }
html[data-theme="aurora-glass"] .theme-menu { background: rgba(242, 249, 255, .96); }
html[data-theme="aurora-glass"] :is(.nav-rail-brand, .nav-rail-btn) { color: #f0f7ff; }
html[data-theme="aurora-glass"] .nav-rail-btn.is-active { color: #fff; background: linear-gradient(135deg, rgba(117, 208, 254, .48), rgba(61, 112, 214, .54)); box-shadow: inset 0 1px rgba(255, 255, 255, .4), 0 0 12px rgba(79, 177, 255, .35); }
html[data-theme="aurora-glass"] :is(.md-btn--tonal, .md-btn--icon, .day-item) { background: linear-gradient(#fff, #d2e6f8); border: 1px solid #8db5d8; border-radius: 10px; }
.theme-menu button[data-theme="grassy-hill"] { background: linear-gradient(#3080e0 48%, #57b522 49%); color: #fff; --swatch-accent: #fff; }
.theme-menu button[data-theme="aqua-classic"] { background: linear-gradient(135deg, #f0f7ff, #77c9ed); color: #173149; --swatch-accent: #1476b9; }
.theme-menu button[data-theme="aurora-glass"] { background: linear-gradient(135deg, #133f6e, #2b7dae); color: #fff; --swatch-accent: #9bdcff; }
.account-appearance { margin-top: 20px; }
.account-appearance label { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.account-appearance input { width: 20px; height: 20px; accent-color: var(--accent); }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"]) :is(.md-card, .cluster-card, .dash-panel, .dash-metric, .stocks-cluster, .stocks-browser, .atlas-matrix, .atlas-detail, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .pm-browser, .pm-detail, .account-shell, .country-panel) {
    background: var(--md-sys-color-surface-container-highest);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

[data-theme="old-school-rpg"] {
  color-scheme: light;
  --md-sys-color-surface: #c5b891;
  --md-sys-color-surface-container: #e0d4ac;
  --md-sys-color-surface-container-high: #e9ddba;
  --md-sys-color-surface-container-highest: #f1e5c5;
  --md-sys-color-on-surface: #2c2417;
  --md-sys-color-on-surface-variant: #514329;
  --md-sys-color-primary: #715615;
  --md-sys-color-on-primary: #fff2c9;
  --md-sys-color-primary-container: #d9c37c;
  --md-sys-color-outline: #695b3c;
  --md-sys-color-outline-variant: #a38d57;
  --md-sys-color-up: #326a2a;
  --md-sys-color-down: #a1362b;
  --font-sans: "Segoe UI", Verdana, sans-serif;
}
html[data-theme="old-school-rpg"] body {
  background: #c5b891;
}
html[data-theme="old-school-rpg"]:not([data-font]) :is(h1, h2, h3, .cluster-name) { font-family: Georgia, "Times New Roman", serif; }
html[data-theme="old-school-rpg"] .app-halos { display: none; }
html[data-theme="old-school-rpg"] :is(.md-card, .cluster-card, .dash-panel, .dash-metric, .stocks-cluster, .stocks-browser, .atlas-matrix, .atlas-detail, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .pm-browser, .pm-detail, .account-shell, .country-panel) {
  background: linear-gradient(145deg, #eee2bc, #d9cba2);
  border: 2px ridge #85704a;
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px rgba(255, 247, 213, .55), 0 3px 8px rgba(53, 39, 20, .22);
}
html[data-theme="old-school-rpg"] :is(.nav-rail, .mobile-topbar, .top-app-bar, .theme-menu) {
  background: linear-gradient(145deg, #eee2bc, #d9cba2);
  border-color: #a78944;
  color: var(--text);
}
html[data-theme="old-school-rpg"] .nav-rail-btn { color: var(--text); }
html[data-theme="old-school-rpg"] .nav-rail-btn.is-active { color: #fff0bd; background: #53623a; border: 1px solid #b6a25c; border-radius: 4px; }
html[data-theme="old-school-rpg"] :is(.md-btn--tonal, .md-btn--icon, .day-item) {
  background: linear-gradient(#e9d796, #c6a75b);
  border: 1px solid #7f652f;
  border-radius: 4px;
  color: #302615;
}
.theme-menu button[data-theme="old-school-rpg"] { background: linear-gradient(135deg, #444634 50%, #ddc989 50%); color: #fff0bd; --swatch-accent: #f5d36f; }
html[data-theme="pure-black"] :is(button, input, select, textarea, pre, code) { font-family: "FiraCode Nerd Font", "Fira Code", ui-monospace, monospace; }

html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"], [data-theme="old-school-rpg"]) {
  --md-surface-container: var(--panel);
  --md-on-surface: var(--text);
  --md-on-surface-variant: var(--text-meta);
  --md-outline: var(--border);
  --md-primary: var(--accent);
}
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"], [data-theme="old-school-rpg"]) :is(.account-form input, .account-publish-market select) {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"], [data-theme="old-school-rpg"]) :is(.account-primary, .account-actions .account-primary, .weekly-tab.is-active) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--md-sys-color-on-primary);
}
html:is([data-theme="grassy-hill"], [data-theme="aqua-classic"], [data-theme="aurora-glass"], [data-theme="old-school-rpg"]) :is(.account-secondary, .account-actions button:not(.account-primary)) {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="material"][data-color-mode="light"] .account-shell { border-color: transparent; }
html[data-theme="grassy-hill"] .top-app-bar :is(.brand, .tagline) { color: #fff; }
html[data-theme="aqua-classic"] :is(.account-primary, .account-actions .account-primary) { background: linear-gradient(#8fddff, #2589c8 52%, #1566aa); border-color: #2b79b0; }
html[data-theme="aurora-glass"] :is(.md-card, .cluster-card, .dash-panel, .dash-metric, .stocks-cluster, .stocks-browser, .atlas-matrix, .atlas-detail, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .pm-browser, .pm-detail, .account-shell, .country-panel) { background: rgba(250, 253, 255, .94); }
html[data-theme="old-school-rpg"] :is(.nav-rail-brand, .brand, .mobile-brand) { color: var(--text); }

@media (prefers-color-scheme: dark) {
  .theme-menu button[data-theme="apple"] { background: linear-gradient(135deg, #303033, #171719); color: #f5f5f7; border-color: #525256; --swatch-accent: #e5e5e7; }
  .theme-menu button[data-theme="material"] { background: linear-gradient(135deg, #36343b, #141218); color: #e6e0e9; border-color: #49454f; --swatch-accent: #d0bcff; }
}
html[data-theme="pure-black"] :is(.account-shell, .weekly-tabs, .weekly-summary > div, .weekly-cluster, .weekly-trend-panel, .chart-folder-tabs, .events-sort-segmented) { background: var(--panel); border-color: var(--border); }
html[data-theme="pure-black"] :is(.account-form input, .account-publish-market select) { background: var(--panel-2); border-color: var(--border); color: var(--text); }
html[data-theme="pure-black"] :is(.account-primary, .account-actions .account-primary, .weekly-tab.is-active) { background: var(--accent); border-color: var(--accent); color: #000; }
html[data-theme] .account-theme-menu {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  max-height: none;
  margin: 14px 0 18px;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme] .account-theme-menu button { min-width: 0; min-height: 44px; }
html[data-theme] .account-theme-menu button[data-pro-theme]::after { content: "PRO"; margin-left: auto; padding: 2px 5px; border: 1px solid currentColor; border-radius: 5px; font-size: 9px; font-weight: 800; letter-spacing: .05em; }
html[data-theme] .account-theme-menu button[data-pro-theme]:disabled { opacity: .65; cursor: not-allowed; }
html[data-theme] .account-theme-menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 769px) {
  html[data-theme] .nav-rail { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  html[data-theme] :is(.nav-rail-brand, .nav-rail-btn:not(.is-active)) { color: var(--text); }
}

html[data-theme="minimal"] {
  color-scheme: light;
  --md-sys-color-surface: #fafbf9;
  --md-sys-color-surface-container: transparent;
  --md-sys-color-surface-container-high: #eff2ee;
  --md-sys-color-surface-container-highest: #e7ece7;
  --md-sys-color-on-surface: #1c2922;
  --md-sys-color-on-surface-variant: #58675d;
  --md-sys-color-primary: #246653;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-primary-container: #e1eee8;
  --md-sys-color-outline: #d8e0d9;
  --md-sys-color-outline-variant: #c7d2c9;
  --md-sys-color-up: #167a49;
  --md-sys-color-down: #b74040;
  --md-surface-container: transparent;
  --md-on-surface: var(--text);
  --md-on-surface-variant: var(--text-meta);
  --md-outline: var(--border);
  --md-primary: var(--accent);
}
.theme-menu button[data-theme="minimal"] { background: #fafbf9; color: #1c2922; border-color: #d8e0d9; --swatch-accent: #246653; }
.theme-menu button[data-theme="minimal-dark"] { background: #101514; color: #eef5f1; border-color: #394942; --swatch-accent: #7ad5b2; }
html[data-theme="minimal-dark"] {
  color-scheme: dark;
  --md-sys-color-surface: #101514;
  --md-sys-color-surface-container: transparent;
  --md-sys-color-surface-container-high: #202c27;
  --md-sys-color-surface-container-highest: #29362f;
  --md-sys-color-on-surface: #eef5f1;
  --md-sys-color-on-surface-variant: #a3b8ac;
  --md-sys-color-primary: #7ad5b2;
  --md-sys-color-on-primary: #0d251b;
  --md-sys-color-primary-container: #254137;
  --md-sys-color-outline: #394942;
  --md-sys-color-outline-variant: #506459;
  --md-sys-color-up: #83d8a0;
  --md-sys-color-down: #ef8888;
}
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) body { background: var(--bg); background-image: none; }
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) .app-halos { display: none; }
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) :is(.md-card, .cluster-card, .cluster-card:hover, .article-grid > *, .account-shell, .account-plan, .md-chart, .stance, .stance-history-panel, .price-bar, .movers-strip, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .weekly-cluster-summary, .weekly-cluster-history, .weekly-cluster-chart, .dash-metric, .dash-panel, .dash-trend-readout, .dash-market, .stocks-browser, .stocks-cluster, .stocks-search-tools, .stocks-tile, .atlas-stats span, .atlas-switch, .atlas-matrix, .atlas-detail, .atlas-detail-panel, .atlas-detail-score, .chart-folder, .chart-folder-tabs, .country-panel, .pm-browser, .pm-detail, .top-app-bar, .publish-nav, .events-sort-segmented) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) :is(.cluster-card, .weekly-cluster, .dash-panel, .stocks-cluster) { border-bottom: 1px solid var(--border); border-radius: 0; }
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) :is(.account-form input, .account-publish-market select) { background: var(--panel-2); border-color: var(--border); color: var(--text); }
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) :is(.account-primary, .account-actions .account-primary) { background: var(--accent); border-color: var(--accent); color: var(--md-sys-color-on-primary); }
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) :is(.nav-rail-btn.is-active, .weekly-tab.is-active) { background: transparent; box-shadow: none; color: var(--accent); }
html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) .weekly-tab.is-active { border-bottom: 2px solid var(--accent); border-radius: 0; }
@media (max-width: 768px) {
  html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) .nav-rail { background: var(--bg); border-right: 1px solid var(--border); }
  html:is([data-theme="minimal"], [data-theme="minimal-dark"], [data-surface-style="minimal"]) .mobile-topbar { background: var(--bg); }
}

html[data-theme="apple"][data-color-mode="dark"] {
  color-scheme: dark;
  --md-sys-color-surface: #171719;
  --md-sys-color-surface-container: rgba(28, 28, 30, .82);
  --md-sys-color-surface-container-high: rgba(44, 44, 46, .78);
  --md-sys-color-surface-container-highest: #3a3a3c;
  --md-sys-color-on-surface: #f5f5f7;
  --md-sys-color-on-surface-variant: #98989d;
  --md-sys-color-primary: #e5e5e7;
  --md-sys-color-on-primary: #242426;
  --md-sys-color-primary-container: #454548;
  --md-sys-color-outline: rgba(84, 84, 88, .65);
  --md-sys-color-outline-variant: rgba(84, 84, 88, .45);
  --md-sys-color-up: #30d158;
  --md-sys-color-down: #ff453a;
  --glass-fill: rgba(28, 28, 30, .76);
  --glass-card: rgba(28, 28, 30, .48);
  --glass-sheen: linear-gradient(145deg, rgba(255, 255, 255, .04), transparent 65%);
  --glass-inset: rgba(20, 20, 22, .24);
  --glass-edge: rgba(255, 255, 255, .16);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(255, 255, 255, .04), 0 8px 24px rgba(0, 0, 0, .24);
}
.theme-menu button[data-theme="apple"] { background: linear-gradient(135deg, #303033, #171719); color: #f5f5f7; border-color: #525256; --swatch-accent: #e5e5e7; }
html[data-theme] .appearance-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
html[data-theme] .appearance-options label { display: block; min-width: 0; color: var(--text-meta); font-size: 12px; font-weight: 600; }
html[data-theme] .appearance-options select { display: block; width: 100%; min-height: 42px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; }
html[data-theme] .appearance-options select:disabled { opacity: .55; cursor: not-allowed; }
html[data-theme] .appearance-pro-label { padding: 2px 5px; border: 1px solid currentColor; border-radius: 5px; font-size: 9px; }
@media (max-width: 520px) { html[data-theme] .appearance-options { grid-template-columns: 1fr; } }
html[data-font="sans"] { --font-sans: "Segoe UI", Arial, sans-serif; }
html[data-font="roboto"] { --font-sans: Roboto, Arial, sans-serif; }
html[data-font="verdana"] { --font-sans: Verdana, Geneva, sans-serif; }
html[data-font="serif"] { --font-sans: Georgia, "Times New Roman", serif; }
html[data-font="cambria"] { --font-sans: Cambria, Georgia, serif; }
html[data-font="mono"] { --font-sans: Consolas, "Courier New", monospace; }
html[data-font="roboto-mono"] { --font-sans: "Roboto Mono", Consolas, monospace; }
html[data-font="fira"] { --font-sans: "FiraCode Nerd Font", "Fira Code", Consolas, monospace; }
html[data-font]:not([data-font="theme"]) :is(button, input, select, textarea, summary) { font-family: var(--font-sans); }
html[data-surface-style="glass"]:not([data-theme="apple"]) {
  --glass-fill: color-mix(in srgb, var(--panel) 78%, transparent);
  --glass-card: color-mix(in srgb, var(--panel) 48%, transparent);
  --glass-inset: color-mix(in srgb, var(--panel) 24%, transparent);
  --glass-edge: color-mix(in srgb, var(--text) 16%, transparent);
  --glass-sheen: linear-gradient(145deg, color-mix(in srgb, var(--text) 4%, transparent), transparent 65%);
  --glass-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 16%, transparent), 0 8px 24px rgba(0, 0, 0, .18);
}
html[data-surface-style="glass"]:not([data-theme="apple"]) :is(.md-card, .cluster-card, .account-shell, .admin-monitor-panel, .pm-browser, .pm-detail, .movers-strip, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .country-panel, .mindmap, .chart-folder, .dash-metric, .dash-panel, .atlas-matrix, .atlas-detail, .stocks-cluster, .stocks-browser) {
  background: var(--glass-sheen), var(--glass-card);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}
html[data-surface-style="glass"]:not([data-theme="apple"]) :is(.md-chart, .stance, .stance-history-panel, .price-bar, .article-grid > *, .account-plan, .publish-console, .country-card, .dash-trend-readout, .atlas-detail-panel, .stocks-tile) {
  background: var(--glass-inset);
}
html[data-surface-style="glass"]:not([data-theme="apple"]) :is(.cluster-card, .cluster-card:hover) { background: var(--glass-sheen), var(--glass-card); }
html[data-surface-style="glass"]:not([data-theme="apple"]) :is(.nav-rail, .top-app-bar, .mobile-topbar, .theme-menu, .events-sort-segmented, .publish-nav) {
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
@media (min-width: 769px) {
  html[data-surface-style="glass"]:not([data-theme="apple"]) .nav-rail { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
html[data-surface-style="outline"] :is(.md-card, .cluster-card, .account-shell, .admin-monitor-panel, .pm-browser, .pm-detail, .movers-strip, .weekly-summary > div, .weekly-cluster, .weekly-ai-digest, .weekly-trend-panel, .country-panel, .mindmap, .chart-folder, .dash-metric, .dash-panel, .atlas-matrix, .atlas-detail, .stocks-cluster, .stocks-browser) {
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-surface-style="outline"] :is(.md-chart, .stance, .stance-history-panel, .price-bar, .article-grid > *, .account-plan, .country-card, .stocks-tile) { background: transparent; }
html[data-surface-style="outline"] :is(.cluster-card, .cluster-card:hover, .top-app-bar, .mobile-topbar, .theme-menu, .events-sort-segmented, .publish-nav) { background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-screen-style="crt"] :is(.brand, .mobile-brand, .cluster-name, .nav-rail-btn.is-active, .account-shell h1, .account-plan h2, .md-card h2, .md-chip, .stock-bubble) {
  text-shadow: 0 0 5px color-mix(in srgb, var(--accent) 75%, transparent), 0 0 16px color-mix(in srgb, var(--accent) 42%, transparent);
}
html[data-screen-style="crt"] :is(.nav-rail-btn.is-active, .cluster-card, .md-card, .account-shell) {
  box-shadow: var(--glass-shadow, inset 0 0 18px color-mix(in srgb, var(--accent) 8%, transparent)), 0 0 20px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* The sidebar identifies each view; retain its heading for screen-reader navigation. */
:is(#dashboardView .dash-header, #stocksView .stocks-heading, #connectionsView .cx-hero, #weeklyView .weekly-heading, #atlasView .atlas-head, #adminView .account-shell) h1 {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Account status stays with the persistent navigation. */
.nav-pro-badge { align-self:flex-start; margin:0 8px 10px; }
.dock-pro-badge { display:none; }
@media (min-width:769px) {
  html[data-theme] .page-brand-bar { display:none; }
}
@media (max-width:768px) {
  html[data-theme] .top-app-bar .dock-pro-badge:not([hidden]) { display:inline-flex; padding:0; border:0; background:transparent; color:inherit; font-size:11px; gap:4px; }
  html[data-theme] .burger-btn:has(.dock-pro-badge:not([hidden])) .burger-label { display:none; }
  html[data-theme] .top-app-bar:has(.dock-pro-badge:not([hidden])).is-scroll-hidden { transform:none; opacity:1; visibility:visible; pointer-events:auto; }
}

/* Keep methodology available without filling the data cards with paragraphs. */
.data-details { min-width:0; margin:4px 0; color:var(--text-meta); font-size:11px; }
.data-details > summary { display:inline-flex; align-items:center; gap:7px; min-height:32px; cursor:pointer; list-style:none; }
.data-details > summary::-webkit-details-marker { display:none; }
.data-details > summary::before { content:''; width:5px; height:5px; border:solid currentColor; border-width:0 1px 1px 0; transform:rotate(-45deg); transition:transform .15s; }
.data-details[open] > summary::before { transform:rotate(45deg); }
.data-details > summary:focus-visible { outline:2px solid var(--text); outline-offset:3px; border-radius:3px; }
.data-details-body { max-width:78ch; padding:4px 0 8px 12px; border-left:1px solid var(--border); line-height:1.6; }
.data-details-body > :is(p,div) { margin:0 0 8px; font-size:11px; }
.data-details-body > :last-child { margin-bottom:0; }
.data-details-body .history-data-note { white-space:pre-line; }
.stock-sidebar .price-bar > .data-details { grid-column:1 / -1; margin:0; }
.chart-data-meta { display:flex; flex-wrap:wrap; align-items:center; gap:4px 14px; margin:4px 0 8px; }
.chart-data-meta > .data-details[open] { flex-basis:100%; }
.data-quality-status { color:var(--text-meta); font-size:11px; }
@media(max-width:768px) { .data-details > summary { min-height:44px; } }
@media(prefers-reduced-motion:reduce) { .data-details > summary::before { transition:none; } }
