:root {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --ws-bg: #0d1422;
    --ws-surface: #151f30;
    --ws-ink: #e7edf7;
    --ws-muted: #9aa8bc;
    --ws-line: #2a3850;
    --ws-blue: #7e9cff;
    --ws-blue-deep: #a8bbff;
    --ws-soft: #202f51;
    --ws-rise: #ff6f73;
    --ws-fall: #4fd29a;
    --ws-warning: #e6ad4c;
    --ws-score-low: #aab6c8;
    --ws-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}

:root[data-theme="dark"] body {
    background: linear-gradient(180deg, #111a2a 0, var(--ws-bg) 340px);
    color: var(--ws-ink);
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .main-tabs,
:root[data-theme="dark"] .stock-card,
:root[data-theme="dark"] .index-card,
:root[data-theme="dark"] .order-card,
:root[data-theme="dark"] .sector-item,
:root[data-theme="dark"] .money-item,
:root[data-theme="dark"] .strategy-rate-board,
:root[data-theme="dark"] .strategy-compare,
:root[data-theme="dark"] .strategy-choice,
:root[data-theme="dark"] .backtest-detail-wrap,
:root[data-theme="dark"] .empty,
:root[data-theme="dark"] .workspace-tool-button,
:root[data-theme="dark"] #globalStockSearch,
:root[data-theme="dark"] .global-search-results,
:root[data-theme="dark"] .watchlist-card,
:root[data-theme="dark"] .workspace-drawer,
:root[data-theme="dark"] .drawer-header,
:root[data-theme="dark"] .drawer-close,
:root[data-theme="dark"] .signal-drawer-tabs,
:root[data-theme="dark"] .signal-timeline-filters input,
:root[data-theme="dark"] .signal-timeline-filters select,
:root[data-theme="dark"] .signal-summary-panel,
:root[data-theme="dark"] .signal-event-card,
:root[data-theme="dark"] .research-quote-grid > div,
:root[data-theme="dark"] .research-section,
:root[data-theme="dark"] .alert-item,
:root[data-theme="dark"] .source-item,
:root[data-theme="dark"] .source-session,
:root[data-theme="dark"] .daily-summary-card,
:root[data-theme="dark"] .confidence-card,
:root[data-theme="dark"] .confidence-more,
:root[data-theme="dark"] .confidence-toolbar select,
:root[data-theme="dark"] .confidence-more select,
:root[data-theme="dark"] .support-card,
:root[data-theme="dark"] .kline-area {
    background: var(--ws-surface);
    border-color: var(--ws-line);
    color: var(--ws-ink);
}

:root[data-theme="dark"] .experimental-strategy-board {
    background: linear-gradient(135deg, #17243a, var(--ws-surface));
    border-color: #33496f;
    border-left-color: var(--ws-blue);
}

:root[data-theme="dark"] .experimental-summary,
:root[data-theme="dark"] .experimental-checkpoints b {
    color: var(--ws-ink);
}

:root[data-theme="dark"] .experimental-checkpoints span,
:root[data-theme="dark"] .experimental-empty {
    background: #1b293e;
    color: var(--ws-muted);
}

:root[data-theme="dark"] .experimental-warning {
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .experimental-stock-card {
    background: var(--ws-surface);
}

:root[data-theme="dark"] .experimental-verdict {
    background: #382f1d;
    color: #f0c876;
}

:root[data-theme="dark"] .strategy-workbench,
:root[data-theme="dark"] .market-overview {
    background: rgba(21, 31, 48, .94);
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .support-card {
    background: linear-gradient(135deg, #151f30, #111a29);
}

:root[data-theme="dark"] .brand-mark,
:root[data-theme="dark"] .card-score,
:root[data-theme="dark"] .signal-summary-grid > div,
:root[data-theme="dark"] .research-signal,
:root[data-theme="dark"] .strategy-comparison-card,
:root[data-theme="dark"] .strategy-compact-item,
:root[data-theme="dark"] .search-result-main:hover {
    background: #19263a;
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .update-tip,
:root[data-theme="dark"] .server-data-notice {
    background: #182438;
    color: var(--ws-muted);
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .research-risk-notice,
:root[data-theme="dark"] .browser-storage-notice,
:root[data-theme="dark"] .drawer-disclaimer {
    background: #282315;
    color: #d8cba9;
}

:root[data-theme="dark"] .market-overview-degraded,
:root[data-theme="dark"] .state-panel.state-error,
:root[data-theme="dark"] .signal-summary-panel.is-error {
    background: #2a1e22;
    border-color: #633b43;
}

:root[data-theme="dark"] .data-table {
    background: var(--ws-surface);
    color: var(--ws-ink);
}

:root[data-theme="dark"] .data-table th {
    background: #19263a;
    color: var(--ws-muted);
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .data-table td {
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .board-group-even td {
    background: #19263a;
}

:root[data-theme="dark"] #panel-ladder .data-table tr[style] td {
    background: transparent;
}

:root[data-theme="dark"] #backtestDetailTable tr {
    background: var(--ws-surface);
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .pct-up {
    color: var(--ws-rise);
}

:root[data-theme="dark"] .pct-down {
    color: var(--ws-fall);
}

:root[data-theme="dark"] .filter-chip:not(.active),
:root[data-theme="dark"] .money-sort-btn:not(.active) {
    background: #19263a;
    border-color: var(--ws-line);
    color: var(--ws-muted);
}

:root[data-theme="dark"] .filter-chip:hover:not(.active),
:root[data-theme="dark"] .money-sort-btn:hover:not(.active),
:root[data-theme="dark"] .sub-chip:hover:not(.active),
:root[data-theme="dark"] .money-subtab:hover:not(.active) {
    background: var(--ws-soft);
    color: var(--ws-ink);
}

:root[data-theme="dark"] .strategy-confidence-panel {
    background: #111a29;
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .strategy-rate-title,
:root[data-theme="dark"] .strategy-compact-name,
:root[data-theme="dark"] .support-card h2,
:root[data-theme="dark"] .definition-grid p,
:root[data-theme="dark"] .strategy-comparison-card dd,
:root[data-theme="dark"] .confidence-more summary,
:root[data-theme="dark"] .confidence-check,
:root[data-theme="dark"] .signal-event-strategy {
    color: var(--ws-ink);
}

:root[data-theme="dark"] .strategy-workbench-head,
:root[data-theme="dark"] .definition-grid div + div,
:root[data-theme="dark"] .research-detail-row,
:root[data-theme="dark"] .signal-outcome-details,
:root[data-theme="dark"] .search-result {
    border-color: var(--ws-line);
}

:root[data-theme="dark"] .index-card[style*="#fee2e2"],
:root[data-theme="dark"] .order-card[style*="#fee2e2"],
:root[data-theme="dark"] .money-item[style*="#fee2e2"] {
    background: #382028 !important;
    border-color: #75414d !important;
}

:root[data-theme="dark"] .index-card[style*="#dcfce7"],
:root[data-theme="dark"] .order-card[style*="#dcfce7"],
:root[data-theme="dark"] .money-item[style*="#dcfce7"] {
    background: #173129 !important;
    border-color: #356c59 !important;
}

:root[data-theme="dark"] .mi-lead span[style*="#333"] {
    color: var(--ws-ink) !important;
}

:root[data-theme="dark"] .card-line2 .tag,
:root[data-theme="dark"] .signal-event-meta span,
:root[data-theme="dark"] .confidence-sample,
:root[data-theme="dark"] .stock-results-meta,
:root[data-theme="dark"] .nav-count {
    background: #202c40;
    border-color: var(--ws-line);
    color: var(--ws-muted);
}

:root[data-theme="dark"] .global-search-results,
:root[data-theme="dark"] .workspace-drawer {
    box-shadow: -18px 0 60px rgba(0, 0, 0, .42);
}

:root[data-theme="dark"] input::placeholder {
    color: #74839a;
}

:root[data-theme="dark"] .workspace-tool-button:hover,
:root[data-theme="dark"] .state-action:hover {
    background: var(--ws-soft);
}

:root[data-theme="dark"] .kline-area img {
    border-radius: 8px;
    opacity: .94;
}
