/* Theme applies only to screens; exported and printed documents keep light surfaces. */
.theme-switch{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:40px;min-height:40px;padding:8px 11px;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:9px;font-size:10px;font-weight:650;white-space:nowrap;flex-shrink:0}
.theme-switch:hover{border-color:var(--blue);color:var(--blue)}.theme-switch svg{width:18px;height:18px;flex-shrink:0}.theme-sun{display:none}
html[data-theme=dark] .theme-moon{display:none}html[data-theme=dark] .theme-sun{display:block}
.auth-theme-control{position:absolute;right:24px;top:20px;z-index:2}.auth-page{position:relative;padding-top:80px}
@media(max-width:650px){.topbar .theme-switch [data-theme-label]{display:none}.topbar .theme-switch{padding:8px;width:40px}.auth-theme-control{top:15px;right:18px}.auth-page{padding-top:74px}}
@media screen{
html[data-theme=dark]{color-scheme:dark;--bg:#0b1422;--panel:#121f31;--panel2:#192d45;--line:#2b405a;--text:#e5edf8;--muted:#a5b7ce;--blue:#79b9ff;--cyan:#4dd9de;--green:#78ddba;--amber:#ffd08c;--red:#ffa3af;--shadow:0 4px 20px #00000020;scrollbar-color:#526b89 #121f31}
html[data-theme=dark] body{background:var(--bg);color:var(--text)}
html[data-theme=dark] :is(.topbar,.card,.filters,.table-wrap,.task-link,.kpi-card,.auth-card,.auth-layout,.team-doctor-picker,.command-dialog){background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-theme=dark] :is(.card .card,.card .filters,.summary-row,.agenda-card .summary-row,th,.command-search,.command-trigger,kbd,.segmented,.inline-guide,.page-help[open],.bulk-payment-bar,.import-steps li,.import-counts>div,.team-add,.material-row,.permission-item){background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(h1,h2,h3,.page-title h1,.section-title,label,.filters label,td,td strong,.stat small,.summary-row strong,.breadcrumb-current,.task-link strong,.doctor-value,.team-summary .help strong,.auth-card h2){color:var(--text)}
html[data-theme=dark] :is(.nav-label,.nav-item,.nav-item .ui-icon,.sidebar-collapse,.logout-link,.workspace-label,.app-footer,.topbar-date,.kpi-heading,.kpi-footer,.task-link small,.period-caption,.filters .period-explanation,.page-help li,.command-results small,.command-footer,.auth-subtitle,.auth-help a,.task-start h2){color:var(--muted)}
html[data-theme=dark] :is(.nav-item:hover,.icon-button:hover,.icon-button[aria-pressed=true],.stat-link:hover,.stat-link.active,.task-link:hover,.segmented a:not(.active):hover,.command-results a:hover,.command-results a:focus-visible,.team-doctor-picker label:has(input:checked),.permission-item:has(input:checked)){background:#1c3655;border-color:#4b82b6;color:var(--text)}
html[data-theme=dark] :is(.nav-item.active,.nav-item.active .ui-icon,.segmented a.active){background:#176ac0;border-color:#3989de;color:#fff}
html[data-theme=dark] :is(input,textarea,select,option){background:#0e1b2c;color:var(--text);border-color:#425b79}
html[data-theme=dark] :is(input::placeholder,textarea::placeholder){color:#9cafc7}
html[data-theme=dark] input[readonly]{background:#192a40;color:#b6c9df}
html[data-theme=dark] input:focus,html[data-theme=dark] select:focus,html[data-theme=dark] textarea:focus{border-color:#79b9ff;box-shadow:0 0 0 3px #79b9ff22}
html[data-theme=dark] :is(input[type=file],.avatar,.team-avatar,.kpi-icon,.agenda-count,.doctor-rank,.task-link>.ui-icon:first-child,.auth-form-mark,.upload-symbol){background:#193655;color:#9acbff;border-color:#345d84}
html[data-theme=dark] :is(th,td){border-color:var(--line)}
html[data-theme=dark] tbody tr:hover td{background:#192d45}html[data-theme=dark] :is(tbody tr.bulk-selected td,.selected-row td){background:#20466a}
html[data-theme=dark] :is(.button,.icon-button){background:var(--panel2);color:var(--text);border-color:var(--line)}
html[data-theme=dark] .button:hover{background:#244567;border-color:#669bd0;color:#fff}
html[data-theme=dark] .button.primary{background:#176ac0;color:#fff;border-color:#3989de}html[data-theme=dark] .button.primary:hover{background:#237cda}
html[data-theme=dark] .button.success{background:#16634f;border-color:#388e76;color:#fff}
html[data-theme=dark] :is(.button.danger,.alert.danger,.badge.danger,.kpi-card.late .kpi-icon){background:#432332;color:#ffb3bd;border-color:#864454}
html[data-theme=dark] :is(.alert.success,.badge.success,.kpi-card.paid .kpi-icon){background:#153d35;color:#95e8c9;border-color:#347c64}
html[data-theme=dark] :is(.alert.warning,.badge.warning){background:#3d3020;color:#ffd49a;border-color:#80623b}
html[data-theme=dark] .badge.info{background:#1c385c;color:#aed5ff;border-color:#3c638f}html[data-theme=dark] .badge.muted{background:#223247;color:#bfd0e3;border-color:#3d526e}
html[data-theme=dark] :is(.overdue){color:var(--red)}html[data-theme=dark] .warning-text{color:var(--amber)}
html[data-theme=dark] :is(a:hover,.page-eyebrow,.page-help summary,.inline-guide summary,.team-add>summary,.dashboard-more>summary,.secondary-details>summary,.team-unavailable>summary,.team-note>summary,.team-history>summary,.auth-kicker,#payment-preview,#bulk-payment-summary,.import-counts strong,.period-explanation strong){color:#9acbff}
html[data-theme=dark] .kpi-card.featured{background:linear-gradient(125deg,#1258a0,#1773c6);color:#fff;border-color:#388fdf}html[data-theme=dark] .kpi-card.featured :is(.kpi-heading,.kpi-footer){color:#e4f3ff}html[data-theme=dark] .kpi-card.featured .kpi-icon{background:#ffffff24;color:#fff}
html[data-theme=dark] .payment-ring:before{background:var(--panel)}html[data-theme=dark] .payment-ring{background:conic-gradient(#51b5fa var(--progress),#2b405a 0)}html[data-theme=dark] progress,html[data-theme=dark] progress::-webkit-progress-bar{background:#2b405a}
html[data-theme=dark] .auth-intro{background:radial-gradient(circle at 15% 15%,#16436e 0,transparent 60%),#101f34;color:var(--text)}
html[data-theme=dark] :is(.auth-intro h1,.auth-intro .auth-kicker){color:#e5edf8}html[data-theme=dark] :is(.auth-intro p,.auth-intro-footer){color:#b6cce3}
html[data-theme=dark] .brand-logo,html[data-theme=dark] .auth-logo{filter:brightness(0) invert(1)}
html[data-theme=dark] .command-dialog::backdrop{background:#030912bb}
html[data-theme=dark] .command-results a{color:var(--text);border-color:var(--line)}
html[data-theme=dark] .table-wrap{scrollbar-color:#526b89 #121f31}
html[data-theme=dark] :focus-visible{outline-color:#9acbff}
}
@media print{.theme-switch,.auth-theme-control{display:none!important}}

@media screen{html[data-theme=dark]{--balance-positive:#95e8c9;--balance-negative:#ffb3bd;--balance-neutral:#a5b7ce}}
