:root {
  --ok-bg: #e7f5ec;
  --ok-ink: #1b6f3a;
  --warn-bg: #fff6e0;
  --warn-ink: #8a5a00;
  --bad-bg: #fdecea;
  --bad-ink: #9a332b;
  --info-bg: #eaf4fa;
  --info-ink: #1d5f8a;
}

:root[data-theme="dark"] {
  --navy: #d9efff;
  --ink: #e6edf3;
  --blue: #78c7f3;
  --sky: #17384e;
  --line: #2c4b5f;
  --muted: #a9bac7;
  --surface: #102739;
  --bg: #071823;
  --ok-bg: #123823;
  --ok-ink: #85e0a6;
  --warn-bg: #3f2e08;
  --warn-ink: #ffd777;
  --bad-bg: #431d1d;
  --bad-ink: #ffaaa5;
  --info-bg: #123247;
  --info-ink: #9bd9ff;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .topbar {
  background: var(--bg);
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] form,
:root[data-theme="dark"] details,
:root[data-theme="dark"] .account-chip,
:root[data-theme="dark"] .account-menu,
:root[data-theme="dark"] .signin-card,
:root[data-theme="dark"] .connection-card,
:root[data-theme="dark"] .storage-card,
:root[data-theme="dark"] .activity-card,
:root[data-theme="dark"] .mini-history,
:root[data-theme="dark"] .account-panel,
:root[data-theme="dark"] .invoice-card,
:root[data-theme="dark"] .payment-entry,
:root[data-theme="dark"] .date-filter,
:root[data-theme="dark"] .line-editor,
:root[data-theme="dark"] .generated,
:root[data-theme="dark"] .schedule-card,
:root[data-theme="dark"] .job-card,
:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .check-card,
:root[data-theme="dark"] .photo-card,
:root[data-theme="dark"] .customer-card {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .estimate-card,
:root[data-theme="dark"] .estimate-toolbar,
:root[data-theme="dark"] .aging-panel,
:root[data-theme="dark"] .book-job-dialog,
:root[data-theme="dark"] .backup-dialog {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="dark"] input:not([type="checkbox"]),
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #0b1e2c;
  border-color: #3c6077;
  color: var(--ink);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #8fa4b3;
}

:root[data-theme="dark"] label,
:root[data-theme="dark"] .date-filter legend,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] .app-nav a,
:root[data-theme="dark"] .account-menu a,
:root[data-theme="dark"] .account-menu button,
:root[data-theme="dark"] .account-chip,
:root[data-theme="dark"] .secondary,
:root[data-theme="dark"] .chip-button {
  color: var(--navy);
}

:root[data-theme="dark"] .secondary,
:root[data-theme="dark"] .chip-button,
:root[data-theme="dark"] .add {
  background: #0b1e2c;
  border-color: #3c6077;
}

:root[data-theme="dark"] .secondary:hover,
:root[data-theme="dark"] .chip-button:hover,
:root[data-theme="dark"] .app-nav a:hover,
:root[data-theme="dark"] .app-nav a[aria-current="page"],
:root[data-theme="dark"] .account-chip:hover,
:root[data-theme="dark"] .account-menu a:hover,
:root[data-theme="dark"] .account-menu button:hover,
:root[data-theme="dark"] .account-menu a:focus-visible,
:root[data-theme="dark"] .account-menu button:focus-visible {
  background: var(--sky);
  color: var(--navy);
}

:root[data-theme="dark"] .app-nav a {
  border-color: var(--line);
}

:root[data-theme="dark"] .primary,
:root[data-theme="dark"] .chip-button.selected,
:root[data-theme="dark"] .filter-tabs .selected,
:root[data-theme="dark"] .email-preview-views .chip-button[aria-pressed="true"] {
  background: #4aaee3;
  color: #061722;
}

:root[data-theme="dark"] .drive-status,
:root[data-theme="dark"] .signin-message,
:root[data-theme="dark"] .connection-banner,
:root[data-theme="dark"] .calculation-note {
  background: var(--info-bg);
  border-color: #315d78;
  color: var(--info-ink);
}

:root[data-theme="dark"] .generating-card {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] .generating-text {
  color: var(--navy);
}

:root[data-theme="dark"] .error-box,
:root[data-theme="dark"] .check-note[data-tone="bad"] {
  background: var(--bad-bg);
  border-color: #794343;
  color: var(--bad-ink);
}

:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .status-badge {
  background: #1a3448;
  border-color: #355a73;
  color: var(--navy);
}

:root[data-theme="dark"] .status-badge[data-tone="ok"],
:root[data-theme="dark"] .drive-status[data-state="saved"],
:root[data-theme="dark"] .check-row.ok strong {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

:root[data-theme="dark"] .status-badge[data-tone="warn"] {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

:root[data-theme="dark"] .status-badge[data-tone="bad"],
:root[data-theme="dark"] .drive-status[data-state="failed"],
:root[data-theme="dark"] .check-row.bad strong,
:root[data-theme="dark"] .signout-button {
  background: var(--bad-bg);
  color: var(--bad-ink) !important;
}

:root[data-theme="dark"] .signout-all-button {
  color: var(--bad-ink) !important;
}

:root[data-theme="dark"] .status-badge[data-tone="info"],
:root[data-theme="dark"] .drive-status[data-state="setup"] {
  background: var(--info-bg);
  color: var(--info-ink);
}

:root[data-theme="dark"] .status-badge[data-tone="muted"],
:root[data-theme="dark"] .payment-entry.voided {
  background: #1c2832;
  color: var(--muted);
}

:root[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #142c3d 25%, #1e4058 37%, #142c3d 63%);
}

:root[data-theme="dark"] .toast {
  background: #d9efff;
  color: #071823;
}

:root[data-theme="dark"] .toast button {
  color: #075985;
}

:root[data-theme="dark"] .paper,
:root[data-theme="dark"] .paper * {
  color-scheme: light;
}

:root[data-theme="dark"] .paper {
  background: #fff;
  color: #1a2a3c;
}

:root[data-theme="dark"] iframe,
:root[data-theme="dark"] img,
:root[data-theme="dark"] .map,
:root[data-theme="dark"] .radar,
:root[data-theme="dark"] .photo,
:root[data-theme="dark"] canvas {
  color-scheme: light;
}

:root[data-theme="dark"] .brand img,
:root[data-theme="dark"] .signin-logo {
  content: url("assets/logo-dark.svg");
}

:root[data-theme="dark"] .paper .paper-logo,
:root[data-theme="dark"] .paper img {
  content: revert;
}

:root[data-theme="dark"] .stepper ol,
:root[data-theme="dark"] .setup-guide,
:root[data-theme="dark"] .studio-page .form-section,
:root[data-theme="dark"] .choice,
:root[data-theme="dark"] .address-panel,
:root[data-theme="dark"] .studio-page .subtle-details,
:root[data-theme="dark"] .quick-add,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .fuel-box,
:root[data-theme="dark"] .parcel-card,
:root[data-theme="dark"] .email-card,
:root[data-theme="dark"] .share-card,
:root[data-theme="dark"] .confirm-dialog,
:root[data-theme="dark"] .result-dialog,
:root[data-theme="dark"] .result-side,
:root[data-theme="dark"] .next-up,
:root[data-theme="dark"] .next-box,
:root[data-theme="dark"] .needs-time,
:root[data-theme="dark"] .needs-list li,
:root[data-theme="dark"] .schedule-board,
:root[data-theme="dark"] .wx-dialog,
:root[data-theme="dark"] .move-dialog,
:root[data-theme="dark"] .wx-head,
:root[data-theme="dark"] .wx-verdict,
:root[data-theme="dark"] .forecast-card,
:root[data-theme="dark"] .month-grid,
:root[data-theme="dark"] .month-day,
:root[data-theme="dark"] .settings-toggle,
:root[data-theme="dark"] .letterhead-preview,
:root[data-theme="dark"] .payment-preview,
:root[data-theme="dark"] .calendar-access,
:root[data-theme="dark"] .settings-actions,
:root[data-theme="dark"] .filter-box,
:root[data-theme="dark"] .attention-list button,
:root[data-theme="dark"] .note,
:root[data-theme="dark"] .check-note {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .segmented,
:root[data-theme="dark"] .step-dot,
:root[data-theme="dark"] .sub-card,
:root[data-theme="dark"] .review-row,
:root[data-theme="dark"] .phone-action-bar,
:root[data-theme="dark"] .wx-daychip,
:root[data-theme="dark"] .wx-chip,
:root[data-theme="dark"] .month-job,
:root[data-theme="dark"] .settings-example,
:root[data-theme="dark"] .calendar-admin code,
:root[data-theme="dark"] .parcel-badge {
  background: #0b1e2c;
  border-color: #3c6077;
  color: var(--ink);
}

:root[data-theme="dark"] .choice:has(input:checked),
:root[data-theme="dark"] .fuel-box.is-on,
:root[data-theme="dark"] .settings-toggle:has(input:checked),
:root[data-theme="dark"] .calendar-access[data-tone="ok"],
:root[data-theme="dark"] .wx-verdict.wx-good,
:root[data-theme="dark"] .wx-chip.wx-good,
:root[data-theme="dark"] .job-card.is-done {
  background: var(--ok-bg);
  border-color: #2e6f47;
  color: var(--ok-ink);
}

:root[data-theme="dark"] .needs-time,
:root[data-theme="dark"] .next-notes,
:root[data-theme="dark"] .wx-verdict.wx-watch,
:root[data-theme="dark"] .wx-chip.wx-watch,
:root[data-theme="dark"] .calendar-access[data-tone="warn"],
:root[data-theme="dark"] .job-card.status-needs_time,
:root[data-theme="dark"] .month-job.status-needs_time,
:root[data-theme="dark"] .preview-flag,
:root[data-theme="dark"] .drive-status[data-state="setup"],
:root[data-theme="dark"] .email-status[data-tone="warning"],
:root[data-theme="dark"] .send-problem,
:root[data-theme="dark"] .settings-status[data-tone="dirty"] {
  background: var(--warn-bg);
  border-color: #806019;
  color: var(--warn-ink);
}

:root[data-theme="dark"] .wx-verdict.wx-bad,
:root[data-theme="dark"] .wx-chip.wx-bad,
:root[data-theme="dark"] .empty-state.is-error,
:root[data-theme="dark"] .email-status[data-tone="error"],
:root[data-theme="dark"] .stepper a[data-state="attention"] .step-dot,
:root[data-theme="dark"] .step-badge[data-state="attention"] {
  background: var(--bad-bg);
  border-color: #7b4542;
  color: var(--bad-ink);
}

:root[data-theme="dark"] .drive-status[data-state="saved"],
:root[data-theme="dark"] .drive-status[data-state="ready"],
:root[data-theme="dark"] .email-status[data-tone="success"],
:root[data-theme="dark"] .settings-status[data-tone="saved"],
:root[data-theme="dark"] #document-status[data-state="ready"],
:root[data-theme="dark"] .studio-page #generated,
:root[data-theme="dark"] .step-badge {
  background: var(--ok-bg);
  border-color: #2e6f47;
  color: var(--ok-ink);
}

:root[data-theme="dark"] .stepper a[aria-current="step"],
:root[data-theme="dark"] .stepper a:hover,
:root[data-theme="dark"] .studio-page .subtle-details > summary:hover,
:root[data-theme="dark"] .address-suggestions li:hover,
:root[data-theme="dark"] .address-suggestions li[aria-selected="true"],
:root[data-theme="dark"] .customer-card:hover,
:root[data-theme="dark"] .customer-card.selected {
  background: var(--sky);
  border-color: var(--blue);
  color: var(--navy);
}

:root[data-theme="dark"] .section-titles h2,
:root[data-theme="dark"] .choice strong,
:root[data-theme="dark"] .doc-type legend,
:root[data-theme="dark"] .next-who h2,
:root[data-theme="dark"] .next-when strong,
:root[data-theme="dark"] .next-box h3,
:root[data-theme="dark"] .month-nav h2,
:root[data-theme="dark"] .agenda-date,
:root[data-theme="dark"] .job-time strong,
:root[data-theme="dark"] .job-title strong,
:root[data-theme="dark"] .wx-head h2,
:root[data-theme="dark"] .settings-card h2,
:root[data-theme="dark"] .settings-toggle strong,
:root[data-theme="dark"] .letterhead strong,
:root[data-theme="dark"] .payment-preview dt,
:root[data-theme="dark"] .calendar-admin summary,
:root[data-theme="dark"] .empty-state strong,
:root[data-theme="dark"] .card-top strong,
:root[data-theme="dark"] .quick-add-label,
:root[data-theme="dark"] .fuel-toggle strong,
:root[data-theme="dark"] .parcel-head h3,
:root[data-theme="dark"] .email-card h3,
:root[data-theme="dark"] .share-card h3,
:root[data-theme="dark"] .send-titles h2,
:root[data-theme="dark"] .confirm-dialog h2 {
  color: var(--navy);
}

:root[data-theme="dark"] .next-work,
:root[data-theme="dark"] .next-where,
:root[data-theme="dark"] .next-notes,
:root[data-theme="dark"] .wx-sub,
:root[data-theme="dark"] .wx-problem,
:root[data-theme="dark"] .letterhead,
:root[data-theme="dark"] .payment-preview dd,
:root[data-theme="dark"] .calendar-access,
:root[data-theme="dark"] .calendar-check-result,
:root[data-theme="dark"] .address-credit,
:root[data-theme="dark"] .contact-line,
:root[data-theme="dark"] .job-line,
:root[data-theme="dark"] .confirm-dialog p {
  color: var(--ink);
}

:root[data-theme="dark"] .job-card.status-canceled,
:root[data-theme="dark"] .job-card.status-voided,
:root[data-theme="dark"] .month-job.status-canceled,
:root[data-theme="dark"] .month-job.status-voided {
  background: #1c2832;
  border-color: #526575;
  color: var(--muted);
}

:root[data-theme="dark"] .wx-icon-button,
:root[data-theme="dark"] .segmented button[aria-pressed="true"],
:root[data-theme="dark"] .day-chip span,
:root[data-theme="dark"] .chip {
  background: #0b1e2c;
  border-color: #3c6077;
  color: var(--navy);
}

:root[data-theme="dark"] .day-chip input:checked + span,
:root[data-theme="dark"] .primary {
  background: #4aaee3;
  border-color: #4aaee3;
  color: #061722;
}

:root[data-theme="dark"] .measure-dialog,
:root[data-theme="dark"] .measure-panel,
:root[data-theme="dark"] .measure-footer,
:root[data-theme="dark"] .measure-fallback {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

/* ---------- Final contrast pass ---------- */

/* The invoice preview is a picture of the PDF, so it keeps the light palette in dark mode. */
:root[data-theme="dark"] .paper {
  --navy: #10364d;
  --ink: #1a2a3c;
  --blue: #2475a3;
  --sky: #eaf4fa;
  --line: #dbe5ec;
  --muted: #5e707d;
  --surface: #fff;
  --bg: #f3f7fa;
  --ok-bg: #e7f5ec;
  --ok-ink: #1b6f3a;
  --warn-bg: #fff6e0;
  --warn-ink: #8a5a00;
  --bad-bg: #fdecea;
  --bad-ink: #9a332b;
  --info-bg: #eaf4fa;
  --info-ink: #1d5f8a;
}

/* Small solid badges that were navy or blue with white text. */
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .skip-link,
:root[data-theme="dark"] .studio-page .section-heading .step,
:root[data-theme="dark"] .agenda-rel,
:root[data-theme="dark"] .month-day.is-today .month-num,
:root[data-theme="dark"] .wx-daychip em,
:root[data-theme="dark"] .wx-c-time em,
:root[data-theme="dark"] .wx-day-name em {
  background: #4aaee3;
  color: #061722;
}

:root[data-theme="dark"] .studio-page .tax-confirm {
  background: #0b1e2c;
  border-color: #3c6077;
  color: var(--ink);
}

:root[data-theme="dark"] .studio-page .tax-confirm:has(input:checked) {
  background: var(--ok-bg);
  border-color: #2e6f47;
  color: var(--ok-ink);
}

/* Schedule text that was set for light cards. */
:root[data-theme="dark"] .job-work,
:root[data-theme="dark"] .next-problem,
:root[data-theme="dark"] .wx-panel.wx-none,
:root[data-theme="dark"] .wx-day-words strong,
:root[data-theme="dark"] .wx-facts dd,
:root[data-theme="dark"] .needs-head p {
  color: var(--ink);
}

:root[data-theme="dark"] .job-where,
:root[data-theme="dark"] .next-calendar,
:root[data-theme="dark"] .wx-verdict.wx-none p + p,
:root[data-theme="dark"] .wx-verdict-text p + p,
:root[data-theme="dark"] .wx-daysum-facts,
:root[data-theme="dark"] .wx-radar-legend,
:root[data-theme="dark"] .wx-alert summary small,
:root[data-theme="dark"] .wx-loop figcaption,
:root[data-theme="dark"] .move-now {
  color: var(--muted);
}

:root[data-theme="dark"] .tone-good,
:root[data-theme="dark"] .next-calendar.tone-good,
:root[data-theme="dark"] .wx-good .wx-level-title,
:root[data-theme="dark"] .wx-good .wx-verdict-title,
:root[data-theme="dark"] .wx-r-good .ui-icon,
:root[data-theme="dark"] .calendar-check-result li.is-ok::marker {
  color: var(--ok-ink);
}

/* Red before amber: a moderate alert has both classes and must end up amber. */
:root[data-theme="dark"] .tone-bad,
:root[data-theme="dark"] .next-calendar.tone-bad,
:root[data-theme="dark"] .wx-bad .wx-level-title,
:root[data-theme="dark"] .wx-bad .wx-verdict-title,
:root[data-theme="dark"] .wx-r-bad .ui-icon,
:root[data-theme="dark"] .wx-alert summary,
:root[data-theme="dark"] .wx-alert summary .ui-icon,
:root[data-theme="dark"] .calendar-check-result li.is-bad::marker {
  color: var(--bad-ink);
}

:root[data-theme="dark"] .tone-warn,
:root[data-theme="dark"] .next-calendar.tone-warn,
:root[data-theme="dark"] .wx-watch .wx-level-title,
:root[data-theme="dark"] .wx-watch .wx-verdict-title,
:root[data-theme="dark"] .wx-r-watch .ui-icon,
:root[data-theme="dark"] .next-problem .ui-icon,
:root[data-theme="dark"] .wx-problem .ui-icon,
:root[data-theme="dark"] .needs-head .ui-icon,
:root[data-theme="dark"] .needs-head h2,
:root[data-theme="dark"] .job-time .no-time,
:root[data-theme="dark"] .wx-sev-moderate summary,
:root[data-theme="dark"] .wx-sev-minor summary,
:root[data-theme="dark"] .wx-sev-unknown summary,
:root[data-theme="dark"] .wx-sev-moderate summary .ui-icon,
:root[data-theme="dark"] .wx-sev-minor summary .ui-icon,
:root[data-theme="dark"] .wx-sev-unknown summary .ui-icon,
:root[data-theme="dark"] .calendar-check-result[data-tone="warn"] p,
:root[data-theme="dark"] .review-missing {
  color: var(--warn-ink);
}

:root[data-theme="dark"] .wx-strip-rain,
:root[data-theme="dark"] .wx-strip-rain.is-wet,
:root[data-theme="dark"] .wx-chip-rain,
:root[data-theme="dark"] .wx-table tr.is-wet .wx-c-umbrella .wx-cell-value {
  color: var(--info-ink);
}

/* Status pills and notes use the dark status colours. */
:root[data-theme="dark"] .traffic-light .traffic-pill,
:root[data-theme="dark"] .pill-green,
:root[data-theme="dark"] .wx-work.wx-good {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

:root[data-theme="dark"] .traffic-moderate .traffic-pill,
:root[data-theme="dark"] .drive-leave.is-now,
:root[data-theme="dark"] .pill-amber,
:root[data-theme="dark"] .wx-work.wx-watch,
:root[data-theme="dark"] .move-warning,
:root[data-theme="dark"] .job-notes {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

:root[data-theme="dark"] .traffic-heavy .traffic-pill,
:root[data-theme="dark"] .wx-work.wx-bad,
:root[data-theme="dark"] .move-error {
  background: var(--bad-bg);
  color: var(--bad-ink);
}

:root[data-theme="dark"] .pill-grey {
  background: #1c2832;
  color: var(--muted);
}

/* Schedule panels, dialogs and the weather table. */
:root[data-theme="dark"] .schedule-photos-dialog,
:root[data-theme="dark"] .move-actions,
:root[data-theme="dark"] .wx-loop figcaption {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .month-day.is-outside,
:root[data-theme="dark"] .wx-verdict.wx-none,
:root[data-theme="dark"] .wx-daysum,
:root[data-theme="dark"] .wx-daywords,
:root[data-theme="dark"] .wx-day.is-job,
:root[data-theme="dark"] .wx-table thead th {
  background: #0b1e2c;
}

:root[data-theme="dark"] .wx-table thead th {
  color: var(--muted);
}

:root[data-theme="dark"] .wx-stats div {
  background: #0b1e2cc2;
}

:root[data-theme="dark"] .wx-dialog details.wx-alert {
  background: var(--bad-bg);
}

:root[data-theme="dark"] .wx-dialog details.wx-alert.wx-sev-moderate,
:root[data-theme="dark"] .wx-dialog details.wx-alert.wx-sev-minor,
:root[data-theme="dark"] .wx-dialog details.wx-alert.wx-sev-unknown {
  background: var(--warn-bg);
}

:root[data-theme="dark"] .wx-table tr.is-night,
:root[data-theme="dark"] .wx-table tr.is-night td,
:root[data-theme="dark"] .wx-table tr.is-night th {
  background: #0a1a26;
}

:root[data-theme="dark"] .wx-key-job,
:root[data-theme="dark"] .wx-table tr.is-job,
:root[data-theme="dark"] .wx-table tr.is-job td,
:root[data-theme="dark"] .wx-table tr.is-job th,
:root[data-theme="dark"] .month-day:hover,
:root[data-theme="dark"] .month-day.is-selected,
:root[data-theme="dark"] .wx-daychip:hover,
:root[data-theme="dark"] .move-email:has(input[name="notify"]:checked),
:root[data-theme="dark"] .settings-jump a:hover,
:root[data-theme="dark"] .settings-jump a:focus-visible {
  background: var(--sky);
}

:root[data-theme="dark"] .wx-rainbar {
  background: #1e3a4e;
}

/* Invoice stepper, line editors and the result dialog. */
:root[data-theme="dark"] .studio-page .form-section[data-state="done"] .section-heading .step {
  background: #2f8f5b;
  color: #fff;
}

:root[data-theme="dark"] .stepper a[data-state="done"] small,
:root[data-theme="dark"] .generated-title h3,
:root[data-theme="dark"] .result-head .eyebrow {
  color: var(--ok-ink);
}

:root[data-theme="dark"] .remove {
  color: var(--bad-ink);
}

:root[data-theme="dark"] .studio-page .line-editor .remove:hover {
  background: var(--bad-bg);
}

:root[data-theme="dark"] .icon-button {
  background: #0b1e2c;
  border-color: #3c6077;
  color: var(--navy);
}

:root[data-theme="dark"] .icon-button:hover {
  background: var(--sky);
}

:root[data-theme="dark"] .month-day.is-past:not(.is-today) .month-num {
  color: #8a99a6;
}

/* Invoice form leftovers: banners, notes, errors and the phone bar. */
:root[data-theme="dark"] .result-head {
  background: linear-gradient(180deg, #123823, var(--surface));
  border-color: var(--line);
}

:root[data-theme="dark"] .mobile-action-bar,
:root[data-theme="dark"] .studio-page .form-section:last-child,
:root[data-theme="dark"] .wx-day {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] .stepper a[data-state="progress"] .step-dot {
  background: #0b1e2c;
}

:root[data-theme="dark"] .segmented button:hover {
  background: #ffffff14;
}

:root[data-theme="dark"] .draft-banner,
:root[data-theme="dark"] .review-tag,
:root[data-theme="dark"] .line-total[data-state="pending"] {
  background: var(--warn-bg);
  border-color: #806019;
  color: var(--warn-ink);
}

:root[data-theme="dark"] .draft-banner p {
  color: var(--ink);
}

:root[data-theme="dark"] .lookup-note {
  background: var(--info-bg);
  color: var(--info-ink);
}

:root[data-theme="dark"] .stepper a[data-state="attention"] small,
:root[data-theme="dark"] .field-error,
:root[data-theme="dark"] .error-box a {
  color: var(--bad-ink);
}

:root[data-theme="dark"] .error-step,
:root[data-theme="dark"] .drive-status[data-state="error"] {
  background: var(--bad-bg);
  color: var(--bad-ink);
}

:root[data-theme="dark"] input[aria-invalid="true"],
:root[data-theme="dark"] select[aria-invalid="true"],
:root[data-theme="dark"] textarea[aria-invalid="true"] {
  background: #2a1618;
  border-color: #c2605a;
}

/* Map measuring dialog panels. */
:root[data-theme="dark"] .measure-close,
:root[data-theme="dark"] .measure-map-wrap,
:root[data-theme="dark"] .measure-map,
:root[data-theme="dark"] .measure-map-info,
:root[data-theme="dark"] .measure-attributions,
:root[data-theme="dark"] .measure-layer-controls,
:root[data-theme="dark"] .measure-rotate-label,
:root[data-theme="dark"] .measure-google-roof {
  background: #0b1e2c;
  border-color: var(--line);
}

:root[data-theme="dark"] .measure-photo-panel,
:root[data-theme="dark"] .measure-shape,
:root[data-theme="dark"] .measure-actions {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .measure-photo-panel.is-stale {
  background: var(--warn-bg);
}

:root[data-theme="dark"] .measure-attributions,
:root[data-theme="dark"] .measure-layer-controls legend,
:root[data-theme="dark"] .measure-rotate-label {
  color: var(--muted);
}

/* ---------- Payments detail header ---------- */
:root[data-theme="dark"] .account-panel-hero {
  background: linear-gradient(135deg, #0c3048, #1a5d86);
}

/* Keep invoice step accents distinct without turning dark cards into bright blocks. */
:root[data-theme="dark"] .studio-page #step-customer {
  --section-accent: #63bfe9;
  --section-tint: #102d3e;
  --section-divider: #28566e;
}
:root[data-theme="dark"] .studio-page #step-services {
  --section-accent: #62c9ad;
  --section-tint: #102f2c;
  --section-divider: #285d52;
}
:root[data-theme="dark"] .studio-page #step-extras {
  --section-accent: #e8ae54;
  --section-tint: #352b1b;
  --section-divider: #6d552b;
}
:root[data-theme="dark"] .studio-page #step-payment {
  --section-accent: #b79ae8;
  --section-tint: #29233a;
  --section-divider: #584a77;
}
:root[data-theme="dark"] .studio-page #step-review {
  --section-accent: #70c891;
  --section-tint: #173125;
  --section-divider: #315e42;
}
:root[data-theme="dark"] .studio-page .form-section .section-heading .step {
  background: var(--section-accent);
  color: #061722;
}
