/* Shared appearance layer. Light mode retains the existing Soft UI surfaces. */
:root {
  color-scheme:light; --theme-selected:#f8fafc; --theme-track:rgba(255,255,255,.20);
  --series-0:#067647; --series-1:#c24130; --series-2:#2563a6; --series-3:#b54708;
  --series-4:#764caa; --series-5:#137d88; --series-6:#9c466c; --series-7:#626e2c;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --paper:#19212d; --panel:#1e2836; --ink:#e3ebf6; --muted:#b0bed1;
  --accent:#93a3ff; --accent-ink:#acb9ff; --shadow-dark:#101722; --shadow-light:#303d4e;
  --raised:5px 5px 14px #111925,-5px -5px 14px #253142;
  --raised-small:3px 3px 10px #111925,-3px -3px 10px #253142;
  --pressed:inset 3px 3px 8px #111925,inset -3px -3px 8px #293647;
  --up:#75d7b5; --down:#ff949f; --amber:#edc278; --line:rgba(183,199,219,.16);
  --theme-selected:#303d50; --theme-track:#151e29;
  --series-0:#72d4ad; --series-1:#ff9282; --series-2:#8eb7f8; --series-3:#f4b475;
  --series-4:#c6a0f4; --series-5:#75cdd8; --series-6:#e99bc1; --series-7:#c7d285;
}
.theme-settings { margin:0 0 26px; }
.theme-switch { display:flex; gap:4px; padding:4px; border-radius:99px; background:var(--theme-track); box-shadow:var(--pressed); }
.theme-choice { display:flex; align-items:center; justify-content:center; flex:1; height:44px; min-width:44px; padding:0; border:0; border-radius:99px; background:transparent; color:var(--muted); cursor:pointer; box-shadow:none; }
.theme-choice svg { flex-shrink:0; }
.theme-choice:hover { color:var(--ink); }
.theme-choice[aria-pressed="true"] { color:var(--ink); background:var(--theme-selected); box-shadow:var(--raised-small); }
.theme-choice:active { box-shadow:var(--pressed); }
.theme-status { margin:8px 0 0; text-align:center; color:var(--muted); font-size:12px; line-height:1.5; }
.sidebar { overflow-y:auto; overscroll-behavior:contain; }
.sidebar nav { margin-bottom:18px; }
.mobile-theme-settings { display:none; }
@media(max-width:900px) {
  .mobile-theme-settings { display:block; margin:0; justify-self:start; }
  .mobile-theme-settings .theme-switch { width:168px; }
  .mobile-theme-settings .theme-choice { height:40px; }
  .mobile-theme-settings .theme-status { display:none; }
}
/* Neutral surfaces, inputs, overlays and semantic status colors. */
html[data-theme="dark"] :is(.readonly-note,.sales-reading-block p) { color:var(--muted); }
html[data-theme="dark"] :is(.workbench-actions article,.rank-overview) { background:var(--panel); }
html[data-theme="dark"] :is(th,.movement-grid select) { background:#253142; }
html[data-theme="dark"] tbody tr:hover td { background-color:rgba(166,188,218,.08); }
html[data-theme="dark"] :is(.product-menu,dialog) { box-shadow:0 16px 48px #080e1866; }
html[data-theme="dark"] :is(.rank-tooltip,.sales-chart-tooltip) { background:#253142; border-color:var(--line); box-shadow:0 12px 32px #080e1866; }
html[data-theme="dark"] .rank-tooltip-item>i { box-shadow:0 0 0 2px var(--paper); }
html[data-theme="dark"] .sif-bar-track { background:#131c29; box-shadow:var(--pressed); }
html[data-theme="dark"] :is(.rank-top10,.top10) { background:#214d40; color:#b0edd5; }
html[data-theme="dark"] :is(.rank-page1,.page1) { background:#253e38; color:#b0ddcd; }
html[data-theme="dark"] :is(.rank-page2,.page2) { background:#4b3f29; color:#f0d49d; }
html[data-theme="dark"] :is(.rank-page3,.page3) { background:#4c303b; color:#ffb4bc; }
html[data-theme="dark"] :is(.rank-missing,.missing) { background:#293342; color:var(--muted); }
html[data-theme="dark"] .sales-desk { --sales-ink:var(--ink); --sales-muted:var(--muted); --sales-blue:var(--accent-ink); --sales-green:var(--up); --sales-red:var(--down); }
html[data-theme="dark"] :is(.sales-status,.sales-kpi,.sales-surface,.sales-evidence,.sales-reason,.sales-desk details,.sales-toolbar,.sales-verification) { background:var(--panel); }
html[data-theme="dark"] .sales-kpi { box-shadow:var(--raised-small); }
html[data-theme="dark"] :is(.sales-desk select,.sales-desk input) { background:var(--paper); box-shadow:var(--pressed); }
html[data-theme="dark"] :is(.sales-switch,.sales-factor-track) { background:#151e29; }
html[data-theme="dark"] :is(.sales-switch button[aria-pressed="true"],.sales-alerts button,.sales-button,.sales-proof-label,.sales-reason-index,.sales-dialog-close,.sales-summary-split>div,.sales-market-grid article,.sales-candidate-list a,.sales-action-grid>article,.sales-market-summary>div,.sales-review-grid article,.sales-review-themes span) { background:#29364a; }
html[data-theme="dark"] :is(.sales-alerts button:hover,.sales-alerts button[aria-pressed="true"],.sales-candidate-list a:hover) { background:#354665; }
html[data-theme="dark"] :is(.sales-proof-label,.sales-reason-index,.sales-dialog-close) { color:var(--muted); }
html[data-theme="dark"] .sales-desk th { background:#253142; }
html[data-theme="dark"] :is(.sales-desk th,.sales-desk td,.sales-context-events article,.sales-action-result) { border-color:var(--line); }
html[data-theme="dark"] :is(.sales-desk details.sales-hypotheses,.sales-desk details.sales-check,.sales-desk details.sales-market-audit,.sales-desk details.sales-deep-panel) { background:var(--panel); }
html[data-theme="dark"] .sales-judgement { background:linear-gradient(120deg,#242f43,#202c3f); }
html[data-theme="dark"] .sales-integrated { background:#2b3852; }
html[data-theme="dark"] .sales-dialog { background:var(--paper); }
html[data-theme="dark"] .sales-chart [data-sales-day]:focus { stroke:var(--accent); }
/* SVG axis/grid and series remain readable without changing their values or geometry. */
html[data-theme="dark"] svg text { fill:var(--muted); }
html[data-theme="dark"] svg :is([stroke="#cbd3df"],[stroke="#ccd4df"],[stroke="#d2dae7"],[stroke="#d0d9e6"],[stroke="#dce3ed"],[stroke="#d8e0eb"],[stroke="rgba(88,103,125,.14)"],[stroke="#d6deea"]) { stroke:var(--line); }
html[data-theme="dark"] svg :is([stroke="#fff"],[stroke="#ffffff"]) { stroke:var(--paper); }
html[data-theme="dark"] svg [stroke="#394557"] { stroke:var(--ink); }
html[data-theme="dark"] svg :is([stroke="#6376d8"],[stroke="#536ddc"],[stroke="#667eea"]) { stroke:var(--accent); }
html[data-theme="dark"] svg :is([fill="#6376d8"],[fill="#536ddc"],[fill="#667eea"]) { fill:var(--accent); }
html[data-theme="dark"] svg [fill="#25334a"] { fill:var(--ink); }
html[data-theme="dark"] svg [stroke="#f8faff"] { stroke:var(--panel); }
html[data-theme="dark"] svg :is([stroke="#067647"],[stroke="#29A36A"]) { stroke:#72d4ad; }
html[data-theme="dark"] svg :is([fill="#067647"],[fill="#29A36A"]) { fill:#72d4ad; }
html[data-theme="dark"] svg [stroke="#c24130"] { stroke:#ff9282; }
html[data-theme="dark"] svg [fill="#c24130"] { fill:#ff9282; }
html[data-theme="dark"] svg :is([stroke="#2563a6"],[stroke="#526DC4"],[stroke="#4d65d9"]) { stroke:#8eb7f8; }
html[data-theme="dark"] svg :is([fill="#2563a6"],[fill="#526DC4"],[fill="#4d65d9"]) { fill:#8eb7f8; }
html[data-theme="dark"] svg [stroke="#764caa"] { stroke:#c6a0f4; }
html[data-theme="dark"] svg [fill="#764caa"] { fill:#c6a0f4; }
html[data-theme="dark"] svg [stroke="#b54708"] { stroke:#f4b475; }
html[data-theme="dark"] svg [fill="#b54708"] { fill:#f4b475; }
html[data-theme="dark"] svg [stroke="#137d88"] { stroke:#75cdd8; }
html[data-theme="dark"] svg [fill="#137d88"] { fill:#75cdd8; }
html[data-theme="dark"] svg [stroke="#9c466c"] { stroke:#e99bc1; }
html[data-theme="dark"] svg [fill="#9c466c"] { fill:#e99bc1; }
html[data-theme="dark"] svg [stroke="#626e2c"] { stroke:#c7d285; }
html[data-theme="dark"] svg [fill="#626e2c"] { fill:#c7d285; }
html[data-theme="dark"] :is(.kpi,.sif-card,.correlation-kpis article):hover { box-shadow:var(--raised); }
html[data-theme="dark"] [data-kd-light]::after { background:radial-gradient(340px circle at var(--kd-light-x,50%) var(--kd-light-y,50%),#a1b9f415,transparent 72%); }
/* The local Streamlit dashboard reuses the same preference and appearance controller. */
html[data-theme="dark"] :is([data-testid="stMarkdownContainer"],label,[data-testid="stCaptionContainer"]) { color:var(--ink); }
html[data-theme="dark"] :is([data-baseweb="select"]>div,[data-baseweb="input"],textarea,[data-testid="stExpander"], [role="listbox"]) { color:var(--ink); background:var(--panel); border-color:var(--line); }
html[data-theme="dark"] .js-plotly-plot :is(.bg,.legend>rect,.hoverlayer .bg) { fill:var(--paper)!important; }
html[data-theme="dark"] .js-plotly-plot .svg-container > svg.main-svg { background:transparent!important; }
html[data-theme="dark"] .js-plotly-plot .svg-container > svg.main-svg:first-of-type { background:var(--paper)!important; }
html[data-theme="dark"] .js-plotly-plot text { fill:var(--muted)!important; }
html[data-theme="dark"] .js-plotly-plot :is(.xgrid,.ygrid,.xlines-above,.ylines-above) { stroke:var(--line)!important; }
@media print { .theme-settings { display:none!important; } }
