/* The header already uses a dark surface in both themes. */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-block: 4px;
}
.site-header .mobile-menu-toggle {
    color: #e8f0f7;
    background: #193047;
    border-color: #536b80;
}
.theme-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 46%;
    color: #e8f0f7;
}
.theme-icon {
    width: 12px;
    height: 12px;
    flex: none;
    border-radius: 50%;
    background: linear-gradient(90deg, #dce8f2 50%, transparent 50%);
    border: 1px solid #dce8f2;
}
.theme-control select {
    min-height: 28px;
    max-width: 100%;
    padding: 2px 6px;
    color: inherit;
    border: 1px solid #536b80;
    border-radius: 6px;
    background: #193047;
    color-scheme: dark;
    font: inherit;
}
@media (max-width: 780px) {
    .theme-control select { min-height: 36px; }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --night-page: #101923;
    --night-surface: #162330;
    --night-raised: #1c2d3d;
    --night-field: #111d29;
    --night-border: #3a5265;
    --night-text: #e7eef5;
    --night-muted: #b7c8d7;
    --night-accent: #ffd1a4;
    --night-accent-surface: #382a25;
    --night-accent-border: #aa6742;
    --text-main: var(--night-text);
    --text-muted: var(--night-muted);
    --border-line: var(--night-border);
}

[data-theme="dark"] body {
    background: var(--night-page);
    color: var(--night-text);
}
[data-theme="dark"] .hero-art {
    filter: brightness(.78);
}
[data-theme="dark"] :is(.hub-section, .release-list, .hub-empty, .modal .modal-content, .nav-menu) {
    background: var(--night-surface);
    color: var(--night-text);
    border-color: var(--night-border);
}
[data-theme="dark"] :is(.product-card, .card, .product-symbol, .bottom-nav, .lang-dropdown, .mobile-menu-header,
    .mobile-menu-close, .nav-link, .product-link, .dropdown-menu,
    .modal .modal-header, .modal .modern-header, .modal .firmware-item,
    .modal .search-result-item, .modal .contact-card, .modal .news-item,
    .panel-dashboard, .res-card, .sat-info-display, .modern-compass) {
    background: var(--night-raised);
    color: var(--night-text);
    border-color: var(--night-border);
}
[data-theme="dark"] :is(.section-head h2, .card h2, .product-title, .bottom-nav a, .bottom-nav button,
    .modal .modal-header h2, .modal .close-btn, .modal .fw-version, .modal .search-result-item h3,
    .modal .contact-card strong, .modal .news-item h3, .header-title h2, .res-val) {
    color: var(--night-text);
}
[data-theme="dark"] :is(.section-head p, .card p, .product-category, .hub-empty, .release-row time, .release-info span,
    .modal .modal-subtitle, .modal .empty-state, .modal .fw-date, .modal .news-date, .modal .release-notes,
    #releaseNotesVersion, .section-label, .input-group label, .res-label, .compass-label, .c-txt) {
    color: var(--night-muted);
}
[data-theme="dark"] :is(.search-container, .search-input, .search-input:focus, .catalog-search,
    .notes-language select, .modern-input, .modern-select) {
    background: var(--night-field);
    border-color: var(--night-border);
    color: var(--night-text);
}
[data-theme="dark"] :is(.search-input, .catalog-search, .modern-input)::placeholder {
    color: var(--night-muted);
}
[data-theme="dark"] :is(.secondary-btn, .filter-chip, .resource-chip, .resource-tab,
    .release-notes-button, .compass-toggle, .modal .resource-choice-btn:disabled) {
    color: var(--night-text);
    background: var(--night-field);
    border-color: var(--night-border);
}
[data-theme="dark"] :is(.secondary-btn:hover, .filter-chip:hover, .resource-chip:not(:disabled):hover,
    .release-notes-button:hover, .resource-tab:hover, .modal .close-btn:hover,
    .lang-dropdown button:hover, .contact-card:hover) {
    background: var(--night-raised);
    border-color: #6a8297;
}
[data-theme="dark"] :is(.resource-tab[aria-selected="true"], .filter-chip[aria-pressed="true"], .secondary-btn[aria-pressed="true"],
    .recent-update, .modal .firmware-item.is-latest, .modal .verification-badge) {
    background: var(--night-accent-surface);
    color: var(--night-accent);
    border-color: var(--night-accent-border);
}
[data-theme="dark"] :is(.latest-version, .release-download, .card-action, #releaseNotesSource,
    .text-btn, .modern-btn-cover, .res-val.highlight, .c-txt.n) { color: var(--night-accent); }
[data-theme="dark"] :is(.resource-tabs, .release-row + .release-row, .product-latest, .nav-item, .product-group,
    .lang-dropdown li + li) { border-color: var(--night-border); }
[data-theme="dark"] :is(.search-btn, .latest-download, .modal .fw-download-btn,
    .modal .resource-choice-btn:not(:disabled), .modern-btn-main, .compass-toggle.active) {
    color: #fff3e7;
    background: #913e19;
    border-color: #b46844;
}
[data-theme="dark"] :is(.search-btn:hover, .latest-download:hover, .modal .fw-download-btn:hover,
    .modal .resource-choice-btn:not(:disabled):hover, .modern-btn-main:hover) { background: #a64b21; }
[data-theme="dark"] :is(.modern-btn-cover, .header-title span) { background: var(--night-field); }
[data-theme="dark"] .header-title span { color: var(--night-muted); }
[data-theme="dark"] .needle-body { background: var(--night-muted); }
[data-theme="dark"] .status-badge.success { color: #a9dfbf; background: #203c32; }
[data-theme="dark"] :is(.status-badge.error, .status-badge.unavailable) { color: #ffd3cd; background: #482d31; }
[data-theme="dark"] :is(.form-error, .res-val.danger-value) { color: #ffb8ad; }
[data-theme="dark"] :focus-visible { outline-color: #ffb67d; }
