/* Formularios de Terreno
   Papel de libreta de terreno, tinta azul de lápiz pasta y fechas timbradas.
   La fecha tope es lo más visible de cada fila. Sin sombras ni degradados:
   debe leerse a pleno sol. */

@font-face { font-family: 'Atkinson Hyperlegible Next'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fuentes/atkinson-hyperlegible-next-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fuentes/atkinson-hyperlegible-next-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fuentes/atkinson-hyperlegible-next-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'League Gothic'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fuentes/league-gothic-latin-400-normal.woff2) format('woff2'); }

:root {
  --papel: #EEF1E8;
  --hoja: #FFFFFF;
  --tinta: #101B3B;
  --tinta-2: #505B73;
  --azul: #1F4FD8;
  --azul-osc: #173DAB;
  --azul-claro: #E7EDFC;
  --verde: #1B8048;
  --verde-claro: #E3F3EA;
  --verde-texto: #146C3B;
  --ambar: #DFA000;
  --ambar-claro: #FFF4D6;
  --ambar-texto: #8A5A00;
  --rojo: #D7301F;
  --rojo-claro: #FDE9E4;
  --rojo-texto: #B3261A;
  --gris-claro: #ECEEF2;
  --linea: #D5DACD;
  --borde: #8A93A6;
  --texto: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --timbre: 'League Gothic', 'Arial Narrow', Impact, sans-serif;
  --radio: 8px;
  --alto-barra: 56px;
  --alto-nav: 62px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--papel); color: var(--tinta); font-family: var(--texto); font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.con-dialogo { overflow: hidden; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.18rem; line-height: 1.25; font-weight: 700; }
h3 { font-size: 1.05rem; line-height: 1.3; font-weight: 700; }
a { color: var(--azul); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; border-radius: 4px; }
.fuera-de-vista { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.icono { flex: none; vertical-align: -0.2em; }
.arranque { padding: 48px 20px; color: var(--tinta-2); }

/* ---------- Botones ---------- */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border: 1.5px solid var(--azul); border-radius: var(--radio);
  background: var(--azul); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; text-align: center; }
.boton:hover { background: var(--azul-osc); border-color: var(--azul-osc); }
.boton:disabled { opacity: 0.5; cursor: default; }
.boton.ocupado { position: relative; color: transparent; }
.boton.ocupado .icono { visibility: hidden; }
.boton.ocupado::after { content: ''; position: absolute; width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%; animation: giro 0.8s linear infinite; }
.boton-suave { background: var(--hoja); color: var(--tinta); border-color: var(--borde); }
.boton-suave:hover { background: var(--gris-claro); border-color: var(--tinta-2); }
.boton-suave.ocupado::after { border-color: rgba(16, 27, 59, 0.25); border-top-color: var(--tinta); }
.boton-peligro { background: var(--rojo); border-color: var(--rojo); }
.boton-peligro:hover { background: var(--rojo-texto); border-color: var(--rojo-texto); }
.boton-peligro-suave { color: var(--rojo-texto); }
.boton-ancho { width: 100%; }
.boton-grande { min-height: 58px; font-size: 1.1rem; }
.boton-chico { min-height: 40px; padding: 6px 14px; font-size: 0.94rem; }
.boton-icono { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--radio); background: transparent; color: var(--tinta-2); cursor: pointer; }
.boton-icono:hover { background: var(--gris-claro); color: var(--tinta); }
.boton-icono:disabled { opacity: 0.3; cursor: default; }
.enlace { border: 0; background: none; padding: 6px 0; color: var(--azul); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.enlace:hover { color: var(--azul-osc); }
.enlace-fila { text-align: left; padding: 2px 0; font-weight: 600; }
.enlace-chico { justify-self: start; padding: 0; font-size: 0.92rem; font-weight: 600; }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 18px; }
.acciones-izq { justify-content: flex-start; }
.acciones-centro { justify-content: center; }
.acciones .espacio { flex: 1 1 auto; }
@keyframes giro { to { transform: rotate(360deg); } }
.giro { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(80, 91, 115, 0.3); border-top-color: currentColor; border-radius: 50%; animation: giro 0.8s linear infinite; flex: none; }
.cargando { display: flex; align-items: center; gap: 10px; padding: 28px 0; color: var(--tinta-2); }

/* ---------- Campos ---------- */
.pila { display: grid; gap: 16px; }
.campo { display: grid; gap: 6px; min-width: 0; }
.campo-etiqueta { font-weight: 600; }
.campo-opcional { font-weight: 400; color: var(--tinta-2); }
.campo-ayuda { color: var(--tinta-2); font-size: 0.92rem; margin-top: -2px; }
.campo-error { color: var(--rojo-texto); font-weight: 600; font-size: 0.95rem; }
.campo-corto input { max-width: 140px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--hoja); color: var(--tinta); }
textarea { resize: vertical; line-height: 1.4; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23101B3B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--azul); outline-offset: 0; border-color: var(--azul); }
input::placeholder, textarea::placeholder { color: #7A8497; }
.en-linea { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.con-unidad { display: flex; align-items: center; gap: 10px; }
.con-unidad span { font-weight: 600; color: var(--tinta-2); white-space: nowrap; }
.casilla { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.casilla input, .opcion input, .dia input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--azul); }
.nota { color: var(--tinta-2); font-size: 0.92rem; }
.mensaje { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radio); font-weight: 600; }
.mensaje-error { background: var(--rojo-claro); color: var(--rojo-texto); }
.mensaje-info { background: var(--azul-claro); color: var(--azul-osc); }

.opciones { display: grid; gap: 8px; }
.opciones-columnas { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.opcion { display: flex; align-items: flex-start; gap: 12px; min-height: 52px; padding: 13px 14px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--hoja); cursor: pointer; }
.opcion.marcada { border-color: var(--azul); background: var(--azul-claro); }
.opcion small { display: block; color: var(--tinta-2); font-size: 0.88rem; }
.opcion-doble b { display: block; }

/* Sí / No / No aplica: tres botones grandes para el pulgar */
.sino { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.sino-op { position: relative; display: flex; align-items: center; justify-content: center; min-height: 56px; padding: 8px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--hoja); font-weight: 700; cursor: pointer; text-align: center; }
.sino-op input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sino-op:focus-within { outline: 3px solid var(--azul); outline-offset: 2px; }
.sino-si.marcada { background: var(--verde); border-color: var(--verde); color: #fff; }
.sino-no.marcada { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.sino-na.marcada { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.obs { margin-top: 8px; }

.fotos { display: flex; flex-wrap: wrap; gap: 10px; }
.foto { position: relative; width: 104px; height: 104px; border-radius: var(--radio); overflow: hidden; background: var(--gris-claro); display: flex; align-items: center; justify-content: center; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-quitar { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(16, 27, 59, 0.82); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.foto-agregar { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 132px; min-height: 104px; padding: 8px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--hoja); color: var(--azul); font-weight: 600; font-size: 0.9rem; text-align: center; cursor: pointer; }
.foto-abrir { border: 0; padding: 0; background: none; width: 100%; height: 100%; cursor: zoom-in; }
.foto-grande { display: block; max-height: 72vh; margin: 0 auto; border-radius: var(--radio); }
.firma { display: grid; gap: 4px; justify-items: start; }
.firma-lienzo { width: 100%; max-width: 600px; aspect-ratio: 600 / 220; border: 1.5px solid var(--borde); border-radius: var(--radio); background: #fff; touch-action: none; cursor: crosshair; }
.ubicacion { display: grid; gap: 8px; justify-items: start; }
.ubicacion-lectura span { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* ---------- Marco ---------- */
.barra { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--alto-barra); padding: 0 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); background: var(--tinta); color: #fff; }
.barra-marca { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.barra-app { font-family: var(--timbre); font-size: 1.85rem; line-height: 1; letter-spacing: 0.02em; }
.barra-org { color: #C5CCDD; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-lado { display: flex; align-items: center; gap: 14px; flex: none; }
.barra-usuario { display: none; color: #C5CCDD; font-size: 0.92rem; }
.estado-red { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 12px; border: 1.5px solid rgba(255, 255, 255, 0.45); border-radius: 18px; background: transparent; color: #fff; font-weight: 600; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.estado-red:focus-visible { outline-color: #fff; }
.estado-ok { border-color: #5FD08F; }
.estado-ok .icono { color: #5FD08F; }
.estado-cola { background: var(--ambar); border-color: var(--ambar); color: var(--tinta); }
.estado-sin { background: #fff; border-color: #fff; color: var(--tinta); }
.contenido { min-width: 0; }
.franja-envio { padding: 10px 16px; background: var(--ambar-claro); color: var(--tinta); font-weight: 600; font-size: 0.95rem; border-bottom: 1.5px solid var(--ambar); }
.franja-grave { background: var(--rojo-claro); border-bottom-color: var(--rojo); color: var(--rojo-texto); }
.principal { padding: 22px 16px calc(var(--alto-nav) + 40px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; outline: none; }
.marco-admin .principal { max-width: 1040px; }

.nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; background: var(--hoja); border-top: 1.5px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); }
.nav-grupo { display: flex; flex: 1 1 0; min-width: 0; }
.nav-titulo { display: none; }
.nav-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--alto-nav); padding: 6px 2px; border: 0; border-top: 3px solid transparent; background: none; color: var(--tinta-2); font-size: 0.76rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-item.activo { color: var(--azul); border-top-color: var(--azul); }
.marco-admin .nav-grupo-propio { display: none; }
.marco-admin .nav-grupo a:nth-of-type(5) { display: none; }
.marco-admin .nav-grupo:first-child { flex: 4 1 0; }
.nav-mas { flex: 1 1 0; }

@media (min-width: 960px) {
  .marco { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: var(--alto-barra) 1fr; min-height: 100vh; }
  .barra { grid-column: 1 / -1; padding: 0 24px; }
  .barra-usuario { display: inline; }
  .nav { position: sticky; top: var(--alto-barra); align-self: start; height: calc(100vh - var(--alto-barra)); flex-direction: column; gap: 18px; padding: 20px 12px; border-top: 0; border-right: 1.5px solid var(--linea); overflow-y: auto; }
  .nav-grupo, .marco-admin .nav-grupo:first-child { flex: none; flex-direction: column; gap: 2px; }
  .marco-admin .nav-grupo-propio { display: flex; }
  .marco-admin .nav-grupo a:nth-of-type(5) { display: flex; }
  .nav-titulo { display: block; padding: 0 12px 6px; color: var(--tinta-2); font-size: 0.85rem; font-weight: 600; }
  .nav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 8px 12px; border-top: 0; border-left: 3px solid transparent; border-radius: 0 var(--radio) var(--radio) 0; font-size: 1rem; }
  .nav-item:hover { background: var(--gris-claro); }
  .nav-item.activo { background: var(--azul-claro); border-left-color: var(--azul); }
  .nav-mas { display: none; }
  .principal { padding: 32px 32px 64px; margin: 0; }
  .marco:not(.marco-admin) .principal { margin: 0 auto; }
}

/* ---------- Encabezados y bloques ---------- */
.encabezado { display: grid; gap: 6px; margin-bottom: 20px; }
.encabezado-bajada { color: var(--tinta-2); }
.encabezado-accion { grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.encabezado-chico { margin-bottom: 14px; }
.volver { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -10px 0 6px -6px; padding: 0 8px 0 2px; color: var(--tinta-2); font-weight: 600; text-decoration: none; }
.volver:hover { color: var(--tinta); }
.bloque { margin-top: 30px; }
.bloque > h2, .bloque-cabeza { margin-bottom: 10px; }
.bloque-cabeza { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.bloque-cabeza h2 { margin: 0; }
.bloque > .campo + .campo { margin-top: 16px; }
.bloque > p + p, .bloque > p + .acciones, .bloque > .pila + p { margin-top: 8px; }
.bloque form.pila { max-width: 480px; }
.bloque-bajada { color: var(--tinta-2); font-size: 0.95rem; margin: -4px 0 12px; max-width: 68ch; }
.vacio { padding: 22px 20px; border-radius: 12px; background: var(--hoja); border: 1.5px solid var(--linea); display: grid; gap: 8px; justify-items: start; max-width: 620px; }
.vacio p { color: var(--tinta-2); }
.vacio .vacio-titulo { color: var(--tinta); font-weight: 700; font-size: 1.08rem; }
.vacio .boton { margin-top: 6px; }
.al-dia { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--verde-claro); color: var(--verde-texto); font-weight: 600; }
.tira { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-radius: 12px; background: var(--azul-claro); margin-bottom: 8px; }
.tira span { flex: 1 1 220px; font-weight: 600; }

/* ---------- Lista de tareas: la fecha tope va timbrada a la izquierda ---------- */
.lista { background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 12px; overflow: hidden; }
.tarea { display: flex; align-items: center; gap: 14px; padding: 12px 14px; color: var(--tinta); text-decoration: none; border-bottom: 1.5px solid var(--linea); }
.lista > :last-child { border-bottom: 0; }
.tarea:hover { background: #F6F8F2; }
.tarea > .icono { color: var(--borde); }
.tarea-texto { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.tarea-titulo { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.tarea-lista .tarea-titulo { font-weight: 600; }
.tag { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 62px; border: 2px solid var(--tinta); border-radius: 6px; background: var(--hoja); color: var(--tinta); }
.tag-dia { font-family: var(--timbre); font-size: 2.2rem; line-height: 0.9; letter-spacing: 0.01em; }
.tag-mes { font-size: 0.82rem; font-weight: 700; line-height: 1.1; }
.tag-ambar { background: var(--ambar); border-color: var(--ambar); }
.tag-rojo { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.tag-verde { background: var(--verde); border-color: var(--verde); color: #fff; }
.tag-libre { border-color: var(--azul); color: var(--azul); }
.tag-cola { border-color: var(--ambar); background: var(--ambar-claro); color: var(--ambar-texto); }
.plazo { display: flex; align-items: flex-start; gap: 6px; color: var(--tinta-2); font-size: 0.94rem; line-height: 1.3; }
.plazo .icono { margin-top: 1px; }
.plazo-ambar { color: var(--ambar-texto); font-weight: 600; }
.plazo-rojo { color: var(--rojo-texto); font-weight: 600; }
.fila-historial { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1.5px solid var(--linea); color: var(--tinta); text-decoration: none; }
.fila-historial-enlace:hover { background: #F6F8F2; }
.fila-historial-texto { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; color: var(--tinta); text-decoration: none; }
.fila-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px; border-bottom: 1.5px solid var(--linea); }
.fila-form-texto { flex: 1 1 280px; min-width: 0; display: grid; gap: 4px; color: var(--tinta); text-decoration: none; }
.fila-form-texto:hover .tarea-titulo { color: var(--azul); }
.apagada { opacity: 0.62; }
.fila-enlace { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 4px; color: var(--tinta); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid var(--linea); }
.fila-enlace span { flex: 1 1 auto; }
.lista-mas > :last-child { border-bottom: 0; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.84rem; font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.chip-verde { background: var(--verde-claro); color: var(--verde-texto); }
.chip-ambar { background: var(--ambar-claro); color: var(--ambar-texto); }
.chip-rojo { background: var(--rojo-claro); color: var(--rojo-texto); }
.chip-gris { background: var(--gris-claro); color: var(--tinta-2); }
td .chip + .chip, td .chip { margin-left: 0; }
td .chip { margin-top: 2px; }

/* ---------- Llenado ---------- */
.llenado { display: grid; gap: 14px; }
.pregunta { padding: 16px; border: 1.5px solid var(--linea); border-radius: 12px; background: var(--hoja); gap: 10px; }
.pregunta .campo-etiqueta { font-size: 1.06rem; line-height: 1.3; }
.pregunta.con-error { border-color: var(--rojo); border-width: 2px; }
.seccion { margin-top: 14px; padding-bottom: 6px; border-bottom: 2px solid var(--tinta); }
.seccion p { color: var(--tinta-2); margin-top: 2px; }
.pie-llenado { display: grid; gap: 10px; margin-top: 22px; justify-items: center; }
.guardado-auto { color: var(--tinta-2); font-size: 0.9rem; min-height: 1.3em; }

/* Timbre de confirmación al enviar */
.sello-fondo { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; background: rgba(238, 241, 232, 0.96); text-align: center; }
.sello { padding: 6px 26px 2px; border: 6px solid var(--tinta); border-radius: 10px; color: var(--tinta); transform: rotate(-5deg); animation: timbrar 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.sello-titulo { font-family: var(--timbre); font-size: 4.6rem; line-height: 1.05; letter-spacing: 0.04em; text-transform: uppercase; }
.sello-verde { border-color: var(--verde); color: var(--verde); }
.sello-azul { border-color: var(--azul); color: var(--azul); }
.sello-espera { border-color: var(--borde); color: var(--tinta-2); animation: none; transform: none; }
.sello-espera .sello-titulo { font-size: 2.6rem; }
.sello-bajada { max-width: 30ch; font-weight: 600; font-size: 1.1rem; }
@keyframes timbrar { from { transform: rotate(-5deg) scale(1.7); opacity: 0; } to { transform: rotate(-5deg) scale(1); opacity: 1; } }

/* ---------- Ver una respuesta ---------- */
.respuesta { background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 12px; overflow: hidden; }
.respuesta-fila { display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1.5px solid var(--linea); }
.respuesta-fila:last-child { border-bottom: 0; }
.respuesta dt { color: var(--tinta-2); font-size: 0.94rem; }
.respuesta dd { font-weight: 600; overflow-wrap: anywhere; }
.respuesta-obs { font-weight: 400; margin-top: 4px; }
.sin-dato { color: var(--tinta-2); font-weight: 400; }
.valor-sino { display: inline-block; padding: 1px 12px; border-radius: 6px; background: var(--gris-claro); }
.valor-si { background: var(--verde-claro); color: var(--verde-texto); }
.valor-no { background: var(--rojo-claro); color: var(--rojo-texto); }
.ficha { display: grid; gap: 0; background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 12px; overflow: hidden; }
.ficha > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 14px; border-bottom: 1.5px solid var(--linea); }
.ficha > div:last-child { border-bottom: 0; }
.ficha dt { color: var(--tinta-2); }
.ficha dd { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.ficha-clave dd { font-size: 1.15rem; letter-spacing: 0.03em; }

/* ---------- Acceso ---------- */
.acceso { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; }
.acceso-caja { width: 100%; max-width: 440px; padding: 24px 22px 26px; background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 14px; display: grid; gap: 16px; }
.acceso-marca { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 2px solid var(--tinta); }
.acceso-app { font-family: var(--timbre); font-size: 1.9rem; line-height: 1; letter-spacing: 0.02em; }
.acceso-org { color: var(--tinta-2); font-size: 0.94rem; margin-top: 2px; }
.acceso-org:empty { display: none; }
.acceso-bajada { color: var(--tinta-2); margin-top: -8px; }
.pasos { padding-left: 22px; display: grid; gap: 8px; }
@media (min-width: 700px) { .acceso { align-items: center; } }

/* ---------- Diálogos y avisos ---------- */
.dialogo-fondo { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(16, 27, 59, 0.55); }
.dialogo { width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--hoja); border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.dialogo-ancho { max-width: 720px; }
.dialogo:focus { outline: none; }
.dialogo-cabeza { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 10px 10px 20px; background: var(--hoja); border-bottom: 1.5px solid var(--linea); }
.dialogo-cuerpo { padding: 18px 20px 22px; }
.dialogo-texto { color: var(--tinta-2); }
@media (min-width: 640px) { .dialogo-fondo { align-items: center; padding: 24px; } .dialogo { border-radius: 16px; } }
.avisos { position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(var(--alto-nav) + 14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.aviso { display: flex; align-items: flex-start; gap: 10px; max-width: 520px; padding: 12px 16px; border-radius: 10px; background: var(--tinta); color: #fff; font-weight: 600; }
.aviso-error { background: var(--rojo-texto); }
.aviso.saliendo { opacity: 0; transition: opacity 0.3s; }
@media (min-width: 960px) { .avisos { bottom: 24px; } }

/* ---------- Administración ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.filtros select, .filtros input[type=date] { width: auto; min-width: 160px; flex: 1 1 160px; max-width: 360px; min-height: 44px; }
.filtro-fecha { display: flex; align-items: center; gap: 8px; color: var(--tinta-2); font-weight: 600; font-size: 0.94rem; }
.filtros .casilla { align-items: center; font-weight: 600; }
.panel-cuerpo.refrescando { opacity: 0.45; transition: opacity 0.15s; }

.resumen { padding: 20px; background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 12px; display: grid; gap: 14px; }
.resumen-fila { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 40px; }
.cifra-rotulo { color: var(--tinta-2); font-weight: 600; font-size: 0.94rem; }
.cifra-valor { font-size: 3.5rem; line-height: 1; font-weight: 700; letter-spacing: -0.02em; }
.cifras { display: flex; flex-wrap: wrap; gap: 12px 34px; }
.cifra-num { font-size: 1.55rem; line-height: 1.15; font-weight: 700; }
.resumen-frase { max-width: 70ch; }

/* Reparto de estados: barra delgada en tablas, barra alta sola */
.barra-estados { display: flex; gap: 2px; height: 8px; width: 100%; min-width: 90px; }
.barra-estados .seg { min-width: 3px; border-radius: 4px; flex-basis: 0; flex-shrink: 1; }
.barra-vacia { background: var(--gris-claro); border-radius: 4px; }
.barra-alta { height: 28px; }
.barra-alta .seg { display: flex; align-items: center; padding: 0 8px; overflow: visible; min-width: 4px; }
.seg-texto { font-size: 0.86rem; font-weight: 700; white-space: nowrap; }
.seg-verde { background: var(--verde); color: #fff; }
.seg-ambar { background: var(--ambar); color: var(--tinta); }
.seg-rojo { background: var(--rojo); color: #fff; }
.seg-azul { background: var(--azul); color: #fff; }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--tinta-2); font-size: 0.9rem; font-weight: 600; margin: 8px 0 4px; }
.leyenda span { display: inline-flex; align-items: center; gap: 5px; }
.muestra { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

.tabla-caja { overflow-x: auto; background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 12px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.tabla th, .tabla td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1.5px solid var(--linea); }
.tabla thead th { color: var(--tinta-2); font-weight: 600; font-size: 0.88rem; white-space: nowrap; background: #F7F8F4; }
.tabla tbody tr:last-child th, .tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody th { font-weight: 600; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .fuerte { font-weight: 700; }
.tabla .sub { color: var(--tinta-2); font-weight: 400; font-size: 0.88rem; }
.tabla-medidores .celda-barra { width: 24%; min-width: 120px; }
.tabla-medidores th:first-child { min-width: 180px; }
.resumen + .tabla-caja, .filtros + .resumen { margin-top: 16px; }
.resumen .acciones { margin-top: 2px; }
.tabla-filas tbody tr:hover { background: #F6F8F2; }

/* Gráfico de columnas */
.grafico { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; padding: 18px 16px 10px 12px; background: var(--hoja); border: 1.5px solid var(--linea); border-radius: 12px; }
.eje-y { position: relative; height: 190px; min-width: 26px; color: var(--tinta-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.eje-y span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.grafico-area { min-width: 0; overflow-x: auto; }
.plano { position: relative; height: 190px; }
.plano, .eje-x { margin: 0 16px 0 4px; }
.linea-guia { position: absolute; left: 0; right: 0; height: 1px; background: #E6E9E0; }
.linea-base { background: var(--borde); }
.columnas { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.celda { flex: 1 1 0; min-width: 10px; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; border-radius: 4px; }
.celda:hover, .celda:focus-visible { background: rgba(31, 79, 216, 0.08); }
.celda:focus-visible { outline-offset: -2px; }
.pila-col { width: min(24px, 76%); height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.tramo { display: block; width: 100%; min-height: 2px; flex: none; }
.pila-col .tramo:last-child { border-radius: 4px 4px 0 0; }
.eje-x { display: flex; gap: 2px; padding-top: 6px; color: var(--tinta-2); font-size: 0.78rem; }
.eje-x span { flex: 1 1 0; min-width: 10px; text-align: center; white-space: nowrap; overflow: visible; }
.eje-x .oculta { visibility: hidden; }
.grafico-denso .plano, .grafico-denso .eje-x { min-width: 540px; }
.globo { position: absolute; top: 4px; z-index: 5; transform: translateX(-50%); padding: 8px 12px; border-radius: 8px; background: var(--tinta); color: #fff; font-size: 0.86rem; white-space: nowrap; pointer-events: none; }
.globo-titulo { font-weight: 600; margin-bottom: 4px; color: #C5CCDD; }
.globo-fila { display: flex; align-items: center; gap: 8px; }
.globo-fila b { min-width: 2ch; text-align: right; font-size: 0.98rem; }
.trazo { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }

/* Editor de formularios */
.campos-editor { display: grid; gap: 12px; }
.tarjeta-campo { display: grid; gap: 12px; padding: 14px 16px 16px; background: var(--hoja); border: 1.5px solid var(--linea); border-left: 5px solid var(--azul); border-radius: 12px; }
.tarjeta-seccion { border-left-color: var(--tinta); }
.tarjeta-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -6px -8px -4px 0; }
.tarjeta-tipo { display: inline-flex; align-items: center; gap: 8px; color: var(--tinta-2); font-weight: 600; font-size: 0.92rem; }
.tarjeta-botones { display: flex; }
.campo-extras { display: grid; gap: 12px; }
.campo-extras:empty { display: none; }
.tipos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tipo { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--hoja); font-weight: 600; text-align: left; cursor: pointer; }
.tipo:hover { border-color: var(--azul); background: var(--azul-claro); }
.tipo .icono { color: var(--azul); }
.dias { display: flex; flex-wrap: wrap; gap: 8px; }
.dia { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 14px 8px 12px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--hoja); font-weight: 600; cursor: pointer; }
.dia input { margin: 0; }
.dia.marcada { border-color: var(--azul); background: var(--azul-claro); }
.atajos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pastilla { min-height: 40px; padding: 6px 16px; border: 1.5px solid var(--borde); border-radius: 20px; background: var(--hoja); font-weight: 600; cursor: pointer; }
.pastilla:hover { border-color: var(--azul); }
.pastilla-activa { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.atajos + input[type=search] { margin-bottom: 10px; }
.atajos ~ .nota { margin-bottom: 10px; }
.pie-editor { position: sticky; bottom: calc(var(--alto-nav) + env(safe-area-inset-bottom)); z-index: 10; margin: 26px -16px 0; padding: 12px 16px; background: var(--papel); border-top: 1.5px solid var(--linea); }
@media (min-width: 960px) { .pie-editor { bottom: 0; margin: 26px 0 0; padding: 14px 0; } }
.previa { display: grid; gap: 14px; }
.previa > p { color: var(--tinta-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
