/* ============================================================
   INSTRUCTIVO - CSS Responsive (Flexbox, sin transform:scale)
   ============================================================ */

/* === RESET / BASE === */
html {
  height: -webkit-fill-available;
  touch-action: pan-x pan-y;
  scroll-behavior: auto !important; /* evita scroll automático a anclas (#paso-X) */
  overflow-anchor: none;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;        /* Sin scroll en el body */
  overflow-x: hidden;
  max-width: 100vw;
  background-color: #e6e5e4;
  color: #000;
  scroll-behavior: auto !important;
  overflow-anchor: none;
}

/* === LOGO DE LA ELECCION === */
.logo_eleccion_izq {
  max-height: 50px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* === LAYOUT PRINCIPAL: 3 zonas (header | contenido | botón fijo) === */
#contenedor {
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ayuda {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  position: relative;
}

/* --- Zona 1: Header fijo --- */
#contenedor-ayuda header {
  flex-shrink: 0;
  height: 60px;
  min-height: 60px;
  display: flex !important;
  align-items: center;
  visibility: visible !important;
  overflow: visible;
}

#contenedor-ayuda header .container,
#contenedor-ayuda header .row {
  width: 100%;
}

#contenedor-ayuda header .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  margin: 0;
}

#contenedor-ayuda header #superior {
  display: flex;
  align-items: center;
  flex: 1;
  float: none;
  width: auto;
  min-width: 0;
}

#contenedor-ayuda header .texto-tribunal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  float: none;
  width: auto;
}

#contenedor-ayuda header img {
  max-height: 50px;
  width: auto;
  object-fit: contain;
}

/* --- Zona 2: Contenido central (ocupa todo lo disponible) --- */
#ayuda #contenedor-ayuda {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* Sin esto el flex item crece y overflow-y:auto no scrollea en WebView */
}

#bienvenido,
#agradecimiento,
#ayuda .paso {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding-bottom: 80px;    /* Espacio para el botón fijo */
}

/* Imágenes escalan automáticamente sin romper el layout */
#ayuda .grafico {
  max-height: 42vh;
  max-width: 80%;
  width: auto;
  object-fit: contain;
  margin: 0 auto;
}

/* Textos responsive con clamp */
#ayuda .paso h1 {
  margin: 16px auto;
  color: #000;
  font-size: clamp(1rem, 2.5vw, 1.8em);
  text-align: center;
  max-width: 80%;
}

#bienvenido h1,
#agradecimiento h1 {
  font-size: clamp(1.2rem, 3vw, 2.3em);
  margin-bottom: 0;
}

#bienvenido h3,
#agradecimiento h3 {
  font-size: 1.3em;
  margin-top: 16px;
}

#bienvenido .botones {
  display: flex;
  justify-content: center;
}

.login-encuestador {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 100%);
}

.login-encuestador__panel {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  text-align: left;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  color: #f8fafc;
}

.login-encuestador__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.login-encuestador__logo .login-icon {
  font-size: 2rem;
}

.login-encuestador__panel h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.login-encuestador__panel p {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #94a3b8;
  line-height: 1.4;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-encuestador__panel input {
  height: 48px;
  width: 100%;
  padding: 0 14px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 16px;
  color: #f8fafc;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-encuestador__panel input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.login-encuestador__panel button {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.login-encuestador__panel button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
}

.login-encuestador__error {
  min-height: 20px;
  color: #f87171;
  font-size: 0.9rem;
  text-align: center;
}

/* ==========================================================================
   PORTAL DEL ENCUESTADOR (PANEL INTERMEDIO)
   ========================================================================== */
.portal-encuestador {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 15%, #1e293b 0%, #090d16 100%);
  overflow-y: auto;
}

.portal-hero {
  width: min(840px, 100%);
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 18px;
}

.portal-user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.portal-user-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.portal-user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.portal-badge--role {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.portal-badge--status {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.btn-portal-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-portal-logout:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Big CTA Button to open Simulator */
.portal-cta-box {
  width: 100%;
}

.btn-iniciar-simulador {
  width: 100%;
  padding: 22px 28px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.45);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-iniciar-simulador:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 40px rgba(16, 185, 129, 0.6);
  filter: brightness(1.08);
}

.btn-iniciar-simulador .cta-content {
  display: flex;
  align-items: center;
  gap: 18px;
}

.btn-iniciar-simulador .cta-icon {
  font-size: 2.4rem;
}

.btn-iniciar-simulador .cta-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: left;
}

.btn-iniciar-simulador .cta-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
  text-align: left;
  margin-top: 2px;
}

.btn-iniciar-simulador .cta-arrow {
  font-size: 1.8rem;
  font-weight: bold;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.btn-iniciar-simulador:hover .cta-arrow {
  transform: translateX(6px);
}

/* Grid of status cards */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 680px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }
}

.portal-stat-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: border-color 0.2s;
}

.portal-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.portal-stat-card--highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.portal-stat-card .stat-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

.portal-stat-card .stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.portal-stat-card .stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f8fafc;
  word-break: break-word;
}

.portal-stat-card .stat-sub {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 2px;
}

.btn-portal-sync {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-portal-sync:hover {
  background: rgba(59, 130, 246, 0.4);
}

/* Device bar */
.portal-device-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  gap: 12px;
}

.portal-device-bar .device-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-device-bar .device-label {
  color: #64748b;
  font-weight: 600;
}

.portal-device-bar .device-val {
  color: #cbd5e1;
  font-weight: 600;
}

/* Floating button in Sufragio to return to portal */
.btn-volver-portal-sufragio {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-volver-portal-sufragio:hover {
  background: #1e293b;
  color: #34d399;
  border-color: #34d399;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  text-decoration: none;
}

/* --- Zona 3: Botones SIEMPRE fijos al fondo --- */
#ayuda button {
  height: 50px;
  width: 160px;
  padding: 0;
  margin-top: 0;
  margin-left: 0;
}

#ayuda .login-encuestador__panel button {
  position: static !important;
  transform: none !important;
  width: 100%;
  height: 50px;
  margin-top: 8px;
  margin-left: 0;
}

#ayuda .portal-hero button {
  position: static !important;
  transform: none !important;
  margin: 0 !important;
}

#ayuda .portal-hero .btn-iniciar-simulador {
  position: static !important;
  transform: none !important;
  width: 100% !important;
  min-height: 84px !important;
  height: auto !important;
  padding: 20px 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 16px !important;
  box-sizing: border-box !important;
  color: #ffffff !important;
}

#ayuda .portal-hero .btn-iniciar-simulador:hover {
  transform: translateY(-2px) !important;
  filter: brightness(1.08) !important;
}

#ayuda .portal-hero .btn-portal-logout {
  position: static !important;
  transform: none !important;
  width: auto !important;
  height: auto !important;
  min-height: 38px !important;
  padding: 8px 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px !important;
}

#ayuda .portal-hero .btn-portal-sync {
  position: static !important;
  transform: none !important;
  width: auto !important;
  height: auto !important;
  min-height: 30px !important;
  padding: 5px 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px !important;
}

#empezar,
#ayuda .paso button.next,
#reset {
  position: fixed !important;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) !important;
  -webkit-transform: translateX(-50%) !important;
  z-index: 100;
  margin: 0 !important;
  height: 50px;
  width: 160px;
  padding: 0;
}

/* Excepción: paso-3 tiene 2 botones, los acomodamos */
#ayuda #paso-3 button.next {
  margin-left: 0 !important;
}

/* ============================================================
   SELECCION DE UBICACIONES
   Desktop:  Partido = 1 col | Resto = 2 col
   Mobile:   Todo = 1 col
   ============================================================ */

/* El paso #ubicaciones puede scrollear verticalmente (sin scrollbar visible) */
#ayuda #ubicaciones.paso {
  justify-content: flex-start;
  min-height: 0;
  max-height: 100%;
  box-sizing: border-box;
  padding-top: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding-bottom: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: 24px;
  scroll-padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#ayuda #ubicaciones.paso::-webkit-scrollbar { display: none; }

/* ULs de seleccion — flex container */
#ayuda #contenedor-ayuda #ubicaciones .departamentos,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos {
  display: flex;         /* SIN !important: JS necesita poder poner display:none */
  flex-wrap: wrap;       /* SIN !important: idem */
  justify-content: center;
  align-items: flex-start;
  column-gap: 8px;       /* no superar 8px: rompe 2 col con calc(50%-4px) */
  row-gap: 10px;
  list-style: none;
  width: 100%;
  padding: 0;
  margin: 8px 0;
  box-sizing: border-box;
}

/* === DESKTOP: PRIMERA SELECCION (Partido) - 1 columna centrada === */
#ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li {
  flex: 0 0 100% !important;
  width: 100% !important;
  max-width: 600px !important;
  margin: 0 auto !important;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
}

/* === DESKTOP: RESTO DE SELECCIONES - exactamente 2 columnas === */
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
#ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
#ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
  flex: 0 0 calc(50% - 4px) !important;
  width: calc(50% - 4px) !important;
  max-width: calc(50% - 4px) !important;
  margin: 0 !important;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* touch: sin delay, sin flash, sin selección de texto */
#ayuda #contenedor-ayuda #ubicaciones .departamentos li,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
  outline: none;
}
#ayuda #contenedor-ayuda #ubicaciones .departamentos li:focus,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li:focus {
  outline: none !important;
  box-shadow: none !important;
}
#ayuda #contenedor-ayuda #ubicaciones .departamentos li:active,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li:active {
  opacity: 0.85;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
}

/* pointer-events:none en hijos: cualquier tap en cualquier zona
   del <li> dispara el evento en el <li> mismo (donde esta el data-id) */
#ayuda #contenedor-ayuda #ubicaciones .departamentos li *,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li * {
  pointer-events: none;
}

/* === MISCELÁNEOS === */
#ayuda button:hover { cursor: pointer; }
#ayuda #escudo { display: inline-block; }
#ayuda .tribunal { display: inline-block; font-size: 0.9em; color: #888; }
#ayuda .simulador { font-size: 0.9em; display: inline-block; color: #999; }
.simulador-guia { display: flex; align-items: center; font-size: 0.75rem; }
#ayuda .texto-tribunal { display: flex; }
#ayuda h2 { font-size: 1.6em; color: #000; width: 100%; max-width: 50%; margin-top: 3%; line-height: 1.3em; }
#ayuda .bienvenida { margin: 0 auto; width: 100%; max-width: 50%; }

#ayuda #btn_goople_play { border: 0; background: transparent; }
#ayuda #btn_goople_play img { height: 55px; }

#logo-final {
  width: 15%;
  position: absolute;
  right: 5%;
  bottom: 20%;
}

/* Gradiente (uso interno, se mantiene por compatibilidad) */
.gradiente-gris {
  background: #feffff;
  background: linear-gradient(to bottom, #feffff 0%, #ddf1f9 50%, #a0d8ef 100%);
}

/* ============================================================
   MEDIA QUERIES — Sin transform:scale, solo ajustes de tamaño
   ============================================================ */

/* --- Tablet / ventana a ~1024px --- */
@media (max-width: 1024px) {
  .row { display: flex; }

  #contenedor-ayuda header img,
  .logo_eleccion_izq {
    max-height: 45px;
  }

  .texto-tribunal { font-size: 0.85em; }

  #ayuda .grafico { max-height: 38vh; }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 45px;
    width: 145px;
  }
  /* ELIMINADO width:auto que pisaba las reglas de flex de ubicaciones */
}

/* --- Tablet pequeña / ventana achicada (~900px) --- */
@media (max-width: 900px) {
  #ayuda .grafico { max-height: 35vh; }

  #ayuda #contenedor-ayuda #ubicaciones,
  #ayuda #contenedor-ayuda #seleccionar_ubicaciones {
    padding-left: 0;
    padding-right: 0;
  }

  #ayuda #contenedor-ayuda #ubicaciones .departamentos,
  #ayuda #contenedor-ayuda #seleccionar_ubicaciones .departamentos,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos {
    padding-left: 0;
    padding-right: 0;
    margin-top: 0;
    column-gap: 6px;   /* no superar: sync con calc(50% - 3px) */
    row-gap: 10px;
  }

  #ayuda #contenedor-ayuda #ubicaciones .departamentos .btn-lg,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos .btn-lg,
  #ayuda #contenedor-ayuda #seleccionar_ubicaciones .departamentos .btn-lg {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
  }
}

/* --- Mobile (portrait o landscape) --- */
@media (max-width: 768px) {
  #contenedor-ayuda header {
    height: 50px;
  }

  #contenedor-ayuda header img,
  .logo_eleccion_izq {
    max-height: 35px;
  }

  /* Ocultar texto del tribunal en mobile para ganar espacio */
  .texto-tribunal {
    display: none !important;
  }

  #ayuda .grafico { max-height: 32vh; }

  #ayuda .paso h1 {
    font-size: clamp(0.85rem, 2vw, 1.1em);
    margin: 8px auto;
  }

  #bienvenido h1,
  #agradecimiento h1 {
    font-size: clamp(1rem, 2.5vw, 1.5em);
  }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 40px;
    width: 135px;
    font-size: 15px;
  }

  #empezar,
  #ayuda .paso button.next,
  #reset {
    bottom: 10px;
  }

  /* Mobile portrait: TODAS las listas en 1 sola columna */
  #ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box;
  }


  #bienvenido,
  #agradecimiento,
  #ayuda .paso {
    padding-bottom: 65px;
  }
}

/* --- Mobile landscape (pantalla corta y ancha, cubre iPhones en modo horizontal) --- */
@media (max-height: 500px) {
  #contenedor-ayuda header {
    height: 42px;
  }

  #contenedor-ayuda header img,
  .logo_eleccion_izq {
    max-height: 30px;
  }

  #ayuda .grafico { max-height: 28vh; }

  #ayuda .paso h1 {
    font-size: 0.9em;
    margin: 5px auto;
  }

  #bienvenido h1,
  #agradecimiento h1 {
    font-size: 1.1em;
  }

  #bienvenido,
  #agradecimiento,
  #ayuda .paso {
    padding-bottom: 58px;
  }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 36px;
    width: 130px;
    font-size: 14px;
  }

  #empezar,
  #ayuda .paso button.next,
  #reset {
    bottom: 8px;
  }

  /* Landscape mobile: 1 sola columna en ubicaciones */
  #ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin: 0;
  }
}

/* --- Pantalla muy pequeña (altura < 280px) --- */
@media (max-height: 280px) {
  #contenedor-ayuda header {
    height: 34px;
  }

  .logo_eleccion_izq {
    max-height: 24px;
  }

  #ayuda .grafico { max-height: 22vh; }

  #ayuda .paso h1,
  #bienvenido h1,
  #agradecimiento h1 {
    font-size: 0.85em;
    margin: 4px auto;
  }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 32px;
    width: 120px;
    font-size: 13px;
  }

  #empezar,
  #ayuda .paso button.next,
  #reset {
    bottom: 6px;
  }

  .texto-tribunal { display: none !important; }
}

/* ============================================================
   DISPOSITIVOS TOUCH (mobile / tablet) — cualquier orientacion
   hover:none + pointer:coarse = teclado tactil, no mouse
   Desktop siempre tiene hover:hover y pointer:fine → no aplica
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* 1 sola columna en TODAS las listas de ubicaciones en dispositivos touch */
  #ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box;
  }

  /* 1 columna: column-gap irrelevante, ampliar row-gap */
  #ayuda #contenedor-ayuda #ubicaciones .departamentos,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos {
    column-gap: 0;
    row-gap: 12px;
  }
}


.seccion-descargas-final {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.boton-personalizado {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 62px;
  border-radius: 8px;
  text-decoration: none;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
}

.boton-personalizado:hover {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-decoration: none !important;
}

.boton-win-azul {
  background-color: #337ab7;
  color: white;
  font-family:
    "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  font-size: 18px;
  text-align: center;
  padding: 0 25px;
  border: none;
  width: 200px;
}

.boton-con-imagen img {
  height: 100%;
  width: 200px;
  display: block;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .seccion-descargas-final {
    flex-direction: column;
    gap: 15px;
  }

  .boton-personalizado {
    height: 60px;
  }

  .boton-win-azul {
    font-size: 17px;
  }
}

/* ============================================================
   PORTAL Y LOGIN DEL ENCUESTADOR - ESTILOS MÓVILES PWA
   ============================================================ */

body.portal-activo,
body.portal-activo #contenedor,
body.portal-activo #ayuda,
body.login-activo,
body.login-activo #contenedor,
body.login-activo #ayuda {
  height: auto !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  overflow-y: auto !important;
  background: #0f172a !important;
  color: #f8fafc !important;
}

/* --- LOGIN ENCUESTADOR --- */
.login-encuestador {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 20px 16px;
  width: 100%;
  box-sizing: border-box;
}

.login-encuestador__panel {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  text-align: center;
}

.login-encuestador__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-encuestador__logo .login-icon {
  font-size: 32px;
}

.login-encuestador__logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: #38bdf8;
  margin: 0;
}

.login-encuestador__panel p {
  color: #94a3b8;
  font-size: 13.5px;
  margin-bottom: 24px;
  line-height: 1.4;
}

.login-input-group {
  text-align: left;
  margin-bottom: 18px;
}

.login-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.login-input-group input {
  width: 100%;
  height: 48px;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 12px;
  padding: 0 16px;
  color: #ffffff;
  font-size: 15px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

#btn-login-encuestador {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  transition: transform 0.15s, opacity 0.2s;
}

#btn-login-encuestador:active {
  transform: scale(0.98);
}

.btn-login-pwa-install {
  width: 100%;
  height: 44px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
}

.btn-login-pwa-install:active {
  transform: scale(0.98);
  background: rgba(56, 189, 248, 0.25);
}

.btn-portal-install {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-portal-install:active {
  transform: scale(0.95);
  background: #0284c7;
  color: #ffffff;
}

.login-encuestador__error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 13px;
  display: none;
}

/* --- PORTAL PRINCIPAL DEL ENCUESTADOR --- */
.portal-encuestador {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 16px 12px 30px;
  box-sizing: border-box;
}

.portal-hero {
  max-width: 600px;
  width: 100%;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 20px 18px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid #334155;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid #38bdf8;
  flex-shrink: 0;
}

.portal-user-name {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.portal-user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.portal-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.portal-badge--role {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.portal-badge--status {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.btn-portal-logout {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-portal-logout:hover {
  background: #ef4444;
  color: #ffffff;
}

/* CTA BOTÓN ABRIR SIMULADOR */
.portal-cta-box {
  margin-bottom: 20px;
}

.btn-iniciar-simulador {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
  box-sizing: border-box;
  text-align: left;
}

.btn-iniciar-simulador:active {
  transform: scale(0.98);
}

.cta-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cta-icon {
  font-size: 32px;
  line-height: 1;
}

.cta-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.2;
}

.cta-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 3px;
}

.cta-arrow {
  font-size: 24px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

/* GRID DE ESTADÍSTICAS OPERATIVAS */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 480px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }
}

.portal-stat-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 14px 16px;
  box-sizing: border-box;
  position: relative;
}

.portal-stat-card--highlight {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
}

.stat-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 4px;
  word-break: break-word;
}

.stat-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 4px;
}

.btn-portal-sync {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

/* BARRA DE ESTADO DEL DISPOSITIVO */
.portal-device-bar {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-label {
  color: #94a3b8;
  font-weight: 500;
}

.device-val {
  color: #cbd5e1;
  font-weight: 600;
  text-align: right;
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
