/* Estilos pensados para terreno: botones grandes, alto contraste. */
:root {
  --azul: #0F4C81;
  --gris-fondo: #F2F4F7;
  --gris-borde: #D5DAE1;
  --texto: #1C2733;
  --ok: #2E7D32;
  --mal: #C62828;
  --pendiente: #E65100;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--gris-fondo);
  color: var(--texto);
  padding-bottom: 70px;
}

.oculto { display: none !important; }

/* ---- barra superior ---- */
#topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--azul); color: white;
  padding: 10px 14px;
  position: sticky; top: 0; z-index: 10;
}
#titulo-app { font-weight: 700; flex: 1; }
#chip-usuario { font-size: 12px; opacity: .9; }
.btn-icono {
  background: none; border: none; color: white;
  font-size: 22px; cursor: pointer; padding: 2px 6px;
}

/* ---- barra inferior ---- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: white;
  border-top: 1px solid var(--gris-borde); z-index: 10;
}
.tab {
  flex: 1; border: none; background: none;
  padding: 14px 4px; font-size: 13px; font-weight: 600;
  color: #667; cursor: pointer;
}
.tab.activa { color: var(--azul); border-top: 3px solid var(--azul); }

/* ---- contenido ---- */
#app { padding: 14px; max-width: 640px; margin: 0 auto; }

h1 { font-size: 20px; margin: 6px 0 14px; }
h2 { font-size: 16px; margin: 16px 0 8px; }

.tarjeta {
  background: white; border: 1px solid var(--gris-borde);
  border-radius: 12px; padding: 14px; margin-bottom: 12px;
}

/* ---- formularios ---- */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 12px; font-size: 16px;
  border: 1px solid var(--gris-borde); border-radius: 8px;
  background: white;
}
textarea { min-height: 70px; }

.boton {
  display: block; width: 100%;
  padding: 15px; margin-top: 14px;
  font-size: 17px; font-weight: 700;
  border: none; border-radius: 10px;
  background: var(--azul); color: white; cursor: pointer;
}
.boton.secundario { background: white; color: var(--azul); border: 2px solid var(--azul); }
.boton.peligro { background: var(--mal); }
.boton.exito { background: var(--ok); }
.boton:disabled { opacity: .5; }

.error {
  background: #FDECEA; color: var(--mal);
  border: 1px solid #F5C6C0; border-radius: 8px;
  padding: 10px; margin-top: 10px; font-size: 14px;
}

/* ---- tablero ---- */
.banner-periodo {
  border-radius: 12px; padding: 18px; color: white;
  text-align: center; margin-bottom: 14px;
}
.banner-periodo .grande { font-size: 26px; font-weight: 800; }
.banner-periodo .chico { font-size: 13px; opacity: .95; }

.grilla-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: white; border: 1px solid var(--gris-borde);
  border-radius: 12px; padding: 12px; text-align: center;
}
.stat .numero { font-size: 28px; font-weight: 800; }
.stat .etiqueta { font-size: 12px; color: #556; }

.aviso-ventana {
  border-radius: 10px; padding: 10px 12px; font-size: 14px;
  margin-bottom: 12px; background: #FFF8E1; border: 1px solid #F5C400;
}

/* ---- lista de activos ---- */
.fila-activo {
  display: block; width: 100%; text-align: left;
  background: white; border: 1px solid var(--gris-borde);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; font-size: 15px;
}
.fila-activo .nombre { font-weight: 700; }
.fila-activo .detalle { font-size: 13px; color: #556; margin-top: 2px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: white; margin-top: 6px;
}
.badge.vigente { background: var(--ok); }
.badge.pendiente { background: var(--pendiente); }
.badge.no_utilizar { background: var(--mal); }
.badge.vencido { background: #616161; }
.badge.sin_inspeccion { background: #90A4AE; }

/* ---- checklist ---- */
.item-check {
  background: white; border: 1px solid var(--gris-borde);
  border-radius: 12px; padding: 12px; margin-bottom: 10px;
}
.item-check .texto { font-size: 15px; margin-bottom: 10px; }
.par-botones { display: flex; gap: 10px; }
.opcion {
  flex: 1; padding: 12px; font-size: 15px; font-weight: 700;
  border: 2px solid var(--gris-borde); border-radius: 10px;
  background: white; cursor: pointer;
}
.opcion.sel-ok { background: var(--ok); border-color: var(--ok); color: white; }
.opcion.sel-mal { background: var(--mal); border-color: var(--mal); color: white; }

/* ---- firma ---- */
canvas.firma {
  width: 100%; height: 160px;
  background: white; border: 2px dashed var(--gris-borde); border-radius: 10px;
  touch-action: none;
}

/* ---- QR ---- */
.qr-box { text-align: center; }
.qr-box img { width: 220px; height: 220px; }

#lector-qr { width: 100%; border-radius: 12px; overflow: hidden; }

/* ---- tabla usuarios / historial ---- */
.linea { border-top: 1px solid var(--gris-borde); padding: 10px 0; font-size: 14px; }
.linea .sub { color: #556; font-size: 12px; }
