/* Portal GM — identidad tomada del escudo: azul del campo, rojo y blanco de la franja, verde de los laureles. */
:root {
  --noche: #163F66;
  --azul: #1F5F99;
  --cielo: #DCE8F3;
  --rojo: #C62828;
  --laurel: #1E7B34;
  --oro: #E0A800;
  --fondo: #F2F4F7;
  --papel: #FFFFFF;
  --tinta: #1B2430;
  --gris: #5B6573;
  --linea: #DDE2E8;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(22, 63, 102, .08), 0 8px 24px rgba(22, 63, 102, .06);
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
a { color: var(--azul); }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 750; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
.tenue { color: var(--gris); font-size: .9rem; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Ingreso ---------- */
.ingreso {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, var(--noche) 0, var(--noche) 42%, var(--fondo) 42%);
}
.ingreso__caja {
  width: 100%; max-width: 400px;
  background: var(--papel);
  border-radius: 20px;
  box-shadow: var(--sombra);
  overflow: hidden;
}
.franja { display: grid; grid-template-columns: 1fr 1fr 1fr; height: 8px; }
.franja span:nth-child(1), .franja span:nth-child(3) { background: var(--rojo); }
.franja span:nth-child(2) { background: #fff; }
.ingreso__cuerpo { padding: 28px 26px 26px; }
.ingreso__escudo { width: 92px; margin: 0 auto 14px; }
.ingreso h1 { text-align: center; font-size: 1.45rem; }
.ingreso .tenue { text-align: center; margin-top: 4px; margin-bottom: 22px; }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo label { font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; color: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--linea);
  border-radius: 10px;
  background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px var(--cielo); }
textarea { min-height: 120px; resize: vertical; }
.fila { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.boton {
  font: inherit; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 0;
  background: var(--azul); color: #fff;
  cursor: pointer; text-decoration: none;
  min-height: 46px;
}
.boton:hover { background: var(--noche); }
.boton--ancho { width: 100%; }
.boton--suave { background: var(--cielo); color: var(--noche); }
.boton--suave:hover { background: #cddcec; }
.boton--peligro { background: transparent; color: var(--rojo); padding: 8px 10px; min-height: 0; }
.boton--peligro:hover { background: #fdecec; }
.boton[disabled] { opacity: .6; cursor: progress; }
.aviso { padding: 12px 14px; border-radius: 10px; font-size: .92rem; margin-bottom: 14px; }
.aviso--error { background: #fdecec; color: #8e1c1c; }
.aviso--ok { background: #e6f4ea; color: #155d27; }

/* ---------- Estructura ---------- */
.marco { min-height: 100vh; min-height: 100dvh; }
.cabecera {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--noche); color: #fff;
}
.cabecera img { width: 34px; }
.cabecera strong { font-size: 1rem; }
.cabecera .tenue { color: #b9cde2; font-size: .8rem; display: block; line-height: 1.2; }
.contenido { padding: 18px 16px 110px; max-width: 920px; margin: 0 auto; }
.titulo { margin: 6px 0 18px; }
.titulo p { margin-top: 4px; }

.menu-abajo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--papel);
  border-top: 1px solid var(--linea);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.menu-abajo a {
  display: grid; justify-items: center; gap: 2px;
  padding: 8px 2px 10px;
  font-size: .72rem; font-weight: 600;
  color: var(--gris); text-decoration: none;
}
.menu-abajo a svg { width: 24px; height: 24px; }
.menu-abajo a[aria-current="page"] { color: var(--azul); }
.menu-abajo a[aria-current="page"] svg { stroke-width: 2.4; }
.menu-lado { display: none; }

@media (min-width: 900px) {
  .marco { display: grid; grid-template-columns: 250px 1fr; }
  .cabecera { display: none; }
  .menu-abajo { display: none; }
  .menu-lado {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh;
    padding: 22px 14px;
    background: var(--noche); color: #fff;
  }
  .menu-lado__marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
  .menu-lado__marca img { width: 44px; }
  .menu-lado__marca strong { display: block; font-size: 1rem; }
  .menu-lado__marca span { color: #b9cde2; font-size: .8rem; }
  .menu-lado a, .menu-lado button {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: #dbe7f3; text-decoration: none; font: inherit; font-weight: 550;
    background: none; border: 0; cursor: pointer; text-align: left;
  }
  .menu-lado a svg, .menu-lado button svg { width: 20px; height: 20px; }
  .menu-lado a:hover, .menu-lado button:hover { background: rgba(255, 255, 255, .08); }
  .menu-lado a[aria-current="page"] { background: #fff; color: var(--noche); }
  .menu-lado .separador { flex: 1; }
  .contenido { padding: 34px 40px 60px; }
}

/* ---------- Carnet (elemento principal del inicio) ---------- */
.carnet {
  position: relative;
  background: var(--papel);
  border-radius: 18px;
  box-shadow: var(--sombra);
  overflow: hidden;
  margin-bottom: 22px;
}
.carnet__banda {
  background: var(--noche); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  font-size: .85rem;
}
.carnet__banda b { font-weight: 650; }
.carnet__cuerpo { display: grid; grid-template-columns: 76px 1fr; gap: 16px; padding: 18px; align-items: center; }
.carnet__cuerpo img { width: 76px; }
.carnet__nombre { font-size: 1.35rem; font-weight: 750; line-height: 1.15; }
.carnet__datos { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: .9rem; color: var(--gris); }
.carnet__datos b { color: var(--tinta); font-weight: 650; }
.carnet .franja { height: 6px; }

.acceso-aula {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; margin-bottom: 26px;
  background: var(--laurel); color: #fff;
  border-radius: var(--radio);
  text-decoration: none;
}
.acceso-aula:hover { background: #17652a; }
.acceso-aula svg { width: 30px; height: 30px; flex: none; }
.acceso-aula strong { display: block; font-size: 1.05rem; }
.acceso-aula span { font-size: .85rem; opacity: .9; }

/* ---------- Bloques y listas ---------- */
.bloque { margin-bottom: 28px; }
.bloque__cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.bloque__cabeza a { font-size: .9rem; font-weight: 600; text-decoration: none; }
.hoja { background: var(--papel); border-radius: var(--radio); border: 1px solid var(--linea); }
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { padding: 14px 16px; border-top: 1px solid var(--linea); }
.lista > li:first-child { border-top: 0; }
.vacio { padding: 22px 16px; color: var(--gris); }

.clase { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: baseline; }
.clase__hora { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--noche); }
.clase--ahora { background: #fff8e1; box-shadow: inset 4px 0 0 var(--oro); }

.aviso-item h3 { margin-bottom: 4px; }
.aviso-item__cuerpo { white-space: pre-wrap; margin-top: 8px; }
.aviso-item__pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.etiqueta { display: inline-block; font-size: .78rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--cielo); color: var(--noche); }

.evento { display: grid; grid-template-columns: 58px 1fr; gap: 14px; align-items: start; }
.fecha-cuadro { text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--linea); }
.fecha-cuadro span { display: block; background: var(--rojo); color: #fff; font-size: .72rem; font-weight: 650; padding: 2px 0; }
.fecha-cuadro b { display: block; font-size: 1.35rem; padding: 4px 0; color: var(--tinta); }

.curso { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: inherit; }
.curso:hover h3 { color: var(--azul); }
.curso svg { width: 20px; height: 20px; color: var(--gris); flex: none; }

/* Horario: pestañas por día */
.dias { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.dias button {
  font: inherit; font-weight: 600; font-size: .9rem;
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--linea); background: #fff; color: var(--gris); cursor: pointer; white-space: nowrap;
}
.dias button[aria-pressed="true"] { background: var(--noche); border-color: var(--noche); color: #fff; }

/* Perfil */
.datos { display: grid; grid-template-columns: 1fr; margin: 0; }
.datos div { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--linea); }
.datos div:first-child { border-top: 0; }
.datos dt { color: var(--gris); font-size: .9rem; }
.datos dd { margin: 0; font-weight: 600; word-break: break-word; }
.formulario { padding: 16px; }

/* Más opciones (móvil) */
.opciones a, .opciones button {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; font: inherit; font-weight: 600; color: var(--tinta);
  background: none; border: 0; border-top: 1px solid var(--linea); text-decoration: none; text-align: left; cursor: pointer;
}
.opciones > :first-child { border-top: 0; }
.opciones svg { width: 22px; height: 22px; color: var(--azul); }
.opciones .salir, .opciones .salir svg { color: var(--rojo); }

.cargando { padding: 40px 0; text-align: center; color: var(--gris); }

@media (prefers-reduced-motion: no-preference) {
  .carnet { animation: entra .45s ease-out both; }
  @keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
