/* Appearance is local to the app; print/PDF output retains its light palette. */
.appearance-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}
.appearance-settings h3 { margin: 0 0 4px; font-size: 1rem; }
.appearance-settings p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.appearance-toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.appearance-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.appearance-toggle-track { position: relative; flex: none; width: 44px; height: 26px; border: 1px solid #9aa9b6; border-radius: 20px; background: #cbd3dc; }
.appearance-toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .15s ease; }
.appearance-toggle input:checked + .appearance-toggle-track { background: #357d94; border-color: #357d94; }
.appearance-toggle input:checked + .appearance-toggle-track::after { transform: translateX(18px); }
.appearance-toggle input:focus-visible + .appearance-toggle-track { outline: 3px solid var(--brand); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .appearance-toggle-track::after { transition: none; } }

@media screen {
  :root { color-scheme: light; }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101820;
    --panel: #192632;
    --surface: #1e2e3c;
    --raised: #263a4a;
    --ink: #e8eef4;
    --muted: #a8b8c7;
    --line: #3a4d5f;
    --brand: #83c9dc;
    --brand-dark: #a9ddec;
    --danger: #ffa69e;
    --ok: #8bd3b1;
    --shadow: 0 18px 46px #0004;
  }
  html[data-theme="dark"] body,
  html[data-theme="dark"].auth-pending body { background: var(--bg); color: var(--ink); }

  /* Cards, dialogs, editors and tables share the same dark surfaces. */
  html[data-theme="dark"] :is(
    .panel, .modal, .modal > .panel-header, .auth-gate section, .workspace-load-error section,
    .account-quick-menu, .history-tools-popover, .history-column-popover, .combo-menu,
    .carrier-card, .zone-card, .service-card, .quote-card, .subscription-choice-card,
    .workspace-landing-card, .workspace-account-actions, .account-settings-section,
    .account-team-panel, .account-activity-panel, .team-member-row, .team-invite-form,
    .team-self-name-form, .team-invite-result, .mfa-dialog, .matrix-weight-popup,
    .carrier-leave-dialog, .fuel-table-editor-popup, .workflow-confirm-dialog,
    .stats-card, .stats-visual-card, .stats-table-wrap, .stats-chart, .stats-bars,
    .data-table, .history-table-shell, .tier-table, .zone-matrix-wrap,
    .quote-detail-sum, .workflow-reconciliation, .workflow-readiness,
    .carrier-management-card, .fuel-table-card, .fuel-table-body, .carrier-detail-row,
    .comparison-diesel-heading, .setup-guide-stage, .setup-guide-preview,
    .setup-guide-calculation, .setup-guide-service-card, .setup-guide-matrix,
    .export-format-card, .export-option-card, .transport-template-row
  ) { background: var(--panel); border-color: var(--line); color: var(--ink); }

  html[data-theme="dark"] :is(
    .form-step, .form-step-action, .filter-bar, .stats-filter-bar, .detail-item,
    .history-detail-grid > div, .carrier-inline-section, .carrier-summary-grid > div,
    .carrier-inline-fuel-rates > div, .carrier-inline-relations .carrier-detail-grid > section,
    .fuel-admin-card, .fuel-admin-tier-item, .fuel-country-control-row, .fuel-current-card,
    .fuel-country-edit, .fuel-readout-item, .account-security, .import-preview, .draft-offer,
    .account-team-note, .team-member-row.pending, .team-invite-card, .account-tab-switch,
    .mfa-setup, .mfa-secret code, .stats-insight, .stats-shipment-segments,
    .stats-no-data-note, .stats-export-filter-note, .metric, .market-options-setting,
    .excluded-carrier-row, .market-option-card, .setup-guide-procedure, .setup-guide-fields > div,
    .setup-guide-country-order > div, .setup-guide-cases article, .setup-guide-history-detail > div,
    .email-change-recipients > div, .fuel-table-countries label, .tier-row.tier-head,
    .carrier-country-switch-row, .invoice-received-control, .workflow-list-row
  ) { background: var(--surface); border-color: var(--line); color: var(--ink); }

  html[data-theme="dark"] :is(h1, h2, h3, h4, h5, label, legend, strong, th) { color: var(--ink); }
  html[data-theme="dark"] :is(
    .muted, .tariff-stamp, .panel-kicker, .zone-card-ranges, .service-card-desc,
    .workspace-sidebar-context span, .account-team-note span, .activity-log-meta,
    .team-member-email, .team-member-name-empty, .team-member-person > div > span, .comparison-result-count,
    .history-invoice-meta, .stats-note, .stats-note p, .stats-card span,
    .stats-cost-row-track small, .stats-bar-row > span, .stats-visual-card > p, .appearance-settings p,
    .workflow-reconciliation span, .workflow-readiness span, .workflow-list-row > div > span
  ) { color: var(--muted); }

  html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .compact-select) {
    color: var(--ink); background-color: var(--surface); border-color: var(--line);
  }
  html[data-theme="dark"] :is(input, textarea)::placeholder { color: #94a7b8; opacity: 1; }
  html[data-theme="dark"] :is(input, select, textarea):focus-visible { outline-color: var(--brand); border-color: var(--brand); }
  html[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23b9cddd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
  }
  /* Pagination already has its own inline SVG arrow. */
  html[data-theme="dark"] .history-pagination-size select { background-image: none; }
  html[data-theme="dark"] input[type="checkbox"], html[data-theme="dark"] input[type="radio"] { accent-color: #4c9db7; }
  html[data-theme="dark"] :is(input, select, textarea):disabled { background-color: #263442; color: #9aaaba; }

  html[data-theme="dark"] .btn,
  html[data-theme="dark"] :is(.btn-ghost, .icon-btn, .choice-btn, .combo-toggle, .matrix-row-edit, .stats-visual-toggle, .history-pagination-buttons button, .mobile-menu-toggle, .mobile-menu-close) {
    background: var(--surface); border-color: var(--line); color: var(--ink);
  }
  html[data-theme="dark"] .btn.btn-primary,
  html[data-theme="dark"] .comparison-form .step-marker { background: #357d94; border-color: #4b95ad; color: #fff; }
  html[data-theme="dark"] .comparison-form .workflow-templates { border-bottom-color: #2c3e4c; }
  html[data-theme="dark"] .btn.btn-primary:hover { background: #408ca4; color: #fff; }
  html[data-theme="dark"] .btn-danger { background: #472a2d; border-color: #995557; color: #ffc2bb; }
  html[data-theme="dark"] :is(.btn-ghost, .icon-btn, .choice-btn, .combo-toggle):hover { background: var(--raised); color: var(--ink); }
  html[data-theme="dark"] :is(.btn.btn-danger, .icon-btn.danger):not(:disabled):not(.is-disabled):is(:hover, :focus-visible) {
    background: #693438; border-color: #db8c86; color: #ffe0da;
  }
  html[data-theme="dark"] :is(button[data-demo-locked]:disabled, .btn:disabled, .btn.is-disabled),
  html[data-theme="dark"] button[data-demo-locked]:disabled:hover { background: #2b3947; border-color: #435363; color: #9cabb9; box-shadow: none; }

  html[data-theme="dark"] .workspace-sidebar { background: #14212c; border-color: var(--line); }
  html[data-theme="dark"] .workspace-sidebar-bottom { border-top-color: #2c3e4c; }
  html[data-theme="dark"] .workspace-sidebar-brand { border-color: var(--line); }
  /* Keep the existing transparent PNG, without a light rectangular backplate. */
  html[data-theme="dark"] img[src$="logo-aligned.png"] { filter: brightness(0) invert(1); }
  html[data-theme="dark"] .workspace-sidebar-brand img { background: transparent; border-radius: 0; padding: 0; }
  html[data-theme="dark"] :is(.workspace-nav button, .workspace-sidebar-bottom button, .workspace-sidebar-link, .workspace-sidebar-context strong) { color: var(--ink); }
  html[data-theme="dark"] :is(.workspace-nav button, .workspace-sidebar-bottom button, .workspace-sidebar-link):hover { background: var(--raised); border-color: var(--line); }
  html[data-theme="dark"] :is(.workspace-nav button[aria-current="page"], .workspace-nav-parent[aria-expanded="true"], #accountMenuToggle[aria-expanded="true"], #supportMenuToggle[aria-expanded="true"]) { background: #244454; border-color: #477487; color: #b2e0ed; }
  html[data-theme="dark"] .workspace-nav button:disabled { color: #8d9eae; background: transparent; border-color: transparent; }
  html[data-theme="dark"] :is(.account-quick-menu > button, .account-quick-menu > a, .history-tools-item, .combo-menu button, .combo-menu span) { color: var(--ink); background: transparent; }
  html[data-theme="dark"] :is(.account-quick-menu > button, .account-quick-menu > a, .history-tools-item, .combo-menu button):hover { background: var(--raised); color: var(--ink); }
  html[data-theme="dark"] :is(.account-quick-menu > button, .account-quick-menu > a, .history-tools-item):focus-visible { background: var(--raised); color: var(--ink); outline: 2px solid var(--brand); outline-offset: -2px; }
  html[data-theme="dark"] #accountQuickMenu [data-account-quick="logout"]:is(:hover, :focus-visible),
  html[data-theme="dark"] .history-tools-item.history-tools-danger:not(:disabled):is(:hover, :focus-visible) { background: #593036; color: #ffd4cc; }
  html[data-theme="dark"] .account-quick-menu-head .account-quick-menu-avatar { background: #315569; color: #e0f5ff; }
  html[data-theme="dark"] :is(.account-quick-menu-divider, .history-tools-divider) { background: var(--line); }
  html[data-theme="dark"] :is(.history-tools-danger, .icon-btn.danger) { color: var(--danger); }
  html[data-theme="dark"] .topbar { background: var(--bg); border-color: var(--line); }

  html[data-theme="dark"] :is(.check-row, .extra-card, .service-switch-grid .switch-control) { background: var(--surface); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] :is(.check-row.selected, .check-row:has(input:checked), .choice-btn.active, .service-switch-grid .switch-control:has(input:checked), .segmented button.active) { background: #244454; border-color: #5e9caf; color: #c2e8f2; }
  html[data-theme="dark"] :is(.extra-price-pill, .mini-badge, .badge-neutral, .team-role-pill, .team-member-avatar, .workspace-card-icon, .account-security-icon, .empty-steps span, .price-preview span) { background: var(--raised); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] .extra-price-pill :is(b, em) { color: var(--ink); }
  html[data-theme="dark"] :is(.team-self-badge, .team-invite-card-symbol) { background: #244454; color: var(--brand-dark); }
  html[data-theme="dark"] :is(.extra-group-badge, .extra-card-head small, .filter-chip, .active-filter-chip) { background: #244454; border-color: #527e91; color: #b5deeb; }
  html[data-theme="dark"] .switch-track { background: #506273; }
  html[data-theme="dark"] .switch-control input:checked + .switch-track { background: #448ba2; }
  html[data-theme="dark"] :is(.switch-track::after, .appearance-toggle-track::after) { background: #f5f8fb; }
  html[data-theme="dark"] .fuel-table-countries label:not(.disabled):has(input:checked) {
    background: #315e72; border-color: #9ad7e9; color: #f1fbff;
    box-shadow: inset 0 0 0 1px #9ad7e9;
  }
  html[data-theme="dark"] .fuel-table-countries label:not(.disabled):hover { border-color: #9ad7e9; }
  html[data-theme="dark"] .fuel-table-countries label:focus-within { outline: 2px solid var(--brand); outline-offset: 3px; }
  html[data-theme="dark"] .fuel-table-countries label.disabled { background: #263442; border-color: var(--line); color: #95a5b5; }
  html[data-theme="dark"] .fuel-tier-header { color: var(--muted); }

  html[data-theme="dark"] :is(table, th, td, .quote-detail-row, .quote-detail-grand-total, .panel-header, .modal .form-actions, .carrier-inline-section) { border-color: var(--line); }
  html[data-theme="dark"] :is(.data-table th, .history-table th, .stats-table th, .zone-matrix-table th, .setup-guide-matrix th) { background: #223442; color: var(--muted); }
  html[data-theme="dark"] :is(.history-table tbody tr.history-row, .country-table tbody tr, .stats-table tr) { background: var(--panel); color: var(--ink); }
  html[data-theme="dark"] :is(.history-table tbody tr.history-row:hover, .data-table tr:hover) td { background: var(--raised); }
  html[data-theme="dark"] .history-table td { color: var(--ink); }
  html[data-theme="dark"] .quote-detail-row { color: var(--ink); }
  html[data-theme="dark"] .quote-detail-group { border-color: var(--line); }
  html[data-theme="dark"] :is(.quote-detail-grand-total, .setup-guide-calculation > div.total) { background: #244454; }
  html[data-theme="dark"] :is(.comparison-savings, .notice, .history-note, .carrier-detail-note, .stats-success-message, .fuel-result-note, .subscription-banner.archive, .draft-offer, .stats-export-filter-note) { background: #203a47; color: #c4e2ee; border-color: #487687; }
  html[data-theme="dark"] :is(.comparison-savings strong, .stats-cost-row-heading span, .stats-drill-label, .stats-history-link) { color: var(--brand-dark); }
  html[data-theme="dark"] .quote-card.best { border-color: #6fa6b8; }
  html[data-theme="dark"] :is(.comparison-best-label, .status-badge.active, .status-toggle.active, .confirmation-success, .stats-quality.good) { background: #1d4036; border-color: #4e8a73; color: #a8e2c3; }
  html[data-theme="dark"] :is(.status-badge.inactive, .status-toggle.inactive, .stats-quality.warning, .team-sync-warning, .setup-guide-warning) { background: #40351e; color: #f3d490; border-color: #88703b; }
  html[data-theme="dark"] :is(.demo-preview-notice, .subscription-banner.demo-preview-notice) { background: #3a3019; border-color: #9c8138; color: #f5d98d; }
  html[data-theme="dark"] .demo-preview-notice strong { color: #ffe6a6; }
  html[data-theme="dark"] :is(.workflow-form-error, .modal-error, .subscription-business-check.error) { background: #45292d; color: #ffc2bb; border-color: #9e5659; }
  html[data-theme="dark"] :is(.field-error, .character-limit-message.is-error, .invoice-overrun, .history-invoice-toggle.open) { color: #ffb1a8; }
  html[data-theme="dark"] :is(.invoice-saving, .history-invoice-toggle.received) { color: #99dbbb; }
  html[data-theme="dark"] .empty { background: var(--surface); color: var(--muted); border-color: var(--line); }

  html[data-theme="dark"] :is(.stats-card, .stats-visual-card, .stats-overview-kpis .stats-card, .stats-overview-chart-grid .stats-visual-card) { background: var(--panel) !important; border-color: var(--line) !important; color: var(--ink); }
  html[data-theme="dark"] :is(.stats-bar-row div, .stats-cost-row-track div, .stats-donut-track) { background: #344b5a; stroke: #344b5a; }
  html[data-theme="dark"] .stats-chart .chart-grid-line { stroke: var(--line); }
  html[data-theme="dark"] .stats-chart text { fill: var(--muted); }
  html[data-theme="dark"] .stats-chart :is(.chart-line, .chart-point) { stroke: #8fc6d2; }
  html[data-theme="dark"] .stats-chart .chart-point { fill: var(--panel); }
  html[data-theme="dark"] .stats-visual-toggle { color: var(--brand-dark); }

  html[data-theme="dark"] :is(.modal-backdrop, .mfa-dialog-backdrop, .workflow-confirm-overlay, .carrier-leave-backdrop) { background: #050b12ad; }
  html[data-theme="dark"] .mfa-qr { background: #fff; } /* QR contrast must remain scannable. */
  html[data-theme="dark"] .mfa-qr img { background: #fff; }
  html[data-theme="dark"] .floating-tip { background: #dce9f1; color: #152431; }
  html[data-theme="dark"] .appearance-settings { background: var(--surface); }

  /* Separate offer cards with the page background, not a shared panel fill. */
  html[data-theme="dark"] body[data-workspace-view="comparison"] .comparison-results,
  html[data-theme="dark"] .comparison-results > .panel-body,
  html[data-theme="dark"] .comparison-results .results { background: transparent; }
  html[data-theme="dark"] .activity-log-row { border-top-color: #2c3e4c; }

  /* Handbook navigation, sample forms and explanatory copy. */
  html[data-theme="dark"] .setup-guide :is(
    .setup-guide-step, .setup-guide-intro-grid article, .setup-guide-fuel-head,
    .setup-guide-mode-row, .setup-guide-map span, .setup-guide-mini-list span
  ) { background: var(--surface); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] .setup-guide .setup-guide-step:is(:hover, :focus-visible) { background: var(--raised); border-color: var(--brand); }
  html[data-theme="dark"] .setup-guide .setup-guide-step.active { background: #244454; border-color: #83c9dc; color: #dcf4fc; }
  html[data-theme="dark"] .setup-guide-step span { background: var(--raised); color: var(--ink); }
  html[data-theme="dark"] .setup-guide :is(.setup-guide-step.active span, .setup-guide-procedure li > span) { background: #357d94; color: #fff; }
  html[data-theme="dark"] .setup-guide :is(
    .setup-guide-notes ul, .setup-guide-procedure p, .setup-guide-preview figcaption,
    .setup-guide-preview-note, .setup-guide-mini-list, .setup-guide-calculation > div
  ) { color: var(--ink); }
  html[data-theme="dark"] .setup-guide :is(
    .setup-guide-check, .setup-guide-country-order em, .setup-guide-fuel-head em,
    .setup-guide-country-order > div.is-default, .setup-guide-matrix tr.is-current > *,
    .setup-guide-history-detail .total, .setup-guide-calculation > div.total
  ) { background: #1d4036; border-color: #4e8a73; color: #a8e2c3; }
  html[data-theme="dark"] .setup-guide :is(.setup-guide-mode-row:not(.manual) small, .total strong) { color: #a8e2c3; }
  html[data-theme="dark"] .setup-guide-history-status { background: #40351e; color: #f3d490; }

  /* Match light-mode interaction cues without restoring light surfaces. */
  html[data-theme="dark"] .fuel-table-summary-toggle { background: var(--surface); color: var(--ink); }
  html[data-theme="dark"] body :where(
    .btn:not(.btn-primary):not(.btn-danger), .icon-btn:not(.danger), .choice-btn,
    .combo-toggle, .draft-offer .btn, .team-name-edit-btn, .history-pagination-buttons button,
    .filter-chip, .history-selection-trigger, .tab, .fuel-table-summary-toggle,
    .stats-chart-expandable, .stats-visual-toggle, .history-column-popover label,
    .fuel-admin-tier-item, button.fuel-readout-item, .team-member-row-button,
    .workspace-team-page .team-invite-card, .export-format-card
  ):not(:disabled):not(.is-disabled):not([aria-disabled="true"]):is(:hover, :focus-visible) {
    background: var(--raised); border-color: #77b7ca; color: var(--ink);
    box-shadow: 0 0 0 1px #77b7ca33;
  }
  html[data-theme="dark"] body :is(.btn.btn-primary, .icon-btn.edit, .tab.active):not(:disabled):not(.is-disabled):not([aria-disabled="true"]):is(:hover, :focus-visible) {
    background: #408ca4; border-color: #83c9dc; color: #fff;
  }
  html[data-theme="dark"] body :is(.choice-btn.active, .history-selection-trigger.has-selection):not(:disabled):not(.is-disabled):not([aria-disabled="true"]):is(:hover, :focus-visible) {
    background: #315e72; border-color: #93d0e2; color: #e3f7ff;
  }
  html[data-theme="dark"] body :is(.quote-card, .carrier-card):not([aria-disabled="true"]):is(:hover, :focus-visible) {
    background: #203442; border-color: #83c9dc;
    box-shadow: 0 5px 18px #050b1266;
  }
  html[data-theme="dark"] .quote-card.best:not(.tariff-expired):is(:hover, :focus-visible) {
    border-color: #9cd9eb; box-shadow: inset 5px 0 0 var(--ok), 0 5px 18px #050b1266;
  }
  html[data-theme="dark"] .quote-card.tariff-expired { border-color: #c49a52; box-shadow: inset 5px 0 0 #c49a52; }
  html[data-theme="dark"] body .quote-card.tariff-expired:is(:hover, :focus-visible) {
    border-color: #f2c477; box-shadow: inset 5px 0 0 #f2c477, 0 5px 18px #050b1266;
  }
  html[data-theme="dark"] body :is(.check-row, .service-switch-grid .switch-control, .export-option-card):not(.disabled):not(:has(input:disabled)):is(:hover, :focus-within, :focus-visible) {
    background: #294252; border-color: #83c9dc; color: var(--ink);
  }
  html[data-theme="dark"] body :is(.check-row, .service-switch-grid .switch-control, .export-option-card):not(.disabled):not(:has(input:disabled)):has(input:checked):is(:hover, :focus-within, :focus-visible) {
    background: #315e72; border-color: #a3deef;
  }
  html[data-theme="dark"] .export-option-card:has(input:checked) { background: #244454; border-color: #5e9caf; }
  html[data-theme="dark"] .tab { background: var(--surface); color: var(--ink); }
  html[data-theme="dark"] .tab.active { background: #357d94; color: #fff; }
  html[data-theme="dark"] .history-selection-trigger.has-selection { background: #244454; color: #b5deeb; border-color: #527e91; }
  html[data-theme="dark"] body :is(.workspace-nav button, .workspace-sidebar-bottom button, .workspace-sidebar-link):not(:disabled):is(:hover, :focus-visible) {
    background: #315569; border-color: #77b7ca; color: #e0f5ff;
  }
  html[data-theme="dark"] .team-member-person-button:is(:hover, :focus-visible) .team-member-avatar { background: #315e72; color: #e0f5ff; }
  html[data-theme="dark"] :is(.stats-history-link, .exclusive-marker):is(:hover, :focus-visible) { color: #d7f4ff; }
  html[data-theme="dark"] input[type="date"]:not(:disabled):hover { background-color: var(--raised); border-color: #77b7ca; }

  /* Secondary copy and rare dialog states found in the full dark-mode audit. */
  html[data-theme="dark"] :is(.exclusive-marker, .info-dot) { color: #b5c8d8; border-color: #7893a6; }
  html[data-theme="dark"] .fuel-current-actions .info-dot { color: transparent; }
  html[data-theme="dark"] .fuel-current-actions .info-dot::before { color: #b5c8d8; }
  html[data-theme="dark"] :is(
    .fuel-country-control-row span, .fuel-country-control-row small,
    .subscription-choice-card p, .mfa-secret > span, .mfa-code-form label span,
    .mfa-setup-intro, .account-security [data-security-description]
  ) { color: var(--muted); }
  html[data-theme="dark"] .workspace-team-page .team-member-card-grid .team-member-person > div > span { color: var(--muted); }
  html[data-theme="dark"] body[data-workspace-view="stats"] #statsPanel .stats-cost-row-heading span { color: var(--ink); }
  html[data-theme="dark"] body[data-workspace-view="stats"] #statsPanel .stats-cost-row-track div { background: #344b5a; }
  html[data-theme="dark"] .invoice-field-label { color: var(--ink); }
  html[data-theme="dark"] .stats-export-filter-note span { color: var(--ink); }
  html[data-theme="dark"] .history-invoice-status.open { color: #ffb1a8; }
  html[data-theme="dark"] :is(.history-invoice-status.received, .history-invoice-toggle.received) { color: #a9ddec; }
  html[data-theme="dark"] :is(.fuel-country-control-row, .fuel-result-note) .fuel-status-ok { color: #a8e2c3; }
  html[data-theme="dark"] :is(.fuel-country-control-row, .fuel-result-note) .fuel-status-warning { color: #f3d490; }
  html[data-theme="dark"] :is(.fuel-country-control-row, .fuel-result-note) .fuel-status-danger { color: #ffb1a8; }
  html[data-theme="dark"] :is(.mfa-dialog-status, .mfa-dialog .field-error, .account-security-status) { color: #ffb1a8; }
  html[data-theme="dark"] .account-security-state { background: #244454; color: #d0edf6; }
  html[data-theme="dark"] .account-security-active .account-security-state { background: #1d4036; color: #a8e2c3; }
  html[data-theme="dark"] .export-format-icon { background: #357d94; color: #fff; }
  html[data-theme="dark"] .import-steps li { background: var(--raised); color: var(--ink); }
  html[data-theme="dark"] .import-steps li[aria-current="step"] { background: #357d94; color: #fff; }
  html[data-theme="dark"] body[data-workspace-view="stats"] #statsPanel .stats-no-data-note { background: var(--surface); border-color: var(--line); }
  html[data-theme="dark"] :is(.fuel-table-editor-popup-actions, .breakdown span) { background: var(--surface); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] :is(.account-email-change-note, .email-change-confirmation, .stats-warning-list div, .history-edited-badge) { background: #40351e; border-color: #88703b; color: #f3d490; }
  html[data-theme="dark"] :is(.workspace-start-notice, .email-change-confirmation.complete) { background: #1d4036; border-color: #4e8a73; color: #a8e2c3; }
  html[data-theme="dark"] :is(.workspace-start-notice span, .account-email-change-note span, .email-change-confirmation-head span, .email-change-confirmation p) { color: var(--ink); }
  html[data-theme="dark"] .tier-validation-message { background: #45292d; border-color: #9e5659; color: #ffc2bb; }
  html[data-theme="dark"] :is(.tariff-warning, .tariff-warning .info-dot) { color: #f3d490; border-color: #b89b62; }
  html[data-theme="dark"] .save-status { color: #a8e2c3; }
  html[data-theme="dark"] .save-status[data-state="saving"] { color: var(--muted); }
  html[data-theme="dark"] .save-status[data-state="error"] { color: #ffb1a8; }

  /* Disabled state must win over every variant's hover/focus/active styling. */
  html[data-theme="dark"] :where(.workspace-nav button, .account-quick-menu > button, .history-tools-item, .comparison-diesel-refresh) {
    --disabled-background: transparent;
    --disabled-border: transparent;
  }
  html[data-theme="dark"] :where(button, .btn, [role="button"]):is(:disabled, .is-disabled, [aria-disabled="true"]) {
    background: var(--disabled-background, #2b3947) !important;
    border-color: var(--disabled-border, #435363) !important;
    color: var(--disabled-color, #9cabb9) !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
    cursor: not-allowed;
  }
}
