/* LAOS Office Tools — hoja de estilo MOBILE-FIRST.

   Regla de la casa (documentada en LAOS_WEB_STANDARD.md): las reglas base son las
   del móvil y las `@media (min-width: …)` sólo añaden. Quien entre desde el
   navegador del móvil sin instalar nada tiene que ver prácticamente la misma cosa
   que quien instale la PWA: barra de aplicación arriba, barra de pestañas abajo,
   una pantalla por intención y objetivos táctiles de 44 px o más.

   Los tokens, la tipografía y la marca son los del portal público
   (LaosUIForge/web/laos_web_platform/src/styles.css): sin esquinas redondeadas,
   bordes de 1px, versalitas con tracking ancho y el azul institucional.

   Sin fuentes externas ni CDN: la CSP sólo permite 'self'.                        */

:root {
  --white: #fff;
  --canvas: #f6f8fb;
  --surface: #eef3f8;
  --ink: #101828;
  --muted: #475467;
  --line: #d9e2ec;
  --blue: #1769e0;
  --blue-deep: #0b3b8f;
  --blue-soft: #dcebff;
  --green: #087a55;
  --amber: #fff3c4;
  --amber-ink: #7a4b00;
  --rose: #ffd9d9;
  --rose-ink: #99201f;
  --shell: 1080px;
  --barra-alta: 58px;
  --tabbar-alta: 60px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.55; }
h1, h2, h3, p { margin-top: 0; }
a { color: var(--blue-deep); text-decoration-thickness: 1px; text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue-soft); color: var(--blue-deep); }
.visually-hidden { position: absolute; overflow: hidden; clip: rect(0 0 0 0); width: 1px; height: 1px; margin: -1px; white-space: nowrap; }

/* ── esqueleto de app ──────────────────────────────────────────────────── */

body.app {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-alta) + env(safe-area-inset-bottom));
}

.app-bar {
  position: sticky; z-index: 20; top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  padding-top: env(safe-area-inset-top);
  backdrop-filter: saturate(140%) blur(6px);
}
.app-bar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--barra-alta); padding-inline: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 28px; height: 28px; flex: 0 0 auto; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border: 1px solid var(--ink); }
.brand-mark i { display: block; aspect-ratio: 1; background: var(--ink); }
.brand-mark i:nth-child(2) { background: var(--blue); }
.brand-mark i:nth-child(3) { background: var(--blue-deep); }
.brand strong { display: block; font-size: .82rem; letter-spacing: .1em; line-height: 1; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .58rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.insignia-pro { margin-left: auto; display: inline-flex; align-items: center; min-height: 34px; padding: 0 .8rem; border: 1px solid var(--blue); background: var(--blue); color: #fff; text-decoration: none; font-size: .72rem; font-weight: 760; letter-spacing: .02em; white-space: nowrap; }
.insignia-pro:hover, .insignia-pro:focus-visible { background: var(--blue-deep); color: #fff; }


/* Aviso de servicio: solo cuando algo va mal. Una luz verde permanente diciendo
   que el backend respira no es informacion para nadie. */
.aviso-servicio { margin: 0; padding: .35rem .6rem; border: 1px solid #e8c766; background: #fffdf5; color: var(--amber-ink); font-size: .72rem; font-weight: 650; }

.vista { width: min(var(--shell), 100%); margin-inline: auto; padding: 22px 16px 30px; }

.tabbar {
  position: fixed; z-index: 30; right: 0; bottom: 0; left: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line); background: rgba(255, 255, 255, .98);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: saturate(140%) blur(6px);
}
.tab {
  display: grid; gap: 3px; justify-items: center; min-height: var(--tabbar-alta);
  padding: 8px 4px 6px; border: 0; background: none; color: var(--muted);
  cursor: pointer; font-size: .61rem; font-weight: 720; letter-spacing: .02em;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--blue-deep); box-shadow: inset 0 2px 0 var(--blue); }

/* ── pantallas ─────────────────────────────────────────────────────────── */

.eyebrow { margin: 0 0 .7rem; color: var(--blue-deep); font-size: .66rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.pantalla h1 { margin-bottom: .8rem; font-size: 1.72rem; letter-spacing: -.04em; line-height: 1.12; }
.entradilla { margin-bottom: 1.3rem; color: var(--muted); font-size: .95rem; }
.nota { margin: 14px 0 0; color: var(--muted); font-size: .8rem; }
.campo { display: block; margin-bottom: .4rem; color: var(--ink); font-size: .7rem; font-weight: 760; letter-spacing: .06em; text-transform: uppercase; }
.select { width: 100%; min-height: 48px; margin-bottom: 18px; border: 1px solid var(--line); padding: .6rem .7rem; background: var(--white); color: var(--ink); }

.button {
  display: inline-flex; min-height: 48px; align-items: center; justify-content: center;
  gap: 8px; padding: .72rem 1.05rem; border: 1px solid transparent; color: var(--ink);
  background: none; cursor: pointer; font-size: .76rem; font-weight: 760;
  letter-spacing: .025em; text-decoration: none; text-transform: uppercase;
  transition: background-color .18s ease, border-color .18s ease;
}
.button-primary { color: var(--white); background: var(--blue); }
.button-primary:hover { background: var(--blue-deep); }
.button-secondary { border-color: var(--line); background: var(--white); }
.button-secondary:hover { border-color: var(--blue); color: var(--blue-deep); }
.button-quiet { min-height: 44px; padding: .4rem .6rem; color: var(--muted); font-size: .68rem; }
.button-quiet:hover { color: var(--blue-deep); }
.button-grande { min-height: 60px; font-size: .82rem; }
.button[disabled] { cursor: not-allowed; opacity: .45; }

.dropzone { display: grid; padding: 26px 18px; border: 1px dashed #b9c9dc; background: var(--white); text-align: center; }
.dropzone[data-activa="si"] { border-color: var(--blue); background: var(--blue-soft); }
.dropzone p { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.dropzone-acciones { display: grid; gap: 10px; }
.dropzone-nota { margin: 16px 0 0 !important; font-size: .74rem !important; }

.captura { display: grid; gap: 10px; }

.lista-atajos, .pasos-guia { display: grid; gap: 1px; margin: 22px 0 0; padding: 1px; background: var(--line); list-style: none; }
.lista-atajos li, .pasos-guia li { display: flex; align-items: baseline; gap: 12px; padding: 13px 15px; background: var(--white); font-size: .88rem; }
.lista-atajos span { color: var(--blue); font-size: .62rem; font-weight: 780; letter-spacing: .1em; }
.lista-atajos strong { font-weight: 620; letter-spacing: -.01em; }
.pasos-guia { counter-reset: guia; }
.pasos-guia li { color: var(--muted); }
.pasos-guia li::before { counter-increment: guia; content: counter(guia, decimal-leading-zero); color: var(--blue); font-size: .62rem; font-weight: 780; letter-spacing: .1em; }

/* ── panel de trabajo ──────────────────────────────────────────────────── */

.panel { border: 1px solid var(--line); border-top: 3px solid var(--blue); background: var(--white); }
.panel-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; border-bottom: 1px solid var(--line); padding: 9px 16px; color: var(--muted); font-size: .6rem; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.panel-top b { color: var(--blue-deep); }
.panel-cuerpo { padding: 18px 16px 22px; }
.panel h2 { margin-bottom: .3rem; font-size: 1.3rem; letter-spacing: -.03em; }
.panel-sub { margin-bottom: 18px; color: var(--muted); font-size: .86rem; }

.hechos { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; margin: 0 0 20px; padding: 1px; background: var(--line); }
.hechos div { display: grid; align-content: space-between; gap: 5px; min-height: 62px; padding: 10px 12px; background: var(--white); }
.hechos dt { color: var(--blue); font-size: .6rem; font-weight: 780; letter-spacing: .08em; text-transform: uppercase; }
.hechos dd { margin: 0; font-size: .84rem; font-weight: 620; overflow-wrap: anywhere; }

.salidas { display: grid; gap: 10px; }
.salida { display: grid; align-content: space-between; gap: 10px; min-height: 108px; padding: 14px; border: 1px solid var(--line); background: var(--white); cursor: pointer; text-align: left; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.salida:hover { border-color: var(--blue); box-shadow: 0 12px 26px rgba(16, 24, 40, .07); transform: translateY(-2px); }
.salida strong { font-size: .97rem; letter-spacing: -.02em; line-height: 1.2; }
.salida em { color: var(--muted); font-size: .77rem; font-style: normal; }
.motor { display: inline-flex; align-self: start; padding: .18rem .4rem; border: 1px solid currentColor; font-size: .58rem; font-weight: 760; letter-spacing: .06em; text-transform: uppercase; }
.motor-determinista { color: var(--green); }
.motor-ia-local { color: var(--blue-deep); }

.estado { display: grid; gap: 12px; padding: 22px 16px; }
.pasos { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.pasos li { display: flex; align-items: center; gap: 10px; color: #98a2b3; font-size: .84rem; }
.pasos li::before { display: inline-block; width: 9px; height: 9px; border: 1px solid currentColor; content: ""; }
.pasos li[data-estado="haciendo"] { color: var(--blue-deep); font-weight: 700; }
.pasos li[data-estado="haciendo"]::before { background: var(--blue); border-color: var(--blue); }
.pasos li[data-estado="hecho"] { color: var(--ink); }
.pasos li[data-estado="hecho"]::before { background: var(--green); border-color: var(--green); }
.barra { height: 4px; background: var(--surface); }
.barra i { display: block; height: 100%; background: var(--blue); transition: width .3s ease; }

.aviso { margin: 0 0 16px; border-left: 3px solid #e8c766; padding: 9px 0 9px 13px; background: #fffdf5; color: var(--amber-ink); font-size: .84rem; }
.error { margin: 0 0 16px; border-left: 3px solid var(--rose-ink); padding: 9px 0 9px 13px; background: #fff7f7; color: var(--rose-ink); font-size: .87rem; }
.error strong { display: block; margin-bottom: .2rem; }
.error ul { margin: .4rem 0 0; padding-left: 1.1rem; }

.cuerpo-resumen { margin-bottom: 20px; font-size: 1rem; }
.seccion-resumen { margin-bottom: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.seccion-resumen h3 { margin-bottom: .5rem; color: var(--blue-deep); font-size: .66rem; font-weight: 780; letter-spacing: .1em; text-transform: uppercase; }
.lista-hechos { display: grid; gap: 6px; margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; }

/* ── cuadrícula de revisión ────────────────────────────────────────────── */

.leyenda { display: grid; gap: 7px; margin-bottom: 13px; color: var(--muted); font-size: .76rem; }
.leyenda span { display: inline-flex; align-items: center; gap: 7px; }
.muestra { display: inline-block; width: 13px; height: 13px; flex: 0 0 auto; border: 1px solid var(--line); }
.muestra-dudosa { background: var(--amber); }
.muestra-ilegible { background: var(--rose); }
.muestra-editada { background: var(--blue-soft); }

.rejilla-envoltorio { overflow-x: auto; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
table.rejilla { min-width: 100%; border-collapse: collapse; font-size: .85rem; }
table.rejilla th, table.rejilla td { min-width: 84px; border: 1px solid var(--line); padding: 0; text-align: left; }
table.rejilla th { position: sticky; top: 0; background: var(--surface); font-size: .66rem; font-weight: 780; letter-spacing: .06em; text-transform: uppercase; }
table.rejilla th input, table.rejilla td input { width: 100%; min-height: 44px; border: 0; padding: .5rem .55rem; background: none; color: inherit; font: inherit; }
table.rejilla th input { font-size: .66rem; font-weight: 780; letter-spacing: .06em; text-transform: uppercase; }
table.rejilla td[data-marca="dudosa"] { background: var(--amber); }
table.rejilla td[data-marca="ilegible"] { background: var(--rose); }
table.rejilla td[data-marca="editada"] { background: var(--blue-soft); }
table.rejilla td input:focus { outline: 2px solid var(--blue); outline-offset: -2px; }
.fila-num { position: sticky; left: 0; min-width: 38px !important; padding: .5rem .5rem !important; background: var(--surface); color: #98a2b3; font-size: .68rem; text-align: right !important; }

/* ── editor del resultado (revisar antes de descargar) ─────────────────── */
.editor-salida { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.editor-texto {
  width: 100%; min-height: 240px; border: 1px solid var(--line); padding: 12px 13px;
  background: var(--white); color: var(--ink); font-family: ui-monospace, Consolas, monospace;
  font-size: .84rem; line-height: 1.6; resize: vertical; tab-size: 2;
}
.editor-texto:focus { outline: 2px solid var(--blue); outline-offset: -2px; }

/* ── tu propio modelo ──────────────────────────────────────────────────── */
.bloque-propio { margin-top: 26px; border: 1px solid var(--line); border-top: 3px solid var(--blue-deep); padding: 18px 16px 20px; background: var(--white); }
.bloque-propio h2 { margin-bottom: .5rem; font-size: 1.2rem; letter-spacing: -.03em; }
.bloque-propio code { color: var(--blue-deep); font-family: ui-monospace, Consolas, monospace; font-size: .95em; }
.entrada { width: 100%; min-height: 48px; margin-bottom: 16px; border: 1px solid var(--line); padding: .6rem .7rem; background: var(--white); color: var(--ink); }
.entrada:focus { outline: 2px solid var(--blue); outline-offset: -2px; }

.acciones { display: grid; gap: 10px; margin-top: 18px; }
.resultado-fichero { display: grid; gap: 4px; border: 1px solid var(--line); padding: 13px 15px; background: var(--surface); }
.resultado-fichero strong { font-size: .93rem; overflow-wrap: anywhere; }
.resultado-fichero span { color: var(--muted); font-size: .77rem; }

/* ── a partir de tablet: se ensancha, no se transforma ─────────────────── */

@media (min-width: 700px) {
  :root { --tabbar-alta: 0px; }
  body.app { padding-bottom: 0; }
  .app-bar-inner { min-height: 68px; padding-inline: 24px; }
  .brand strong { font-size: .92rem; }
  .tabbar {
    position: sticky; top: calc(var(--barra-alta) + env(safe-area-inset-top));
    grid-template-columns: repeat(4, auto); justify-content: center;
    gap: 4px; border-top: 0; border-bottom: 1px solid var(--line); padding: 0;
  }
  .tab { grid-auto-flow: column; align-items: center; min-height: 50px; padding-inline: 16px; font-size: .68rem; }
  .tab[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--blue); }
  .vista { padding: 34px 24px 60px; }
  .pantalla h1 { max-width: 20ch; font-size: 2.4rem; }
  .entradilla { max-width: 62ch; font-size: 1rem; }
  .dropzone { padding: 40px 32px; }
  .dropzone-acciones { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
  .captura { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lista-atajos { grid-template-columns: repeat(2, 1fr); }
  .salidas { grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); }
  .leyenda { display: flex; flex-wrap: wrap; gap: 8px 20px; }
  .acciones { display: flex; flex-wrap: wrap; }
  .resultado-fichero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .panel-cuerpo { padding: 24px 22px 26px; }
}

@media (min-width: 1024px) {
  .pantalla h1 { font-size: 3rem; letter-spacing: -.05em; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}

/* ── producto: inicio, catálogo, archivos y cuenta ─────────────────────── */

.saludo { margin: 0 0 .3rem; color: var(--muted); font-size: .82rem; font-weight: 650; }
.seccion { margin-top: 28px; }
.titulo-seccion { margin-bottom: .8rem; color: var(--blue-deep); font-size: .68rem; font-weight: 780; letter-spacing: .11em; text-transform: uppercase; }
.nota-retencion { margin-top: 26px; border-left: 3px solid var(--green); padding: 10px 0 10px 14px; color: var(--muted); font-size: .8rem; }
.nota-pendiente { margin-top: 26px; border-left: 3px solid var(--line); padding: 10px 0 10px 14px; }

.rejilla-acciones { display: grid; gap: 10px; }
.accion {
  display: grid; gap: 5px; padding: 14px 15px; border: 1px solid var(--line);
  background: var(--white); cursor: pointer; text-align: left;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.accion:hover { border-color: var(--blue); box-shadow: 0 12px 26px rgba(16, 24, 40, .07); transform: translateY(-2px); }
.accion strong { font-size: .97rem; letter-spacing: -.02em; }
.accion em { color: var(--muted); font-size: .8rem; font-style: normal; }
.accion-estrella { border-left: 3px solid var(--blue); }

.entrada-busqueda { margin-bottom: 20px; }

.lista-archivos { display: grid; gap: 1px; padding: 1px; background: var(--line); }
.archivo { display: grid; gap: 10px; padding: 13px 15px; background: var(--white); }
.archivo-datos { display: grid; gap: 3px; }
.archivo-datos strong { font-size: .92rem; overflow-wrap: anywhere; }
.archivo-datos span { color: var(--muted); font-size: .78rem; }
.archivo-estado { color: var(--green) !important; font-weight: 650; }
.archivo-estado-ko { color: #98a2b3 !important; }
.archivo-acciones { display: flex; flex-wrap: wrap; gap: 8px; }

.vacio { display: grid; gap: 14px; justify-items: start; border: 1px dashed #b9c9dc; padding: 24px 18px; background: var(--white); color: var(--muted); font-size: .9rem; }
.vacio p { margin: 0; }

.tarjeta { margin-bottom: 18px; border: 1px solid var(--line); border-top: 3px solid var(--blue-deep); padding: 18px 16px 20px; background: var(--white); }
.tarjeta h2 { margin-bottom: .5rem; font-size: 1.15rem; letter-spacing: -.03em; }
.tarjeta p { color: var(--muted); font-size: .88rem; }
.lista-ventajas { display: grid; gap: 6px; margin: 0 0 14px; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; }

.opciones-modo { display: grid; gap: 10px; margin-bottom: 14px; }
.opcion { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); padding: 12px 13px; cursor: pointer; }
.opcion:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.opcion input { margin-top: 3px; width: 18px; height: 18px; }
.opcion strong { display: block; font-size: .92rem; }
.opcion em { color: var(--muted); font-size: .8rem; font-style: normal; }

.detalle-tecnico { margin: 14px 0; border-top: 1px solid var(--line); padding-top: 12px; }
.detalle-tecnico summary { color: var(--blue-deep); cursor: pointer; font-size: .78rem; font-weight: 700; }
.detalle-tecnico p { margin: 12px 0 0; color: var(--muted); font-size: .84rem; }

.filtro { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--muted); cursor: pointer; font-size: .82rem; }
.filtro input { width: 18px; height: 18px; }
.error-salida { margin: .6rem 0 0; color: var(--muted); font-size: .84rem; }

/* ── escritorio: barra lateral y contenido ancho, no un móvil estirado ─── */

@media (min-width: 1024px) {
  :root { --tabbar-alta: 0px; }
  body.app { padding-bottom: 0; padding-left: 232px; }
  .app-bar { padding-left: 232px; }
  .tabbar {
    top: 0; right: auto; bottom: 0; left: 0; width: 232px;
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 2px; border-top: 0; border-right: 1px solid var(--line); padding: 84px 12px 12px;
  }
  .tab { grid-auto-flow: column; justify-items: start; justify-content: start; gap: 12px; min-height: 46px; padding-inline: 12px; font-size: .8rem; text-align: left; }
  .tab[aria-current="page"] { box-shadow: none; background: var(--blue-soft); color: var(--blue-deep); }
  .tab-central { order: 0; }
  .vista { width: min(var(--shell), 100%); padding: 34px 32px 60px; }
  .rejilla-acciones { grid-template-columns: repeat(3, 1fr); }
  .archivo { grid-template-columns: 1fr auto; align-items: center; }
  .lista-atajos { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1440px) {
  :root { --shell: 1180px; }
  .rejilla-acciones { grid-template-columns: repeat(4, 1fr); }
}

/* Cuenta: insignia de la barra y formulario de alta. Movil primero: los campos
   ocupan el ancho y el botón principal es grande, porque esto se rellena con el
   pulgar y a menudo con prisa. */
.insignia-cuenta {
  margin-left: auto;
  border: 1px solid var(--linea, #d7dce4);
  background: #fff;
  border-radius: 999px;
  padding: .35rem .8rem;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--tinta, #1a2230);
  cursor: pointer;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insignia-cuenta:hover { border-color: var(--marca, #1769e0); }

.formulario { display: grid; gap: .9rem; }
.formulario h2 { margin: 0; }
.campo { display: grid; gap: .3rem; }
.campo > span { font-size: .85rem; font-weight: 600; }
.campo input {
  width: 100%;
  box-sizing: border-box;
  padding: .7rem .8rem;
  font: inherit;
  font-size: 1rem;              /* 16px: menos que esto y iOS hace zoom al enfocar */
  border: 1px solid var(--linea, #d7dce4);
  border-radius: .6rem;
  background: #fff;
}
.campo input:focus-visible { outline: 2px solid var(--marca, #1769e0); outline-offset: 1px; }
.campo-check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
.campo-check input { margin-top: .15rem; width: 1.1rem; height: 1.1rem; flex: none; }
.formulario .acciones { display: flex; flex-wrap: wrap; gap: .6rem; }
.formulario .acciones .button { flex: 1 1 100%; }

@media (min-width: 40em) {
  .formulario { max-width: 26rem; }
  .formulario .acciones .button { flex: 0 0 auto; }
}

/* El editor de tablas en el móvil. Tres cosas fallaban a la vez: la cabecera
   pegajosa no se pegaba nunca —su bloque contenedor no tenía scroll vertical
   propio, así que no había de dónde despegarse—, sólo cabían dos columnas de
   siete, y tocar una celda hacía zoom en iOS porque la fuente bajaba de 16px. */
.rejilla-envoltorio {
  overflow: auto;
  max-height: 70dvh;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
table.rejilla th { z-index: 2; }
.fila-num { z-index: 1; }
table.rejilla th.fila-num { z-index: 3; }   /* la esquina, por encima de las dos */
/* 16px es el umbral por debajo del cual Safari hace zoom al enfocar un campo, y
   ese zoom deja la tabla descolocada justo cuando se está corrigiendo. */
table.rejilla th input, table.rejilla td input { font-size: 1rem; }

@media (min-width: 40em) {
  table.rejilla th, table.rejilla td { min-width: 112px; }
  table.rejilla th input, table.rejilla td input { font-size: .85rem; }
  table.rejilla th input { font-size: .66rem; }
}

/* Barra indeterminada: para cuando de verdad no se sabe cuánto queda. Se mueve
   para decir "sigo aquí", no para fingir un porcentaje. */
.barra[data-indeterminada] { overflow: hidden; }
.barra[data-indeterminada] i {
  width: 40%;
  animation: barra-vaiven 1.1s ease-in-out infinite;
}
@keyframes barra-vaiven {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
@media (prefers-reduced-motion: reduce) {
  .barra[data-indeterminada] i { animation: none; width: 100%; opacity: .35; }
}

/* Analítica opcional. El panel es parte visible del producto: aparece en la
   primera visita y siempre se puede reabrir desde Privacidad o el pie. */
.analytics-consent[hidden] { display: none !important; }
.analytics-consent {
  position: fixed;
  right: 12px;
  bottom: calc(var(--tabbar-alta, 64px) + env(safe-area-inset-bottom) + 12px);
  left: 12px;
  z-index: 2147483000;
  display: grid;
  gap: 16px;
  max-width: 660px;
  margin: 0 auto;
  border: 1px solid #b9c9dc;
  border-top: 4px solid var(--blue-deep);
  padding: 18px;
  background: var(--white);
  box-shadow: 0 18px 70px rgba(20, 43, 74, .24);
}
.analytics-consent h2 { margin: 2px 0 7px; font-size: 1.2rem; }
.analytics-consent p { margin: 0; color: var(--muted); font-size: .86rem; }
.analytics-consent-kicker {
  color: var(--blue-deep) !important;
  font-size: .68rem !important;
  font-weight: 800;
  letter-spacing: .12em;
}
.analytics-consent-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.analytics-consent-actions button,
.analytics-preferences {
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  background: var(--white);
  color: var(--blue-deep);
  font: inherit;
  font-size: .82rem;
  font-weight: 750;
  cursor: pointer;
}
.analytics-consent-actions button:focus-visible,
.analytics-preferences:focus-visible { outline: 3px solid rgba(23, 105, 224, .25); }
.analytics-consent-actions button:disabled { opacity: .5; cursor: not-allowed; }
.analytics-consent-actions .analytics-consent-accept {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
  color: var(--white);
}
.site-footer .analytics-preferences { border-color: currentColor; background: transparent; color: inherit; }

@media (min-width: 680px) {
  .analytics-consent {
    right: auto;
    bottom: 24px;
    left: 24px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    margin: 0;
  }
}
