/* Shared QEdge palette: AlgoStorm-inspired near-black dark mode and
 * high-contrast light mode. Layout, dimensions and business logic unchanged. */
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#08090d;--surface:#13161d;--surface-2:#1a1e28;--surface2:#1a1e28;
  --panel:#13161d;--panel2:#1a1e28;--panel3:#13161d;
  --line:#2a2f3a;--line2:#252a34;--border:#2a2f3a;
  --text:#ecf0f8;--muted:#adb7c7;--faint:#8995a8;
  --primary:#8699fb;--blue:#8699fb;--cyan:#54b9da;
  --bull:#1aba89;--bear:#f15a66;--green:#1aba89;--red:#f15a66;
  --warn:#e7bd72;--amber:#e7bd72;
  --qedge-canvas:#0b0c12;--qedge-card:#161920;--qedge-input:#1b1f28;
  --shadow:0 14px 28px rgba(0,0,0,.2);
}
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f5f6fa;--surface:#ffffff;--surface-2:#eef1f7;--surface2:#eef1f7;
  --panel:#ffffff;--panel2:#f0f2f8;--panel3:#f8f9fc;
  --line:#d5dbe6;--line2:#e0e4ed;--border:#d5dbe6;
  --text:#1c2738;--muted:#526078;--faint:#67758b;
  --primary:#5154b8;--blue:#5154b8;--cyan:#087b9a;
  --bull:#087f5c;--bear:#c72d47;--green:#087f5c;--red:#c72d47;
  --warn:#885a00;--amber:#885a00;
  --qedge-canvas:#fbfcfe;--qedge-card:#ffffff;--qedge-input:#ffffff;
  --shadow:0 9px 21px rgba(39,54,76,.09);
}
:root[data-theme] body{background:var(--bg);color:var(--text)}
:root[data-theme] .panel,:root[data-theme] .summary-card,
:root[data-theme] .card,:root[data-theme] .package,
:root[data-theme] .counter,:root[data-theme] .storage-projection,
:root[data-theme] .brand-bar,:root[data-theme] .summary-strip,
:root[data-theme] .chart-panel,:root[data-theme] .runtime-strip{
  background:var(--surface);border-color:var(--border);box-shadow:var(--shadow);
}
:root[data-theme] .summary-cell,:root[data-theme] .counter,
:root[data-theme] .package,:root[data-theme] .storage-projection{
  border-color:var(--border);
}
:root[data-theme] .card:not(.qr-panel),:root[data-theme] .skeleton{
  background:var(--qedge-card);
}
:root[data-theme] .nav-button,:root[data-theme] .secondary-button,
:root[data-theme] .btn.secondary,:root[data-theme] .brand-nav a,
:root[data-theme] .market-switch-button,:root[data-theme] .back{
  background:var(--surface2);border-color:var(--border);color:var(--text);
}
:root[data-theme] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
:root[data-theme] textarea,:root[data-theme] select{
  background:var(--qedge-input);color:var(--text);border-color:var(--border);
}
:root[data-theme] input[type="file"]{
  background:var(--qedge-input);color:var(--text);border-color:var(--border);
}
:root[data-theme] .table-wrap,:root[data-theme] .notice,
:root[data-theme] .quality-grid div,:root[data-theme] .research-grid div,
:root[data-theme] .market-facts div,:root[data-theme] .chart-detail{
  border-color:var(--border);color:var(--text);
}
:root[data-theme] th{background:var(--surface2);color:var(--muted)}
:root[data-theme] td,:root[data-theme] th{border-color:var(--border)}
:root[data-theme] .muted,:root[data-theme] .sub,:root[data-theme] .note,
:root[data-theme] .section-note,:root[data-theme] .brand-subtitle,
:root[data-theme] .summary-kicker,:root[data-theme] .summary-cell small{
  color:var(--muted)
}
:root[data-theme] .positive,:root[data-theme] .tone-buy,:root[data-theme] .tone-good{
  color:var(--bull)!important
}
:root[data-theme] .negative,:root[data-theme] .tone-sell,:root[data-theme] .tone-bad{
  color:var(--bear)!important
}
:root[data-theme] .tone-neutral{color:var(--text)!important}
:root[data-theme] .canvas-wrap,:root[data-theme] .chart-stage,
:root[data-theme] #tvChart,:root[data-theme] #chartStage{
  background:var(--qedge-canvas);border-color:var(--border)
}
:root[data-theme] .tool-strip{background:var(--surface2);border-color:var(--border)}
:root[data-theme] .summary-strip{border-color:var(--border)}
:root[data-theme] .status-chip,:root[data-theme] .version-chip{background:var(--surface2)}
:root[data-theme] .brand-mark{background:var(--surface2);border-color:var(--border)}
:root[data-theme] .chart-panel .chart-footer,:root[data-theme] .runtime-strip{
  background:var(--surface)
}
:root[data-theme="light"] header:not(.panel-header):not(.chart-header):not(.summary-header){
  color:var(--text)
}
:root[data-theme="light"] header.topbar,:root[data-theme="light"] header.brand-bar,
:root[data-theme="light"] header.options-topbar,
:root[data-theme="light"] body>header{
  background:var(--bg);border-color:var(--border)
}
:root[data-theme="light"] .qr-panel{
  background:#f6fbfa;color:#07110f
}
:root[data-theme="light"] .qr-panel .qr-title{color:#07110f}
/* Explicit native control; never obscure login fields or trade controls. */
.qedge-theme-switch{
  display:inline-flex;align-items:center;justify-content:center;
  flex:0 0 auto;min-height:34px;min-width:91px;padding:6px 11px;
  border:1px solid var(--border);border-radius:8px;
  background:var(--surface2);color:var(--text);
  font:700 12px/1.2 "Segoe UI",Arial,sans-serif;
  white-space:nowrap;cursor:pointer;letter-spacing:0;
}
.qedge-theme-switch:hover,.qedge-theme-switch:focus-visible{
  border-color:var(--primary);outline-offset:2px
}
:root[data-theme] #themeToggle{color:var(--text);border-color:var(--border);background:var(--surface2)}
/* The compact chart header stays single line on desktop; on small screens
 * the control wraps into existing navigation instead of overlaying content. */
@media(max-width:760px){
  .qedge-theme-switch{min-width:83px;min-height:34px;padding:5px 8px}
  .brand-nav{flex-wrap:wrap}
}

/* Unified pure-black canvas across ALL QEdge pages, dashboard included.
 * Only visual surfaces change; no signal/EA logic or layout changes. */
:root[data-theme="dark"]{
  --bg:#000000;
  --surface:#13161c;--panel:#13161c;--panel2:#181b23;--panel3:#13161c;
  --qedge-card:#13161c;--qedge-canvas:#050505;
  --surface2:#181b23;--surface-2:#181b23;--qedge-input:#191d26;
  --border:#2c3039;--line:#2c3039;--line2:#252932;
  --text:#f2f5fa;--muted:#b4bdca;
}
:root[data-theme="dark"] html,:root[data-theme="dark"] body{
  background:#000000!important;background-image:none!important;
}
:root[data-theme="dark"] .app-shell,
:root[data-theme="dark"] .options-shell,
:root[data-theme="dark"] .livechart-shell{
  background-color:transparent;
}
/* Original Dashboard had a blue glass gradient over its metric cards, signal
 * section and supporting panels; use the Options Analytics surface instead. */
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .summary-card,
:root[data-theme="dark"] .horizontal-signal-panel,
:root[data-theme="dark"] .market-banner,
:root[data-theme="dark"] .summary-tile,
:root[data-theme="dark"] .window-summary,
:root[data-theme="dark"] .market-facts div,
:root[data-theme="dark"] .market-basis-panel,
:root[data-theme="dark"] .signal-list div,
:root[data-theme="dark"] .chart-panel{
  background:#13161c!important;
  background-image:none!important;
  border-color:var(--border);
  color:var(--text);
}
:root[data-theme="dark"] .market-banner.market-open,
:root[data-theme="dark"] .market-banner.market-closed,
:root[data-theme="dark"] .market-banner.market-holiday{
  background:#13161c!important;
}
:root[data-theme="dark"] .metric-card:hover,
:root[data-theme="dark"] .panel:hover{
  background:#171b24!important;
}
:root[data-theme="light"] .metric-card,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .summary-card,
:root[data-theme="light"] .horizontal-signal-panel,
:root[data-theme="light"] .market-banner,
:root[data-theme="light"] .summary-tile,
:root[data-theme="light"] .window-summary{
  background:var(--surface)!important;background-image:none!important;
  color:var(--text);
}
:root[data-theme="light"] .market-banner.market-open{
  background:var(--surface)!important;
}
:root[data-theme="dark"] .metric-card strong,
:root[data-theme="dark"] .summary-tile strong,
:root[data-theme="dark"] .horizontal-signal-list dd{
  color:var(--text);text-shadow:0 1px 1px #000;
}
:root[data-theme="dark"] .metric-card .positive,
:root[data-theme="dark"] .metric-card .negative{
  text-shadow:none;
}

/* Dashboard light-mode contrast repairs (2026-11-03).
   Original dashboard widgets used fixed dark rgba backgrounds while shared
   theme switched their text to dark. Limit these overrides to light mode;
   the data, component positions and dark theme are unchanged. */
:root[data-theme="light"] .topbar-meta span:not(.pill),
:root[data-theme="light"] .range-context span,
:root[data-theme="light"] .market-facts div,
:root[data-theme="light"] .system-status-col {
  background:var(--surface-2)!important;
  background-image:none!important;
  color:var(--text);
  border-color:var(--border);
}
:root[data-theme="light"] .market-facts dt,
:root[data-theme="light"] .topbar-meta .muted-label,
:root[data-theme="light"] .range-context span {
  color:var(--muted);
}
:root[data-theme="light"] .market-facts dd,
:root[data-theme="light"] .range-context strong,
:root[data-theme="light"] .topbar-meta span:not(.pill) {
  color:var(--text)!important;
}
:root[data-theme="light"] .market-switcher {
  background:var(--surface-2);
  border-color:var(--border);
}
:root[data-theme="light"] .market-switch-button {
  background:transparent;
  color:var(--text);
  opacity:.85;
}
:root[data-theme="light"] .market-switch-button.is-active {
  background:var(--surface);
  color:var(--primary);
  opacity:1;
  box-shadow:inset 0 0 0 1px var(--primary);
}
/* Detailed reasoning and expected-move tags must not remain charcoal when
   the parent panel changes to white. */
:root[data-theme="light"] .horizontal-reason-list li,
:root[data-theme="light"] .delta-range-box.range-otm {
  background:var(--surface-2);
  color:var(--muted);
  border-color:var(--border);
}
:root[data-theme="light"] .horizontal-reason-list li strong {
  color:var(--text);
}
:root[data-theme="light"] .horizontal-reason-list li.reason-positive {border-left-color:var(--bull)}
:root[data-theme="light"] .horizontal-reason-list li.reason-negative {border-left-color:var(--bear)}
:root[data-theme="light"] .horizontal-reason-list li.reason-warning {border-left-color:var(--warn)}
:root[data-theme="light"] .horizontal-reason-list li.reason-neutral {border-left-color:var(--primary)}
:root[data-theme="light"] .delta-range-box.range-atm {color:#124d82}
:root[data-theme="light"] .delta-range-box.range-put-near {color:#935008}
:root[data-theme="light"] .delta-range-box.range-call-near {color:#087f5c}
/* Intraday IV/skew and outstanding strike cards have independent stylesheet
   backgrounds; they must follow the shared light palette as well. */
:root[data-theme="light"] .volume-analysis-card,
:root[data-theme="light"] .analysis-card-head {
  background:var(--surface)!important;
  border-color:var(--border);
  color:var(--text);
}
:root[data-theme="light"] .analysis-summary-row > div,
:root[data-theme="light"] .analysis-equation,
:root[data-theme="light"] .analysis-equation-muted,
:root[data-theme="light"] .analysis-formula-note,
:root[data-theme="light"] .attention-strike-row {
  background:var(--surface-2)!important;
  border-color:var(--border);
  color:var(--text);
}
:root[data-theme="light"] .analysis-equation-title,
:root[data-theme="light"] .analysis-formula-note {
  color:var(--text);
}
:root[data-theme="light"] .analysis-equation-title strong {color:var(--primary)}
:root[data-theme="light"] .analysis-equation-detail,
:root[data-theme="light"] .analysis-equation-detail span,
:root[data-theme="light"] .analysis-equation-sub,
:root[data-theme="light"] .attention-reason,
:root[data-theme="light"] .analysis-muted,
:root[data-theme="light"] .analysis-caution {
  color:var(--muted);
}
:root[data-theme="light"] .analysis-equation-detail,
:root[data-theme="light"] .analysis-summary-row strong,
:root[data-theme="light"] .attention-strike-title strong,
:root[data-theme="light"] .attention-volume-grid b {
  color:var(--text);
}
:root[data-theme="light"] .analysis-conclusion.bias-bullish {background:#ecfaf5;color:var(--bull)}
:root[data-theme="light"] .analysis-conclusion.bias-bearish {background:#fff0f2;color:var(--bear)}
:root[data-theme="light"] .analysis-conclusion.bias-neutral {background:var(--surface-2);color:var(--muted)}
:root[data-theme="light"] .analysis-conclusion p {color:var(--text)}
:root[data-theme="light"] .attention-lead {background:#eef6ff;border-color:#bfdcf2;color:var(--text)}
:root[data-theme="light"] .attention-rank {background:#e7eefc;color:var(--primary)}
:root[data-theme="light"] .attention-call {background:#e2f6ee;color:var(--bull)}
:root[data-theme="light"] .attention-put {background:#ffeaee;color:var(--bear)}
:root[data-theme="light"] .attention-mixed {background:var(--surface-2);color:var(--muted)}
