/* ==========================================================================
   SISTEMA DE GESTION Y ASIGNACION DE HORARIOS DOCENTES
   Hoja de estilos principal
   ========================================================================== */

:root {
    --azul-900: #0b2545;
    --azul-800: #10315a;
    --azul-700: #134074;
    --azul-600: #1a5599;
    --azul-500: #2670c4;
    --azul-400: #4f8fd6;
    --azul-100: #e7f0fb;
    --azul-50: #f4f8fd;
    --gris-900: #1f2937;
    --gris-600: #5b6572;
    --gris-300: #d7dce3;
    --gris-100: #f2f4f7;
    --blanco: #ffffff;
    --verde: #1f9d55;
    --rojo: #d64545;
    --amarillo: #e2a83a;
    --radio: 10px;
    --sombra: 0 2px 10px rgba(11, 37, 69, 0.08);
    --sombra-lg: 0 10px 30px rgba(11, 37, 69, 0.16);
    --fuente: 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--fuente);
    background: var(--gris-100);
    color: var(--gris-900);
    font-size: 14px;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

/* =========================== LOGIN =========================== */
.login-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--azul-900), var(--azul-600));
    padding: 20px;
}

.login-card {
    background: var(--blanco);
    width: 100%;
    max-width: 400px;
    border-radius: var(--radio);
    box-shadow: var(--sombra-lg);
    padding: 40px 32px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-card .logo .icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--azul-100);
    color: var(--azul-700);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto 12px;
}

.login-card h1 { font-size: 18px; text-align: center; color: var(--azul-900); margin: 0 0 4px; }
.login-card p.subtitle { text-align: center; color: var(--gris-600); margin: 0 0 24px; font-size: 13px; }

.login-switch {
    text-align: center; margin-top: 18px; font-size: 13px; color: var(--gris-600);
}
.login-switch a { color: var(--azul-600); font-weight: 600; }

/* =========================== FORMULARIOS =========================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--gris-900);
}
.form-control, select.form-control, textarea.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gris-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--fuente);
    background: var(--blanco);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--azul-500);
    box-shadow: 0 0 0 3px rgba(38, 112, 196, .15);
}
.input-icon-wrap { position: relative; }
.input-icon-wrap i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gris-600);
}
.input-icon-wrap .form-control { padding-left: 36px; }
.form-hint { font-size: 12px; color: var(--gris-600); margin-top: 4px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

/* =========================== BOTONES =========================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .05s ease, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--azul-600); color: #fff; }
.btn-primary:hover { background: var(--azul-700); }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1px solid var(--gris-300); color: var(--gris-900); }
.btn-outline:hover { border-color: var(--azul-500); color: var(--azul-600); }
.btn-danger { background: #fdeeee; color: var(--rojo); }
.btn-danger:hover { background: var(--rojo); color: #fff; }
.btn-success { background: #eafaf0; color: var(--verde); }
.btn-success:hover { background: var(--verde); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; border-radius: 8px; }

/* =========================== LAYOUT =========================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--azul-900), var(--azul-800));
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 40;
    transition: transform .2s ease;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar .brand .icon {
    width: 38px; height: 38px; border-radius: 8px;
    background: rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.sidebar .brand strong { font-size: 14px; line-height: 1.3; display: block; }
.sidebar .brand span { font-size: 11px; opacity: .7; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar .nav-section-title {
    padding: 14px 18px 6px; font-size: 11px; text-transform: uppercase;
    letter-spacing: .06em; opacity: .55;
}
.sidebar a.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 18px; font-size: 13.5px; color: rgba(255,255,255,.85);
    border-left: 3px solid transparent;
}
.sidebar a.nav-link i { width: 18px; text-align: center; }
.sidebar a.nav-link:hover { background: rgba(255,255,255,.06); }
.sidebar a.nav-link.active {
    background: rgba(255,255,255,.1);
    border-left-color: var(--azul-400);
    color: #fff; font-weight: 600;
}
.sidebar .logout-box { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); }

.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(11,37,69,.5);
    z-index: 35; display: none;
}
.sidebar-overlay.show { display: block; }
@media (min-width: 901px) { .sidebar-overlay { display: none !important; } }

.main-content { margin-left: 250px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    height: 64px; background: #fff; box-shadow: var(--sombra);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 17px; font-weight: 700; color: var(--azul-900); }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .user-chip .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--azul-100);
    color: var(--azul-700); display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.menu-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--azul-900); cursor: pointer; }

.content-area { padding: 24px; flex: 1; }

/* =========================== CARDS =========================== */
.card {
    background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.card-header h2 { font-size: 16px; margin: 0; color: var(--azul-900); }

.sede-block { margin-bottom: 28px; }
.sede-block .sede-title {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.sede-block .sede-title .badge-count {
    background: var(--azul-100); color: var(--azul-700); font-size: 12px; padding: 2px 10px; border-radius: 20px;
}
.sede-block h3 { font-size: 15px; color: var(--azul-900); margin: 0; text-transform: uppercase; letter-spacing: .03em; }

.cursos-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px;
}
.curso-card {
    background: #fff; border-radius: var(--radio); box-shadow: var(--sombra);
    padding: 18px; cursor: pointer; border: 1px solid transparent;
    transition: box-shadow .15s, transform .1s, border-color .15s;
}
.curso-card:hover { box-shadow: var(--sombra-lg); transform: translateY(-2px); border-color: var(--azul-400); }
.curso-card .curso-icon {
    width: 42px; height: 42px; border-radius: 10px; background: var(--azul-100); color: var(--azul-700);
    display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 12px;
}
.curso-card h4 { margin: 0 0 4px; font-size: 15px; color: var(--gris-900); }
.curso-card p { margin: 0; font-size: 12.5px; color: var(--gris-600); }

/* =========================== TABLAS =========================== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
    background: var(--azul-50); color: var(--azul-900); text-align: left;
    padding: 10px 12px; font-weight: 700; border-bottom: 2px solid var(--gris-300); white-space: nowrap;
}
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--gris-100); vertical-align: middle; }
table.data-table tr:hover td { background: var(--azul-50); }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; display: inline-block; }
.badge-activo { background: #eafaf0; color: var(--verde); }
.badge-inactivo { background: #fdeeee; color: var(--rojo); }
.badge-neutro { background: var(--azul-100); color: var(--azul-700); }

/* =========================== DROPDOWN DE ACCIONES (tres puntitos) =========================== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    display: none;
    position: fixed; /* se posiciona por JS (app.js) para escapar del overflow de la tabla */
    left: 0;
    top: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--sombra-lg);
    min-width: 210px;
    z-index: 300;
    padding: 6px;
    text-align: left;
    border: 1px solid var(--gris-100);
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 10px; border: none; background: none;
    border-radius: 6px; font-size: 13px; color: var(--gris-900); cursor: pointer; text-align: left;
    font-family: var(--fuente);
}
.dropdown-menu button i { width: 16px; text-align: center; color: var(--gris-600); }
.dropdown-menu button:hover { background: var(--azul-50); }
.dropdown-menu button:disabled { opacity: .5; cursor: not-allowed; }
.dropdown-menu button:disabled:hover { background: none; }
.dropdown-menu button.text-danger { color: var(--rojo); }
.dropdown-menu button.text-danger i { color: var(--rojo); }
.dropdown-menu button.text-danger:hover { background: #fdeeee; }
.dropdown-menu .dropdown-divider { height: 1px; background: var(--gris-100); margin: 6px 4px; }

.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--azul-100); }

/* =========================== TABLA HORARIO =========================== */
/* La columna de horas queda FIJA (sticky) mientras las columnas de los dias se
   desplazan a izquierda/derecha dentro de .horario-wrap. Para que los bordes no
   "se despeguen" al hacer scroll se usa border-collapse: separate. */
.horario-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radio); }
table.horario-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
table.horario-table th {
    background: var(--azul-700); color: #fff; padding: 10px; font-size: 12.5px; text-align: center;
    border-right: 1px solid rgba(255,255,255,.18);
}
table.horario-table td {
    border-right: 1px solid var(--gris-300);
    border-bottom: 1px solid var(--gris-300);
    height: 64px;
    width: 13%;
    text-align: center;
    vertical-align: middle;
    padding: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background .12s;
}
table.horario-table td:first-child { border-left: 1px solid var(--gris-300); }
table.horario-table th:first-child,
table.horario-table td.hora-col { position: sticky; left: 0; z-index: 2; }
table.horario-table th:first-child { z-index: 3; }
table.horario-table td.hora-col {
    background: var(--azul-50); font-weight: 700; color: var(--azul-800); cursor: default;
    width: 9%; min-width: 84px;
    box-shadow: 3px 0 6px -3px rgba(11, 37, 69, .28);
}
table.horario-table td.celda-libre:hover { background: var(--azul-100); }
table.horario-table td.celda-ocupada {
    background: #eaf3fc;
    border-left: 3px solid var(--azul-500);
}
table.horario-table td.celda-ocupada:hover { background: #d9ecfb; }
table.horario-table td.celda-ocupada.docente-seleccionado {
    background: #dffbe6; border-left: 3px solid var(--verde);
}
.celda-materia { font-weight: 700; color: var(--azul-800); display: block; }
.celda-docente { color: var(--gris-600); font-size: 11px; display: block; }
/* Aula en el horario del docente: mismo estilo que la materia, en la parte inferior de la celda */
.celda-aula { margin-top: 3px; }

/* =========================== DRAG AND DROP DE HORARIO =========================== */
table.horario-table td.celda-choque {
    background: #fdeeee !important;
    border-left: 4px solid var(--rojo) !important;
}

/* Indicador del color del docente seleccionado (junto al select de designacion) */
.docente-color-indicador {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--gris-600); margin-left: 10px;
}
.docente-color-indicador .swatch {
    display: inline-block; width: 22px; height: 22px; border-radius: 6px;
    border: 1px solid var(--gris-300);
}
.select-con-indicador { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.select-con-indicador select { flex: 1; min-width: 220px; }
table.horario-table td[draggable="true"] { cursor: grab; }
table.horario-table td.celda-arrastrando { opacity: .35; }
table.horario-table td.celda-drop-target {
    outline: 2px dashed var(--azul-500);
    outline-offset: -2px;
    background-color: var(--azul-100) !important;
}

/* =========================== MODAL =========================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(11,37,69,.55);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff; border-radius: var(--radio); width: 100%; max-width: 480px;
    box-shadow: var(--sombra-lg); max-height: 90vh; overflow-y: auto;
    animation: modalIn .15s ease;
}
.modal-box.modal-lg { max-width: 640px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: translateY(0);} }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--gris-100);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--azul-900); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gris-600); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--gris-100); display: flex; justify-content: flex-end; gap: 10px; }

.info-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--gris-300); font-size: 13.5px; }
.info-line strong { color: var(--azul-900); }

/* =========================== NOTIFICACIONES (TOAST) =========================== */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 200;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    min-width: 260px; max-width: 340px;
    background: #fff; border-radius: 8px; box-shadow: var(--sombra-lg);
    padding: 14px 16px; display: flex; align-items: flex-start; gap: 10px;
    border-left: 4px solid var(--azul-500);
    animation: toastIn .2s ease;
    font-size: 13.5px;
}
@keyframes toastIn { from { opacity:0; transform: translateX(30px);} to { opacity:1; transform: translateX(0);} }
.toast.success { border-left-color: var(--verde); }
.toast.error { border-left-color: var(--rojo); }
.toast.warning { border-left-color: var(--amarillo); }
.toast .toast-icon { font-size: 16px; margin-top: 1px; }
.toast.success .toast-icon { color: var(--verde); }
.toast.error .toast-icon { color: var(--rojo); }
.toast.warning .toast-icon { color: var(--amarillo); }

/* =========================== FILTROS / BUSQUEDA =========================== */
.filtros-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.chip-filter {
    padding: 7px 16px; border-radius: 20px; border: 1px solid var(--gris-300);
    background: #fff; font-size: 13px; cursor: pointer; font-weight: 600; color: var(--gris-600);
}
.chip-filter.active { background: var(--azul-600); border-color: var(--azul-600); color: #fff; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.search-box input { padding-left: 34px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gris-600); }

/* =========================== DOCENTE CARD (Horarios Docentes) =========================== */
.docente-card { margin-bottom: 24px; }
.docente-card .docente-header {
    display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.docente-card img.avatar-lg, .docente-card .avatar-lg-fallback, .docente-header .avatar-lg {
    width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--azul-100);
    display: flex; align-items: center; justify-content: center; color: var(--azul-700); font-weight: 700; font-size: 18px;
}
.docente-card .docente-info h4 { margin: 0; font-size: 15px; color: var(--azul-900); }
.docente-card .docente-info span { font-size: 12.5px; color: var(--gris-600); }
.btn-whatsapp {
    background: #e8faf0; color: #1f9d55; margin-left: auto;
}
.btn-whatsapp:hover { background: #1f9d55; color: #fff; }
/* Menu de descargas (imagen / PDF) a la derecha, justo antes del boton de WhatsApp */
.docente-card .docente-header .dropdown { margin-left: auto; }
.docente-card .docente-header .dropdown + .btn-whatsapp { margin-left: 0; }
.card-header.con-export > a.curso-card { flex: 1; min-width: 0; }
.card-header.con-export > .acciones-curso { display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0; margin-left: 12px; }
.card-header.con-export > .acciones-curso .dropdown { margin: 0; }
.btn-recargar-curso:disabled { opacity: .7; cursor: wait; }

/* =========================== LAYOUT DE DOS COLUMNAS (perfil, etc.) =========================== */
.two-col-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.two-col-layout > .card { flex: 1; }

/* =========================== HORARIOS GENERALES: 2 COLUMNAS POR TURNO =========================== */
/* A la izquierda los cursos del turno mañana y a la derecha los del turno tarde.
   Dentro de cada columna los horarios se acomodan en una grilla que va sumando
   columnas al alejar el zoom del navegador (aumenta el ancho CSS disponible). */
#lista-cursos-horario { display: block; }
.turnos-grid {
    display: grid;
    grid-template-columns: repeat(var(--n-turnos, 2), minmax(0, 1fr));
    gap: 22px;
    align-items: start;
}
/* Con 3 o 4 turnos en pantalla cada columna tiene un ancho minimo y se desplaza en horizontal */
.turnos-grid.con-scroll {
    grid-template-columns: repeat(var(--n-turnos, 3), minmax(560px, 1fr));
    overflow-x: auto; padding-bottom: 14px;
}
.turnos-grid.con-scroll .turno-titulo { position: static; }
.turno-col { min-width: 0; }
.turno-titulo {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px; margin-bottom: 14px;
    border-radius: var(--radio); box-shadow: var(--sombra);
    font-size: 13.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    position: sticky; top: 74px; z-index: 5;
}
.turno-titulo .badge-count {
    margin-left: auto; background: rgba(255,255,255,.75); border-radius: 20px; padding: 2px 11px; font-size: 12px;
}
.turno-manana .turno-titulo { background: #fff6e0; color: #8a5a00; border-left: 5px solid #f0b429; }
.turno-tarde  .turno-titulo { background: #eaeefc; color: #2a3a8f; border-left: 5px solid #5b6ee1; }
.turno-mediodia .turno-titulo { background: #fff0e6; color: #9a3412; border-left: 5px solid #f97316; }
.turno-noche .turno-titulo { background: #ece4fb; color: #4c2a8f; border-left: 5px solid #7c4dff; }
.turno-cursos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(500px, 100%), 1fr));
    gap: 18px;
    align-items: start;
}
.turno-cursos > .card { margin-bottom: 0; min-width: 0; }
.turno-cursos > .turno-vacio { grid-column: 1 / -1; }
.turnos-grid table.horario-table { min-width: 620px; }
#lista-cursos-horario > .empty-state,
#lista-cursos-horario > .card { margin-bottom: 0; }
@media (max-width: 1000px) {
    .turnos-grid, .turnos-grid.con-scroll { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
    .turnos-grid.con-scroll .turno-titulo { position: sticky; }
}

/* =========================== EMPTY STATE =========================== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gris-600); }
.empty-state i { font-size: 34px; margin-bottom: 10px; display: block; color: var(--gris-300); }

/* =========================== ALERTA CONFIRM =========================== */
.confirm-danger-icon {
    width: 56px; height: 56px; border-radius: 50%; background: #fdeeee; color: var(--rojo);
    display: flex; align-items: center; justify-content: center; font-size: 24px; margin: 0 auto 14px;
}

/* =========================== MESA DE TRABAJO DE APOYO =========================== */
/* Tablas con columnas de ancho fijo y colgroup: la mesa y la grilla comparten
   exactamente las mismas columnas y se desplazan juntas dentro de .horario-wrap */
table.horario-table.tabla-fija { table-layout: fixed; }
table.horario-table.tabla-fija col.col-hora { width: 92px; }
table.horario-table.tabla-fija td { overflow-wrap: anywhere; }
table.horario-table.mesa-table { margin-bottom: 12px; }
table.horario-table.mesa-table td { height: auto; min-height: 64px; vertical-align: top; cursor: default; }
table.horario-table.mesa-table td.mesa-label {
    vertical-align: middle; text-align: center; background: #fff6e0; color: #8a5a00;
    font-size: 11.5px; line-height: 1.25;
}
.mesa-label i { display: block; font-size: 18px; margin-bottom: 3px; }
.mesa-label span { display: block; font-weight: 800; }
.mesa-label small { display: block; font-weight: 600; opacity: .8; margin-top: 2px; }
table.horario-table.mesa-table td.mesa-celda {
    padding: 6px; border-top: 1px dashed #d8b45a;
    background: repeating-linear-gradient(45deg, #fffdf7, #fffdf7 8px, #fff7e3 8px, #fff7e3 16px);
    min-height: 74px;
}
table.horario-table.mesa-table td.mesa-celda .mesa-vacio { display: block; min-height: 50px; }
table.horario-table.mesa-table.mesa-activa td.mesa-celda { outline: 2px dashed #e0a526; outline-offset: -3px; }
.mesa-item {
    position: relative; display: block; text-align: left; margin-bottom: 6px;
    padding: 6px 22px 6px 8px; border: 1px solid var(--gris-300); border-radius: 8px;
    cursor: grab; user-select: none; -webkit-user-select: none; box-shadow: var(--sombra);
}
.mesa-item:last-child { margin-bottom: 0; }
.mesa-item:active { cursor: grabbing; }
.mesa-item.celda-arrastrando { opacity: .35; }
.mesa-item.seleccionado { outline: 3px solid var(--azul-600); outline-offset: 1px; }
.mesa-item-x {
    position: absolute; top: 2px; right: 3px; width: 20px; height: 20px; border: 0; border-radius: 50%;
    background: rgba(11, 37, 69, .12); color: var(--azul-900); font-size: 14px; line-height: 1; cursor: pointer;
}
.mesa-item-x:hover { background: var(--rojo); color: #fff; }
.mesa-hint { margin: -6px 0 12px; line-height: 1.5; }
.mesa-hint kbd {
    display: inline-block; padding: 0 5px; border: 1px solid var(--gris-300); border-bottom-width: 2px;
    border-radius: 4px; background: #fff; font-size: 11px; font-family: inherit;
}
#btn-deshacer .badge-count {
    background: var(--azul-600); color: #fff; border-radius: 20px; padding: 0 7px; font-size: 11px; font-weight: 700; margin-left: 2px;
}
#btn-deshacer:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 560px) {
    table.horario-table.tabla-fija col.col-hora { width: 72px; }
}

/* =========================== EXPORTAR HORARIO (PDF / IMAGEN) =========================== */
/* Copia del horario que se fotografia para el PDF / imagen (fuera de pantalla, tamano fijo) */
.export-horario {
    position: absolute; left: -10000px; top: 0; width: 1100px; box-sizing: border-box;
    padding: 30px; background: #fff; color: #0b2545;
}
.export-horario .export-titulo { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #2670c4; }
.export-horario .export-docente { font-size: 28px; font-weight: 800; margin: 4px 0 2px; }
.export-horario .export-detalle { font-size: 13px; color: #5b6b7d; margin-bottom: 18px; }
.export-horario .export-pie { margin-top: 14px; font-size: 11px; color: #8795a6; text-align: right; }
.export-horario table.horario-table { min-width: 0; width: 100%; table-layout: fixed; }
.export-horario table.horario-table th:first-child,
.export-horario table.horario-table td.hora-col { position: static; box-shadow: none; width: 110px; min-width: 0; }
.export-horario table.horario-table td { height: 72px; font-size: 13px; cursor: default; padding: 6px; overflow-wrap: anywhere; }
.export-horario table.horario-table th { font-size: 14px; padding: 12px 8px; }
.export-horario .celda-materia { font-size: 13.5px; }
.export-horario .celda-docente { font-size: 11.5px; }
.export-horario .celda-libre i { display: none; }
.export-horario table.horario-table td.celda-ocupada { cursor: default; }

/* Varios horarios en una sola imagen/PDF (Horarios Generales): columna mañana | columna tarde */
.export-horario.export-lote { width: 1500px; }
.export-lote .export-turnos-cab { display: grid; gap: 24px; margin-bottom: 18px; }
.export-lote .export-turnos-cab.una-col { grid-template-columns: 1fr; }
.export-lote .export-turno-titulo {
    padding: 12px 18px; border-radius: 10px; font-size: 17px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .05em;
}
.export-lote .export-turno-titulo.manana { background: #fff6e0; color: #8a5a00; border-left: 6px solid #f0b429; }
.export-lote .export-turno-titulo.tarde  { background: #eaeefc; color: #2a3a8f; border-left: 6px solid #5b6ee1; }
.export-lote .export-turno-titulo.mediodia { background: #fff0e6; color: #9a3412; border-left: 6px solid #f97316; }
.export-lote .export-turno-titulo.noche { background: #ece4fb; color: #4c2a8f; border-left: 6px solid #7c4dff; }
.export-lote .export-fila { display: grid; gap: 24px; margin-bottom: 22px; align-items: start; }
.export-lote .export-curso { min-width: 0; border: 1px solid #d5deea; border-radius: 10px; padding: 14px; }
.export-lote .export-curso h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 17px; color: #0b2545; }
.export-lote .export-curso .form-hint { margin: 0 0 10px; font-size: 12px; }
.export-lote table.horario-table { min-width: 0; width: 100%; table-layout: fixed; }
.export-lote table.horario-table td { height: 54px; font-size: 11.5px; padding: 3px; }
.export-lote table.horario-table th { font-size: 12.5px; padding: 8px 4px; }
.export-lote table.horario-table th:first-child,
.export-lote table.horario-table td.hora-col { width: 86px; font-size: 11px; }
.export-lote .celda-materia { font-size: 11.5px; }
.export-lote .celda-docente { font-size: 10.5px; }

/* Texto informativo dentro de un menu desplegable */
.dropdown-info {
    padding: 10px 14px; font-size: 12px; line-height: 1.45; color: var(--gris-600);
    border-bottom: 1px solid var(--gris-100); max-width: 280px; white-space: normal;
}
.dropdown-info strong { color: var(--azul-900); }

/* =========================== SELECTOR DE TURNOS (Horarios Generales) =========================== */
.filtro-etiqueta { font-size: 12.5px; font-weight: 700; color: var(--gris-600); display: inline-flex; align-items: center; gap: 6px; }
.turno-check { position: relative; cursor: pointer; }
.turno-check input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.turno-check span {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 20px;
    border: 1px solid var(--gris-300); background: #fff; color: var(--gris-600);
    font-size: 13px; font-weight: 600; transition: background .12s, border-color .12s, color .12s;
}
.turno-check span::before {
    content: '\f0c8'; font-family: 'Font Awesome 6 Free'; font-weight: 400; font-size: 14px; margin-right: 2px;
}
.turno-check input:checked + span::before { content: '\f14a'; font-weight: 900; }
.turno-check em { font-style: normal; font-weight: 700; opacity: .75; }
.turno-check.sin-cursos span { opacity: .55; }
.turno-check-manana input:checked + span   { background: #fff3d6; border-color: #f0b429; color: #8a5a00; }
.turno-check-mediodia input:checked + span { background: #ffe3d1; border-color: #f97316; color: #9a3412; }
.turno-check-tarde input:checked + span    { background: #e6ebff; border-color: #5b6ee1; color: #2a3a8f; }
.turno-check-noche input:checked + span    { background: #ece4fb; border-color: #7c4dff; color: #4c2a8f; }
.turno-check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(38, 112, 196, .25); }

/* Encabezado de area dentro de la columna de un turno */
.area-titulo {
    grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
    margin: 4px 0 -4px; padding: 5px 2px; border-bottom: 2px solid #b2dfdb;
    font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #00695c;
}
.area-titulo span { background: #e0f2f1; border-radius: 20px; padding: 1px 9px; font-size: 11.5px; }

/* Aviso de aula compartida (informativo, no bloquea) y de choque de materias */
.aula-info, .aviso-choque {
    margin-top: 8px; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
    background: #fff8e1; border: 1px solid #ffe082; color: #7a5b00;
}
.aviso-choque { background: #fdeeee; border-color: #f5b5b5; color: #a12a2a; margin-bottom: 12px; font-weight: 600; }

/* Choque de materias del docente (v18) */
/* "Marca de agua" en el horario del curso: el docente seleccionado ya tiene clase en ese horario en otro curso */
table.horario-table td.celda-choque-docente {
    background: repeating-linear-gradient(135deg, #fbf1f1, #fbf1f1 8px, #f6e3e3 8px, #f6e3e3 16px) !important;
    cursor: pointer; position: relative;
}
table.horario-table td.celda-choque-docente:hover { background: #f3d6d6 !important; }
.marca-choque {
    display: block; transform: rotate(-7deg); line-height: 1.25;
    font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
    color: rgba(168, 48, 48, .5);
}
.marca-choque small {
    display: block; margin-top: 2px; font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none;
    color: rgba(110, 60, 60, .55); overflow-wrap: anywhere;
}
/* Casilla del horario del docente con 2 o mas materias */
table.horario-table td.celda-multiple { padding: 4px; text-align: left; vertical-align: top; height: auto; }
.choque-etiqueta {
    display: block; margin: 0 0 4px; padding: 2px 6px; border-radius: 6px;
    background: #fdeeee; color: #a12a2a; font-size: 10.5px; font-weight: 800; text-align: center;
}
.celda-multiple .celda-item {
    margin-bottom: 4px; padding: 4px 6px; border-radius: 6px; text-align: left;
    background: rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .05);
}
.celda-multiple .celda-item:last-child { margin-bottom: 0; }

/* =========================== COLOR DE SEDE =========================== */
.sede-color-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--gris-600); }
.sede-color-chip i { display: inline-block; width: 8px; height: 22px; border-radius: 3px; }
.sede-color-selector { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sede-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sede-swatch {
    width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
    box-shadow: 0 0 0 1px var(--gris-300); transition: transform .12s ease;
}
.sede-swatch:hover { transform: scale(1.12); }
.sede-swatch.activo { box-shadow: 0 0 0 2px var(--azul-900); }

/* Leyenda de sedes del horario del docente (la franja izquierda de cada materia = color de su sede) */
.sede-leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; font-size: 12.5px; color: var(--gris-600); }
.sede-leyenda-titulo { font-weight: 700; color: var(--azul-900); }
.sede-leyenda-item { display: inline-flex; align-items: center; gap: 7px; }
.sede-leyenda-item i { display: inline-block; width: 6px; height: 18px; border-radius: 2px; }
.export-horario .export-leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: -6px 0 14px; font-size: 13px; color: #5b6b7d; }
.export-horario .export-leyenda-titulo { font-weight: 700; color: #0b2545; }
.export-horario .export-leyenda-item { display: inline-flex; align-items: center; gap: 8px; }
.export-horario .export-leyenda-item i { display: inline-block; width: 7px; height: 20px; border-radius: 2px; }

/* =========================== TURNOS: etiquetas y selector =========================== */
.badge-turno-manana { background: #fff3d6; color: #8a5a00; }
.badge-turno-tarde  { background: #e6ebff; color: #2a3a8f; }
.badge-turno-mediodia { background: #ffe3d1; color: #9a3412; }
.badge-turno-noche    { background: #ece4fb; color: #4c2a8f; }
.badge-area { background: #e0f2f1; color: #00695c; }
.badge-aviso        { background: #fff3d6; color: #8a5a00; }

.turno-options { display: flex; gap: 10px; flex-wrap: wrap; }
.form-group .turno-option {
    display: block; position: relative; margin: 0; flex: 1; min-width: 140px;
    cursor: pointer; font-weight: 600;
}
.turno-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.turno-option span {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 14px; border: 2px solid var(--gris-300); border-radius: 10px;
    background: #fff; color: var(--gris-600); transition: border-color .15s, background .15s, color .15s;
}
.turno-option input:checked + span { border-color: var(--azul-600); background: var(--azul-100); color: var(--azul-800); }
.turno-option input:focus-visible + span { box-shadow: 0 0 0 3px rgba(38, 112, 196, .25); }

/* =========================== HORARIOS NO HABILES DEL DOCENTE =========================== */
.dias-check { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-group .dia-check { display: inline-block; position: relative; margin: 0; cursor: pointer; }
.dia-check input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.dia-check span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 48px; height: 40px; padding: 0 12px; border: 1px solid var(--gris-300);
    border-radius: 20px; background: #fff; font-weight: 700; font-size: 13px; color: var(--gris-600);
}
.dia-check input:checked + span { background: var(--azul-600); border-color: var(--azul-600); color: #fff; }
.dia-check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(38, 112, 196, .25); }

.nh-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.nh-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 12px; background: #fff; border: 1px solid var(--gris-300);
    border-left: 4px solid var(--rojo); border-radius: 10px;
}
.nh-item-info { min-width: 0; }
.nh-item-info .badge { margin-left: 6px; }
.nh-vacio {
    padding: 14px; border: 1px dashed var(--gris-300); border-radius: 10px;
    color: var(--gris-600); background: var(--azul-50); font-size: 13px;
}
.nh-form { border-top: 1px solid var(--gris-100); padding-top: 16px; }
.nh-subtitulo { margin: 0 0 12px; font-size: 14px; color: var(--azul-900); }

/* =========================== MENU LATERAL CONTRAIBLE (escritorio) =========================== */
/* Expandido: 250 px con iconos y nombres. Contraido (html.sidebar-colapsado): 72 px solo con iconos;
   al pasar el mouse por un icono aparece un globo flotante con su nombre (ver app.js). El estado se
   recuerda en localStorage. En movil/tablet este bloque no aplica: ahi el menu es un cajon. */
.sidebar-collapse-btn { display: none; }
.sidebar-tooltip {
    position: fixed; z-index: 600; pointer-events: none; white-space: nowrap;
    padding: 7px 12px; border-radius: 8px;
    background: var(--azul-900); color: #fff; font-size: 12.5px; font-weight: 600;
    box-shadow: 0 6px 18px rgba(11, 37, 69, .35);
    opacity: 0; transform: translate(-6px, -50%);
    transition: opacity .12s ease, transform .12s ease;
}
.sidebar-tooltip::before {
    content: ''; position: absolute; left: -5px; top: 50%; margin-top: -5px;
    border: 5px solid transparent; border-left: 0; border-right-color: var(--azul-900);
}
.sidebar-tooltip.visible { opacity: 1; transform: translate(0, -50%); }
.sidebar .nav-text { white-space: nowrap; }

@media (min-width: 901px) {
    .sidebar { transition: width .22s ease, transform .2s ease; }
    .main-content { transition: margin-left .22s ease; }
    .sidebar nav { overflow-x: hidden; }
    .sidebar .brand { overflow: hidden; white-space: nowrap; }

    /* Botones para contraer/expandir: hamburguesa de la barra superior + chevron en el borde del menu */
    .menu-toggle {
        display: flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; border-radius: 10px;
    }
    .menu-toggle:hover { background: var(--azul-50); }
    .sidebar-collapse-btn {
        display: flex; align-items: center; justify-content: center;
        position: absolute; top: 26px; right: -13px; z-index: 41;
        width: 26px; height: 26px; padding: 0; border-radius: 50%;
        border: 2px solid #fff; background: var(--azul-600); color: #fff;
        font-size: 11px; cursor: pointer; box-shadow: var(--sombra);
        transition: transform .22s ease, background .15s ease;
    }
    .sidebar-collapse-btn:hover { background: var(--azul-500); }
    .sidebar-collapse-btn:focus-visible { outline: 3px solid rgba(38, 112, 196, .35); outline-offset: 2px; }

    /* ---- Contraido ---- */
    html.sidebar-colapsado .sidebar { width: 72px; }
    html.sidebar-colapsado .main-content { margin-left: 72px; }
    html.sidebar-colapsado .sidebar-collapse-btn { transform: rotate(180deg); }
    html.sidebar-colapsado .sidebar .sidebar-logo { display: none; }

    html.sidebar-colapsado .sidebar .brand { justify-content: center; padding: 18px 0; }
    html.sidebar-colapsado .sidebar .brand > div:not(.icon) { display: none; }

    html.sidebar-colapsado .sidebar nav { padding: 8px 0; scrollbar-width: none; }
    html.sidebar-colapsado .sidebar nav::-webkit-scrollbar { display: none; }
    /* Los titulos de seccion pasan a ser una linea separadora */
    html.sidebar-colapsado .sidebar .nav-section-title {
        height: 0; padding: 0; margin: 10px 20px; overflow: hidden;
        font-size: 0; opacity: 1; border-top: 1px solid rgba(255, 255, 255, .16);
    }
    html.sidebar-colapsado .sidebar nav > .nav-section-title:first-child { display: none; }

    html.sidebar-colapsado .sidebar a.nav-link {
        justify-content: center; gap: 0;
        margin: 3px 12px; padding: 12px 0;
        border-left: 0; border-radius: 10px;
    }
    html.sidebar-colapsado .sidebar a.nav-link .nav-text { display: none; }
    html.sidebar-colapsado .sidebar a.nav-link i { width: auto; font-size: 17px; }
    html.sidebar-colapsado .sidebar a.nav-link:hover { background: rgba(255, 255, 255, .12); }
    html.sidebar-colapsado .sidebar a.nav-link.active {
        background: rgba(255, 255, 255, .18);
        box-shadow: inset 3px 0 0 var(--azul-400);
    }

    html.sidebar-colapsado .sidebar .logout-box { padding: 12px; }
    html.sidebar-colapsado .sidebar .logout-box .btn { padding: 11px 0; }
    html.sidebar-colapsado .sidebar .logout-box .nav-text { display: none; }
}

/* =========================== RESPONSIVE (administrador) =========================== */
.admin-bottomnav { display: none; }
@keyframes sheetIn { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

/* ---- Tablet y movil: menu lateral tipo cajon + barra de navegacion inferior ---- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 280px; max-width: 86vw; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--sombra-lg); }
    .main-content { margin-left: 0; }
    body.sidebar-abierto { overflow: hidden; }
    .menu-toggle { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; }
    .menu-toggle:active { background: var(--azul-100); }
    .topbar { height: 58px; padding: 0 12px; }
    .topbar .page-title { max-width: 56vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .turno-titulo { top: 66px; }
    .content-area { padding: 16px 14px calc(92px + env(safe-area-inset-bottom, 0px)); }

    .admin-bottomnav {
        display: flex; justify-content: space-around; align-items: stretch;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 34;
        background: #fff; border-top: 1px solid var(--gris-300);
        box-shadow: 0 -4px 16px rgba(11, 37, 69, .10);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    }
    .bn-item {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: 6px 2px; border: 0; background: none; border-radius: 12px;
        color: var(--gris-600); font-size: 10.5px; font-weight: 700; font-family: var(--fuente); cursor: pointer;
    }
    .bn-item i { font-size: 18px; }
    .bn-item.active { color: var(--azul-600); background: var(--azul-100); }
    .bn-item:active { background: var(--azul-100); }

    table.horario-table td { height: 54px; font-size: 11px; }
    .cursos-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .two-col-layout > .card { flex: 1 1 100%; min-width: 0 !important; }
}

/* ---- Movil: tablas como tarjetas, menus como "hoja inferior", tactil comodo ---- */
@media (max-width: 700px) {
    .card-header { flex-direction: column; align-items: stretch; }
    .card-header > .btn { width: 100%; justify-content: center; }
    .docente-card { position: relative; }
    .docente-card .docente-header { flex-direction: column; align-items: flex-start; }
    .docente-card .docente-header .docente-info { padding-right: 52px; }
    .docente-card .docente-header .dropdown { position: absolute; top: 14px; right: 14px; margin: 0; }
    .card-header.con-export { flex-direction: row; align-items: flex-start; }
    .btn-whatsapp { margin-left: 0; width: 100%; justify-content: center; }

    /* Tablas de datos -> tarjetas (las etiquetas las agrega app.js con data-label) */
    .table-responsive { overflow: visible; }
    table.data-table { display: block; width: 100%; min-width: 0; }
    table.data-table thead { display: none; }
    table.data-table tbody { display: block; }
    table.data-table tr {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px;
        position: relative; background: #fff; margin-bottom: 12px; padding: 12px 14px;
        border: 1px solid var(--gris-300); border-left: 4px solid var(--azul-500);
        border-radius: 12px; box-shadow: var(--sombra);
    }
    table.data-table tr:has(> td[colspan]) { display: block; padding: 0; border: 0; box-shadow: none; background: none; }
    table.data-table tr:hover td { background: none; }
    table.data-table td { display: block; border: 0; padding: 5px 0; min-width: 0; overflow-wrap: anywhere; }
    table.data-table td[colspan] { grid-column: 1 / -1; }
    table.data-table td::before {
        content: attr(data-label); display: block; margin-bottom: 2px;
        font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gris-600);
    }
    table.data-table td[data-label=""]::before,
    table.data-table td[colspan]::before,
    table.data-table td.td-principal::before,
    table.data-table td.td-acciones::before { display: none; }
    table.data-table td[data-label="#"] { display: none; }
    table.data-table td.td-principal { grid-column: 1 / -1; font-size: 15px; padding-right: 54px; }
    table.data-table td.td-foto { position: absolute; top: 12px; right: 12px; padding: 0; }
    table.data-table td.td-acciones {
        grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
        margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--gris-300);
    }
    table.data-table td .btn-icon,
    table.data-table td .btn-sm { margin: 0; }
    table.data-table td.td-acciones .btn-icon { width: 40px; height: 40px; }
    table.data-table td.td-acciones .btn-sm { min-height: 40px; padding: 8px 12px; }

    /* Menu de tres puntitos -> hoja inferior a todo el ancho */
    .dropdown.open::after { content: ''; position: fixed; inset: 0; background: rgba(11, 37, 69, .45); z-index: 299; }
    .dropdown.open .dropdown-menu {
        position: fixed; left: 0 !important; right: 0; top: auto !important; bottom: 0;
        width: 100%; min-width: 0; z-index: 300;
        border-radius: 18px 18px 0 0; border: 0;
        padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px));
        animation: sheetIn .18s ease;
    }
    .dropdown-menu button { padding: 14px 12px; font-size: 15px; gap: 14px; }
    .dropdown-menu button i { font-size: 16px; }

    /* Filtros */
    .filtros-bar { gap: 8px; }
    .chip-filter { padding: 8px 14px; }
    .search-box { flex: 1 1 100%; max-width: none; min-width: 0; }
}

/* ---- Movil angosto: modales como hoja inferior, formularios comodos ---- */
@media (max-width: 560px) {
    .card { padding: 14px; }
    .login-card { padding: 28px 20px; border-radius: 8px; }
    .login-wrapper { padding: 14px; }
    .topbar .user-chip > div:last-child { display: none; }
    .topbar .page-title { font-size: 14.5px; }
    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { min-width: 0; }
    .two-col-layout { display: block; }
    .btn { min-height: 42px; }
    table.horario-table { min-width: 640px; }
    table.horario-table td { height: 48px; font-size: 10.5px; padding: 2px; }
    table.horario-table td.hora-col { min-width: 70px; width: 70px; font-size: 11px; }

    #toast-container { left: 10px; right: 10px; top: 10px; }
    .toast { max-width: none; width: 100%; }

    /* Modales: hoja que sube desde abajo, cuerpo con scroll propio y botones a todo el ancho */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-box, .modal-box.modal-lg {
        max-width: 100% !important; width: 100%;
        border-radius: 18px 18px 0 0;
        max-height: 92vh; max-height: 92dvh;
        display: flex; flex-direction: column; overflow: hidden;
        animation: sheetIn .2s ease;
    }
    .modal-box > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
    .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; }
    .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .modal-header { flex-shrink: 0; }
    .modal-footer { flex-shrink: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
    .modal-footer .btn { flex: 1; }
    .modal-close { width: 40px; height: 40px; font-size: 22px; }

    /* Evita el zoom automatico de iOS al enfocar campos (min. 16px) */
    .form-control, select.form-control, textarea.form-control,
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="time"], input[type="file"] {
        font-size: 16px;
    }
    .form-control { min-height: 44px; }

    .cursos-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .curso-card { padding: 14px; }
    .sede-block .sede-title { flex-wrap: wrap; }
    .select-con-indicador select { min-width: 0; flex: 1 1 100%; }
    .docente-color-indicador { margin-left: 0; }
    .turno-options { flex-direction: column; }
    .nh-item { align-items: flex-start; }
}

@media (max-width: 380px) {
    .cursos-grid { grid-template-columns: 1fr; }
    .topbar .user-chip .avatar { width: 30px; height: 30px; font-size: 13px; }
    .sidebar .brand strong { font-size: 13px; }
    .bn-item span { font-size: 9.5px; }
}
