/* Rental System dark-mode contract adapted to Stock Agent's component names. */
:root:is(.theme-dark, [data-theme="dark"]) {
  color-scheme: dark;
  --dark-bg: #0d1621;
  --dark-bg-top: #101b28;
  --dark-panel: #152231;
  --dark-panel-raised: #172638;
  --dark-panel-muted: #1d2d3f;
  --dark-panel-inset: #101d2b;
  --dark-toolbar: #142335;
  --dark-text: #e8f1f8;
  --dark-heading: #f2f8fc;
  --dark-secondary: #c8d9e6;
  --dark-supporting: #b9cfdf;
  --dark-muted: #a9bac8;
  --dark-placeholder: #7f93a6;
  --dark-accent: #38bdf8;
  --dark-accent-strong: #7dd3fc;
  --dark-accent-soft: #123447;
  --dark-border: #365068;
  --dark-border-strong: #58728a;
  --dark-table-head: #29475f;
  --dark-table-stripe: #1b3043;
  --dark-table-hover: #28516b;
  --dark-selected: #17506b;
  --dark-hover: #25445d;
  --dark-success: #34d399;
  --dark-success-bg: #173d32;
  --dark-success-text: #a7f3d0;
  --dark-warning: #fbbf24;
  --dark-warning-bg: #3b3017;
  --dark-warning-text: #fff4cf;
  --dark-danger: #f87171;
  --dark-danger-bg: #48252c;
  --dark-danger-text: #fecaca;
  --dark-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --xero-blue: #38bdf8;
  --xero-blue-deep: #7dd3fc;
  --xero-blue-soft: #123447;
  --xero-blue-tint: #172f42;
  --xero-ink: #f2f8fc;
  --xero-text: #e8f1f8;
  --xero-muted: #a9bac8;
  --xero-line: #365068;
  --xero-line-strong: #58728a;
  --xero-panel: #152231;
  --xero-surface: #0d1621;
  --xero-success: #34d399;
  --xero-danger: #f87171;
  --xero-warning: #fbbf24;
  --xero-shadow: var(--dark-shadow);
  --xero-table-head: #29475f;
  --xero-table-row: #1b3043;
  --rs-surface: #152231;
  --rs-surface-muted: #1d2d3f;
  --rs-border: #365068;
  --rs-text: #e8f1f8;
  --rs-text-soft: #b9cfdf;
  --rs-muted: #a9bac8;
  --rs-pill-bg: #1d2d3f;
  --rs-pill-border: rgba(125, 211, 252, 0.48);
  --rs-pill-text: #d7e7f2;
  --rs-table-head: #29475f;
  --rs-table-row-alt: #1b3043;
  --rs-table-row-hover: #28516b;
  --chart-series-1: #38bdf8;
  --chart-series-2: #34d399;
  --chart-series-3: #fbbf24;
  --chart-series-4: #a78bfa;
  --chart-series-5: #fb7185;
  --chart-grid: rgba(125, 211, 252, 0.28);
  --chart-axis: #e2eef5;
  --chart-tooltip-bg: #172638;
  --chart-tooltip-text: #f2f8fc;
  scrollbar-color: #58728a #101b28;
}

:root:is(.theme-dark, [data-theme="dark"]) body {
  color: var(--dark-text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 30%),
    linear-gradient(180deg, var(--dark-bg-top) 0%, var(--dark-bg) 100%);
}

:root:is(.theme-dark, [data-theme="dark"]) a { color: #93ddff; }
:root:is(.theme-dark, [data-theme="dark"]) a:hover { color: #e0f7ff; }
:root:is(.theme-dark, [data-theme="dark"]) :is(h1, h2, h3, h4, h5, h6) { color: var(--dark-heading); }
:root:is(.theme-dark, [data-theme="dark"]) :is(p, li, dd, td) { text-decoration-color: currentColor; }
:root:is(.theme-dark, [data-theme="dark"]) :is(small, .helper-text, .muted, .secondary-text) { color: var(--dark-muted); }
:root:is(.theme-dark, [data-theme="dark"]) label { color: var(--dark-supporting); }

/* App chrome and navigation */
:root:is(.theme-dark, [data-theme="dark"]) :is(.main-header-shell, .bottom-status-bar) {
  border-color: rgba(88, 114, 138, 0.85);
  background: rgba(21, 34, 49, 0.98);
  color: var(--dark-text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.sidebar, .right-rail) {
  border-color: rgba(88, 114, 138, 0.72);
  background: linear-gradient(180deg, #172638 0%, #101d2b 100%);
  color: var(--dark-text);
  box-shadow: 14px 0 34px rgba(0, 0, 0, 0.28);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.nav-item, .quick-links li, .top-nav-menu > summary, .top-nav-link) {
  border-color: rgba(88, 114, 138, 0.58);
  background: rgba(29, 45, 63, 0.86);
  color: var(--dark-secondary);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.nav-item.active, .nav-item:hover, .quick-links li:hover, .top-nav-link:hover) {
  border-color: rgba(125, 211, 252, 0.48);
  background: var(--dark-selected);
  color: #dff5ff;
}
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-trigger {
  color: var(--dark-supporting);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .nav-dropdown-trigger.active,
  .nav-dropdown.active > .nav-dropdown-trigger,
  .nav-dropdown:hover > .nav-dropdown-trigger,
  .nav-dropdown:focus-within > .nav-dropdown-trigger
) {
  border-color: rgba(125, 211, 252, 0.34);
  background: var(--dark-selected);
  color: #dff5ff;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.34);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.nav-menu-icon, .nav-group-icon) {
  background: var(--dark-accent-soft);
  color: var(--dark-accent-strong);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.16);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.mobile-bottom-nav-host, .mobile-bottom-nav, .top-nav-menu[open] .top-nav-menu-panel) {
  border-color: var(--dark-border-strong);
  background: var(--dark-toolbar);
  color: var(--dark-text);
}

/* Panels, cards and inset sections */
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .page-busy-panel, .sidebar-card, .right-rail-note, .notification-summary, .notification-item,
  .price-alert-toast, .table-card, .chart-card, .metric-card, .hero-summary, .summary-card,
  .dashboard-card, .panel, .card, .widget, .stock-card, .app-about-hero, .app-about-version-badge,
  .overview-reporting-notes, .overview-rule-item, .system-form-field, .governance-settings-ledger,
  .watchlist-chip-card, .rule-breakers-card, .rule-breakers-side-panel, .tag-card, .auth-panel
) {
  border-color: var(--dark-border);
  background: linear-gradient(180deg, var(--dark-panel) 0%, var(--dark-panel-muted) 100%);
  color: var(--dark-text);
  box-shadow: var(--dark-shadow);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .system-metric-card, .metric-row, .app-about-data-row, .company-detail-grid > div,
  .company-price-stat, .score-category-meter, .score-summary-row, .confirm-modal-detail,
  .fx-modal-stat, .daily-change-total-card, .rule-explain-item, .tag-context-grid > div,
  .taxonomy-category, .tag-muted-panel, .delete-summary, .password-policy
) {
  border-color: var(--dark-border);
  background: var(--dark-panel-inset);
  color: var(--dark-secondary);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.brand-mark, .sidebar-toggle, .right-rail-toggle) {
  border-color: var(--dark-border-strong);
  background: var(--dark-panel-raised);
  color: var(--dark-accent-strong);
}

/* Forms and controls */
:root:is(.theme-dark, [data-theme="dark"]) :is(input, select, textarea) {
  border-color: var(--dark-border-strong);
  background: #101b28;
  color: var(--dark-text);
  box-shadow: inset 0 0 0 1px rgba(88, 114, 138, 0.28);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(input, textarea)::placeholder { color: var(--dark-placeholder); }
:root:is(.theme-dark, [data-theme="dark"]) :is(input, select, textarea, button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--dark-accent-strong);
  outline-offset: 2px;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .utility-btn, .secondary-action, .tag-button.secondary, .rule-breakers-button.secondary,
  .toolbar-button.secondary, .action-icon-button, .table-icon-btn, .score-help-trigger,
  .password-visibility-toggle, .company-price-range-btn, .fx-range-btn
) {
  border-color: rgba(125, 211, 252, 0.48);
  background: var(--dark-panel-muted);
  color: var(--dark-secondary);
  box-shadow: none;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .utility-btn, .secondary-action, .tag-button.secondary, .rule-breakers-button.secondary,
  .toolbar-button.secondary, .action-icon-button, .table-icon-btn, .score-help-trigger,
  .password-visibility-toggle, .company-price-range-btn, .fx-range-btn
):hover {
  background: #29475f;
  color: var(--dark-heading);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(button, .btn, .icon-button):disabled {
  border-color: rgba(88, 114, 138, 0.42);
  background: #223246;
  color: #8fa9bc;
  box-shadow: none;
}

/* Status bar and the light/dark pill */
:root:is(.theme-dark, [data-theme="dark"]) .bottom-status-pill {
  border-color: var(--dark-border-strong);
  background: var(--dark-panel-raised);
  color: var(--dark-secondary);
}
:root:is(.theme-dark, [data-theme="dark"]) .bottom-status-pill strong { color: var(--dark-heading); }
.theme-mode-toggle { cursor: pointer; white-space: nowrap; }
.theme-mode-toggle [data-theme-toggle-icon] { width: 1.2em; text-align: center; font-size: 1.05em; line-height: 1; }
:root:is(.theme-dark, [data-theme="dark"]) .theme-mode-toggle {
  border-color: rgba(125, 211, 252, 0.58);
  background: var(--dark-selected);
  color: var(--dark-primary-text, #dff5ff);
}

/* Overview metrics: remove the light-theme label fade and strengthen key values. */
:root:is(.theme-dark, [data-theme="dark"]) .page-overview .overview-summary-bar .monitoring-status-pill {
  border-color: rgba(125, 211, 252, 0.52);
  background: linear-gradient(180deg, #1b3246 0%, #172a3c 100%);
  color: var(--dark-supporting);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 8px 18px rgba(0, 0, 0, 0.16);
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview .overview-summary-bar .monitoring-status-pill > span {
  color: #c8d9e6;
  opacity: 1;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview .overview-summary-bar .monitoring-status-pill > strong {
  color: #9fe3ff;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview .overview-summary-bar .overview-metric-note:not(.value-positive):not(.value-negative) {
  color: #b9cfdf;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview .overview-summary-bar .monitoring-status-pill:is([class*="target-change-up-"], [class*="target-change-down-"]) > :is(span, strong, em) {
  color: inherit !important;
}

/* Tables and DataTables */
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .table-wrap, .system-table, .system-table-wrap, .tag-table-wrap, .rule-breakers-table-wrap,
  .company-valuation-table, table, table.dataTable
) {
  border-color: var(--dark-border);
  background: var(--dark-panel);
  color: var(--dark-text);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(thead th, table.dataTable thead th, .system-table th) {
  border-color: var(--dark-border-strong) !important;
  background: var(--dark-table-head) !important;
  color: var(--dark-text) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(th, td, table.dataTable tbody th, table.dataTable tbody td) {
  border-color: var(--dark-border) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) tbody tr:nth-child(even):not([class*="price-alert-"]):not([class*="score-band-"]),
:root:is(.theme-dark, [data-theme="dark"]) tbody tr:nth-child(even):not([class*="price-alert-"]):not([class*="score-band-"]) > td {
  background: var(--dark-table-stripe) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) tbody tr:hover,
:root:is(.theme-dark, [data-theme="dark"]) tbody tr:hover > td {
  background: var(--dark-table-hover) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) table.dataTable > tbody > tr:not([class*="price-alert-"]):not([class*="score-band-"]) > * {
  background-color: var(--dark-panel) !important;
  color: var(--financial-direction-color, var(--dark-secondary)) !important;
  box-shadow: none !important;
}
:root:is(.theme-dark, [data-theme="dark"]) table.dataTable > tbody > tr:nth-child(even):not([class*="price-alert-"]):not([class*="score-band-"]) > * {
  background-color: var(--dark-table-stripe) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) table.dataTable.display > tbody > tr.odd > *,
:root:is(.theme-dark, [data-theme="dark"]) table.dataTable.stripe > tbody > tr.odd > * {
  box-shadow: none !important;
}
:root:is(.theme-dark, [data-theme="dark"]) table.dataTable > tbody > tr:not([class*="score-band-"]):hover > * {
  background-color: var(--dark-table-hover) !important;
  color: var(--financial-direction-color, var(--dark-heading)) !important;
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.015) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable > tbody > tr > * {
  color: var(--financial-direction-color, #d7e7f2) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable > tbody > tr:nth-child(even) > * {
  background-color: var(--dark-table-stripe) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable > tbody > tr:hover > * {
  background-color: var(--dark-table-hover) !important;
  color: var(--financial-direction-color, #f2f8fc) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable .company-ticker-button {
  border-color: rgba(125, 211, 252, 0.58);
  background: #17384d;
  color: #b9eaff;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable :is(.analyst-pill, .ai-action-pill) {
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.14);
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable .ai-action-pill {
  border: 1px solid #4b6b83 !important;
  background: #20364a !important;
  color: #e4f2f9 !important;
  box-shadow: none !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable .ai-action-pill:is(.increase, .add) {
  border-color: #278a66 !important;
  background: #123f32 !important;
  color: #a7f3d0 !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable .ai-action-pill.hold {
  border-color: #2688ad !important;
  background: #17384d !important;
  color: #bae6fd !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .page-overview #allocationTable .ai-action-pill:is(.sell, .avoid) {
  border-color: #b94c5b !important;
  background: #4a2530 !important;
  color: #fecaca !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-watch-lists .ai-action-pill {
  border: 1px solid #4b6b83 !important;
  background: #20364a !important;
  color: #e4f2f9 !important;
  box-shadow: none !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-watch-lists .ai-action-pill:is(.increase, .add) {
  border-color: #278a66 !important;
  background: #123f32 !important;
  color: #a7f3d0 !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-watch-lists .ai-action-pill.hold {
  border-color: #2688ad !important;
  background: #17384d !important;
  color: #bae6fd !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-watch-lists .ai-action-pill:is(.sell, .avoid) {
  border-color: #b94c5b !important;
  background: #4a2530 !important;
  color: #fecaca !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .ai-action-pill {
  border: 1px solid #4b6b83 !important;
  background: #20364a !important;
  color: #e4f2f9 !important;
  box-shadow: none !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .ai-action-pill:is(.increase, .add) {
  border-color: #278a66 !important;
  background: #123f32 !important;
  color: #a7f3d0 !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .ai-action-pill.hold {
  border-color: #2688ad !important;
  background: #17384d !important;
  color: #bae6fd !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .ai-action-pill:is(.sell, .avoid) {
  border-color: #b94c5b !important;
  background: #4a2530 !important;
  color: #fecaca !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-ai-decisions .decision-detail-full {
  color: #d7e7f2 !important;
  font-weight: 600;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-ai-decisions .decision-detail-compact {
  color: #9fe3ff !important;
  font-weight: 800;
}
:root:is(.theme-dark, [data-theme="dark"]) table.dataTable > tbody > tr.selected > * {
  background-color: var(--dark-selected) !important;
  color: var(--financial-direction-color, #dff5ff) !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.22) !important;
}

/* Portfolio risk tables: keep neutral figures readable without masking gain/loss states. */
:root:is(.theme-dark, [data-theme="dark"]) body.page-portfolio-risk :is(.system-table, table.dataTable) > tbody > tr > * {
  color: var(--financial-direction-color, #d7e7f2) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-portfolio-risk :is(.system-table, table.dataTable) > tbody > tr > * .money-tooltip {
  color: var(--financial-direction-color, #d7e7f2) !important;
  font-weight: 600;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-portfolio-risk :is(.system-table, table.dataTable) > tbody > tr:hover > * {
  color: var(--financial-direction-color, var(--dark-heading)) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.dataTables_info, .dataTables_length, .dataTables_filter, .dataTables_paginate) {
  color: var(--dark-supporting) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .dataTables_wrapper .dataTables_paginate .paginate_button {
  border-color: var(--dark-border) !important;
  background: var(--dark-panel-muted) !important;
  color: var(--dark-secondary) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  border-color: rgba(125, 211, 252, 0.48) !important;
  background: var(--dark-selected) !important;
  color: #dff5ff !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.system-table tfoot th, table.dataTable tfoot th) {
  border-color: var(--dark-border-strong) !important;
  background: var(--dark-toolbar) !important;
  color: var(--dark-heading) !important;
}

/* Tabs, menus, pills and tooltips */
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .system-tab-btn, .company-modal-tab, .score-modal-tab, .nav-tab, .tab-button, [role="tab"]
) {
  border-color: rgba(88, 114, 138, 0.72);
  background: var(--dark-panel-muted);
  color: #c7d8e5;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .system-tab-btn.is-active, .company-modal-tab.is-active, .score-modal-tab.is-active,
  .nav-tab.active, .tab-button.active, [role="tab"][aria-selected="true"]
) {
  border-color: rgba(125, 211, 252, 0.48);
  background: var(--dark-selected);
  color: #dff5ff;
  box-shadow: inset 0 -2px 0 var(--dark-accent-strong);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .top-nav-menu-panel, .nav-dropdown-menu, .rule-breakers-column-panel, .system-ticker-panel, .analyst-panel,
  .score-help-panel, .bottom-status-tooltip-panel, .sidebar-chart-tooltip, .ticker-news-tooltip,
  .ai-action-tooltip, .kpi-tooltip-panel, .dropdown-menu,
  .context-menu, .popover, .suggestion-panel, [role="menu"], [role="listbox"], [role="tooltip"]
) {
  border-color: rgba(88, 114, 138, 0.9);
  background: var(--dark-panel-raised);
  color: var(--dark-secondary);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .system-ticker-title, .analyst-panel-title, .ticker-news-title, .ai-action-tooltip-title,
  .score-help-title, .kpi-tooltip-panel-title, .bottom-status-tooltip-title, .sidebar-chart-tooltip-title
) {
  color: var(--dark-heading) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .system-ticker-subtitle, .ticker-news-source, .ai-action-tooltip-copy, .ai-action-tooltip-label,
  .kpi-tooltip-panel-copy, .bottom-status-tooltip-line, .sidebar-chart-tooltip-copy
) {
  color: var(--dark-supporting) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .analyst-panel-list, .analyst-panel-list li, .ticker-news-summary-item, .ticker-news-summary-item strong,
  .ticker-news-list, .ai-action-tooltip-value, .ai-action-tooltip-list, .bottom-status-tooltip-list
) {
  color: #d7e7f2 !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .ticker-news-summary-item span {
  color: var(--dark-supporting) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.ticker-news-list a, .ai-action-tooltip a, .analyst-panel a) {
  color: #9fe3ff !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.ticker-news-list a, .ai-action-tooltip a, .analyst-panel a):hover {
  color: var(--dark-heading) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown-menu,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown-menu-right {
  border-color: rgba(88, 114, 138, 0.9);
  background: var(--dark-panel-raised);
  color: var(--dark-secondary);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu a,
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu .nav-dropdown-action {
  color: #d7e7f2;
}
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu a.active,
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu a:hover,
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu a:focus-visible,
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu .nav-dropdown-action:hover,
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-menu .nav-dropdown-action:focus-visible {
  background: var(--dark-hover);
  color: var(--dark-heading);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.34);
}
:root:is(.theme-dark, [data-theme="dark"]) .nav-dropdown-divider {
  background: rgba(125, 151, 174, 0.48);
}

/* Currency conversion hover: the NZD label is rendered with pseudo-elements. */
:root:is(.theme-dark, [data-theme="dark"]) .money-tooltip::before {
  border-color: rgba(125, 211, 252, 0.58);
  background: #20364a;
  color: #f2f8fc;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.46);
}
:root:is(.theme-dark, [data-theme="dark"]) .money-tooltip::after {
  border-color: rgba(125, 211, 252, 0.58);
  background: #20364a;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host > nav {
  border-top-color: rgba(88, 114, 138, 0.9);
  background: rgba(18, 32, 46, 0.98);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.34);
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .main-header-shell {
  border-bottom: 0;
  box-shadow: none;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown-trigger {
  border-color: transparent;
  background: transparent;
  color: #c7d9e7;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-group-icon {
  background: #20384d !important;
  color: #9de3ff !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.3) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown.active > .nav-dropdown-trigger,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown:hover > .nav-dropdown-trigger,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown:focus-within > .nav-dropdown-trigger {
  border-color: rgba(125, 211, 252, 0.48);
  background: #17384d;
  color: #dff5ff;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.28);
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown.active > .nav-dropdown-trigger .nav-group-icon,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown:hover > .nav-dropdown-trigger .nav-group-icon,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown:focus-within > .nav-dropdown-trigger .nav-group-icon {
  background: #29506a !important;
  color: #dff5ff !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.48) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .nav-dropdown-menu :is(.nav-menu-icon, .nav-group-icon) {
  background: #20384d !important;
  color: #9de3ff !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.28) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .top-nav-right .utility-btn {
  border-color: rgba(125, 211, 252, 0.48) !important;
  background: #1b3044 !important;
  color: #dff5ff !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.18) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .top-nav-right .utility-btn:hover,
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .top-nav-right .utility-btn:focus-visible {
  border-color: rgba(125, 211, 252, 0.72) !important;
  background: #29475f !important;
  color: #ffffff !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .mobile-theme-toggle {
  border-color: rgba(125, 211, 252, 0.52);
  background: #17384d;
  color: #b9eaff;
}
:root:is(.theme-dark, [data-theme="dark"]) body.compact-feature-mode .mobile-bottom-nav-host .mobile-theme-toggle [data-theme-toggle-icon] {
  background: #203f55;
  color: #dff5ff;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .pill, .article-modal-pill, .monitoring-status-pill, .company-tag-badge,
  .system-ticker-label, .system-ticker-summary span, .intent-broker-status
) {
  border-color: var(--dark-border-strong);
  background: var(--dark-panel-muted);
  color: var(--dark-secondary);
}

/* Dialogs and pop-ups */
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .article-modal, .company-modal, .score-modal, .overview-modal, .modal-shell
) {
  background: rgba(0, 0, 0, 0.62);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.modal-backdrop, .dialog-backdrop, .popup-backdrop) {
  background: rgba(0, 0, 0, 0.62);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .article-modal-panel, .company-modal-panel, .score-modal-panel, .overview-modal-panel,
  .modal-card, .dialog-card, .popup-panel
) {
  border-color: var(--dark-border);
  background: var(--dark-panel);
  color: var(--dark-text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 24px 60px rgba(0, 0, 0, 0.42);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(
  .article-modal-preview, .article-modal-summary, .company-modal-card, .score-modal-card,
  .fx-chart-card, .fx-alert-card, .daily-change-history-card, .daily-change-column,
  .company-price-chart-wrap, .company-price-stat
) {
  border-color: var(--dark-border);
  background: var(--dark-panel-raised);
  color: var(--dark-text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.article-modal-actions, .modal-actions, .dialog-actions, .popup-actions) {
  border-color: rgba(88, 114, 138, 0.72);
  background: var(--dark-toolbar);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.article-modal-close, .company-modal-close, .icon-button) {
  border-color: rgba(125, 211, 252, 0.48);
  background: var(--dark-accent-soft);
  color: var(--dark-accent-strong);
}

/* Company detail pop-up: override the portable kit's light-only table surfaces. */
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-modal-copy {
  color: var(--dark-muted) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-valuation-table, .company-options-table) {
  border-color: var(--dark-border) !important;
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-valuation-table, .company-options-table) thead th {
  border-color: var(--dark-border-strong) !important;
  background: var(--dark-table-head) !important;
  color: var(--dark-heading) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-valuation-table, .company-options-table) tbody tr > :is(th, td) {
  border-color: var(--dark-border) !important;
  background: var(--dark-panel) !important;
  color: var(--dark-secondary) !important;
  box-shadow: none !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-valuation-table, .company-options-table) tbody tr > th {
  background: var(--dark-panel-muted) !important;
  color: var(--dark-supporting) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-valuation-table, .company-options-table) tbody tr:nth-child(even) > :is(th, td) {
  background: var(--dark-table-stripe) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-valuation-table, .company-options-table) tbody tr:hover > :is(th, td) {
  background: var(--dark-table-hover) !important;
  color: var(--dark-heading) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-purchase-table tfoot th {
  border-color: var(--dark-border-strong) !important;
  background: var(--dark-toolbar) !important;
  color: var(--dark-heading) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-valuation-table .valuation-help-row td {
  border-color: rgba(251, 191, 36, 0.36) !important;
  background: var(--dark-warning-bg) !important;
  color: var(--dark-warning-text) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .valuation-help-trigger::after {
  border-color: rgba(125, 211, 252, 0.48);
  background: var(--dark-accent-soft);
  color: var(--dark-accent-strong);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .valuation-score-track {
  border-color: var(--dark-border-strong);
  background: linear-gradient(90deg, #5d3038 0%, #5b4a1d 50%, #20503f 100%);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-price-range .company-price-range-btn:not(.is-active) {
  border-color: rgba(125, 211, 252, 0.48) !important;
  background: #1d2d3f !important;
  background-color: #1d2d3f !important;
  color: #c8d9e6 !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.08) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-price-range .company-price-range-btn:not(.is-active):hover,
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-price-range .company-price-range-btn:not(.is-active):focus-visible {
  border-color: rgba(125, 211, 252, 0.82) !important;
  background: #29475f !important;
  background-color: #29475f !important;
  color: #f2f8fc !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-price-range .company-price-range-btn.is-active {
  border-color: #7dd3fc !important;
  background: #17506b !important;
  background-color: #17506b !important;
  color: #e0f7ff !important;
  box-shadow: inset 0 -2px 0 #7dd3fc, 0 0 0 1px rgba(125, 211, 252, 0.28) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) #totalGainModal .total-gain-range .company-price-range-btn:not(.is-active) {
  border-color: rgba(125, 211, 252, 0.48) !important;
  background: #1d2d3f !important;
  background-color: #1d2d3f !important;
  color: #c8d9e6 !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.08) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) #totalGainModal .total-gain-range .company-price-range-btn:not(.is-active):hover,
:root:is(.theme-dark, [data-theme="dark"]) #totalGainModal .total-gain-range .company-price-range-btn:not(.is-active):focus-visible {
  border-color: rgba(125, 211, 252, 0.82) !important;
  background: #29475f !important;
  background-color: #29475f !important;
  color: #f2f8fc !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) #totalGainModal .total-gain-range .company-price-range-btn.is-active {
  border-color: #7dd3fc !important;
  background: #17506b !important;
  background-color: #17506b !important;
  color: #e0f7ff !important;
  box-shadow: inset 0 -2px 0 #7dd3fc, 0 0 0 1px rgba(125, 211, 252, 0.28) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(
  .company-detail-grid .company-analyst-count-card,
  .company-analyst-table .company-analyst-count-cell
) {
  border-color: rgba(125, 211, 252, 0.52) !important;
  background: rgba(56, 189, 248, var(--analyst-count-dark-alpha, 0)) !important;
  color: var(--dark-heading) !important;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.10) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-count-card :is(span, strong),
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-analyst-table .company-analyst-count-cell {
  color: var(--dark-heading) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-analyst-count-card, .company-analyst-count-cell).is-strong,
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-analyst-count-card.is-strong :is(span, strong) {
  color: #fff !important;
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-rating-card.analyst-rating-strong-buy,
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-rating-card.analyst-rating-buy {
  border-color: rgba(74, 163, 128, 0.72);
  background: var(--dark-success-bg);
  color: var(--dark-success-text);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-rating-card:is(.analyst-rating-strong-buy, .analyst-rating-buy) :is(span, strong) {
  color: var(--dark-success-text);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-rating-card.analyst-rating-sell,
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-rating-card.analyst-rating-strong-sell {
  border-color: rgba(196, 89, 99, 0.72);
  background: var(--dark-danger-bg);
  color: var(--dark-danger-text);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-detail-grid .company-analyst-rating-card:is(.analyst-rating-sell, .analyst-rating-strong-sell) :is(span, strong) {
  color: var(--dark-danger-text);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-options-subcard, .company-price-chart-wrap, .company-price-stat) {
  border-color: var(--dark-border);
  background: var(--dark-panel-inset);
  color: var(--dark-text);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal .company-options-warning {
  border-color: rgba(251, 191, 36, 0.48);
  background: var(--dark-warning-bg);
  color: var(--dark-warning-text);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.company-options-subcard h4, .valuation-score-value, .valuation-score-head strong) {
  color: var(--dark-heading);
}
:root:is(.theme-dark, [data-theme="dark"]) .company-modal :is(.valuation-score-head, .valuation-score-scale, .valuation-score-empty) {
  color: var(--dark-muted);
}

/* Company-name hover chart: dark canvas, readable grid/axes, accessible market colours. */
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-bg {
  fill: var(--dark-panel-inset);
}
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-grid {
  stroke: var(--chart-grid);
}
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-axis {
  fill: var(--chart-axis);
}
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-candle.is-up,
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-volume.is-up {
  fill: #34d399;
  stroke: #34d399;
}
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-candle.is-down,
:root:is(.theme-dark, [data-theme="dark"]) .system-ticker-chart .company-hover-chart-volume.is-down {
  fill: #f87171;
  stroke: #f87171;
}

/* Semantic feedback and financial direction */
:root:is(.theme-dark, [data-theme="dark"]) :is(.success, .notice-success, .status-success, .auth-alert.success, .tag-alert.success, .user-alert.success, .rule-breakers-alert.success) {
  border-color: rgba(74, 163, 128, 0.72);
  background: var(--dark-success-bg);
  color: var(--dark-success-text);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.warning, .notice-warning, .status-warning, .article-summary-warning) {
  border-color: rgba(251, 191, 36, 0.48);
  background: var(--dark-warning-bg);
  color: var(--dark-warning-text);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.error, .notice-error, .status-error, .auth-alert.error, .tag-alert.error, .user-alert.error, .rule-breakers-alert.error) {
  border-color: rgba(196, 89, 99, 0.72);
  background: var(--dark-danger-bg);
  color: var(--dark-danger-text);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.value-positive, .is-positive, .gain, .positive, .price-up, .change-positive, .rule-delta-up, .text-success) {
  --financial-direction-color: #86efac;
  color: var(--financial-direction-color) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.value-negative, .is-negative, .loss, .negative, .price-down, .change-negative, .rule-delta-down, .text-danger) {
  --financial-direction-color: #fca5a5;
  color: var(--financial-direction-color) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is([class*="price-alert-up-"], [class*="target-change-up-"]) {
  border-color: rgba(74, 163, 128, 0.72) !important;
  background: var(--dark-success-bg) !important;
  color: var(--dark-success-text) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is([class*="price-alert-down-"], [class*="target-change-down-"]) {
  border-color: rgba(196, 89, 99, 0.72) !important;
  background: var(--dark-danger-bg) !important;
  color: var(--dark-danger-text) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) :is([class*="score-band-"]) {
  border-color: var(--dark-border) !important;
  background: var(--dark-panel-muted) !important;
  color: var(--financial-direction-color, var(--dark-text)) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-under-40 > td { background:#332b19 !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-40 > td { background:#172b37 !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-50 > td { background:#173440 !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-60 > td { background:#18352e !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-70 > td { background:#174031 !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-80 > td { background:#155039 !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-90 > td { background:#116044 !important; box-shadow:none !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-under-40:hover > td { background:#44391d !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-40:hover > td { background:#1b3948 !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-50:hover > td { background:#1b4352 !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-60:hover > td { background:#1b463a !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-70:hover > td { background:#19523d !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-80:hover > td { background:#176347 !important; }
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr.score-band-90:hover > td { background:#147653 !important; }
:root:is(.theme-dark, [data-theme="dark"]) body.page-market-data [data-system-tab-panel$="-coverage-matrix"] table.system-datatable tbody tr[class*="score-band-"] > td:nth-child(6).is-positive,
:root:is(.theme-dark, [data-theme="dark"]) body.page-market-data [data-system-tab-panel$="-coverage-matrix"] table.system-datatable tbody tr[class*="score-band-"] > td:nth-child(8).is-positive,
:root:is(.theme-dark, [data-theme="dark"]) body.page-market-data [data-system-tab-panel$="-coverage-matrix"] table.system-datatable tbody tr[class*="score-band-"] > td:nth-child(9).is-positive {
  color:#a7f3d0 !important;
  text-shadow:0 1px 0 rgba(0, 0, 0, 0.42);
}
:root:is(.theme-dark, [data-theme="dark"]) body:is(.page-market-data, .page-watch-lists) table.system-datatable tbody tr[class*="score-band-"] > td {
  color:var(--financial-direction-color, var(--dark-text)) !important;
}
:root:is(.theme-dark, [data-theme="dark"]) body.page-watch-lists table.system-datatable tbody tr[class*="score-band-"] > td.is-positive {
  color:#a7f3d0 !important;
  text-shadow:0 1px 0 rgba(0, 0, 0, 0.42);
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.tag-score-pill, .rule-score-pill, .analyst-pill.score-band-under-40) {
  border-color: rgba(251, 191, 36, 0.48);
  background: var(--dark-warning-bg);
  color: var(--dark-warning-text);
}

/* Standalone authentication page */
:root:is(.theme-dark, [data-theme="dark"]) .auth-page { color: var(--dark-text); }
:root:is(.theme-dark, [data-theme="dark"]) :is(.auth-field, .reset-title, .modal-section-title, .modal-check-row) { color: var(--dark-heading); }
:root:is(.theme-dark, [data-theme="dark"]) :is(.reset-copy, .brand p) { color: var(--dark-muted); }
:root:is(.theme-dark, [data-theme="dark"]) .auth-loading {
  border-color: rgba(125, 211, 252, 0.48);
  background: var(--dark-accent-soft);
  color: var(--dark-accent-strong);
}

/* Recipient/print-facing output intentionally remains a light document. */
:root:is(.theme-dark, [data-theme="dark"]) :is(.document-preview, .pdf-preview, .print-preview, .email-preview) {
  border-color: #c8d5df !important;
  background: #fff !important;
  color: #102a43 !important;
  color-scheme: light;
}
:root:is(.theme-dark, [data-theme="dark"]) :is(.document-preview, .pdf-preview, .print-preview, .email-preview) * {
  color-scheme: light;
}

@media print {
  :root:is(.theme-dark, [data-theme="dark"]) { color-scheme: light; }
  :root:is(.theme-dark, [data-theme="dark"]) body { background: #fff; color: #102a43; }
}
