/* The account preference sets tokens before first paint, across the shared suite. */
:root {--brand-primary-soft:#e8f1f6;--surface-raised:#fff;--chat-incoming:#eef3f4;--chat-outgoing:#e8f6f0}
:root[data-theme="dark"] {
 color-scheme:dark;
 --brand-primary:#93c9ee;--brand-primary-strong:#c1e1fa;--brand-secondary:#75d3d8;
 --brand-accent:#fa954f;--brand-accent-text:#ffb17c;--brand-red:#ff9494;
 --brand-background:#0c1926;--brand-surface:#142739;--surface-raised:#1c3448;
 --brand-text:#edf4fa;--brand-text-muted:#b2c4d2;--brand-border:#365167;
 --brand-primary-soft:#223e55;--surface-subtle:#1b3246;--surface-hover:#28475f;
 --text-subtle:#a2b6c6;--border-strong:#607c91;--focus-color:#a6d9fa;--focus-ring:#fa954f66;
 --semantic-success:#77dfb3;--semantic-success-soft:#183d34;
 --semantic-warning:#ffd08b;--semantic-warning-soft:#453823;
 --semantic-error:#ffabab;--semantic-error-soft:#4d2934;
 --semantic-info:#9bdafa;--semantic-info-soft:#1a3b50;
 --chat-incoming:#20394d;--chat-outgoing:#17483f;--overlay:#030a12bb;
 --shadow-sm:0 2px 10px #0004;--shadow-md:0 18px 48px #0006;
}
html[data-theme="dark"] body {background:var(--brand-background);color:var(--brand-text)}
html[data-theme="dark"] :is(.panel,.deal-card,.health-card,.stat-card,.kpi-card,.card,.topbar,.form-panel,.search-results,.modal-card,.modal-content,.drawer,.peek-panel,.cross-workspace-panel,.conversation-list,.chat-panel,.conversation-context,.p2-side-peek,.platform-form-peek-panel,.platform-disclosure-panel) {background:var(--brand-surface);color:var(--brand-text);border-color:var(--brand-border)}
html[data-theme="dark"] :is(input,select,textarea) {background:var(--brand-background);color:var(--brand-text);border-color:var(--border-strong)}
html[data-theme="dark"] :is(input,textarea)::placeholder {color:var(--text-subtle);opacity:1}
html[data-theme="dark"] :is(table,thead,tbody,tr,th,td,.kanban-column,.request-form-section,.home-context-strip,.selected-patient,.selected-procedure,.chat-head,.wa-queue-toolbar,.wa-filters,.wa-quick-picker,.wa-operator-composer,.peek-header,.peek-tabs) {background-color:var(--brand-surface);color:var(--brand-text);border-color:var(--brand-border)}
html[data-theme="dark"] :is(th,.kanban-column>header,.conversation-item.active,.wa-conversation.active) {background:var(--surface-subtle)}
html[data-theme="dark"] :is(.btn-primary,.btn-secondary) {background:#215575;color:#fff;border-color:#5585a4}
html[data-theme="dark"] :is(.btn-ghost,.text-action) {color:var(--brand-primary);background:transparent;border-color:var(--brand-border)}
html[data-theme="dark"] :is(.chat-message,.message-bubble,.wa-message-bubble) {background:var(--chat-incoming);color:var(--brand-text)}
html[data-theme="dark"] :is(.chat-message.outbound,.message.outbound .message-bubble,.wa-message.outbound .wa-message-bubble) {background:var(--chat-outgoing);color:var(--brand-text)}
html[data-theme="dark"] :is(.search-results button,.wa-quick-item) {background:var(--brand-surface);color:var(--brand-text)}
html[data-theme="dark"] :is(.search-results button:hover,.wa-quick-item:hover) {background:var(--surface-hover)}
html[data-theme="dark"] :focus-visible {outline-color:var(--focus-color)}
html[data-theme="dark"] .sidebar {background:linear-gradient(170deg,#12384d,#0d253a);color:#edf4fa}
html[data-theme="dark"] .sidebar .main-nav a {color:#edf4fa}
html[data-theme="dark"] .sidebar .main-nav a.active {background:#24465c;color:#fff}
html[data-theme="dark"] .whatsapp-layout :is(.form-control,.chat-compose,.wa-filter-popover) {background:var(--brand-surface);color:var(--brand-text);border-color:var(--brand-border)}
html[data-theme="dark"] .whatsapp-layout .chat-compose>textarea {color:var(--brand-text);background:transparent}
html[data-theme="dark"] .whatsapp-layout :is(.wa-document,.wa-media-download,.wa-text-button,.wa-identification,.wa-card-patient,.wa-card-title time,.wa-filter-popover label,.wa-queue-controls>select,.wa-icon-button) {color:var(--brand-text-muted)}
html[data-theme="dark"] .whatsapp-layout :is(.wa-window,.wa-window>small) {background:var(--semantic-warning-soft);color:var(--semantic-warning)}
html[data-theme="dark"] :is(.panel-switch>summary,.panel-switch-menu,.panel-launch-card,.cross-help-panel) {background:var(--brand-surface);color:var(--brand-text);border-color:var(--brand-border)}
html[data-theme="dark"] .panel-switch-menu a {color:var(--brand-primary)}
html[data-theme="dark"] :is(.cross-help-launch,.wa-send) {color:#fff;background:#215575}
html[data-theme="dark"] :is(.view-toggle,.wa-queue-search) {background:var(--brand-surface);border-color:var(--brand-border)}
html[data-theme="dark"] .view-toggle a {color:var(--brand-text-muted)}
html[data-theme="dark"] .view-toggle a.active {background:#215575;color:#fff}
