/* Taller IA Centros — estilos comunes.
 * --ink / --ink-2 / --on-ink son los colores DEL CENTRO: los sobrescribe
 * Centro.aplicarTema() con los del config.json. Nunca un hex fijo en su lugar. */

:root {
  --ink: #1f4e79;
  --ink-2: #b8860b;
  --on-ink: #ffffff;
  --ink-suave: color-mix(in srgb, var(--ink) 9%, white);
  --papel: #f6f5f1;
  --superficie: #ffffff;
  --texto: #1b2530;
  --texto-2: #545f6b;
  --linea: #d8d5cb;
  --ok: #2e7d32;
  --ok-fondo: #e8f3e9;
  --mal: #b3261e;
  --mal-fondo: #fbeaea;
  --aviso: #9a5b00;
  --aviso-fondo: #fdf3e1;
  --radio: 6px;
  --sombra: 0 1px 2px rgba(20, 30, 40, .08);
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papel); color: var(--texto);
  font: 17px/1.5 var(--fuente);
}
@media (min-width: 900px) { body { font-size: 18px; } }
img { max-width: 100%; }
a { color: var(--ink); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Cabecera del centro ─────────────────────────────────────────────── */
.cab {
  background: var(--ink); color: var(--on-ink);
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; min-height: 56px;
  border-bottom: 4px solid var(--ink-2);
}
.cab img.escudo { width: 38px; height: 44px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; flex: none; }
.cab .cab-texto { flex: 1; min-width: 0; }
.cab .cab-nombre {
  font-weight: 650; font-size: 1.02rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cab .cab-sub { font-size: .82rem; opacity: .9; }
.cab .cab-acciones { display: flex; gap: .4rem; align-items: center; }
.cab select, .cab button {
  background: transparent; color: var(--on-ink); border: 1px solid color-mix(in srgb, var(--on-ink) 50%, transparent);
  border-radius: var(--radio); padding: .3rem .5rem; font: inherit; font-size: .85rem;
}
.cab select option { color: var(--texto); }

/* ── Estructura ──────────────────────────────────────────────────────── */
.contenedor { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.estrecho { max-width: 560px; margin: 0 auto; }
.tarjeta {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 1rem 1.1rem; box-shadow: var(--sombra); margin-bottom: 1rem;
}
.rejilla { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.fila { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.fila-sep { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.suave { color: var(--texto-2); }
.pequeno { font-size: .85rem; }

.aviso-red {
  background: var(--aviso-fondo); color: var(--aviso); border-bottom: 1px solid #ecd3a4;
  padding: .45rem 1rem; font-size: .9rem; text-align: center;
}

/* ── Sesión y navegación de módulos ──────────────────────────────────── */
.sesion { border-left: 5px solid var(--ink); }
.sesion .sesion-num { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); }
.sesion h1 { margin: .1rem 0 .3rem; }
.reto {
  background: var(--ink-suave); border: 1px solid color-mix(in srgb, var(--ink) 30%, white);
  border-radius: var(--radio); padding: .7rem 1rem; margin-bottom: 1rem;
}
.reto strong { color: var(--ink); }

.nav-modulos {
  display: flex; gap: .4rem; overflow-x: auto; padding: .2rem 0 .6rem; margin-bottom: .6rem;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.nav-modulos button {
  flex: none; border: 1px solid var(--linea); background: var(--superficie); color: var(--texto);
  border-radius: 999px; padding: .45rem .9rem; font: inherit; font-size: .92rem; cursor: pointer;
  display: inline-flex; gap: .35rem; align-items: center;
}
.nav-modulos button .min { color: var(--texto-2); font-size: .78rem; }
.nav-modulos button[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.nav-modulos button[aria-current="true"] .min { color: var(--on-ink); opacity: .85; }
.nav-modulos button.extra { border-style: dashed; }

/* ── Formularios ─────────────────────────────────────────────────────── */
label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }
label .ayuda { display: block; font-weight: 400; color: var(--texto-2); font-size: .85rem; }
input[type=text], input[type=password], input[type=number], input:not([type]), textarea, select {
  width: 100%; font: inherit; color: var(--texto); background: #fff;
  border: 1px solid #b9b5a8; border-radius: var(--radio); padding: .55rem .65rem;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ink) 55%, white); outline-offset: 2px;
}
.campo-voz { position: relative; }
.campo-voz textarea, .campo-voz input { padding-right: 2.8rem; }
.btn-voz {
  position: absolute; right: .35rem; top: .35rem; width: 2.2rem; height: 2.2rem;
  border: 1px solid var(--linea); border-radius: 50%; background: #fff; cursor: pointer; font-size: 1rem;
}
.btn-voz.escuchando { background: var(--mal); color: #fff; border-color: var(--mal); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; border-radius: var(--radio); cursor: pointer;
  padding: .6rem 1.1rem; border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink);
  text-decoration: none; min-height: 44px;
}
.btn.sec { background: #fff; color: var(--ink); }
.btn.peligro { background: #fff; color: var(--mal); border-color: var(--mal); }
.btn.peq { padding: .3rem .7rem; min-height: 34px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.opciones-radio { display: flex; flex-wrap: wrap; gap: .4rem; }
.opciones-radio label {
  margin: 0; font-weight: 400; border: 1px solid var(--linea); border-radius: var(--radio);
  padding: .4rem .7rem; cursor: pointer; background: #fff;
}
.opciones-radio input { margin-right: .35rem; }
.opciones-radio label:has(input:checked) { border-color: var(--ink); background: var(--ink-suave); }

/* ── Generador ───────────────────────────────────────────────────────── */
.tipos { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tipos button {
  text-align: left; border: 1px solid var(--linea); background: #fff; border-radius: var(--radio);
  padding: .65rem .8rem; font: inherit; cursor: pointer; min-height: 52px;
}
.tipos button:hover { border-color: var(--ink); }
.tipos button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-suave); font-weight: 600; }
.grupo-tipos { margin: .9rem 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); }
.gen-cuerpo { display: grid; gap: 1rem; }
@media (min-width: 900px) { .gen-cuerpo { grid-template-columns: 1fr 1fr; align-items: start; } }
.prompt-salida {
  white-space: pre-wrap; font-family: var(--mono); font-size: .86rem; line-height: 1.45;
  background: #fbfaf7; border: 1px solid var(--linea); border-radius: var(--radio);
  padding: .8rem; max-height: 60vh; overflow: auto;
}
@media (min-width: 900px) { .gen-previa { position: sticky; top: 1rem; } }

/* ── Estados (citas, avisos) ─────────────────────────────────────────── */
.chip { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600; }
.chip.verde { background: var(--ok-fondo); color: var(--ok); }
.chip.rojo { background: var(--mal-fondo); color: var(--mal); }
.chip.ambar { background: var(--aviso-fondo); color: var(--aviso); }
.cita { border-left: 5px solid var(--linea); padding: .5rem .8rem; margin: .5rem 0; background: #fff; border-radius: 0 var(--radio) var(--radio) 0; }
.cita.verde { border-color: var(--ok); } .cita.rojo { border-color: var(--mal); } .cita.ambar { border-color: #d89a2b; }

/* ── Checklist ───────────────────────────────────────────────────────── */
.check-bloque h3 { color: var(--ink); margin-top: 1rem; }
.check-item { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; border-bottom: 1px solid #eeebe3; font-weight: 400; margin: 0; cursor: pointer; }
.check-item input { width: 1.25rem; height: 1.25rem; flex: none; margin-top: .15rem; accent-color: var(--ink); }
.progreso { height: .6rem; background: #e7e4dc; border-radius: 999px; overflow: hidden; }
.progreso > span { display: block; height: 100%; background: var(--ink); transition: width .2s; }

/* ── Listas en directo (dudas, frases) ───────────────────────────────── */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); padding: .6rem .8rem; margin-bottom: .5rem; }
.lista li.resuelta { opacity: .55; }
.lista .meta { font-size: .8rem; color: var(--texto-2); }

/* ── Barras (votación, autodiagnóstico) ──────────────────────────────── */
.barras { display: grid; gap: .55rem; }
.barra { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr 3rem; gap: .6rem; align-items: center; }
.barra .pista { height: 1.3rem; background: #e7e4dc; border-radius: 4px; overflow: hidden; }
.barra .relleno { height: 100%; background: var(--ink); transition: width .4s; }
.barra .relleno.b { background: var(--ink-2); }
.barra .valor { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.leyenda { display: flex; gap: 1rem; font-size: .85rem; color: var(--texto-2); margin-bottom: .5rem; }
.leyenda i { display: inline-block; width: .9rem; height: .9rem; border-radius: 2px; vertical-align: -2px; margin-right: .3rem; background: var(--ink); }
.leyenda i.b { background: var(--ink-2); }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50;
  background: #1b2530; color: #fff; padding: .6rem 1rem; border-radius: var(--radio);
  box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: calc(100vw - 2rem); font-size: .95rem;
}
#toast.mal { background: var(--mal); }

/* ── Panel del formador ──────────────────────────────────────────────── */
.panel-rejilla { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .panel-rejilla { grid-template-columns: 1fr 1fr; } }
.modulo-toggle { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .2rem 0; }
.modulo-toggle.en-sesion { font-weight: 600; }
.cronometro { font-size: 2.2rem; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }

/* ── Proyector ───────────────────────────────────────────────────────── */
body.proyector { font-size: 26px; background: #fff; }
body.proyector .cab { min-height: 90px; padding: .8rem 2rem; }
body.proyector .cab img.escudo { width: 70px; height: 80px; }
body.proyector .cab .cab-nombre { font-size: 1.4rem; }
.proy-main { padding: 1.5rem 2rem 5rem; }
.proy-arranque { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .proy-arranque { grid-template-columns: 320px 1fr; } }
.qr-caja { text-align: center; }
.qr-caja svg, .qr-caja img { width: 100%; max-width: 300px; height: auto; background: #fff; }
.qr-caja .codigo { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; letter-spacing: .08em; color: var(--ink); }
.muro { columns: 2 320px; column-gap: 1rem; }
.muro .frase {
  break-inside: avoid; background: var(--ink-suave); border-left: 6px solid var(--ink);
  padding: .6rem .9rem; margin-bottom: 1rem; border-radius: 0 var(--radio) var(--radio) 0;
  animation: entra .4s ease-out;
}
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .muro .frase { animation: none; } .barra .relleno, .progreso > span { transition: none; } }
.parrafo-centro {
  max-width: 1100px; margin: 0 auto; text-align: center; padding: 2rem;
  border-top: 6px solid var(--ink); border-bottom: 6px solid var(--ink-2);
}
.parrafo-centro img { width: 120px; height: 140px; object-fit: contain; }
.parrafo-centro p { font-size: 1.3em; line-height: 1.55; font-family: Georgia, "Times New Roman", serif; }
.proy-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: .5rem; justify-content: center;
  padding: .5rem; background: rgba(255,255,255,.95); border-top: 1px solid var(--linea); font-size: 16px;
}
.proy-reloj { font-size: 6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); text-align: center; }
.proy-reto { font-size: 1.4em; text-align: center; max-width: 1100px; margin: 1rem auto; }

@media print {
  .cab, .nav-modulos, .no-print, .proy-nav, #toast, .aviso-red { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .tarjeta { box-shadow: none; border: none; padding: 0; }
  .contenedor { max-width: none; padding: 0; }
}

/* Semáforo de datos: colores semánticos fijos (no son los del centro). */
.se-leyenda { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.se-chip { margin: 0; padding: .6rem .8rem; border-radius: 8px; border-left: 8px solid; background: var(--fondo-2, #f4f4f4); }
.se-chip span, .se-chip p { font-size: .9em; }
.se-verde { border-color: #2e7d32; } .se-ambar { border-color: #f9a825; } .se-rojo { border-color: #c62828; }
.se-bg-verde { background: #2e7d32; } .se-bg-ambar { background: #f9a825; } .se-bg-rojo { background: #c62828; }
.se-botones { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: .8rem 0; }
.se-botones .btn { color: #fff; border-color: transparent; padding: 1rem; font-size: 1.05em; }
.se-botones .btn.se-verde { background: #2e7d32; } .se-botones .btn.se-ambar { background: #8a5a00; } .se-botones .btn.se-rojo { background: #c62828; }
.se-casos { list-style: none; padding: 0; } .se-casos li { display: flex; gap: .5rem; align-items: center; padding: .35rem 0; }
.se-casos .se-texto { flex: 1; } .se-punto { width: .9rem; height: .9rem; border-radius: 50%; flex: none; }

/* Panel multicentro */
.pf-lista { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.pf-fila { border: 1px solid var(--borde, #d8d8d8); border-radius: 8px; padding: .7rem .8rem; }
.pf-actual { border-color: var(--ink); border-width: 2px; }
.pf-etq { font-size: .75em; padding: .1rem .4rem; border-radius: 99px; background: var(--ink); color: var(--on-ink); }
.qr-caja .enlace-corto { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; word-break: break-all; margin-bottom: .6rem; }
