:root { color-scheme: dark; --selection-text: #80baff; --selection-bg: #1a304b; }
:root[data-palette="pine"] {
  --bg: #111b19; --panel: #1a2824; --panel-2: #21332c; --border: #384c43;
  --text: #e3ede6; --muted: #a4b6aa; --accent: #498a72;
  --selection-text: #a2dbba; --selection-bg: #244437;
}
:root[data-palette="plum"] {
  --bg: #1c1922; --panel: #27232e; --panel-2: #322c3b; --border: #4a4154;
  --text: #efe8f0; --muted: #bdb0c3; --accent: #9072ad;
  --selection-text: #d4b8eb; --selection-bg: #463550;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eeeae2; --panel: #f8f5ed; --panel-2: #eae5d9; --border: #cec7b7;
  --text: #35332d; --muted: #625f53; --accent: #3e6175;
  --selection-text: var(--accent); --selection-bg: #dce4e5;
  --up: #a62e38; --down: #286543; --warn: #805213; --danger: #a02438;
}
:root[data-palette="oat"] {
  --bg: #eee4da; --panel: #f8f1e8; --panel-2: #ede2d5; --border: #d1bdab;
  --text: #42382f; --muted: #6d6052; --accent: #875333; --selection-bg: #eee0cf;
}
:root[data-palette="sage"] {
  --bg: #e7e9df; --panel: #f4f4ea; --panel-2: #e7e9dc; --border: #c4cab8;
  --text: #323b31; --muted: #5b6758; --accent: #486849; --selection-bg: #dfe8d8;
}
.theme-palette-picker {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); white-space: nowrap; font-size: 12px;
}
.theme-palette-picker select { width: auto; padding: 4px 6px; }
#theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
#theme-toggle > span {
  display: inline-flex; align-items: center; width: 24px; height: 14px;
  padding: 1px; border: 1px solid var(--muted); border-radius: 8px;
}
#theme-toggle > span::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted);
}
:root[data-theme="light"] #theme-toggle > span { justify-content: end; background: var(--accent); border-color: var(--accent); }
:root[data-theme="light"] #theme-toggle > span::after { background: var(--panel); }

:root[data-palette] .stock-new { --sn-accent: var(--selection-text); --sn-tint: var(--selection-bg); }
:root[data-theme="light"] .marketdata-diagnostics .md-badge--blocked { color: var(--warn); }
:root[data-theme="light"] .marketdata-diagnostics .md-badge--success { color: var(--accent); }

/* 產業新聞自行定義了色彩；各類狀態與報告標籤也需配合明亮的面板。 */
:root[data-theme="light"] .news-workspace { --news-positive: var(--up); --news-negative: var(--down); }
:root[data-theme="light"] :is(.news-job-message, .news-model small, .news-progress-label, .news-progress-label b,
  .news-source, .news-analysis-state, .news-external, .news-label, .news-evidence p, .news-quotes li,
  .news-reasoning, .news-assessment, .news-stocks p, .news-detail-block ul) { color: var(--muted); }
:root[data-theme="light"] :is(.news-eyebrow, .news-job-state, .news-progress-active .news-progress-label,
  .news-inference .news-label, .news-details > summary, .news-stock-heading > a,
  .news-stock-heading > span:first-child, .news-article h3 a:hover) { color: var(--accent); }
:root[data-theme="light"] .news-model-ready { color: var(--down); }
:root[data-theme="light"] :is(.news-model-offline, .news-error-text) { color: var(--warn); }
:root[data-theme="light"] .news-detail-block h4 { color: var(--text); }
:root[data-theme="light"] .news-factor-bullish h4 { color: var(--up); }
:root[data-theme="light"] .news-factor-bearish h4 { color: var(--down); }
:root[data-theme="light"] .news-page-header h1 span,
:root[data-theme="light"] .news-metric[aria-pressed="true"] { background: var(--selection-bg); color: var(--accent); border-color: var(--accent); }
:root[data-theme="light"] .news-metric[aria-pressed="true"] span { color: var(--text); }
:root[data-theme="light"] .news-process { background: linear-gradient(125deg, var(--selection-bg), var(--panel) 65%); }
:root[data-theme="light"] .news-evidence { background: var(--bg); border-color: var(--border); }
:root[data-theme="light"] .news-impact { background: var(--panel-2); color: var(--muted); }
:root[data-theme="light"] .news-impact-bullish { background: #fde9ec; color: var(--up); }
:root[data-theme="light"] .news-impact-bearish { background: #dff3e9; color: var(--down); }
:root[data-theme="light"] :is(.news-impact-mixed, .news-notice) { background: #fff1d6; color: var(--warn); border-color: #dfc389; }
:root[data-theme="light"] .news-impact-uncertain { background: #efe9ff; color: #5e4096; }
