:root {
    color-scheme: light;
    --ui-primary: #087f8c;
    --ui-primary-hover: #066674;
    --ui-ink: #20384b;
    --ui-muted: #536779;
    --ui-line: #d6e5ec;
    --ui-soft: #edf8fa;
}

.app-shell {
    background: #f5fafc;
}

.app-shell .app-sidebar {
    width: 280px;
    min-width: 280px;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(165deg, #ffffff, #f5fbfc 90%);
    color: var(--ui-ink);
    border-right: 1px solid var(--ui-line);
    box-shadow: 12px 0 34px rgba(15, 23, 42, .1);
}

.app-brand {
    min-height: 78px;
    flex-shrink: 0;
    background: #ffffff;
    border-color: var(--ui-line);
}

.app-brand img {
    max-width: 210px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .13));
}

.app-nav {
    scrollbar-width: thin;
    scrollbar-color: #b9d5de transparent;
}

.app-nav-label {
    padding: 0 1rem .55rem;
    color: #61798a;
    font-size: .67rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .16em;
}

.app-nav-link {
    min-height: 47px;
    position: relative;
    gap: .75rem;
    font-size: .91rem;
    line-height: 1.2;
    white-space: nowrap;
}

.app-nav-link svg {
    flex: 0 0 auto;
    margin-right: 0;
    opacity: .87;
}

.app-nav-link:hover {
    background: #edf8fa;
    color: #066674;
}

.app-nav-link.is-active,
.app-nav-link.is-active:hover {
    background: #ddf1f4;
    color: #066674;
    box-shadow: inset 3px 0 0 #087f8c, 0 3px 10px rgba(8, 127, 140, .06);
}

.app-nav-link.is-active svg {
    color: #087f8c;
    opacity: 1;
}

.app-account {
    flex-shrink: 0;
    background: #f2f9fb;
    border-color: var(--ui-line);
}

.app-account button {
    min-height: 40px;
}

.app-topbar {
    min-height: 76px;
    flex-shrink: 0;
    border-color: #e5ebf2;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

.app-topbar-title h1 {
    line-height: 1.35;
}

.app-date {
    color: #155e75;
    background: #ecf9fc;
    border: 1px solid #c6eaf2;
}

.app-page {
    min-height: 0;
    background: radial-gradient(circle at 100% 0, rgba(8, 127, 140, .065), transparent 32%), #f5fafc;
}

.app-page > .bg-white.rounded-2xl,
.app-page > .grid > .bg-white.rounded-2xl,
.app-page > .grid > a.bg-white.rounded-2xl {
    border-color: #e5ebf3;
    box-shadow: 0 6px 25px rgba(28, 47, 81, .035);
}

.app-page table thead {
    background: #f8fafc;
}

.app-page table tbody tr:hover {
    background: #f7fbfe;
}

.dashboard-intro {
    padding: .25rem 0;
}

.dashboard-eyebrow {
    margin-bottom: .45rem;
    color: #087f8c;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.dashboard-primary-action {
    min-height: 43px;
    background: linear-gradient(130deg, #087f8c, #08717d);
    box-shadow: 0 8px 18px rgba(8, 127, 140, .18);
    transition: transform .18s, box-shadow .18s, background .18s;
}

.dashboard-primary-action:hover {
    background: linear-gradient(130deg, #066674, #066674);
    box-shadow: 0 10px 22px rgba(8, 127, 140, .24);
    transform: translateY(-1px);
}

.dashboard-stat {
    min-height: 132px;
    border-color: #e2eaf2;
}

.dashboard-stat:hover {
    border-color: #b9dce2;
    transform: translateY(-2px);
}

.dashboard-recent,
.directory-card {
    border-color: #e2eaf2;
}

.directory-search {
    background: #f5fbfc;
}

.directory-search input[type="search"] {
    border-color: #dbe5ee;
    min-height: 42px;
}

.directory-search input[type="search"]:focus {
    border-color: #087f8c;
    box-shadow: 0 0 0 3px rgba(8, 127, 140, .12);
}

.patient-breadcrumb a {
    color: #64748b;
    text-decoration: none;
}

.patient-breadcrumb a:hover {
    color: #066674;
}

.patient-hero {
    min-height: 152px;
    border-color: #deebf4;
    background: linear-gradient(112deg, #fff 40%, #f0fafb 100%);
    box-shadow: 0 12px 32px rgba(22, 50, 82, .06);
}

.patient-hero-decoration {
    position: absolute;
    width: 310px;
    height: 310px;
    right: -105px;
    top: -145px;
    border: 55px solid rgba(8, 127, 140, .055);
    border-radius: 50%;
    pointer-events: none;
}

.patient-avatar {
    background: linear-gradient(145deg, #1596a1, #08717d);
    box-shadow: 0 10px 22px rgba(8, 127, 140, .2);
}

.patient-eyebrow {
    margin-bottom: .2rem;
    color: #087f8c;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.patient-meta svg {
    flex: 0 0 auto;
}

.patient-action-btn {
    min-height: 38px;
    white-space: nowrap;
}

.patient-edit-btn {
    border-color: #b9def4;
    color: #066674;
    background: #edf8fa;
}

.patient-edit-btn:hover {
    background: #d9f0f4;
}

.patient-workspace {
    border-color: #e1e9f1;
    box-shadow: 0 10px 34px rgba(22, 42, 70, .045);
}

.clinical-tabs {
    padding: .8rem 1rem;
    border-bottom: 1px solid #e5ebf2;
    background: #f9fbfd;
}

.clinical-tab-nav {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    padding-bottom: 2px;
}

.clinical-tab-nav .tab-btn {
    min-height: 44px;
    padding: .65rem .95rem;
    border: 1px solid transparent;
    border-radius: .7rem;
    color: #52647c;
    font-weight: 600;
}

.clinical-tab-nav .tab-btn svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-right: .55rem;
    color: currentColor;
}

.clinical-tab-nav .tab-btn:hover {
    background: #edf8fa;
    color: #066674;
}

.clinical-tab-nav .tab-btn[aria-selected="true"],
.clinical-tab-nav .tab-btn[aria-selected="true"]:hover {
    background: #ddf1f4;
    border-color: #b9dce2;
    color: #066674;
    box-shadow: 0 2px 6px rgba(14, 116, 188, .08);
}

.clinical-content {
    background: #fff;
}

.clinical-content .tab-content > form > .bg-white.rounded-2xl,
.clinical-content #content-odontograma > .bg-white.rounded-2xl,
.clinical-content #content-odontograma > .w-full > .bg-white.rounded-2xl {
    border-color: #e5ecf3;
    box-shadow: 0 5px 18px rgba(20, 43, 70, .04);
}

.clinical-content .tab-content h3 {
    color: #1e293b;
    letter-spacing: -.02em;
}

.clinical-content #content-historia label {
    color: #334155;
}

.clinical-content #content-historia textarea,
.clinical-content #content-historia input[type="text"] {
    background: #f8fbfc;
    border-color: #dbe5ee;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.clinical-content #content-historia textarea:hover,
.clinical-content #content-historia input[type="text"]:hover {
    background: #fff;
    border-color: #a5cce5;
}

.clinical-content #content-historia textarea:focus,
.clinical-content #content-historia input[type="text"]:focus {
    background: #fff;
    border-color: #087f8c;
    box-shadow: 0 0 0 3px rgba(8, 127, 140, .12);
}

.clinical-row {
    border-radius: .5rem;
}

.clinical-row:hover {
    background: #f2f9fd;
}

.clinical-row input[type="checkbox"] {
    accent-color: #087f8c;
}

@media (max-width: 1023px) {
    .app-shell .app-sidebar {
        width: min(280px, 88vw);
        min-width: 0;
    }
}

@media (max-width: 639px) {
    .app-topbar { min-height: 64px; }
    .patient-hero { padding: 1.2rem; }
    .patient-hero h2 { font-size: 1.3rem; }
    .patient-avatar { width: 3.4rem; height: 3.4rem; font-size: 1.25rem; }
    .patient-meta { font-size: .75rem; }
    .clinical-tabs { padding: .65rem .7rem; }
    .clinical-tab-nav .tab-btn { padding: .6rem .7rem; }
}

/* Estilo común de la agenda: superficies claras, turquesa y texto oscuro. */
:is(.app-shell, .auth-shell) { color: var(--ui-ink); font-family: Inter, sans-serif; }
.app-shell .app-brand { color: var(--ui-ink); }
.app-shell .app-nav-link { color: #425a70; white-space: normal; }
.app-shell .app-nav-link:hover { color: #066674; }
.app-shell .app-nav-link.is-active { color: #066674; }
.app-shell .app-account-name { color: var(--ui-ink); }
.app-shell .app-account .text-gray-400 { color: var(--ui-muted); }
.app-shell .app-account :is(.app-account-link, button) {
    border: 1px solid #cbdce6; background: #fff; color: #365468;
    border-radius: 10px; font-weight: 500;
}
.app-shell .app-account .app-account-link:hover,
.app-shell .app-account .app-account-link[aria-current=page] { background: #ddf1f4; color: #066674; border-color: #9ecfd7; }
.app-shell .app-account button:hover { background: #fff1f2; color: #b4233c; border-color: #fecaca; }
.app-shell .app-topbar { border-color: var(--ui-line); }
.app-shell .app-topbar-title h1 { color: var(--ui-ink); }
:is(.app-shell, .auth-shell) :is(h1,h2,h3,h4).text-gray-900 { color: var(--ui-ink); }
:is(.app-shell, .auth-shell) :is(.text-gray-500,.text-slate-500) { color: var(--ui-muted); }
:is(.app-shell, .auth-shell) :is(.border-gray-100,.border-gray-200,.border-slate-200) { border-color: var(--ui-line); }
.app-page :is(.bg-white.rounded-2xl,details.rounded-2xl) { border-radius: 20px; box-shadow: 0 6px 25px #15315309; }
.app-page table thead { background: #edf8fa; color: #425a70; }
.app-page table th { font-size: 11px; letter-spacing: .06em; }
.app-page table tbody tr:hover { background: #f0fafb; }
.app-page table td { border-color: #e6eff3; }
:is(.app-shell, .auth-shell) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]),select,textarea) {
    border-color: #cbdce6; border-radius: 9px; background-color: #f8fbfc; color: #273a50;
}
:is(.app-shell, .auth-shell) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]),select,textarea):focus {
    border-color: #087f8c; outline: 2px solid #c4e8ec; outline-offset: 1px;
    box-shadow: none; --tw-ring-color: #c4e8ec;
}
:is(.app-shell, .auth-shell) input::placeholder,
:is(.app-shell, .auth-shell) textarea::placeholder { color: #6b8090; }
:is(.app-shell, .auth-shell) :is(input[type=checkbox],input[type=radio]) { accent-color: #087f8c; }
:is(.app-shell, .auth-shell) :is(input,textarea)[readonly] { background-color: #edf3f7; color: #536779; }
:is(.app-shell, .auth-shell) :is(button,a,input,select,textarea,summary):focus-visible { outline: 2px solid #087f8c; outline-offset: 3px; }
:is(.app-shell, .auth-shell) button:disabled { cursor: not-allowed; }
/* Compatibilidad con las utilidades existentes. No cambia las marcas clínicas. */
:is(.app-shell, .auth-shell) :is(.bg-blue-600,.bg-indigo-600,.bg-primary):not(.odonto-legend *) {
    background: #087f8c; color: #fff; border-color: #08717d; box-shadow: 0 3px 12px #087f8c25;
}
:is(.app-shell, .auth-shell) :is(.bg-blue-600,.bg-indigo-600,.bg-primary):not(.odonto-legend *):hover { background: #066674; }
: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: #08717d; }
: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-color: #edf8fa; }
:is(.app-shell, .auth-shell) :is(.border-blue-100,.border-blue-200,.border-primary):not(.odonto-legend *) { border-color: #c2e2e7; }
:is(.app-shell, .auth-shell) :is(.hover\:text-blue-500,.hover\:text-blue-600,.hover\:text-blue-800):not(.odonto-legend *):hover { color: #066674; }
:is(.app-shell, .auth-shell) :is(.hover\:bg-blue-50,.hover\:bg-blue-100,.hover\:bg-blue-50\/50):not(.odonto-legend *):hover { background-color: #ddf1f4; }
.app-shell .clinical-content .bg-gray-800 { background: #edf8fa; border-bottom: 1px solid #d5e8ec; }
.app-shell .clinical-content .bg-gray-800 .text-white { color: #20384b; }
.app-shell .clinical-content .bg-gray-800 .text-gray-400 { color: #536779; }
.app-shell .odonto-help button { color: #08717d; }
.app-shell .odonto-surface-options button[aria-pressed=true] { background: #ddf1f4; border-color: #087f8c; color: #066674; }
.app-shell .odonto-modal { border-color: var(--ui-line); color: var(--ui-ink); }
.app-shell .odonto-selection { background: #edf8fa; }
.app-shell .dashboard-primary-action { background: #087f8c; border: 1px solid #08717d; }
.app-shell .dashboard-primary-action:hover { background: #066674; }
.app-shell .patient-avatar { background: linear-gradient(145deg,#1596a1,#08717d); }
.auth-shell { background: linear-gradient(135deg,#f5fafc,#edf8fa); }
.auth-shell > main { border-color: var(--ui-line); border-radius: 22px; box-shadow: 0 15px 40px #15315312; }
.auth-shell > .bg-blue-400 { background-color: #8bd1d9; }
.auth-shell > .bg-indigo-400 { background-color: #b2e4da; }
.theme-swatch { width: 24px; height: 24px; border: 1px solid #cbdce6; border-radius: 7px; }
.theme-swatch-primary { background: #087f8c; }
.theme-swatch-soft { background: #edf8fa; }
.theme-swatch-ink { background: #20384b; }
@media(prefers-reduced-motion:reduce) {
    .auth-shell *, .app-shell * { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
:is(.app-shell, .auth-shell) :is(input,select,textarea)[aria-invalid=true] { border-color: #b4233c; background-color: #fff7f8; }
:is(.app-shell, .auth-shell) :is(input,select,textarea)[aria-invalid=true]:focus { outline-color: #fecdd3; }
