:root {
  --azul: #1B2A4A; --azul-2: #2C4270; --rojo: #D02527;
  --tinta: #1B2A4A; --gris: #5E6B82; --linea: #E3E8F0; --fondo: #F4F6FA; --blanco: #fff;
  --verde: #2E9E5B; --amarillo: #F2B91D;
  --sombra: 0 1px 2px rgba(27,42,74,.06), 0 8px 24px rgba(27,42,74,.08);
  --radio: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tinta); background: var(--fondo); font-size: 17px; line-height: 1.4;
  min-height: 100dvh; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1 { font-size: 1.65rem; line-height: 1.15; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
p { margin: 0 0 .8rem; }
.sub { color: var(--gris); }
.chico { font-size: .88rem; }

/* Barra superior */
.barra {
  position: sticky; top: 0; z-index: 20; background: var(--blanco);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--linea);
}
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca img { height: 30px; width: auto; display: block; }
.marca-texto { color: var(--rojo); font-size: 1.15rem; letter-spacing: .04em; }
.marca-app { color: var(--gris); font-weight: 600; padding-left: 10px; border-left: 1px solid var(--linea); }
#barra-der { display: flex; align-items: center; gap: 8px; }
.pastilla {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; background: #E9F6EE; color: #1F7A45; white-space: nowrap;
}
.pastilla::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pastilla.pend { background: #FFF4D6; color: #8A6200; }
.pastilla.off { background: #FDE9E9; color: #A31C1E; }
.enlace { color: var(--azul-2); font-weight: 600; font-size: .9rem; text-decoration: none; padding: 8px 4px; }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); }
main.ancho { max-width: 1040px; }

.tarjeta { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px; margin-bottom: 16px; }
.tarjeta.plana { box-shadow: none; border: 1px solid var(--linea); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 14px; font-weight: 650;
  background: var(--azul); color: #fff; transition: transform .06s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.ancho { width: 100%; }
.btn.grande { min-height: 68px; font-size: 1.2rem; border-radius: 18px; }
.btn.suave { background: #E8EDF6; color: var(--azul); }
.btn.linea { background: #fff; color: var(--azul); border: 1.5px solid var(--linea); }
.btn.alerta { background: #fff; color: var(--rojo); border: 1.5px solid #F1C7C8; }
.btn.chico { min-height: 40px; padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; }
.fila > .btn { flex: 1 1 140px; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Formularios */
label.campo { display: block; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
label.campo span.opc { font-weight: 400; color: var(--gris); }
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  width: 100%; margin-top: 6px; padding: 14px; border: 1.5px solid var(--linea); border-radius: 12px;
  background: #fff; font-weight: 400; font-size: 1.05rem; outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--azul-2); box-shadow: 0 0 0 3px rgba(44,66,112,.12); }
.codigo-in { text-align: center; font-size: 1.6rem !important; font-weight: 700 !important; letter-spacing: .12em; text-transform: uppercase; }
.error { color: var(--rojo); font-weight: 600; margin: 8px 0; }

/* Contadores */
.cont { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.cont:last-child { border-bottom: 0; }
.cont .ctl { display: flex; align-items: center; gap: 6px; }
.cont .ctl button { width: 46px; height: 46px; border-radius: 12px; background: #E8EDF6; font-size: 1.5rem; font-weight: 600; color: var(--azul); line-height: 1; }
.cont .ctl b { min-width: 36px; text-align: center; font-size: 1.25rem; }

/* Cifras */
.cifras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cifra { background: #fff; border-radius: 14px; padding: 14px 10px; text-align: center; box-shadow: var(--sombra); }
.cifra b { display: block; font-size: 1.9rem; line-height: 1.1; }
.cifra span { font-size: .78rem; color: var(--gris); font-weight: 600; }
.cifra.v b { color: var(--verde); } .cifra.a b { color: #B98900; } .cifra.r b { color: var(--rojo); }

/* Asistente paso a paso */
.paso-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.atras { width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: var(--sombra); font-size: 1.4rem; flex: none; }
.progreso { flex: 1; height: 6px; background: var(--linea); border-radius: 3px; overflow: hidden; }
.progreso i { display: block; height: 100%; background: var(--azul); border-radius: 3px; transition: width .2s; }
.pregunta { font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 18px; line-height: 1.15; }
.opciones { display: grid; gap: 12px; }
.opciones.dos { grid-template-columns: 1fr 1fr; }
.op {
  background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px 18px; text-align: left;
  font-size: 1.2rem; font-weight: 650; min-height: 72px; display: flex; flex-direction: column; justify-content: center;
  border: 2.5px solid transparent; transition: transform .06s;
}
.op:active { transform: scale(.98); }
.op small { font-weight: 400; color: var(--gris); font-size: .9rem; margin-top: 2px; }
.op.sel { border-color: var(--azul); }
.op.enorme { min-height: 190px; align-items: center; text-align: center; font-size: 1.6rem; gap: 10px; }
.op.enorme svg { width: 64px; height: 64px; }
.op.centro { align-items: center; text-align: center; min-height: 92px; font-size: 1.35rem; }
.op.verde { background: var(--verde); color: #fff; } .op.amarillo { background: var(--amarillo); color: #3A2C00; } .op.rojo { background: var(--rojo); color: #fff; }
.op.verde small, .op.rojo small { color: rgba(255,255,255,.85); } .op.amarillo small { color: rgba(58,44,0,.75); }
.op.verde, .op.amarillo, .op.rojo { min-height: 104px; font-size: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chip { padding: 9px 14px; border-radius: 999px; background: #E8EDF6; font-size: .9rem; font-weight: 600; }

/* Listas */
.item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 0; border-bottom: 1px solid var(--linea); }
.item:last-child { border-bottom: 0; }
.item .txt { flex: 1; min-width: 0; }
.item .txt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .txt span { color: var(--gris); font-size: .86rem; }
.punto { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--linea); }
.punto.verde { background: var(--verde); } .punto.amarillo { background: var(--amarillo); } .punto.rojo { background: var(--rojo); }
.anulado { opacity: .45; text-decoration: line-through; }
.etq { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #E8EDF6; color: var(--azul); }
.etq.rojo { background: #FDE9E9; color: #A31C1E; } .etq.verde { background: #E9F6EE; color: #1F7A45; }
dl.datos { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
dl.datos dt { color: var(--gris); font-size: .9rem; } dl.datos dd { margin: 0; font-weight: 600; }

/* Resumen */
.barras { display: grid; gap: 7px; }
.barra-fila { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 34px; gap: 10px; align-items: center; font-size: .92rem; }
.barra-fila i { display: block; height: 10px; border-radius: 5px; background: var(--azul); min-width: 2px; }
.barra-fila b { text-align: right; }
.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Firma */
.firma-caja { border: 2px dashed #C9D2E2; border-radius: 14px; background: #fff; position: relative; touch-action: none; }
.firma-caja canvas { display: block; width: 100%; height: 200px; border-radius: 14px; }
.firma-caja::after { content: "Firme aquí"; position: absolute; left: 14px; bottom: 10px; color: #B3BED1; font-size: .85rem; pointer-events: none; }
img.firma { max-width: 280px; width: 100%; display: block; border-bottom: 1.5px solid var(--tinta); }

.banda { background: #FFF4D6; color: #6B4C00; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-weight: 600; }
.banda.roja { background: #FDE9E9; color: #8E1719; }
.aviso { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--azul); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; box-shadow: var(--sombra); z-index: 50; max-width: 90vw; text-align: center; }

/* Panel */
table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tabla th { text-align: left; color: var(--gris); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1.5px solid var(--linea); }
table.tabla td { padding: 10px; border-bottom: 1px solid var(--linea); vertical-align: top; }
.desliza { overflow-x: auto; }
.evento-fila { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; }
.evento-fila .fecha { flex: none; width: 58px; text-align: center; background: var(--fondo); border-radius: 12px; padding: 8px 4px; }
.evento-fila .fecha b { display: block; font-size: 1.3rem; line-height: 1; } .evento-fila .fecha span { font-size: .72rem; color: var(--gris); text-transform: uppercase; font-weight: 700; }
.solo-print { display: none; }

@media (max-width: 560px) {
  .cifras { grid-template-columns: repeat(2, 1fr); }
  .rejilla { grid-template-columns: 1fr; }
  .marca-app { display: none; }
}
@media print {
  body { background: #fff; font-size: 11pt; }
  .no-print { display: none !important; }
  .solo-print { display: block; }
  main, main.ancho { max-width: none; padding: 0; }
  .tarjeta, .cifra { box-shadow: none; border: 1px solid #D5DCE8; break-inside: avoid; }
  .cifras { grid-template-columns: repeat(4, 1fr); }
  .rejilla { grid-template-columns: 1fr 1fr; }
  .cab-print { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid var(--azul); padding-bottom: 10px; margin-bottom: 16px; }
  .cab-print img { height: 38px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Solicitudes de apoyo de los brigadistas */
.alerta { position: sticky; top: 51px; z-index: 19; display: block; width: 100%; background: var(--rojo); color: #fff; font-weight: 700; padding: 12px 16px; text-align: center; }
.sol { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--linea); }
.sol:last-child { border-bottom: 0; }
.sol .punto { margin-top: 5px; width: 16px; height: 16px; }
.sol .txt { flex: 1; min-width: 0; }
.sol .txt b { display: block; font-size: 1.1rem; }
.sol .txt span { color: var(--gris); font-size: .88rem; }
.sol .acc { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tarjeta.urgente { background: #FFF1F1; }
.etq.ambar { background: #FFF4D6; color: #8A6200; }
.alerta[hidden] { display: none; }
