@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ── Design tokens (fluid / full-viewport) ── */
:root {
    /* Breakpoints (contrato app): móvil <768 | tablet 768–1023 | desktop ≥1024
       Usar literales en @media (custom props no aplican en media queries). */
    --bp-tablet: 768px;
    --bp-desktop: 1024px;
    --df-container-max: 80rem;
    --df-container-pad: clamp(0.5rem, 0.4rem + 1vw, 1.25rem);

    --font-xs:   clamp(0.7rem,  0.65rem + 0.2vw,  0.8rem);
    --font-sm:   clamp(0.8rem,  0.72rem + 0.3vw,  0.9rem);
    --font-base: clamp(0.875rem, 0.78rem + 0.4vw,  1rem);
    --font-md:   clamp(0.95rem,  0.85rem + 0.45vw, 1.1rem);
    --font-lg:   clamp(1.05rem,  0.92rem + 0.55vw, 1.25rem);
    --gap-xs:    clamp(0.25rem, 0.2rem + 0.15vw, 0.4rem);
    --gap-sm:    clamp(0.4rem,  0.3rem + 0.25vw, 0.6rem);
    --gap-md:    clamp(0.5rem,  0.4rem + 0.35vw, 0.75rem);
    --gap-lg:    clamp(0.65rem, 0.5rem + 0.5vw,  1rem);
    --header-h:  0px;
    --ui-green: #16a34a;
    --ui-green-dark: #047857;
    --ui-caption: linear-gradient(180deg, #0f766e 0%, #047857 100%);
    --ui-btn-h: 2.15rem;
    --ui-btn-radius: 999px;
    accent-color: #16a34a;
    --sidebar-w: clamp(15.5rem, 14rem + 2vw, 18.5rem);
    --mobile-nav-h: clamp(3.25rem, 3rem + 1vw, 3.75rem);
    --radius:    0.5rem;
    --tooth-size: clamp(1.6rem, 1.2rem + 1.1vw, 2.75rem);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
}

button,
input,
select,
textarea {
    accent-color: var(--ui-green);
}

:focus-visible {
    outline: 2px solid var(--ui-green);
    outline-offset: 2px;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: var(--font-base);
    line-height: 1.45;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

.font-mono { font-family: 'JetBrains Mono', monospace; }

/* Scrollbars */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f5f9; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }

/* ── Responsive utilities (Paso 1) ── */
.df-container {
    width: 100%;
    max-width: var(--df-container-max);
    margin-inline: auto;
    padding-inline: var(--df-container-pad);
    min-width: 0;
}

.df-container--fluid {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    padding-inline: var(--df-container-pad);
    min-width: 0;
}

/* Alias documentado; .table-scroll se mantiene por compatibilidad */
.df-table-scroll,
.table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

/* Tablet+ (≥ 768px) */
@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-inline-flex { display: inline-flex !important; }
}

/* Desktop+ (≥ 1024px) */
@media (min-width: 1024px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-inline-flex { display: inline-flex !important; }
}

/* Solo tablet (768–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .d-md-only { display: block !important; }
    .d-md-only-flex { display: flex !important; }
}
@media (max-width: 767px), (min-width: 1024px) {
    .d-md-only,
    .d-md-only-flex { display: none !important; }
}

/* ── App shell (100% viewport) ── */
.app-workspace {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    overflow: hidden;
    background: #0f172a;
}

.app-frame {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f1f5f9;
}

.app-body {
    position: relative;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.app-menu-btn {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    z-index: 42;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.375rem;
    border: 1px solid #334155;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgb(15 23 42 / 0.35);
}
.app-menu-btn:hover { background: #334155; }

@media (min-width: 768px) {
    .app-body:not(.app-body--sidebar-collapsed) .app-menu-btn {
        display: none;
    }
}

.app-user-dock {
    position: fixed;
    right: 0.65rem;
    bottom: 0.65rem;
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.4rem 0.35rem 0.5rem;
    background: rgb(15 23 42 / 0.94);
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 0.65rem;
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.4);
    backdrop-filter: blur(8px);
    max-width: calc(100vw - 1.3rem);
}

/* En Agenda el dock tapa la leyenda/acciones; ya hay Salir en pantalla */
body:has(.agenda-screen) .app-user-dock {
    display: none;
}
.app-user-dock__demo {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fcd34d;
    background: rgb(120 53 15 / 0.55);
    border: 1px solid #b45309;
    border-radius: 0.35rem;
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
}
.app-user-dock__who {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.app-user-dock__avatar {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}
.app-user-dock__name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #5eead4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}
.app-user-dock__logout {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #e2e8f0;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 0.4rem;
    padding: 0.28rem 0.7rem;
    text-decoration: none;
}
.app-user-dock__logout:hover {
    background: #334155;
    color: #fff;
}

.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    z-index: 40;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        linear-gradient(180deg, #0c3b2e 0%, #08261d 38%, #061910 100%);
    color: #d1fae5;
    border-right: 1px solid #14532d;
    user-select: none;
    transition: width 0.22s ease, min-width 0.22s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.7rem 0.55rem;
    flex-shrink: 0;
}

.app-sidebar__brand-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.app-sidebar__logo {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
    background: linear-gradient(180deg, #4ade80 0%, #16a34a 55%, #15803d 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 4px 10px rgba(22, 163, 74, 0.35);
}

.app-sidebar__brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.app-sidebar__brand-text strong {
    font-size: 0.95rem;
    font-weight: 800;
    color: #ecfdf5;
    letter-spacing: -0.01em;
}

.app-sidebar__brand-text span {
    font-size: 0.68rem;
    font-weight: 600;
    color: #86efac;
}

.app-sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.35rem 0.55rem 0.75rem;
}

.app-sidebar__section {
    margin: 0.85rem 0.45rem 0.3rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6ee7b7;
}

.app-sidebar__section:first-child { margin-top: 0.15rem; }

.app-sidebar__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin: 0.12rem 0;
    padding: 0.42rem 0.55rem;
    border-radius: 0.7rem;
    text-decoration: none;
    color: #d1fae5;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.app-sidebar__link:hover {
    background: rgba(74, 222, 128, 0.12);
    color: #fff;
}

.app-sidebar__link.is-active {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 42%, #16a34a 100%);
    color: #052e16;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 6px 14px rgba(22, 163, 74, 0.28);
}

.app-sidebar__link-main {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.app-sidebar__icon {
    width: 1.15rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    line-height: 1;
}

.app-sidebar__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__badge {
    flex-shrink: 0;
    padding: 0.08rem 0.38rem;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #bbf7d0;
    background: rgba(6, 78, 59, 0.85);
    border: 1px solid rgba(74, 222, 128, 0.28);
}

.app-sidebar__link.is-active .app-sidebar__badge {
    color: #14532d;
    background: rgba(255, 255, 255, 0.72);
    border-color: transparent;
}

.app-sidebar__seat {
    margin: 0.4rem 0.55rem 0.65rem;
    padding: 0.7rem 0.75rem 0.65rem;
    border-radius: 0.9rem;
    background: linear-gradient(180deg, #0f3d2e 0%, #0a2a20 100%);
    border: 1px solid #166534;
    box-shadow: inset 0 1px 0 rgba(134, 239, 172, 0.12);
    flex-shrink: 0;
}

.app-sidebar__seat-head {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4ade80;
}

.app-sidebar__seat-head .font-mono {
    color: #86efac;
    font-weight: 700;
    letter-spacing: 0;
}

.app-sidebar__seat-name {
    margin-top: 0.28rem;
    font-size: 0.86rem;
    font-weight: 800;
    color: #f0fdf4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__seat-os {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: #86efac;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__seat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 0.55rem;
}

.app-sidebar__attend {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
    color: #052e16;
    font-size: 0.68rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

.app-sidebar__attend:hover { filter: brightness(1.06); }

.app-sidebar__balance {
    font-size: 0.68rem;
    font-weight: 800;
    color: #4ade80;
    white-space: nowrap;
}

.app-sidebar__balance.is-due { color: #fde68a; }

/* Evita animación/parpadeo al rehidratar preferencia colapsada */
html.sidebar-boot-collapsed .app-sidebar {
    transition: none !important;
}

/* Escritorio: acordeón — menú lateral colapsado */
@media (min-width: 768px) {
    .app-body--sidebar-collapsed .app-sidebar {
        width: 0;
        min-width: 0;
        opacity: 0;
        border-color: transparent;
        pointer-events: none;
    }

    /* Resaltado = menú oculto, clic para volver a mostrar */
    .app-body--sidebar-collapsed .app-menu-btn {
        background: #0f766e;
        border-color: #14b8a6;
        color: #ccfbf1;
    }
}

.app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgb(15 23 42 / 0.65);
    z-index: 35;
    border: none;
    padding: 0;
    cursor: pointer;
}

.app-sidebar-backdrop.is-visible { display: block; }

.app-mobile-nav {
    display: none;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: #0f172a;
    color: #fff;
    border-top: 1px solid #1e293b;
    padding: 0.25rem 0;
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.app-mobile-nav::-webkit-scrollbar { display: none; }

.app-mobile-nav__inner {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    min-width: min-content;
    padding: 0 0.25rem;
}

.app-mobile-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 4.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    flex-shrink: 0;
    border-radius: 0.375rem;
}
.app-mobile-nav__link:hover { color: #cbd5e1; background: #1e293b; }
.app-mobile-nav__link.is-active { color: #2dd4bf; }
.app-mobile-nav__icon { font-size: 1.2rem; line-height: 1.2; }

.app-sidebar__close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border: 1px solid #166534;
    border-radius: 999px;
    background: rgba(6, 78, 59, 0.55);
    color: #bbf7d0;
    cursor: pointer;
    font-size: 0.85rem;
}

.app-sidebar__collapse {
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border: 1px solid #166534;
    border-radius: 999px;
    background: rgba(6, 78, 59, 0.45);
    color: #bbf7d0;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
}
.app-sidebar__collapse:hover,
.app-sidebar__close:hover {
    background: #166534;
    color: #ecfdf5;
}

@media (min-width: 768px) {
    .app-sidebar__collapse { display: inline-flex; }
}

.app-main {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-content {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--gap-sm);
}
.app-content:has(.prof-screen) {
    padding: 0;
}
.app-content:has(.agenda-screen) {
    padding: 0.15rem;
}
.app-content:has(.odonto-screen) {
    padding: 0.2rem;
}

.app-content--scroll {
    overflow-y: auto;
}

/* ── Módulos genéricos ── */
.module-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap-md);
    height: 100%;
}

.module-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.module-card-head {
    padding: var(--gap-md) var(--gap-lg);
    border-bottom: 1px solid #f1f5f9;
}

.module-card-head--split {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--gap-sm);
}

.module-title {
    font-size: var(--font-md);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #0f172a;
}

.module-subtitle {
    font-size: var(--font-sm);
    color: #64748b;
    margin-top: 0.15rem;
}

.module-body {
    padding: var(--gap-lg);
    font-size: var(--font-base);
}

.module-table {
    width: 100%;
    font-size: var(--font-sm);
    border-collapse: collapse;
}

.crud-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.module-table th {
    padding: var(--gap-sm) var(--gap-md);
    text-align: left;
    font-size: var(--font-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.module-table td {
    padding: var(--gap-sm) var(--gap-md);
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.patient-bar {
    flex-shrink: 0;
    padding: var(--gap-sm) var(--gap-lg);
    font-size: var(--font-sm);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-sm);
}

.patient-bar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-sm);
    width: 100%;
}

@media (min-width: 640px) {
    .patient-bar__actions { width: auto; }
}

.patient-bar__name {
    font-size: var(--font-md);
    font-weight: 700;
    color: #0f172a;
}

.patient-bar__meta {
    font-size: var(--font-sm);
    color: #64748b;
}

/* ── Odontograma full-screen ── */
.odonto-screen {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: grid;
    /* Toolbar | odontograma al contenido | historial con más peso */
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.2rem;
    overflow: hidden;
}

/* Toolbar única compacta */
.odonto-select-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.45rem;
    padding: 0.22rem 0.4rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
    font-size: var(--font-sm);
    flex-shrink: 0;
}

.odonto-toolbar-patient {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    min-width: 0;
}

.odonto-toolbar-patient__search {
    width: 8.5rem;
    max-width: 22vw;
    border: 1px solid #cbd5e1;
    border-radius: 0.3rem;
    padding: 0.28em 0.5em;
    font-size: var(--font-xs);
    background: #f8fafc;
    min-width: 0;
}

.odonto-toolbar-patient__select {
    max-width: 11rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.3rem;
    padding: 0.28em 0.4em;
    font-size: var(--font-xs);
    background: #fff;
    min-width: 0;
}

.odonto-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid;
    flex-shrink: 0;
}

.odonto-status-pill__dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.odonto-status-pill--ok {
    color: #047857;
    background: #ecfdf5;
    border-color: #6ee7b7;
}
.odonto-status-pill--ok .odonto-status-pill__dot { background: #10b981; }

.odonto-status-pill--warn {
    color: #b45309;
    background: #fffbeb;
    border-color: #fcd34d;
}
.odonto-status-pill--warn .odonto-status-pill__dot { background: #f59e0b; }

.odonto-select-bar__group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.odonto-select-bar__label {
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    font-size: 0.65rem;
    white-space: nowrap;
    align-items: center;
}

.odonto-layer-btn-group,
.odonto-click-mode-group {
    display: flex;
    gap: 2px;
    background: #f1f5f9;
    padding: 2px;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
}

.odonto-layer-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 999px;
}

.odonto-layer-switch__btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    min-height: 1.85rem;
    padding: 0 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.odonto-layer-switch__btn:hover {
    background: #f0fdf4;
    color: #14532d;
}

.odonto-layer-switch__btn.is-active {
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.odonto-layer-switch__btn.odonto-layer-btn--initial.is-active { background: #2563eb; }
.odonto-layer-switch__btn.odonto-layer-btn--completed.is-active { background: #ea580c; }
.odonto-layer-switch__btn.odonto-layer-btn--planned.is-active { background: #16a34a; }

.odonto-select-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-left: auto;
}

.odonto-mode-btn {
    padding: 0.28em 0.55em;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    background: transparent;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    color: #475569;
    min-height: 1.7rem;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.odonto-mode-btn:hover { background: #e2e8f0; }

.odonto-mode-btn--active {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

.odonto-layer-btn--initial.odonto-mode-btn--active { background: #2563eb; }
.odonto-layer-btn--planned.odonto-mode-btn--active { background: #16a34a; }
.odonto-layer-btn--completed.odonto-mode-btn--active { background: #ea580c; }

.odonto-select-mode.odonto-mode-btn--active {
    background: #0f766e;
    color: #fff;
}

.odonto-dentition-btn.odonto-mode-btn--active {
    background: #7c3aed;
    color: #fff;
}

.odonto-clear-btn {
    border: 1px solid #fecaca !important;
    background: #fff !important;
    color: #dc2626 !important;
}
.odonto-clear-btn:hover { background: #fef2f2 !important; }

.odonto-selection-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 1;
    min-height: 1.35rem;
    align-items: center;
    font-size: var(--font-sm);
    min-width: 5rem;
}

.odonto-selection-chips__hint {
    color: #94a3b8;
    font-size: 0.65rem;
    font-style: italic;
}

.odonto-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.2em 0.5em;
    background: #ccfbf1;
    border: 1px solid #5eead4;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #115e59;
}

.odonto-chip__remove {
    background: none;
    border: none;
    color: #dc2626;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1.1em;
}

.odonto-top {
    display: grid;
    grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
    gap: 0.25rem;
    min-height: 0;
    overflow: hidden;
    align-items: start;
}

.odonto-top--patient-collapsed {
    grid-template-columns: 2rem minmax(0, 1fr);
}


.odonto-patient-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
    transition: width 0.2s ease;
}

.odonto-patient-panel.is-collapsed .odonto-patient-body {
    display: none;
}

.odonto-patient-panel.is-collapsed .odonto-panel-head__title,
.odonto-patient-panel.is-collapsed .odonto-panel-head__badge {
    display: none;
}

.odonto-patient-panel.is-collapsed .odonto-panel-head--patient {
    flex-direction: column;
    justify-content: flex-start;
    padding: 0.4em 0.2em;
    height: 100%;
    gap: 0.4em;
}

.odonto-patient-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border: 1px solid rgb(255 255 255 / 0.25);
    border-radius: 0.3rem;
    background: rgb(255 255 255 / 0.1);
    color: #e2e8f0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}
.odonto-patient-toggle:hover {
    background: rgb(255 255 255 / 0.2);
}
.odonto-patient-panel.is-collapsed .odonto-patient-toggle {
    transform: rotate(180deg);
}

.odonto-panel-head {
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    color: #ccfbf1;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.35em;
    flex-shrink: 0;
}

.odonto-panel-head--patient {
    background: var(--ui-caption);
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35em;
    padding: 0.3em 0.4em;
    text-align: left;
}

.odonto-panel-head__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.odonto-panel-head__badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    background: rgb(255 255 255 / 0.12);
    padding: 0.1em 0.4em;
    border-radius: 0.25rem;
    color: #7dd3fc;
    flex-shrink: 0;
}

.odonto-patient-body {
    padding: 0.35rem 0.4rem;
    font-size: var(--font-xs);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: minmax(6.5rem, 0.85fr) 1fr 1fr;
    gap: 0.28rem 0.35rem;
    align-content: start;
}

.odonto-patient-body .odonto-field--full {
    grid-column: 1 / -1;
}

/* DNI + Celular: aprovechan el ancho restante bajo la 1.ª fila */
.odonto-patient-body > .odonto-field:nth-child(5) {
    grid-column: 1 / 2;
}
.odonto-patient-body > .odonto-field:nth-child(6) {
    grid-column: 2 / -1;
}

.odonto-patient-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.odonto-save-ficha-btn {
    padding: 0.4em 0.55em;
    background: var(--ui-green);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.odonto-save-ficha-btn:hover { background: linear-gradient(180deg, #254770 0%, #163456 100%); }

.odonto-camera-btn {
    width: 2.1rem;
    padding: 0;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.odonto-camera-btn:hover { background: #0f766e; }

.odonto-field label {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.1em;
}

.odonto-field input,
.odonto-field select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
    padding: 0.22em 0.35em;
    font-size: 0.75rem;
    background: #f8fafc;
    min-width: 0;
}

.odonto-field input[readonly] {
    background: #fff;
    color: #0f172a;
    font-weight: 600;
}

.odonto-field--highlight input { color: #be123c; font-weight: 700; }

.odonto-avatar {
    width: clamp(2.5rem, 4vw, 3.5rem);
    height: clamp(2.5rem, 4vw, 3.5rem);
    margin: 0 auto;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #f0fdfa, #e2e8f0);
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.odonto-affiliate-row {
    display: grid;
    grid-template-columns: 1fr 2.5rem;
    gap: 0.25rem;
}

.odonto-search-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 0.5em;
    background: #0f766e;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-sm);
    font-weight: 700;
    cursor: pointer;
}
.odonto-search-btn:hover { background: #0d9488; }

/* Capas: vista 1ª visita (1) o planificadas+efectuadas (2) */
.odonto-layers {
    display: grid;
    grid-template-rows: auto;
    gap: 0.2rem;
    min-height: 0;
    height: auto;
    align-content: start;
}

.odonto-layers--visit {
    grid-template-rows: auto;
}

.odonto-layers--plan {
    grid-template-rows: auto auto;
}

.odonto-layer.is-hidden-layer {
    display: none !important;
}

.odonto-layers--single {
    grid-template-rows: auto;
}

.odonto-layers--single .odonto-layer--inactive {
    display: none;
}

.odonto-layers--single .odonto-layer:not(.odonto-layer--inactive) {
    min-height: 0;
    height: auto;
}

.odonto-screen--visit,
.odonto-screen--plan,
.odonto-screen--single-layer {
    --tooth-size: clamp(1.85rem, 1.2rem + 2vw, 3rem);
}

.odonto-screen--visit .odonto-layer__teeth,
.odonto-screen--plan .odonto-layer__teeth,
.odonto-screen--single-layer .odonto-layer__teeth {
    min-height: 0;
    flex: 0 0 auto;
    opacity: 1;
    pointer-events: auto;
    justify-content: flex-start;
    align-self: stretch;
}

.odonto-screen--visit .odonto-arch-row,
.odonto-screen--plan .odonto-arch-row,
.odonto-screen--single-layer .odonto-arch-row {
    min-height: calc(var(--tooth-size) + 1.1rem);
    flex: 0 0 auto;
}

/* En vista dual, la capa no activa sigue siendo clickeable */
.odonto-layers--plan .odonto-layer--inactive .odonto-layer__teeth {
    opacity: 0.72;
    pointer-events: auto;
}

.odonto-screen--single-layer .odonto-layer-btn-group {
    box-shadow: 0 0 0 2px #0d9488;
}

.odonto-single-hint {
    display: none;
    font-size: 0.65rem;
    color: #0f766e;
    font-weight: 600;
    white-space: nowrap;
}

.odonto-screen--single-layer .odonto-single-hint {
    display: inline;
}

.odonto-layer {
    border-radius: var(--radius);
    border: 1px solid;
    overflow: hidden;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
}

.odonto-layer--initial  { background: #eff6ff; border-color: #60a5fa; }
.odonto-layer--planned  { background: #f0fdf4; border-color: #4ade80; }
.odonto-layer--completed { background: #fff7ed; border-color: #fb923c; }

.odonto-layer__inner {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    gap: 0.1rem 0.2rem;
    padding: 0.15rem 0.25rem 0.15rem 0.3rem;
    align-content: start;
    align-items: start;
}

.odonto-layer__title {
    grid-column: 1 / -1;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.18em 0.45em;
    border-radius: 0.2rem;
    line-height: 1.2;
}

.odonto-layer--initial .odonto-layer__title  { background: #2563eb; color: #fff; }
.odonto-layer--planned .odonto-layer__title  { background: #16a34a; color: #fff; }
.odonto-layer--completed .odonto-layer__title { background: #ea580c; color: #fff; }

.odonto-layer__teeth {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: stretch;
    min-height: 0;
    min-width: 0;
    width: 100%;
    gap: 0.15rem;
    overflow: visible;
}

.odonto-layer--inactive .odonto-layer__teeth {
    opacity: 0.4;
    pointer-events: none;
}

.odonto-layer--active-ring {
    box-shadow: 0 0 0 2px #0d9488;
    z-index: 1;
}

.odonto-arch-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1px, 0.15vw, 3px);
    flex: 0 0 auto;
    width: 100%;
    min-height: calc(var(--tooth-size) + 1.1rem);
    padding: 0;
}

.odonto-arch-row--hidden { display: none; }

.odonto-layer[data-dentition="adult"] .odonto-dent--child { display: none; }
.odonto-layer[data-dentition="child"] .odonto-dent--adult { display: none; }

.odonto-midline {
    width: 2px;
    align-self: stretch;
    min-height: 1.5rem;
    background: linear-gradient(180deg, transparent, #94a3b8 15%, #94a3b8 85%, transparent);
    margin: 0 clamp(0.15rem, 0.4vw, 0.5rem);
    flex-shrink: 0;
}

.odonto-layer__controls {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: clamp(3.2rem, 3.5vw, 4.2rem);
    padding: 0.05rem 0;
    justify-content: flex-start;
    align-self: start;
}

.odonto-ctrl-btn {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.25em 0.3em;
    border-radius: 0.25rem;
    border: 1px solid #cbd5e1;
    background: rgb(255 255 255 / 0.85);
    color: #475569;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
    min-height: 1.3rem;
}
.odonto-ctrl-btn:hover { background: #fff; border-color: #0d9488; color: #0f766e; }

/* Diente FDI — escala con viewport */
.fdi-tooth {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: var(--tooth-size);
}

.fdi-tooth__num {
    font-size: clamp(0.55rem, 0.45rem + 0.25vw, 0.7rem);
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: #475569;
    line-height: 1.1;
    margin-bottom: 1px;
}

.fdi-tooth__num--selectable { cursor: pointer; padding: 0 2px; border-radius: 2px; }
.fdi-tooth__num--selectable:hover { background: #ccfbf1; color: #0f766e; }

.fdi-tooth__cross {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1px;
    border: 1px solid #94a3b8;
    border-radius: 3px;
    overflow: hidden;
    background: #e2e8f0;
}

.fdi-tooth__surf { border: 0.5px solid #cbd5e1; }
.fdi-tooth__surf--v { grid-area: 1 / 2 / 2 / 3; }
.fdi-tooth__surf--m { grid-area: 2 / 1 / 3 / 2; }
.fdi-tooth__surf--o { grid-area: 2 / 2 / 3 / 3; }
.fdi-tooth__surf--d { grid-area: 2 / 3 / 3 / 4; }
.fdi-tooth__surf--p { grid-area: 3 / 2 / 4 / 3; }

[data-selectable] { cursor: pointer; }
[data-selectable]:hover { outline: 2px solid #0d9488; outline-offset: -1px; z-index: 2; position: relative; }

.fdi-tooth__surf--selected,
.fdi-tooth__num--selected {
    outline: 2px solid #0d9488 !important;
    outline-offset: -1px;
    box-shadow: inset 0 0 0 1px #fff;
}

.fdi-tooth--maxilar-selected .fdi-tooth__cross,
.fdi-tooth--maxilar-selected .fdi-tooth__num {
    outline: 2px solid #f59e0b;
    outline-offset: 1px;
}

/* Historial + acciones (historial ocupa el resto de la pantalla) */
.odonto-bottom {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.odonto-history-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.odonto-history-head {
    background: var(--ui-caption);
    color: #e2e8f0;
    padding: 0.25em 0.5em;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.odonto-history-head__title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 0;
}

.odonto-history-count {
    font-size: var(--font-xs);
    font-weight: 700;
    background: #0d9488;
    color: #fff;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}

.odonto-prestacion-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, 1fr) auto;
    gap: 0.4rem;
    align-items: end;
    padding: 0.35rem 0.55rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.odonto-prestacion-field--doctor {
    min-width: 0;
}

.odonto-prestacion-field label {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.15em;
}

.odonto-prestacion-field input,
.odonto-prestacion-field select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 0.3rem;
    padding: 0.3em 0.45em;
    font-size: 0.75rem;
    background: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.odonto-prestacion-field--grow { min-width: 0; }

.odonto-save-feedback {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 0.35rem 0.5rem;
    border-radius: 0.3rem;
}
.odonto-save-feedback.is-ok {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #6ee7b7;
}
.odonto-save-feedback.is-error {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fda4af;
}

.odonto-save-btn {
    padding: 0.4em 0.85em;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    white-space: nowrap;
    min-height: 1.85rem;
}
.odonto-save-btn:hover { background: #0f766e; }
.odonto-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.odonto-activity-scroll {
    overflow: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.odonto-history-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.35rem 0.5rem;
    padding: 0.35rem 0.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.odonto-history-filters__field {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 8rem;
    flex: 1 1 8rem;
}
.odonto-history-filters__field span {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.03em;
}
.odonto-history-filters__field input,
.odonto-history-filters__field select {
    border: 1px solid #cbd5e1;
    border-radius: 0.3rem;
    padding: 0.28em 0.45em;
    font-size: 0.75rem;
    background: #fff;
    min-width: 0;
    width: 100%;
}
.odonto-history-filters__clear {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    border-radius: 0.3rem;
    min-height: 1.85rem;
    min-width: 1.85rem;
    cursor: pointer;
    font-weight: 800;
    flex-shrink: 0;
}
.odonto-history-filters__clear:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.odonto-activity-table {
    width: 100%;
    font-size: var(--font-sm);
    border-collapse: collapse;
}

.odonto-activity-table thead {
    background: #f1f5f9;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid #e2e8f0;
}

.odonto-activity-table th {
    padding: 0.3em 0.5em;
    text-align: left;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.65rem;
    white-space: nowrap;
}

.odonto-activity-table td {
    padding: 0.28em 0.5em;
    border-top: 1px solid #f1f5f9;
    color: #334155;
}

.odonto-activity-table tbody tr:hover { background: #f0fdfa; }
.odonto-activity-table tbody tr:nth-child(even) { background: #f8fafc; }

.odonto-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    min-height: 0;
    flex-shrink: 0;
    margin-left: auto;
}

.odonto-action-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.25em;
    padding: 0.2em 0.45em;
    background: rgb(255 255 255 / 0.12);
    border: 1px solid rgb(255 255 255 / 0.28);
    border-radius: 0.3rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-align: center;
    color: #e2e8f0;
    text-decoration: none;
    line-height: 1.1;
    cursor: pointer;
    min-height: 1.55rem;
    min-width: 0;
    transition: background 0.15s, border-color 0.15s;
}
.odonto-action-btn:hover {
    background: rgb(255 255 255 / 0.22);
    border-color: #5eead4;
    color: #fff;
}
.odonto-action-btn__icon { font-size: 0.8rem; line-height: 1; flex-shrink: 0; }
.odonto-action-btn__label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.odonto-status-badge {
    display: inline-block;
    padding: 0.2em 0.55em;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    border: 1px solid;
    white-space: nowrap;
}
.odonto-status-badge--initial { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.odonto-status-badge--planned { background: #d1fae5; color: #047857; border-color: #6ee7b7; }
.odonto-status-badge--completed { background: #ffedd5; color: #c2410c; border-color: #fdba74; }

.odonto-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.6;
    padding: 0.15em;
    line-height: 1;
}
.odonto-delete-btn:hover { opacity: 1; }

.odonto-activity-table tbody tr.is-hidden { display: none; }
.odonto-activity-table tbody tr.is-filtered-highlight { background: #ecfdf5 !important; }

/* ── Odontograma responsive ── */
@media (min-width: 768px) and (max-width: 1023px) {
    .odonto-top {
        grid-template-columns: minmax(14rem, 16.5rem) minmax(0, 1fr);
    }

    .odonto-top--patient-collapsed {
        grid-template-columns: 2rem minmax(0, 1fr);
    }

    .odonto-patient-body {
        grid-template-columns: 1fr 1fr;
    }

    .odonto-patient-body .odonto-field--full,
    .odonto-patient-body > .odonto-field:nth-child(5),
    .odonto-patient-body > .odonto-field:nth-child(6) {
        grid-column: 1 / -1;
    }

    .odonto-prestacion-panel {
        grid-template-columns: 1fr 1fr;
    }

    .odonto-save-btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .odonto-actions {
        width: 100%;
        margin-left: 0;
    }

    .odonto-action-btn {
        flex: 1 1 calc(50% - 0.2rem);
    }

    .odonto-screen--single-layer {
        --tooth-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.4rem);
    }
}

@media (max-width: 767px) {
    .odonto-screen,
    .odonto-screen--single-layer {
        height: auto;
        min-height: 0;
        overflow: visible;
        grid-template-rows: auto auto auto;
        --tooth-size: clamp(1.55rem, 1.1rem + 3.2vw, 2.35rem);
    }

    .odonto-select-bar {
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .odonto-toolbar-patient {
        width: 100%;
        flex: 1 1 100%;
    }

    .odonto-toolbar-patient__search,
    .odonto-toolbar-patient__select {
        flex: 1;
        max-width: none;
        width: auto;
    }

    .odonto-select-bar__group {
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: wrap;
    }

    .odonto-layer-switch {
        flex-wrap: wrap;
    }

    .odonto-layer-switch__btn {
        padding: 0 0.55rem;
        font-size: 0.68rem;
        min-height: 1.75rem;
    }

    .odonto-selection-chips {
        flex: 1 1 100%;
        min-width: 0;
        order: 5;
    }

    .odonto-select-bar__actions {
        margin-left: 0;
        width: 100%;
        justify-content: stretch;
    }

    .odonto-select-bar__actions .odonto-mode-btn,
    .odonto-clear-btn {
        flex: 1 1 auto;
    }

    .odonto-top,
    .odonto-top--patient-collapsed {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        overflow: visible;
    }

    .odonto-patient-panel.is-collapsed .odonto-panel-head--patient {
        flex-direction: row;
        height: auto;
        padding: 0.45em 0.55em;
    }

    .odonto-patient-panel.is-collapsed .odonto-panel-head__title,
    .odonto-patient-panel.is-collapsed .odonto-panel-head__badge {
        display: inline;
    }

    .odonto-patient-body {
        grid-template-columns: 1fr 1fr;
    }

    .odonto-patient-body .odonto-field--full {
        grid-column: 1 / -1;
    }

    .odonto-patient-body > .odonto-field:nth-child(5),
    .odonto-patient-body > .odonto-field:nth-child(6) {
        grid-column: auto;
    }

    .odonto-layers,
    .odonto-layers--single {
        height: auto;
        min-height: 0;
    }

    .odonto-layer__inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .odonto-layer__teeth {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: clamp(6rem, 28vw, 10rem);
    }

    .odonto-arch-row {
        justify-content: flex-start;
        min-width: max-content;
        padding-bottom: 0.15rem;
    }

    .odonto-layer__controls {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
        justify-content: flex-start;
    }

    .odonto-bottom {
        overflow: visible;
        min-height: 0;
    }

    .odonto-history-block {
        min-height: 16rem;
    }

    .odonto-history-head {
        flex-direction: column;
        align-items: stretch;
    }

    .odonto-actions {
        width: 100%;
        margin-left: 0;
    }

    .odonto-action-btn {
        flex: 1 1 calc(50% - 0.2rem);
    }

    .odonto-prestacion-panel {
        grid-template-columns: 1fr;
    }

    .odonto-save-btn {
        width: 100%;
    }

    .odonto-history-filters__field {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
    }

    .odonto-activity-scroll {
        min-height: 10rem;
        max-height: min(45vh, 22rem);
    }

    .odonto-activity-table {
        min-width: 32rem;
    }

    .odonto-col-doctor,
    .odonto-col-surface,
    .odonto-col-time {
        display: none;
    }

    .odonto-modal {
        padding: 0.5rem;
        align-items: flex-end;
    }

    .odonto-modal__panel {
        max-width: 100%;
        max-height: min(92vh, 40rem);
        width: 100%;
    }
}

@media (max-width: 480px) {
    .odonto-screen,
    .odonto-screen--single-layer {
        --tooth-size: clamp(1.35rem, 4.5vw, 2rem);
    }

    .odonto-patient-body {
        grid-template-columns: 1fr;
    }

    .odonto-action-btn {
        flex: 1 1 100%;
    }

    .odonto-history-filters__field {
        flex: 1 1 100%;
    }

    .odonto-activity-table {
        min-width: 26rem;
    }

    .odonto-layer-switch__btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ── Carga de Prácticas (layout legacy) ── */
.carga-screen {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr 1.1fr;
    gap: var(--gap-sm);
    overflow: hidden;
}

.carga-section-head {
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    color: #ccfbf1;
    font-size: var(--font-xs);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.45em 0.5em;
}

.carga-registro {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.carga-registro__body {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: var(--gap-md);
    padding: var(--gap-md);
    align-items: end;
    font-size: var(--font-sm);
}

.carga-field label {
    display: block;
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.2em;
}

.carga-field--span-2 {
    grid-column: span 2;
}

.carga-field input,
.carga-field select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 0.45em 0.55em;
    font-size: var(--font-sm);
    background: #f8fafc;
}

.carga-affiliate-row {
    display: grid;
    grid-template-columns: 1fr 2.5rem;
    gap: var(--gap-xs);
}

.carga-middle {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--gap-sm);
    min-height: 0;
    overflow: hidden;
}

.carga-patients-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.carga-patients-scroll {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.carga-patients-table {
    width: 100%;
    font-size: var(--font-sm);
    border-collapse: collapse;
}

.carga-patients-table th {
    background: #f1f5f9;
    padding: 0.45em 0.55em;
    text-align: left;
    font-size: var(--font-xs);
    font-weight: 800;
    text-transform: uppercase;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 1;
}

.carga-patients-table td {
    padding: 0.4em 0.55em;
    border-top: 1px solid #f1f5f9;
    cursor: pointer;
}

.carga-patients-table tr:hover td { background: #f0fdfa; }
.carga-patients-table tr.is-selected td {
    background: #ccfbf1;
    font-weight: 700;
    color: #115e59;
}

.carga-side-btns {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    min-width: clamp(7rem, 9vw, 9rem);
}

.carga-side-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    padding: var(--gap-sm);
    background: linear-gradient(180deg, #fef9c3 0%, #fde68a 100%);
    border: 1px solid #ca8a04;
    border-radius: var(--radius);
    font-size: var(--font-xs);
    font-weight: 800;
    text-align: center;
    color: #1e293b;
    text-decoration: none;
    line-height: 1.2;
    min-height: 4rem;
}
.carga-side-btn:hover { background: linear-gradient(180deg, #fef08a 0%, #facc15 100%); }
.carga-side-btn__icon { font-size: 1.35rem; }

.carga-practica {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.carga-practica__body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--gap-md);
    padding: var(--gap-md);
    overflow: hidden;
}

.carga-practica__main {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    min-height: 0;
    overflow-y: auto;
    font-size: var(--font-sm);
}

.carga-patient-summary {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: var(--radius);
    padding: var(--gap-sm) var(--gap-md);
    color: #be123c;
    font-weight: 700;
    font-size: var(--font-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em 1.25em;
}

.carga-piezas-input {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: var(--font-md);
    letter-spacing: 0.02em;
}

.carga-tipo-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-md);
    align-items: center;
}

.carga-tipo-row label {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-weight: 700;
    font-size: var(--font-sm);
    cursor: pointer;
}

.carga-nom-list {
    flex: 1;
    min-height: 6rem;
    max-height: 10rem;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
}

.carga-nom-item {
    padding: 0.45em 0.65em;
    font-size: var(--font-sm);
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    gap: 0.5em;
}
.carga-nom-item:hover { background: #f0fdfa; }
.carga-nom-item.is-selected { background: #0f766e; color: #fff; font-weight: 700; }

.carga-action-col {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
    min-width: clamp(6.5rem, 8vw, 8rem);
}

.carga-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2em;
    padding: 0.4em;
    background: linear-gradient(180deg, #fef9c3 0%, #fde68a 100%);
    border: 1px solid #ca8a04;
    border-radius: var(--radius);
    font-size: var(--font-xs);
    font-weight: 800;
    cursor: pointer;
    color: #1e293b;
    min-height: 2.75rem;
}
.carga-action-btn--primary { background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%); color: #fff; border-color: #0f766e; }
.carga-action-btn--primary:hover { background: #0f766e; }

/* ── Carga de Prácticas responsive ── */
@media (min-width: 768px) and (max-width: 1023px) {
    .carga-registro__body {
        grid-template-columns: 1fr 1fr auto;
    }

    .carga-field--span-2 {
        grid-column: span 2;
    }

    .carga-middle {
        grid-template-columns: 1fr;
    }

    .carga-side-btns {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
    }

    .carga-side-btn {
        flex: 1 1 calc(33.33% - var(--gap-sm));
        min-height: 3.25rem;
        flex-direction: row;
        gap: 0.4em;
    }

    .carga-practica__body {
        grid-template-columns: 1fr auto;
    }

    .carga-action-col {
        min-width: 6.5rem;
    }
}

@media (max-width: 767px) {
    .carga-screen {
        height: auto;
        min-height: 0;
        overflow: visible;
        grid-template-rows: auto auto auto;
        gap: var(--gap-sm);
    }

    .carga-registro__body {
        grid-template-columns: 1fr;
        gap: var(--gap-sm);
    }

    .carga-field--span-2 {
        grid-column: auto;
    }

    .carga-middle {
        grid-template-columns: 1fr;
        overflow: visible;
        height: auto;
    }

    .carga-patients-panel {
        min-height: 12rem;
        max-height: min(40vh, 18rem);
    }

    .carga-patients-table {
        min-width: 28rem;
    }

    .carga-col-turno,
    .carga-col-orden {
        display: none;
    }

    .carga-side-btns {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
    }

    .carga-side-btn {
        flex: 1 1 calc(50% - var(--gap-sm));
        min-height: 3.25rem;
        flex-direction: row;
        gap: 0.35em;
        padding: 0.45em 0.55em;
    }

    .carga-practica {
        overflow: visible;
    }

    .carga-practica__body {
        grid-template-columns: 1fr;
        overflow: visible;
        height: auto;
    }

    .carga-practica__main {
        overflow: visible;
    }

    .carga-patient-summary {
        flex-direction: column;
        gap: 0.35em;
    }

    .carga-tipo-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gap-sm);
    }

    .carga-nom-list {
        max-height: 12rem;
    }

    .carga-action-col {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
        width: 100%;
    }

    .carga-action-btn {
        flex: 1 1 calc(50% - var(--gap-xs));
        flex-direction: row;
        min-height: 2.6rem;
        gap: 0.35em;
    }
}

@media (max-width: 480px) {
    .carga-side-btn,
    .carga-action-btn {
        flex: 1 1 100%;
    }

    .carga-patients-table {
        min-width: 22rem;
    }
}

.rx-canvas {
    background: linear-gradient(180deg, #1a1d20 0%, #2e343b 50%, #111315 100%);
}

.tooth-cell {
    min-width: 2.25rem;
    min-height: 2.25rem;
}

/* ── Modal Ayuda Odontograma ── */
.odonto-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--gap-lg);
}
.odonto-modal.is-open { display: flex; }
.odonto-modal[aria-hidden="true"] { display: none; }
.odonto-modal[aria-hidden="false"] { display: flex; }

.odonto-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.65);
    backdrop-filter: blur(2px);
}

.odonto-modal__panel {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: var(--radius);
    border: 2px solid #0d9488;
    box-shadow: 0 25px 50px rgb(0 0 0 / 0.35);
    max-width: min(92vw, 52rem);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.odonto-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-md);
    padding: 0.65em 1em;
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    color: #ccfbf1;
}

.odonto-modal__head h2 {
    margin: 0;
    font-size: var(--font-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.odonto-modal__close {
    border: none;
    background: rgb(255 255 255 / 0.15);
    color: #fff;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
.odonto-modal__close:hover { background: rgb(255 255 255 / 0.3); }

.odonto-modal__body {
    padding: var(--gap-md);
    overflow: auto;
    text-align: center;
}

.odonto-modal__img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
}

.odonto-modal__hint {
    margin: 0.75em 0 0;
    font-size: var(--font-xs);
    color: #64748b;
    line-height: 1.4;
}

/* ── Agenda de Turnos (layout legacy) ── */
.agenda-screen {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    gap: 0.18rem;
    overflow: hidden;
    background: #f4f7f5;
    font-size: clamp(0.68rem, 0.58rem + 0.28vw, 0.82rem);
    container-type: inline-size;
    container-name: agenda;
    --agenda-btn-h: clamp(2.05rem, 1.75rem + 0.45vw, 2.45rem);
    --agenda-btn-w: clamp(6.6rem, 5.6rem + 1.5vw, 7.9rem);
    --agenda-btn-bg:
        #16a34a;
    --agenda-btn-shadow:
        inset 0 1px 0 rgba(255,255,255,0.78),
        inset 0 -8px 12px rgba(0, 45, 40, 0.22),
        0 3px 6px rgba(0, 0, 0, 0.28);
}

.agenda-top {
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    overflow: hidden;
    flex-shrink: 0;
}

.agenda-top__head {
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    color: #ccfbf1;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.12em 0.5em;
    font-size: 0.7em;
}

.agenda-top__body {
    display: grid;
    grid-template-columns: minmax(14rem, 24rem) minmax(0, 1fr);
    gap: 0.25em 0.45em;
    padding: 0.22em 0.35em;
    align-items: center;
}

.agenda-search {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    grid-template-areas:
        "doc afil actions"
        "ape nom actions";
    gap: 0.15em 0.28em;
    align-items: end;
}

.agenda-search .agenda-field--doc { grid-area: doc; }
.agenda-search .agenda-field--afil { grid-area: afil; }
.agenda-search .agenda-field--apellido { grid-area: ape; }
.agenda-search .agenda-field--nombre { grid-area: nom; }

.agenda-search .agenda-search__actions {
    grid-area: actions;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: end;
    gap: 0.15em;
    width: var(--agenda-btn-w);
    min-width: var(--agenda-btn-w);
}

.agenda-search .agenda-btn--search {
    width: 100%;
    height: var(--agenda-btn-h);
    min-height: var(--agenda-btn-h);
    padding: 0 0.45rem;
}

.agenda-search .agenda-check {
    justify-content: center;
    padding-bottom: 0;
    margin: 0;
    font-size: 0.72em;
}

.agenda-btn--new-patient {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
}
.agenda-btn--new-patient:hover {
    color: #fff;
}

.agenda-field label {
    display: block;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.1em;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.agenda-field input,
.agenda-field select {
    width: 100%;
    border: 1px solid #94a3b8;
    border-radius: 0.2rem;
    padding: 0.22em 0.35em;
    font-size: inherit;
    background: #fff;
    min-width: 0;
}

.agenda-field--grow { grid-column: span 2; }
.agenda-inline { display: flex; gap: 0.25em; min-width: 0; align-items: stretch; }
.agenda-select-sm {
    width: 25%;
    max-width: 2.6rem;
    min-width: 2.1rem;
    flex: 0 0 25%;
    padding-left: 0.15em;
    padding-right: 0.1em;
    font-size: 0.68em;
}
.agenda-inline > input {
    flex: 1 1 75%;
    min-width: 0;
    width: auto;
}

.agenda-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--agenda-btn-w);
    min-width: var(--agenda-btn-w);
    height: var(--agenda-btn-h);
    min-height: var(--agenda-btn-h);
    padding: 0 0.55rem;
    border: 1px solid #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    color: #fff;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
    text-decoration: none;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    box-shadow: var(--agenda-btn-shadow);
    font-family: inherit;
}
.agenda-btn:hover {
    filter: brightness(1.06);
    color: #fff;
}
.agenda-btn--search { grid-column: span 1; }

.agenda-check {
    display: flex;
    align-items: center;
    gap: 0.25em;
    font-weight: 600;
    color: #475569;
    align-self: end;
    padding-bottom: 0.2em;
    font-size: 0.85em;
}

.agenda-patient-card {
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: 0.2rem 0.4rem;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    padding: 0.22rem 0.4rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ecfdf5 100%);
    min-height: 0;
    height: auto;
    align-self: stretch;
    align-content: center;
    font-size: 0.78rem;
}

.agenda-patient-card.is-blocked {
    border-color: #ef4444;
    background: linear-gradient(180deg, #fff7f7 0%, #fee2e2 100%);
}

.agenda-patient-card.has-obs:not(.is-blocked) {
    border-color: #f59e0b;
}

.agenda-patient-card__avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.25rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    align-self: center;
}

.agenda-patient-card__emoji { font-size: 1.15rem; line-height: 1; }
.agenda-patient-card__initials {
    font-weight: 800;
    font-size: 0.78rem;
    color: #115e59;
    letter-spacing: 0.02em;
}

.agenda-patient-card__main {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.agenda-patient-card__identity {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.15em 0.3em;
    min-width: 0;
}

.agenda-patient-card__name {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    font-size: clamp(0.78rem, 0.7rem + 0.25vw, 0.95rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-patient-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.05em 0.35em;
    border-radius: 0.2rem;
    font-size: 0.64rem;
    font-weight: 800;
    background: #ccfbf1;
    color: #115e59;
    border: 1px solid #5eead4;
    white-space: nowrap;
}

.agenda-patient-card__badge--danger {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.agenda-patient-card__badge--warn {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}

.agenda-patient-card__block-msg {
    margin-top: 0.35rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.4rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35;
}

.agenda-block-context {
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    color: #475569;
}

.agenda-block-scope {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    padding: 0.55rem 0.7rem 0.35rem;
    margin: 0.55rem 0;
}

.agenda-block-scope legend {
    padding: 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.agenda-block-scope__opt {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    padding: 0.4rem 0.15rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: #1e293b;
}

.agenda-block-scope__opt input {
    margin-top: 0.2rem;
}

.agenda-block-scope__opt strong {
    display: block;
    font-size: 0.82rem;
}

.agenda-block-scope__opt small {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.3;
}

.agenda-block-scope__opt:has(input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}

.agenda-block-hint {
    margin: 0 0 0.55rem;
    font-size: 0.72rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.4rem;
    padding: 0.4rem 0.55rem;
}

.agenda-block-list {
    margin: 0.55rem 0 0.2rem;
    padding: 0.5rem 0.65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.45rem;
}

.agenda-block-list__title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.3rem;
}

.agenda-block-list ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.78rem;
    color: #334155;
}

.agenda-block-list li {
    margin: 0.2rem 0;
}

.agenda-patient-card__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.2rem), 1fr));
    gap: 0.05rem 0.45rem;
    font-size: 0.72rem;
    color: #1e293b;
    line-height: 1.2;
}

.agenda-patient-card__meta span {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25em;
    white-space: nowrap;
    min-width: 0;
}

.agenda-patient-card__meta em {
    font-style: normal;
    color: #64748b;
    font-weight: 800;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.agenda-patient-card__meta b {
    font-weight: 800;
    font-size: 0.72rem;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agenda-patient-card__meta small { color: #64748b; font-weight: 700; font-size: 0.7rem; }
.agenda-patient-card__meta-wide {
    white-space: nowrap !important;
    grid-column: span 2;
    min-width: 0;
}

.agenda-label { display: block; color: #64748b; font-size: 0.85em; }

.agenda-patient-card__actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.2em;
    margin-left: auto;
}

.agenda-mini-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5.2rem;
    min-width: 5.2rem;
    height: 1.7rem;
    min-height: 1.7rem;
    padding: 0 0.4rem;
    border: 1px solid #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    line-height: 1.05;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    box-shadow: var(--agenda-btn-shadow);
}
.agenda-mini-btn:hover { filter: brightness(1.06); color: #fff; }

.agenda-mini-btn--primary,
.agenda-mini-btn--primary:hover {
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-color: #0f6b52;
    color: #fff;
}

.agenda-mini-btn--new,
.agenda-mini-btn--new:hover {
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-color: #0f6b52;
    color: #fff;
}

.agenda-toolbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.28rem;
    padding: 0.22rem;
    background: #e2e8f0;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    flex-shrink: 0;
    align-items: stretch;
}

.agenda-toolbar__item {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    width: 100%;
    min-width: 0;
    height: var(--agenda-btn-h);
    min-height: var(--agenda-btn-h);
    padding: 0.1rem 0.25rem;
    border: 1px solid #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.62rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    box-shadow: var(--agenda-btn-shadow);
    font-family: inherit;
    line-height: 1.05;
    text-align: center;
}
.agenda-toolbar__item > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.agenda-toolbar__item { color: #fff; }
.agenda-toolbar__item:hover { filter: brightness(1.06); color: #fff; }
.agenda-toolbar__item:disabled,
.agenda-toolbar__item.is-disabled {
    opacity: 0.5;
    filter: grayscale(0.35);
    cursor: not-allowed;
}
.agenda-toolbar__icon { font-size: 0.85rem; line-height: 1; }

.agenda-filters {
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    padding: 0.15em 0.3em;
    flex-shrink: 0;
}

.agenda-filters__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.25em 0.35em;
    min-width: 0;
}

.agenda-filters__mode {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35em;
    padding-right: 0.35em;
    border-right: 1px solid #e2e8f0;
    margin-right: 0;
    align-self: center;
    padding-bottom: 0.15em;
    flex: 0 0 auto;
}

.agenda-radio {
    display: block;
    font-weight: 600;
    margin-bottom: 0.1em;
    cursor: pointer;
}

.agenda-radio--inline {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    font-size: 0.75em;
    margin: 0;
    white-space: nowrap;
}

.agenda-field--inline {
    flex: 1 1 9rem;
    max-width: 16rem;
    min-width: min(100%, 7.5rem);
}

.agenda-field--prestacion {
    flex: 2 1 12rem;
    min-width: min(100%, 10rem);
    max-width: none;
}

.agenda-practica-picker {
    display: grid;
    grid-template-columns: minmax(7rem, 0.7fr) minmax(10rem, 1.8fr);
    gap: 0.25em;
    align-items: stretch;
    min-width: 0;
}

.agenda-practica-picker input,
.agenda-practica-picker select {
    width: 100%;
    border: 1px solid #94a3b8;
    border-radius: 0.2rem;
    padding: 0.22em 0.35em;
    font-size: inherit;
    background: #fff;
    min-width: 0;
}

.agenda-practica-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
    padding: 0.35em 0.4em 0.15em;
    border-top: 1px dashed #cbd5e1;
    margin-top: 0.15em;
}

.agenda-practica-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    max-width: 100%;
    padding: 0.2em 0.45em;
    border-radius: 999px;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
    font-size: 0.72em;
    font-weight: 700;
}

.agenda-practica-chip button {
    border: none;
    background: transparent;
    color: #b91c1c;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.15em;
}

.agenda-practica-cell {
    text-align: center;
    white-space: nowrap;
}

.agenda-practica-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #0f766e;
    border-radius: 0.25rem;
    background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
    color: #fff;
    font-size: 0.72em;
    font-weight: 700;
    padding: 0.28em 0.55em;
    cursor: pointer;
    white-space: nowrap;
}
.agenda-practica-view-btn:hover {
    background: linear-gradient(180deg, #2dd4bf 0%, #0f766e 100%);
}

.agenda-practicas-list {
    list-style: none;
    margin: 0 0 0.85em;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    max-height: 55vh;
    overflow: auto;
}

.agenda-practicas-list li {
    padding: 0.45em 0.65em;
    border: 1px solid #cbd5e1;
    border-radius: 0.3rem;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.92em;
    font-weight: 600;
    line-height: 1.35;
}

.agenda-filters .agenda-field input,
.agenda-filters .agenda-field select {
    padding: 0.2em 0.3em;
}

.agenda-filters .agenda-list-actions {
    display: flex;
    align-items: center;
    gap: 0.2em;
    min-width: 0;
}

.agenda-filters .agenda-list-actions select {
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
}

.agenda-filters .agenda-crud-btn {
    width: 1.7rem;
    min-width: 1.7rem;
    height: 1.7rem;
    min-height: 1.7rem;
    padding: 0;
    font-size: 0.8rem;
    text-align: center;
    flex: 0 0 1.7rem;
}

.agenda-filters .agenda-universo-btn {
    align-self: end;
    margin-left: 0.15em;
    flex: 0 0 var(--agenda-btn-w);
}

.agenda-more-menu {
    position: relative;
    align-self: end;
    flex: 0 0 auto;
}

.agenda-more-menu > summary {
    list-style: none;
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--agenda-btn-w);
    min-width: var(--agenda-btn-w);
    height: var(--agenda-btn-h);
    min-height: var(--agenda-btn-h);
    border: 1px solid #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-radius: 999px;
    padding: 0 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    box-shadow: var(--agenda-btn-shadow);
    user-select: none;
}

.agenda-more-menu > summary::-webkit-details-marker { display: none; }

.agenda-more-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.2rem);
    z-index: 40;
    min-width: 11rem;
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    padding: 0.35em;
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    box-shadow: 0 8px 20px rgb(15 23 42 / 0.15);
}

.agenda-more-menu__panel a {
    display: block;
    padding: 0.3em 0.45em;
    border-radius: 0.2rem;
    font-size: 0.78em;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
}

.agenda-more-menu__panel a:hover { background: #ecfdf5; }

.agenda-date-hidden { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

.agenda-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15em 0.7em;
    padding: 0.12em 0.4em;
    background: var(--ui-caption);
    color: #fff;
    font-weight: 600;
    border-radius: 0.25rem;
    flex-shrink: 0;
    font-size: 0.68em;
}

.agenda-summary__warn { color: #fecaca; font-style: normal; font-weight: 800; }

.agenda-main {
    display: grid;
    grid-template-columns: clamp(14.5rem, 18vw, 18rem) minmax(0, 1fr) auto;
    gap: 0.22rem;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

.agenda-calendar-panel {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    width: 100%;
    max-width: none;
    min-height: 0;
    overflow: auto;
}

.agenda-calendar {
    background: #fff;
    border: 1px solid #e8eef4;
    border-radius: 1rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    padding: 0.7rem 0.65rem 0.5rem;
    overflow: hidden;
}

.agenda-calendar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    background: transparent;
    color: #0f172a;
    text-align: left;
    font-weight: 800;
    padding: 0.1rem 0.2rem 0.35rem;
    font-size: 0.92rem;
}

.agenda-calendar__title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.agenda-calendar__title-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.agenda-calendar__nav {
    display: inline-flex;
    align-items: center;
    gap: 0.05rem;
    flex-shrink: 0;
}

.agenda-calendar__nav-btn {
    width: 1.45rem;
    height: 1.45rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: #94a3b8;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.agenda-calendar__nav-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.agenda-calendar__weekdays,
.agenda-calendar__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.agenda-calendar__weekdays span {
    font-weight: 700;
    color: #94a3b8;
    padding: 0.35rem 0 0.2rem;
    font-size: 0.68rem;
}
.agenda-calendar__weekdays span.is-weekend { color: #cbd5e1; }

.agenda-calendar__day {
    aspect-ratio: 1;
    margin: 0.1rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: #334155;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.agenda-calendar__day.is-weekend:not(.is-selected):not(.is-free):not(.is-partial):not(.is-full) {
    color: #cbd5e1;
}
.agenda-calendar__day.is-outside {
    color: #cbd5e1;
    font-weight: 600;
}
.agenda-calendar__day:hover:not(.is-selected) { background: #f8fafc; }
.agenda-calendar__day.is-free {
    background: #16a34a;
    color: #fff;
    font-weight: 800;
}
.agenda-calendar__day.is-free:hover:not(.is-selected) {
    background: #15803d;
    color: #fff;
}
.agenda-calendar__day.is-partial {
    background: #ea580c;
    color: #fff;
    font-weight: 800;
}
.agenda-calendar__day.is-partial:hover:not(.is-selected) {
    background: #c2410c;
    color: #fff;
}
.agenda-calendar__day.is-full {
    background: #e11d48;
    color: #fff;
    font-weight: 800;
}
.agenda-calendar__day.is-full:hover:not(.is-selected) {
    background: #be123c;
    color: #fff;
}
.agenda-calendar__day.is-selected {
    background: #1e293b !important;
    color: #fff !important;
    border-radius: 999px !important;
    box-shadow: none;
}
.agenda-calendar__day.has-patient-turn:not(.is-selected) {
    outline: 2px solid #ca8a04;
    outline-offset: -2px;
}
.agenda-calendar__day.is-recepcion-day:not(.is-selected) {
    background: #fef08a;
    color: #713f12;
    border: 1px solid #ca8a04;
    border-radius: 0.15rem;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px #fde047;
}
.agenda-calendar__day.is-recepcion-focus:not(.is-selected) {
    background: #f59e0b !important;
    color: #fff !important;
    border-color: #b45309 !important;
}
.agenda-screen--recepcion .agenda-calendar {
    box-shadow: 0 0 0 2px #f59e0b;
}
.agenda-calendar__legend-item.is-patient-recep::before {
    background: #fef08a;
    border: 1px solid #ca8a04;
}
.agenda-calendar__legend {
    display: flex;
    gap: 0.55rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.45rem 0.15rem 0.25rem;
    margin-top: 0.15rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.62rem;
    font-weight: 600;
    color: #64748b;
}
.agenda-calendar__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}
.agenda-calendar__legend-item::before {
    content: '';
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    border: 0;
    background: #cbd5e1;
}
.agenda-calendar__legend-item.is-free::before { background: #22c55e; }
.agenda-calendar__legend-item.is-partial::before { background: #f59e0b; }
.agenda-calendar__legend-item.is-full::before { background: #f43f5e; }
.agenda-calendar__legend-item.is-assigned::before { background: #f59e0b; }
.agenda-calendar__legend-item.is-empty-day::before { background: #e2e8f0; }

.agenda-stats {
    list-style: none;
    margin: 0;
    padding: 0.18em 0.25em;
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    font-size: 0.7em;
}

.agenda-stats li {
    display: flex;
    justify-content: space-between;
    gap: 0.3em;
    padding: 0.05em 0;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
}
.agenda-stats li:last-child { border-bottom: none; }

.agenda-stats__val--green { color: #15803d; font-weight: 800; }
.agenda-stats__val--red { color: #dc2626; font-weight: 800; }

.agenda-table-area {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.22rem;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.agenda-table-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    overflow: hidden;
    background: #fff;
}

.agenda-universo-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.35rem 0.4rem;
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    flex-shrink: 0;
}

.agenda-universo-filter {
    flex: 1 1 auto;
    min-width: 5.5rem;
    text-align: center;
    padding: 0.28rem 0.55rem;
    border: 1px solid #94a3b8;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.agenda-universo-filter:hover {
    border-color: #0f766e;
    color: #0f766e;
    background: #f0fdfa;
}

.agenda-universo-filter.is-active {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.agenda-table-head {
    background: var(--ui-caption);
    color: #ecfdf5;
    font-weight: 800;
    text-align: center;
    padding: 0.25em;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    font-size: 0.85em;
}

.agenda-table-head__extra {
    font-weight: 700;
    color: #fef08a;
    letter-spacing: 0.02em;
    margin-left: 0.15em;
}

.agenda-table-scroll {
    flex: 1 1 auto;
    min-height: 8rem;
    overflow: auto;
}

.agenda-table {
    width: 100%;
    border-collapse: collapse;
    font-size: inherit;
}

.agenda-table th {
    background: #e2e8f0;
    padding: 0.2em 0.35em;
    text-align: left;
    font-weight: 800;
    border-bottom: 1px solid #94a3b8;
    position: sticky;
    top: 0;
    z-index: 1;
}

.agenda-table td {
    padding: 0.18em 0.35em;
    border-bottom: 1px solid rgb(0 0 0 / 0.08);
    vertical-align: middle;
}

.agenda-table th:nth-child(1),
.agenda-table td:nth-child(1) {
    width: 3.2rem;
    white-space: nowrap;
}

.agenda-table th:nth-child(2),
.agenda-table td:nth-child(2) {
    width: 3.5rem;
    white-space: nowrap;
}

.agenda-turn-row { cursor: pointer; }
.agenda-turn-row.is-selected {
    outline: 2px solid var(--ui-green);
    outline-offset: -2px;
}
/* Turno libre enfocado: fondo verde + texto blanco; al quitar foco vuelve al estilo inline original */
.agenda-turn-row.is-libre.is-selected {
    background: var(--ui-green) !important;
    color: #fff !important;
    font-weight: 700;
    outline-color: var(--ui-green-dark);
}
.agenda-turn-row.is-libre.is-selected .agenda-practica-empty {
    color: rgba(255, 255, 255, 0.85);
}
.agenda-turn-row.is-libre.is-selected .agenda-practica-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    color: #fff;
}
.agenda-turn-row.is-bloqueado {
    background: #dc2626 !important;
    color: #fff !important;
    font-weight: 700;
}
.agenda-turn-row.is-bloqueado .agenda-practica-empty {
    color: #fecaca;
}
.agenda-action-icon[data-mode="bloquear"] {
    background-color: #dc2626;
    border-color: #991b1b;
}
.agenda-action-icon[data-mode="desbloquear"] {
    background-color: #0f766e;
    border-color: #115e59;
}

.agenda-table-side {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    justify-content: flex-start;
    padding-top: 0.15em;
    min-height: 0;
    overflow: auto;
    width: var(--agenda-btn-w);
    flex: 0 0 var(--agenda-btn-w);
}
.agenda-table-side form {
    width: 100%;
    margin: 0;
}

.agenda-action-icon,
.agenda-action-big {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: var(--agenda-btn-h);
    min-height: var(--agenda-btn-h);
    padding: 0.15rem 0.35rem;
    border: 1px solid #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.68rem;
    line-height: 1.05;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    box-shadow: var(--agenda-btn-shadow);
    font-family: inherit;
}
.agenda-action-icon:hover,
.agenda-action-big:hover {
    filter: brightness(1.06);
    color: #fff;
}
.agenda-action-big--muted,
.agenda-action-big--exit,
.agenda-action-big--universo,
.agenda-action-big--universo.is-active {
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-color: #0f6b52;
    color: #fff;
    margin-top: 0;
}
.agenda-action-big:disabled,
.agenda-action-icon:disabled {
    opacity: 0.5;
    filter: grayscale(0.35);
    cursor: not-allowed;
}
.agenda-table-head.is-asignados {
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
}
.agenda-table-head.is-ambos {
    background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
}

.agenda-table th.agenda-col-practica,
.agenda-table td.agenda-practica-cell {
    width: 3.2rem;
    text-align: center;
    white-space: nowrap;
}

.agenda-paciente-cell {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.agenda-practica-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid #0f766e;
    border-radius: 999px;
    background: #ecfdf5;
    color: #0f766e;
    cursor: pointer;
    line-height: 1;
}

.agenda-practica-icon-btn:hover {
    background: #ccfbf1;
    filter: brightness(1.03);
}

.agenda-practica-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.agenda-practica-empty {
    color: #94a3b8;
    font-weight: 700;
}

.agenda-turn-row.is-asignado .agenda-paciente-cell {
    color: inherit;
}

.agenda-table .sr-only,
.agenda-screen .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.agenda-legend {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    min-width: 4.25rem;
    max-width: 5.25rem;
    padding: 0.18em;
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    font-weight: 700;
    font-size: 0.7em;
    align-self: start;
    max-height: 100%;
    overflow: auto;
}

.agenda-legend__item {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

.agenda-legend__sq {
    width: 0.95em;
    height: 0.95em;
    border: 1px solid #64748b;
    border-radius: 0.1rem;
    flex-shrink: 0;
}

/* ── Agenda responsive (móvil <768 | tablet 768–1023 | desktop ≥1024) ── */

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .agenda-top__body {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.35em;
    }

    .agenda-search {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
        max-width: 36rem;
    }

    .agenda-toolbar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 0.28rem;
        grid-auto-flow: unset;
        grid-auto-columns: unset;
    }

    .agenda-toolbar__item {
        flex: 0 0 auto;
        width: auto;
        min-width: 4.5rem;
        padding-inline: 0.45rem;
    }

    .agenda-filters__bar {
        align-items: stretch;
    }

    .agenda-field--inline {
        flex: 1 1 10rem;
        max-width: none;
    }

    .agenda-field--prestacion {
        flex: 1 1 100%;
        max-width: none;
    }

    .agenda-practica-picker {
        grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.5fr);
    }

    .agenda-main {
        grid-template-columns: minmax(13rem, 15.5rem) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .agenda-calendar-panel {
        grid-row: 1;
    }

    .agenda-table-area {
        grid-row: 1;
        min-width: 0;
    }

    .agenda-legend {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        min-width: 0;
        max-width: none;
        width: 100%;
        max-height: none;
        gap: 0.35em 0.75em;
        padding: 0.3em 0.45em;
    }

    .agenda-table-side {
        width: clamp(5.2rem, 12vw, 6.4rem);
        flex-basis: clamp(5.2rem, 12vw, 6.4rem);
    }

    .agenda-action-icon span {
        font-size: 0.62rem;
    }
}

/* Móvil */
@media (max-width: 767px) {
    .agenda-screen {
        height: auto;
        min-height: 0;
        overflow: visible;
        gap: 0.28rem;
        padding-bottom: 0.25rem;
        font-size: clamp(0.72rem, 0.68rem + 0.35vw, 0.82rem);
    }

    .agenda-top__body {
        grid-template-columns: 1fr;
        gap: 0.35em;
        padding: 0.3em;
    }

    .agenda-search {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "doc afil"
            "ape nom"
            "actions actions";
        width: 100%;
        max-width: none;
    }

    .agenda-search .agenda-search__actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        min-width: 0;
        gap: 0.35em;
    }

    .agenda-search .agenda-btn--search {
        width: auto;
        min-width: var(--agenda-btn-w);
        flex: 0 0 auto;
    }

    .agenda-patient-card__identity {
        flex-wrap: wrap;
    }

    .agenda-patient-card__name {
        flex: 1 1 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .agenda-patient-card__actions {
        margin-left: 0;
        width: 100%;
    }

    .agenda-patient-card__meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .agenda-patient-card__meta-wide {
        grid-column: 1 / -1;
        white-space: normal !important;
    }

    .agenda-toolbar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 0.22rem;
        padding: 0.28rem;
        grid-auto-flow: unset;
        grid-auto-columns: unset;
    }

    .agenda-toolbar__item {
        flex: 0 0 auto;
        width: auto;
        min-width: 3.35rem;
        height: auto;
        min-height: 2.55rem;
        padding: 0.25rem 0.35rem;
        font-size: 0.58rem;
    }

    .agenda-toolbar__icon {
        font-size: 1rem;
    }

    .agenda-filters__bar {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.35em;
    }

    .agenda-filters__mode {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 0 0 0.25em;
        margin: 0;
        width: 100%;
    }

    .agenda-field--inline,
    .agenda-field--prestacion {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }

    .agenda-practica-picker {
        grid-template-columns: 1fr;
    }

    .agenda-more-menu {
        width: 100%;
    }

    .agenda-more-menu > summary {
        width: 100%;
        min-width: 0;
    }

    .agenda-more-menu__panel {
        left: 0;
        right: 0;
        min-width: 0;
        width: 100%;
    }

    .agenda-summary {
        gap: 0.2em 0.55em;
        font-size: 0.7em;
    }

    .agenda-summary__item--secondary {
        display: none;
    }

    .agenda-main {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .agenda-calendar-panel {
        max-width: none;
        width: 100%;
        overflow: visible;
    }

    .agenda-calendar {
        padding: 0.55rem 0.5rem 0.4rem;
    }

    .agenda-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 0.5em;
        padding: 0.3em 0.4em;
    }

    .agenda-stats li {
        border-bottom: none;
        padding: 0.15em 0;
    }

    .agenda-table-area {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .agenda-table-wrap {
        order: 1;
        height: auto;
        min-height: 14rem;
        max-height: min(55vh, 28rem);
    }

    .agenda-table-side {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        flex: none;
        gap: 0.3rem;
        padding-top: 0;
        overflow: visible;
    }

    .agenda-table-side--left {
        order: 2;
    }

    .agenda-table-side--right {
        order: 3;
    }

    .agenda-table-side form {
        flex: 1 1 calc(50% - 0.3rem);
        min-width: 6.5rem;
    }

    .agenda-table-side--right > a.agenda-action-big {
        flex: 1 1 calc(50% - 0.3rem);
        min-width: 6.5rem;
    }

    .agenda-action-icon,
    .agenda-action-big {
        flex-direction: row;
        gap: 0.3rem;
        height: auto;
        min-height: 2.4rem;
        padding: 0.35rem 0.5rem;
        font-size: 0.72rem;
    }

    .agenda-universo-filters {
        gap: 0.25rem;
    }

    .agenda-universo-filter {
        flex: 1 1 calc(33.33% - 0.25rem);
        min-width: 0;
        padding: 0.35rem 0.3rem;
        font-size: 0.68rem;
    }

    .agenda-table-head {
        font-size: 0.78em;
        line-height: 1.25;
        padding: 0.35em 0.4em;
    }

    .agenda-table-head__extra {
        display: block;
        margin: 0.15em 0 0;
    }

    .agenda-table-scroll {
        min-height: 10rem;
    }

    .agenda-table {
        min-width: 28rem;
    }

    .agenda-col-id,
    .agenda-col-lugar {
        display: none;
    }

    .agenda-paciente-cell {
        max-width: 9rem;
    }

    .agenda-legend {
        order: 4;
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
        max-width: none;
        width: 100%;
        max-height: none;
        gap: 0.3em 0.65em;
        padding: 0.35em 0.45em;
        font-size: 0.72em;
    }

    .agenda-recep-item {
        grid-template-columns: 1fr;
    }

    .agenda-modal__form-grid {
        grid-template-columns: 1fr;
    }

    .agenda-modal__body {
        overflow-x: auto;
    }

    .agenda-modal__panel,
    .agenda-modal__panel--wide {
        width: min(100%, 28rem);
        max-width: calc(100vw - 1rem);
        margin: 0.5rem;
    }
}

/* Móvil estrecho */
@media (max-width: 480px) {
    .agenda-toolbar__item > span:last-child {
        max-width: 3.2rem;
    }

    .agenda-patient-card {
        grid-template-columns: 2.75rem minmax(0, 1fr);
    }

    .agenda-patient-card__avatar {
        width: 2.75rem;
        height: 2.75rem;
    }

    .agenda-stats {
        grid-template-columns: 1fr;
    }

    .agenda-table-side form,
    .agenda-table-side--right > a.agenda-action-big {
        flex: 1 1 100%;
        min-width: 0;
    }

    .agenda-universo-filter {
        flex: 1 1 100%;
    }

    .agenda-table {
        min-width: 24rem;
    }
}

/* Contenedor angosto (sidebar abierto / ventana estrecha en desktop) */
@container agenda (max-width: 767px) {
    .agenda-top__body {
        grid-template-columns: 1fr;
    }

    .agenda-main {
        display: flex;
        flex-direction: column;
        overflow: auto;
        height: auto;
    }

    .agenda-calendar-panel {
        max-width: none;
        width: 100%;
    }

    .agenda-legend {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: none;
        width: 100%;
        min-width: 0;
    }
}

/* ── Especialidades & Bonos (CRUD legacy) ── */
.esp-screen, .bonos-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0b241c;
    color: #e2e8f0;
    font-size: var(--font-xs);
}

.esp-head, .bonos-screen .esp-head {
    background: var(--ui-caption);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.45em 0.75em;
    flex-shrink: 0;
}

.esp-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(9rem, 12rem) 1fr;
    gap: var(--gap-xs);
    padding: var(--gap-xs);
    overflow: hidden;
}

.bonos-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr minmax(14rem, 20rem);
    gap: var(--gap-sm);
    padding: var(--gap-sm);
    overflow: hidden;
}

.esp-list-panel {
    background: #0b241c;
    border: 1px solid #166534;
    border-radius: 0.25rem;
    padding: var(--gap-xs);
    overflow-y: auto;
}

.esp-list-item {
    display: block;
    padding: 0.35em 0.5em;
    margin-bottom: 0.2em;
    border-radius: 0.2rem;
    color: #d1fae5;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid transparent;
}
.esp-list-item:hover { background: #14532d; }
.esp-list-item.is-active { background: var(--ui-green); border-color: #86efac; color: #fff; }
.esp-list-item--new { color: #86efac; }
.esp-list-item--link { margin-top: 0.5em; color: #fde68a; }

.esp-form-panel, .bonos-list-panel, .bonos-form-panel {
    background: #f0fdf4;
    color: #1e293b;
    border: 1px solid #64748b;
    border-radius: 0.25rem;
    padding: var(--gap-sm);
    overflow-y: auto;
    min-height: 0;
}

.esp-section-title {
    background: var(--ui-green-dark);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.8em;
    padding: 0.3em 0.5em;
    margin-bottom: var(--gap-xs);
    letter-spacing: 0.04em;
}

.esp-top-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: var(--gap-xs);
    margin-bottom: var(--gap-sm);
}

@media (max-width: 1100px) {
    .esp-top-grid { grid-template-columns: 1fr 1fr; }
    .esp-layout { grid-template-columns: 1fr; }
    .bonos-body { grid-template-columns: 1fr; }
}

.esp-field label {
    display: block;
    font-weight: 700;
    font-size: 0.85em;
    margin-bottom: 0.15em;
    color: #334155;
}

.esp-field input,
.esp-field select,
.esp-field textarea {
    width: 100%;
    border: 1px solid #94a3b8;
    border-radius: 0.2rem;
    padding: 0.25em 0.4em;
    font-size: inherit;
    background: #fff;
    color: #1e293b;
}

.esp-field--grow { grid-column: span 1; }
.esp-field--full { grid-column: 1 / -1; }
.esp-field--costo { min-width: 6rem; }

.esp-check-label {
    display: flex !important;
    align-items: flex-start;
    gap: 0.45rem;
    text-transform: none !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    cursor: pointer;
    line-height: 1.35;
}
.esp-check-label input[type="checkbox"] {
    width: auto !important;
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.esp-field-hint {
    margin: 0.35rem 0 0;
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.35;
}

.esp-flags-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap-xs);
    margin-bottom: var(--gap-sm);
    padding: var(--gap-xs);
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 0.25rem;
}

@media (max-width: 900px) {
    .esp-flags-grid { grid-template-columns: repeat(2, 1fr); }
}

.esp-check {
    display: flex;
    align-items: flex-start;
    gap: 0.35em;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.25;
}

.esp-subsection {
    margin-bottom: var(--gap-sm);
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    padding: var(--gap-xs);
    background: #f8fafc;
}

.esp-table-scroll { max-height: 8rem; overflow: auto; -webkit-overflow-scrolling: touch; }

.esp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: inherit;
}

.esp-table th {
    background: #cbd5e1;
    padding: 0.3em 0.45em;
    text-align: left;
    font-weight: 800;
    position: sticky;
    top: 0;
}

.esp-table td {
    padding: 0.25em 0.45em;
    border-top: 1px solid #e2e8f0;
}

.esp-table tr.is-selected { background: #fef9c3; }

.esp-assign-row {
    display: grid;
    grid-template-columns: 6rem 1fr auto;
    gap: var(--gap-xs);
    align-items: end;
    margin-top: var(--gap-xs);
}

.esp-mini-btn {
    border: 1px solid #64748b;
    background: #f1f5f9;
    border-radius: 0.2rem;
    padding: 0.25em 0.5em;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    color: #1e293b;
    text-decoration: none;
    display: inline-block;
}
.esp-mini-btn--primary { background: var(--ui-green); color: #fff; border-color: #15803d; }
.esp-mini-btn--danger { background: #fecaca; color: #991b1b; border-color: #f87171; }

.esp-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 16rem;
    gap: var(--gap-sm);
    margin-bottom: var(--gap-sm);
}

.esp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
    justify-content: flex-end;
    padding-top: var(--gap-xs);
    border-top: 1px solid #94a3b8;
}

.esp-action-btn {
    padding: 0.45em 1em;
    border: 1px solid #64748b;
    border-radius: 0.25rem;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    font-weight: 800;
    font-size: inherit;
    cursor: pointer;
    text-decoration: none;
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}
.esp-action-btn--primary { background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%); color: #fff; border-color: #15803d; }
.esp-action-btn--danger { background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%); color: #fff; border-color: #dc2626; }

.bonos-table-scroll { max-height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }
.bonos-list-panel { display: flex; flex-direction: column; min-height: 0; }
.bonos-form-panel { align-self: start; }

/* ── Inicio / menú por rol ── */
.home-header-btn {
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #99f6e4;
    background: rgb(15 118 110 / 0.25);
    border: 1px solid rgb(45 212 191 / 0.35);
    text-decoration: none;
    transition: background 0.15s;
}
.home-header-btn:hover { background: rgb(15 118 110 / 0.4); }

.home-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #cbd5e1;
    text-decoration: none;
    transition: background 0.15s;
}
.home-sidebar-link:hover { background: #1e293b; }
.home-sidebar-link.is-active {
    background: rgb(13 148 136 / 0.2);
    color: #99f6e4;
    border: 1px solid rgb(45 212 191 / 0.3);
}

.home-screen {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--gap-md);
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
}

.home-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-md);
    padding: var(--gap-lg);
    background: linear-gradient(135deg, #0f766e 0%, #115e59 50%, #134e4a 100%);
    border-radius: var(--radius);
    color: #fff;
    box-shadow: 0 4px 14px rgb(15 118 110 / 0.35);
}

.home-hero__main {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
    min-width: 0;
}

.home-hero__avatar {
    font-size: 2.5rem;
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(255 255 255 / 0.15);
    border-radius: 1rem;
    flex-shrink: 0;
}

.home-hero__welcome {
    font-size: var(--font-sm);
    opacity: 0.85;
    margin: 0;
}

.home-hero__name {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0.15rem 0 0;
    line-height: 1.2;
}

.home-hero__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-sm);
    opacity: 0.9;
    margin: 0.35rem 0 0;
}

.home-hero__pill {
    background: rgb(255 255 255 / 0.2);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.home-hero__stats {
    display: flex;
    gap: var(--gap-md);
    flex-shrink: 0;
}

.home-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgb(0 0 0 / 0.15);
    border-radius: 0.5rem;
    min-width: 7rem;
}

.home-stat__val {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
}

.home-stat__label {
    font-size: 0.7rem;
    opacity: 0.85;
    text-align: center;
    margin-top: 0.25rem;
}

.home-group__title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin: 0 0 var(--gap-sm);
    padding-left: 0.25rem;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: var(--gap-sm);
}

.home-card {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
    padding: var(--gap-md);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.home-card:hover {
    border-color: #5eead4;
    box-shadow: 0 4px 12px rgb(13 148 136 / 0.15);
    transform: translateY(-1px);
}

.home-card__icon {
    font-size: 1.75rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0fdfa;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.home-card__body {
    flex: 1;
    min-width: 0;
}

.home-card__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.home-card__head h3 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.home-card__badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    color: #fff;
}

.home-card__desc {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0.25rem 0 0;
    line-height: 1.35;
}

.home-card__arrow {
    font-size: 1.25rem;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.15s, transform 0.15s;
}

.home-card:hover .home-card__arrow {
    color: #0d9488;
    transform: translateX(2px);
}

.home-footnote {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    margin: 0;
    padding: var(--gap-sm);
}

/* ── Responsive global (shell + módulos sin bloque propio) ── */
@media (max-width: 767px) {
    .app-flash {
        left: var(--gap-sm);
        right: var(--gap-sm);
        max-width: none;
    }

    .app-sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: min(var(--sidebar-w), 85vw);
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 24px rgb(0 0 0 / 0.35);
    }

    .app-sidebar.is-open { transform: translateX(0); }

    .app-body--sidebar-collapsed .app-sidebar {
        width: min(var(--sidebar-w), 85vw);
        min-width: 0;
        opacity: 1;
        pointer-events: auto;
    }

    .app-menu-btn[aria-expanded="true"] {
        background: #0f766e;
        border-color: #14b8a6;
        color: #ccfbf1;
    }

    .app-sidebar__close { display: inline-flex; }

    .app-mobile-nav { display: block; }

    .app-main {
        padding-bottom: 0;
    }

    .app-content,
    .app-content.app-content--scroll {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: var(--gap-xs);
        padding-bottom: calc(var(--mobile-nav-h) + var(--gap-sm));
    }

    .app-user-dock {
        bottom: calc(var(--mobile-nav-h) + 0.4rem);
        right: 0.4rem;
    }
    .app-user-dock__demo { display: none; }

    .patient-bar {
        padding: var(--gap-sm);
        flex-wrap: wrap;
        gap: var(--gap-xs);
    }

    .patient-bar__name {
        font-size: var(--font-sm);
    }

    .patient-bar__meta {
        font-size: var(--font-xs);
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .module-card-head {
        padding: var(--gap-sm) var(--gap-md);
    }

    .module-body {
        padding: var(--gap-md);
    }

    .table-scroll .module-table,
    .crud-list .module-table,
    .esp-table,
    .agenda-modal-table {
        min-width: 32rem;
    }

    .bonos-table-scroll .esp-table,
    .esp-table-scroll .esp-table {
        min-width: 28rem;
    }

    .agenda-universo-btn {
        white-space: nowrap;
    }

    .config-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding: 0 var(--gap-sm);
    }

    .config-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .module-card-head--split {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gap-sm);
    }

    .esp-top-grid {
        grid-template-columns: 1fr;
    }

    .esp-flags-grid {
        grid-template-columns: 1fr;
    }

    .agenda-field--grow { grid-column: span 1; }

    .esp-screen,
    .bonos-screen,
    .module-screen {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .esp-bottom-grid {
        grid-template-columns: 1fr;
    }

    .esp-assign-row {
        grid-template-columns: 1fr;
    }

    .esp-top-grid {
        grid-template-columns: 1fr;
    }

    .home-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .home-hero__stats {
        width: 100%;
        justify-content: stretch;
    }

    .home-stat {
        flex: 1;
    }

    .home-grid {
        grid-template-columns: 1fr;
    }

    .home-card {
        padding: var(--gap-sm) var(--gap-md);
    }

    .stats-kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    :root {
        --tooth-size: clamp(1.35rem, 4.5vw, 2rem);
        --sidebar-w: min(16rem, 88vw);
    }

    .app-user-dock__name {
        max-width: 7.5rem;
    }

    .stats-kpi-grid {
        grid-template-columns: 1fr;
    }

    .home-hero__name {
        font-size: 1.2rem;
    }

    .config-form-grid {
        grid-template-columns: 1fr;
    }

    .module-body {
        padding: var(--gap-sm);
    }

    .esp-assign-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .app-sidebar {
        position: relative;
        transform: none;
        box-shadow: none;
    }
}

.hidden { display: none !important; }

/* ── Configuración / Profesionales ── */
.config-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 var(--gap-lg);
    background: #f8fafc;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.config-tab {
    padding: 0.65em 1em;
    font-size: var(--font-sm);
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    flex-shrink: 0;
    white-space: nowrap;
}
.config-tab:hover { color: #0f766e; }
.config-tab.is-active { color: #0f766e; border-bottom-color: #0d9488; }

.config-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: var(--gap-md);
    align-items: end;
}

.config-field { min-width: 0; }
.config-field--full { grid-column: 1 / -1; }
.config-field label {
    display: block;
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.2em;
}
.config-field input,
.config-field select,
.config-field textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 0.45em 0.6em;
    font-size: var(--font-sm);
}

.config-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5em 1em;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    font-size: var(--font-sm);
    font-weight: 700;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
}
.config-btn:hover { background: #e2e8f0; }
.config-btn--primary { background: #0d9488; color: #fff; border-color: #0f766e; }
.config-btn--primary:hover { background: #0f766e; }

/* ── Profesionales: layout compacto (mockup franjas/turnos) ── */
.prof-screen {
    display: grid;
    grid-template-columns: minmax(14rem, 16.5rem) minmax(0, 1fr);
    gap: 0.5rem;
    height: 100%;
    min-height: 0;
    padding: 0.4rem;
    box-sizing: border-box;
    overflow: hidden;
    background: #f1f5f9;
}
.prof-aside {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.45rem;
    overflow: hidden;
}
.prof-aside__head {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
    flex-shrink: 0;
}
.prof-aside__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}
.prof-aside__title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #334155;
}
.prof-aside__list {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.prof-aside__foot {
    padding: 0.35rem 0.5rem;
    font-size: 0.62rem;
    line-height: 1.3;
    color: #64748b;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.prof-card {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.45rem 0.5rem;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.prof-card:hover { background: #f8fafc; }
.prof-card.is-active {
    background: #ecfdf5;
    border-left-color: #0d9488;
}
.prof-card__avatar {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    color: #115e59;
    font-size: 0.62rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.prof-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}
.prof-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}
.prof-card__name {
    font-size: 0.7rem;
    font-weight: 800;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prof-card__badge {
    font-size: 0.55rem;
    font-weight: 700;
    background: #d1fae5;
    color: #065f46;
    padding: 0.05rem 0.3rem;
    border-radius: 0.2rem;
    flex-shrink: 0;
}
.prof-card__esp {
    font-size: 0.62rem;
    font-weight: 700;
    color: #0f766e;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prof-card__meta {
    font-size: 0.58rem;
    color: #94a3b8;
}
.prof-main {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.prof-toolbar-mini { flex-shrink: 0; }
.prof-ficha {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.45rem;
    padding: 0.45rem 0.55rem;
    flex-shrink: 0;
}
.prof-ficha__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.prof-ficha__title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: #334155;
    min-width: 0;
}
.prof-ficha__title strong {
    color: #0f766e;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prof-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #10b981;
    flex-shrink: 0;
}
.prof-ficha__actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}
.prof-ficha__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem 0.45rem;
}
.prof-field {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    font-size: 0.62rem;
    font-weight: 700;
    color: #475569;
}
.prof-field--esp span { color: #065f46; }
.prof-field__label {
    font-size: 0.62rem;
    font-weight: 700;
    color: #475569;
}
.prof-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
    padding: 0.28rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #0f172a;
    background: #fff;
    min-height: 1.7rem;
}
.prof-input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 1px #14b8a6;
}
.prof-input--search {
    padding-left: 0.5rem;
    font-weight: 500;
}
.prof-input--upper { text-transform: uppercase; }
.prof-input--tiny {
    width: 2.4rem;
    text-align: center;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}
.prof-field--esp .prof-input {
    border-color: #5eead4;
    background: #f0fdfa;
    color: #064e3b;
}
.prof-banner-new {
    margin: 0 0 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 0.25rem;
    padding: 0.25rem 0.45rem;
}
.prof-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 0.25rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.prof-btn--sm {
    font-size: 0.65rem;
    padding: 0.22rem 0.45rem;
}
.prof-btn--primary {
    background: #0d9488;
    border-color: #0f766e;
    color: #fff;
}
.prof-btn--primary:hover { background: #0f766e; }
.prof-btn--dark {
    background: #1e293b;
    border-color: #0f172a;
    color: #fff;
}
.prof-btn--danger {
    color: #e11d48;
    border-color: #fecdd3;
    background: #fff1f2;
}
.prof-split {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(16rem, 0.9fr) minmax(0, 1.2fr);
    gap: 0.45rem;
    overflow: hidden;
}
.prof-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.45rem;
    overflow: hidden;
}
.prof-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #334155;
    flex-shrink: 0;
}
.prof-panel__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.5rem;
}
.prof-panel__body--flush { padding: 0; }
.prof-panel__foot {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.28rem 0.55rem;
    font-size: 0.62rem;
    color: #64748b;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.prof-chip {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: none;
    background: #f0fdfa;
    color: #0f766e;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
}
.prof-ok { color: #0f766e; font-weight: 700; }
.prof-slot-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.prof-slot-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}
.prof-slot-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
}
.prof-weeks { display: flex; flex-direction: column; gap: 0.2rem; }
.prof-week-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
}
.prof-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}
.prof-hint {
    margin: 0;
    font-size: 0.62rem;
    color: #64748b;
}
.prof-slot-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.4rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.35rem;
}
.prof-slot-extras__left,
.prof-slot-extras__right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.prof-st-qty {
    gap: 0.2rem;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 0.25rem;
    padding: 0.1rem 0.3rem;
}
.prof-st-qty span {
    font-size: 0.58rem;
    font-weight: 800;
    color: #6b21a8;
}
.prof-generate {
    margin-top: 0.5rem;
    background: #0f172a;
    color: #fff;
    border-radius: 0.4rem;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.prof-generate__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}
.prof-generate__period {
    font-size: 0.6rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: none;
}
.prof-generate__hint {
    margin: 0;
    font-size: 0.62rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.35;
    text-transform: none;
}

.agenda-regen-blockers {
    margin: 0 0 0.75rem;
    border: 1px solid #fca5a5;
    background: #fff1f2;
    border-radius: 0.35rem;
    overflow: hidden;
}
.agenda-regen-blockers__head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.7rem;
    background: #ffe4e6;
    border-bottom: 1px solid #fecdd3;
    font-size: 0.8rem;
    color: #9f1239;
}
.agenda-regen-blockers__head strong {
    font-size: 0.85rem;
    color: #881337;
}
.agenda-regen-blockers__table-wrap {
    max-height: 14rem;
    overflow: auto;
}
.agenda-regen-blockers__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.agenda-regen-blockers__table th,
.agenda-regen-blockers__table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #fecdd3;
    text-align: left;
    white-space: nowrap;
}
.agenda-regen-blockers__table th {
    position: sticky;
    top: 0;
    background: #fff;
    font-weight: 800;
    color: #9f1239;
    z-index: 1;
}
.agenda-regen-blockers__table td { color: #1f2937; }

.app-notice {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.app-notice__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.app-notice__card {
    position: relative;
    width: min(32rem, 100%);
    background: #fff;
    border: 1px solid #86efac;
    border-radius: 1rem;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
    padding: 1.25rem 1.35rem 1.1rem;
}
.app-notice__title {
    margin: 0 0 0.55rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: #14532d;
    line-height: 1.3;
    word-break: break-word;
}
.app-notice__msg {
    margin: 0;
    white-space: pre-line;
    line-height: 1.45;
    color: #1f2937;
    font-size: 0.95rem;
}
.app-notice__ok {
    margin-top: 1rem;
    margin-left: auto;
    display: block;
    min-height: 2.15rem;
    padding: 0 1.1rem;
    border: 1px solid #15803d;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}
.app-notice__ok:hover { background: #15803d; }

.app-flash {
    max-width: min(28rem, calc(100vw - 2rem));
    white-space: pre-line;
    line-height: 1.35;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.app-flash.is-hiding {
    opacity: 0;
    transform: translateY(-0.4rem);
    pointer-events: none;
}
.prof-generate__row {
    display: grid;
    grid-template-columns: 4.5rem 1fr auto;
    gap: 0.35rem;
    align-items: end;
}
.prof-generate__row label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: #94a3b8;
}
.prof-generate .prof-input {
    background: #1e293b;
    border-color: #334155;
    color: #fff;
}
.prof-tabs { display: flex; gap: 0.2rem; }
.prof-tab {
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.45rem;
    border-radius: 0.25rem;
    cursor: pointer;
    text-transform: none;
}
.prof-tab.is-active {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f766e;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}
.prof-load {
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    text-transform: none;
}
.prof-load strong {
    color: #0f766e;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 0.2rem;
    padding: 0.05rem 0.35rem;
}
.prof-table-wrap { height: 100%; overflow: auto; }
.prof-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}
.prof-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    z-index: 1;
}
.prof-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.prof-table tr.is-selected { background: #ecfdf5; }
.prof-table__freq { font-weight: 700; font-size: 0.65rem; }
.prof-link {
    border: 0;
    background: none;
    color: #0f766e;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    padding: 0 0.15rem;
}
.prof-link--danger { color: #e11d48; }
.prof-week-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.35rem;
    height: 100%;
    min-height: 10rem;
}
.prof-week-col {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.3rem;
    min-height: 0;
    overflow: hidden;
}
.prof-week-col__head {
    text-align: center;
    font-size: 0.62rem;
    font-weight: 800;
    color: #334155;
    padding: 0.3rem;
    border-bottom: 1px solid #e2e8f0;
}
.prof-week-col__body {
    flex: 1;
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: auto;
}
.prof-week-free {
    margin: auto;
    font-size: 0.6rem;
    color: #94a3b8;
    font-style: italic;
}
.prof-week-slot {
    display: block;
    background: #ccfbf1;
    border: 1px solid #5eead4;
    color: #115e59;
    border-radius: 0.25rem;
    padding: 0.3rem;
    text-decoration: none;
    font-size: 0.62rem;
    line-height: 1.25;
}
.prof-week-slot strong { display: block; font-size: 0.65rem; }
.prof-week-slot span {
    display: block;
    color: #0f766e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prof-empty {
    margin: 0;
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
}
.prof-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 0.45rem;
    color: #64748b;
    font-size: 0.85rem;
}
.prof-days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.prof-day-chip {
    cursor: pointer;
}
.prof-day-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.prof-day-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    padding: 0.28rem 0.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
    font-size: 0.62rem;
    font-weight: 800;
    color: #475569;
    background: #fff;
}
.prof-day-chip input:checked + span {
    background: #0d9488;
    border-color: #0f766e;
    color: #fff;
}
.prof-days-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}
.prof-preset {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.12rem 0.4rem;
    cursor: pointer;
}
.prof-preset:hover {
    border-color: #99f6e4;
    color: #0f766e;
    background: #f0fdfa;
}
.prof-consultorio-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.3rem;
    align-items: stretch;
}
.prof-consultorio-row .prof-btn {
    min-width: 2rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}
.prof-mini-link {
    margin-top: 0.15rem;
    font-size: 0.58rem;
    font-weight: 600;
    color: #0f766e;
    text-decoration: none;
}
.prof-mini-link:hover { text-decoration: underline; }
.prof-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 220;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.prof-modal.is-open { display: flex; }
.prof-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.5);
}
.prof-modal__panel {
    position: relative;
    width: min(420px, 96vw);
    background: #fff;
    border-radius: 0.45rem;
    box-shadow: 0 16px 40px rgb(15 23 42 / 0.25);
    overflow: hidden;
}
.prof-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: #0f172a;
    color: #fff;
}
.prof-modal__head h2 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 800;
}
.prof-modal__head button {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
.prof-modal__body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem;
}
.prof-modal__body textarea.prof-input {
    min-height: 3.2rem;
    resize: vertical;
    font-weight: 500;
}
.prof-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-top: 0.2rem;
}
@media (max-width: 1100px) {
    .prof-ficha__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .prof-split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .prof-screen {
        grid-template-columns: 1fr;
        overflow: auto;
        height: auto;
        min-height: 100%;
    }
    .prof-aside { max-height: 12rem; }
    .prof-ficha__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .prof-week-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.agenda-universo-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3em;
    width: var(--agenda-btn-w);
    min-width: var(--agenda-btn-w);
    height: var(--agenda-btn-h);
    min-height: var(--agenda-btn-h);
    padding: 0 0.45rem;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    color: #fff;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    text-decoration: none;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    border: 1px solid #0f6b52;
    box-shadow: var(--agenda-btn-shadow);
    white-space: normal;
}
.agenda-universo-btn:hover { filter: brightness(1.06); color: #fff; }
.agenda-universo-btn__icon { font-size: 0.9rem; }

.agenda-turn-row.is-move-source { outline: 2px dashed #f59e0b; }


.crud-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--gap-lg);
    align-items: start;
}

.crud-list__title,
.crud-form__title {
    font-size: var(--font-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin-bottom: var(--gap-sm);
}

.crud-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: var(--gap-md);
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.crud-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm);
    margin-top: var(--gap-xs);
}

.module-table tr.is-selected { background: #ecfdf5 !important; }

@media (max-width: 900px) {
    .crud-layout { grid-template-columns: 1fr; }
}

/* Agenda modales y acciones */
.agenda-toolbar__item.has-alert {
    position: relative;
    color: #fff;
}
.agenda-toolbar__item.has-alert::after {
    content: '';
    position: absolute;
    top: 0.18rem;
    right: 0.4rem;
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: #facc15;
    box-shadow: 0 0 0 1px #713f12;
}
.agenda-toolbar__item.has-alert .agenda-toolbar__icon { filter: none; }

.agenda-list-actions {
    display: flex;
    gap: 0.2em;
    align-items: center;
}
.agenda-list-actions select { flex: 1; min-width: 0; }
.agenda-crud-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    min-width: 1.7rem;
    height: 1.7rem;
    min-height: 1.7rem;
    padding: 0;
    border: 1px solid #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-decoration: none;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 40, 20, 0.35);
    box-shadow: var(--agenda-btn-shadow);
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
}
.agenda-crud-btn:hover { filter: brightness(1.06); color: #fff; }

.agenda-search-row {
    display: flex;
    gap: 0.25em;
}
.agenda-search-row input { flex: 1; }


.agenda-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.agenda-modal.is-open { display: flex; }
.agenda-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.55);
}
.agenda-modal__panel {
    position: relative;
    background: #fff;
    border-radius: 0.5rem;
    width: min(520px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgb(0 0 0 / 0.2);
    border: 1px solid #94a3b8;
}
.agenda-modal__panel--wide { width: min(760px, 100%); }
.agenda-modal__panel--search {
    width: min(980px, 98vw);
    max-height: min(86vh, 720px);
    display: flex;
    flex-direction: column;
}
.agenda-modal__panel--search .agenda-modal__body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}
.agenda-popup-search {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 0.5rem 0.65rem;
    align-items: end;
    margin-bottom: 0.75rem;
}
.agenda-popup-search__meta {
    margin: 0 0 0.5rem;
    font-size: 0.85em;
    font-weight: 600;
    color: #475569;
}
.agenda-popup-search__results {
    overflow: auto;
    min-height: 12rem;
    max-height: 48vh;
    border: 1px solid #e2e8f0;
    border-radius: 0.35rem;
}
.agenda-patient-result-row { cursor: pointer; }
.agenda-patient-result-row:hover { background: #f0fdfa; }
.agenda-patient-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    align-items: center;
    white-space: nowrap;
}
.agenda-next-turn {
    font-size: 0.9em;
    white-space: nowrap;
    color: #0f766e;
    font-weight: 600;
}
.agenda-mini-btn--ficha,
a.agenda-mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    border-color: #0f6b52;
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
}
.agenda-mini-btn--ficha:hover,
a.agenda-mini-btn:hover {
    filter: brightness(1.06);
    color: #fff;
}
.agenda-mini-btn--alert {
    color: #9a3412;
    border-color: #fdba74;
    background: #fff7ed;
}
.agenda-mini-badge {
    display: inline-flex;
    min-width: 1.1em;
    padding: 0 0.3em;
    border-radius: 999px;
    background: #ea580c;
    color: #fff;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1.3;
    margin-left: 0.15em;
}
.agenda-alerts-block {
    margin-bottom: 1rem;
}
.agenda-alerts-block h3 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}
.agenda-alerts-obs {
    margin: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.35rem;
    background: #f8fafc;
    color: #64748b;
    white-space: pre-wrap;
}
.agenda-alerts-obs.has-text {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fdba74;
    font-weight: 600;
}
@media (max-width: 767px) {
    .agenda-popup-search { grid-template-columns: 1fr 1fr; }
}
.agenda-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65em 1em;
    background: var(--ui-caption);
    color: #fff;
}
.agenda-modal__head h2 { margin: 0; font-size: 1em; }
.agenda-modal__head button {
    border: none;
    background: rgb(255 255 255 / 0.2);
    color: #fff;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1.1rem;
}
.agenda-modal__body { padding: 1em; overflow: auto; }
.agenda-modal__scroll { max-height: 60vh; }
.agenda-modal__textarea {
    width: 100%;
    border: 1px solid #94a3b8;
    border-radius: 0.25rem;
    padding: 0.5em;
    font-family: inherit;
    font-size: inherit;
    resize: vertical;
}
.agenda-modal__actions {
    display: flex;
    gap: 0.5em;
    margin-top: 0.75em;
}
.agenda-modal__row { margin: 0.5em 0; }
.agenda-modal__row select { width: 100%; padding: 0.35em; }
.agenda-modal__hint { margin: 0 0 0.75em; color: #475569; font-weight: 600; }
.agenda-modal__form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5em;
}
.agenda-field--full { grid-column: 1 / -1; }
.agenda-btn--primary {
    background: var(--agenda-btn-bg);
    background-color: #2faf62;
    color: #fff;
    border-color: #0f6b52;
}

.agenda-recep-list { display: flex; flex-direction: column; gap: 0.5em; margin-bottom: 0.75em; max-height: 16rem; overflow-y: auto; }
.agenda-recep-day-head {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 0.2rem;
    padding: 0.25em 0.45em;
    margin-top: 0.25em;
}
.agenda-recep-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.4em;
    margin-bottom: 0.55em;
}
.agenda-recep-filters__field {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    min-width: 10rem;
    flex: 1 1 10rem;
}
.agenda-recep-filters__field span {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
}
.agenda-recep-filters__field select {
    border: 1px solid #94a3b8;
    border-radius: 0.2rem;
    padding: 0.3em 0.4em;
    font-size: 0.85em;
}
.agenda-recep-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.35em 0.5em;
    align-items: start;
    padding: 0.5em;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    background: #f8fafc;
    cursor: pointer;
}
.agenda-recep-item small { grid-column: 2 / -1; color: #64748b; font-size: 0.85em; }
.agenda-recep-monto { font-weight: 800; color: #15803d; }
.agenda-recep-total {
    text-align: right;
    font-size: 1.1em;
    margin-bottom: 0.5em;
    padding: 0.5em;
    background: #ecfdf5;
    border-radius: 0.25rem;
}

.agenda-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}
.agenda-modal-table th,
.agenda-modal-table td {
    border: 1px solid #e2e8f0;
    padding: 0.35em 0.5em;
    text-align: left;
}
.agenda-modal-table th { background: #f1f5f9; }

.esp-new-banner {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    font-weight: 700;
    padding: 0.5em 0.75em;
    border-radius: 0.25rem;
    margin-bottom: 0.75em;
}

.esp-agenda-back,
.esp-head__back {
    margin-left: auto;
    font-size: 0.85em;
}
.esp-head {
    display: flex;
    align-items: center;
    gap: 0.75em;
}

/* Look del sistema: botones en píldora y captions en verde (sin el azul de barra de Windows). */
button.config-btn,
a.config-btn,
button.esp-action-btn,
a.esp-action-btn,
button.esp-mini-btn,
a.esp-mini-btn,
button.carga-action-btn,
a.carga-action-btn,
button.agenda-btn,
a.agenda-btn,
.agenda-search .agenda-btn--search,
button.df-db-confirm__btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--ui-btn-h);
    padding: 0 0.95rem;
    border-radius: var(--ui-btn-radius);
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    font-weight: 700;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    text-decoration: none;
}

button.config-btn--primary,
a.config-btn--primary,
button.esp-action-btn--primary,
a.esp-action-btn--primary,
button.esp-mini-btn--primary,
a.esp-mini-btn--primary,
button.carga-action-btn--primary,
a.carga-action-btn--primary,
button.agenda-btn--primary,
a.agenda-btn--primary,
.agenda-search .agenda-btn--search,
button.df-db-confirm__btn--ok,
.agenda-toolbar__item.is-primary,
button.agenda-action-big,
a.agenda-action-big,
button.agenda-action-icon,
a.agenda-universo-btn,
.agenda-more-menu > summary,
button.agenda-crud-btn,
a.agenda-crud-btn,
a.agenda-mini-btn,
button.agenda-mini-btn {
    background: var(--ui-green);
    border-color: #15803d;
    color: #fff;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(22, 163, 74, 0.28);
}

button.esp-mini-btn--danger,
button.esp-action-btn--danger,
#df-db-confirm.is-delete .df-db-confirm__btn--ok {
    background: #ef4444;
    border-color: #b91c1c;
    color: #fff;
}

a.agenda-toolbar__item,
button.agenda-toolbar__item {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

a.agenda-toolbar__item.is-primary,
button.agenda-toolbar__item.is-primary {
    background: var(--ui-green);
    border-color: #15803d;
    color: #fff;
}

a.agenda-toolbar__item:hover,
button.agenda-toolbar__item:hover,
button.config-btn:hover,
a.config-btn:hover,
button.esp-action-btn:hover,
a.esp-action-btn:hover {
    filter: none;
    background: #f0fdf4;
    color: #14532d;
}

a.agenda-toolbar__item.is-primary:hover,
button.agenda-btn--primary:hover,
button.agenda-action-big:hover,
a.agenda-action-big:hover {
    filter: none;
    background: #15803d;
    color: #fff;
}

.agenda-search .agenda-btn--search {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.agenda-search .agenda-btn--search:hover {
    filter: none;
    background: #1e293b;
    color: #fff;
}
