/* Shared staff-only semantic palette. Loaded last in both workspaces.
   Explicit surface/text pairs prevent legacy light styles leaking into dark UI. */
body.staff-dark {
  --text-primary:#f1f5f8; --text-secondary:#c3d0da; --text-muted:#c3d0da;
  --surface:#17232c; --surface-elevated:#263640; --surface-inset:#101b23;
  --surface-hover:#344955; --surface-selected:#354b5a; --border:#718694;
  --accent:#ffad70; --accent-fill:#f58636; --on-accent:#111b22;
  --success:#85e0b1; --success-surface:#173f30;
  --warning:#ffda83; --warning-surface:#483919;
  --danger:#ffb1b5; --danger-surface:#52252d;
  --info:#a9cfff; --info-surface:#253e60;
  --ink:var(--text-primary); --muted:var(--text-muted); --paper:var(--surface);
  --line:var(--border); --orange:var(--accent); --orange-2:var(--accent);
  --orange-soft:var(--warning-surface); --green:var(--success); --green-soft:var(--success-surface);
  --red:var(--danger); --red-soft:var(--danger-surface); --blue:var(--info); --blue-soft:var(--info-surface);
  --amber:var(--warning); --amber-soft:var(--warning-surface);
  color-scheme:dark;
}
body.staff-dark.southwest-workspace {
  --accent:#83e3eb; --accent-fill:#55cad7; --on-accent:#102b39;
  --surface:#142b35; --surface-elevated:#223d47; --surface-inset:#0e222b;
  --surface-hover:#31505b; --surface-selected:#284752;
}
/* Scope excludes public marketing pages and printable/PDF artwork. */
body.staff-dark :is(#app,#modal-root,#toast-root) {color:var(--text-primary)}
body.staff-dark #app :is(.main,.app-shell,.view,.driver-app){background:var(--surface);color:var(--text-primary)}
body.staff-dark :is(#app,#modal-root) :is(.sidebar,.topbar,.op-selector-bar,.panel,.ops-panel,.record-panel,.record-list,.record-detail,.metric,.billing-card,.module-stat,.account-metric,.op-metrics article,.ops-metrics>div,.info-card,.detail-box,.detail-box-body,.note,.note-entry,.op-timeline-list li,.toolbar,.filter-bar,.ops-toolbar,.op-table-wrap,.ops-table-wrap,.table-wrap,.job-card,.job-card-head,.module-row,.request-row,.ops-card,.ops-task,.ops-alert,.ops-strip,.command-intro,.command-panel,.command-stat,.command-money,.command-empty,.driver-card,.driver-empty,.driver-shift-card,.driver-inspection,.driver-note,.driver-detail dl,.driver-tabs,.driver-report-status,.modal,.modal-body,.cad-intake,.cad-intake-strip){background:var(--surface-elevated)!important;color:var(--text-primary);border-color:var(--border)}
body.staff-dark :is(#app,#modal-root) :is(.panel-head,.ops-panel-head,.detail-box-head,.modal-head,.modal-foot,.form-section-title,.ops-head,.nav-label,.nav-section-label,.user-card,.command-panel-head,th){background:var(--surface-inset)!important;color:var(--text-secondary)!important;border-color:var(--border)}
body.staff-dark :is(#app,#modal-root) :is(h1,h2,h3,h4,h5,strong,.cell-main,.metric-value,.module-stat strong,.account-metric strong,.section-title,.detail-fact,.driver-detail dd){color:var(--text-primary)!important}
body.staff-dark :is(#app,#modal-root) :is(p,small,label,dt,.cell-sub,.metric-label,.metric-foot,.eyebrow,.date-chip,.toolbar-count,.account-note,.op-note,.op-empty,.ops-empty,.empty,.staff-loading,.driver-muted,.driver-card-location,.driver-detail dt,.job-issue,.job-meta-row,.cad-intake-help,.form-note,.detail-fact span,.module-stat span,.account-metric span,.op-metrics span,.banking-account dt,.banking-account>span,.user-copy span,.brand-text span){color:var(--text-secondary)!important}
body.staff-dark :is(#app,#modal-root) :is(input,textarea,select,option,optgroup){background:var(--surface-inset)!important;color:var(--text-primary)!important;border-color:var(--border)!important;color-scheme:dark;opacity:1}
body.staff-dark :is(#app,#modal-root) :is(input,textarea)::placeholder{color:var(--text-muted)!important;opacity:1}
body.staff-dark :is(#app,#modal-root) :is(a,.text-link,.table-id,.job-id,.command-tag,.command-overline,.driver-card-top,.driver-greeting>span,.driver-shift-card>span){color:var(--accent)}
body.staff-dark :is(#app,#modal-root) :is(.secondary-btn,.tiny-btn,.ghost-btn,.icon-btn,.modal-close,.driver-outline,.driver-detail-actions a,.driver-detail-actions button,.account-tabs button,.op-tabs button,.segmented button,.driver-tabs button,.workspace-switch,.nav-btn,.signout-btn,.flow-step,.op-po-line button){background:var(--surface-elevated)!important;color:var(--text-primary)!important;border-color:var(--border)}
body.staff-dark :is(#app,#modal-root) :is(.primary-btn,.driver-primary,.command-main-action,.nav-badge,.avatar){background:var(--accent-fill)!important;color:var(--on-accent)!important;border-color:var(--accent-fill)!important}
body.staff-dark :is(#app,#modal-root) :is(.primary-btn,.driver-primary,.command-main-action) :is(span,strong,svg){color:inherit!important}
body.staff-dark :is(#app,#modal-root) :is(.nav-btn,.account-tabs button,.op-tabs button,.driver-tabs button,.segmented button,.flow-step):is(.active,.current,.selected){background:var(--surface-selected)!important;color:var(--accent)!important;border-color:var(--accent)}
body.staff-dark #app :is(.nav-btn svg,.nav-btn.active svg){color:inherit}
body.staff-dark :is(#app,#modal-root) :is(button,a):hover:not(:disabled){filter:brightness(1.12)}
body.staff-dark :is(#app,#modal-root) :is(.record-item,.active-row,.data-table tbody tr,.op-table tbody tr,.ops-table tbody tr,.module-row,.driver-card):hover{background:var(--surface-hover)!important;color:var(--text-primary)}
body.staff-dark #app .record-item.selected{background:var(--surface-selected);color:var(--text-primary)}
body.staff-dark :is(#app,#modal-root) :is(button,input,textarea,select,a,summary):focus-visible{outline:3px solid var(--accent)!important;outline-offset:3px}
body.staff-dark :is(#app,#modal-root) :is(button,input,select,textarea):disabled{opacity:1!important;background:var(--surface-inset)!important;color:var(--text-muted)!important;border-color:var(--border)!important;cursor:not-allowed;box-shadow:none}
body.staff-dark :is(#app,#modal-root) :is(.status-pill,.type-pill,.bill-pill,.priority-pill,.driver-status,.mode-chip,.board-count,.staff-state){background:var(--info-surface);color:var(--info);border:1px solid currentColor}
body.staff-dark :is(#app,#modal-root) :is(.status-completed,.bill-paid,.staff-state.active,.flow-step.done){background:var(--success-surface)!important;color:var(--success)!important}
body.staff-dark :is(#app,#modal-root) :is(.status-new,.bill-draft,.priority-pill,.driver-status){background:var(--warning-surface);color:var(--warning)}
body.staff-dark :is(#app,#modal-root) :is(.bill-overdue,.status-cancelled,.staff-state.disabled,.danger-btn,.delete-warning,.op-error){background:var(--danger-surface)!important;color:var(--danger)!important;border-color:var(--danger)}
body.staff-dark :is(#app,#modal-root) :is(.required,.banking-debit,[role=alert],.op-record-form>p){color:var(--danger)!important}
body.staff-dark :is(#app,#modal-root) :is(.banking-credit,.trend-up){color:var(--success)!important}
body.staff-dark :is(#app,#modal-root) td{color:var(--text-primary);border-color:var(--border)}
body.staff-dark .toast{background:var(--surface-elevated);color:var(--text-primary);border-color:var(--accent)}
/* CAD keeps its reference layout and blue/gold signals, with AA text pairs. */
body.staff-dark #app .ref-summary h1{color:var(--warning)!important}
body.staff-dark #app .ref-tab.selected{background:#2458a0}
body.staff-dark #app :is(.ref-rail>button,.ref-modules summary,.ref-related-tabs button.selected,#ref-note-form button){background:#624b08;color:#fff;border-color:#e9ad12}
body.staff-dark #app .ref-unit{background:#15614f;color:#fff}
body.staff-dark #app :is(.ref-footer,.ref-log article header,.ref-related-body>article header){color:#91bcff}
body.staff-dark #app .ref-muted{color:var(--text-muted)}
body.staff-dark #app .ref-related h2{color:var(--warning)!important}
body.staff-dark :is(#app,#modal-root) ::selection{background:var(--accent-fill);color:var(--on-accent)}
@media(forced-colors:active){body.staff-dark :is(#app,#modal-root) :is(button,input,select,textarea){border:1px solid ButtonText}}
/* Shared header, customer selection and identity controls found in page audit. */
body.staff-dark #app :is(.welcome-row,.command-hero,.top-search,.shortcut,.record-item){background:var(--surface-elevated)!important;color:var(--text-primary);border-color:var(--border)}
body.staff-dark :is(#app,#modal-root) :is(.request-row span,.record-item span,.info-card span,.billing-card span,.ops-head span,.shortcut){color:var(--text-secondary)!important}
body.staff-dark :is(#app,#modal-root) :is(.record-avatar,.detail-avatar,.staff-row em){background:var(--accent-fill)!important;color:var(--on-accent)!important}
body.staff-dark #app .record-item.active{background:var(--surface-selected)!important}
