/* --------------------------------------------------------------------------
   Checklist de Preinspección — Hidro Lógica Ambiental
   Paleta y tipografía tomadas del sitio público.
   Pensado para llenarse en el celular, a la intemperie y con guantes:
   objetivos táctiles grandes y contraste alto.
   -------------------------------------------------------------------------- */

:root {
  --azul: #3AA7C7;
  --verde: #7EB63F;
  --cafe: #B27B4B;
  --rojo: #D64545;
  --ambar: #E0A030;
  --gris-logo: #9AA0A4;

  --fondo: #F3F8FA;
  --panel: #FDFEFE;
  --panel-suave: #EDF4F7;
  --texto: #23343C;
  --texto-suave: #6C7A82;
  --borde: #DDE7EC;
  --sombra: 0 1px 2px rgba(35, 52, 60, .06), 0 4px 16px rgba(35, 52, 60, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #101A1F;
    --panel: #16242B;
    --panel-suave: #1C2E36;
    --texto: #D3DCE0;
    --texto-suave: #93A2A9;
    --gris-logo: #AEB6BA;
    --borde: #263A43;
    --rojo: #F0736F;
    --ambar: #E8B860;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------------------------------------------------------- Encabezado */
.encabezado {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--borde);
}
.encabezado-marca { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.marca-texto { display: flex; flex-direction: column; min-width: 0; }
.marca-texto strong { font-size: .95rem; font-weight: 600; letter-spacing: .01em; }
.marca-texto span {
  font-size: .78rem; color: var(--texto-suave);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.encabezado-nav { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.encabezado-nav a {
  color: var(--texto-suave); text-decoration: none; font-size: .85rem;
  padding: .4rem .6rem; border-radius: 8px; white-space: nowrap;
}
.encabezado-nav a:hover { background: var(--panel-suave); color: var(--texto); }
.encabezado-nav a.activo { color: var(--azul); font-weight: 600; }

.contenido { max-width: 46rem; margin: 0 auto; padding: 1.1rem 1rem 3.5rem; }
.contenido.ancho { max-width: 76rem; }

.pie {
  text-align: center; font-size: .78rem; color: var(--texto-suave);
  padding: 1.5rem 1rem 2.5rem; border-top: 1px solid var(--borde);
}

/* Etiqueta visible solo para lectores de pantalla */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------------- Texto */
h1 { font-size: 1.35rem; font-weight: 600; line-height: 1.25; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 600; }
.subtitulo { color: var(--texto-suave); font-size: .92rem; margin-top: .35rem; }
.etiqueta-seccion {
  font-size: .72rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--azul);
}

/* ------------------------------------------------------------------ Tarjetas */
.tarjeta {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 14px;
  box-shadow: var(--sombra);
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.tarjeta > h2 { margin-bottom: .2rem; }
.tarjeta-encabezado { margin-bottom: .9rem; }

/* Barra tricolor del logo, como acento superior */
.acento { display: flex; gap: 5px; margin-bottom: 1rem; }
.acento span { height: 4px; border-radius: 2px; flex: 1; }
.acento span:nth-child(1) { background: var(--azul); }
.acento span:nth-child(2) { background: var(--cafe); }
.acento span:nth-child(3) { background: var(--verde); }

/* -------------------------------------------------------------------- Campos */
.campo { margin-bottom: 1rem; }
.campo:last-child { margin-bottom: 0; }
.campo > label {
  display: block; font-weight: 600; font-size: .92rem; margin-bottom: .4rem;
}
.campo .ayuda { display: block; font-weight: 400; color: var(--texto-suave); font-size: .82rem; margin-top: .15rem; }
.requerido { color: var(--rojo); }

input[type="text"], input[type="date"], input[type="number"],
input[type="search"], input[type="password"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* 16px evita el zoom automatico en iOS */
  color: var(--texto);
  background: var(--panel);
  border: 1.5px solid var(--borde);
  border-radius: 10px;
  padding: .72rem .8rem;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239AA0A4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  padding-right: 2.2rem;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(58, 167, 199, .18);
}
input.error, select.error, textarea.error { border-color: var(--rojo); }

/* ---------------------------------------------------------------- Checklist */
.item {
  border-top: 1px solid var(--borde);
  padding: .95rem 0 1rem;
}
.item:first-of-type { border-top: none; padding-top: .3rem; }
.item-texto { font-size: .95rem; margin-bottom: .6rem; }
.item.sin-responder .item-texto::after {
  content: " *";
  color: var(--rojo);
  font-weight: 700;
}

/* Grupo de botones de respuesta, hecho con radios accesibles */
.opciones { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .5rem; }
.opciones input { position: absolute; opacity: 0; pointer-events: none; }
.opciones label {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: .5rem .4rem;
  font-size: 1.05rem; font-weight: 600;
  border: 1.5px solid var(--borde); border-radius: 10px;
  background: var(--panel); color: var(--texto-suave);
  cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.opciones label:active { transform: scale(.985); }
.opciones input:focus-visible + label { box-shadow: 0 0 0 3px rgba(58, 167, 199, .3); }

.opciones input:checked + label.ok {
  background: var(--verde); border-color: var(--verde); color: #fff;
}
.opciones input:checked + label.falla {
  background: var(--rojo); border-color: var(--rojo); color: #fff;
}
.opciones input:checked + label.na {
  background: var(--gris-logo); border-color: var(--gris-logo); color: #fff;
}
.opciones label.estado { font-size: .92rem; }

/* Adjuntar foto: aparece solo cuando el punto se marca como falla */
.zona-foto {
  margin-top: .65rem;
  padding: .7rem .8rem;
  border: 1.5px dashed var(--borde);
  border-radius: 10px;
  background: var(--panel-suave);
}
.zona-foto[hidden] { display: none; }
.zona-foto p { font-size: .82rem; color: var(--texto-suave); margin-bottom: .5rem; }
.zona-foto input[type="file"] { font-size: .85rem; width: 100%; }
.zona-foto .conteo { font-size: .8rem; color: var(--verde); font-weight: 600; margin-top: .4rem; }

/* ------------------------------------------------------------------- Avisos */
.aviso {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .8rem .9rem; border-radius: 10px;
  font-size: .88rem; line-height: 1.5;
  margin-bottom: 1rem;
}
.aviso strong { display: block; margin-bottom: .15rem; }
.aviso.critico {
  background: color-mix(in srgb, var(--rojo) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--rojo) 35%, transparent);
  color: var(--texto);
}
.aviso.info {
  background: color-mix(in srgb, var(--azul) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--azul) 30%, transparent);
}
.aviso.exito {
  background: color-mix(in srgb, var(--verde) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--verde) 35%, transparent);
}
.aviso.error {
  background: color-mix(in srgb, var(--rojo) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--rojo) 35%, transparent);
}
.aviso .icono { font-size: 1.1rem; line-height: 1.3; }

/* ------------------------------------------------------------------ Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 52px; padding: .8rem 1.4rem;
  font: inherit; font-size: 1rem; font-weight: 600;
  border: 1.5px solid transparent; border-radius: 10px;
  background: var(--azul); color: #fff;
  cursor: pointer; text-decoration: none;
  -webkit-appearance: none; appearance: none;
}
.boton:hover { filter: brightness(1.06); }
.boton:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.boton.ancho { width: 100%; }
.boton.verde { background: var(--verde); }
.boton.secundario { background: var(--panel); color: var(--texto); border-color: var(--borde); }
.boton.chico { min-height: 40px; padding: .45rem .85rem; font-size: .88rem; }

.acciones { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.acciones .boton { flex: 1 1 12rem; }

/* -------------------------------------------------------- Selector de unidad */
.lista-unidades { display: grid; gap: .55rem; margin-top: .8rem; }
.unidad {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  width: 100%; text-align: left;
  padding: .85rem .95rem; min-height: 60px;
  background: var(--panel); color: var(--texto);
  border: 1.5px solid var(--borde); border-radius: 11px;
  font: inherit; cursor: pointer; text-decoration: none;
}
.unidad:hover { border-color: var(--azul); }
.unidad-eco { font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; }
.unidad-desc { font-size: .84rem; color: var(--texto-suave); }
.unidad .flecha { color: var(--gris-logo); font-size: 1.2rem; }
.vacio { text-align: center; color: var(--texto-suave); padding: 2rem 1rem; font-size: .92rem; }

/* -------------------------------------------------------------- Progreso fijo */
.progreso-fijo {
  position: sticky; bottom: 0; z-index: 15;
  background: var(--panel);
  border-top: 1px solid var(--borde);
  padding: .7rem 1rem;
  padding-bottom: calc(.7rem + env(safe-area-inset-bottom));
  margin: 1.5rem -1rem -3.5rem;
}
.progreso-barra { height: 6px; border-radius: 3px; background: var(--panel-suave); overflow: hidden; }
.progreso-barra i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .2s ease; }
.progreso-texto {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .82rem; color: var(--texto-suave); margin-top: .45rem;
}
.progreso-texto .no-operar { color: var(--rojo); font-weight: 700; }

/* ------------------------------------------------------------------- Tablas */
.tabla-envoltura { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 44rem; }
table.tabla th, table.tabla td {
  padding: .65rem .7rem; text-align: left; border-bottom: 1px solid var(--borde);
  white-space: nowrap;
}
table.tabla th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--texto-suave); font-weight: 700;
}
table.tabla tbody tr:hover { background: var(--panel-suave); }
table.tabla a { color: var(--azul); text-decoration: none; font-weight: 600; }
table.tabla a:hover { text-decoration: underline; }
td.envolver, th.envolver { white-space: normal; min-width: 12rem; }

.insignia {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.insignia.ok { background: color-mix(in srgb, var(--verde) 18%, transparent); color: var(--verde); }
.insignia.falla { background: color-mix(in srgb, var(--rojo) 16%, transparent); color: var(--rojo); }
.insignia.na { background: var(--panel-suave); color: var(--texto-suave); }
.insignia.aviso { background: color-mix(in srgb, var(--ambar) 20%, transparent); color: var(--ambar); }

/* --------------------------------------------------------------- Indicadores */
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.indicador { background: var(--panel); border: 1px solid var(--borde); border-radius: 12px; padding: .85rem .95rem; }
.indicador .cifra { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.indicador .rotulo { font-size: .78rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }
.indicador.rojo .cifra { color: var(--rojo); }
.indicador.verde .cifra { color: var(--verde); }

/* ------------------------------------------------------------------ Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filtros .campo { margin-bottom: 0; flex: 1 1 10rem; }
.filtros .campo > label { font-size: .78rem; }

/* ------------------------------------------------------------ Detalle y fotos */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .55rem; margin-top: .6rem; }
.galeria a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--borde); }
.galeria img { display: block; width: 100%; height: 7rem; object-fit: cover; }

.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; }
.dato .rotulo { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); }
.dato .valor { font-size: 1rem; font-weight: 600; margin-top: .1rem; word-break: break-word; }

.fila-respuesta {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 0; border-top: 1px solid var(--borde); font-size: .9rem;
}
.fila-respuesta:first-child { border-top: none; }

@media print {
  .encabezado, .pie, .acciones, .encabezado-nav, .no-imprimir { display: none !important; }
  body { background: #fff; }
  .tarjeta { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

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