:root {
  --fondo: #F4F3EE; --tinta: #17201A; --suave: #4F5B52; --borde: #B9B5A8; --linea: #D6D3C8;
  --naranja: #C2410C; --naranja-claro: #FFF4EC; --verde: #1F3B2D; --verde2: #2E5240;
  --azul: #1D4ED8; --amarillo: #EAB308; --ok: #16A34A; --aviso: #D97706; --viejo: #9CA3AF; --rojo: #B91C1C;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fondo); color: var(--tinta); font-family: 'Atkinson Hyperlegible', system-ui, sans-serif; font-size: 18px; -webkit-tap-highlight-color: transparent; }
.oculto { display: none !important; }
.pantalla { min-height: 100%; display: flex; flex-direction: column; gap: 20px; padding: 24px 20px calc(28px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
h1 { margin: 0; font-size: 30px; line-height: 1.2; }
p { margin: 0; line-height: 1.45; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--naranja); display: flex; align-items: center; justify-content: center; }
.marca small { display: block; font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--suave); }
.marca b { font-size: 16px; }
label.campo { display: flex; flex-direction: column; gap: 8px; font-size: 19px; font-weight: 700; }
input, select { font: inherit; font-size: 22px; height: 62px; padding: 0 16px; border: 2px solid var(--tinta); border-radius: 14px; background: #fff; color: var(--tinta); width: 100%; }
.ayuda { font-size: 15px; font-weight: 400; color: var(--suave); }
.btn { font: inherit; font-weight: 700; font-size: 21px; min-height: 62px; border-radius: 16px; border: 0; background: var(--naranja); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 18px; cursor: pointer; text-decoration: none; width: 100%; }
.btn:disabled { opacity: .5; }
.btn.sec { background: #fff; color: var(--tinta); border: 2px solid var(--tinta); }
.btn.peq { min-height: 48px; font-size: 17px; }
.papel { font: inherit; text-align: left; display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 3px solid var(--linea); color: var(--tinta); width: 100%; cursor: pointer; }
.papel[aria-pressed="true"] { background: var(--naranja-claro); border-color: var(--naranja); }
.papel b { display: block; font-size: 21px; }
.papel span.d { font-size: 15px; color: var(--suave); }
.ico-puesto { width: 40px; height: 40px; border-radius: 50%; background: var(--naranja); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--tinta); flex-shrink: 0; }
.ico-resac { width: 28px; height: 28px; margin: 6px; background: var(--amarillo); border: 3px solid var(--tinta); transform: rotate(45deg); flex-shrink: 0; }
.tarjeta-oscura { background: var(--verde); color: #fff; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tarjeta-oscura span { color: #C9D8CE; font-size: 15px; }
.tarjeta-oscura b { font-size: 20px; }
.nota { display: flex; gap: 12px; background: #E7E4D8; border-radius: 12px; padding: 14px; font-size: 15px; color: #2B3A30; }
.error { background: #FDECEC; color: var(--rojo); border: 2px solid var(--rojo); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.crece { flex-grow: 1; }

/* ---------- mapa ---------- */
#vMapa { position: fixed; inset: 0; }
#mapa { position: absolute; inset: 0; background: #55623A; }
.barra-sup { position: absolute; left: 10px; right: 10px; top: calc(10px + env(safe-area-inset-top)); z-index: 500; background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 2px; }
.barra-sup .fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.estado { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.estado i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.estado.ok { color: #166534; } .estado.ok i { background: var(--ok); box-shadow: 0 0 0 4px #DCFCE7; }
.estado.mal { color: var(--rojo); } .estado.mal i { background: var(--rojo); box-shadow: 0 0 0 4px #FDECEC; }
.estado.medio { color: #92400E; } .estado.medio i { background: var(--aviso); box-shadow: 0 0 0 4px #FEF3C7; }
.barra-sup .sub { font-size: 14px; color: var(--suave); }
.panel-inf { position: absolute; left: 0; right: 0; bottom: 0; z-index: 500; background: #fff; border-radius: 20px 20px 0 0; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 10px; }
.leyenda { display: flex; justify-content: space-between; font-size: 14px; color: #2B3A30; gap: 6px; flex-wrap: wrap; }
.leyenda span { display: flex; align-items: center; gap: 5px; }
.leyenda i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.botonera { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.botonera button { font: inherit; height: 62px; border-radius: 14px; border: 2px solid var(--tinta); background: #fff; color: var(--tinta); font-size: 15px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; }
.capa-btn { position: absolute; right: 10px; z-index: 500; top: calc(96px + env(safe-area-inset-top)); font: inherit; font-size: 14px; font-weight: 700; background: #fff; border: 2px solid var(--tinta); border-radius: 12px; height: 44px; padding: 0 12px; }

/* marcadores (divIcon de Leaflet) */
.mk { position: relative; width: 24px; height: 24px; }
.mk .p { position: absolute; inset: 0; border-radius: 50%; background: var(--naranja); border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--tinta), 0 1px 4px rgba(0,0,0,.5); }
.mk .r { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: var(--amarillo); border: 2.5px solid var(--tinta); transform: rotate(45deg); box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.mk.viejo .p, .mk.viejo .r { background: var(--viejo); }
.mk .et { position: absolute; top: -8px; left: 30px; background: #fff; border-radius: 8px; padding: 3px 8px; white-space: nowrap; line-height: 1.2; box-shadow: 0 1px 4px rgba(0,0,0,.35); font-size: 15px; font-weight: 700; color: var(--tinta); }
.mk.viejo .et { background: #E5E7EB; }
.mk.izq .et { left: auto; right: 30px; }
.mk .et small { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 400; color: var(--suave); }
.mk .et small i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.yo { position: relative; width: 28px; height: 28px; }
.yo .halo { position: absolute; left: -14px; top: -14px; width: 56px; height: 56px; border-radius: 50%; background: rgba(29,78,216,.22); }
.yo .punto { position: absolute; inset: 0; border-radius: 50%; background: var(--azul); border: 4px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.yo .et { position: absolute; top: 32px; left: -13px; width: 54px; text-align: center; background: var(--azul); color: #fff; font-weight: 700; font-size: 16px; border-radius: 8px; padding: 2px 0; }
.leaflet-div-icon { background: transparent; border: 0; }

/* ---------- lista ---------- */
#vLista { position: fixed; inset: 0; z-index: 900; background: var(--fondo); overflow-y: auto; }
.cab-lista { position: sticky; top: 0; background: #fff; padding: calc(14px + env(safe-area-inset-top)) 16px 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 0 var(--linea); }
.chips { display: flex; gap: 8px; }
.chips button { font: inherit; height: 44px; padding: 0 16px; border-radius: 22px; font-size: 16px; font-weight: 700; background: #fff; color: var(--tinta); border: 2px solid var(--borde); }
.chips button[aria-pressed="true"] { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.filas { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 30px; }
.fila-p { font: inherit; text-align: left; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 14px 8px 10px; border-radius: 14px; background: #fff; border: 2px solid #E2DFD5; color: var(--tinta); width: 100%; }
.fila-p.viejo { background: #FDECEC; border-color: var(--rojo); }
.fila-p .nom { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.fila-p .nom b { font-size: 19px; }
.fila-p .nom span { font-size: 14px; color: var(--suave); }
.fila-p .hace { font-weight: 700; font-size: 15px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.fila-p .hace i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.atras { width: 44px; height: 44px; border-radius: 12px; background: #ECEAE3; border: 0; display: flex; align-items: center; justify-content: center; }

/* ---------- modo bolsillo ---------- */
#vBolsillo { position: fixed; inset: 0; z-index: 2000; background: #000; color: #A3A3A3; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 28px calc(36px + env(safe-area-inset-bottom)); gap: 16px; user-select: none; }
#vBolsillo .titulo { font-size: 15px; letter-spacing: .08em; font-weight: 700; color: #8A8A8A; }
#vBolsillo .circ { width: 88px; height: 88px; border-radius: 50%; border: 3px solid #15803D; display: flex; align-items: center; justify-content: center; }
#vBolsillo .circ.mal { border-color: #B91C1C; }
#vBolsillo .grande { font-size: 26px; font-weight: 700; color: #D4D4D4; }
#vBolsillo .caja { border: 1px solid #3F3F3F; border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.4; }
#vBolsillo .caja b { color: #FB923C; }
#vBolsillo .salir { width: 100%; height: 60px; border-radius: 14px; border: 2px solid #525252; color: #D4D4D4; font: inherit; font-size: 18px; font-weight: 700; background: transparent; }
#vBolsillo small { font-size: 13px; color: #8A8A8A; }
