/* ═══════════════════════════════════════════════════════════════════
   UNEXA AULA
   ───────────────────────────────────────────────────────────────────
   Tres columnas: menú, contenido y asistente. El asistente NO es un
   añadido decorativo: tiene ancho fijo y no se encoge, porque en el
   momento en que se encoge para dejarle sitio a una tabla, deja de
   usarse.

   Tipografía grande a propósito. Los alumnos son adultos que estudian
   de noche después de trabajar, muchos pasados los cuarenta, y con
   frecuencia miran esto en el teléfono a las once.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --tinta:      #1a1d21;
  --tinta-2:    #5a6270;
  --tenue:      #8b929e;
  --linea:      #e3e6ea;
  --fondo:      #f5f6f8;
  --papel:      #ffffff;

  --acento:     #1f6f6b;
  --acento-sua: #e6f2f1;

  --verde:      #17795e;
  --verde-sua:  #e4f4ee;
  --azul:       #1f5fa8;
  --azul-sua:   #e6eff9;
  --ambar:      #9a6206;
  --ambar-sua:  #fdf1dc;
  --rojo:       #b3261e;
  --rojo-sua:   #fdeceb;
  --gris-sua:   #eef0f3;

  --menu-ancho: 232px;
  --asis-ancho: 340px;
  --radio:      10px;
  --sombra:     0 1px 2px rgba(16,24,40,.05), 0 4px 12px rgba(16,24,40,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  background: var(--fondo);
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.25; }
p  { margin: 0 0 .6rem; }
a  { color: var(--acento); }
code { font: .88em ui-monospace, "Cascadia Code", Consolas, monospace; }
.tenue { color: var(--tenue); }

/* ── Estructura ─────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--menu-ancho) minmax(0, 1fr) var(--asis-ancho);
  min-height: 100vh;
}

/* ── Menú ───────────────────────────────────────────────────────── */

.menu {
  background: #14171b;
  color: #c9cfd8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.marca {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.15rem 1rem;
  border-bottom: 1px solid #24282e;
}
.marca-logo {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--acento); color: #fff;
  border-radius: 9px; font-weight: 700; font-size: 1.05rem;
}
.marca-logo.grande { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 13px; }
.marca-txt { display: flex; flex-direction: column; min-width: 0; }
.marca-txt strong { color: #fff; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-txt small  { color: #7d8694; font-size: .78rem; }

.menu nav { padding: .75rem .55rem; flex: 1; overflow-y: auto; }
.menu-grupo {
  margin: 1rem .5rem .35rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: #6b7482;
}
.menu-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .58rem .6rem;
  border-radius: 8px;
  color: #c9cfd8; text-decoration: none;
  font-size: .93rem;
}
.menu-item:hover  { background: #1e222840; color: #fff; }
.menu-item.activo { background: var(--acento); color: #fff; font-weight: 600; }
.menu-ico { width: 1.1rem; text-align: center; opacity: .85; }

.menu-pie { padding: .8rem 1rem; border-top: 1px solid #24282e; }
.quien strong { display: block; color: #fff; font-size: .9rem; }
.quien small  { color: #7d8694; font-size: .78rem; }
.salir {
  display: inline-block; margin-top: .55rem;
  color: #9aa3af; text-decoration: none; font-size: .85rem;
}
.salir:hover { color: #fff; text-decoration: underline; }

/* ── Contenido ──────────────────────────────────────────────────── */

.contenido { padding: 1.6rem 2rem 3rem; min-width: 0; }

.barra { margin-bottom: 1.4rem; }
.barra h1 { font-size: 1.5rem; }
.barra-sub { color: var(--tenue); margin: .2rem 0 0; font-size: .95rem; }

.titulo-seccion { font-size: 1.05rem; margin: 1.8rem 0 .8rem; }

/* ── Avisos ─────────────────────────────────────────────────────── */

.aviso {
  padding: .7rem .95rem; border-radius: var(--radio);
  margin-bottom: 1rem; font-size: .93rem;
  border: 1px solid transparent;
}
.aviso-success, .aviso-exito { background: var(--verde-sua); color: var(--verde); border-color: #bfe3d4; }
.aviso-error   { background: var(--rojo-sua);  color: var(--rojo);  border-color: #f4c9c6; }
.aviso-info    { background: var(--azul-sua);  color: var(--azul);  border-color: #c9dcf2; }

/* ── Resumen de cifras ──────────────────────────────────────────── */

.resumen { display: flex; gap: 1rem; flex-wrap: wrap; }
.dato {
  background: var(--papel); border: 1px solid var(--linea);
  border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 1rem 1.2rem; display: flex; align-items: center; gap: .9rem;
  flex: 1 1 190px;
}
.dato-num { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.dato-txt { font-size: .86rem; color: var(--tinta-2); }
.dato-txt small { color: var(--tenue); }

.verde { color: var(--verde); } .azul { color: var(--azul); }
.ambar { color: var(--ambar); } .rojo { color: var(--rojo); }
.gris  { color: var(--tenue); }

/* ── Tarjetas de curso ──────────────────────────────────────────── */

.cursos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

.curso {
  background: var(--papel); border: 1px solid var(--linea);
  border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 1.05rem 1.15rem;
}
.curso > header { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; }
.curso h3 { font-size: 1.02rem; }
.curso .tenue { font-size: .83rem; margin: .15rem 0 0; }
.curso-prof { font-size: .87rem; color: var(--tinta-2); margin: .55rem 0 .75rem; }

.nota {
  font-size: 1.35rem; font-weight: 700; line-height: 1;
  padding: .35rem .55rem; border-radius: 8px; flex: none;
}
.nota-verde { background: var(--verde-sua); color: var(--verde); }
.nota-azul  { background: var(--azul-sua);  color: var(--azul); }
.nota-ambar { background: var(--ambar-sua); color: var(--ambar); }
.nota-rojo  { background: var(--rojo-sua);  color: var(--rojo); }
.nota-gris  { background: var(--gris-sua);  color: var(--tenue); }

.curso-notas { display: flex; flex-wrap: wrap; gap: .4rem; }
.mini {
  font-size: .8rem; font-weight: 650;
  background: var(--gris-sua); border-radius: 7px;
  padding: .3rem .5rem; display: flex; align-items: baseline; gap: .35rem;
}
.mini em { font-style: normal; font-weight: 400; color: var(--tinta-2); font-size: .74rem; }

.curso-pie {
  margin-top: .85rem; padding-top: .7rem;
  border-top: 1px solid var(--linea);
  font-size: .85rem; color: var(--tinta-2);
}
.curso-pie.ambar { color: var(--ambar); }
.curso-pie.rojo  { color: var(--rojo); }
.curso-acciones { margin-top: .6rem; font-size: .87rem; }
.curso-acciones a { text-decoration: none; font-weight: 600; }
.curso-acciones a:hover { text-decoration: underline; }

/* ── Tablas ─────────────────────────────────────────────────────── */

.tabla-caja {
  background: var(--papel); border: 1px solid var(--linea);
  border-radius: var(--radio); box-shadow: var(--sombra); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .65rem .85rem; text-align: left; border-bottom: 1px solid var(--linea); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue); font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; padding: .18rem .5rem; border-radius: 20px;
  font-size: .76rem; font-weight: 650;
}
.badge-verde { background: var(--verde-sua); color: var(--verde); }
.badge-azul  { background: var(--azul-sua);  color: var(--azul); }
.badge-ambar { background: var(--ambar-sua); color: var(--ambar); }
.badge-rojo  { background: var(--rojo-sua);  color: var(--rojo); }
.badge-gris  { background: var(--gris-sua);  color: var(--tenue); }

/* ── Botones y formularios ──────────────────────────────────────── */

.btn {
  display: inline-block; padding: .6rem 1.05rem;
  border: 1px solid var(--linea); border-radius: 8px;
  background: var(--papel); color: var(--tinta);
  font: inherit; font-size: .93rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #cfd5dc; background: #fafbfc; }
.btn-lleno { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-lleno:hover { background: #195a57; border-color: #195a57; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label { display: block; margin-bottom: .9rem; font-size: .88rem; font-weight: 600; color: var(--tinta-2); }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; margin-top: .3rem;
  padding: .6rem .7rem; font: inherit;
  border: 1px solid var(--linea); border-radius: 8px;
  background: var(--papel); color: var(--tinta);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--acento-sua); border-color: var(--acento);
}

.vacio {
  background: var(--papel); border: 1px dashed var(--linea);
  border-radius: var(--radio); padding: 2rem; text-align: center; color: var(--tinta-2);
}

/* ═══════════════════════════════════════════════════════════════════
   EL ASISTENTE
   ═══════════════════════════════════════════════════════════════════ */

.asistente {
  background: var(--papel);
  border-left: 1px solid var(--linea);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.asis-cab {
  display: flex; align-items: center; gap: .6rem;
  padding: .95rem 1rem; border-bottom: 1px solid var(--linea);
}
.asis-cab strong { display: block; font-size: .95rem; }
.asis-cab small  { color: var(--tenue); font-size: .78rem; }
.asis-punto {
  width: 9px; height: 9px; border-radius: 50%; background: var(--verde); flex: none;
  box-shadow: 0 0 0 3px var(--verde-sua);
}
.asis-cerrar {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--tenue); padding: 0 .2rem;
  display: none;
}

.asis-cuerpo { flex: 1; overflow-y: auto; padding: 1rem; }
.asis-saludo { font-size: .92rem; color: var(--tinta-2); margin-bottom: .8rem; }

/* Las tarjetas que el asistente dice sin que le pregunten. */
.tarjeta {
  border: 1px solid var(--linea); border-left: 3px solid var(--tenue);
  border-radius: 9px; padding: .75rem .85rem; margin-bottom: .7rem;
  background: #fcfcfd;
}
.tarjeta h4 { font-size: .89rem; margin-bottom: .2rem; }
.tarjeta p  { font-size: .85rem; color: var(--tinta-2); margin: 0; }
.tarjeta-rojo  { border-left-color: var(--rojo);  background: var(--rojo-sua); }
.tarjeta-ambar { border-left-color: var(--ambar); background: var(--ambar-sua); }
.tarjeta-azul  { border-left-color: var(--azul);  background: var(--azul-sua); }
.tarjeta-verde { border-left-color: var(--verde); background: var(--verde-sua); }
.tarjeta-rojo h4  { color: var(--rojo); }
.tarjeta-ambar h4 { color: var(--ambar); }

.tarjeta-accion {
  display: inline-block; margin-top: .5rem; padding: 0;
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .84rem; font-weight: 650;
  color: var(--acento); text-decoration: none;
}
.tarjeta-accion:hover { text-decoration: underline; }

/* El hilo de conversación */
.asis-hilo { display: flex; flex-direction: column; gap: .7rem; margin-top: .5rem; }
.msg { font-size: .89rem; border-radius: 10px; padding: .6rem .8rem; max-width: 100%; }
.msg-yo {
  background: var(--acento); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 3px;
}
.msg-el {
  background: var(--gris-sua); color: var(--tinta);
  align-self: flex-start; border-bottom-left-radius: 3px;
}
.msg-el strong { font-weight: 650; }
.msg-el ul, .msg-el ol { margin: .4rem 0; padding-left: 1.15rem; }
.msg-el li { margin-bottom: .25rem; }
.msg-error { background: var(--rojo-sua); color: var(--rojo); align-self: flex-start; }

.msg-fuentes {
  margin-top: .5rem; padding-top: .45rem;
  border-top: 1px solid #d8dce2; font-size: .78rem; color: var(--tinta-2);
}
.msg-fuentes b { display: block; color: var(--tenue); font-weight: 650; margin-bottom: .2rem; }
.msg-aviso {
  margin-top: .45rem; font-size: .78rem;
  color: var(--ambar); background: var(--ambar-sua);
  padding: .35rem .5rem; border-radius: 6px;
}

.escribiendo { display: flex; gap: .25rem; padding: .7rem .8rem; }
.escribiendo i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--tenue);
  animation: latido 1.2s infinite;
}
.escribiendo i:nth-child(2) { animation-delay: .18s; }
.escribiendo i:nth-child(3) { animation-delay: .36s; }
@keyframes latido { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }

/* El pie: ejemplos y caja de texto */
.asis-pie { border-top: 1px solid var(--linea); padding: .75rem; background: #fbfcfd; }
.asis-ejemplos { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .55rem; }
.asis-ejemplos button {
  border: 1px solid var(--linea); background: var(--papel);
  border-radius: 20px; padding: .28rem .6rem;
  font: inherit; font-size: .78rem; color: var(--tinta-2); cursor: pointer;
}
.asis-ejemplos button:hover { border-color: var(--acento); color: var(--acento); }

#asisForm { display: flex; gap: .45rem; align-items: flex-end; }
#asisTexto {
  flex: 1; resize: none; max-height: 120px; margin: 0;
  font-size: .9rem; padding: .55rem .65rem;
}
#asisEnviar {
  flex: none; width: 38px; height: 38px;
  border: 0; border-radius: 9px;
  background: var(--acento); color: #fff;
  font-size: 1.1rem; cursor: pointer;
}
#asisEnviar:disabled { opacity: .45; cursor: not-allowed; }
.asis-nota { font-size: .72rem; color: var(--tenue); margin: .5rem 0 0; text-align: center; }

/* El botón de móvil. En pantalla ancha no existe. */
.asis-abrir { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   PANTALLAS SUELTAS (entrar, 404, sesión caducada)
   ═══════════════════════════════════════════════════════════════════ */

.pantalla-sola {
  display: grid; place-items: center; min-height: 100vh; padding: 1.5rem;
}
.caja-sola {
  background: var(--papel); border: 1px solid var(--linea);
  border-radius: 14px; box-shadow: var(--sombra);
  padding: 1.8rem; width: 100%; max-width: 400px;
}
.caja-sola h1 { font-size: 1.3rem; margin-bottom: .6rem; }
.caja-sola h2 { font-size: 1.1rem; margin-bottom: 1.1rem; }

.entrar { width: 100%; max-width: 400px; }
.entrar-marca { text-align: center; margin-bottom: 1.4rem; }
.entrar-marca .marca-logo { margin: 0 auto .7rem; }
.entrar-marca h1 { font-size: 1.35rem; }
.entrar-marca p  { color: var(--tenue); font-size: .92rem; margin: .2rem 0 0; }
.pie-ayuda { font-size: .82rem; margin: .9rem 0 0; text-align: center; }

.demo-cuentas {
  margin-top: 1rem; padding: .8rem 1rem;
  background: var(--ambar-sua); border-radius: var(--radio);
  font-size: .82rem; color: var(--ambar);
}
.demo-cuentas ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.demo-cuentas p  { margin: 0; }

/* ═══════════════════════════════════════════════════════════════════
   PANTALLAS ESTRECHAS
   Tres columnas no caben. El menú se va arriba y el asistente pasa a
   un botón fijo — que sigue avisando de cuántas cosas tiene que decir,
   porque esconderlo del todo sería perder justamente lo que lo hace
   distinto de un chat cualquiera.
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--menu-ancho) minmax(0, 1fr); }

  .asistente {
    position: fixed; inset: 0 0 0 auto;
    width: min(380px, 100%); z-index: 60;
    box-shadow: -8px 0 32px rgba(16,24,40,.16);
    transform: translateX(100%);
    transition: transform .22s ease;
  }
  .asistente.abierto { transform: translateX(0); }
  .asis-cerrar { display: block; }

  .asis-abrir {
    display: flex; align-items: center; gap: .5rem;
    position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 50;
    padding: .7rem 1.1rem;
    border: 0; border-radius: 30px;
    background: var(--acento); color: #fff;
    font: inherit; font-size: .9rem; font-weight: 650;
    box-shadow: 0 6px 20px rgba(31,111,107,.35);
    cursor: pointer;
  }
  .asis-globo {
    background: var(--rojo); color: #fff;
    border-radius: 20px; padding: .05rem .42rem;
    font-size: .75rem; font-style: normal; font-weight: 700;
  }
  .asistente.abierto ~ .asis-abrir { display: none; }
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .menu { position: static; height: auto; }
  .menu nav { display: flex; gap: .3rem; overflow-x: auto; padding: .5rem; }
  .menu-grupo, .menu-pie .quien { display: none; }
  .menu-item { white-space: nowrap; }
  .menu-pie { display: flex; justify-content: flex-end; padding: .4rem 1rem; }
  .contenido { padding: 1.1rem 1rem 5rem; }
  .barra h1 { font-size: 1.25rem; }
  .cursos { grid-template-columns: 1fr; }
}
