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

/* ── VARIABLES Y TEMAS ───────────────────────────────────────── */
:root {
    /* Paleta Principal CSCP */
    --primary:        #1c4281;
    --primary-light:  #a3cef1;
    --accent:         #6096ba;
    --accent-light:   #1c4281;
    --gold:           #6096ba;

    /* Tema Claro (Default) */
    --bg:             #E7ECEF;
    --surface:        #ffffff;
    --surface2:       #e8edf7;
    --border:         #6096BA;
    --border-light:   #A3CEF1;

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

    /* Estados */
    --danger:         #e05260;
    --warn:           #e8a020;
    --success:        #34c98a;

    /* Dimensiones y Sombras */
    --radius:         10px;
    --sidebar-w:      240px;
    --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);
    
    --font-primary:   'Nunito', 'Nunito Sans', sans-serif;
}

/* Override Tema Oscuro (Carga de Notas) */
.notas-page {
    --bg:             #0f1117;
    --surface:        #181c27;
    --surface2:       #1e2333;
    --border:         #262c3d;
    --accent:         #3b7ff5;
    --accent-dk:      #2563cc;
    --text:           #e4e8f5;
    --text-body:      #e4e8f5;
    --muted:          #7a85a3;
    --radius:         6px;
}

/* ── BASE ────────────────────────────────────────────────────── */
html, body { 
    height: 100%; 
}

body {
    background: var(--bg);
    font-family: var(--font-primary);
    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%);
}

body.notas-page {
    display: flex;
    background-image: radial-gradient(ellipse 70% 40% at 80% -10%, rgba(59,127,245,.12) 0%, transparent 60%);
}

/* Heredar tipografía por defecto en elementos de formulario */
input, select, button, textarea {
    font-family: inherit;
}

/* ── 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;
}

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

.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-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold);
}

.logo-school {
    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-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-size: 13px; 
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.9);
}

.logout-link {
    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-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-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-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;
}

/* ── MÓDULOS ────────────────────────────────────────────────── */
.section-label {
    max-width: 980px;
    margin: 0 auto 16px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    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);
}

.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; }

.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.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-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-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);
}

/* ── LOGIN ──────────────────────────────────────────────────── */
.wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.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-size: 17px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.25;
    letter-spacing: -.01em;
    text-align: left;
}

.header-top > div > p {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    margin-top: 2px;
    letter-spacing: .02em;
}

.header > p {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 6px;
}

.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;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.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-size: 13px;
    font-weight: 600;
    padding: 12px 14px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
}

.form-group input {
    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);
}

.btn-primary {
    width: 100%;
    margin-top: 6px;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    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;
}

.rol-select {
    background-color: #2563cc;
    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;
    appearance: none;
    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;
    border-color: rgba(255, 255, 255, 0.3);
}

.rol-select option {
    background-color: #181c27;
    color: #e4e8f5;
    text-transform: uppercase;
    font-weight: normal;
}

/* ── MODAL UNIFICADO ────────────────────────────────────────── */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 17, 23, 0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.custom-modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 35px -12px 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; }
}

.custom-modal-header {
    background: rgba(59, 127, 245, 0.08);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-modal-header span {
    color: var(--accent);
}

.custom-modal-body {
    padding: 24px 20px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
}

#modal-target-rol {
    color: var(--text);
    font-weight: 600;
}

.custom-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface2);
}

.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: var(--primary);
    color: #ffffff;
}

.modal-btn-primary:hover {
    background: var(--accent-dk);
}

.modal-btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.modal-btn-ghost:hover {
    color: var(--text);
    border-color: var(--muted);
}

/* ── SIDEBAR (Notas) ────────────────────────────────────────── */
.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-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, var(--primary), var(--accent));
    border-radius: 50%;
}

/* ── 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, .logo-divider { display: none; }
    .modulos-grid { grid-template-columns: 1fr; }
}

@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; }
}
/* ── PÁGINA FORZAR CAMBIO DE CLAVE ────────────────────────────── */

/* Contenedor centrado similar al wrap del login */
.lock-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

/* Subtítulo bajo el encabezado principal */
.header-sub {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 6px;
}

/* Texto introductorio dentro de la tarjeta */
.welcome-text {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Wrapper para input de contraseña + botón de ocultar/mostrar */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 42px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
    color: var(--muted);
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 0.8;
}

/* Requisito de la contraseña */
.pwd-requirement {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* Botón principal de guardar (similar a .btn-primary) */
.btn-submit {
    width: 100%;
    margin-top: 10px;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    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-submit:hover {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,58,110,.32);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Enlace para cancelar o volver */
.cancel-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.cancel-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Estado de éxito */
.success-container {
    text-align: center;
    padding: 10px 0;
}

.success-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.success-container h2 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 10px;
}

.success-container p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.footer-note {
    font-size: 11px;
    color: var(--muted);
    margin-top: 24px;
    text-align: center;
}
/* Agregá esta regla al final de tu archivo CSS */
.page-footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 12px;
    color: var(--muted);
    width: 100%;
}