/* Selector compartido; el modo claro conserva los estilos actuales. */
.theme-toggle {
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    padding:8px 12px; min-height:38px; border:1px solid #cbdce6; border-radius:10px;
    background:#fff; color:#365468; font:600 12px/1.3 Inter,system-ui,sans-serif;
    white-space:nowrap; cursor:pointer;
}
.theme-toggle:hover { background:#edf8fa; border-color:#86bcc6; }
.theme-toggle:focus-visible { outline:2px solid #087f8c; outline-offset:3px; }
.auth-theme-control { position:absolute; top:16px; right:16px; z-index:20; }
body.auth-shell { padding-top:76px; padding-bottom:32px; }
@media(max-width:639px) {
    .app-topbar .theme-toggle { padding:7px 9px; font-size:11px; }
    .app-topbar-title h1 { font-size:14px; }
}
@media print { [data-theme-toggle],.auth-theme-control { display:none!important; } }

@media screen {
html[data-theme=dark] {
    color-scheme:dark; background:#0e1824;
    --ui-primary:#57c7cd; --ui-primary-hover:#8cdee2; --ui-ink:#e4edf5;
    --ui-muted:#adc0d0; --ui-line:#34485b; --ui-soft:#1c3640;
}
html[data-theme=dark] :is(.app-shell,.auth-shell) { background:#0e1824; color:#e4edf5; }
html[data-theme=dark] .app-shell .app-page { background:radial-gradient(circle at 100% 0,#18323e80,transparent 40%),#101d2a; }
html[data-theme=dark] .app-shell .app-sidebar { background:linear-gradient(165deg,#152431,#10202d); color:#e4edf5; border-color:#34485b; }
html[data-theme=dark] .app-shell :is(.app-brand,.app-topbar,.app-account) { background:#152431; border-color:#34485b; color:#e4edf5; }
html[data-theme=dark] .app-brand img { background:#fff; border-radius:8px; padding:4px; filter:none; }
html[data-theme=dark] .app-shell :is(.app-nav-label,.app-account .text-gray-400) { color:#adc0d0; }
html[data-theme=dark] .app-shell .app-nav-link { color:#c6d7e5; }
html[data-theme=dark] .app-shell .app-nav-link:hover { background:#1c3640; color:#a6e4e7; }
html[data-theme=dark] .app-shell .app-nav-link.is-active { background:#20434c; color:#a6e4e7; box-shadow:inset 3px 0 0 #57c7cd; }
html[data-theme=dark] .app-shell .app-nav-link.is-active svg { color:#7dd6db; }
html[data-theme=dark] .app-shell .app-account :is(.app-account-link,button),
html[data-theme=dark] .theme-toggle { background:#1c3040; border-color:#3a5266; color:#dcebf5; }
html[data-theme=dark] .app-shell .app-account .app-account-link:hover,
html[data-theme=dark] .theme-toggle:hover { background:#20434c; color:#a6e4e7; }
html[data-theme=dark] .app-shell .app-account button:hover { background:#4a2634; color:#ffb5c3; }
html[data-theme=dark] .app-date { background:#1c3640; color:#a6e4e7; border-color:#365a68; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.bg-white,.bg-gray-50,.bg-gray-50\/50,.bg-slate-50,.bg-gray-100) { background-color:#182a39; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.text-gray-900,.text-gray-800,.text-slate-900,.text-slate-800,h1,h2,h3,h4) { color:#e4edf5; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.text-gray-700,.text-gray-600,.text-gray-500,.text-gray-400,.text-slate-700,.text-slate-600,.text-slate-500,.text-slate-400) { color:#adc0d0; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.border-gray-100,.border-gray-200,.border-slate-200,.border-gray-300) { border-color:#34485b; }
html[data-theme=dark] .app-page :is(.bg-white.rounded-2xl,details.rounded-2xl),
html[data-theme=dark] .auth-shell > main { border-color:#34485b; box-shadow:0 8px 30px #0002; }
html[data-theme=dark] .app-page table thead { background:#1c3640; color:#c6d7e5; }
html[data-theme=dark] .app-page table :is(td,th),
html[data-theme=dark] .app-page table tbody tr { border-color:#34485b; }
html[data-theme=dark] .app-page table tbody tr:hover { background:#203b48; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]),select,textarea) {
    background:#122330; color:#e4edf5; border-color:#425a6e; color-scheme:dark;
}
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(input,select,textarea):focus { border-color:#57c7cd; outline-color:#356f79; box-shadow:none; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(input,textarea)::placeholder { color:#92aabb; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(input,textarea)[readonly] { background:#203240; color:#b9cbd8; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(input,select,textarea)[aria-invalid=true] { background:#3d2430; border-color:#ef9aab; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(button,a,summary):focus-visible { outline-color:#57c7cd; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.text-blue-500,.text-blue-600,.text-blue-700,.text-blue-800,.text-blue-900,.text-indigo-600,.text-primary):not(.odonto-legend *) { color:#8cdee2; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.bg-blue-50,.bg-blue-50\/50,.bg-blue-100,.bg-indigo-50,.bg-primary\/10):not(.odonto-legend *) { background:#1c3640; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.border-blue-100,.border-blue-200,.border-primary):not(.odonto-legend *) { border-color:#365a68; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.hover\:text-blue-500,.hover\:text-blue-600,.hover\:text-blue-800):not(.odonto-legend *):hover { color:#b7f0f2; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.hover\:bg-blue-50,.hover\:bg-blue-100,.hover\:bg-blue-50\/50,.hover\:bg-gray-50,.hover\:bg-gray-100):not(.odonto-legend *):hover { background-color:#20434c; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.bg-green-50,.bg-emerald-50,.bg-green-100,.bg-emerald-100) { background:#173e35; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.text-green-600,.text-green-700,.text-green-800,.text-emerald-600,.text-emerald-700,.text-emerald-800) { color:#86dfbb; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.bg-red-50,.bg-red-100,.bg-rose-50) { background:#432735; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.text-red-500,.text-red-600,.text-red-700,.text-red-800) { color:#ffacbc; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.bg-amber-50,.bg-amber-100,.bg-yellow-50,.bg-yellow-100) { background:#40351f; }
html[data-theme=dark] :is(.app-shell,.auth-shell) :is(.text-amber-700,.text-amber-800,.text-yellow-700,.text-yellow-800) { color:#f6d783; }
html[data-theme=dark] .app-shell :is(.dashboard-eyebrow,.patient-eyebrow,.patient-breadcrumb a) { color:#8cdee2; }
html[data-theme=dark] .app-shell :is(.directory-search,.clinical-tabs) { background:#142835; border-color:#34485b; }
html[data-theme=dark] .app-shell .patient-hero { background:linear-gradient(112deg,#182a39 40%,#1c3640); border-color:#34485b; }
html[data-theme=dark] .app-shell .patient-edit-btn { background:#1c3640; border-color:#365a68; color:#a6e4e7; }
html[data-theme=dark] .app-shell :is(.patient-workspace,.clinical-content) { background:#182a39; border-color:#34485b; }
html[data-theme=dark] .app-shell .clinical-tab-nav .tab-btn { color:#adc0d0; }
html[data-theme=dark] .app-shell .clinical-tab-nav .tab-btn[aria-selected=true] { background:#20434c; color:#a6e4e7; border-color:#365a68; }
html[data-theme=dark] .app-shell .clinical-tab-nav .tab-btn:hover,
html[data-theme=dark] .app-shell .clinical-row:hover { background:#203b48; }
html[data-theme=dark] .app-shell .clinical-content #content-historia label { color:#c6d7e5; }
html[data-theme=dark] .app-shell .clinical-content #content-historia :is(textarea,input[type=text]) { background:#122330; color:#e4edf5; border-color:#425a6e; }
html[data-theme=dark] .app-shell .clinical-content #content-historia :is(textarea,input[type=text]):focus { border-color:#57c7cd; box-shadow:none; }
html[data-theme=dark] .app-shell .clinical-content .bg-gray-800 { background:#1c3640; border-color:#34485b; }
html[data-theme=dark] .app-shell .clinical-content .bg-gray-800 :is(.text-white,.text-gray-400) { color:#e4edf5; }
html[data-theme=dark] .app-shell :is(.odonto-modal,.odonto-modal header) { background:#182a39; color:#e4edf5; border-color:#34485b; }
html[data-theme=dark] .app-shell :is(.odonto-help,.odonto-summary,.odonto-save-status,.odontograma-board .tooth-number) { color:#adc0d0; }
html[data-theme=dark] .app-shell .odonto-help button { color:#8cdee2; }
html[data-theme=dark] .app-shell :is(.odonto-close,.odonto-surface-options button,.odonto-whole-actions button) { background:#203240; color:#e4edf5; border-color:#425a6e; }
html[data-theme=dark] .app-shell .odonto-surface-options button[aria-pressed=true] { background:#20434c; color:#a6e4e7; border-color:#57c7cd; }
html[data-theme=dark] .app-shell .odonto-selection { background:#1c3640; }
html[data-theme=dark] .app-shell .odonto-legend .text-blue-700 { color:#9fc4ff; }
html[data-theme=dark] .app-shell .odonto-legend .hover\:bg-blue-50:hover { background:#203955; }
html[data-theme=dark] .app-shell .odontograma-board .tooth { background:#203240; border-color:#425a6e; }
html[data-theme=dark] .auth-shell > :is(.bg-blue-400,.bg-indigo-400) { opacity:.08; }
/* Agenda y su formulario, incluidos los elementos que se crean por JavaScript. */
html[data-theme=dark] .agenda-app { --agenda-muted:#adc0d0; background:linear-gradient(135deg,#182c3d,#142331); color:#e4edf5; border-color:#34485b; }
html[data-theme=dark] .agenda-app :is(.agenda-heading h2,.agenda-navigation strong) { color:#e4edf5; }
html[data-theme=dark] :is(.agenda-eyebrow,.agenda-dialog .agenda-eyebrow) { color:#8cdee2; }
html[data-theme=dark] .agenda-app :is(.agenda-stats,.agenda-day-header,.agenda-time-header,.agenda-time-column) { background:#1b3244; border-color:#34485b; }
html[data-theme=dark] .agenda-app :is(.agenda-stats span,.agenda-stats p,.agenda-feedback,.agenda-bottom,.agenda-doctor-filter span,.agenda-day-header span,.agenda-time-label,.agenda-time-header) { color:#adc0d0; }
html[data-theme=dark] .agenda-app .agenda-stats>div { border-color:#34485b; }
html[data-theme=dark] :is(.agenda-button.secondary,.agenda-navigation button,.agenda-view-switch,.agenda-status-filters button) { background:#203240; color:#dcebf5; border-color:#425a6e; }
html[data-theme=dark] .agenda-view-switch button { color:#dcebf5; }
html[data-theme=dark] .agenda-view-switch button[aria-pressed=true] { background:#087f8c; color:#fff; }
html[data-theme=dark] .agenda-calendar-scroll,
html[data-theme=dark] .agenda-day-column { background:#132432; border-color:#34485b; }
html[data-theme=dark] .agenda-day-column.today { background:#16313c; }
html[data-theme=dark] .agenda-day-header.today { background:#20434c; }
html[data-theme=dark] .agenda-day-header.today span { color:#a6e4e7; }
html[data-theme=dark] .agenda-slot { border-color:#304658; }
html[data-theme=dark] .agenda-slot.half { border-color:#263e4e; }
html[data-theme=dark] .agenda-slot:hover { background:#2d637c40; }
html[data-theme=dark] .agenda-state-pendiente { --event-color:#efc56b; --event-bg:#44371f; }
html[data-theme=dark] .agenda-state-confirmada { --event-color:#8dbbfa; --event-bg:#203e5d; }
html[data-theme=dark] .agenda-state-en_curso { --event-color:#79d7b4; --event-bg:#1c443b; }
html[data-theme=dark] .agenda-state-completada { --event-color:#b6c6d8; --event-bg:#304253; }
html[data-theme=dark] .agenda-state-cancelada { --event-color:#f1a3b2; --event-bg:#4a2939; }
html[data-theme=dark] .agenda-state-no_asistio { --event-color:#d4afea; --event-bg:#443152; }
html[data-theme=dark] .agenda-event,
html[data-theme=dark] .agenda-event em { color:#eef6fc; }
html[data-theme=dark] .agenda-event.is-block { --event-color:#c7b3ef; background:repeating-linear-gradient(135deg,#393450,#393450 7px,#423c5b 7px,#423c5b 10px); }
html[data-theme=dark] .agenda-status-filters button[aria-pressed=true] { color:#eef6fc; background:var(--event-bg,#20434c); }
html[data-theme=dark] :is(.agenda-dialog,.agenda-dialog header,.agenda-dialog footer) { background:#182a39; color:#e4edf5; border-color:#34485b; }
html[data-theme=dark] :is(.agenda-icon-button,.agenda-quick button,.agenda-dialog .agenda-button.secondary) { background:#203240; color:#dcebf5; border-color:#425a6e; }
html[data-theme=dark] :is(.agenda-time-summary,.agenda-quick button.active) { background:#1c3640; color:#a6e4e7; border-color:#365a68; }
html[data-theme=dark] :is(.agenda-field-help,.agenda-quick span) { color:#adc0d0; }
html[data-theme=dark] .agenda-patient-picker :is([role=listbox],[role=option]) { background:#203240; color:#e4edf5; border-color:#425a6e; }
html[data-theme=dark] .agenda-patient-picker [role=option]:is(:hover,[aria-selected=true]) { background:#20434c; }
html[data-theme=dark] .agenda-selected-patient { background:#173e35; color:#86dfbb; border-color:#38685a; }
html[data-theme=dark] :is(.agenda-error,.agenda-button.danger) { background:#432735; color:#ffacbc; border-color:#805062; }
html[data-theme=dark] .agenda-feedback.is-error { color:#ffacbc; }
html[data-theme=dark] .app-shell .app-page .dashboard-stat { border-color:#34485b; }
html[data-theme=dark] .app-shell .app-page .divide-y > :not([hidden]) ~ :not([hidden]) { border-color:#34485b; }
html[data-theme=dark] .app-shell .odonto-state-actions [data-state="Sano"] { background:#203240; color:#e4edf5; border-color:#425a6e; }
/* Documento siempre legible como hoja blanca, incluso con controles oscuros. */
html[data-theme=dark] body.print-shell { background:#101d2a; color:#e4edf5; }
html[data-theme=dark] .print-shell .sheet { background:#fff; color:#172033; }
html[data-theme=dark] .print-shell .toolbar>button:not(.primary) { background:#203240; border-color:#425a6e; color:#dcebf5; }
}
