/* Theme tokens: keep text, surfaces and action fills separate. */
:root {
 --color-bg:#f5f6fa; --color-surface:#ffffff; --color-surface-muted:#efeff8;
 --color-border:#d2d9e6; --color-text:#27334b; --color-text-muted:#627087;
 --color-primary:#5956c9; --color-primary-hover:#4541aa; --color-link:#504bb6;
 --color-input-bg:#ffffff; --color-input-border:#a4aec1; --color-on-primary:#ffffff;
 --color-success-bg:#eaf6ef; --color-success-text:#2c6845;
 --color-warning-bg:#fff5e5; --color-warning-text:#825e23;
 --color-danger-bg:#fcefee; --color-danger-text:#9b4544;
}
html[data-theme=light]{color-scheme:light}
html[data-theme=dark]{
 color-scheme:dark;
 --color-bg:#171c29; --color-surface:#222b3c; --color-surface-muted:#303b51;
 --color-border:#485670; --color-text:#edf0f8; --color-text-muted:#b7c2d6;
 --color-primary:#6259c7; --color-primary-hover:#5148b2; --color-link:#cbc5ff;
 --color-input-bg:#192131; --color-input-border:#71809c; --color-on-primary:#fff;
 --color-success-bg:#213f36; --color-success-text:#b0e9ca;
 --color-warning-bg:#453923; --color-warning-text:#f4d693;
 --color-danger-bg:#472d37; --color-danger-text:#ffc4cd;
 --paper:var(--color-bg); --surface:var(--color-surface); --soft:var(--color-surface-muted);
 --ink:var(--color-text); --muted:var(--color-text-muted); --line:var(--color-border);
 --accent:var(--color-link); --accent-hover:#e2deff; --shadow:0 8px 28px #00000020;
}
html[data-theme=dark] body{background:var(--color-bg);color:var(--color-text)}
html[data-theme=dark] :is(.panel,.sidebar,.topbar,.online-header,.card,.table-wrap,.booking-summary,.wizard-panel,table,.auth-form,.stat-card,.metric-card,.booking-panel,.patient-login-dialog,.patient-tabs){background:var(--color-surface);color:var(--color-text);border-color:var(--color-border)}
/* Access pages share this hero, including recovery and password setup. */
html[data-theme=dark] .auth-story{background:#25283f;color:var(--color-text)}
html[data-theme=dark] .auth-content{background:var(--color-bg)}
html[data-theme=dark] .auth-story :is(.brand,h1,h2,p,strong){color:var(--color-text)}
html[data-theme=dark] .auth-story :is(.eyebrow,.auth-symbol,a){color:var(--color-link)}
html[data-theme=dark] .auth-story :is(.auth-note,.auth-message>p:last-child){color:var(--color-text-muted)}
html[data-theme=dark] :is(.muted,.role-label,.sidebar-footer,.nav-caption,.eyebrow,.patient-readonly dt){color:var(--color-text-muted)}
html[data-theme=dark] :is(h1,h2,h3,label,legend,.brand){color:var(--color-text)}
html[data-theme=dark] a{color:var(--color-link)}
html[data-theme=dark] a:hover{color:#e2deff}
html[data-theme=dark] input:not([type=checkbox]):not([type=radio]),html[data-theme=dark] select,html[data-theme=dark] textarea,html[data-theme=dark] [contenteditable=true]{background:var(--color-input-bg)!important;color:var(--color-text)!important;border-color:var(--color-input-border)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:var(--color-text-muted);opacity:1}
html[data-theme=dark] input:autofill{box-shadow:0 0 0 1000px var(--color-input-bg) inset;-webkit-text-fill-color:var(--color-text)}
html[data-theme=dark] input:is([type=checkbox],[type=radio]){accent-color:var(--color-primary)}
html[data-theme=dark] :is(input,select,textarea):disabled{color:var(--color-text-muted)!important;opacity:1}
html[data-theme=dark] :is(button,.button){background:var(--color-primary);color:var(--color-on-primary);border-color:#958de5}
html[data-theme=dark] :is(button,.button):hover{background:var(--color-primary-hover);color:var(--color-on-primary)}
/* Existing base styles use !important for secondary buttons. */
html[data-theme=dark] :is(.button-secondary,.table-action),html[data-theme=dark] .login-booking .button,html[data-theme=dark] #rich-tools button{background:var(--color-surface-muted)!important;color:var(--color-link)!important;border-color:var(--color-input-border)!important}
html[data-theme=dark] .button-danger{background:#913648!important;color:#fff!important}
html[data-theme=dark] :focus-visible{outline-color:var(--color-link)}
html[data-theme=dark] :is(th,thead,tbody tr:hover){background:var(--color-surface-muted);color:var(--color-text)}
html[data-theme=dark] :is(td,th,.profile-group,.calendar-legend,.available-times,.booking-content .section-heading h2){border-color:var(--color-border)}
html[data-theme=dark] .sidebar nav a{color:var(--color-text-muted)}
html[data-theme=dark] .sidebar nav a:hover,html[data-theme=dark] .sidebar nav a[aria-current=page],html[data-theme=dark] .patient-tabs a[aria-current=page]{background:var(--color-surface-muted);color:var(--color-link)}
html[data-theme=dark] .badge{background:var(--color-surface-muted);color:var(--color-link);border-color:var(--color-border)}
html[data-theme=dark] .badge:is([data-status=confirmado],[data-status=activo],[data-status=atendido]){background:var(--color-success-bg);color:var(--color-success-text)}
html[data-theme=dark] .badge:is([data-status=ausente],[data-status=cancelado]){background:var(--color-danger-bg);color:var(--color-danger-text)}
html[data-theme=dark] .badge[data-status=reprogramado]{background:var(--color-warning-bg);color:var(--color-warning-text)}
html[data-theme=dark] .badge[data-status=inactivo]{background:var(--color-surface-muted);color:var(--color-text-muted)}
html[data-theme=dark] .alert{background:var(--color-success-bg);color:var(--color-success-text);border-color:#52816d}
html[data-theme=dark] .alert-error{background:var(--color-danger-bg);color:var(--color-danger-text);border-color:#a96979}
html[data-theme=dark] .alert :is(strong,a){color:inherit}
html[data-theme=dark] .action-tooltip{background:var(--color-text);color:var(--color-bg)}
html[data-theme=dark] :is(.slot-search,.patient-readonly,.patient-login-invite,.price-summary,.coverage-option,.slot-option span){background:var(--color-surface-muted);color:var(--color-text);border-color:var(--color-border)}
html[data-theme=dark] .coverage-option:has(input:checked){background:#373357;border-color:#b1a9f3}
html[data-theme=dark] .slot-option input:checked+span{background:var(--color-primary);color:var(--color-on-primary);border-color:#b1a9f3}
html[data-theme=dark] .patient-login-dialog::backdrop{background:#080d19bb}
html[data-theme=dark] :is(.booking-progress,.booking-progress li>div,.progress-number,.wizard-steps){background:var(--color-surface);color:var(--color-text-muted);border-color:var(--color-border)}
html[data-theme=dark] .booking-progress .current{color:var(--color-link)}
html[data-theme=dark] .booking-progress .current .progress-number{background:var(--color-primary);color:white}
html[data-theme=dark] .booking-progress li:not(:last-child)::before{background:var(--color-border)}
html[data-theme=dark] .month-day{background:var(--color-surface-muted);color:var(--color-text);border-color:var(--color-border)}
html[data-theme=dark] .month-day.is-available{background:var(--color-success-bg);color:var(--color-success-text);border-color:#52816d}
html[data-theme=dark] .month-day:is(.is-unavailable,.is-past){background:var(--color-surface);color:var(--color-text-muted)}
html[data-theme=dark] .month-day.is-blocked{background:var(--color-danger-bg);color:var(--color-danger-text)}
html[data-theme=dark] .month-day.is-full{background:var(--color-warning-bg);color:var(--color-warning-text)}
html[data-theme=dark] .month-day.is-selected{background:var(--color-primary);color:white;border-color:#c5bfff;box-shadow:0 0 0 2px #8c82d2}
html[data-theme=dark] .fc{--fc-page-bg-color:var(--color-surface);--fc-neutral-bg-color:var(--color-surface-muted);--fc-neutral-text-color:var(--color-text-muted);--fc-border-color:var(--color-border);--fc-today-bg-color:#363250;--fc-list-event-hover-bg-color:var(--color-surface-muted);--fc-button-bg-color:var(--color-primary);--fc-button-border-color:var(--color-primary);--fc-button-hover-bg-color:var(--color-primary-hover);--fc-button-active-bg-color:var(--color-primary-hover);--fc-event-bg-color:var(--color-primary);--fc-event-border-color:var(--color-primary);--fc-event-text-color:white}
html[data-theme=dark] .fc .fc-event,html[data-theme=dark] .fc .fc-event a{color:white}
.theme-control{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.theme-control label{margin:0;white-space:nowrap}.theme-control select{width:auto;min-height:44px;margin:0}.theme-feedback{font-size:13px;max-width:220px}.guest-theme-header{display:flex;justify-content:flex-end;padding:12px 24px}.topbar,.online-header{flex-wrap:wrap;gap:12px}@media(max-width:560px){.theme-control{font-size:13px}.theme-control select{max-width:145px}}
