:root{--bs-body-color:var(--text-primary);--bs-body-bg:var(--background);--bs-border-color:var(--border)}
:root[data-theme=dark]{color-scheme:dark;--background:#121212;--surface:#1c1c1c;--surface-secondary:#262626;--text-primary:#f2f2f2;--text-secondary:#b8b8b8;--text-tertiary:#aaa;--border:#3b3b3b;--accent:#9fc4f3;--accent-soft:#253445;--success:#89d6b0;--danger:#ffabb5;--shadow:0 8px 32px #0001;--heading:var(--text-primary);--body:var(--text-primary);--muted:var(--text-secondary);--link:var(--accent);--border-strong:#707070;--primary:#e7e7e7;--on-primary:#191919;--primary-hover:#fff;--secondary:var(--surface-secondary);--focus:#9fc4f3;--warning:#eed7a5;--warning-soft:#403727;--info:var(--accent);--info-soft:var(--accent-soft);--danger-soft:#442831;--success-soft:#1d3b32;--bs-body-color:#f2f2f2;--bs-body-bg:#121212;--bs-secondary-color:#b8b8b8;--bs-border-color:#3b3b3b;--bs-tertiary-bg:#262626;--bs-secondary-bg:#262626}
[data-theme=dark] :is(.public-body,.admin-body,.setup-body){background:var(--background);color:var(--text-primary)}
[data-theme=dark] :is(.site-header,.admin-sidebar,.admin-topbar,.news-card,.story-card,.story,.metric-card,.feed-skeleton,.mobile-menu,.help-toc,.nd-comment,.nd-comment-form,.nd-ad,.ad-preview,.card,.dropdown-menu){background:var(--surface);color:var(--text-primary);border-color:var(--border)}
[data-theme=dark] :is(.news-card h2 a,.story-header h1,.site-wordmark,.site-footer strong,.admin-brand){color:var(--text-primary)}
[data-theme=dark] :is(.site-topnav a,.category-track a,.admin-nav a,.sidebar-bottom a,.sidebar-bottom button,.card-meta,.story-byline,.live-mark,.story-modified,.clean-table code){color:var(--text-secondary)}
[data-theme=dark] :is(.language-switch,.count-pill,.user-avatar,.state-tag,.note-box,.placeholder-icon,.code-line,.queue-counts span,.section-number,.skeleton-line,.nd-comment-reply,.help-search){background:var(--surface-secondary);color:var(--text-secondary)}
[data-theme=dark] :is(.language-switch a[aria-current=page],.admin-nav a.active){background:var(--accent-soft);color:var(--accent)}
[data-theme=dark] :is(.admin-nav a:hover,.sidebar-bottom a:hover,.sidebar-bottom button:hover,.pagination a,.page-link){background:var(--surface-secondary);color:var(--accent)}
[data-theme=dark] :is(.form-control,.form-select,input,textarea,select){background-color:var(--surface);color:var(--text-primary);border-color:var(--border)}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:var(--text-tertiary);opacity:1}
[data-theme=dark] .table{--bs-table-bg:var(--surface);--bs-table-color:var(--text-primary);--bs-table-border-color:var(--border);--bs-table-striped-bg:var(--surface-secondary);--bs-table-hover-bg:var(--surface-secondary);--bs-table-hover-color:var(--text-primary)}
[data-theme=dark] .table :is(th,td){border-color:var(--border)}
[data-theme=dark] :is(.btn-light,.btn-outline-dark){background:var(--surface-secondary);color:var(--text-primary);border-color:var(--border)}
[data-theme=dark] :is(.btn-light:hover,.btn-light:focus-visible,.btn-outline-dark:hover,.btn-outline-dark:focus-visible){background:var(--accent-soft);color:var(--accent)}
[data-theme=dark] :is(.btn-dark,.btn-dark:hover,.btn-dark:focus-visible){background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
[data-theme=dark] .alert{color:var(--text-primary);background:#292929;border-color:#5c5c5c}
[data-theme=dark] .alert-danger{background:#442831;color:#ffc6cc;border-color:#995966}
[data-theme=dark] .alert-success{background:#1d3b32;color:#b0e6cf;border-color:#407f67}
[data-theme=dark] .alert-warning{background:#403727;color:#eed7a5;border-color:#8b784e}
[data-theme=dark] :is(.status-pill.ready,.state-tag.on){background:#1d3b32;color:#a7e5ca}
[data-theme=dark] .status-pill.paused{background:#292929;color:#c6c6c6}
[data-theme=dark] .status-pill.danger{background:#482a32;color:#ffc0c8}
[data-theme=dark] :is(.site-footer,.category-rail,.card-actions,.card-bottom,.story-sources,.status-list>div,.info-list>div,.setting-switch,.health-grid>div,.panel-footnote){border-color:var(--border)}
[data-theme=dark] :is(.story-prose,.story-lead,.news-card p,.help-section p,.nd-comment p){color:var(--text-primary)}
[data-theme=dark] :is(.nd-ad-label,.field-note,.page-description,.muted,.nd-comment-meta){color:var(--text-secondary)}
[data-theme=dark] :is(.nd-ad-copy,.evergreen-card,.analytics-chart,.fact-context,.qa-summary){background:var(--surface);color:var(--text-primary)}
[data-theme=dark] .bg-light{background-color:var(--surface-secondary)!important}.text-muted{color:var(--text-secondary)!important}
[data-theme=dark] :focus-visible{outline-color:#9fc4f3}

@media(prefers-color-scheme:dark){

:is(:root:not([data-theme]),:root[data-theme=""]){color-scheme:dark;--background:#121212;--surface:#1c1c1c;--surface-secondary:#262626;--text-primary:#f2f2f2;--text-secondary:#b8b8b8;--text-tertiary:#aaa;--border:#3b3b3b;--accent:#9fc4f3;--accent-soft:#253445;--success:#89d6b0;--danger:#ffabb5;--shadow:0 8px 32px #0001;--heading:var(--text-primary);--body:var(--text-primary);--muted:var(--text-secondary);--link:var(--accent);--border-strong:#707070;--primary:#e7e7e7;--on-primary:#191919;--primary-hover:#fff;--secondary:var(--surface-secondary);--focus:#9fc4f3;--warning:#eed7a5;--warning-soft:#403727;--info:var(--accent);--info-soft:var(--accent-soft);--danger-soft:#442831;--success-soft:#1d3b32;--bs-body-color:#f2f2f2;--bs-body-bg:#121212;--bs-secondary-color:#b8b8b8;--bs-border-color:#3b3b3b;--bs-tertiary-bg:#262626;--bs-secondary-bg:#262626}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.public-body,.admin-body,.setup-body){background:var(--background);color:var(--text-primary)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.site-header,.admin-sidebar,.admin-topbar,.news-card,.story-card,.story,.metric-card,.feed-skeleton,.mobile-menu,.help-toc,.nd-comment,.nd-comment-form,.nd-ad,.ad-preview,.card,.dropdown-menu){background:var(--surface);color:var(--text-primary);border-color:var(--border)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.news-card h2 a,.story-header h1,.site-wordmark,.site-footer strong,.admin-brand){color:var(--text-primary)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.site-topnav a,.category-track a,.admin-nav a,.sidebar-bottom a,.sidebar-bottom button,.card-meta,.story-byline,.live-mark,.story-modified,.clean-table code){color:var(--text-secondary)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.language-switch,.count-pill,.user-avatar,.state-tag,.note-box,.placeholder-icon,.code-line,.queue-counts span,.section-number,.skeleton-line,.nd-comment-reply,.help-search){background:var(--surface-secondary);color:var(--text-secondary)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.language-switch a[aria-current=page],.admin-nav a.active){background:var(--accent-soft);color:var(--accent)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.admin-nav a:hover,.sidebar-bottom a:hover,.sidebar-bottom button:hover,.pagination a,.page-link){background:var(--surface-secondary);color:var(--accent)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.form-control,.form-select,input,textarea,select){background-color:var(--surface);color:var(--text-primary);border-color:var(--border)}
:is(:root:not([data-theme]),:root[data-theme=""]) input::placeholder,:is(:root:not([data-theme]),:root[data-theme=""]) textarea::placeholder{color:var(--text-tertiary);opacity:1}
:is(:root:not([data-theme]),:root[data-theme=""]) .table{--bs-table-bg:var(--surface);--bs-table-color:var(--text-primary);--bs-table-border-color:var(--border);--bs-table-striped-bg:var(--surface-secondary);--bs-table-hover-bg:var(--surface-secondary);--bs-table-hover-color:var(--text-primary)}
:is(:root:not([data-theme]),:root[data-theme=""]) .table :is(th,td){border-color:var(--border)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.btn-light,.btn-outline-dark){background:var(--surface-secondary);color:var(--text-primary);border-color:var(--border)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.btn-light:hover,.btn-light:focus-visible,.btn-outline-dark:hover,.btn-outline-dark:focus-visible){background:var(--accent-soft);color:var(--accent)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.btn-dark,.btn-dark:hover,.btn-dark:focus-visible){background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
:is(:root:not([data-theme]),:root[data-theme=""]) .alert{color:var(--text-primary);background:#292929;border-color:#5c5c5c}
:is(:root:not([data-theme]),:root[data-theme=""]) .alert-danger{background:#442831;color:#ffc6cc;border-color:#995966}
:is(:root:not([data-theme]),:root[data-theme=""]) .alert-success{background:#1d3b32;color:#b0e6cf;border-color:#407f67}
:is(:root:not([data-theme]),:root[data-theme=""]) .alert-warning{background:#403727;color:#eed7a5;border-color:#8b784e}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.status-pill.ready,.state-tag.on){background:#1d3b32;color:#a7e5ca}
:is(:root:not([data-theme]),:root[data-theme=""]) .status-pill.paused{background:#292929;color:#c6c6c6}
:is(:root:not([data-theme]),:root[data-theme=""]) .status-pill.danger{background:#482a32;color:#ffc0c8}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.site-footer,.category-rail,.card-actions,.card-bottom,.story-sources,.status-list>div,.info-list>div,.setting-switch,.health-grid>div,.panel-footnote){border-color:var(--border)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.story-prose,.story-lead,.news-card p,.help-section p,.nd-comment p){color:var(--text-primary)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.nd-ad-label,.field-note,.page-description,.muted,.nd-comment-meta){color:var(--text-secondary)}
:is(:root:not([data-theme]),:root[data-theme=""]) :is(.nd-ad-copy,.evergreen-card,.analytics-chart,.fact-context,.qa-summary){background:var(--surface);color:var(--text-primary)}
:is(:root:not([data-theme]),:root[data-theme=""]) .bg-light{background-color:var(--surface-secondary)!important}.text-muted{color:var(--text-secondary)!important}
:is(:root:not([data-theme]),:root[data-theme=""]) :focus-visible{outline-color:#9fc4f3}

}

/* Bootstrap clears form outlines on focus; keep keyboard focus visible in both themes. */
.form-control:focus-visible,.form-select:focus-visible{outline:3px solid var(--focus);outline-offset:3px;border-color:var(--focus)}
