/* Theme controls and complete near-black palette, including transient states. */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;flex-shrink:0;min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font-size:.875rem;font-weight:500;white-space:nowrap}
.theme-toggle:hover{background:var(--green-light);border-color:var(--green)}
.theme-toggle svg{width:18px;height:18px}
.theme-toggle .theme-sun{display:none}
html[data-theme="dark"] .theme-toggle .theme-sun{display:block}
html[data-theme="dark"] .theme-toggle .theme-moon{display:none}
html[data-theme="dark"]{color-scheme:dark;--bg:#080a09;--surface:#121614;--ink:#eef3f0;--muted:#b0bbb4;--faint:#8e9d94;--line:#2b352f;--green:#75dba5;--green-light:#132d20;--red:#ff9690;--red-light:#351d1b;--amber:#e8bd77;--shadow:0 2px 8px #00000026}
html[data-theme="dark"] .site-header{background:#0d100e}
html[data-theme="dark"] .wordmark-divider,html[data-theme="dark"] .footer-divider{color:#75867b}
html[data-theme="dark"] .skip-link{background:var(--green);color:#080a09}
html[data-theme="dark"] .status{background:#1a211c;border-color:var(--line)}
html[data-theme="dark"] .status[data-state="live"]{background:var(--green-light);border-color:#2d513c;color:var(--green)}
html[data-theme="dark"] .status[data-state="error"],html[data-theme="dark"] .status[data-state="closed"],html[data-theme="dark"] .status[data-state="offline"]{background:var(--red-light);border-color:#62342f;color:var(--red)}
html[data-theme="dark"] .status[data-state="connecting"],html[data-theme="dark"] .status[data-state="syncing"],html[data-theme="dark"] .status[data-state="reconnecting"],html[data-theme="dark"] .status[data-state="retrying"],html[data-theme="dark"] .status[data-state="partial"]{background:#2b2417;border-color:#58472b;color:var(--amber)}
html[data-theme="dark"] .metric-live{background:linear-gradient(115deg,#12251a,#101e16)}
html[data-theme="dark"] .metric-live h2,html[data-theme="dark"] .metric-live .metric-value{color:var(--green)}
html[data-theme="dark"] .tiny-live-mark{background:var(--green)}
html[data-theme="dark"] .flow-chart-wrap{background:repeating-linear-gradient(to top,transparent 0,transparent calc(33.33% - 1px),#253129 calc(33.33% - 1px),#253129 33.33%);border-bottom-color:var(--line)}
html[data-theme="dark"] .flow-chart-wrap rect{fill:#3f7454}
html[data-theme="dark"] .flow-chart-wrap rect:last-child{fill:var(--green)}
html[data-theme="dark"] .legend-square{background:#6ec795}
html[data-theme="dark"] .button,html[data-theme="dark"] th,html[data-theme="dark"] dialog{background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .button:hover{background:#202b24;border-color:#4c6856}
html[data-theme="dark"] .button[aria-pressed="true"]{background:#2b2417;border-color:#58472b;color:var(--amber)}
html[data-theme="dark"] input,html[data-theme="dark"] select{background:#0d120f;border-color:#354138}
html[data-theme="dark"] input::placeholder{color:#87958b}
html[data-theme="dark"] input:focus,html[data-theme="dark"] select:focus{background:#131c16;border-color:#75b98f}
html[data-theme="dark"] .feed-meta,html[data-theme="dark"] .block-overview,html[data-theme="dark"] .tx-entry,html[data-theme="dark"] #trade-detail pre{background:#101a13}
html[data-theme="dark"] td,html[data-theme="dark"] .market-row,html[data-theme="dark"] .market-list>button,html[data-theme="dark"] .market-list>a{border-color:#263029}
html[data-theme="dark"] tbody tr:hover,html[data-theme="dark"] .market-row:hover,html[data-theme="dark"] .market-list>button:hover,html[data-theme="dark"] .market-list>a:hover{background:#1a261e}
html[data-theme="dark"] .market-row.active,html[data-theme="dark"] .market-list>button.active{background:var(--green-light)}
html[data-theme="dark"] .side-badge,html[data-theme="dark"] .trade-side{background:#202b24}
html[data-theme="dark"] .side-badge.buy,html[data-theme="dark"] .trade-side.buy{background:var(--green-light)}
html[data-theme="dark"] .side-badge.sell,html[data-theme="dark"] .trade-side.sell{background:var(--red-light)}
html[data-theme="dark"] .new-trade,html[data-theme="dark"] .is-new,html[data-theme="dark"] .flash{animation-name:new-row-dark}
@keyframes new-row-dark{0%{background:#264f35}100%{background:transparent}}
html[data-theme="dark"] .empty-icon,html[data-theme="dark"] .market-icon{background:#192a1e;border-color:#314937;color:#8fc29f}
html[data-theme="dark"] .liquidation-tag{background:#2b2417;border-color:#58472b;color:var(--amber)}
html[data-theme="dark"] .info-icon{border-color:#73867a}
html[data-theme="dark"] .table-scroll,html[data-theme="dark"] .market-list{scrollbar-color:#415548 transparent}
html[data-theme="dark"] dialog{box-shadow:0 24px 100px #0009}
html[data-theme="dark"] dialog::backdrop{background:#0009}
@media(max-width:650px){.header-inner{gap:12px}.theme-toggle{width:40px;min-height:40px;padding:8px}.theme-toggle span{display:none}.wordmark{gap:7px}.connection{gap:0}.status{font-size:.75rem}}
@media(max-width:360px){.header-inner{padding:0 12px;gap:9px}.wordmark{font-size:1rem}.wordmark-live{font-size:.8125rem}.wordmark-divider{margin:0 5px}.brand-symbol{width:22px}}
