/* Screen-only theme: printed orders retain their paper layout and colours. */
@media screen {
    :root[data-theme="dark"] {
        color-scheme: dark;
        --bg: #111820;
        --bg-elevated: #18222d;
        --bg-soft: #243241;
        --text: #edf3f8;
        --text-muted: #b2bfcc;
        --border: #405164;
        --border-strong: #75899e;
        --accent: #86efac;
        --accent-hover: #166534;
        --accent-soft: rgb(74 222 128 / 13%);
        --danger: #fca5a5;
        --danger-soft: rgb(248 113 113 / 12%);
        --ink: var(--text);
        --muted: var(--text-muted);
        --panel: var(--bg-elevated);
        --line: var(--border);
        --accent-strong: #86efac;
        --ui-focus-ring: 0 0 0 3px rgb(134 239 172 / 24%);
    }
    :root[data-theme="dark"],
    :root[data-theme="dark"] body,
    :root[data-theme="dark"] #main-screen { background: var(--bg); color: var(--text); }

    :root[data-theme="dark"] :is(.view, .topbar, .modal__dialog, .modal__footer, .order-summary,
        .mobile-more-panel, .mobile-schedule-bottom, .mobile-navigation, .mobile-navigation button,
        .order-more-actions__menu, .pull-refresh-indicator, .creation-loading__panel,
        .order-section-title, .schedule-toolbar, .clients-toolbar, .dashboard-metric-block,
        .table-wrapper, .placeholder, .empty-state, .client-search-results,
        .waitlist__form, .waitlist__list, .waititem, .login-card) {
        background: var(--bg-elevated); color: var(--text); border-color: var(--border);
    }
    :root[data-theme="dark"] #view-orders > .toolbar,
    :root[data-theme="dark"] #view-clients > .clients-toolbar { background: var(--bg-elevated); }
    :root[data-theme="dark"] :is(.schedule-toolbar, .clients-toolbar),
    :root[data-theme="dark"] #view-orders > .toolbar { box-shadow: 0 6px 0 var(--bg-elevated); }
    :root[data-theme="dark"] .sidebar { background: #101923; border-color: var(--border); }
    :root[data-theme="dark"] :is(.nav-item, .sidebar__subtitle) { color: var(--text-muted); }
    :root[data-theme="dark"] .nav-item--active { background: var(--accent-soft); color: var(--accent); }
    :root[data-theme="dark"] :is(.form-label, .muted, .settings-help, .order-client-picker__status,
        .schedule-time-label, .table th, .dashboard-range, .dashboard-loading,
        .order-assignment__calendar, #schedule-feedback) { color: var(--text-muted); }
    :root[data-theme="dark"] .form-input,
    :root[data-theme="dark"] dialog :is(input, select, textarea) {
        background: #111b26; color: var(--text); border-color: var(--border-strong); caret-color: var(--accent);
    }
    :root[data-theme="dark"] :is(input, textarea)::placeholder { color: #a9b8c8; opacity: 1; }
    :root[data-theme="dark"] :is(select, option) { color-scheme: dark; }
    :root[data-theme="dark"] :is(.btn--ghost, .topbar__toggle, .topbar__refresh,
        .dashboard-refresh-icon, .add-inline, .schedule-view-switch__button) {
        background: var(--bg-soft); color: var(--text); border-color: var(--border);
    }
    :root[data-theme="dark"] .btn--primary { background: #15803d; border-color: #4ade80; color: #fff; }
    :root[data-theme="dark"] .btn--primary:hover { background: #166534; }
    :root[data-theme="dark"] :is(.btn--ghost:hover, .topbar__toggle:hover, .topbar__refresh:hover,
        .mobile-more-panel__close:hover, .mobile-more-panel__close:focus-visible) { background: #304254; color: var(--text); }
    :root[data-theme="dark"] .btn--danger { color: #fca5a5; background: #38242a; border-color: #b96a76; }
    :root[data-theme="dark"] .btn--danger:hover { background: #4a2932; }
    :root[data-theme="dark"] :is(.form-error, .form-message--error, [role="alert"]) { color: #fca5a5; }
    :root[data-theme="dark"] :is(.form-message--ok, .dashboard-period__button.is-active) { color: var(--accent); }
    :root[data-theme="dark"] .form-input:disabled { opacity: 1; color: var(--text-muted); background: var(--bg-soft); }
    :root[data-theme="dark"] :is(.modal__close, .selected-services__remove, .order-assignment__remove) { color: var(--text-muted); }
    :root[data-theme="dark"] :is(.modal__header, .modal__footer, .order-block-divider,
        .table td, .table th, .table-wrapper, .client-history-order) { border-color: var(--border); }
    :root[data-theme="dark"] :is(.order-assignment, .order-total, .selected-services__item,
        .selected-service, .client-history-inline.is-loading, .client-history-row > td,
        .dashboard-total-block, .schedule-view-switch) { background: var(--bg-soft); color: var(--text); }
    :root[data-theme="dark"] :is(.selected-service, .selected-services__item) { background: #17382c; border-color: #477d61; }
    :root[data-theme="dark"] .order-assignment__calendar.is-closed { color: #fca5a5; }
    :root[data-theme="dark"] .table thead { background: var(--bg-soft); }
    :root[data-theme="dark"] #view-orders .orders-scroll thead th,
    :root[data-theme="dark"] #view-clients .clients-scroll thead th { background: var(--bg-soft); color: var(--text-muted); }
    :root[data-theme="dark"] .table tbody tr:hover,
    :root[data-theme="dark"] .table tbody tr:focus-within { background: var(--bg-soft); }
    :root[data-theme="dark"] #orders-table .order-list-item { background: var(--bg-elevated); border-color: var(--border); color: var(--text); }
    :root[data-theme="dark"] #orders-table .order-list-item:active { background: var(--bg-soft); }
    :root[data-theme="dark"] #orders-table .order-list-item[data-status-kind="completed"] { background: #1b302a; }
    :root[data-theme="dark"] #orders-table .order-list-item[data-status-kind="cancelled"] { background: #332329; }
    :root[data-theme="dark"] .client-history-order:hover { background: var(--accent-soft); }
    :root[data-theme="dark"] :is(.schedule, .schedule__week, .schedule > .empty-state) { background: var(--bg-elevated); }
    :root[data-theme="dark"] :is(.schedule-day-header, .schedule__times) { background: var(--bg-soft); color: var(--text); }
    :root[data-theme="dark"] .schedule-day-grid { background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px); }
    :root[data-theme="dark"] .schedule-day-column--closed .schedule-day-grid { background-color: #151e28; }
    :root[data-theme="dark"] .schedule-day-column--closed .schedule-day-header { background: #1a2531; color: var(--text-muted); }
    :root[data-theme="dark"] .schedule-order {
        background: color-mix(in srgb, var(--order-color, #94a3b8) 18%, #18222d);
        color: var(--text);
    }
    :root[data-theme="dark"] .schedule-order.schedule-order--active { background: color-mix(in srgb, var(--order-color, #22c55e) 24%, #18222d); }
    :root[data-theme="dark"] .schedule-order.schedule-order--completed { background: #20312e; opacity: 1; filter: none; }
    :root[data-theme="dark"] .schedule-order.schedule-order--cancelled { background: #3a252d; opacity: 1; filter: none; }
    :root[data-theme="dark"] .schedule-order__status { background: #111b26; color: var(--text); }
    :root[data-theme="dark"] .schedule-order__client { color: #d3dde7; }
    :root[data-theme="dark"] .master-filter__chip { background: var(--bg-soft); color: var(--text); }
    :root[data-theme="dark"] .master-filter__chip--active { background: var(--accent-soft); color: var(--accent); }
    :root[data-theme="dark"] .schedule-view-switch__button.is-active { background: #3a4d60; color: var(--text); }
    :root[data-theme="dark"] .mobile-navigation button[aria-current] { color: var(--accent); background: #19382b; }
    :root[data-theme="dark"] .login-layout__left { background: #132330; }
    :root[data-theme="dark"] :is(.login-card__title, .login-title, .login-card .form-label) { color: var(--text); }
    :root[data-theme="dark"] :is(.login-card__subtitle, .login-hint, .login-layout__left p) { color: var(--text-muted); }
    :root[data-theme="dark"] ::selection { background: #3a6b54; color: #fff; }
    :root[data-theme="dark"] :focus-visible { outline-color: var(--accent); }
    :root[data-theme="dark"] * { scrollbar-color: #63778d #18222d; }

    /* Embedded car selectors use the same preference, without altering car images or canvas content. */
    :root[data-theme="dark"] :is(.selector-panel, .summary, .text-parts, .zones-panel, .toolbar) { background: var(--bg-elevated); color: var(--text); border-color: var(--line); }
    :root[data-theme="dark"] :is(.view-tab, .view-arrow, .mode-button, .tool-button, .markup-link, .text-parts-list button, .text-zone-form input,
        .field input, .field select, .toolbar input, .toolbar > button, #zones-list li, .selected-part, .part-item) { background: var(--bg-soft); color: var(--text); border-color: var(--line); }
    :root[data-theme="dark"] :is(.view-tab.is-active, .mode-button.is-active, .tool-button.primary, .save-button, .apply-button, .primary-button, .request-button) { background: #15803d; color: #fff; border-color: #4ade80; }
    :root[data-theme="dark"] .request-button:disabled { background: var(--bg-soft); color: var(--text-muted); }
    :root[data-theme="dark"] :is(.car-stage, .car-canvas, .canvas-wrap, .stage) { background: #263542; }
    :root[data-theme="dark"] .selected-list li { background: var(--bg-soft); color: var(--text); }
    :root[data-theme="dark"] :is(.remove-part, #zones-list button) { background: #38242a; color: #fca5a5; }
    :root[data-theme="dark"] :is(.empty, .eyebrow, .selector-copy p, .summary p) { color: var(--text-muted); }
}
