/* ==========================================================================
   Informe de desarrollo de preescolar (K2-K5) en el portal de familias.
   Lo dibuja portal-preescolar.js (window.PREINF) dentro de .pre-inf; el diseño sale de §13.3 / §13.5 del spec.

   Los tokens viven en .pre-inf y NO en :root: portal.css ya define --ink y --muted para el resto del portal y una colisión
   cambiaría el color de todo lo demás. Los colores de nivel sirven para el PUNTO y el BORDE, nunca para texto: sobre su fondo
   suave, --basico llega a 4.25:1 y el mínimo es 4.5:1. El texto del nivel va en --ink, y por eso el informe también se lee en
   escala de grises (los puntos llenos cuentan el nivel aunque no se vea el color).
   Sin oklch(from …): los teléfonos viejos no lo parsean y la regla entera se descarta.

   IMPRESIÓN: el bloque `@media print` del final lleva un `@page` (carta, margen de 0,75 in) y un fondo blanco en html/body. `@page` NO se puede
   acotar con un selector: es del DOCUMENTO, y esta hoja se carga en todo el portal. Así que esas dos reglas valen para CUALQUIER página que una
   familia imprima (horario, notas, comunicados), no solo el informe de preescolar, y llegan a todas las familias. Se aceptó a propósito: carta es
   el papel del colegio y portal.css no trae ninguna regla de impresión propia (antes se imprimía con lo que decidiera cada navegador). No se
   reemplaza por cargar la hoja a demanda: es más maquinaria de la que vale un efecto cosmético. Quien toque ese bloque: ya no es solo de preescolar.
   ========================================================================== */
.pre-inf {
  --ink: #1B2521; --muted: #5B6862; --rule: #D5DCD6; --sunk: #E9EDE7; --surface: #FFFFFF;
  --accent: #2C6B5A; --accent-soft: #DCEBE4;
  --bajo: #9A3412; --bajo-soft: #FBE4D6;
  --basico: #B45309; --basico-soft: #F8EBCF;
  --alto: #2C6B5A; --alto-soft: #DCEBE4;
  --superior: #1F4E79; --superior-soft: #DCE6F4;
  display: flex; flex-direction: column; gap: 14px;
  font: 400 15px/1.55 var(--f-body, system-ui, sans-serif); color: var(--ink);
}
.pre-inf p, .pre-inf h2, .pre-inf h3, .pre-inf h4, .pre-inf ul, .pre-inf ol { margin: 0; }
.pre-inf ul, .pre-inf ol { padding: 0; }

/* ---- cabecera y titulares ---- */
.pre-cab { display: flex; flex-direction: column; gap: 2px; }
.pre-cab-sup { font: 600 12.5px var(--f-body, sans-serif); letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.pre-cab-nombre { font: 700 26px/1.2 var(--f-subhead, Georgia, serif); color: var(--ink); }
.pre-cab-sub { font-size: 14px; color: var(--muted); }
.pre-tt { font: 700 16px/1.3 var(--f-subhead, sans-serif); color: var(--ink); }
.pre-tt--vista { font-size: 19px; }

.pre-tarjeta { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; }
.pre-cargando { color: var(--muted); }
.pre-vacio-informe p { color: var(--ink); font-size: 15px; }

/* ---- selector de trimestre: solo existe si hay más de uno ---- */
.pre-sel-tri { display: flex; flex-wrap: wrap; gap: 8px; }
.pre-trim-chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink); font: 600 14px var(--f-body, sans-serif); cursor: pointer; }
.pre-trim-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); border-width: 2px; }
.pre-trim-chip:focus-visible, .pre-btn:focus-visible, .pre-acordeon > summary:focus-visible { outline: 3px solid var(--superior); outline-offset: 2px; }

/* ---- las tres frases ---- */
.pre-tres-frases { display: flex; flex-direction: column; gap: 10px; }
.pre-frase { display: flex; flex-direction: column; gap: 4px; }
.pre-frase-dim { font: 600 12px var(--f-body, sans-serif); letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.pre-frase-tx { white-space: pre-line; }

/* ---- conteo y barra ---- */
.pre-conteo { display: flex; flex-direction: column; gap: 12px; }
.pre-distribucion { display: flex; flex-direction: column; gap: 10px; }
.pre-barra { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--sunk); }
.pre-seg { min-width: 6px; }
.pre-seg--superior { background: var(--superior); }
.pre-seg--alto { background: var(--alto); }
.pre-seg--basico { background: var(--basico); }
.pre-seg--bajo { background: var(--bajo); }
.pre-leyenda { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.pre-leyenda-it { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pre-leyenda-pto { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pre-leyenda-pto--superior { background: var(--superior); }
.pre-leyenda-pto--alto { background: var(--alto); }
.pre-leyenda-pto--basico { background: var(--basico); }
.pre-leyenda-pto--bajo { background: var(--bajo); }
.pre-leyenda-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.pre-leyenda-tx { color: var(--ink); }

/* ---- fortalezas / en qué estamos trabajando ---- */
.pre-listas { display: flex; flex-direction: column; gap: 14px; }
.pre-lista { display: flex; flex-direction: column; gap: 6px; }
.pre-lista ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pre-lista li { position: relative; padding-left: 16px; white-space: pre-line; }
.pre-lista li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---- cómo acompañar en casa ---- */
.pre-acompanar { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.pre-acompanar ol { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.pre-acompanar li { white-space: pre-line; }

/* ---- botones ---- */
.pre-acciones { display: flex; flex-direction: column; gap: 10px; }
.pre-btn { min-height: 48px; padding: 0 18px; border-radius: 12px; font: 700 15px var(--f-body, sans-serif); cursor: pointer; border: 2px solid var(--accent); }
.pre-btn--sec { background: var(--surface); color: var(--ink); }
.pre-btn--pri { background: var(--accent); color: #fff; }
.pre-btn--volver { align-self: flex-start; min-height: 44px; border-width: 1px; border-color: var(--rule); background: var(--surface); color: var(--ink); }

/* ---- el chip de nivel: 4 puntos + texto en --ink; el nivel lo llevan el punto y el borde ---- */
.pre-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 999px;
  border: 2px solid var(--rule); background: var(--sunk); color: var(--ink); font: 700 13.5px var(--f-body, sans-serif); white-space: nowrap; }
.pre-chip--compact { padding: 3px 10px 3px 8px; gap: 6px; font-size: 12.5px; border-width: 1.5px; }
.pre-chip-puntos { display: inline-flex; gap: 3px; }
.pre-punto, .pre-punto--on { width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; }
.pre-punto { border: 1.5px solid #767676; background: transparent; }
.pre-chip--bajo { border-color: var(--bajo); background: var(--bajo-soft); }
.pre-chip--basico { border-color: var(--basico); background: var(--basico-soft); }
.pre-chip--alto { border-color: var(--alto); background: var(--alto-soft); }
.pre-chip--superior { border-color: var(--superior); background: var(--superior-soft); }
.pre-chip--bajo .pre-punto--on { background: var(--bajo); }
.pre-chip--basico .pre-punto--on { background: var(--basico); }
.pre-chip--alto .pre-punto--on { background: var(--alto); }
.pre-chip--superior .pre-punto--on { background: var(--superior); }
/* Un punto lleno y uno vacío se distinguen por relleno Y por borde, no solo por color. */
.pre-chip--bajo .pre-punto { border-color: var(--bajo); }
.pre-chip--basico .pre-punto { border-color: var(--basico); }
.pre-chip--alto .pre-punto { border-color: var(--alto); }
.pre-chip--superior .pre-punto { border-color: var(--superior); }
.pre-leyenda-niveles { display: flex; flex-wrap: wrap; gap: 6px 8px; }

/* ---- detalle por asignatura ---- */
.pre-acordeones { display: flex; flex-direction: column; gap: 10px; }
.pre-acordeon { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.pre-acordeon > summary { display: flex; flex-direction: column; gap: 2px; padding: 13px 44px 13px 16px; min-height: 48px; cursor: pointer;
  list-style: none; position: relative; justify-content: center; }
.pre-acordeon > summary::-webkit-details-marker { display: none; }
.pre-acordeon > summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-70%) rotate(45deg); transition: transform .15s; }
.pre-acordeon[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
.pre-acordeon-tt { font: 700 16px/1.3 var(--f-subhead, sans-serif); }
.pre-res-linea { font-size: 13.5px; color: var(--muted); }
.pre-acordeon-cuerpo { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 16px; border-top: 1px solid var(--rule); }
.pre-dim-grupo { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.pre-dim-tt { font: 600 12px/1.4 var(--f-body, sans-serif); letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.pre-filas { list-style: none; display: flex; flex-direction: column; }
.pre-fila { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 0; border-top: 1px solid var(--rule); }
.pre-fila:first-child { border-top: 0; }
.pre-fila-tx { white-space: pre-line; }

/* ---- comentarios de las docentes ---- */
.pre-com-lista { display: flex; flex-direction: column; gap: 10px; }
.pre-com-tarjeta { display: flex; flex-direction: column; gap: 10px; }
.pre-com-materia { font: 700 15.5px/1.3 var(--f-subhead, sans-serif); }
.pre-com-docente { font-size: 13.5px; color: var(--muted); }
.pre-com-cuerpo { display: flex; flex-direction: column; gap: 10px; }
.pre-com-tx, .pre-com-casa-tx { white-space: pre-line; }
.pre-com-tx--nino { border-left: 3px solid var(--accent); padding-left: 12px; }
.pre-com-voz { font-size: 13px; color: var(--muted); }
.pre-com-casa { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; }
.pre-com-casa-tt { font: 700 12px var(--f-body, sans-serif); letter-spacing: .4px; text-transform: uppercase; margin-bottom: 2px; }

/* ---- pantallas anchas: la misma página, con más aire ---- */
@media (min-width: 720px) {
  .pre-acciones { flex-direction: row; }
  .pre-acciones .pre-btn { flex: 1; }
  .pre-listas { flex-direction: row; }
  .pre-lista { flex: 1; }
  .pre-fila { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; }
  .pre-com-tarjeta { flex-direction: row; gap: 20px; }
  .pre-com-quien { flex: 0 0 170px; }
  .pre-com-cuerpo { flex: 1; min-width: 0; }
}

/* texto del descriptor y, si existe, su traducción debajo */
.pre-fila-bloque { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pre-fila-en { font-size: 13.5px; color: var(--muted); white-space: pre-line; }

/* ==========================================================================
   La ruta de impresión (#informe-print): hojas carta 816×1056 que la familia imprime y firma a mano (§7.5, §13.4).
   En pantalla es una vista previa (cada hoja como un papel); con @media print solo queda el papel. Nada baja de 11px, no hay
   fondos oscuros grandes y el nivel se lee en escala de grises: lo llevan los puntos llenos y el texto, no el color.
   ========================================================================== */
#pre-print { position: fixed; inset: 0; z-index: 2000; overflow: auto; background: #E9EDE7; padding: 0 0 40px; }
.pre-imp-barra { position: sticky; top: 0; z-index: 1; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid #D5DCD6; }
.pre-imp-barra p { margin: 0; font-size: 14px; color: #5B6862; }
.pre-imp-barra-bt { display: flex; gap: 10px; }
.pre-imp-hojas { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 20px 0; }
.pre-imp-hojas .pre-hoja { width: 816px; max-width: 100%; min-height: 1056px; box-sizing: border-box; padding: 72px; background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.pre-imp-vacio { background: #fff; padding: 24px; border-radius: 12px; max-width: 560px; }

.pre-hoja { --ink: #1B2521; --muted: #4F5C56; --rule: #B8C2BB; --sunk: #EEF1EC; --surface: #FFFFFF;
  --accent: #2C6B5A; --accent-soft: #DCEBE4;
  --bajo: #9A3412; --bajo-soft: #FBE4D6; --basico: #B45309; --basico-soft: #F8EBCF; --alto: #2C6B5A; --alto-soft: #DCEBE4;
  --superior: #1F4E79; --superior-soft: #DCE6F4;
  display: flex; flex-direction: column; gap: 14px; font: 400 13px/1.45 var(--f-body, system-ui, sans-serif); color: var(--ink); }
.pre-hoja p, .pre-hoja h2, .pre-hoja h3, .pre-hoja ul, .pre-hoja ol { margin: 0; }
.pre-hoja ul, .pre-hoja ol { padding: 0; }
.pre-hoja .pre-tt { font-size: 15px; }

.pre-imp-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.pre-imp-cab-izq { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pre-imp-cab-der { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; white-space: nowrap; font-size: 12px; color: var(--muted); }
.pre-imp-nombre { font: 700 34px/1.15 var(--f-subhead, Georgia, serif); }
.pre-imp-cab-tt { font: 700 16px/1.3 var(--f-subhead, Georgia, serif); }
.pre-imp-pag { font-weight: 700; color: var(--ink); }
.pre-hoja .pre-cab-sup, .pre-hoja .pre-cab-sub { font-size: 12px; color: var(--muted); }

.pre-imp-bloque { display: flex; flex-direction: column; gap: 8px; }
.pre-imp-frases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pre-imp-frase { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.pre-hoja .pre-frase-dim { font-size: 11px; }
.pre-hoja .pre-frase-tx { font-size: 12.5px; }
.pre-imp-listas { flex-direction: row; gap: 20px; }
.pre-imp-listas .pre-lista { flex: 1; }
.pre-hoja .pre-acompanar { border: 1px solid var(--rule); }
.pre-imp-pie { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--rule); }
.pre-hoja .pre-leyenda { grid-template-columns: repeat(4, auto); justify-content: start; }
.pre-hoja .pre-leyenda-it { font-size: 12px; }
.pre-hoja .pre-chip--compact { font-size: 12px; }
.pre-hoja .pre-barra { height: 12px; border-radius: 0; gap: 3px; }

.pre-imp-materia { display: flex; flex-direction: column; gap: 4px; break-inside: avoid; page-break-inside: avoid; }
.pre-imp-mat-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding-bottom: 4px; border-bottom: 1.5px solid var(--ink); }
.pre-imp-mat-tt { font: 700 18px/1.3 var(--f-subhead, Georgia, serif); }
.pre-hoja .pre-res-linea { font-size: 12px; color: var(--muted); text-align: right; }
.pre-imp-filas { list-style: none; display: flex; flex-direction: column; }
.pre-imp-fila { display: grid; grid-template-columns: 1fr 168px; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--rule); break-inside: avoid; }
.pre-imp-fila:first-child { border-top: 0; }
.pre-imp-fila .pre-chip { justify-self: start; }
.pre-imp-dim { font-size: 11px; color: var(--muted); }
.pre-hoja .pre-fila-en { font-size: 12px; }

.pre-imp-com { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); break-inside: avoid; }
.pre-hoja .pre-com-materia { font-size: 14px; }
.pre-hoja .pre-com-docente, .pre-hoja .pre-com-voz { font-size: 12px; color: var(--muted); }

.pre-imp-firma { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 18px; break-inside: avoid; }
.pre-imp-firma-fila { display: grid; grid-template-columns: 1fr 180px; gap: 24px; }
.pre-imp-firma-campo { display: flex; flex-direction: column; gap: 2px; padding-top: 34px; border-bottom: 1.5px solid var(--ink); }
.pre-imp-firma-campo .pre-imp-firma-rot { order: 2; font-size: 12px; }
.pre-imp-firma-sub { order: 3; font-size: 11px; color: var(--muted); }
.pre-imp-firma-rot { font: 700 12px var(--f-body, sans-serif); }
.pre-imp-firma-com { display: flex; flex-direction: column; gap: 22px; }
.pre-imp-linea { border-bottom: 1px solid var(--ink); height: 18px; }

@media print {
  @page { size: letter; margin: 72px; }
  html, body { background: #fff !important; }
  body.pre-imprimiendo > *:not(#pre-print) { display: none !important; }
  #pre-print { position: static; overflow: visible; background: #fff; padding: 0; }
  .pre-imp-barra { display: none !important; }
  .pre-imp-hojas { display: block; padding: 0; }
  .pre-imp-hojas .pre-hoja { width: auto; min-height: 0; padding: 0; box-shadow: none; max-width: none; break-after: page; page-break-after: always; }
  .pre-imp-hojas .pre-hoja:last-child { break-after: auto; page-break-after: auto; }
  /* Los puntos, la barra y los fondos suaves SON la información del nivel: sin esto el navegador los quita al imprimir. */
  .pre-hoja, .pre-hoja * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pre-imp-materia, .pre-imp-fila, .pre-imp-com, .pre-imp-firma { break-inside: avoid; }
}
