/* The preference is shared by the dashboard, privacy page and private stats. */
:root{color-scheme:light}
.brand-tools{display:flex;align-items:center;gap:12px;margin-left:auto;flex:none}
.brand-tools .brand-settings{margin-left:0}
.theme-toggle[aria-pressed="true"]{background:#e9edff;color:#4052bc;border-color:#c4cdef}

:root[data-theme="dark"]{color-scheme:dark;background:#101722;color:#e3eaf5;--page:#101722;--surface:#192332;--surface-soft:#202d40;--text:#e3eaf5;--muted:#acb9ce;--line:#344257;--brand:#a4b2ff;--up:#ff8c9a;--down:#8ebcff}
:root[data-theme="dark"] body{background:var(--page);color:var(--text)}
:root[data-theme="dark"] :is(h1,h2,h3,h4){color:var(--text)}
:root[data-theme="dark"] .eyebrow{color:var(--muted)}
:root[data-theme="dark"] .section-label{color:var(--text)}
:root[data-theme="dark"] :is(.sidebar,.metric,.panel,.api-card,.dashboard-tile,.loading,.empty-state,.search-box,.query-controls,.scope-picker,.choice-results,.choice-option,.choice-trigger,.button,.icon-button,.brand-settings,.screen-zoom-buttons button,.form-field input,.form-field select,#chart-dialog){background:var(--surface);color:var(--text);border-color:var(--line)}
:root[data-theme="dark"] .topbar{background:#151e2c;border-color:var(--line);box-shadow:0 2px 8px #0002}
:root[data-theme="dark"] :is(.page-heading h1,.panel-heading h2,.api-card h3,.metric .value,.modal-summary strong,.history-section-heading h2,.empty-state h2,.ring-center strong,.brand-name){color:var(--text)}
:root[data-theme="dark"] :is(.page-heading p,.muted,.small-note,.panel-heading p,.panel-heading .meta,.metric-date,.metric .metric-label,.metric .value small,.api-card p,.chart-footer,.chart-range-label,.catalog-cadence,.notice,.chart-interaction-hint,.tile-chart-caption,.tile-chart-footer,.modal-summary,.modal-controls,.modal-footer,.form-field label,.form-field small,.choice-control>label,.choice-control .choice-count,.choice-empty,.scope-picker span,.history-section-heading p,.history-section-heading h2 span,.legend-row,.legend-row strong,.ring-center span,.top-status-strip,.catalog-summary span,.table-pagination,.drag-handle,.screen-zoom-heading,.favorite-guide p,.favorite-guide>button,.sidebar-label,footer,#breadcrumb,#breadcrumb .breadcrumb-current){color:var(--muted)}
:root[data-theme="dark"] :is(.nav-item,.tree summary,.tree-sub summary,.tree-leaf,.tree summary small,.tree-leaf small,.chip,.segmented button,.tabs button,.query-control label,.scope-picker label,.choice-trigger,.choice-option){color:#bcc9de}
:root[data-theme="dark"] :is(.tree-search,.choice-search,.segmented,.tile-toolbar,.notice,.provider-card,.screen-zoom,.updated-badge,.empty-icon,.source-icon,.history-placeholder){background:#202c3e;color:var(--muted);border-color:var(--line)}
:root[data-theme="dark"] :is(input,select){color:var(--text)}
:root[data-theme="dark"] :is(input,select)::placeholder{color:#8d9db5;opacity:1}
:root[data-theme="dark"] :is(.tree-search input,.search-box input,.choice-search input){background:transparent;color:var(--text)}
:root[data-theme="dark"] :is(.query-control select,.scope-picker select,select option){background:var(--surface);color:var(--text);border-color:var(--line)}
:root[data-theme="dark"] :is(.nav-item:hover,.tree-leaf:hover,.choice-option:hover,.choice-option:focus-visible,.search-clear:hover,.expand-button:hover,.brand-settings:hover,.chart-zoom button:hover:not(:disabled)){background:#293b58;color:#d0d9ff;border-color:#667aa7}
:root[data-theme="dark"] :is(.nav-item.active,.chip.active,.filter-row button.active,.segmented button.active,.choice-option[aria-selected="true"],.today-window,.brand-settings.active,.theme-toggle[aria-pressed="true"]){background:#2a3855;color:#c3cdff;border-color:#6174a9}
:root[data-theme="dark"] .tree-leaf.selected{background:#2a3855!important;color:#d0d8ff!important;box-shadow:inset 3px 0 #9caeff}
:root[data-theme="dark"] :is(.tabs button.active,.inline-link,.expand-button,.choice-check,.screen-zoom-heading output){color:#b1bfff}
:root[data-theme="dark"] .button.primary{background:#6679e8;border-color:#6679e8;color:#fff}
:root[data-theme="dark"] .filter-row button{background:var(--surface);border-color:var(--line);color:#bcc9de}
:root[data-theme="dark"] .filter-row button.active{background:#2a3855;color:#c3cdff;border-color:#6174a9}
:root[data-theme="dark"] :is(.data-table td,.data-table .table-title){color:var(--text)!important;border-color:#2b394d}
:root[data-theme="dark"] .data-table th{background:#222f43;color:#bccbe2;border-color:var(--line)}
:root[data-theme="dark"] :is(.query-controls,.scope-picker,.data-table,.chart-footer,.tile-chart,.tile-toolbar,.table-pagination,.modal-footer,.sidebar-bottom,.updated-badge>.cadence-label,.tree-sub){border-color:var(--line)}
:root[data-theme="dark"] .updated-badge strong{color:#e0e8fa}
:root[data-theme="dark"] .updated-badge>.cadence-label strong{color:#bccbf4}
:root[data-theme="dark"] .chart-svg text{fill:#b5c3d9}
:root[data-theme="dark"] .chart-svg>line{stroke:#344257}
:root[data-theme="dark"] .chart-zoom button{background:var(--surface);color:#ccd7ed;border-color:var(--line)}
:root[data-theme="dark"] .chart-zoom span{color:var(--muted)}
:root[data-theme="dark"] :is(.chart-empty,.legend-row small,.search-clear){color:var(--muted)}
:root[data-theme="dark"] .chart-tooltip{background:#344762;color:#fff;border:1px solid #607493;box-shadow:0 5px 20px #0005}
:root[data-theme="dark"] .chart-tooltip small{color:#e1e8f4}
:root[data-theme="dark"] #chart-dialog::backdrop{background:#030914b8}
:root[data-theme="dark"] .metric .star{background:#233047;border-color:#40516d;color:#bdcbe3}
:root[data-theme="dark"] .metric .star.saved{background:#3d3421;border-color:#796237;color:#f2ca72}
:root[data-theme="dark"] .star.saved .icon{fill:#685128}
:root[data-theme="dark"] .change{background:#462b37;color:var(--up)}
:root[data-theme="dark"] .change.down{background:#213951;color:var(--down)}
:root[data-theme="dark"] :is(.status.ok,.status.received,.status.recovered){color:#87d7bb}
:root[data-theme="dark"] :is(.status.error,.status.stale,.status.empty,.metric-date .quote-delay){color:#edbf77}
:root[data-theme="dark"] .status.pending{color:#b3b4ef}
:root[data-theme="dark"] .favorite-guide{background:#1f2e48;border-color:#3c527a;color:#e0e8f6}
:root[data-theme="dark"] .favorite-guide-star{background:#3e3423;color:#efc366}
:root[data-theme="dark"] .favorite-guide .alarm-notice{color:#b4c3ff}
:root[data-theme="dark"] .market-guide{background:var(--surface);border-color:var(--line);color:#c3cfe2}
:root[data-theme="dark"] :is(.market-guide h2,.market-guide h3){color:var(--text)}
:root[data-theme="dark"] :is(.market-guide-grid p,.market-guide summary){color:var(--muted)}
:root[data-theme="dark"] .market-guide details{border-color:var(--line)}
:root[data-theme="dark"] #mobile-menu{background:var(--surface);color:var(--text);border-color:#4a5a74}
:root[data-theme="dark"] .avatar{background:#3d352a;color:#e5c892;border-color:#263347}
:root[data-theme="dark"] .nav-count{background:#344367;color:#d1d9ff}
:root[data-theme="dark"] :is(.privacy-page main,.visit-page .cards section,.visit-page .panel,.visit-page button){background:var(--surface);color:var(--text);border-color:var(--line)}
:root[data-theme="dark"] :is(.privacy-page small,.visit-page header p,.visit-page .cards span,.visit-page th,.visit-page aside){color:var(--muted)}
:root[data-theme="dark"] :is(.privacy-page a,.visit-page a){color:var(--brand)}
:root[data-theme="dark"] .visit-page :is(th,td){border-color:var(--line)}

:root[data-theme="dark"] #breadcrumb a{color:#c0cdef}
:root[data-theme="dark"] .chart-svg>path[stroke]{stroke:#9eafff}
:root[data-theme="dark"] .chart-cursor line{stroke:#b5c3ff}

:root[data-theme="dark"] .availability-notice{background:#302b1b;color:#f4d894;border-color:#665731}
:root[data-theme="dark"] .forex-nav{border-color:var(--line)}
:root[data-theme="dark"] .forex-nav>summary{color:#c4cfe5}
:root[data-theme="dark"] .forex-nav>summary.active{background:#2a3855;color:#c3cdff}
:root[data-theme="dark"] .forex-nav>summary small{color:var(--muted)}
:root[data-theme="dark"] .drag-handle{background:#243148;border-color:#52627d}

[data-theme="dark"] .metric .metric-label{color:#d8e2f3}
[data-theme="dark"] .expand-button,[data-theme="dark"] [data-action="expand-chart"]{border-color:#475471;color:#c5d1ff}
