/* Sistema escolar · hoja de estilos única (sin Vite). Los colores del colegio llegan
   como variables CSS desde el servidor: --principal, --menu, --acento, --fondo
   y sus colores de texto calculados (--principal-texto, etc.). */

:root {
    --principal: #1c3f94; --principal-texto: #fff;
    --menu: #142c66; --menu-texto: #fff;
    --acento: #c62828; --acento-texto: #fff;
    --fondo: #fbfcfe; --fondo-texto: #16181d;

    /* Colores fijos: no cambian con el tema del colegio */
    --nota-aprobada: #1554b8;
    --nota-desaprobada: #c62828;
    --exito: #1e7a3c; --exito-suave: #e7f5ec;
    --aviso: #8a5a00; --aviso-suave: #fff5dc;
    --error: #b3261e; --error-suave: #fdeceb;

    --texto: #1d2129;
    --texto-tenue: #5b6372;
    --borde: #dfe3ea;
    --superficie: #ffffff;
    --superficie-2: #f3f5f9;
    --radio: 10px;
    --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --ancho-menu: 248px;
    --alto-barra: 60px;
    --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--fuente); font-size: 15px; line-height: 1.5;
    color: var(--texto); background: var(--fondo);
}
img { max-width: 100%; }
a { color: var(--principal); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.tarjeta > h2:first-child { margin-top: 0; }
code { background: var(--superficie-2); padding: 0 .3em; border-radius: 4px; }
.texto-tenue { color: var(--texto-tenue); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 0; background: var(--superficie); padding: .5rem 1rem; z-index: 100; }
.saltar:focus { left: .5rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--principal) 55%, white); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.barra {
    position: fixed; inset: 0 0 auto 0; height: var(--alto-barra); z-index: 30;
    display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
    background: var(--principal); color: var(--principal-texto);
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.barra__menu { display: none; background: none; border: 0; color: inherit; padding: .4rem; border-radius: 8px; cursor: pointer; }
.barra__colegio { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; min-width: 0; }
.barra__escudo { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.barra__nombre { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra__anio { font-size: .85rem; padding: .2rem .65rem; border-radius: 99px; background: rgba(255,255,255,.16); white-space: nowrap; }
.barra__usuario { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.barra__quien { display: flex; flex-direction: column; line-height: 1.15; }
.barra__quien small { opacity: .85; }

/* ---------- Menú lateral ---------- */
.menu {
    position: fixed; top: var(--alto-barra); bottom: 0; left: 0; width: var(--ancho-menu);
    background: var(--menu); color: var(--menu-texto); overflow-y: auto; padding: .75rem .5rem 2rem; z-index: 20;
}
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu__grupo + .menu__grupo { margin-top: .75rem; }
.menu__titulo { margin: .25rem .75rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.menu__enlace {
    display: block; width: 100%; text-align: left; padding: .5rem .75rem; border-radius: 8px;
    color: inherit; text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer;
}
.menu__enlace:hover { background: rgba(255,255,255,.1); }
.menu__enlace.es-activo { background: rgba(255,255,255,.18); font-weight: 600; box-shadow: inset 3px 0 0 var(--acento); }
.menu__salir { margin-top: .75rem; border-top: 1px solid rgba(255,255,255,.15); padding-top: .5rem; }

.contenido { margin-left: var(--ancho-menu); padding: calc(var(--alto-barra) + 1.5rem) 1.75rem 3rem; max-width: 1400px; }

@media (max-width: 900px) {
    .barra__menu { display: inline-flex; }
    .barra__anio, .barra__quien { display: none; }
    .menu { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 18px rgba(0,0,0,.2); }
    body.menu-abierto .menu { transform: none; }
    .contenido { margin-left: 0; padding: calc(var(--alto-barra) + 1rem) 1rem 3rem; }
}

/* ---------- Tarjetas y resumen ---------- */
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; box-shadow: var(--sombra); margin-bottom: 1.25rem; }
.tarjeta--angosta { max-width: 460px; }
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.resumen--linea { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.resumen__tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.1rem; box-shadow: var(--sombra); display: flex; flex-direction: column; gap: .15rem; }
.resumen__valor { font-size: 1.75rem; font-weight: 700; color: var(--principal); line-height: 1.1; }
.resumen__nombre { color: var(--texto-tenue); font-size: .9rem; }
.resumen__tarjeta--destacada { border-color: var(--principal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--principal) 25%, transparent), var(--sombra); }
.resumen__tarjeta--destacada .resumen__valor { font-size: 2.6rem; }
.accesos { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Avisos ---------- */
.alerta { border-radius: var(--radio); padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alerta p { margin: 0 0 .25rem; } .alerta ul { margin: .25rem 0 0 1.1rem; padding: 0; }
.alerta--exito { background: var(--exito-suave); border-color: #b6dfc3; color: var(--exito); }
.alerta--aviso { background: var(--aviso-suave); border-color: #f0d79a; color: var(--aviso); }
.alerta--error { background: var(--error-suave); border-color: #f3c0bc; color: var(--error); }

/* ---------- Botones ---------- */
.boton {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 40px;
}
.boton--primario { background: var(--principal); color: var(--principal-texto); }
.boton--primario:hover { filter: brightness(1.08); }
.boton--secundario { background: var(--superficie); color: var(--principal); border-color: var(--borde); }
.boton--secundario:hover { background: var(--superficie-2); }
.boton--peligro { background: var(--error); color: #fff; }
.boton--acento { background: var(--acento); color: var(--acento-texto); }
.boton--chico { padding: .3rem .6rem; min-height: 32px; font-size: .88rem; }
.boton--ancho { width: 100%; }
.boton[disabled] { opacity: .6; cursor: not-allowed; }
.boton-icono { background: none; border: 0; padding: .3rem; border-radius: 6px; cursor: pointer; color: var(--texto-tenue); }
.boton-icono:hover { background: var(--superficie-2); color: var(--error); }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; }

/* ---------- Formularios ---------- */
.formulario fieldset { border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; margin: 0 0 1rem; }
.formulario legend { font-weight: 700; padding: 0 .4rem; }
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.campo label, .campo__etiqueta { font-weight: 600; font-size: .92rem; }
.campo input:not([type=checkbox]):not([type=radio]):not([type=color]), .campo select, .campo textarea, .entrada {
    font: inherit; padding: .5rem .65rem; border: 1px solid #c8ced8; border-radius: 8px; background: #fff; color: var(--texto); width: 100%;
}
.campo input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid #c8ced8; border-radius: 8px; background: #fff; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .entrada:focus { border-color: var(--principal); outline: 2px solid color-mix(in srgb, var(--principal) 30%, transparent); outline-offset: 0; }
.campo__ayuda { color: var(--texto-tenue); font-size: .84rem; }
.campo__mensaje { color: var(--error); font-size: .85rem; font-weight: 600; }
.campo--error input, .campo--error select { border-color: var(--error); }
.requerido { color: var(--error); }
.opcion { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400 !important; cursor: pointer; }
.rejilla-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.rejilla-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.rejilla-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1rem; }
@media (max-width: 700px) { .rejilla-2, .rejilla-3, .rejilla-4 { grid-template-columns: 1fr; } }
.filtros { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filtros .campo { margin-bottom: 0; }
.vista-imagen { display: block; max-width: 120px; max-height: 120px; object-fit: contain; border: 1px solid var(--borde); border-radius: 8px; background: #fff; padding: 4px; }
.vista-imagen--ancha { max-width: 260px; }

/* ---------- Fotos ---------- */
.foto { border-radius: 50%; object-fit: cover; background: #e8ebf1; flex-shrink: 0; vertical-align: middle; }
.foto--mini { width: 26px; height: 26px; }
.foto--chica { width: 34px; height: 34px; }
.foto--mediana { width: 56px; height: 56px; }
.foto--grande { width: 140px; height: 140px; }
.foto-actual { text-align: center; margin-bottom: 1rem; }
.persona { display: inline-flex; align-items: center; gap: .5rem; }

/* ---------- Tablas ---------- */
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--superficie); margin-bottom: 1rem; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th, .tabla td { padding: .5rem .65rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
.tabla thead th { background: var(--superficie-2); font-weight: 700; white-space: nowrap; }
.tabla tbody tr:hover { background: #fafbfd; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .centro { text-align: center; }
.tabla tfoot td { font-weight: 700; background: var(--superficie-2); }
.tabla--compacta th, .tabla--compacta td { padding: .3rem .4rem; }

/* ---------- Notas y escala (colores fijos) ---------- */
.nota-aprobada { color: var(--nota-aprobada); font-weight: 600; }
.nota-desaprobada { color: var(--nota-desaprobada); font-weight: 600; }
.escala { display: inline-block; min-width: 2.2em; text-align: center; font-weight: 700; padding: .05rem .35rem; border-radius: 6px; }
.escala--azul { color: var(--nota-aprobada); background: #e8effb; }
.escala--roja { color: var(--nota-desaprobada); background: #fdecec; }

/* ---------- Etiquetas y pastillas ---------- */
.etiqueta { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; background: var(--superficie-2); color: var(--texto-tenue); }
.etiqueta--exito { background: var(--exito-suave); color: var(--exito); }
.etiqueta--aviso { background: var(--aviso-suave); color: var(--aviso); }
.etiqueta--error { background: var(--error-suave); color: var(--error); }
.pastilla { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9em; height: 1.6em; padding: 0 .3em; border-radius: 99px; font-size: .78rem; font-weight: 700; color: #fff; }
.pastilla--P { background: #2e7d32; }
.pastilla--T { background: #e09a00; color: #1d1d1d; }
.pastilla--TJ { background: #a1742a; }
.pastilla--F { background: #c62828; }
.pastilla--FJ { background: #5f7487; }

/* ---------- Pestañas ---------- */
.pestanas { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 2px solid var(--borde); margin-bottom: 1rem; }
.pestanas a, .pestanas button { padding: .55rem .9rem; border: 0; background: none; font: inherit; font-weight: 600; color: var(--texto-tenue); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.pestanas .es-activa, .pestanas [aria-selected=true] { color: var(--principal); border-bottom-color: var(--principal); }

/* ---------- Desplegables ---------- */
details.grupo { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: .75rem; }
details.grupo > summary { padding: .75rem 1rem; cursor: pointer; font-weight: 700; list-style-position: inside; }
details.grupo[open] > summary { border-bottom: 1px solid var(--borde); }
details.grupo > .grupo__cuerpo { padding: 1rem; }

/* ---------- Ingreso ---------- */
.pagina-ingreso { min-height: 100vh; background: var(--principal); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ingreso { width: 100%; max-width: 400px; }
.ingreso__tarjeta { background: var(--superficie); border-radius: 16px; padding: 2rem 1.75rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); text-align: center; }
.ingreso__tarjeta .formulario { text-align: left; margin-top: 1.25rem; }
.ingreso__escudo { width: 96px; height: 96px; object-fit: contain; }
.ingreso__colegio { font-size: 1.35rem; margin: .5rem 0 .2rem; color: var(--principal); }
.ingreso__lema { margin: 0; color: var(--texto-tenue); }
.ingreso__vista-previa { background: var(--aviso-suave); color: var(--aviso); padding: .5rem .8rem; border-radius: 8px; text-align: center; }
.pagina-simple { background: var(--fondo); }
.instalar { max-width: 760px; margin: 2rem auto; padding: 0 1rem; }

/* ---------- Impresión ---------- */
.solo-impresion { display: none; }
@media print {
    @page { size: A4; margin: 12mm; }
    body { background: #fff; font-size: 11px; }
    .barra, .menu, .no-imprimir, .acciones, .filtros, .pestanas, form button, .alerta { display: none !important; }
    .solo-impresion { display: block; }
    .contenido { margin: 0; padding: 0; max-width: none; }
    .tarjeta, .tabla-scroll { box-shadow: none; border: 0; overflow: visible; }
    .tabla th, .tabla td { padding: 2px 4px; border: 1px solid #999; }
    .tabla thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .nota-aprobada, .nota-desaprobada, .escala, .pastilla { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: inherit; text-decoration: none; }
}

/* ---------- Administración ---------- */
.encabezado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.encabezado h1 { margin: 0; }
.acciones-fila { white-space: nowrap; }
.acciones-fila, .acciones-fila form { display: inline-flex; align-items: center; gap: .35rem; }
.acciones-fila form { margin: 0; }
.acciones--sin-margen { margin-top: 0; }
.entrada--corta { max-width: 5.5rem; }
.fila-inactiva td { color: var(--texto-tenue); }
.fila-inactiva .foto { opacity: .5; }
.opcion--bloque { display: flex; align-items: flex-start; gap: .5rem; padding: .3rem 0; }
.opcion--bloque input { margin-top: .3rem; }
.casillas { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.lista-simple { margin: 0 0 1rem; padding-left: 1.2rem; }
.barra-herramientas { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin: 1rem 0; }
.segmentado { display: inline-flex; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; background: var(--superficie); }
.segmentado button { border: 0; background: none; padding: .45rem .9rem; font: inherit; font-weight: 600; color: var(--texto-tenue); cursor: pointer; }
.segmentado button + button { border-left: 1px solid var(--borde); }
.segmentado .es-activo { background: var(--principal); color: var(--principal-texto); }
.credenciales { border: 2px dashed var(--principal); background: var(--superficie); border-radius: var(--radio); padding: 1rem 1.25rem; margin-bottom: 1rem; max-width: 520px; }
.credenciales__titulo { margin: 0 0 .5rem; font-weight: 700; }
.credenciales dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0 0 .5rem; }
.credenciales dt { color: var(--texto-tenue); }
.credenciales dd { margin: 0; }
.credenciales code { font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; }
.credenciales__nota { margin: 0; font-size: .88rem; color: var(--aviso); }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }

/* ---------- Horario semanal ---------- */
.horario td { vertical-align: top; min-width: 120px; }
.horario__hora { white-space: nowrap; width: 1%; }
.horario__hora small { color: var(--texto-tenue); font-weight: 400; }
.horario__clase { position: relative; background: color-mix(in srgb, var(--principal) 8%, white); border-left: 3px solid var(--principal); border-radius: 6px; padding: .35rem .5rem; padding-right: 1.8rem; }
.horario__clase + .horario__clase { margin-top: .3rem; }
.horario__clase strong { display: block; font-size: .88rem; }
.horario__clase small { display: block; color: var(--texto-tenue); font-size: .78rem; }
.horario__borrar { position: absolute; top: .1rem; right: .1rem; }

/* ---------- Notas ---------- */
.lista-clases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.lista-clases a { display: flex; flex-direction: column; padding: .75rem 1rem; border: 1px solid var(--borde); border-radius: var(--radio); text-decoration: none; color: var(--texto); background: var(--superficie); }
.lista-clases a:hover { border-color: var(--principal); box-shadow: var(--sombra); }
.lista-clases strong { color: var(--principal); }
.tabla--notas th { font-size: .82rem; }
.tabla--notas td.centro, .tabla--notas th.centro { text-align: center; }
.col-alumno { min-width: 210px; white-space: nowrap; }
.col-eval { min-width: 62px; max-width: 110px; white-space: normal !important; vertical-align: top; font-weight: 600; }
.col-eval__titulo { display: block; line-height: 1.2; }
.col-eval small { display: block; color: var(--texto-tenue); font-weight: 400; }
.col-eval .boton-icono { padding: 0; margin-top: .15rem; }
.grupo-comp--0 { background: #e9eef8 !important; }
.grupo-comp--1 { background: #f3eefa !important; }
.celda-nota { width: 3.6rem; text-align: center; font: inherit; font-weight: 600; padding: .3rem .2rem; border: 1px solid #c8ced8; border-radius: 6px; }
.celda-nota:focus { border-color: var(--principal); outline: 2px solid color-mix(in srgb, var(--principal) 30%, transparent); }
.celda-nota--error { border-color: var(--error); background: var(--error-suave); color: var(--error); }
.nota--fuerte { font-weight: 800; }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center; font-size: .86rem; margin-top: 1rem; }
.leyenda-competencias { font-size: .86rem; color: var(--texto-tenue); padding-left: 0; list-style: none; }
.oculto { display: none; }
.encabezado-impresion p { margin: 0 0 .15rem; }
.encabezado-impresion__colegio { font-size: 1.1rem; font-weight: 700; }
.promedio-general { display: inline-flex; align-items: center; gap: .6rem; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: .6rem 1rem; margin-bottom: 1rem; }
.promedio-general strong { font-size: 1.4rem; }
.curso__cabecera { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.curso__cabecera h2 { margin: 0; }
.curso__promedio { font-size: 1.2rem; }
.competencia { margin-top: .75rem; }
.competencia__nombre { font-weight: 600; margin: 0 0 .35rem; display: flex; justify-content: space-between; gap: 1rem; }
.competencia__prom { white-space: nowrap; }
.fila-subtotal td { background: var(--superficie-2); font-size: .85rem; color: var(--texto-tenue); }
.resumen--alumno { grid-template-columns: 1fr 1.3fr 1fr; align-items: stretch; }
.resumen--alumno .resumen__tarjeta { justify-content: center; text-align: center; }
.resumen__valor--grande { font-size: 2.8rem !important; display: inline-flex; gap: .5rem; align-items: center; justify-content: center; }
.resumen__valor--grande .escala { font-size: 1.6rem; }
@media (max-width: 700px) { .resumen--alumno { grid-template-columns: 1fr; } .resumen--alumno .resumen__tarjeta--destacada { order: -1; } }
.hijo { display: flex; gap: 1rem; align-items: flex-start; }
.hijo h2 { margin: 0; }
.hijo p { margin: .25rem 0; }
.selector-hijo { display: flex; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.selector-hijo select { font: inherit; padding: .35rem .5rem; border-radius: 8px; border: 1px solid #c8ced8; }

/* ---------- Puestos ---------- */
.podio { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; max-width: 720px; }
.podio__fila { display: flex; align-items: center; gap: .9rem; padding: .6rem .9rem; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); }
.podio__fila--top { border-color: color-mix(in srgb, var(--acento) 45%, white); }
.podio__fila--yo { box-shadow: 0 0 0 2px var(--principal); }
.podio__puesto { font-size: 1.3rem; font-weight: 800; min-width: 2.8rem; color: var(--principal); }
.podio__fila--top .podio__puesto { color: var(--acento); }
.podio__nombre { flex: 1; font-weight: 600; }
.podio__promedio { white-space: nowrap; font-size: 1.1rem; }
.tu-puesto p { margin: .2rem 0; }

@media print {
    .tabla--notas { font-size: 9px; }
    .celda-nota { border: 0; width: auto; padding: 0; }
    .grupo-comp--0, .grupo-comp--1 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .encabezado-impresion { margin-bottom: 8px; }
}

/* ---------- Libreta y situación final ---------- */
.libreta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; }
.libreta__cabecera { display: flex; align-items: center; gap: 1rem; border-bottom: 2px solid var(--principal); padding-bottom: .75rem; margin-bottom: .75rem; }
.libreta__escudo { width: 64px; height: 64px; object-fit: contain; }
.libreta__colegio { font-size: 1.25rem; font-weight: 800; margin: 0; color: var(--principal); }
.libreta__titulo { margin: 0; color: var(--texto-tenue); }
.libreta__datos { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0 0 1rem; }
.libreta__datos dt { font-size: .8rem; color: var(--texto-tenue); }
.libreta__datos dd { margin: 0; font-weight: 600; }
.libreta__area { background: var(--superficie-2); width: 9rem; vertical-align: top !important; }
.libreta__inicio-area td, .libreta__inicio-area th { border-top: 2px solid #c9d1de; }
.libreta__conclusion { margin: .2rem 0 0; font-size: .8rem; color: var(--texto-tenue); }
.libreta__pie { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.libreta__pie h2 { margin-top: 0; font-size: 1rem; }
.libreta__situacion { font-size: 1.2rem; font-weight: 800; color: var(--principal); margin: 0; }
.libreta__firmas { margin-top: 48px; grid-template-columns: repeat(3, 1fr); gap: 24px; text-align: center; }
.libreta__firmas span { border-top: 1px solid #333; padding-top: 4px; }
.conclusion__alumno { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 1rem; margin: 0 0 .5rem; }
.campo textarea { font: inherit; padding: .5rem .65rem; border: 1px solid #c8ced8; border-radius: 8px; width: 100%; resize: vertical; }
.barra-guardar { position: sticky; bottom: 0; background: var(--fondo); padding: .75rem 0; }
@media (max-width: 700px) { .libreta__pie { grid-template-columns: 1fr; } }
@media print {
    .libreta { border: 0; padding: 0; }
    .libreta__tabla { font-size: 9.5px; }
    .libreta__area { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .libreta__firmas { display: grid !important; }
}

/* ---------- Asistencia ---------- */
.resumen-dia { background: var(--superficie); border: 1px solid var(--borde); border-left: 4px solid var(--principal); border-radius: 8px; padding: .6rem .9rem; font-weight: 600; }
.estados { display: inline-flex; gap: .25rem; border: 0; padding: 0; margin: 0; }
.estado { position: relative; cursor: pointer; }
.estado input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.estado span:not(.sr-only) { display: inline-flex; align-items: center; justify-content: center; min-width: 2.2rem; height: 2rem; padding: 0 .35rem; border-radius: 8px; border: 1px solid #c8ced8; font-weight: 700; font-size: .85rem; color: var(--texto-tenue); background: #fff; }
.estado input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--principal) 50%, white); }
.estado--P input:checked + span { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.estado--T input:checked + span { background: #e09a00; border-color: #e09a00; color: #1d1d1d; }
.estado--TJ input:checked + span { background: #a1742a; border-color: #a1742a; color: #fff; }
.estado--F input:checked + span { background: #c62828; border-color: #c62828; color: #fff; }
.estado--FJ input:checked + span { background: #5f7487; border-color: #5f7487; color: #fff; }
.estado--vacio input:checked + span { background: var(--superficie-2); color: var(--texto); border-style: dashed; }
.entrada--hora { width: 7.2rem; }
.tabla--asistencia td { vertical-align: middle; }
.tabla--mes th, .tabla--mes td { padding: .2rem .15rem; }
.tabla--mes .pastilla { min-width: 1.6em; height: 1.4em; font-size: .7rem; }
.fin-de-semana { background: #f4f5f8; }
@media print { .tabla--mes { font-size: 8px; } .fin-de-semana { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- Ruleta ---------- */
.ruleta { display: grid; grid-template-columns: minmax(260px, 440px) 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .ruleta { grid-template-columns: 1fr; } }
.ruleta__rueda { position: relative; max-width: 440px; }
.ruleta__lienzo { width: 100%; height: auto; display: block; }
.ruleta__puntero { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 28px solid var(--acento); z-index: 2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.ruleta__panel { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; }
.ruleta__elegido { text-align: center; min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; }
.ruleta__nombre { font-size: 1.6rem; font-weight: 800; color: var(--principal); margin: 0; }
.ruleta__mensaje { color: var(--aviso); font-weight: 600; min-height: 1.2em; }
.ruleta__lista { margin: 0; padding-left: 1.4rem; max-height: 260px; overflow: auto; }
.boton--grande { font-size: 1.15rem; padding: .7rem 1.8rem; }

/* ---------- Cobranza ---------- */
.campo--ancho { min-width: min(420px, 100%); }
.rejilla--arriba { align-items: start; }
.fila-vencida td { background: #fff6f6; }
.fila-anulada td { color: var(--texto-tenue); text-decoration: line-through; }
.fila-anulada--motivo td { text-decoration: none; color: var(--error); font-size: .85rem; }
.entrada--monto { width: 7.5rem; text-align: right; }
.tabla--cobro td { vertical-align: middle; }
.fila-otro { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1.4fr) 8rem; gap: .5rem; margin-bottom: .5rem; }
@media (max-width: 700px) { .fila-otro { grid-template-columns: 1fr; } }
.total-cobro { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; justify-content: flex-end; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: .9rem 1rem; position: sticky; bottom: 0; }
.total-cobro strong { font-size: 1.6rem; color: var(--principal); }
.resumen--caja { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1000px) { .resumen--caja { grid-template-columns: repeat(3, 1fr); } }
.resumen__valor--chico { font-size: 1.2rem; }
.anular { display: inline-block; position: relative; }
.anular > summary { list-style: none; }
.anular__form { position: absolute; right: 0; z-index: 5; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: .75rem; display: grid; gap: .4rem; width: 260px; }
.zona-peligro { border-color: #f0b4af; background: #fffafa; }
.sin-borde { border: 0 !important; padding: 0 !important; margin: 0; min-width: 0; }
.fila-hijo { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.fila-vincular { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--borde); }
.parentesco { display: inline-flex; align-items: center; gap: .4rem; }
.tabla--estado .etiqueta { font-size: .7rem; padding: .05rem .35rem; }

/* ---------- Ajustes para celular ---------- */
.resumen { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
@media (max-width: 700px) {
    h1 { font-size: 1.3rem; }
    .resumen, .resumen--caja, .resumen--linea { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .resumen__valor { font-size: 1.35rem; }
    .resumen__tarjeta { padding: .75rem; }
    .tabla th, .tabla td { padding: .4rem .45rem; }
    .tabla .foto--mini { display: none; }
    .col-alumno { min-width: 150px; white-space: normal; }
    /* El nombre del alumno queda fijo al desplazar la tabla de notas */
    .tabla--notas .col-alumno { position: sticky; left: 0; z-index: 1; background: var(--superficie); box-shadow: 2px 0 0 var(--borde); }
    .tabla--notas thead .col-alumno { background: var(--superficie-2); }
    .estados { flex-wrap: wrap; width: 6.9rem; min-width: 6.9rem; }
    .estado span:not(.sr-only) { min-width: 1.9rem; height: 1.8rem; }
    .encabezado .acciones .boton { flex: 1 1 auto; }
    .filtros .campo { flex: 1 1 140px; }
    .total-cobro { justify-content: space-between; }
    .total-cobro .boton { width: 100%; }
    .podio__fila { gap: .5rem; padding: .5rem .6rem; }
    .podio__fila .foto--mediana { width: 40px; height: 40px; }
}
.salida { background: #111827; color: #e5e7eb; padding: .75rem 1rem; border-radius: 8px; overflow: auto; font-size: .82rem; white-space: pre-wrap; }
