/* =============================================
   CEDIS - Área de Profesionales
   Paleta: azul médico institucional
   ============================================= */

:root {
    --primary:       #2a7abf;
    --primary-light: #e8f3fb;
    --primary-mid:   #5a9fd4;
    --primary-dark:  #1a5c94;
    --success:       #2e9e6b;
    --success-light: #e6f7f1;
    --warning:       #d4920a;
    --warning-light: #fef6e4;
    --danger:        #c0392b;
    --danger-light:  #fdecea;
    --info:          #2980b9;
    --gray-50:       #f8fafc;
    --gray-100:      #f1f5f9;
    --gray-200:      #e2e8f0;
    --gray-400:      #94a3b8;
    --gray-600:      #475569;
    --gray-800:      #1e293b;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:     0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:     0 8px 24px rgba(0,0,0,.10);
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 15px;
    line-height: 1.5;
}

/* ── LOGIN ─────────────────────────────────── */

.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #39B0CA;
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 44px 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,.22);
    max-width: 400px;
    width: 100%;
}

.login-box .login-icon {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 12px;
    line-height: 1;
}

.login-box h1 {
    color: var(--primary-dark);
    margin-bottom: 6px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.login-box p {
    text-align: center;
    color: var(--gray-400);
    margin-bottom: 28px;
    font-size: .9rem;
}

/* ── APP CONTAINER ─────────────────────────── */

.app-container {
    display: none;
}

.app-container.active {
    display: block;
}

/* ── FOTO MEDICO ────────────────────────────── */

@keyframes girar-borde {
    to { transform: rotate(360deg); }
}

.foto-medico-wrapper {
    position: relative;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    flex-shrink: 0;
}

.foto-medico-wrapper::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0deg, var(--primary-mid) 120deg, transparent 180deg, transparent 360deg);
    animation: girar-borde 10s linear infinite;
    z-index: 0;
}

.foto-medico-wrapper::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    background: #fff;
    z-index: 1;
}

.foto-medico-wrapper img {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
}

/* ── APP HEADER ────────────────────────────── */

.app-header {
    background: #fff;
    padding: 12px 28px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    text-align: left;
}

.user-name strong {
    display: block;
    color: var(--gray-800);
    font-size: .95rem;
}

.user-name span {
    font-size: .8rem;
    color: var(--gray-400);
}

/* ── APP CONTENT ───────────────────────────── */

.app-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── STAT CARDS ────────────────────────────── */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--gray-200);
}

.stat-card.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.stat-card h3 {
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card .number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

/* ── SECTIONS ──────────────────────────────── */

.sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.section {
    background: #fff;
    padding: 22px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.section h2 {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

/* ── PACIENTE ITEMS ────────────────────────── */

.paciente-item {
    background: var(--gray-50);
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-mid);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow .2s, transform .2s;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--primary-mid);
}

.paciente-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.paciente-item.en-espera {
    border-left-color: var(--warning);
    background: var(--warning-light);
    border-color: #f0dba8;
    border-left-color: var(--warning);
}

.paciente-item.atendiendo {
    border-left-color: var(--success);
    background: var(--success-light);
    border-color: #a8dcc5;
    border-left-color: var(--success);
}

.paciente-info h4 {
    color: var(--gray-800);
    font-size: .95rem;
    margin-bottom: 4px;
}

.paciente-info p {
    font-size: .8rem;
    color: var(--gray-600);
    margin: 2px 0;
}

.paciente-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── FORMULARIO ────────────────────────────── */

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-600);
    font-size: .9rem;
}

input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    background: #fff;
    color: var(--gray-800);
    transition: border-color .2s, box-shadow .2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42,122,191,.12);
}

/* ── BOTONES ───────────────────────────────── */

.btn {
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, transform .1s;
    letter-spacing: .02em;
}

.btn:active {
    transform: scale(.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(42,122,191,.3);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #228055;
    box-shadow: 0 2px 8px rgba(46,158,107,.3);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #b87d08;
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-info:hover {
    background: #1f6da3;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* ── ALERTS ────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
}

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: .9rem;
    font-weight: 500;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #f5c0bb;
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #f0dba8;
}

/* ── BADGES ────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .03em;
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ── LISTA ITEMS (Sala de Espera / Agenda) ── */

.lista-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 0.5px solid var(--gray-200);
}

.lista-item:last-child {
    border-bottom: none;
}

.lista-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lista-nombre {
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.lista-detalle {
    font-size: .78rem;
    color: var(--gray-600);
}

.link-accion {
    font-size: .82rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.link-accion:hover {
    text-decoration: underline;
}

/* ── RESPONSIVE ────────────────────────────── */

@media (max-width: 768px) {

    /* Login */
    .login-container {
        padding: 16px;
        align-items: center;
    }

    .login-box {
        padding: 32px 24px;
        max-width: 100%;
        border-radius: var(--radius-md);
    }

    /* Header */
    .app-header {
        padding: 10px 14px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .foto-medico-wrapper {
        width: 40px;
        height: 40px;
    }

    .app-header h1 {
        font-size: 1rem;
    }

    .user-name strong { font-size: .85rem; }
    .user-name span   { font-size: .72rem; }

    /* Nav bar */
    .nav-bar {
        padding: 8px 14px;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        position: relative;
    }

    .nav-btn {
        font-size: .85rem;
        padding: 8px 14px;
        flex-shrink: 0;
    }

    /* Contenido */
    .app-content {
        padding: 12px 14px;
    }

    .sections,
    .lista-agenda {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Items */
    .lista-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .lista-item .btn,
    .paciente-actions .btn {
        width: 100%;
        text-align: center;
    }

    .paciente-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .paciente-actions {
        width: 100%;
    }

    /* Tabs */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .tab {
        padding: 9px 14px;
        font-size: .82rem;
        white-space: nowrap;
    }

    /* Modales — sube desde abajo */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-panel {
        width: 100vw;
        max-width: 100vw;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal-header {
        border-radius: 16px 16px 0 0;
        padding: 14px 16px;
    }

    .modal-body {
        padding: 14px 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        border-radius: 0;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
        text-align: center;
    }

    /* Signos vitales: 4 col → 2 col */
    div[style*="repeat(4,1fr)"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Nuevo paciente: 2 col → 1 col */
    #modalNuevoPaciente .modal-body > div {
        grid-template-columns: 1fr !important;
    }

    #modalNuevoPaciente div[style*="grid-column"] {
        grid-column: 1 !important;
    }

    /* Calendario */
    .calendar-grid { gap: 2px; }
    .calendar-day  { padding: 5px 2px; font-size: .8rem; }
    .calendar-day-header { font-size: .68rem; padding: 3px 0; }
}


/* ── STATS COMPACT (header) ────────────────── */

.stats-compact {
    display: flex;
    gap: 10px;
}

.stat-card-compact {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    text-align: center;
    min-width: 80px;
}

.stat-card-compact.primary {
    background: var(--primary-light);
    border-color: var(--primary-mid);
}

.stat-label {
    font-size: .7rem;
    color: var(--gray-400);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-card-compact.primary .stat-number {
    color: var(--primary);
}

/* ── MODAL ─────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 30, 50, .45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    display: flex;
}

.modal-panel {
    position: relative;
    width: 95vw;
    max-width: 1400px;
    max-height: 90vh;
    background: #fff;
    border-radius: var(--radius-lg);
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,.04);
}

.modal-header {
    background: var(--primary);
    color: #fff;
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: sticky;
    top: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 10;
}

.modal-header h2 {
    margin: 0 0 2px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
    margin-top: 2px;
}

.modal-close:hover {
    background: rgba(255,255,255,.28);
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 14px 22px;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 8px rgba(0,0,0,.05);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── PACIENTE HEADER INLINE (en modal-header) ─ */

.paciente-header-inline {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .78rem;
    margin-top: 4px;
    opacity: .92;
}

.paciente-header-inline .dato {
    display: flex;
    gap: 4px;
}

.paciente-header-inline .dato-label {
    font-weight: 600;
    color: rgba(255,255,255,.7);
}

.paciente-header-inline .dato-value {
    color: #fff;
}

/* ── TABS ──────────────────────────────────── */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 20px;
    gap: 2px;
}

.tab {
    padding: 10px 18px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    font-size: .88rem;
    color: var(--gray-400);
    transition: color .2s, border-color .2s;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--primary-mid);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ── HISTORIAL ─────────────────────────────── */

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-600);
    margin: 20px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gray-200);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.historial-item {
    background: var(--gray-50);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--primary-mid);
    transition: box-shadow .2s;
}

.historial-item:hover {
    box-shadow: var(--shadow-md);
}

.historial-fecha {
    font-weight: 700;
    color: var(--primary);
    font-size: .88rem;
    margin-bottom: 4px;
}

.historial-detalle {
    font-size: .85rem;
    color: var(--gray-600);
    margin-top: 4px;
    line-height: 1.5;
}

.empty-historial {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
    font-size: .9rem;
}

/* ── ALERT SECTION (alergias, etc.) ────────── */

.alert-section {
    background: var(--warning-light);
    border-left: 3px solid var(--warning);
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
}

.alert-section h4 {
    margin: 0 0 6px 0;
    color: var(--warning);
    font-size: .88rem;
}

.alert-section p {
    margin: 3px 0;
    color: #7a5000;
    font-size: .85rem;
}

/* ── INFO GRID (perfil paciente) ───────────── */

.paciente-header {
    background: var(--gray-50);
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    border: 1px solid var(--gray-200);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: .72rem;
    color: var(--gray-400);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.info-value {
    font-size: .92rem;
    color: var(--gray-800);
}

/* ── NAV BAR ────────────────────────────────── */

.nav-bar {
    background: #306785;
    width: 100%;
    display: flex;
    gap: 4px;
    padding: 8px 20px;
}

.nav-btn {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(255,255,255,.28);
}

/* ── NAV BUSCADOR ───────────────────────────── */

.nav-fila-principal {
    display: flex;
    gap: 4px;
    padding: 8px 20px;
    align-items: center;
}

.nav-btn-lupa {
    margin-left: auto;
    font-size: 1rem;
    padding: 8px 14px;
}

.nav-fila-busqueda {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 10px;
    position: relative;
    border-top: 1px solid rgba(255,255,255,.15);
}

.nav-fila-busqueda.active {
    display: flex;
}

.nav-fila-busqueda input {
    flex: 1;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
}

.nav-fila-busqueda input::placeholder {
    color: rgba(255,255,255,.65);
}

.nav-fila-busqueda input:focus {
    outline: none;
    background: rgba(255,255,255,.22);
    border-color: rgba(255,255,255,.6);
    box-shadow: none;
    color: #fff;
}

.nav-btn-cerrar-busqueda {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-btn-cerrar-busqueda:hover {
    background: rgba(255,255,255,.28);
}

.resultados-busqueda {
    display: none;
    position: absolute;
    top: calc(100% - 2px);
    left: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-height: 260px;
    overflow-y: auto;
}

.resultados-busqueda.active {
    display: block;
}

.resultado-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.resultado-item:last-child { border-bottom: none; }

.resultado-item:hover { background: var(--primary-light); }

.resultado-item.sin-resultado {
    color: var(--gray-400);
    cursor: default;
    font-size: .88rem;
}

.resultado-item.sin-resultado:hover { background: none; }

.resultado-nombre {
    font-weight: 600;
    font-size: .9rem;
    color: var(--gray-800);
}

.resultado-detalle {
    font-size: .78rem;
    color: var(--gray-400);
}

.nav-buscador {
    position: relative;
    margin-left: auto;
}

.nav-buscador input {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    width: 220px;
}

.nav-buscador input::placeholder {
    color: rgba(255,255,255,.7);
}

.nav-buscador input:focus {
    outline: none;
    background: rgba(255,255,255,.25);
    box-shadow: none;
    border-color: rgba(255,255,255,.6);
    color: #fff;
}

.resultados-busqueda {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 300px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
}

.resultados-busqueda.active {
    display: block;
}

.resultado-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.resultado-item:last-child {
    border-bottom: none;
}

.resultado-item:hover {
    background: var(--primary-light);
}

.resultado-item.sin-resultado {
    color: var(--gray-400);
    cursor: default;
    font-size: .88rem;
}

.resultado-item.sin-resultado:hover {
    background: none;
}

.resultado-nombre {
    font-weight: 600;
    font-size: .9rem;
    color: var(--gray-800);
}

.resultado-detalle {
    font-size: .78rem;
    color: var(--gray-400);
}

@media (max-width: 768px) {
    .nav-buscador {
        width: 100%;
        margin-left: 0;
        margin-top: 6px;
    }

    .nav-buscador input {
        width: 100%;
    }

    .resultados-busqueda {
        right: auto;
        left: 0;
        width: 100%;
    }
}

/* ── MENU ACCIONES (reemplaza stats) ─────── */

.menu-acciones {
    display: flex;
    gap: 10px;
}

/* ── PASOS MODAL TURNO ───────────────────── */

.nt-paso {
    display: none;
}

.nt-paso.active {
    display: block;
}

/* ── CALENDARIO (reutilizado en modal) ───── */

.calendar-container {
    margin-bottom: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-size: .72rem;
    font-weight: 700;
    color: var(--gray-400);
    padding: 4px 0;
    text-transform: uppercase;
}

.calendar-day {
    text-align: center;
    padding: 6px 2px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .85rem;
    border: 1px solid transparent;
}

.calendar-day.disabled {
    color: var(--gray-200);
    cursor: default;
}

.calendar-day.available {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-mid);
}

.calendar-day.available:hover {
    background: var(--primary-mid);
    color: #fff;
}

.calendar-day.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.day-number {
    font-weight: 600;
    line-height: 1.2;
}

.day-slots {
    font-size: .65rem;
    opacity: .8;
}

/* ── FECHA PICKER ───────────────────────────── */

.btn-fecha-picker {
    background: var(--primary-light);
    border: 1.5px solid var(--primary-mid);
    color: var(--primary-dark);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}

.btn-fecha-picker:hover {
    background: var(--primary-mid);
    color: #fff;
}

/* ── DISPONIBILIDAD SOBRETURNOS ───────────── */

.disponibilidad-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    padding: 10px;
}

.disponibilidad-hora {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .2s;
}

.disponibilidad-hora:hover {
    background: var(--primary-light);
    border-color: var(--primary-mid);
}

.disponibilidad-hora.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

/* Estados específicos de disponibilidad */
.disponibilidad-hora.disponible-libre {
    border-color: var(--success);
    background: var(--success-light);
}

.disponibilidad-hora.disponible-libre:hover {
    background: #dcfce7;
    border-color: #059669;
}

.disponibilidad-hora.disponible-libre.selected {
    background: var(--success);
    border-color: #059669;
}

.disponibilidad-hora.disponible-sobreturno-normal {
    border-color: var(--warning);
    background: var(--warning-light);
}

.disponibilidad-hora.disponible-sobreturno-normal:hover {
    background: #fef3c7;
    border-color: #d97706;
}

.disponibilidad-hora.disponible-sobreturno-normal.selected {
    background: var(--warning);
    border-color: #d97706;
}

.disponibilidad-hora.disponible-sobreturno-extra {
    border-color: var(--danger);
    background: var(--danger-light);
}

.disponibilidad-hora.disponible-sobreturno-extra:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.disponibilidad-hora.disponible-sobreturno-extra.selected {
    background: var(--danger);
    border-color: #dc2626;
}

.disponibilidad-hora .hora {
    font-weight: 600;
    font-size: .9rem;
}

.disponibilidad-hora .estado {
    font-size: .8rem;
    opacity: .8;
}

.disponibilidad-hora.selected .estado {
    opacity: 1;
}

.disponibilidad-vacio {
    text-align: center;
    padding: 20px;
    color: var(--gray-400);
    font-style: italic;
}


/* ── NAV HAMBURGUESA MOBILE ─────────────────── */

.nav-desktop {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-hamburguesa {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    margin-left: auto;
}

.nav-hamburguesa span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}

.nav-hamburguesa.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburguesa.active span:nth-child(2) { opacity: 0; }
.nav-hamburguesa.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 149;
}

.nav-mobile-overlay.active { display: block; }

.nav-mobile-menu {
    display: none;
    position: fixed;
    top: auto;
    right: 12px;
    min-width: 220px;
    background: #306785;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    padding: 6px;
    border: 1px solid rgba(255,255,255,.15);
}

.nav-mobile-menu.active { display: block; }

.nav-mobile-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #fff;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.nav-mobile-item:hover { background: rgba(255,255,255,.18); }

.nav-mobile-separador {
    height: 1px;
    background: rgba(255,255,255,.2);
    margin: 4px 6px;
}

.nav-mobile-item-cambiar-pass {
    color: rgba(255,255,255,.75);
    font-weight: 500;
}

@media (max-width: 768px) {
    .nav-desktop { display: none; }
    .nav-hamburguesa { display: flex; }
    .nav-bar { justify-content: flex-end; }
}

/* ── CALENDARIO SEMANAL ─────────────────────── */

.csem-nav-btn {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.csem-nav-btn:hover {
    background: rgba(255,255,255,.32);
}

.csem-grid {
    display: flex;
    flex-direction: column;
    overflow: auto;
    height: calc(90vh - 130px);
}

.csem-header-row {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 2px solid var(--gray-200);
}

.csem-dia-header {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border-left: 1px solid var(--gray-200);
}

.csem-dia-header:first-child {
    border-left: none;
}

.csem-dia-header.csem-hoy {
    background: var(--primary-light);
}

.csem-dia-nombre {
    font-weight: 700;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--gray-400);
}

.csem-dia-header.csem-hoy .csem-dia-nombre {
    color: var(--primary);
}

.csem-dia-num {
    font-size: .92rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-top: 2px;
}

.csem-dia-header.csem-hoy .csem-dia-num {
    color: var(--primary);
}

.csem-turno.csem-libre {
    background: #f0fdf4;
    border-left-color: #86efac;
    opacity: .8;
}

.csem-turno.csem-libre:hover {
    opacity: 1;
    background: #dcfce7;
    filter: none;
}

.csem-slot-libre-label {
    color: #16a34a;
    font-weight: 500;
    font-style: italic;
}

.csem-dia-total {
    font-size: .72rem;
    font-weight: 400;
    color: var(--gray-400);
}

.csem-body {
    display: flex;
    flex: 1;
}

.csem-dia-col {
    flex: 1;
    min-width: 0;
    border-left: 1px solid var(--gray-200);
}

.csem-dia-col:first-child {
    border-left: none;
}

.csem-dia-col.csem-hoy-col {
    background: #f5f9ff;
}

.csem-vacio {
    padding: 20px;
    text-align: center;
    color: var(--gray-400);
    font-size: .85rem;
}

.csem-turno {
    border-bottom: 1px solid var(--gray-100);
    box-sizing: border-box;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: filter .15s;
}

.csem-turno:hover {
    filter: brightness(.95);
}

.csem-turno.csem-reservado {
    background: #dbeafe;
    border-left-color: #3b82f6;
}

.csem-turno.csem-espera {
    background: var(--warning-light);
    border-left-color: var(--warning);
}

.csem-turno.csem-atendiendo {
    background: var(--success-light);
    border-left-color: var(--success);
}

.csem-turno.csem-atendido {
    background: var(--gray-100);
    border-left-color: var(--gray-400);
    opacity: .7;
}

.csem-turno-linea {
    font-size: .82rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    color: var(--gray-800);
}

.csem-turno-hora {
    font-weight: 700;
    color: var(--gray-600);
}

.csem-turno-nombre {
    font-weight: 600;
    color: var(--gray-800);
}

.csem-turno-tipo {
    font-weight: 400;
    color: var(--gray-600);
}

@media (max-width: 768px) {
    .csem-turno-linea { font-size: .75rem; }
    .csem-turno-tipo  { display: none; }
}