:root {
  --tdf-navy: #062338;
  --tdf-navy-deep: #041726;
  --tdf-charcoal: #263238;
  --tdf-slate: #546e7a;
  --tdf-white: #ffffff;
  --tdf-surface-alt: #f4f7f9;
  --tdf-border: #dce4ec;

  --tdf-orange: #f5820b;
  --tdf-orange-alert: #ea5b1b;
  --tdf-coral: #ff3b1d;
  --tdf-green: #00a83f;
  --tdf-blue: #0088ff;

  --tdf-rainbow: linear-gradient(90deg, #ea5b1b 0%, #f5820b 32%, #00a83f 68%, #0088ff 100%);

  --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--tdf-navy);
  color: var(--tdf-charcoal);
  font-family: var(--font-sans);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ==========================================================================
   1. CONTENEDOR SUPERIOR COMPACTO
   ========================================================================== */
.top-ui-stack {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.top-ui-stack > * {
  pointer-events: auto;
}

.tdf-header {
  background: var(--tdf-white);
  padding-top: var(--safe-top);
  box-shadow: 0 2px 10px rgba(6, 35, 56, 0.14);
}

.tdf-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  gap: 8px;
}

.idetdf-nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.idetdf-nav-logo {
  height: 28px;
  width: auto;
  max-width: 105px;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s ease;
}

.idetdf-nav-link:hover .idetdf-nav-logo {
  opacity: 0.85;
}

.tdf-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.tdf-ring-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.tdf-brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tdf-gob-label {
  font-size: 0.74rem;
  color: var(--tdf-charcoal);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tdf-gob-label strong {
  font-family: var(--font-display);
  font-weight: 800;
}

.tdf-drill-label {
  font-size: 0.63rem;
  font-weight: 800;
  color: var(--tdf-orange-alert);
  letter-spacing: 0.2px;
  line-height: 1.15;
}

.tdf-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.net-badge {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e6f7ed;
  color: var(--tdf-green);
}

.net-badge.offline {
  background: #fff3e0;
  color: var(--tdf-orange-alert);
}

/* Manejo de textos por defecto */
.drill-text-alarm {
  display: none;
}

.drill-text-full {
  display: inline;
}

/* Estado cuando la alarma está sonando */
.tdf-header.alarm-active .tdf-gob-label {
  display: none;
}

.tdf-header.alarm-active .drill-text-full {
  display: none;
}

.tdf-header.alarm-active .drill-text-alarm {
  display: inline;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--tdf-orange-alert);
  letter-spacing: 0.1px;
}

/* Botón silenciar optimizado */
.btn-mute-alarm {
  display: none;
  background: var(--tdf-coral);
  color: var(--tdf-white);
  border: none;
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(255, 59, 29, 0.4);
}

.btn-mute-alarm.visible {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Enlace del logo IDETDF */
.idetdf-nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.idetdf-nav-logo {
  height: 26px;
  width: auto;
  max-width: 95px;
  object-fit: contain;
  display: block;
}

.tdf-rainbow-rule {
  height: 4px;
  width: 100%;
  background: var(--tdf-rainbow);
}

/* ==========================================================================
   1b. CABECERA: TÍTULO IZQUIERDA / LOGOS Y SILENCIAR DERECHA
   ========================================================================== */
.tdf-header-inner {
  justify-content: space-between;
  gap: 6px;
}

.tdf-brand {
  flex: 1 1 auto;
  min-width: 0;
}

.tdf-brand-titles {
  min-width: 0;
}

.tdf-zona-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--tdf-navy);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tdf-header-right {
  gap: 7px;
}

.gob-logo {
  height: 34px;
  width: auto;
  max-width: none;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.gob-logo.is-compact {
  height: 34px;
  width: 34px;
}

.idetdf-nav-logo {
  height: 34px;
  width: auto;
  max-width: none;
}

.btn-mute-alarm {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 5px 8px;
  font-size: 0.7rem;
}

.tdf-header-inner.mute-compact .btn-mute-text {
  display: none;
}

.tdf-header-inner.mute-compact .btn-mute-alarm {
  padding: 6px 8px;
}

/* ==========================================================================
   2. CONTADOR CON OLA ANIMADA
   ========================================================================== */
.stage-stack-pad {
  padding: 8px 10px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.stage-stack-pad > * {
  pointer-events: auto;
}

.stage-pill {
  position: relative;
  overflow: hidden;
  background: var(--tdf-navy-deep);
  color: var(--tdf-white);
  border-radius: 14px;
  padding: 9px 11px;
  box-shadow: 0 6px 18px rgba(6, 35, 56, 0.32);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-bottom: 3px solid var(--tdf-orange);
}

.wave-progress-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  z-index: 1;
  overflow: hidden;
  transition: width 1s ease;
  background: linear-gradient(90deg, rgba(0, 102, 170, 0.55) 0%, rgba(0, 136, 255, 0.78) 100%);
  border-right: 2px solid rgba(255, 255, 255, 0.75);
}

.wave-svg {
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 200%;
  height: 100%;
  animation: waveSlide 6s linear infinite;
}

.wave-layer-back {
  fill: rgba(0, 136, 255, 0.42);
}

.wave-layer-front {
  fill: rgba(56, 189, 248, 0.52);
}

.wave-crest-glow {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65));
}

@keyframes waveSlide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.flyer-rings-bg {
  position: absolute;
  right: -18px;
  top: -18px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle,
    transparent 0px,
    transparent 8px,
    rgba(234, 91, 27, 0.22) 9px,
    rgba(234, 91, 27, 0.22) 11px
  );
  z-index: 1;
  pointer-events: none;
}

.stage-pill.stage-during {
  background: var(--tdf-orange-alert);
  border-bottom-color: var(--tdf-white);
}

.stage-pill.stage-safe {
  background: var(--tdf-green);
  border-bottom-color: #046c2a;
}

.stage-pill.stage-post {
  background: var(--tdf-blue);
  border-bottom-color: var(--tdf-navy);
}

.stage-pill-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-pill-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.stage-pill-texts {
  min-width: 0;
  flex: 1;
}

.stage-calendar-badge {
  background: var(--tdf-orange-alert);
  color: var(--tdf-white);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.76rem;
  line-height: 1;
  padding: 5px 6px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.stage-calendar-badge small {
  font-size: 0.5rem;
  letter-spacing: 0.4px;
}

.stage-pill-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.stage-pill-sub {
  font-size: 0.61rem;
  line-height: 1.2;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.stage-pill-digits {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 900;
  background: rgba(4, 23, 38, 0.76);
  padding: 5px 8px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

/* ==========================================================================
   3. FILA DE PÍLDORAS OPERATIVAS REDONDEADAS (RESTAURADAS)
   ========================================================================== */
.quick-pills-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  overflow-x: auto;
  padding: 0 1px 2px 1px;
  scrollbar-width: none;
}

.quick-pills-row::-webkit-scrollbar {
  display: none;
}

.q-pill {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--tdf-white);
  color: var(--tdf-navy);
  border: 1.5px solid var(--tdf-border);
  border-radius: 99px;
  padding: 6px 8px;
  font-family: var(--font-sans);
  font-size: 0.69rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(6, 35, 56, 0.18);
  transition: all 0.2s ease;
}

.q-pill.compass-active {
  background: var(--tdf-navy);
  color: var(--tdf-white);
  border-color: var(--tdf-orange);
}

.q-pill-sos {
  background: var(--tdf-coral);
  color: var(--tdf-white);
  border-color: var(--tdf-white);
  font-family: var(--font-display);
}

/* ==========================================================================
   4. TARJETA OPERATIVA INFERIOR
   ========================================================================== */
.citizen-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--tdf-white);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 28px rgba(6, 35, 56, 0.26);
  overflow: hidden;
  padding-bottom: var(--safe-bottom);
  transition: transform 0.25s ease;
}

.sheet-rainbow-bar {
  height: 5px;
  width: 100%;
  background: var(--tdf-rainbow);
}

.sheet-handle-btn {
  width: 100%;
  background: var(--tdf-white);
  border: none;
  padding: 6px 14px 2px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.sheet-handle-bar {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: #cbd5e1;
}

.sheet-handle-label {
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--tdf-slate);
}

.citizen-sheet.collapsed .citizen-sheet-body {
  display: none;
}

.citizen-sheet-body {
  padding: 6px 14px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.status-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border-left: 6px solid var(--tdf-navy);
  background: var(--tdf-surface-alt);
}

.status-banner.status-evac {
  background: #fff1f0;
  border-left-color: var(--tdf-coral);
}

.status-banner.status-safe {
  background: #e8f8ee;
  border-left-color: var(--tdf-green);
}

.status-banner.status-outside {
  background: #fff7e6;
  border-left-color: var(--tdf-orange);
}

.status-icon-wrap {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.status-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.status-head-row h2 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--tdf-navy);
}

.status-dist-pill {
  background: var(--tdf-navy);
  color: var(--tdf-white);
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
}

.status-copy p {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--tdf-charcoal);
  font-weight: 600;
}

.post-summary-box {
  background: var(--tdf-navy);
  color: var(--tdf-white);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.post-summary-text {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
}

.post-summary-text strong {
  color: #ffb74d;
  font-family: var(--font-display);
}

.post-summary-actions {
  display: flex;
  gap: 6px;
}

.btn-safe-wa {
  background: var(--tdf-green);
  color: var(--tdf-white);
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.71rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.btn-cert-inline {
  background: var(--tdf-orange);
  color: var(--tdf-white);
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.71rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.action-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.btn-locate-main {
  width: 100%;
  background: var(--tdf-orange);
  color: var(--tdf-white);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 130, 11, 0.32);
}

.locate-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tdf-white);
}

.locate-pulse-dot.active {
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.35);
}

.sub-actions-row.three-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-items: stretch;
}

.card-action {
  border: none;
  border-radius: 12px;
  padding: 9px 8px;
  color: var(--tdf-white);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  min-height: 54px;
  text-decoration: none;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.card-green { background: linear-gradient(135deg, #00a83f 0%, #008a33 100%); }
.card-blue  { background: linear-gradient(135deg, #0088ff 0%, #0066cc 100%); }
.card-coral { background: linear-gradient(135deg, #ff5126 0%, #e03212 100%); }

a.card-action {
  text-decoration: none;
  color: var(--tdf-white);
}

.card-action.is-locked {
  background: #94a3b8;
  color: #f1f5f9;
  opacity: 0.88;
}

.card-action-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.card-action-sub {
  font-size: 0.62rem;
  line-height: 1.15;
  opacity: 0.95;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* ==========================================================================
   5. MODALES Y BUSCADOR DE CALLES
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 35, 56, 0.68);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  background: var(--tdf-white);
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(20px + var(--safe-bottom)) 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 5px solid var(--tdf-orange);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--tdf-border);
  padding-bottom: 9px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--tdf-navy);
}

.modal-close {
  background: var(--tdf-surface-alt);
  border: 1px solid var(--tdf-border);
  color: var(--tdf-charcoal);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.search-result-btn {
  width: 100%;
  text-align: left;
  background: var(--tdf-surface-alt);
  border: 1px solid var(--tdf-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tdf-navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result-btn small {
  color: var(--tdf-orange-alert);
  font-weight: 800;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--tdf-surface-alt);
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--tdf-border);
}

.legend-row strong {
  font-size: 0.8rem;
  color: var(--tdf-navy);
  display: block;
  margin-bottom: 2px;
}

.legend-row p {
  font-size: 0.74rem;
  color: var(--tdf-slate);
  line-height: 1.33;
}

.swatch {
  width: 34px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 3px;
}

.swatch-punto-llegada {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a23de;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(6, 35, 56, 0.35);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 2px 5px 0 5px;
}

.swatch-evac {
  background: rgba(230, 0, 0, 0.35);
  border: 2px dashed #ffffff;
  outline: 2px solid #000000;
}

.swatch-safe-poly {
  background: rgba(11, 167, 41, 0.35);
  border: 2px dashed #ffffff;
  outline: 2px solid #0ba729;
}

.swatch-via-azul {
  height: 7px;
  background: #1a23de;
  margin-top: 8px;
}

.swatch-escalera {
  height: 7px;
  background: repeating-linear-gradient(90deg, #1d4ed8 0px, #1d4ed8 6px, #ffffff 6px, #ffffff 10px);
  border: 1px solid #94a3b8;
  margin-top: 8px;
}

.swatch-user-track {
  height: 6px;
  background: #00e676;
  border: 1.5px solid #ffffff;
  outline: 1px solid #052e16;
  margin-top: 8px;
}

.clean-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--tdf-navy);
}

.input-clean {
  background: var(--tdf-surface-alt);
  border: 1.5px solid var(--tdf-border);
  color: var(--tdf-charcoal);
  padding: 10px 12px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  width: 100%;
}

textarea.input-clean {
  min-height: 85px;
  resize: vertical;
}

.cert-canvas-box {
  background: var(--tdf-navy);
  padding: 10px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
}

#certCanvas {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 10px;
}

.modal-two-btns {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
}

.btn-primary-orange {
  background: var(--tdf-orange);
  color: var(--tdf-white);
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.83rem;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

.btn-outline-dark {
  background: var(--tdf-white);
  color: var(--tdf-navy);
  border: 2px solid var(--tdf-navy);
  padding: 12px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.modal-helper {
  font-size: 0.78rem;
  color: var(--tdf-slate);
}

.sos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sos-item {
  border-radius: 14px;
  padding: 15px 10px;
  text-decoration: none;
  color: var(--tdf-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sos-item strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
}

.sos-item span {
  font-size: 0.76rem;
  font-weight: 700;
}

.sos-orange { background: var(--tdf-orange-alert); }
.sos-blue   { background: var(--tdf-blue); }

/* Panel Admin */
.admin-panel {
  background: var(--tdf-white);
  color: var(--tdf-charcoal);
  border: 2px solid var(--tdf-orange-alert);
  border-radius: 14px;
  padding: 10px;
  font-size: 0.71rem;
  display: none;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  max-height: 46vh;
  overflow-y: auto;
}

.admin-panel.active {
  display: flex;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--tdf-orange-alert);
}

.admin-close, .admin-btn {
  background: var(--tdf-surface-alt);
  color: var(--tdf-navy);
  border: 1px solid var(--tdf-border);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.67rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn.active {
  background: var(--tdf-orange-alert);
  color: var(--tdf-white);
}

.admin-meta {
  color: var(--tdf-slate);
  font-size: 0.65rem;
}

.admin-label {
  font-weight: 800;
  color: var(--tdf-navy);
}

.admin-btn-row, .admin-webhook-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--tdf-border);
  border-radius: 6px;
  font-size: 0.69rem;
}

/* Marcador GPS con Cono de Visión / Brújula */
.user-gps-marker {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tdf-blue);
  border: 3.5px solid var(--tdf-white);
  box-shadow: 0 0 0 6px rgba(0, 136, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.user-gps-marker.level-evac {
  background: var(--tdf-coral);
  box-shadow: 0 0 0 8px rgba(255, 59, 29, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.user-gps-marker.level-safe {
  background: var(--tdf-green);
  box-shadow: 0 0 0 8px rgba(0, 168, 63, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.user-gps-marker.level-outside {
  background: var(--tdf-orange);
  box-shadow: 0 0 0 7px rgba(245, 130, 11, 0.4), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.user-heading-cone {
  position: absolute;
  top: -34px;
  left: -16px;
  width: 48px;
  height: 42px;
  background: linear-gradient(180deg, rgba(0, 136, 255, 0.0) 0%, rgba(0, 136, 255, 0.58) 100%);
  clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
  pointer-events: none;
  display: none;
}

.user-gps-marker.compass-on .user-heading-cone {
  display: block;
}

.drill-alert-backdrop {
  align-items: center;
  background: rgba(234, 91, 27, 0.96);
  z-index: 100;
}

.drill-alert-card {
  background: var(--tdf-white);
  color: var(--tdf-navy);
  border-radius: 20px;
  padding: 24px 20px;
  margin: 16px;
  width: calc(100% - 32px);
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: drillPulse 1.2s ease-in-out infinite;
}

.drill-alert-icon {
  font-size: 3rem;
  line-height: 1;
}

.drill-alert-card h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--tdf-orange-alert);
}

.drill-alert-card p {
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 600;
}

.drill-alert-note {
  font-size: 0.8rem !important;
  color: var(--tdf-slate);
}

.admin-controls {
  flex-direction: column;
  gap: 6px;
}

.admin-btn-danger {
  background: var(--tdf-coral) !important;
  color: var(--tdf-white) !important;
  border-color: var(--tdf-coral) !important;
}

@keyframes drillPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.02); }
}

/* Estado Cancelado en el Banner Superior y Panel Admin */
.stage-pill.stage-canceled {
  background: #334155;
  border-bottom-color: var(--tdf-coral);
}

.stage-pill.stage-canceled .wave-progress-track {
  display: none;
}

.admin-btn-cancel {
  background: #334155 !important;
  color: var(--tdf-white) !important;
  border-color: #1e293b !important;
}