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



:root {
    /* Colores del escudo CSCP */
    --primary:       #1c4281;   /* azul marino del escudo */
    --primary-light: #a3cef1;   /* azul medio */
    --accent:        #6096ba;   /* naranja del escudo */
    --accent-light:  #1c4281;   /* naranja claro */
    --gold:          #6096ba;   /* dorado del sol */

    /* Fondo claro */
    --bg:            #E7ECEF;
    --surface:       #ffffff;
    --surface2:      #e8edf7;
    --border:        #6096BA;
    --border-light:  #A3CEF1;

    /* Texto */
    --text:          #1c4281;
    --text-body:     #1C4281;
    --muted:         #1c4281;

    --radius:        10px;
    --shadow-sm:     0 2px 8px rgba(26,58,110,.08);
    --shadow-md:     0 6px 24px rgba(26,58,110,.12);
    --shadow-lg:     0 12px 40px rgba(26,58,110,.16);
}

html, body { height: 100%; }

body {
    background: var(--bg);
    font-family: 'bodoni mt bold','century schoolbook';
    color: var(--text-body);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 70% 40% at 100% 0%,   rgba(232,119,34,.07)  0%, transparent 60%),
        radial-gradient(ellipse 60% 35% at 0%   100%, rgba(26,58,110,.06)   0%, transparent 60%);
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 68px;
    background: var(--primary);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(26,58,110,.25);
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Logo del colegio */
.school-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

/* Divisor vertical */
.logo-divider {
    width: 1px;
    height: 32px;
    background: rgba(255,255,255,.25);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.logo-sge {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold);
}
.logo-school {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 340px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.rol-badge {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--primary);
    background: var(--gold);
    padding: 4px 12px;
    border-radius: 20px;
}
.user-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: default;
}
.avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 13px; font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.user-name {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.9);
}

.logout-link {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--radius);
    transition: all .2s;
}
.logout-link:hover {
    color: #fff;
    border-color: rgba(255,255,255,.6);
    background: rgba(255,255,255,.1);
}

/* ── HERO ───────────────────────────────────────────────────── */
.hero {
    padding: 48px 32px 36px;
    max-width: 980px;
    margin: 0 auto;
    animation: fadeUp .5s ease both;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.greeting-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(232,119,34,.1);
    border: 1px solid rgba(232,119,34,.25);
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
}
.greeting-chip::before {
    content: '☀';
    font-size: 13px;
}

.hero h1 {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--primary);
    margin-bottom: 10px;
}
.hero h1 em {
    font-style: normal;
    color: var(--accent);
}
.hero-sub {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.6;
    max-width: 500px;
}

/* ── STATS ──────────────────────────────────────────────────── */
.stats-row {
    max-width: 980px;
    margin: 0 auto 36px;
    padding: 0 32px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    animation: fadeUp .5s .1s ease both;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 18px 22px;
    flex: 1;
    min-width: 140px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.stat-val {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    margin-bottom: 5px;
    color: var(--primary);
}
.stat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ── SECCIÓN LABEL ──────────────────────────────────────────── */
.section-label {
    max-width: 980px;
    margin: 0 auto 16px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    animation: fadeUp .5s .15s ease both;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* ── MÓDULOS ────────────────────────────────────────────────── */
.modulos-grid {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 32px 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 16px;
}

.modulo-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 26px;
    text-decoration: none;
    color: var(--text-body);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: border-color .25s, transform .25s, box-shadow .25s;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: fadeUp .5s ease both;
}
.modulo-card:nth-child(1) { animation-delay: .2s; }
.modulo-card:nth-child(2) { animation-delay: .27s; }
.modulo-card:nth-child(3) { animation-delay: .34s; }
.modulo-card:nth-child(4) { animation-delay: .41s; }
.modulo-card:nth-child(5) { animation-delay: .48s; }
.modulo-card:nth-child(6) { animation-delay: .55s; }

/* Franja de color arriba */
.modulo-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 14px 14px 0 0;
    transition: height .25s;
}
.modulo-card.blue::after   { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.modulo-card.green::after  { background: linear-gradient(90deg, #2e9e6e, #4dcb96); }
.modulo-card.purple::after { background: linear-gradient(90deg, #6b2fa0, #a062d2); }
.modulo-card.orange::after { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.modulo-card.red::after  { background: linear-gradient(90deg, #c0392b, #e57373); }
.modulo-card.gray::after { background: linear-gradient(90deg, #6096BA, #aab6cf); }


.modulo-card:not(.disabled):hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.modulo-card.blue:not(.disabled):hover   { border-color: rgba(26,58,110,.35); }
.modulo-card.green:not(.disabled):hover  { border-color: rgba(46,158,110,.35); }
.modulo-card.purple:not(.disabled):hover { border-color: rgba(107,47,160,.35); }
.modulo-card.orange:not(.disabled):hover { border-color: rgba(232,119,34,.4); }
.modulo-card.red:not(.disabled):hover  { border-color: rgba(192,57,43,.35); }
.modulo-card.gray:not(.disabled):hover { border-color: rgba(122,138,170,.35); }

.modulo-card.disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.card-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.blue   .card-icon { background: rgba(26,58,110,.09);  }
.green  .card-icon { background: rgba(46,158,110,.10); }
.purple .card-icon { background: rgba(107,47,160,.10); }
.orange .card-icon { background: rgba(232,119,34,.10); }
.red  .card-icon  { background: rgba(192,57,43,.10); }
.gray .card-icon  { background: rgba(122,138,170,.12); }

.card-tag {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--surface2);
    color: var(--muted);
}

.card-body h2 {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -.01em;
    margin-bottom: 7px;
}
.card-body p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.65;
}

.card-arrow {
    font-size: 18px;
    color: var(--border);
    transition: color .2s, transform .2s;
    align-self: flex-end;
}
.modulo-card:not(.disabled):hover .card-arrow {
    color: var(--accent);
    transform: translateX(5px);
}

/* ── FOOTER ─────────────────────────────────────────────────── */
.page-footer {
    text-align: center;
    padding: 22px 24px;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    border-top: 1px solid var(--border-light);
    letter-spacing: .04em;
}
.page-footer strong {
    color: var(--primary);
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    .topbar          { padding: 0 14px; height: 60px; }
    .logo-school     { font-size: 11px; max-width: 200px; }
    .logo-sge        { font-size: 10px; }
    .hero, .stats-row, .section-label, .modulos-grid { padding-left: 14px; padding-right: 14px; }
    .user-name, .rol-badge { display: none; }
    .modulos-grid    { grid-template-columns: 1fr; }
    .logo-divider    { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   LOGIN — estilos específicos de la pantalla de inicio de sesión
   ═══════════════════════════════════════════════════════════════ */

/* Contenedor centrado de página completa */
.wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 0;
}

/* ── Cabecera institucional ───────────────────────────────────── */
.header {
    width: 100%;
    max-width: 440px;
    text-align: center;
    margin-bottom: 28px;
    animation: fadeUp .45s ease both;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 10px;
}

.logo-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(26,58,110,.2));
}

.header h1 {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.25;
    letter-spacing: -.01em;
    text-align: left;
}

.header-top > div > p {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    margin-top: 2px;
    letter-spacing: .02em;
}

/* Subtítulo "Sistema de Gestión Estudiantil" */
.header > p {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 6px;
}

/* ── Tarjeta del formulario ───────────────────────────────────── */
.card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
    animation: fadeUp .45s .08s ease both;
    position: relative;
    overflow: hidden;
}

/* Franja de color en el tope de la tarjeta */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* ── Alerta de error ──────────────────────────────────────────── */
.alert-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(220, 53, 69, .08);
    border: 1px solid rgba(220, 53, 69, .25);
    border-radius: var(--radius);
    color: #b91c1c;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 13px;
    font-weight: 600;
    padding: 12px 14px;
    margin-bottom: 20px;
}

/* ── Grupos de campo ──────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-group label {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
}

.form-group input {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    width: 100%;
}

.form-group input::placeholder {
    color: var(--muted);
    font-weight: 400;
}

.form-group input:focus {
    border-color: var(--primary-light);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(26,58,110,.1);
}

/* ── Botón principal ──────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    margin-top: 6px;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .04em;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 4px 14px rgba(26,58,110,.25);
}

.btn-primary:hover {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,58,110,.32);
}

.btn-primary:active {
    transform: translateY(0);
    opacity: 1;
}

/* ── Nota al pie ──────────────────────────────────────────────── */
.footer-note {
    width: 100%;
    max-width: 440px;
    text-align: center;
    margin-top: 22px;
    animation: fadeUp .45s .16s ease both;
}

.footer-note p {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .02em;
    line-height: 1.6;
}

/* ── Login responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
    .card             { padding: 28px 20px; border-radius: 12px; }
    .header h1        { font-size: 15px; }
    .logo-img         { width: 48px; height: 48px; }
    .header-top       { gap: 12px; }
}

/* Estilo para el desplegable de roles */
.rol-select {
    background-color: #2563cc; /* Mismo color azul base del badge */
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 28px 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    font-family: 'bodoni mt bold','century schoolbook';
    appearance: none; /* Remueve la flecha nativa horrible de Windows/Chrome */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: background-color 0.2s, border-color 0.2s;
}

.rol-select:hover {
    background-color: #1d4ed8; /* Variante más oscura al pasar el mouse */
    border-color: rgba(255, 255, 255, 0.3);
}

.rol-select option {
    background-color: #181c27; /* Fondo oscuro consistente con tu paleta */
    color: #e4e8f5;
    text-transform: uppercase;
    font-weight: normal;
}

/* --- CONTENEDOR PRINCIPAL DEL MODAL (FONDO OSCURECIDO) --- */
.custom-modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 10000; /* Por encima de todo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 17, 23, 0.75); /* Fondo traslúcido oscuro */
    backdrop-filter: blur(4px); /* Efecto descompresión sutil */
    align-items: center;
    justify-content: center;
}

/* --- CAJA DEL MODAL --- */
.custom-modal-content {
    background-color: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 35px -12px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.2s ease;
    overflow: hidden;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- CUERPO Y CABECERA --- */
.custom-modal-header {
    background: rgba(59, 127, 245, 0.08);
    border-bottom: 1px solid #262c3d;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #e4e8f5; /* --text */
    display: flex;
    align-items: center;
    gap: 8px;
}
.custom-modal-header span {
    color: #3b7ff5; /* --accent */
}

.custom-modal-body {
    padding: 24px 20px;
    font-size: 14px;
    color: #7a85a3; /* --muted */
    line-height: 1.5;
}
#modal-target-rol {
    color: #e4e8f5;
    font-weight: 600;
}

/* --- BOTONES DEL MODAL --- */
.custom-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #262c3d;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #131620;
}

.modal-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.modal-btn-primary {
    background: #1c4281; /* --accent */
    color: #ffffff;
}
.modal-btn-primary:hover {
    background: #2563cc;
}

.modal-btn-ghost {
    background: transparent;
    color: #7a85a3;
    border: 1px solid #262c3d;
}
.modal-btn-ghost:hover {
    color: #e4e8f5;
    border-color: #7a85a3;
}
/* --- CONTENEDOR PRINCIPAL DEL MODAL (FONDO OSCURECIDO) --- */
.custom-modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 10000; /* Por encima de todo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 17, 23, 0.75); /* Fondo traslúcido oscuro */
    backdrop-filter: blur(4px); /* Efecto descompresión sutil */
    align-items: center;
    justify-content: center;
}

/* --- CAJA DEL MODAL --- */
.custom-modal-content {
    background: #181c27; /* --surface */
    border: 1px solid #262c3d; /* --border */
    border-radius: 8px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.2s ease-out;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* --- CUERPO Y CABECERA --- */
.custom-modal-header {
    background: rgba(59, 127, 245, 0.08);
    border-bottom: 1px solid #262c3d;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #e4e8f5; /* --text */
    display: flex;
    align-items: center;
    gap: 8px;
}
.custom-modal-header span {
    color: #3b7ff5; /* --accent */
}

.custom-modal-body {
    padding: 24px 20px;
    font-size: 14px;
    color: #7a85a3; /* --muted */
    line-height: 1.5;
}
#modal-target-rol {
    color: #e4e8f5;
    font-weight: 600;
}

/* --- BOTONES DEL MODAL --- */
.custom-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #262c3d;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #131620;
}

.modal-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.modal-btn-primary {
    background: #3b7ff5; /* --accent */
    color: #ffffff;
}
.modal-btn-primary:hover {
    background: #2563cc;
}

.modal-btn-ghost {
    background: transparent;
    color: #7a85a3;
    border: 1px solid #262c3d;
}
.modal-btn-ghost:hover {
    color: #e4e8f5;
    border-color: #7a85a3;
}
        .page {
            max-width: 680px;
            margin: 0 auto;
            animation: fadeUp .4s ease both;
        }

        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(16px); }
            to   { opacity: 1; transform: translateY(0);    }
        }

        .breadcrumb {
            font-size: 13px;
            color: var(--muted);
            margin-bottom: 22px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 500; }
        .breadcrumb a:hover { text-decoration: underline; }
        .breadcrumb span { color: var(--border); }

        .page-header {
            margin-bottom: 24px;
            border-bottom: 2px solid var(--primary);
            padding-bottom: 12px;
        }
        .page-header h1 {
            font-size: 24px;
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 4px;
        }
        .page-header p {
            font-size: 14px;
            color: var(--muted);
        }

        .alert {
            border-radius: var(--radius);
            font-size: 14px;
            padding: 12px 16px;
            margin-bottom: 24px;
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }
        .alert-success {
            background: rgba(46,125,50,.08);
            border: 1px solid rgba(46,125,50,.3);
            color: var(--success);
        }
        .alert-error {
            background: rgba(217,83,79,.08);
            border: 1px solid rgba(217,83,79,.3);
            color: var(--danger);
        }

        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 32px;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
        }

        .section-title {
            font-size: 12px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: .05em;
            color: var(--primary);
            padding-bottom: 6px;
            border-bottom: 1px solid var(--border);
            margin-bottom: 20px;
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
        }
        .form-row.single { grid-template-columns: 1fr; }

        .form-group {
            margin-bottom: 18px;
        }
        label {
            display: block;
            font-size: 13px;
            font-weight: 500;
            color: var(--text);
            margin-bottom: 6px;
        }
        label .req { color: var(--danger); margin-left: 2px; }

        input, select {
            width: 100%;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            color: var(--text);
            font-family: 'bodoni mt bold','century schoolbook';
            font-size: 14px;
            padding: 10px 12px;
            transition: border-color .2s, box-shadow .2s;
            outline: none;
        }
        select {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23233a6a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 14px center;
            padding-right: 36px;
            cursor: pointer;
        }
        input:focus, select:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(236,116,25,.15);
        }

        .field-error {
            font-size: 12px;
            color: var(--danger);
            margin-top: 5px;
        }
        input.is-invalid, select.is-invalid {
            border-color: var(--danger);
        }

        .hint {
            font-size: 12px;
            color: var(--muted);
            margin-top: 5px;
        }

        /* ---- Checkbox Custom ---- */
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #f1f5f9;
            padding: 12px;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            margin-top: 5px;
        }
        .checkbox-group input {
            width: auto;
            cursor: pointer;
        }
        .checkbox-group label {
            margin-bottom: 0;
            cursor: pointer;
            text-transform: none;
            letter-spacing: normal;
            font-size: 14px;
        }

        .actions {
            display: flex;
            gap: 12px;
            margin-top: 8px;
            padding-top: 24px;
            border-top: 1px solid var(--border);
        }
        .btn {
            padding: 12px 24px;
            border-radius: var(--radius);
            font-family: 'bodoni mt bold','century schoolbook';
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: background .2s, transform .1s;
            border: none;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .btn:active { transform: scale(.98); }
        .btn-primary { background: var(--accent); color: #fff; flex: 1; justify-content: center; font-weight: 600; }
        .btn-primary:hover { background: var(--accent-dk); }
        .btn-ghost {
            background: transparent;
            color: var(--muted);
            border: 1px solid var(--border);
        }
        .btn-ghost:hover { color: var(--primary); border-color: var(--primary); }

        .pwd-wrap { position: relative; }
        .pwd-wrap input { padding-right: 44px; }
        .toggle-pwd {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--muted);
            cursor: pointer;
            font-size: 16px;
            padding: 4px;
        }

        .rol-info {
            margin-top: 8px;
            display: none;
            font-size: 13px;
            color: var(--primary);
            background: rgba(35,58,106,.05);
            border: 1px solid rgba(35,58,106,.15);
            border-radius: 4px;
            padding: 8px 12px;
        }
        .rol-info.visible { display: block; }

        @media (max-width: 520px) {
            .form-row { grid-template-columns: 1fr; }
            .card { padding: 24px 18px; }
        }
        .lock-container {
            width: 100%;
            max-width: 440px;
            animation: fadeIn 0.3s ease-out;
        }
        .pwd-requirement {
            font-size: 12px;
            color: #7a85a3;
            margin-top: 6px;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }

/* ═══════════════════════════════════════════════════════════════
   CARGA DE NOTAS — estilos específicos de la página cargar_notas
   (tema oscuro, sidebar, tabla de evaluaciones)
   ═══════════════════════════════════════════════════════════════ */

/* Variables locales (tema oscuro) */
.notas-page {
    --bg:        #0f1117;
    --surface:   #181c27;
    --surface2:  #1e2333;
    --border:    #262c3d;
    --accent:    #3b7ff5;
    --accent-dk: #2563cc;
    --text:      #e4e8f5;
    --muted:     #7a85a3;
    --danger:    #e05260;
    --warn:      #e8a020;
    --success:   #34c98a;
    --radius:    6px;
    --sidebar-w: 240px;
}

body.notas-page {
    background: var(--bg);
    font-family:'bodoni mt bold','century schoolbook';
    color: var(--text);
    display: flex;
    min-height: 100vh;
    background-image: radial-gradient(ellipse 70% 40% at 80% -10%, rgba(59,127,245,.12) 0%, transparent 60%);
}

/* ══ SIDEBAR ═════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.logo-dot {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.logo-name {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    line-height: 1.3;
}
.logo-name small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }

.nav-section { padding: 0 10px; margin-bottom: 8px; }
.nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    padding: 0 8px;
    margin-bottom: 4px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(59,127,245,.15); color: var(--accent); }
.nav-item .icon  { font-size: 15px; width: 18px; text-align: center; }

.sidebar-bottom { margin-top: auto; padding: 16px 18px 0; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #3b7ff5, #7c4dff);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-info strong { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span   { font-size: 11px; color: var(--muted); }

/* ══ MAIN LAYOUT ══════════════════════════════════════════════ */
.main {
    flex: 1;
    min-width: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.notas-page .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: none;
    border-bottom: none;
    box-shadow: none;
    position: static;
    height: auto;
    padding: 0;
}
.topbar-left h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 4px; }
.topbar-left p { font-size: 13px; color: var(--muted); }

.etapa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}
.etapa-badge.open   { background: rgba(52,201,138,.12); border: 1px solid rgba(52,201,138,.3); color: var(--success); }
.etapa-badge.locked { background: rgba(224,82,96,.10);  border: 1px solid rgba(224,82,96,.3);  color: var(--danger); }
.etapa-badge .dot   { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.notas-page .alert {
    border-radius: var(--radius);
    font-size: 13px;
    padding: 12px 16px;
    border: 1px solid transparent;
    display: block;
}
.alert-ok  { background: rgba(52,201,138,.1); border-color: rgba(52,201,138,.3); color: #5edba8; }
.alert-err { background: rgba(224,82,96,.1);  border-color: rgba(224,82,96,.3);  color: #f07e88; }

/* ── Filtros ── */
.filters-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; width: 100%; }
.filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.notas-page select,
.notas-page input[type="number"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .2s;
}
.notas-page select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%237a85a3' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
    appearance: none;
}

/* ── Grid de Estadísticas ── */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}
.stat-card .val {
    font-size: 22px;
    font-weight: 600;
    font-family: 'bodoni mt bold','century schoolbook';
    margin-bottom: 2px;
}
.stat-card .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card.c-ok    .val { color: var(--success); }
.stat-card.c-warn  .val { color: var(--warn); }
.stat-card.c-err   .val { color: var(--danger); }
.stat-card.c-muted .val { color: var(--muted); }

/* ── Tabla de notas ── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.table-title    { font-size: 14px; font-weight: 600; }
.table-subtitle { font-size: 12px; color: var(--muted); }

.table-responsive-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.notas-page table { width: 100%; border-collapse: collapse; min-width: 850px; }
.notas-page thead th {
    background: var(--surface2);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.notas-page td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.notas-page tbody tr:last-child td { border-bottom: none; }

.nota-input-wrap { width: 75px; }
.nota-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 14px;
    text-align: center;
    padding: 6px;
    outline: none;
}
.nota-input.nota-ok   { border-color: var(--success); color: var(--success); }
.nota-input.nota-warn { border-color: var(--warn);    color: var(--warn); }
.nota-input.nota-bad  { border-color: var(--danger);  color: var(--danger); }

.recup-wrap  { display: flex; align-items: center; gap: 4px; }
.recup-label { font-size: 10px; color: var(--muted); text-transform: uppercase; }

.prom-cell       { font-family: 'bodoni mt bold','century schoolbook'; font-size: 13px; font-weight: 600; text-align: center; }
.prom-cell.ok    { color: var(--success); }
.prom-cell.warn  { color: var(--warn); }
.prom-cell.bad   { color: var(--danger); }
.prom-cell.empty { color: var(--muted); }

.estado-badge          { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.estado-regular        { background: rgba(52,201,138,.1);  color: var(--success); }
.estado-riesgo         { background: rgba(232,160,32,.1);  color: var(--warn); }
.estado-libre          { background: rgba(224,82,96,.1);   color: var(--danger); }
.estado-pendiente      { background: rgba(122,133,163,.1); color: var(--muted); }

.obs-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 12px;
    padding: 6px 10px;
    outline: none;
    min-width: 140px;
}

.locked-notice {
    font-size: 13px;
    color: var(--danger);
    background: rgba(224,82,96,.08);
    border: 1px solid rgba(224,82,96,.25);
    border-radius: var(--radius);
    padding: 8px 14px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.empty-state .icon { font-size: 32px; margin-bottom: 12px; }

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}
.footer-hint { font-size: 12px; color: var(--muted); }
.btn-save {
    padding: 10px 24px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-save:disabled { opacity: .5; cursor: not-allowed; }

.mono { font-family: 'bodoni mt bold','century schoolbook'; }
.center { text-align: center; }

/* ══ RESPONSIVE — cargar_notas ════════════════════════════════ */
@media (max-width: 1024px) {
    .main { padding: 20px; }
    .filters-bar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    body.notas-page { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px 0;
    }
    .sidebar-logo { padding: 0 16px 12px; margin-bottom: 8px; }
    .nav-section  { display: flex; flex-direction: row; overflow-x: auto; padding: 0 16px; gap: 8px; }
    .nav-label    { display: none; }
    .nav-item     { white-space: nowrap; padding: 6px 12px; }
    .sidebar-bottom { display: none; }

    .notas-page .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .filters-bar  { grid-template-columns: 1fr; }
    .table-header { flex-direction: column; align-items: flex-start; }
    .form-footer  { flex-direction: column; align-items: stretch; text-align: center; }
    .btn-save     { width: 100%; justify-content: center; }
}

/* ==========================================================================
   ESTILOS ADICIONALES: UNIFICACIÓN DE CARGA DE NOTAS Y VISTAS INTERNAS
   ========================================================================== */

/* ── DISPOSICIÓN GLOBAL E INTERFAZ CON SIDEBAR ──────────────────────────── */
body.notas-page {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.logo-dot { font-size: 20px; }
.logo-name {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}
.sidebar-logo small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

.nav-section { padding: 0 12px; flex: 1; }
.nav-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    padding-left: 12px;
    margin-bottom: 8px;
    letter-spacing: .05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all .2s;
    margin-bottom: 4px;
}
.nav-item .icon { font-size: 16px; color: var(--muted); }
.nav-item:hover { background: var(--bg); color: var(--primary); }
.nav-item.active { background: var(--surface2); color: var(--primary); font-weight: 700; }
.nav-item.active .icon { color: var(--accent); }

.sidebar-bottom {
    padding: 16px;
    margin-top: auto;
    border-top: 1px solid var(--border-light);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    padding: 10px;
    border-radius: var(--radius);
}
.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-info strong { font-size: 13px; color: var(--text); }
.user-info span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

.main {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    max-width: 1200px;
}

/* ── CONTENEDORES SUPERIORES Y BADGES DE ETAPA ────────────────────────── */
.topbar-left h1 {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}
.topbar-left p { font-size: 14px; color: var(--muted); }

.etapa-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
}
.etapa-badge.open { background: rgba(46,158,110,.1); color: #2e9e6e; border: 1px solid rgba(46,158,110,.2); }
.etapa-badge.locked { background: rgba(220,53,69,.1); color: #b91c1c; border: 1px solid rgba(220,53,69,.2); }
.etapa-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ── ALERTAS Y FILTROS ──────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-ok { background: rgba(46,158,110,.1); border: 1px solid rgba(46,158,110,.25); color: #155724; }
.alert-err { background: rgba(220,53,69,.08); border: 1px solid rgba(220,53,69,.25); color: #b91c1c; }

.filters-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
    align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label {
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: .04em;
}
.filter-group select {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    outline: none;
    cursor: pointer;
    transition: all .2s;
}
.filter-group select:focus { border-color: var(--primary-light); background: var(--surface); }

/* ── SECCIÓN DE GRIDS / PLANILLAS ACADÉMICAS ────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive { overflow-x: auto; }

.table-notas {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.table-notas th {
    background: var(--surface2);
    color: var(--text);
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 14px 18px;
    border-bottom: 2px solid var(--border);
    letter-spacing: .02em;
}
.table-notas td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.table-notas tr:hover td { background: rgba(240,244,250,.4); }

/* Inputs dentro de las celdas de notas */
.input-nota {
    width: 70px;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: all .2s;
}
.input-nota:focus {
    border-color: var(--primary-light);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(26,58,110,.08);
}
.input-nota:disabled { opacity: 0.6; background: var(--border-light); cursor: not-allowed; }

.input-obs {
    width: 100%;
    min-width: 180px;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-body);
    background: var(--bg);
    outline: none;
    transition: all .2s;
}
.input-obs:focus { border-color: var(--primary-light); background: var(--surface); }

/* ── BADGES ACADÉMICOS DINÁMICOS ────────────────────────────────────────── */
.badge-nota {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .02em;
    text-align: center;
    min-width: 75px;
}
.badge-nota.regular { background: rgba(46,158,110,.12); color: #1e7e53; }
.badge-nota.riesgo  { background: rgba(245,168,74,.15); color: #b76300; }
.badge-nota.libre   { background: rgba(220,53,69,.1); color: #b91c1c; }
.badge-nota.vacio   { background: var(--bg); color: var(--muted); }

/* ── BARRA DE ACCIÓN INFERIOR (PANEL DE GUARDADO) ───────────────────────── */
.panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--surface2);
    border-top: 1px solid var(--border);
}

.btn-save {
    padding: 11px 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    border: none;
    font-family: 'bodoni mt bold','century schoolbook';
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(232,119,34,.2);
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-save:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(232,119,34,.3); }
.btn-save:active { transform: translateY(0); }
.btn-save:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── CONFIGURACIONES RESPONSIVAS ADICIONALES ───────────────────────────── */
@media (max-width: 1024px) {
    .main { padding: 20px; }
    .filters-bar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    body.notas-page { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); padding: 16px 0; }
    .sidebar-logo { padding: 0 16px 12px; margin-bottom: 8px; }
    .nav-section { display: flex; flex-direction: row; overflow-x: auto; padding: 0 16px; gap: 4px; }
    .nav-item { margin-bottom: 0; white-space: nowrap; }
    .nav-label { display: none; }
    .sidebar-bottom { display: none; }
    .filters-bar { grid-template-columns: 1fr; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
        body { font-family: 'bodoni mt bold','century schoolbook'; background: #f0f2f5; color: #1a1a2e; }

        /* ── Navbar ── */
        .navbar {
            background: #1a1a2e;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            height: 56px;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 2px 8px rgba(0,0,0,.3);
        }
        .navbar-brand { font-size: 1.1rem; font-weight: 700; }
        .navbar-brand span { color: #4fc3f7; }
        .navbar-user { font-size: .85rem; opacity: .8; }
        .navbar-user a { text-decoration: none; }

        /* ── Layout ── */
        .page-wrapper { max-width: 1300px; margin: 32px auto; padding: 0 16px; }

        .page-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 24px;
            flex-wrap: wrap;
            gap: 12px;
        }
        .page-title { font-size: 1.4rem; font-weight: 700; }
        .page-title small { font-size: .82rem; font-weight: 400; color: #666; margin-left: 8px; }

        /* ── Flash ── */
        .flash {
            padding: 12px 16px;
            border-radius: 6px;
            margin-bottom: 20px;
            font-size: .88rem;
            font-weight: 500;
        }
        .flash-ok    { background: #dcfce7; border-left: 4px solid #16a34a; color: #166534; }
        .flash-error { background: #fee2e2; border-left: 4px solid #dc2626; color: #991b1b; }

        /* ── Filtro ciclo ── */
        .ciclo-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 24px;
            flex-wrap: wrap;
        }
        .ciclo-bar label { font-size: .85rem; font-weight: 600; color: #374151; }
        .ciclo-bar select {
            padding: 7px 12px;
            border: 1.5px solid #cbd5e1;
            border-radius: 7px;
            font-size: .88rem;
            outline: none;
            cursor: pointer;
        }
        .ciclo-bar select:focus { border-color: #1976d2; }

        /* ── Grid 2 columnas ── */
        .grid-2 {
            display: grid;
            grid-template-columns: 380px 1fr;
            gap: 24px;
            align-items: start;
        }
        /* Tabla sola (sin formulario) ocupa todo el ancho */
        .grid-2 > .card:only-child {
            grid-column: 1 / -1;
        }
        @media (max-width: 860px) {
            .grid-2 { grid-template-columns: 1fr; }
        }

        /* ── Card ── */
        .card {
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 1px 6px rgba(0,0,0,.08);
            overflow: hidden;
        }
        .card-header {
            padding: 16px 20px;
            background: #1a1a2e;
            color: #fff;
        }
        .card-header h2 { font-size: 1rem; font-weight: 700; }
        .card-header p  { font-size: .78rem; opacity: .7; margin-top: 2px; }
        .card-body { padding: 20px; }

        /* ── Formulario ── */
        .form-group { margin-bottom: 16px; }
        .form-group label {
            display: block;
            font-size: .8rem;
            font-weight: 600;
            margin-bottom: 5px;
            color: #374151;
            text-transform: uppercase;
            letter-spacing: .3px;
        }
        .form-control {
            width: 100%;
            padding: 9px 12px;
            border: 1.5px solid #cbd5e1;
            border-radius: 7px;
            font-size: .88rem;
            outline: none;
            background: #fafafa;
            transition: border-color .15s;
        }
        .form-control:focus { border-color: #1976d2; background: #fff; }

        .btn-submit {
            width: 100%;
            padding: 10px;
            background: #1976d2;
            color: #fff;
            border: none;
            border-radius: 7px;
            font-size: .9rem;
            font-weight: 700;
            cursor: pointer;
            margin-top: 4px;
            transition: background .15s;
        }
        .btn-submit:hover { background: #1565c0; }

        /* ── Empty ── */
        .empty { text-align: center; padding: 40px 16px; color: #94a3b8; font-size: .9rem; }
        .empty-icon { font-size: 2rem; margin-bottom: 8px; }

        /* ── Modal ── */
        .modal-overlay {
            display: none;
            position: fixed; inset: 0;
            background: rgba(0,0,0,.45);
            z-index: 200;
            align-items: center;
            justify-content: center;
        }
        .modal-overlay.open { display: flex; }
        .modal {
            background: #fff;
            border-radius: 10px;
            padding: 28px 28px 24px;
            max-width: 440px;
            width: 92%;
            box-shadow: 0 8px 32px rgba(0,0,0,.2);
        }
        .modal h3 { font-size: 1rem; margin-bottom: 10px; }
        .modal p  { font-size: .86rem; color: #555; margin-bottom: 16px; line-height: 1.5; }

        .modal-select-wrap { margin-bottom: 20px; }
        .modal-select-wrap label { font-size: .8rem; font-weight: 600; display: block; margin-bottom: 5px; }
        .modal-select-wrap select {
            width: 100%;
            padding: 8px 10px;
            border: 1.5px solid #cbd5e1;
            border-radius: 6px;
            font-size: .88rem;
            outline: none;
        }

        .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
        .btn-cancel  { background: #e5e7eb; color: #374151; padding: 8px 18px; border-radius: 6px; border: none; cursor: pointer; font-size: .86rem; font-weight: 600; }
        .btn-confirm { background: #f59e0b; color: #fff; padding: 8px 18px; border-radius: 6px; border: none; cursor: pointer; font-size: .86rem; font-weight: 700; }
        .btn-confirm-red { background: #dc2626; color: #fff; padding: 8px 18px; border-radius: 6px; border: none; cursor: pointer; font-size: .86rem; font-weight: 700; }

        .divider { height: 1px; background: #f1f5f9; margin: 16px 0; }

        /* ── Info box ── */
        .info-box {
            background: #eff6ff;
            border-left: 4px solid #1976d2;
            padding: 10px 14px;
            border-radius: 0 6px 6px 0;
            font-size: .8rem;
            color: #1e40af;
            margin-bottom: 16px;
            line-height: 1.5;
        }

        /* ── Tabla ── */
        .tabla-wrap { overflow-x: auto; }

        table { 
            width: 100%; 
            border-collapse: collapse; 
            min-width: 700px; 
            background: #ffffff;
        }

        /* Distribución de columnas */
        thead th:nth-child(1) { width: 35%; }
        thead th:nth-child(2) { width: 20%; }
        thead th:nth-child(3) { width: 30%; }
        thead th:nth-child(4) { width: 15%; }

        thead { background: #1a1a2e; }

        thead th {
            padding: 13px 18px;
            text-align: left;
            font-size: .72rem;
            text-transform: uppercase;
            letter-spacing: .7px;
            color: #cbd5e1;
            border-bottom: none;
            font-weight: 700;
        }

        tbody tr { 
            border-bottom: 1px solid #f1f5f9; 
            transition: background .15s ease; 
        }

        tbody tr:last-child { border-bottom: none; }

        tbody tr:hover { background: #f0f9ff; }

        tbody td { 
            padding: 14px 18px;
            font-size: .88rem; 
            color: #334155;
            vertical-align: middle;
        }

        /* ── Chips ── */
        .chip {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: .78rem;
            font-weight: 600;
        }

        .chip-materia { 
            background: transparent; 
            color: #1e1e2f; 
            padding: 0;
            font-size: .9rem;
            font-weight: 600;
        }

        .chip-curso { 
            background: #e0f2fe; 
            color: #0369a1; 
        }

        tbody td small {
            color: #64748b;
            font-size: .78rem;
            display: inline-block;
            margin-top: 2px;
        }

        /* ── Botones de acción ── */
        .btn-sm {
            padding: 5px 12px;
            border-radius: 6px;
            font-size: .78rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            transition: all .15s ease;
        }

        .btn-reasignar { 
            background: #fef3c7; 
            color: #b45309; 
            border: 1px solid #fcd34d;
        }
        .btn-reasignar:hover { background: #fde68a; }

        .btn-eliminar { 
            background: #fee2e2; 
            color: #dc2626; 
            border: 1px solid #fca5a5;
        }
        .btn-eliminar:hover { background: #fecaca; }

.stat-val.etapa-abierta {
        color: #10b981;
        font-size: 0.9rem;
    }
    
    .stat-val.etapa-cerrada {
        color: #ef4444;
        font-size: 0.9rem;
    }
    
    .stat-val.etapa-sin-datos {
        color: #94a3b8;
        font-size: 0.9rem;
    }

/* ── STATS: BIMESTRES ── */
.stat-bimestre {
    flex: 0 1 auto;
    min-width: 90px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-bimestre-val {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px; /* separación con el nombre */
}

.bimestre-status {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bimestre-status.abierto {
    background-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.bimestre-status.cerrado {
    background-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.bimestre-estado-texto {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-body);
    white-space: nowrap;
}

/* Ajuste del nombre del bimestre (debajo) */
.stat-bimestre .stat-lbl {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-top: 2px;
    text-align: center;
    line-height: 1.2;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .stat-bimestre {
        min-width: 70px;
        padding: 8px 10px;
    }
    .bimestre-status {
        width: 10px;
        height: 10px;
    }
    .bimestre-estado-texto {
        font-size: 0.6rem;
    }
    .stat-bimestre .stat-lbl {
        font-size: 0.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   MEJORAS RESPONSIVE PARA DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

/* ── TABLETS (entre 481px y 768px) ── */
@media (max-width: 768px) {
    .stats-row {
        gap: 10px;
        padding: 0 14px;
        justify-content: center;
    }

    /* Cada tarjeta ocupa ~2 columnas en lugar de 4 */
    .stat {
        flex: 0 0 calc(50% - 10px);
        min-width: 0;
        padding: 12px 14px;
    }

    .stat-val {
        font-size: 24px;
    }

    .stat-lbl {
        font-size: 10px;
    }

    /* Ajuste específico para bimestres */
    .stat-bimestre {
        min-width: 0;
        padding: 10px 6px;
    }

    .bimestre-estado-texto {
        font-size: 0.65rem;
    }

    .bimestre-status {
        width: 10px;
        height: 10px;
    }

    .hero {
        padding: 32px 14px 24px;
    }

    .hero h1 {
        font-size: clamp(22px, 3.5vw, 30px);
    }

    .hero-sub {
        font-size: 14px;
    }

    .modulos-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0 14px 40px;
    }

    .modulo-card {
        padding: 18px 16px;
    }

    .card-body h2 {
        font-size: 15px;
    }

    .card-body p {
        font-size: 12px;
    }

    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .card-tag {
        font-size: 9px;
        padding: 2px 8px;
    }
}

/* ── TELÉFONOS (hasta 480px) ── */
@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
        height: 56px;
    }

    .school-logo {
        width: 34px;
        height: 34px;
    }

    .logo-text .logo-sge {
        font-size: 8px;
    }

    .logo-text .logo-school {
        font-size: 9px;
        max-width: 130px;
    }

    .topbar-right {
        gap: 8px;
    }

    .user-btn .user-name {
        display: none; /* ocultamos nombre, solo avatar */
    }

    .avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .logout-link {
        font-size: 10px;
        padding: 4px 10px;
    }

    /* enlaces de navegación (Bimestres, etc.) en topbar */
    .nav-link {
        padding: 4px 8px;
        font-size: 0;
        /* solo ícono */
    }

    .nav-link svg {
        width: 16px;
        height: 16px;
    }

    .nav-link .nav-label {
        display: none;
    }

    /* Hero */
    .hero {
        padding: 24px 12px 16px;
        text-align: center;
    }

    .hero h1 {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .hero-sub {
        font-size: 13px;
        max-width: 100%;
    }

    /* Estadísticas: una columna */
    .stats-row {
        gap: 8px;
        padding: 0 12px;
        margin-bottom: 24px;
    }

    .stat {
        flex: 0 0 100%;
        padding: 10px 12px;
        min-width: 0;
        border-radius: 8px;
    }

    .stat::before {
        height: 2px;
    }

    .stat-val {
        font-size: 20px;
    }

    .stat-lbl {
        font-size: 9px;
    }

    /* Bimestres: en una fila horizontal */
    .stat-bimestre {
        flex: 0 0 calc(25% - 6px);
        padding: 6px 4px;
        min-width: 0;
        border-radius: 6px;
    }

    .stat-bimestre-val {
        gap: 4px;
        margin-bottom: 2px;
    }

    .bimestre-status {
        width: 8px;
        height: 8px;
    }

    .bimestre-estado-texto {
        font-size: 0.5rem;
        letter-spacing: 0.02em;
    }

    .stat-bimestre .stat-lbl {
        font-size: 0.45rem;
        letter-spacing: 0.02em;
        margin-top: 1px;
    }

    /* Módulos: una columna */
    .modulos-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 12px 32px;
    }

    .modulo-card {
        padding: 16px 14px;
        border-radius: 10px;
        gap: 12px;
    }

    .modulo-card::after {
        height: 3px;
    }

    .card-body h2 {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .card-body p {
        font-size: 12px;
        line-height: 1.5;
    }

    .card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .card-tag {
        font-size: 8px;
        padding: 2px 6px;
    }

    .card-arrow {
        font-size: 14px;
    }

    /* Sección label */
    .section-label {
        font-size: 10px;
        padding: 0 12px;
        margin-bottom: 12px;
    }

    /* Footer */
    .page-footer {
        font-size: 9px;
        padding: 16px 12px;
        line-height: 1.4;
    }

    /* Modal de cambio de rol */
    .custom-modal-content {
        width: 95%;
        max-width: 360px;
        border-radius: 12px;
    }

    .custom-modal-header {
        font-size: 13px;
        padding: 14px 16px;
    }

    .custom-modal-body {
        font-size: 13px;
        padding: 18px 16px;
    }

    .custom-modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .modal-btn {
        padding: 10px 20px;
        font-size: 14px; /* mayor para táctil */
        min-height: 44px;
        min-width: 80px;
    }

    /* Selector de roles (si está visible) */
    .rol-select {
        font-size: 10px;
        padding: 2px 24px 2px 8px;
        background-position: right 6px center;
        background-size: 8px;
    }

    /* Ajuste del badge de sede en dashboard (si existe) */
    .sede-badge {
        font-size: 0.6rem;
        padding: 4px 10px;
    }

    .bimestres-header h1 {
        font-size: 1.2rem;
    }
}

/* ── EXTRAPEQUEÑOS (hasta 360px) ── */
@media (max-width: 360px) {
    .stat-bimestre {
        flex: 0 0 calc(25% - 4px);
        padding: 4px 2px;
    }

    .bimestre-estado-texto {
        font-size: 0.4rem;
    }

    .bimestre-status {
        width: 6px;
        height: 6px;
    }

    .stat-bimestre .stat-lbl {
        font-size: 0.4rem;
    }

    .modulo-card {
        padding: 12px 10px;
    }

    .card-body h2 {
        font-size: 13px;
    }
}

/* ── SELECCIONAR ROL EN MÓVILES ── */
@media (max-width: 640px) {
    /* Asegurar que el selector sea visible y grande para táctil */
    .rol-select {
        display: inline-block !important;
        font-size: 12px !important;
        padding: 6px 28px 6px 10px !important;
        min-height: 36px;
        min-width: 80px;
        background-size: 10px;
        background-position: right 8px center;
    }

    /* El badge de rol (cuando hay un solo rol) se oculta, pero mostramos el nombre del rol */
    .rol-badge {
        display: none !important;
    }

    /* Si usas un botón en lugar de select, ajustar */
    .rol-btn {
        display: inline-block !important;
        font-size: 12px;
        padding: 6px 12px;
        min-height: 36px;
    }

    /* Para el modal de confirmación de cambio de rol */
    .custom-modal-content {
        width: 92% !important;
        max-width: 360px !important;
        margin: 0 16px !important;
    }

    .custom-modal-header,
    .custom-modal-body,
    .custom-modal-footer {
        padding: 14px 16px !important;
    }

    .modal-btn {
        min-height: 44px;
        min-width: 80px;
        font-size: 14px;
        padding: 8px 16px;
    }

    /* Ajuste del espacio en topbar-right para que quepa */
    .topbar-right {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}