.theme-toggle { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:8px 12px; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--gold); font-size:13px; white-space:nowrap; }
.theme-toggle:hover { border-color:var(--gold); }
.theme-toggle .icon { width:19px; height:19px; }
:root[data-theme="dark"] { color-scheme:dark; }
:root[data-theme="light"] {
  color-scheme:light;
  --bg:#f5f6f1;
  --sidebar:#fffdf8;
  --panel:#ffffff;
  --field:#f4f6f2;
  --line:#dbe2d7;
  --text:#23352a;
  --muted:#526456;
  --faint:#657267;
  --gold:#805b23;
  --green:#28734b;
  --red:#aa413d;
}
/* Shared controls and surfaces. */
[data-theme="light"] .sidebar { background:var(--sidebar); }
[data-theme="light"] .brand-mark { background:#e9cea0; color:#293a27; }
[data-theme="light"] .nav-item:hover { background:#eff3eb; }
[data-theme="light"] .nav-item.active { background:#f3ead9; border-color:#d7bd90; color:var(--gold); }
[data-theme="light"] .primary-button { background:#805b23; border-color:#805b23; color:#fff; }
[data-theme="light"] .primary-button:hover { background:#66471b; border-color:#66471b; }
[data-theme="light"] .text-button:hover, [data-theme="light"] .icon-button:hover { color:#674718; }
[data-theme="light"] textarea, [data-theme="light"] .sentiment-toolbar input, [data-theme="light"] .sentiment-period { border-color:#c2cfbf; }
[data-theme="light"] textarea::placeholder, [data-theme="light"] .search-field input::placeholder { color:#6b796b; }
[data-theme="light"] textarea:hover { border-color:#8d9e86; }
[data-theme="light"] textarea:focus { border-color:var(--gold); box-shadow:0 0 0 3px #805b2312; }
[data-theme="light"] .summary-details summary>span, [data-theme="light"] .subtle-tag { border-color:var(--line); }
[data-theme="light"] .copy-button, [data-theme="light"] .preset, [data-theme="light"] .news-mentions button, [data-theme="light"] .related-us button { background:var(--field); border-color:var(--line); }
[data-theme="light"] .preset:hover, [data-theme="light"] .preset.active { background:#f5eddd; border-color:#c7ad7e; }
[data-theme="light"] .impact-market-filter button[aria-pressed="true"], [data-theme="light"] .ai-market-controls button[aria-pressed="true"], [data-theme="light"] .community-market-tabs button[aria-selected="true"] { background:#f3ead9; border-color:#ccb488; color:var(--gold); }
[data-theme="light"] .news-card .text-button { background:#edf2e7; }
[data-theme="light"] .news-market { border-color:#cbb48c; }
[data-theme="light"] .news-market.tw { color:var(--green); border-color:#a6c6af; }
[data-theme="light"] .company-glyph.taiwan { background:#e7f1e8; color:var(--green); }
[data-theme="light"] .company-glyph.nvidia { color:#4c7435; }
[data-theme="light"] .company-glyph.apple { color:#455044; }
[data-theme="light"] .company-glyph.asml { color:#41678c; }
[data-theme="light"] .company-glyph.cloud { color:#38736c; }
[data-theme="light"] .skeleton-line { background:linear-gradient(90deg,#edf1e9,#dce5d6,#edf1e9); background-size:200% 100%; }
[data-theme="light"] dialog { background:var(--panel); border-color:#c8d3c1; box-shadow:0 24px 90px #24352326; }
[data-theme="light"] dialog::backdrop { background:#26362359; }
[data-theme="light"] .toast { color:var(--text); background:#edf3e7; border-color:#a7bb99; box-shadow:0 10px 35px #24352320; }
/* Event analysis keeps direction colors meaningful in either appearance. */
[data-theme="light"] .impact-stock { background:#fafcf8; }
[data-theme="light"] .resolved-entity, [data-theme="light"] .analysis-followup, [data-theme="light"] .data-help { background:#edf3e7; border-color:#c9d7c1; }
[data-theme="light"] .company-impact.bullish { color:#25653e; border-color:#a8c8ad; background:#e8f4e9; }
[data-theme="light"] .company-impact.bearish { color:#9b3536; border-color:#ddb4ad; background:#fceeed; }
[data-theme="light"] .company-impact.mixed, [data-theme="light"] .company-impact.neutral { color:#805b23; border-color:#dbc79d; background:#fbf3e1; }
[data-theme="light"] .impact-evidence blockquote { border-color:#c5a77c; }
/* Risk meters, chart grid, labels and both community rankings. */
[data-theme="light"] .meter-track { background:#e6ece3; }
[data-theme="light"] .meter-track::before { background:#9caa9c; }
[data-theme="light"] .sentiment-meter.cnn .sentiment-value strong { color:#bf4d64; }
[data-theme="light"] .sentiment-meter.feargreedchart .sentiment-value strong { color:#237f69; }
[data-theme="light"] .meter-fill, [data-theme="light"] .meter-dot { background:#bf4d64; }
[data-theme="light"] .feargreedchart .meter-fill, [data-theme="light"] .feargreedchart .meter-dot { background:#237f69; }
[data-theme="light"] .meter-dot { box-shadow:0 0 0 2px #bf4d6420; }
[data-theme="light"] .feargreedchart .meter-dot { box-shadow:0 0 0 2px #237f6920; }
[data-theme="light"] .sentiment-chart>rect { fill:#edf4ed; opacity:1; }
[data-theme="light"] .chart-grid { stroke:#d6dfd5; }
[data-theme="light"] .chart-grid.major { stroke:#b5c4b4; }
[data-theme="light"] .chart-grid.vertical { stroke:#d6dfd5; }
[data-theme="light"] .chart-path.cnn { stroke:#bf4d64; }
[data-theme="light"] .chart-path.feargreedchart { stroke:#237f69; }
[data-theme="light"] .chart-point.cnn { fill:#bf4d64; }
[data-theme="light"] .chart-point.feargreedchart { fill:#237f69; }
[data-theme="light"] #sentiment-chart-cursor { stroke:#805b2380; }
[data-theme="light"] .legend-line { border-color:#bf4d64; }
[data-theme="light"] .legend-line.green { border-color:#237f69; }
[data-theme="light"] .social-symbol, [data-theme="light"] .social-badge { color:#885126; background:#fbefdf; }
[data-theme="light"] .taiwan-card .social-symbol, [data-theme="light"] .taiwan-card .social-badge { color:#386e43; background:#ecf3e6; }
[data-theme="light"] .stocktwits-card .social-symbol, [data-theme="light"] .stocktwits-symbols a { color:#326a84; background:#e8f2f7; border-color:#bdd4df; }
[data-theme="light"] .social-summary { color:#385e70; background:#edf5f8; }
[data-theme="light"] .social-summary strong { color:#426c7b; }
[data-theme="light"] .stocktwits-details p { color:var(--muted); }
[data-theme="light"] .reddit-rank { color:#845b2b; background:#f8f0e4; border-color:#e1cfb2; }
[data-theme="light"] .reddit-rank.top { color:#fff; background:#94682e; border-color:#94682e; }
[data-theme="light"] .rank-change.up { color:var(--green); }
[data-theme="light"] .rank-change.down { color:var(--red); }
[data-theme="light"] .community-mentions strong, [data-theme="light"] .mention-count, [data-theme="light"] .taiwan-sample-stats strong, [data-theme="light"] .taiwan-posts article p>span { color:var(--green); }
[data-theme="light"] .taiwan-posts article>a { color:var(--text); }
[data-theme="light"] .taiwan-comment-details { background:var(--field); }
[data-theme="light"] .source-warning { background:#fcf6e8; border-color:#eadabb; }
[data-theme="light"] .community-ranking .is-search-match { background:#faf0d9; }
/* Distinct layer colors with readable company names and roles. */
[data-theme="light"] .applications { --layer:#9d4d47; --layer-rgb:157,77,71; }
[data-theme="light"] .models { --layer:#68528f; --layer-rgb:104,82,143; }
[data-theme="light"] .infrastructure { --layer:#4c7448; --layer-rgb:76,116,72; }
[data-theme="light"] .chips { --layer:#326a92; --layer-rgb:50,106,146; }
[data-theme="light"] .energy { --layer:#8a661e; --layer-rgb:138,102,30; }
[data-theme="light"] .ai-map-hero { background:linear-gradient(115deg,#fffdf8,#edf3e6); border-color:#d2dcc8; }
[data-theme="light"] .ai-map-hero .eyebrow, [data-theme="light"] .ai-map-hero p:not(.eyebrow), [data-theme="light"] .ai-layer-summary, [data-theme="light"] .ai-company-node small, [data-theme="light"] .ai-market-empty, [data-theme="light"] .ai-layer-insight summary, [data-theme="light"] .ai-layer-insight p, [data-theme="light"] .ai-map-footnote, [data-theme="light"] .ai-detail-role p { color:var(--muted); }
[data-theme="light"] .ai-layer-english { opacity:1; }
[data-theme="light"] .ai-company-node { background:var(--panel); border-color:var(--line); }
[data-theme="light"] .ai-company-node:hover { background:rgba(var(--layer-rgb),.06); border-color:var(--layer); }
[data-theme="light"] .ai-node-name { color:var(--text); }
[data-theme="light"] .ai-company-node.tw strong, [data-theme="light"] .ai-market-label.tw, [data-theme="light"] .ai-detail-market.tw { color:#985344; }
[data-theme="light"] .ai-company-node.us strong, [data-theme="light"] .ai-market-label.us, [data-theme="light"] .ai-detail-market.us { color:#386a8b; }
[data-theme="light"] .ai-layer-insight { border-color:var(--line); }
[data-theme="light"] .ai-layer-filters button[aria-pressed="true"] { color:#385c35; background:#eaf1e4; border-color:#aabc9a; }
[data-theme="light"] .ai-layer-filters button:hover { border-color:#899f7b; }
@media (max-width:900px) {
  .topbar-actions { gap:8px; }
  .theme-toggle { width:44px; height:44px; padding:0; }
  .theme-label { display:none; }
  .brand { max-width:calc(100% - 110px); }
  [data-theme="light"] .sidebar>.main-nav { background:#fffdf8f5; border-top-color:var(--line); box-shadow:0 -8px 30px #2635230d; }
}
