* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: #08090b !important;
  color: #ffffff !important;
  overflow: hidden;
}

.hidden { display: none !important; }

/* Contenedor del Mapa */
.mapa-fondo-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
}

.mapa-fondo-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* App Viewport Overlay */
.app-viewport {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.header-bar {
  pointer-events: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(14, 16, 20, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-title-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.header-title-container h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-header {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
}

/* Banner Reposo (Sin Activas) */
.banner-sin-alertas {
  pointer-events: auto;
  background: rgba(18, 20, 26, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #8e8e93;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* Área Central */
.main-content-area {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 8px 10px;
  overflow: hidden;
}

/* BADGE FLOTANTE ALARMA INCENDIO */
.badge-alarma-incendio-flotante {
  pointer-events: auto;
  background: linear-gradient(135deg, #ff2d55 0%, #cc0029 100%);
  color: #ffffff !important;
  border: 1px solid #ff3b30;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 auto 6px auto;
  box-shadow: 0 4px 16px rgba(255, 45, 85, 0.5);
  z-index: 101;
  animation: pulseBadge 1.5s infinite alternate;
}

.dot-blink-white {
  width: 6px;
  height: 6px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px #ffffff;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}

/* Wrapper Flotante Tarjeta */
.tarjeta-wrapper {
  pointer-events: auto;
  width: 100%;
  max-width: 340px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.tarjeta-flotante-body {
  background: rgba(18, 20, 26, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85);
  max-height: 65vh;
  overflow-y: auto;
}

/* Modo Colapsado Estricto */
.tarjeta-wrapper.minimized .card-section,
.tarjeta-wrapper.minimized .card-tactical-title,
.tarjeta-wrapper.minimized .divider-line,
.tarjeta-wrapper.minimized .btn-ver-ruta,
.tarjeta-wrapper.minimized .badge-emergencia-tactical,
.tarjeta-wrapper.minimized .card-timestamp-discrete {
  display: none !important;
}

.tarjeta-wrapper.minimized .tarjeta-flotante-body {
  padding: 6px 10px;
  background: #08090b;
  border: 1px solid rgba(255, 42, 42, 0.6);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.9);
}

.tarjeta-wrapper.minimized .card-tactical-header {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tarjeta-wrapper.minimized .txt-resumen-inline {
  display: block !important;
}

/* Header Desplegado */
.card-tactical-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge-emergencia-tactical {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ff3b30;
  font-weight: 800;
  font-size: 0.65rem;
  letter-spacing: 0.8px;
}

.dot-blink-red {
  width: 7px;
  height: 7px;
  background-color: #ff3b30;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff3b30;
  animation: blinkRed 1.2s infinite;
}

@keyframes blinkRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.txt-resumen-inline {
  display: none;
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffffff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 6px;
}

.btn-toggle-inline {
  background: linear-gradient(135deg, #a71d1d 0%, #1a0303 100%);
  border: 1px solid #ff3b30;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.card-timestamp-discrete {
  font-size: 0.7rem;
  color: #8e8e93 !important;
  font-weight: 600;
}

.clave-tactical {
  font-size: 2.1rem;
  font-weight: 900;
  color: #ffffff !important;
  line-height: 1;
  letter-spacing: -1px;
}

.descripcion-tactical {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d1d1d6 !important;
  margin-top: 4px;
}

.divider-line {
  height: 2px;
  width: 32px;
  background: #ff3b30;
  margin: 10px 0;
  border-radius: 2px;
}

.card-section {
  margin-bottom: 10px;
}

.section-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: #8e8e93 !important;
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

.location-main {
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff !important;
  line-height: 1.25;
}

.location-sub {
  font-size: 0.75rem;
  color: #8e8e93 !important;
  font-weight: 600;
}

.unidades-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.badge-unidad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.unidad-nombre {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff !important;
}

.dot-unidad {
  width: 4px;
  height: 4px;
  background-color: #ff3b30;
  border-radius: 50%;
}

.preliminar-text {
  font-size: 0.8rem;
  color: #e5e5ea !important;
  line-height: 1.35;
  white-space: normal !important;
  word-break: break-word;
}

.btn-ver-ruta {
  width: fit-content !important;
  min-width: 130px;
  margin: 10px auto 0 auto !important;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff !important;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

.btn-ver-ruta .icon-arrow {
  color: #ff3b30;
  font-size: 0.85rem;
}

/* Stack Solicitudes Amarillas */
.solicitudes-stack {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  max-width: 100%;
  width: 100%;
}

.banner-solicitud-amarilla {
  background: linear-gradient(135deg, #e0a96d 0%, #cca052 100%);
  color: #1a1000 !important;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  font-weight: 800;
  font-size: 0.75rem;
}

.solicitud-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.solicitud-hora {
  font-size: 0.7rem;
  opacity: 0.85;
}

.btn-close-solicitud {
  background: transparent;
  border: none;
  color: #1a1000;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

/* Footer Paginador */
.footer-paginador {
  pointer-events: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(14, 16, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-nav-paginador {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.paginador-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#txtIndicadorPagina {
  font-size: 0.95rem;
  font-weight: 800;
}

.txt-sub-paginador {
  font-size: 0.58rem;
  font-weight: 800;
  color: #8e8e93 !important;
}

/* --- DRAWER CON ESPACIADO HOMOGÉNEO Y AIRE VISUAL --- */
.drawer-overlay {
  pointer-events: auto;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  justify-content: flex-end;
}

.drawer-content {
  width: 85%;
  max-width: 320px;
  height: 100%;
  background: #12141a;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-header h2 {
  font-size: 1rem;
  font-weight: 800;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: #a0a0a0;
  font-size: 1.1rem;
  cursor: pointer;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-section h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.section-desc {
  font-size: 0.72rem;
  color: #8e8e93;
  line-height: 1.3;
}

.channel-card-active {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dot-active-green {
  color: #30d158;
  font-size: 0.9rem;
}

.channel-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
}

.channel-sub {
  font-size: 0.68rem;
  color: #8e8e93;
}

.channel-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 4px;
}

.channel-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #e5e5ea;
  cursor: pointer;
}

.btn-drawer-action {
  width: 100%;
  background: #232730;
  color: #ffffff;
  border: 1px solid #3a3f4d;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  margin-top: 8px;
}

.anteriores-list-drawer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-anterior-drawer {
  background: #1a1d24;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.item-anterior-drawer:active {
  background: #282c37;
}

.anterior-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.badge-67-small {
  background: rgba(48, 209, 88, 0.15);
  color: #30d158;
  border: 1px solid #30d158;
  font-size: 0.58rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
}

.anterior-date {
  font-size: 0.68rem;
  color: #8e8e93;
}

.anterior-title {
  font-size: 0.82rem;
  margin: 4px 0 2px 0;
  color: #ffffff;
  font-weight: 800;
}

.anterior-location {
  font-size: 0.73rem;
  color: #a0a0a0;
}

.btn-ver-mas-anteriores {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #8e8e93;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  margin-top: 4px;
}

.btn-uber {
  background: #000000 !important;
  color: #ffffff !important;
  border: 1px solid #333333;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.modal-content {
  background: #1c1c1e;
  border: 1px solid #3a3a3c;
  padding: 16px;
  border-radius: 14px;
  width: 85%;
  max-width: 290px;
  text-align: center;
}

.btn-modal {
  display: block;
  background: #2c2c2e;
  color: #ffffff !important;
  padding: 10px;
  margin: 6px 0;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.8rem;
}

.btn-cancel {
  background: #ff3b30;
  border: none;
  width: 100%;
}

/* ======================================================
   GATEKEEPER / OVERLAY DE ACTIVACIÓN TÁCTICO
   ====================================================== */
.gatekeeper-overlay {
  pointer-events: auto;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #08090b !important;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gatekeeper-card {
  background: #12141a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.gatekeeper-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.gatekeeper-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
}

.gatekeeper-badge {
  font-size: 0.65rem;
  font-weight: 800;
  color: #ff3b30;
  letter-spacing: 1px;
}

.gk-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff !important;
  text-align: center;
  margin-bottom: 6px;
}

.gk-sub {
  font-size: 0.78rem;
  color: #8e8e93 !important;
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.35;
}

.gk-input {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #ffffff !important;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  outline: none;
}

.gk-input:focus {
  border-color: #0a84ff;
  background: rgba(10, 132, 255, 0.1);
}

.gk-privacy-note {
  font-size: 0.68rem;
  color: #8e8e93 !important;
  line-height: 1.35;
  margin-bottom: 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.gk-btn {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 12px;
  background: #30d158;
  border: none;
  border-radius: 10px;
  color: #000000 !important;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.gk-btn:active {
  opacity: 0.8;
}

.gk-error-msg {
  color: #ff3b30 !important;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  margin-top: 10px;
}

.pwa-steps-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.75rem;
  color: #d1d1d6;
  line-height: 1.5;
  text-align: left;
}

.pwa-steps-box p {
  margin-bottom: 6px;
}

.pwa-steps-box p:last-child {
  margin-bottom: 0;
}

.privacy-box-drawer {
  margin-top: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 0.7rem;
  color: #8e8e93;
  line-height: 1.35;
}

.privacy-title-drawer {
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}