/* PromoRed · identidad visual con el azul del PAN y el logotipo en blanco.
   Sin frameworks ni fuentes externas (residencia: nada de CDN, ADR-C2-08). Animaciones solo con CSS. */
:root {
  --noche: #081642;         /* fondo profundo de encabezados */
  --azul: #18337e;          /* azul institucional del logotipo */
  --brillo: #2f63d6;        /* azul luminoso para degradados */
  --cielo: #6aa8ff;         /* acentos sobre fondo oscuro */
  --hielo: #e9f0ff;
  --grad: linear-gradient(135deg, #081642 0%, #18337e 52%, #2f63d6 100%);
  --grad-boton: linear-gradient(135deg, #1d3c94 0%, #2f63d6 100%);
  --texto: #0f1630;
  --texto-2: #5a6385;
  --fondo: #eef2fa;
  --tarjeta: #ffffff;
  --borde: #dde4f3;
  --ok: #138a4a;   --ok-f: #e3f6ec;
  --aviso: #a26200; --aviso-f: #fff3dc;
  --error: #c0261b; --error-f: #fdecea;
  --radio: 20px;
  --sombra: 0 10px 30px -12px rgba(8, 22, 66, .25), 0 2px 6px rgba(8, 22, 66, .06);
  --sombra-azul: 0 14px 34px -14px rgba(47, 99, 214, .7);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --texto: #eaf0ff; --texto-2: #9ea9cc; --fondo: #060c22; --tarjeta: #0f1838; --borde: #1f2b57;
    --hielo: #16224a; --ok-f: #0d2c1c; --aviso-f: #33250a; --error-f: #3a1411;
    --ok: #4ade80; --aviso: #f5b84a; --error: #f87171;
    --sombra: 0 10px 30px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh; display: flex; flex-direction: column;
}

/* ---------- Encabezado: degradado azul con logotipo en blanco ---------- */
.barra {
  background: var(--grad); color: #fff; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 6px 24px -10px rgba(8, 22, 66, .8);
}
.barra img { height: 34px; width: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.barra h1 { font-size: 1.1rem; margin: 0; font-weight: 800; letter-spacing: .4px; line-height: 1.1; }
.barra .sub { font-size: .72rem; opacity: .75; letter-spacing: 1.5px; text-transform: uppercase; }
.barra button {
  margin-left: auto; background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  padding: 6px 14px; min-height: 36px; font-size: .85rem; backdrop-filter: blur(6px);
}
.aviso-beta { background: var(--noche); color: #b9c8f2; font-size: .7rem; text-align: center; padding: 4px 16px; }

main { width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 24px; flex: 1; outline: none; }

/* ---------- Tarjetas y héroe ---------- */
.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--sombra);
}
.heroe {
  position: relative; overflow: hidden; background: var(--grad); color: #fff; border: 0;
  box-shadow: var(--sombra-azul);
}
.heroe::before, .heroe::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(106, 168, 255, .45), transparent 70%);
}
.heroe::before { width: 280px; height: 280px; right: -90px; top: -110px; }
.heroe::after { width: 200px; height: 200px; left: -80px; bottom: -120px; opacity: .6; }
.heroe > * { position: relative; }
.heroe h2, .heroe .tenue { color: #fff; }
.heroe .tenue { opacity: .78; }
.heroe .metrica { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(6px); }
.heroe .metrica b { color: #fff; }
.heroe .metrica > span { color: #c9d7ff; }

h2 { font-size: 1.3rem; margin: 0 0 8px; color: var(--azul); letter-spacing: -.2px; }
@media (prefers-color-scheme: dark) { h2 { color: #a9c3ff; } }
h3 { font-size: 1rem; margin: 16px 0 6px; }
p { margin: 0 0 10px; }
.tenue { color: var(--texto-2); font-size: .9rem; }
.centro { text-align: center; }
.saludo { font-size: 1.6rem; font-weight: 800; letter-spacing: -.5px; margin: 0 0 2px; }
.cabeza { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cabeza h2 { margin: 0; }

/* ---------- Botones ---------- */
button, .boton {
  font: inherit; font-weight: 700; border: 0; border-radius: 14px; cursor: pointer;
  padding: 13px 18px; min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .12s ease, box-shadow .2s ease, background .2s;
}
button:active, .boton:active { transform: scale(.97); }
.primario { background: var(--grad-boton); color: #fff; width: 100%; box-shadow: var(--sombra-azul); }
.secundario { background: var(--hielo); color: var(--azul); width: 100%; }
@media (prefers-color-scheme: dark) { .secundario { color: #c7d6ff; } }
.blanco { background: #fff; color: var(--azul); width: 100%; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); }
.fantasma { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .35); width: 100%; }
.enlace { background: none; color: var(--brillo); min-height: 0; padding: 6px; font-weight: 600; }
.chico { min-height: 36px; padding: 6px 12px; font-size: .85rem; border-radius: 10px; width: auto; }
button:disabled { opacity: .5; cursor: default; box-shadow: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--cielo); outline-offset: 2px; }
.fila { display: flex; gap: 10px; align-items: center; }
.fila > * { flex: 1; }
.pila > * + * { margin-top: 10px; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input[type=text], input[type=tel], input[type=date], input[type=search], select {
  width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--borde); border-radius: 12px;
  background: var(--tarjeta); color: var(--texto); transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--brillo); box-shadow: 0 0 0 4px rgba(47, 99, 214, .15); outline: none; }
.codigo { text-align: center; font-size: 1.6rem !important; letter-spacing: 6px; font-weight: 800; text-transform: uppercase;
  font-family: ui-monospace, "SF Mono", Menlo, monospace !important; }
.casilla { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
.casilla input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brillo); flex: none; }

/* ---------- Pantalla de bienvenida ---------- */
.portada {
  margin: -16px -16px 16px; padding: 36px 24px 44px; text-align: center; color: #fff; background: var(--grad);
  position: relative; overflow: hidden; border-radius: 0 0 32px 32px;
}
.portada::before {
  content: ""; position: absolute; inset: -40%; pointer-events: none;
  background: radial-gradient(circle at 70% 20%, rgba(106, 168, 255, .45), transparent 40%),
              radial-gradient(circle at 20% 90%, rgba(106, 168, 255, .25), transparent 35%);
}
.portada > * { position: relative; }
.portada img { width: 150px; height: auto; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .35)); }
.portada h2 { color: #fff; font-size: 1.9rem; margin: 18px 0 6px; font-weight: 800; letter-spacing: -.6px; }
.portada p { color: #d3defd; max-width: 420px; margin: 0 auto 6px; }
.chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.chips span { font-size: .75rem; padding: 5px 11px; border-radius: 99px; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2); color: #fff; }

/* ---------- Onboarding ---------- */
.onb { min-height: calc(100dvh - 130px); display: flex; flex-direction: column; }
.onb .lamina {
  flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; color: #fff;
  background: var(--grad); border-radius: 28px; padding: 32px 22px; position: relative; overflow: hidden;
  box-shadow: var(--sombra-azul);
}
.onb .lamina::before {
  content: ""; position: absolute; width: 360px; height: 360px; right: -140px; top: -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(106, 168, 255, .5), transparent 70%); pointer-events: none;
}
.onb .lamina > * { position: relative; }
.onb h2 { color: #fff; font-size: 1.7rem; font-weight: 800; letter-spacing: -.5px; }
.onb p { color: #d3defd; }
.onb .grande { width: 170px; margin: 0 auto 10px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.onb input { background: rgba(255, 255, 255, .95); color: #0f1630; border: 0; text-align: center; font-weight: 700; font-size: 1.15rem; }
.onb label { color: #c9d7ff; }
.puntos { display: flex; justify-content: center; gap: 8px; margin: 16px 0 12px; }
.puntos i { width: 8px; height: 8px; border-radius: 99px; background: var(--borde); transition: all .3s; }
.puntos i.activo { width: 26px; background: var(--brillo); }
.icono-grande { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); }
.icono-grande svg { width: 46px; height: 46px; }
.lista-check { list-style: none; padding: 0; margin: 10px auto 0; text-align: left; max-width: 340px; }
.lista-check li { padding: 8px 0 8px 34px; position: relative; color: #e6edff; }
.lista-check li::before { content: "✓"; position: absolute; left: 0; top: 7px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(106, 168, 255, .35); font-size: .8rem; font-weight: 800; }

/* ---------- Visualización de la red (órbitas) ---------- */
.orbitas { width: 100%; max-width: 360px; display: block; margin: 0 auto; overflow: visible; }
.orbitas .anillo { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: 1; stroke-dasharray: 3 5; }
.orbitas .giro { transform-origin: 0 0; animation: girar 90s linear infinite; }
.orbitas .giro.n2 { animation-duration: 140s; animation-direction: reverse; }
.orbitas .giro.n3 { animation-duration: 220s; }
.orbitas .punto { animation: aparecer .6s both; }
.orbitas .centro-red { filter: drop-shadow(0 0 14px rgba(106, 168, 255, .9)); }
.orbitas .pulso { fill: none; stroke: var(--cielo); stroke-width: 2; animation: pulso 2.6s ease-out infinite; transform-origin: 0 0; }
.tarjeta:not(.heroe) .orbitas .anillo { stroke: var(--borde); }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes pulso { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
@keyframes aparecer { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.leyenda-red { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; font-size: .8rem; margin-top: 8px; }
.leyenda-red span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda-red i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Captura de imágenes ---------- */
.captura { border: 2px dashed var(--borde); border-radius: 18px; padding: 16px; text-align: center; background: var(--hielo); }
.captura img { max-width: 100%; max-height: 220px; border-radius: 12px; display: block; margin: 0 auto 10px; }
.guia { aspect-ratio: 85.6 / 54; border: 3px solid var(--brillo); border-radius: 14px; margin: 0 auto 10px; max-width: 280px;
  display: flex; align-items: center; justify-content: center; color: var(--brillo); font-weight: 700; font-size: .9rem;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(47, 99, 214, .06) 10px 20px); }
.guia.rostro { aspect-ratio: 3 / 4; max-width: 160px; border-radius: 50%; }

.pasos { display: flex; gap: 6px; margin-bottom: 16px; }
.pasos span { flex: 1; height: 6px; border-radius: 3px; background: var(--borde); }
.pasos span.hecho { background: var(--grad-boton); }

/* ---------- Estados y etiquetas ---------- */
.estado { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: .95rem; }
.estado.ok { background: var(--ok-f); color: var(--ok); }
.estado.aviso { background: var(--aviso-f); color: var(--aviso); }
.estado.error { background: var(--error-f); color: var(--error); }
.etiqueta { display: inline-block; font-size: .68rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--hielo); color: var(--azul); letter-spacing: .3px; }
.etiqueta.sim { background: var(--aviso-f); color: var(--aviso); }
.etiqueta.ok { background: var(--ok-f); color: var(--ok); }
.exito { width: 92px; height: 92px; border-radius: 50%; margin: 6px auto 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #17a35a, #4ade80); color: #fff; font-size: 2.6rem; font-weight: 900;
  box-shadow: 0 14px 30px -12px rgba(23, 163, 90, .8); animation: aparecer .5s cubic-bezier(.3, 1.6, .5, 1) both; }

/* ---------- Métricas, barras y gráficas ---------- */
.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.metrica { background: var(--hielo); border-radius: 16px; padding: 12px 14px; }
.metrica b { display: block; font-size: 1.75rem; color: var(--azul); line-height: 1.15; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .metrica b { color: #a9c3ff; } }
.metrica > span { font-size: .78rem; color: var(--texto-2); }
.nivel { display: grid; grid-template-columns: 74px 1fr 60px; gap: 10px; align-items: center; margin: 10px 0; font-size: .9rem; }
.nivel .pista { background: var(--hielo); border-radius: 99px; height: 14px; overflow: hidden; }
.nivel .pista i { display: block; height: 100%; width: 0; background: var(--grad-boton); border-radius: 99px; min-width: 4px;
  transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.nivel b { text-align: right; font-variant-numeric: tabular-nums; }
.heroe .nivel .pista { background: rgba(255, 255, 255, .14); }
.heroe .nivel .pista i { background: linear-gradient(90deg, #8fbcff, #fff); }
.grafica { width: 100%; height: auto; display: block; }
.grafica .area { fill: url(#gradArea); }
.grafica .linea { fill: none; stroke: var(--brillo); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.grafica text { font-size: 10px; fill: var(--texto-2); }
.dona-fila { display: flex; align-items: center; gap: 18px; }
.dona { width: 130px; height: 130px; flex: none; }
.dona text { font-weight: 800; fill: var(--texto); }
.leyenda { list-style: none; margin: 0; padding: 0; font-size: .9rem; flex: 1; }
.leyenda li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.leyenda i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.leyenda b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- Mapa de secciones ---------- */
.mapa-caja { position: relative; border-radius: 16px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #12285f, #060d2a);
  touch-action: none; aspect-ratio: 1 / 1.08; user-select: none; -webkit-user-select: none; }
.mapa-caja svg { width: 100%; height: 100%; display: block; cursor: grab; }
.mapa-caja svg.arrastrando { cursor: grabbing; }
.mapa-caja .sec { stroke: rgba(8, 22, 66, .55); vector-effect: non-scaling-stroke; stroke-width: .4; transition: fill .4s; }
.mapa-caja .sec.sel { stroke: #ffd166; stroke-width: 3; }
.mapa-caja .mun { fill-opacity: 0; stroke: rgba(255, 255, 255, .55); stroke-width: 1.1; vector-effect: non-scaling-stroke;
  pointer-events: none; transition: fill-opacity .5s; }
.mapa-caja svg.lejos .mun { fill-opacity: .9; pointer-events: visiblePainted; }
.mapa-caja .etq-n { font-weight: 800; fill: #96e4ff; }
.mapa-caja .mun.activo { stroke: #fff; stroke-width: 2.4; }
.mapa-caja .etq { fill: #fff; font-weight: 700; paint-order: stroke; stroke: rgba(8, 22, 66, .85); pointer-events: none; text-anchor: middle; }
.mapa-controles { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mapa-controles button { width: 40px; min-height: 40px; height: 40px; padding: 0; border-radius: 12px; background: rgba(255, 255, 255, .92);
  color: var(--azul); font-size: 1.3rem; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.mapa-escala { position: absolute; left: 10px; bottom: 10px; right: 64px; background: rgba(8, 22, 66, .72); backdrop-filter: blur(6px);
  border-radius: 12px; padding: 8px 10px; color: #fff; font-size: .7rem; }
.mapa-escala .rampa { height: 8px; border-radius: 99px; margin: 4px 0 2px; background: linear-gradient(90deg, #1e3478, #2f63d6, #28aaff, #96e4ff, #fff); }
.mapa-escala .fila { justify-content: space-between; }
.mapa-escala .fila > * { flex: none; }
.mapa-info { margin-top: 12px; border-radius: 16px; padding: 14px; background: var(--hielo); min-height: 74px; }
.mapa-info b.grande { font-size: 1.8rem; color: var(--azul); font-weight: 800; }
@media (prefers-color-scheme: dark) { .mapa-info b.grande { color: #a9c3ff; } }
.chips-mun { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 6px; scrollbar-width: none; }
.chips-mun::-webkit-scrollbar { display: none; }
.chips-mun button { flex: none; min-height: 32px; padding: 4px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600;
  background: var(--hielo); color: var(--azul); width: auto; }
.chips-mun button.activo { background: var(--grad-boton); color: #fff; }
@media (prefers-color-scheme: dark) { .chips-mun button:not(.activo), .etiqueta:not(.sim):not(.ok) { color: #c7d6ff; } }
.ranking { counter-reset: r; }
.ranking li { counter-increment: r; }
.ranking li::before { content: counter(r); width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--hielo); color: var(--azul); font-weight: 800; font-size: .8rem; margin-right: 10px; }
.ranking li .mini { height: 6px; border-radius: 99px; background: var(--grad-boton); margin-top: 4px; width: 0; transition: width 1s; }

/* ---------- Listas y tablas ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { padding: 12px 0; border-bottom: 1px solid var(--borde); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lista li:last-child { border-bottom: 0; }
.lista a { color: var(--brillo); }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  color: #fff; background: var(--grad-boton); }
.persona { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.persona > div { min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--borde); }
th { color: var(--texto-2); font-weight: 600; font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- QR ---------- */
.qr { background: #fff; padding: 16px; border-radius: 26px; display: inline-block; position: relative;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .15), 0 20px 40px -14px rgba(0, 0, 0, .55); }
.qr img { width: 230px; height: 230px; display: block; }

/* ---------- Menú inferior flotante ---------- */
.menu {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 4px; margin: 0 auto; width: 100%; max-width: 680px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--tarjeta) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--borde);
}
.menu a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .68rem;
  color: var(--texto-2); text-decoration: none; font-weight: 700; border-radius: 14px; transition: background .2s, color .2s; }
.menu a svg { width: 22px; height: 22px; }
.menu a.activo { color: #fff; background: var(--grad-boton); box-shadow: var(--sombra-azul); }

/* ---------- Movimiento ---------- */
.entra { animation: entra .5s cubic-bezier(.2, .8, .2, 1) both; }
.entra:nth-child(2) { animation-delay: .06s; } .entra:nth-child(3) { animation-delay: .12s; }
.entra:nth-child(4) { animation-delay: .18s; } .entra:nth-child(5) { animation-delay: .24s; }
.entra:nth-child(n+6) { animation-delay: .3s; }
@keyframes entra { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.girando { width: 46px; height: 46px; border: 4px solid var(--hielo); border-top-color: var(--brillo); border-radius: 50%;
  margin: 18px auto; animation: g 1s linear infinite; }
.escaneo { width: 120px; height: 76px; margin: 10px auto 16px; border-radius: 12px; border: 3px solid var(--brillo); position: relative; overflow: hidden; }
.escaneo::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--cielo); box-shadow: 0 0 14px var(--cielo);
  animation: barrido 1.6s ease-in-out infinite alternate; }
@keyframes barrido { from { top: 4px; } to { top: calc(100% - 7px); } }
@keyframes g { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.oculto { display: none !important; }
.mt { margin-top: 14px; }
.fila input[type=search] { flex: 3; }
