/* Estilo formal y sobrio. Los colores institucionales se cambian solo en estas variables. */
:root {
  --color-principal: #1b2a49;
  --color-principal-oscuro: #111c33;
  --color-acento: #8a6a14;
  --color-fondo: #f3f4f7;
  --color-superficie: #ffffff;
  --color-texto: #1a1d24;
  --color-suave: #4a5160;
  --color-borde: #c9ceda;
  --color-error: #9b1c1c;
  --color-error-fondo: #fdecec;
  --radio: 8px;
  --sombra: 0 1px 3px rgba(17, 28, 51, 0.12);
}

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

html { font-size: 100%; }

body {
  margin: 0;
  background: var(--color-fondo);
  color: var(--color-texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.saltar {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-acento);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 10;
}
.saltar:focus { left: 0; }

.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Barra superior */
.barra {
  background: var(--color-principal);
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid var(--color-acento);
}
.barra__marca { display: flex; align-items: center; gap: 0.75rem; }
.barra__marca strong { display: block; font-size: 1.15rem; letter-spacing: 0.02em; }
.barra__sub { font-size: 0.9rem; opacity: 0.9; }
.barra__sello {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: #fff;
  color: var(--color-principal);
  font-weight: 700;
  font-size: 1.4rem;
  display: grid;
  place-items: center;
}
.barra__usuario { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.barra__usuario form { margin: 0; }

main {
  flex: 1;
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}
main:focus { outline: none; }

h1 { color: var(--color-principal); font-size: 1.6rem; margin: 0 0 1rem; }
h2 { color: var(--color-principal); font-size: 1.2rem; margin: 0 0 0.75rem; }

.tarjeta {
  background: var(--color-superficie);
  border: 1px solid var(--color-borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.tarjeta--acceso { max-width: 26rem; margin: 2rem auto; }

.ayuda { color: var(--color-suave); margin-top: 0; }
.vacio { color: var(--color-suave); margin: 0; }

/* Formularios y botones: objetivos táctiles de al menos 48 px */
.campo { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.75rem;
  font-size: 1.0625rem;
  border: 2px solid var(--color-suave);
  border-radius: var(--radio);
  background: #fff;
  color: var(--color-texto);
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--color-principal);
  border: 2px solid var(--color-principal);
  border-radius: var(--radio);
  cursor: pointer;
  text-decoration: none;
}
.boton:hover { background: var(--color-principal-oscuro); }
.boton--bloque { width: 100%; }
.boton--secundario { background: transparent; color: #fff; border-color: #fff; }
.boton--secundario:hover { background: rgba(255, 255, 255, 0.15); }

:focus-visible {
  outline: 3px solid var(--color-acento);
  outline-offset: 2px;
}
.barra :focus-visible { outline-color: #fff; }

.aviso { padding: 0.75rem 1rem; border-radius: var(--radio); margin-bottom: 1rem; }
.aviso--error {
  background: var(--color-error-fondo);
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

/* Tablas */
.tabla-contenedor { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--color-borde); vertical-align: top; overflow-wrap: anywhere; }
thead th { background: var(--color-fondo); color: var(--color-principal); }

/* Clases de hoy */
.lista-clases { list-style: none; margin: 0; padding: 0; }
.lista-clases li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-borde);
}
.lista-clases li:last-child { border-bottom: 0; }
.lista-clases span { display: block; color: var(--color-suave); }
.lista-clases .etiqueta { display: inline-block; }

.etiqueta {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--color-principal);
  color: var(--color-principal);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* Resumen del administrador */
.resumen {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}
.resumen li {
  background: var(--color-superficie);
  border: 1px solid var(--color-borde);
  border-left: 5px solid var(--color-acento);
  border-radius: var(--radio);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
}
.resumen__n { font-size: 2rem; font-weight: 700; color: var(--color-principal); line-height: 1.1; }

/* Menú del administrador */
.menu {
  background: var(--color-principal-oscuro);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0 1rem;
}
.menu a {
  color: #fff;
  text-decoration: none;
  padding: 0.85rem 1rem;
  min-height: 3rem;
  border-bottom: 3px solid transparent;
}
.menu a:hover { background: rgba(255, 255, 255, 0.12); }
.menu a[aria-current="page"] { border-bottom-color: var(--color-acento); font-weight: 700; }
.menu :focus-visible { outline-color: #fff; }

/* Controles de formulario */
select, textarea, input[type="number"], input[type="date"], input[type="time"] {
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.75rem;
  font: inherit;
  border: 2px solid var(--color-suave);
  border-radius: var(--radio);
  background: #fff;
  color: var(--color-texto);
}
.campo--casilla { display: flex; gap: 0.6rem; align-items: flex-start; }
.campo--casilla input { width: 1.4rem; height: 1.4rem; margin-top: 0.2rem; flex: none; }
.campo--casilla label { font-weight: 400; margin: 0; }
.formulario { max-width: 34rem; }
.formulario--fila { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; max-width: none; margin-top: 1rem; }
.formulario--fila .campo { margin: 0; flex: 1 1 14rem; }
.formulario h3 { font-size: 1.05rem; margin: 1rem 0 0.25rem; color: var(--color-principal); }
.en-linea { display: inline; margin: 0; }
.opciones { border: 0; padding: 0; margin: 0 0 1rem; }
.opciones legend { font-weight: 600; padding: 0; margin-bottom: 0.5rem; }

.boton--chico { min-height: 2.75rem; padding: 0.4rem 0.9rem; font-size: 1rem; }
.boton--claro { background: #fff; color: var(--color-principal); }
.boton--claro:hover { background: var(--color-fondo); }
.enlace-boton {
  background: none; border: 0; padding: 0.25rem 0.1rem; font: inherit; cursor: pointer;
  color: var(--color-principal); text-decoration: underline; min-height: 2.75rem;
}

.encabezado-pagina { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.encabezado-pagina h1, .encabezado-pagina h2, .encabezado-pagina p { margin-bottom: 0; }
.migas { margin: 0 0 0.5rem; }

.aviso--ok { background: #e8f4ec; color: #14532d; border: 1px solid #14532d; }
.aviso--alerta { background: #fff6e0; color: #6b4a00; border: 1px solid #8a6a14; }

details { margin-bottom: 0.5rem; }
summary { cursor: pointer; font-weight: 600; color: var(--color-principal); min-height: 2.75rem; display: flex; align-items: center; }
details[open] { background: var(--color-fondo); border-radius: var(--radio); padding: 0 0.75rem 0.75rem; }
.detalle { display: block; font-size: 0.95rem; color: var(--color-suave); }

.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem 1.5rem; margin: 0; }
.datos dt { font-size: 0.9rem; color: var(--color-suave); }
.datos dd { margin: 0; font-weight: 600; }

.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--color-borde); }

/* Avisos */
.mensaje-aviso { background: var(--color-fondo); border-left: 4px solid var(--color-acento); border-radius: var(--radio); padding: 0.75rem 1rem; margin: 0.5rem 0; }
.lista-contactos li { align-items: flex-start; flex-wrap: wrap; }
code { background: var(--color-fondo); padding: 0.1rem 0.35rem; border-radius: 4px; }

/* Estadísticas */
.etiqueta--libre { display: inline-block; text-transform: none; }
.pestanas { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 2px solid var(--color-borde); margin-bottom: 1rem; }
.pestanas a {
  padding: 0.7rem 1rem; min-height: 2.9rem; color: var(--color-principal); text-decoration: none;
  border: 2px solid transparent; border-bottom: 0; border-radius: var(--radio) var(--radio) 0 0;
}
.pestanas a:hover { background: #e6e9f1; }
.pestanas a[aria-current="page"] { background: var(--color-superficie); border-color: var(--color-borde); font-weight: 700; margin-bottom: -2px; }
.filtros { background: var(--color-superficie); border: 1px solid var(--color-borde); border-radius: var(--radio); padding: 0 1rem; margin-bottom: 1rem; }
.filtros[open] { padding-bottom: 1rem; }
.filtros .formulario--fila { margin-top: 0; }
.pct { display: inline-flex; flex-direction: column; gap: 0.2rem; min-width: 6.5rem; }
.barra-pct { display: block; height: 0.5rem; background: #dfe3ec; border-radius: 999px; overflow: hidden; }
.barra-pct > span { display: block; height: 100%; background: var(--color-principal); }
.resumen a { color: inherit; text-decoration: none; display: flex; flex-direction: column; height: 100%; }
.resumen a:hover .resumen__n { text-decoration: underline; }
.resumen li.resumen__alerta { border-left-color: #9b1c1c; background: #fff7f7; }

/* Administración */
.enlace-barra { color: #fff; }
.clave {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  background: var(--color-fondo);
  border: 2px dashed var(--color-principal);
  border-radius: var(--radio);
  user-select: all;
}
.lista-puntos { margin: 0; padding-left: 1.2rem; }
.lista-puntos li { margin-bottom: 0.5rem; }
.paginas { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* Pase de lista */
.oculto { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tarjeta--alerta { border-left: 5px solid var(--color-acento); }
.clase-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; justify-content: flex-end; }

.contadores { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.contador { background: var(--color-superficie); border: 1px solid var(--color-borde); border-radius: 999px; padding: 0.3rem 0.9rem; }
.contador strong { font-size: 1.15rem; margin-right: 0.25rem; }
.contador--presente { border-color: #14532d; }
.contador--falta { border-color: #9b1c1c; }
.contador--retardo { border-color: #8a6a14; }

.alumno {
  background: var(--color-superficie);
  border: 1px solid var(--color-borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 0.75rem;
}
.alumno legend { font-weight: 700; font-size: 1.1rem; color: var(--color-principal); padding: 0 0.4rem; }
.segmentos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.segmentos input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmento {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  margin: 0;
  padding: 0.4rem;
  text-align: center;
  font-weight: 600;
  border: 2px solid var(--color-borde);
  border-radius: var(--radio);
  background: #fff;
  cursor: pointer;
}
.segmentos input:focus-visible + .segmento { outline: 3px solid var(--color-acento); outline-offset: 2px; }
.segmentos input:disabled + .segmento { cursor: default; opacity: 0.75; }
.segmentos input:checked + .segmento--presente { background: #14532d; border-color: #14532d; color: #fff; }
.segmentos input:checked + .segmento--falta { background: #9b1c1c; border-color: #9b1c1c; color: #fff; }
.segmentos input:checked + .segmento--retardo { background: #8a6a14; border-color: #8a6a14; color: #fff; }
.segmentos input:checked + .segmento::before { content: "\2713\00a0"; }
.justificar { margin-top: 0.5rem; }

.barra-acciones {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 0;
  background: var(--color-fondo);
  border-top: 1px solid var(--color-borde);
}

.etiqueta--programada { border-color: #1b2a49; color: #1b2a49; }
.etiqueta--impartida { border-color: #14532d; color: #14532d; background: #e8f4ec; }
.etiqueta--pospuesta { border-color: #6b4a00; color: #6b4a00; background: #fff6e0; }
.etiqueta--cancelada { border-color: #9b1c1c; color: #9b1c1c; background: #fdecec; }

.pie { text-align: center; color: var(--color-suave); font-size: 0.9rem; padding: 1rem; }

@media (max-width: 40rem) {
  main { padding: 1rem 0.75rem 2rem; }
  .barra__usuario { width: 100%; justify-content: space-between; }
  .barra { padding: 0.5rem 0.75rem; }
  .datos { grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
  .datos dd { font-size: 0.95rem; }
  .tarjeta { padding: 1rem; }

  /* En celular, cada fila de la tabla se muestra como una tarjeta legible. */
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; left: -999px; }
  tr { border: 1px solid var(--color-borde); border-radius: var(--radio); margin-bottom: 0.75rem; padding: 0.25rem 0; }
  th[scope="row"] { border-bottom: 1px solid var(--color-borde); color: var(--color-principal); }
  td { border-bottom: 0; padding: 0.35rem 0.75rem; }
  td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--color-suave); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
