/* Gyra — estilos base. Mobile-first; modo claro/oscuro según el sistema. */
:root {
  --fondo: #f4f7f7;
  --superficie: #ffffff;
  --superficie-2: #eef3f3;
  --texto: #10201f;
  --texto-tenue: #5b6b6a;
  --borde: #d9e2e1;
  --acento: #0f766e;
  --acento-texto: #ffffff;
  --acento-suave: #d5efec;
  --peligro: #b42318;
  --peligro-suave: #fde8e6;
  --exito: #0e7a3f;
  --exito-suave: #dcf5e6;
  --radio: 14px;
  --sombra: 0 1px 2px rgb(16 32 31 / 6%), 0 4px 16px rgb(16 32 31 / 5%);
  --alto-barra: 56px;
  --alto-inferior: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b1416;
    --superficie: #122022;
    --superficie-2: #182a2c;
    --texto: #e6f0ef;
    --texto-tenue: #93a7a5;
    --borde: #24393b;
    --acento: #2dd4bf;
    --acento-texto: #042f2c;
    --acento-suave: #123b38;
    --peligro: #ff8a7a;
    --peligro-suave: #3a1814;
    --exito: #5ee29a;
    --exito-suave: #11301f;
    --sombra: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fondo);
}
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .75rem; }
a { color: var(--acento); }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.tenue { color: var(--texto-tenue); margin: 0; }
.solo-lector {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.saltar { position: absolute; left: -999px; }
.saltar:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--superficie); padding: .5rem 1rem; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.icono { width: 20px; height: 20px; flex: none; }

/* ---------- Marca ---------- */
.marca {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 1.15rem; color: var(--texto); text-decoration: none;
}
.marca-grande { font-size: 1.6rem; margin-bottom: 1.5rem; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--alto-barra) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.barra form:last-child { margin-left: auto; }

.espacios {
  display: flex; gap: 2px; padding: 3px;
  background: var(--superficie-2); border-radius: 999px;
}
.espacio {
  display: flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--texto-tenue);
  font: inherit; font-size: .85rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; min-height: 36px;
}
.espacio .icono { width: 16px; height: 16px; }
.espacio.activo { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra); }

.boton-icono {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; color: var(--texto-tenue); cursor: pointer;
}
.boton-icono:hover { background: var(--superficie-2); color: var(--texto); }

/* ---------- Contenido ---------- */
.contenido {
  padding: 20px 16px calc(var(--alto-inferior) + 28px + env(safe-area-inset-bottom));
  max-width: 960px;
}
.saludo { margin-bottom: 1.25rem; }
.saludo .tenue::first-letter { text-transform: uppercase; }

.tarjetas-resumen { display: grid; gap: 12px; grid-template-columns: 1fr; }
.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra);
}
.tarjeta p { margin: 0; }
.etiqueta {
  display: flex; align-items: center; gap: 6px;
  color: var(--texto-tenue); font-size: .85rem; font-weight: 600;
}
.etiqueta .icono { width: 16px; height: 16px; }
.cifra { font-size: 1.5rem; font-weight: 700; margin: 4px 0 8px !important; }

.avance {
  appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px;
  background: var(--superficie-2); overflow: hidden; margin-bottom: 6px;
}
.avance::-webkit-progress-bar { background: var(--superficie-2); border-radius: 999px; }
.avance::-webkit-progress-value { background: var(--acento); border-radius: 999px; }
.avance::-moz-progress-bar { background: var(--acento); border-radius: 999px; }

.modulos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.modulo {
  display: flex; align-items: center; gap: 12px;
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 12px; padding: 12px 14px;
}
.modulo-icono {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; background: var(--acento-suave); color: var(--acento);
}
.modulo-texto { display: flex; flex-direction: column; min-width: 0; }
.modulo-texto .tenue { font-size: .85rem; }
.lista-mas a.modulo { color: var(--texto); text-decoration: none; }
.lista-mas a.modulo:hover { border-color: var(--acento); }
.pie-mas { margin-top: 1.5rem; font-size: .9rem; }
.insignia {
  margin-left: auto; flex: none;
  font-size: .75rem; font-weight: 700; color: var(--texto-tenue);
  border: 1px solid var(--borde); border-radius: 999px; padding: 2px 8px;
}

/* ---------- Navegación ---------- */
.lateral { display: none; }
.inferior {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--alto-inferior) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--superficie); border-top: 1px solid var(--borde);
}
.inf-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .7rem; font-weight: 600; color: var(--texto-tenue); text-decoration: none;
}
.inf-item.activo { color: var(--acento); }
.inf-agregar {
  justify-self: center; display: grid; place-items: center;
  width: 52px; height: 52px; margin-top: -22px; border-radius: 50%;
  background: var(--acento); color: var(--acento-texto); box-shadow: var(--sombra);
}
.inf-agregar .icono { width: 26px; height: 26px; }
.pronto, .inf-agregar[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- Avisos ---------- */
.avisos { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.aviso { padding: 10px 14px; border-radius: 10px; background: var(--superficie-2); }
.aviso-error { background: var(--peligro-suave); color: var(--peligro); }
.aviso-success { background: var(--exito-suave); color: var(--exito); }

/* ---------- Pantallas simples (login, 2FA, sin conexión) ---------- */
body.simple { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 16px; }
.simple-caja {
  width: 100%; max-width: 380px;
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 20px; padding: 28px 24px; box-shadow: var(--sombra);
}
.formulario { display: grid; gap: 6px; margin-top: 16px; }
.formulario label { font-size: .85rem; font-weight: 600; margin-top: 8px; }
.formulario input {
  font: inherit; font-size: 1rem; padding: 12px 14px;
  border: 1px solid var(--borde); border-radius: 10px;
  background: var(--fondo); color: var(--texto); width: 100%;
}
.formulario input:focus { border-color: var(--acento); outline: none; box-shadow: 0 0 0 3px var(--acento-suave); }
#codigo { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.boton {
  display: inline-flex; justify-content: center; align-items: center;
  font: inherit; font-weight: 700; margin-top: 16px; padding: 12px 18px; min-height: 48px;
  border: 0; border-radius: 12px; background: var(--acento); color: var(--acento-texto);
  cursor: pointer; text-decoration: none;
}
.boton-texto {
  border: 0; background: none; color: var(--texto-tenue); font: inherit; font-size: .9rem;
  text-decoration: underline; cursor: pointer; padding: 8px 0;
}
.enlace-salir { margin-top: 12px; text-align: center; }
.pasos { padding-left: 1.2rem; color: var(--texto-tenue); margin: 12px 0; }
.qr { display: grid; place-items: center; margin: 12px 0; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 12px; }
.clave-manual { text-align: center; font-size: .9rem; margin: 0; word-break: break-all; }

/* ---------- Pantallas grandes ---------- */
@media (min-width: 420px) {
  .tarjetas-resumen { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .barra .marca span { display: none; }
  .espacio { padding: 6px 10px; }
}
@media (min-width: 900px) {
  body:not(.simple) {
    display: grid;
    grid-template-columns: 232px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .barra { grid-column: 1 / -1; padding-inline: 20px; }
  .lateral {
    display: flex; flex-direction: column; gap: 4px; padding: 16px 12px;
    border-right: 1px solid var(--borde); background: var(--superficie);
  }
  .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    color: var(--texto-tenue); text-decoration: none; font-weight: 600; font-size: .95rem;
  }
  .nav-item small { margin-left: auto; font-size: .7rem; }
  .nav-item.activo { background: var(--acento-suave); color: var(--acento); }
  .inferior { display: none; }
  .contenido { padding: 28px 32px 48px; }
  .modulos { grid-template-columns: 1fr 1fr; }
}
