/* Explicit preference: Light remains the default, independently of OS settings. */
:root { color-scheme:light; }
.theme-toggle { display:inline-grid; place-items:center; flex:0 0 34px; width:34px; height:34px; padding:0; border:1px solid var(--line); border-radius:50%; background:var(--surface); color:var(--text); font-size:23px; line-height:1; cursor:pointer; }
.theme-toggle:hover { background:var(--bg-accent); }
html[data-theme="dark"] {
 color-scheme:dark;
 --bg:#111622; --bg-accent:#1b2433; --surface:#1b2331; --surface-strong:#202a3a;
 --surface-warm:#302b20; --surface-cool:#182130; --surface-dark:#101624;
 --text:#e8edf5; --muted:#b2bfd0; --line:#354153; --ink:#e8edf5;
 --shadow:0 4px 18px #00000026; --green:#79d5b0; --red:#ff9999; --amber:#e3bd70;
 --green-soft:#1b382e; --red-soft:#43272e; --amber-soft:#3c3220; --gold:#d6bd7f;
 background:var(--bg);
}
html[data-theme="dark"] body { color:var(--text); }
html[data-theme="dark"] :is(.card,.side-menu.card,.certificate-shell,.certificate-detail-panel,.detail-panel,.metric-card,.modal-panel,.auth-status-menu,.annotation-card,.annotations-panel,.notes-panel,.admin-annotation-editor-panel,.admin-annotation-list-panel,.public-panel,.public-metric,.public-schedule,.faq-item,.billing-plan-option,.source-link,.mobile-app-banner) { background:var(--surface); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] :is(.search-query-form,.search-filter-group,.search-filter-panel,.search-position-filter,.search-position-filters,.collection-filter-toolbar,.collection-toolbar,.certificate-shell-actions,.certificate-calendar-panel,.calendar-dividend-controls,.underlying-search-panel,.underlying-search-dialog,.billing-plan-chip,.public-callout) { background:var(--surface-cool); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] :is(input,select,textarea,.manage-input,.pagination-select,.search-query-input,.auth-status-trigger,.card-chevron-button,.cert-calendar-btn,.calendar-expand-button,.collection-view-switch,.collection-export,.sort-direction-control,.underlying-annotation-trigger,.search-toggle-action,.search-reset-action,.underlying-search-open,.billing-action) { background:var(--surface-strong); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder { color:#9cabc0; }
html[data-theme="dark"] :is(h1,h2,h3,h4,.panel-title,.section-heading h2,.info-page h2,.certificate-shell-title,.certificate-isin-chip strong,.underlying-name strong,.market-cell strong,.detail-list dd,.source-link strong,.faq-question,.auth-status-name,.auth-status-copy strong,.billing-plan-option strong,.billing-plan-chip strong,.public-facts dd,.public-certificate-page h1,.certificate-shell-metric strong) { color:var(--text); }
html[data-theme="dark"] :is(.cert-kpi-sub,.cert-kpi-label,.panel-label,.metric-label,.certificate-shell-update,.certificate-shell-subtitle,.certificate-shell-meta,.underlying-meta,.market-cell span,.table-value-meta,.table-value-sub,.detail-list dt,.source-link-meta,.auth-status-copy span,.auth-menu-meta,.billing-plan-option small,.billing-plan-chip small,.legal-block-body,.legal-block-subtitle,.public-muted,.public-metric span,.public-metric small,.public-facts dt,.certificate-table-legend) { color:var(--muted); }
html[data-theme="dark"] :is(.certificate-page-link,.certificate-detail-nav a,.calendar-date-link,.source-link a,.info-page a,.legal-block-body a,.public-document,.public-footer a) { color:#b4cfff; }
html[data-theme="dark"] :is(.side-nav-link:hover,.side-nav-link.is-active,.collection-view-switch button.is-selected,.search-active-filter-chip,.direction-badge,.table-reverse) { background:#393222; color:#e5ca86; border-color:#70603d; }
html[data-theme="dark"] :is(.collection-view-switch button,.side-nav-link,.calendar-expand-button,.underlying-annotation-trigger,.card-chevron-button) { color:var(--muted); }
html[data-theme="dark"] .collection-view-switch button.is-selected { color:#e5ca86; }
html[data-theme="dark"] :is(.certificate-table-scroll,.certificate-calendar-scroll,.underlyings-table-wrap,.public-table-scroll) { background:var(--surface); border-color:var(--line); }
html[data-theme="dark"] :is(.certificate-results-table,.underlyings-table,.certificate-calendar-table,.public-table-scroll table) { color:var(--text); }
html[data-theme="dark"] :is(.certificate-results-table th,.certificate-results-table th:first-child,.underlyings-table th,.certificate-calendar-table th,.public-table-scroll th) { background:#283448; color:#d4dfed; border-color:var(--line); }
html[data-theme="dark"] :is(.certificate-results-table td,.underlyings-table td,.certificate-calendar-table td,.public-table-scroll td,.public-table-scroll th,.detail-list>div,.public-facts>div) { border-color:var(--line); }
html[data-theme="dark"] :is(.certificate-results-table .table-identity,.certificate-results-table .table-actions,.certificate-table-detail td) { background:var(--surface); }
html[data-theme="dark"] .certificate-results-table .certificate-table-row:nth-of-type(2n) td,
html[data-theme="dark"] :is(.underlyings-table tbody tr:nth-child(even),.certificate-calendar-table tr:nth-child(even)) { background:#202b3b; }
html[data-theme="dark"] .certificate-results-table .certificate-table-row:hover td,
html[data-theme="dark"] .certificate-results-table .certificate-table-row.is-expanded td,
html[data-theme="dark"] .underlyings-table tbody tr:hover { background:#343020; }
html[data-theme="dark"] .certificate-results-table .table-identity a { color:var(--text); }
html[data-theme="dark"] .certificate-results-table small { color:var(--muted); }
html[data-theme="dark"] .table-actions button { background:var(--surface-strong); color:#e5ca86; border-color:#526079; }
html[data-theme="dark"] :is(.table-distance.is-safe,.is-positive,.positive,.text-positive) { color:var(--green); }
html[data-theme="dark"] :is(.table-distance.is-risk,.is-negative,.negative,.text-negative) { color:var(--red); }
html[data-theme="dark"] .table-distance.is-neutral { color:var(--text); }
html[data-theme="dark"] .account-transition-banner { background:#332d20; color:#e8ddc3; border-color:#8e7948; }
html[data-theme="dark"] :is(.account-transition-content>strong,.account-transition-icon) { color:#e5ca86; }
html[data-theme="dark"] .account-transition-content .account-transition-retention { color:#cfc4ad; }
html[data-theme="dark"] :is(.topbar.card.certslab-hero,.site-footer) { background:linear-gradient(110deg,#101526,#1b2033); border-color:#35394e; }
html[data-theme="dark"] .side-menu .topbar-signin { background:#c7aa56; color:#211d14; }
html[data-theme="dark"] .hero-copy h1 { color:#fff; }
html[data-theme="dark"] .hero-copy h2 { color:#e0e3ec; }
html[data-theme="dark"] :is(.public-badges span,.state-badge,.annotation-tag) { background:#283448; color:#dae4f1; border-color:var(--line); }
html[data-theme="dark"] :is(.search-controls,.search-query-field,.underlying-search-toolbar,.underlying-picker,.discovery-guide .info-tile,.faq-group .faq-card,.mobile-app-android,.calendar-events-table-wrap) { background:var(--surface-cool); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] :is(.underlying-search-toolbar button,.sort-direction-toggle,.collection-export .is-export,.billing-profile-grid input,.billing-profile-grid select) { background:var(--surface-strong); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] #about-view .about-project { background:var(--surface); }
html[data-theme="dark"] :is(.faq-answer-list strong,.faq-group h3,.info-tile h3,.underlying-search-toolbar strong) { color:var(--text); }
html[data-theme="dark"] .side-menu .auth-status-trigger { background:var(--surface-strong); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] :is(.underlying-adjustment-badge,.underlyings-table tr.underlying-fixed-valuation>td,.public-table-scroll tr.underlying-fixed-valuation>td) { background:#43272e; color:#ffd0cc; }
html[data-theme="dark"] :is(.filter-help,.search-position-hint,.search-active-filter-empty,.notes-storage-copy,.annotations-empty) { color:var(--muted); }
html[data-theme="dark"] :is(.table-value.is-safe,.table-value-button.is-safe) :is(strong,.table-value-meta,.table-value-sub) { color:var(--green); }
html[data-theme="dark"] :is(.table-value.is-risk,.table-value-button.is-risk) :is(strong,.table-value-meta,.table-value-sub) { color:var(--red); }
html[data-theme="dark"] :is(.calendar-date-status-row.is-pass) { background:var(--green-soft); color:var(--green); }
html[data-theme="dark"] :is(.calendar-date-status-row.is-fail) { background:var(--red-soft); color:var(--red); }
html[data-theme="dark"] :is(.calendar-date-status-row.is-unknown) { background:var(--bg-accent); color:var(--muted); }
html[data-theme="dark"] :is(.info-page p,.info-page li,.faq-item p,.faq-card p,.faq-answer-list li,.editorial-heading p,.section-kicker,.legal-block-body p,.legal-block-body li,.info-tile p) { color:var(--muted); }
html[data-theme="dark"] :is(.info-page strong,.faq-card strong,.legal-block-body strong) { color:var(--text); }
html[data-theme="dark"] hr { border-color:var(--line); }
html[data-theme="dark"] .cert-card-header { background:var(--surface); border-color:var(--line); }
html[data-theme="dark"] .manage-action { background:var(--surface-strong); color:var(--text); border-color:var(--line); }
html[data-theme="dark"] :is(.cert-card-rating-note,.certificate-isin-chip span,.direction-badge-on-dark) { color:#e5ca86; }
html[data-theme="dark"] .direction-badge-on-dark { background:#393222; border-color:#70603d; }
/* Dark-mode polish: stronger collection hierarchy and explicit control states. */
html[data-theme="dark"] .certificate-shell {
 border:1px solid #63748d; border-top:3px solid #9aaec9;
 background:#202b3b; box-shadow:0 5px 18px #00000055;
}
html[data-theme="dark"] .certificate-shell .cert-card-header { background:#253247; }
html[data-theme="dark"] .certificate-shell .cert-card-body { background:#202b3b; }
html[data-theme="dark"] .certificate-shell .certificate-shell-actions { background:#172131; border-top-color:#4b5d76; }
html[data-theme="dark"] .certificate-shell.is-expanded { border-color:#c7aa56; border-top-color:#d6bd7f; }
html[data-theme="dark"] .collection-pagination { color:var(--text); }
html[data-theme="dark"] :is(.pagination-summary,.pagination-size,.pagination-ellipsis) { color:#c4cfde; }
html[data-theme="dark"] .pagination-button { background:#263449; color:#e8edf5; border-color:#63748d; }
html[data-theme="dark"] .pagination-button:hover:not(:disabled) { background:#354862; color:#fff; border-color:#a6b8d0; }
html[data-theme="dark"] .pagination-button.is-active { background:#d6bd7f; color:#211d14; border-color:#d6bd7f; }
html[data-theme="dark"] .pagination-button:disabled { background:#1b2433; color:#8493a8; border-color:#3d4a5d; opacity:1; }
html[data-theme="dark"] .pagination-select { background:#263449; color:#e8edf5; border-color:#63748d; }
html[data-theme="dark"] .events-table-scroll { background:var(--surface); border:1px solid #455570; border-radius:9px; }
html[data-theme="dark"] .events-table { color:var(--text); }
html[data-theme="dark"] .events-table th { background:#2a3950; color:#d9e3f1; }
html[data-theme="dark"] .events-table td { border-color:#3b4b63; }
html[data-theme="dark"] .events-table tbody tr:nth-child(even) { background:#222e40; }
html[data-theme="dark"] .events-table tbody tr:hover { background:#2d3d53; }
html[data-theme="dark"] .events-table small { color:#b8c8dc; }
html[data-theme="dark"] .events-kind { background:#403821; color:#eed49a; border:1px solid #78653d; }
html[data-theme="dark"] .events-sort span,html[data-theme="dark"] .events-sort:hover { color:#e5ca86; }
html[data-theme="dark"] #events-status { color:#c4cfde; }
html[data-theme="dark"] .faq-topics a { background:#29394f; color:#d3e3ff; border:1px solid #63748d; }
html[data-theme="dark"] .faq-topics a:hover { background:#3b3524; color:#eed49a; border-color:#b1975c; }
html[data-theme="dark"] #about-view a:not(.mobile-app-store) { color:#b4cfff; text-decoration:underline; }
html[data-theme="dark"] #about-view a.mobile-app-store { background:#30425c; border:1px solid #8da3c0; color:#fff; }
html[data-theme="dark"] #about-view a.mobile-app-store strong { color:#fff; }
html[data-theme="dark"] #about-view a.mobile-app-store span:not(.mobile-app-arrow) { color:#d3deed; }
html[data-theme="dark"] #about-view a.mobile-app-store:hover { background:#3b5272; border-color:#d6bd7f; }
html[data-theme="dark"] .mobile-app-android { background:#222e40; border-color:#63748d; }
html[data-theme="dark"] .catalog-access-banner { background:linear-gradient(110deg,#302b20,#242c39); border-color:#887548; box-shadow:none; }
html[data-theme="dark"] .catalog-access-banner strong { color:#eed49a; }
html[data-theme="dark"] .catalog-access-banner p { color:#d4dce7; }
html[data-theme="dark"] .access-gate-card { background:#222e40; border-color:#63748d; }
html[data-theme="dark"] :is(.access-gate-card p,.access-gate-note) { color:#c4cfde; }
html[data-theme="dark"] .faq-toggle { background:#29394f; color:#d3e3ff; border-color:#63748d; }
/* Native date inputs must retain readable empty segments as well as values. */
html[data-theme="dark"] input[type="date"] { color-scheme:dark; color:#e8edf5; -webkit-text-fill-color:#e8edf5; opacity:1; }
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-fields-wrapper,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-text,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-day-field,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-month-field,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-year-field { color:#e8edf5; -webkit-text-fill-color:#e8edf5; opacity:1; }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { opacity:1; }

html[data-theme="dark"] .table-favorite-status { color:#e5ca86; }
html[data-theme="dark"] .collection-export { background:transparent; }
