@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #050508;
  --bg-panel: rgba(10, 10, 18, 0.96);
  --bg-panel-header: #10101c;
  --border-gold: rgba(197, 160, 89, 0.35);
  --gold-accent: #C5A059;
  --gold-light: #FFE066;
  --red-jacket: #E61F24;
  --black-jacket: #18181B;
  --cyan-telemetry: #00F0FF;
  --green-ok: #10B981;
  --amber-warn: #F59E0B;
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #06060c;
}
::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.45);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 224, 102, 0.7);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  scrollbar-gutter: stable;
}

/* ==========================================================================
   BANNER DE ALERTA JERÁRQUICA (PULL-DOWN NOTIFICATION)
   ========================================================================== */
.alert-broadcast-banner {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  min-width: 480px;
  max-width: 720px;
  padding: 10px 18px;
  border-radius: 0 0 8px 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 30px rgba(0,0,0,0.9);
  animation: slideDown 0.3s ease;
  font-family: var(--font-mono);
}

.alert-broadcast-banner.nivel-baja {
  background: linear-gradient(90deg, #1e3a8a 0%, #172554 100%);
  border: 1px solid #3b82f6;
  color: #bfdbfe;
}

.alert-broadcast-banner.nivel-media {
  background: linear-gradient(90deg, #78350f 0%, #451a03 100%);
  border: 1px solid #f59e0b;
  color: #fef3c7;
}

.alert-broadcast-banner.nivel-alta {
  background: linear-gradient(90deg, #7f1d1d 0%, #450a0a 100%);
  border: 1.5px solid #ef4444;
  color: #fee2e2;
  animation: pulse-siren 1s infinite alternate;
}

@keyframes slideDown {
  from { top: 30px; opacity: 0; }
  to { top: 60px; opacity: 1; }
}

/* ==========================================================================
   CABECERA PRINCIPAL
   ========================================================================== */
.tactical-header {
  height: 68px;
  min-height: 68px;
  max-height: 68px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #10101a 0%, #08080f 100%);
  border-bottom: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  z-index: 1000;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.85);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  white-space: nowrap;
}
.tactical-header::-webkit-scrollbar {
  display: none;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-container-vertical {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-actions-under {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #000;
  background: var(--gold-light);
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   KPIS TÁCTICOS PRINCIPALES INTERACTIVOS (CABECERA)
   ========================================================================== */
.header-kpis-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-kpi-pill {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
  user-select: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.header-kpi-pill .pill-val {
  font-weight: 800;
  font-size: 10.5px;
}

.header-kpi-pill:hover {
  transform: translateY(-1px);
  border-color: var(--gold-light);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.35);
}

.header-kpi-pill.active {
  background: rgba(197, 160, 89, 0.22);
  border-color: #FFE066;
  color: #FFE066;
  box-shadow: 0 0 12px rgba(255, 224, 102, 0.4);
}

.header-kpi-pill.kpi-pill-total .pill-val { color: #FFE066; }
.header-kpi-pill.kpi-pill-mision .pill-val { color: #34d399; }
.header-kpi-pill.kpi-pill-disp .pill-val { color: #38bdf8; }
.header-kpi-pill.kpi-pill-acciones .pill-val { color: #00F0FF; }

.role-tabs {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.75);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  gap: 4px;
}

.role-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.role-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.role-tab-btn.active {
  background: var(--gold-accent);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.4);
}

.btn-tactical {
  background: #141424;
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-tactical:hover, .btn-tactical.active {
  background: var(--gold-accent);
  color: #000;
}

/* ==========================================================================
   VISTAS DEL SISTEMA (SPA)
   ========================================================================== */
.view-container {
  flex: 1;
  position: relative;
  display: none;
  overflow: hidden;
}

.view-container.active {
  display: flex;
}

/* ==========================================================================
   VISTA 1: GERENCIA // DIGITAL TWIN 3D REAL (MAPA LIMPIO)
   ========================================================================== */
.map-viewport {
  position: absolute;
  inset: 0;
  background: #020205;
}

#map-3d {
  width: 100%;
  height: 100%;
}

.side-panel {
  position: absolute;
  top: 15px;
  bottom: 15px;
  width: 350px;
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 45px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.panel-left { left: 15px; }
.panel-right { right: 15px; width: 400px; }

.panel-header {
  padding: 10px 14px;
  background: var(--bg-panel-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.search-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 4px;
  outline: none;
  margin-bottom: 12px;
}

.search-box:focus { border-color: var(--gold-accent); }

.operative-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.operative-card {
  background: rgba(16, 16, 28, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.operative-card:hover, .operative-card.selected {
  border-color: var(--gold-accent);
  background: rgba(197, 160, 89, 0.14);
}

.op-info h4 {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.op-info p {
  font-size: 9.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.badge-tag {
  display: inline-block;
  font-size: 8.5px;
  padding: 2px 5px;
  border-radius: 2px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-lider {
  background: rgba(255, 224, 102, 0.2);
  color: #FFE066;
  border: 1px solid #FFE066;
}

.badge-gestor {
  background: rgba(230, 31, 36, 0.2);
  color: #ff4d4d;
  border: 1px solid #E61F24;
}

/* Marcadores 3D */
.marker-pin-3d {
  width: 38px;
  height: 48px;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.marker-pin-3d:hover {
  transform: scale(1.35) translateY(-6px);
  z-index: 9999 !important;
}

.jacket-model {
  width: 24px;
  height: 32px;
  margin: 0 auto;
  position: relative;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.95));
}

.model-head {
  width: 10px;
  height: 10px;
  background: #fcd34d;
  border-radius: 50%;
  margin: 0 auto 1px;
  border: 1px solid #111;
}

.model-red .model-body {
  width: 20px;
  height: 15px;
  background: linear-gradient(135deg, #ff2a2e 0%, #a30006 100%);
  border-radius: 3px;
  border: 1px solid #fff;
  position: relative;
  box-shadow: 0 0 10px rgba(230, 31, 36, 0.7);
}

.model-red .model-body::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 2px;
  background: #fef08a;
}

.model-black .model-body {
  width: 21px;
  height: 16px;
  background: linear-gradient(135deg, #27272a 0%, #09090b 100%);
  border-radius: 3px;
  border: 1px solid #FFE066;
  position: relative;
  box-shadow: 0 0 12px rgba(255, 224, 102, 0.5);
}

.model-black .model-body::after {
  content: '★';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 7px;
  color: #FFE066;
}

.model-legs {
  width: 14px;
  height: 6px;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
}

.model-leg {
  width: 5.5px;
  height: 6px;
  background: #18181b;
}

.model-ring {
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(230, 31, 36, 0.4) 0%, transparent 70%);
  border: 1px solid var(--red-jacket);
  animation: radar-sweep 2s infinite ease-out;
}

.model-black .model-ring {
  border-color: #FFE066;
  background: radial-gradient(ellipse at center, rgba(255, 224, 102, 0.35) 0%, transparent 70%);
}

.marker-tag {
  background: rgba(8, 8, 14, 0.95);
  border: 1px solid var(--border-gold);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
  text-align: center;
  margin-top: 1px;
}

/* Punto de Encuentro Flag */
.meeting-point-pin {
  background: #FFE066;
  color: #000;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1.5px solid #000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
  white-space: nowrap;
  cursor: pointer;
}

/* Ficha Táctica */
.detail-card {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: var(--gold-accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 10px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 10.5px;
  gap: 8px;
}

.detail-row .k { color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.detail-row .v { font-weight: 600; color: #fff; font-family: var(--font-mono); text-align: right; }

/* ==========================================================================
   VISTA 2: COORDINACIÓN // PLANIFICADOR & GESTIÓN DE PERÍMETROS
   ========================================================================== */
.coordinador-view {
  flex: 1;
  background: #08080f;
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.planning-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 8px 14px;
}

.planning-grid-layout {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 14px;
  flex: 1;
}

.pool-box, .contingency-box {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pool-header {
  padding: 10px 12px;
  background: var(--bg-panel-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  justify-content: space-between;
}

.pool-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-chip {
  background: #12121e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agent-chip.is-lider { border-left: 3px solid #FFE066; }
.agent-chip.is-gestor { border-left: 3px solid #E61F24; }

.activities-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 12px;
  overflow-y: auto;
}

.activity-card {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-card.deficit {
  border-color: #ff4d4d;
  background: rgba(255, 77, 77, 0.06);
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slots-dropzone {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px;
}

.slot-tag {
  background: #181828;
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
  user-select: none;
  transition: all 0.15s ease;
}

.slot-tag:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #00F0FF;
}

.slot-tag.dragging {
  opacity: 0.4;
  cursor: grabbing;
  transform: scale(0.96);
}

.slot-tag.touch-selected {
  border-color: #00F0FF !important;
  background: rgba(0, 240, 255, 0.22) !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.slot-tag .remove-btn {
  color: #ff6b6b;
  cursor: pointer;
  font-weight: bold;
  padding: 0 4px;
  border-radius: 2px;
}

.slot-tag .remove-btn:hover {
  color: #fff;
  background: #ef4444;
}

.form-select, .form-input {
  width: 100%;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 6px 8px;
  border-radius: 4px;
  outline: none;
}

.form-select:focus, .form-input:focus { border-color: var(--gold-accent); }

/* ==========================================================================
   VISTA 3: OPERARIO EN TERRENO (APP MÓVIL)
   ========================================================================== */
.operario-view {
  flex: 1;
  background: #050508;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.mobile-phone-frame {
  width: 380px;
  height: 670px;
  background: #090912;
  border: 2px solid var(--border-gold);
  border-radius: 26px;
  box-shadow: 0 0 60px rgba(197, 160, 89, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.phone-speaker {
  width: 50px;
  height: 4px;
  background: #27272a;
  border-radius: 2px;
  margin: 8px auto 2px;
}

.phone-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow-y: auto;
  gap: 10px;
}

/* ==========================================================================
   BOTONERA TÁCTICA DE ACCIONES POR CATEGORÍAS (8 BOTONES & CONTADORES)
   ========================================================================== */
.tactical-counters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.tactical-counter-pill {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 4px 2px;
  text-align: center;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}

.tactical-counter-pill .cat-name {
  font-size: 7.5px;
  color: #9ca3af;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tactical-counter-pill .cat-val {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  display: block;
}

.tactical-categories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-category-action {
  padding: 8px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-category-action:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.btn-category-action:active {
  transform: scale(0.97);
}

.btn-cat-chc { background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); border-color: #38bdf8; }
.btn-cat-vi  { background: linear-gradient(135deg, #059669 0%, #047857 100%); border-color: #34d399; }
.btn-cat-vic { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); border-color: #fbbf24; }
.btn-cat-mp  { background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%); border-color: #818cf8; }
.btn-cat-cp  { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); border-color: #a78bfa; }
.btn-cat-pcb { background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%); border-color: #facc15; }
.btn-cat-enc { background: linear-gradient(135deg, #e11d48 0%, #be123c 100%); border-color: #fb7185; }
.btn-cat-det { background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%); border-color: #ef4444; }

.photo-evidence-box {
  background: #000;
  border: 1px dashed var(--border-gold);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-preview {
  width: 100%;
  height: 110px;
  background: #111;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-watermark {
  position: absolute;
  bottom: 3px;
  left: 3px;
  right: 3px;
  background: rgba(0,0,0,0.85);
  font-family: var(--font-mono);
  font-size: 7.5px;
  color: var(--gold-light);
  padding: 2px 4px;
  border-radius: 2px;
  text-align: left;
}

@keyframes radar-sweep {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0.9; }
  100% { transform: translate(-50%, 0) scale(2.2); opacity: 0; }
}

@keyframes pulse-siren {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.99); }
  100% { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   VISTA LÍDER DE ESCUADRA & TERMINAL TÁCTICA DE CAMPO
   ========================================================================== */
.lider-view {
  flex: 1;
  background: #08080f;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lider-header-card {
  background: linear-gradient(90deg, #18181b 0%, #0d0d14 100%);
  border: 1.5px solid #FFE066;
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(255, 224, 102, 0.12);
}

.lider-grid-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  flex: 1;
}

.squad-member-card {
  background: rgba(16, 16, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3.5px solid #E61F24;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.squad-member-card:hover {
  background: rgba(230, 31, 36, 0.1);
  border-color: #E61F24;
}

/* MODALES TÁCTICOS (EMISIÓN DE ALERTA 1-9) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #0d0d18;
  border: 1.5px solid var(--border-gold);
  border-radius: 10px;
  width: 540px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.95);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideDown 0.25s ease-out;
}

.modal-header {
  padding: 14px 18px;
  background: #141424;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 20px;
  background: #10101c;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* SELECTOR DE SEVERIDAD 1 A 9 */
.severity-picker {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin-top: 4px;
}

.sev-btn {
  padding: 8px 0;
  background: #141422;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.sev-btn:hover {
  transform: translateY(-2px);
}

.sev-btn.active.baja {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.sev-btn.active.media {
  background: #78350f;
  border-color: #f59e0b;
  color: #fde68a;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.sev-btn.active.alta {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

/* BADGES DE ESTADO DE ACTIVIDAD */
.badge-activa {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10B981;
}

.badge-finalizada {
  background: rgba(156, 163, 175, 0.2);
  color: #9CA3AF;
  border: 1px solid #6B7280;
}

/* BADGES DE DIFICULTAD DE ACTIVIDAD */
.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.diff-baja {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10B981;
}
.diff-media {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid #f59e0b;
}
.diff-alta {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid #f97316;
}
.diff-critica {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid #ef4444;
}

/* SELECTOR DE ESTILOS DE MAPA (3D TWIN / GOOGLE / SATÉLITE) */
.map-style-switch-bar {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 12, 22, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 3px;
  display: flex;
  gap: 4px;
  z-index: 600;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.85);
}

.map-style-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #ccc;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.map-style-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.map-style-btn.active {
  background: var(--gold-accent);
  color: #000;
  font-weight: 700;
  border-color: var(--gold-light);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.4);
}

/* HUD TÁCTICO DE PUNTO FIJADO EN EL MAPA */
.map-pin-hud {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  background: rgba(10, 10, 20, 0.95);
  backdrop-filter: blur(16px);
  border: 1.5px solid #00F0FF;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 10px 40px rgba(0, 240, 255, 0.25);
  z-index: 600;
  animation: slideDown 0.3s ease;
}

#coord-map-view {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 560px;
  background: #020205;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
}

/* ==========================================================================
   BARRA DE DIBUJO EN EL MAPA & HUD DE TRAZO TÁCTICO
   ========================================================================== */
.map-draw-toolbar {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 12, 22, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 3px;
  display: flex;
  gap: 4px;
  z-index: 600;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.85);
}

.map-drawing-hud {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  background: rgba(10, 10, 20, 0.96);
  backdrop-filter: blur(16px);
  border: 1.5px solid #FFE066;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 10px 40px rgba(255, 224, 102, 0.25);
  z-index: 600;
  animation: slideDown 0.25s ease;
}

/* ==========================================================================
   POPUP INTERACTIVO DE GEMELOS DIGITALES (MAPLIBRE GL POPUP)
   ========================================================================== */
.tactical-maplibre-popup .maplibregl-popup-content {
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-gold);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9);
  color: #fff;
  font-family: var(--font-sans);
}

.tactical-maplibre-popup .maplibregl-popup-close-button {
  color: #FFE066;
  font-size: 16px;
  padding: 2px 6px;
}

.tactical-maplibre-popup .maplibregl-popup-tip {
  border-top-color: rgba(10, 10, 18, 0.95);
}

.tactical-agent-popup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.popup-role-badge {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

.popup-code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #FFE066;
  font-weight: bold;
}

.agent-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 8px;
  font-size: 9.5px;
  font-family: var(--font-mono);
}

.agent-popup-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 6px;
}

/* SUB-PESTAÑAS DE COORDINACIÓN */
.sub-tabs-bar {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sub-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.sub-tab-btn.active {
  background: var(--gold-accent);
  color: #000;
  font-weight: 700;
}

/* DASHBOARD DE SEPTIEMBRE // COORDINACIÓN SANTA FE */
.metrics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-stat-card {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-stat-card .kpi-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-stat-card .kpi-val {
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.kpi-stat-card .kpi-trend {
  font-size: 9.5px;
  font-family: var(--font-mono);
}

/* TABLA DE RENDIMIENTO POR OPERARIO */
.performance-table-container {
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}

.perf-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.perf-table th {
  background: #141424;
  color: var(--gold-light);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 700;
}

.perf-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #ddd;
}

.perf-table tbody tr {
  cursor: pointer;
  transition: all 0.15s ease;
}

.perf-table tbody tr:hover td {
  background: rgba(0, 240, 255, 0.08);
}

.perf-table tbody tr.active-dashboard-row td {
  background: rgba(255, 224, 102, 0.16) !important;
  color: #fff;
}

.perf-table tbody tr.active-dashboard-row td:first-child {
  border-left: 3.5px solid #FFE066;
}

/* ==========================================================================
   DRAG & DROP, TOUCH SELECTION & HORAS SEMANALES
   ========================================================================== */
.agent-chip {
  cursor: grab;
  user-select: none;
  transition: all 0.15s ease;
}

.agent-chip:active {
  cursor: grabbing;
}

.agent-chip.dragging {
  opacity: 0.45;
  border: 1.5px dashed #FFE066 !important;
  transform: scale(0.97);
}

.agent-chip.touch-selected {
  border-color: #FFE066 !important;
  background: rgba(255, 224, 102, 0.18) !important;
  box-shadow: 0 0 12px rgba(255, 224, 102, 0.5);
  transform: translateX(4px);
}

.slots-dropzone {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.slots-dropzone.drag-over, .slots-dropzone.ready-to-receive {
  border-color: #10B981 !important;
  background: rgba(16, 185, 129, 0.14) !important;
  box-shadow: inset 0 0 15px rgba(16, 185, 129, 0.2);
}

/* DROPZONE: OPERARIO NO SE PRESENTÓ */
.absent-dropzone {
  background: rgba(30, 8, 8, 0.7);
  border: 1.5px dashed rgba(239, 68, 68, 0.45);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #fca5a5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.absent-dropzone:hover, .absent-dropzone.drag-over {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

/* HORAS SEMANALES BADGE */
.hours-badge {
  font-family: var(--font-mono);
  font-size: 8.5px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #00F0FF;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* MARCADOR DE CLIC EN EL MAPA */
.map-click-pin {
  background: #FFE066;
  color: #000;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1.5px solid #000;
  box-shadow: 0 4px 15px rgba(255, 224, 102, 0.8);
  white-space: nowrap;
  animation: pulse-dest 1.5s infinite alternate;
}

/* INGRESO DE ACTIVIDADES POR CORREO (GERENCIA) */
.email-inbox-card {
  background: rgba(14, 14, 24, 0.9);
  border: 1.5px solid var(--border-gold);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* BADGES DE LOS 3 ESTADOS OFICIALES */
.status-badge-asignado {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10B981;
}

.status-badge-no-asignado {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid #ef4444;
}

.status-badge-disponible {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid #3b82f6;
}

/* ==========================================================================
   DISEÑO RESPONSIVE ADAPTABLE (TABLETS & SMARTPHONES)
   ========================================================================== */
/* ==========================================================================
   V5.7: ARQUITECTURA RESPONSIVE TÁCTICA UNIVERSAL (MÓVIL, TABLET, DESKTOP & 4K)
   ========================================================================== */

/* 1. COMPORTAMIENTO BASE DE PANELES EN DISPOSITIVOS */
.btn-panel-close-responsive {
  display: none;
  padding: 2px 7px;
  font-size: 11px;
}

.tablet-panel-triggers {
  display: none;
}

.mobile-tactical-bottom-nav {
  display: none;
}

/* 2. LAPTOPS COMPACTAS Y PANTALLAS MEDIANAS (1150px a 1380px) */
@media (max-width: 1380px) {
  .side-panel.panel-left {
    width: 290px;
  }
  .side-panel.panel-right {
    width: 320px;
  }
}

/* 3. TABLETS Y PANTALLAS COMPACTAS (769px a 1149px) -> MODO OFF-CANVAS DRAWER */
@media (min-width: 769px) and (max-width: 1149px) {
  .tablet-panel-triggers {
    display: flex;
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    justify-content: space-between;
    pointer-events: none;
    z-index: 850;
  }

  .btn-tablet-trigger {
    pointer-events: auto;
    background: rgba(10, 15, 26, 0.92);
    border: 1px solid var(--border-gold);
    color: var(--gold-light);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .btn-tablet-trigger:hover,
  .btn-tablet-trigger.active {
    background: rgba(255, 224, 102, 0.25);
    border-color: #FFE066;
    color: #FFE066;
    box-shadow: 0 0 14px rgba(255, 224, 102, 0.4);
  }

  .side-panel.panel-left {
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 15px;
    width: 330px;
    max-width: 80vw;
    transform: translateX(-115%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 900;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.95);
  }

  .side-panel.panel-left.drawer-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .side-panel.panel-right {
    position: absolute;
    top: 15px;
    bottom: 15px;
    right: 15px;
    width: 360px;
    max-width: 80vw;
    transform: translateX(115%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 900;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.95);
  }

  .side-panel.panel-right.drawer-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .btn-panel-close-responsive {
    display: block;
  }

  .planning-grid-layout {
    grid-template-columns: 240px 1fr;
  }
}

/* 4. DISPOSITIVOS MÓVILES (< 768px) -> MODO APP TÁCTICA 100% INMERSIVA CON BOTTOM SHEET */
@media (max-width: 768px) {
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .tactical-header {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
    padding: 4px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    justify-content: flex-start;
  }

  .brand-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .brand-actions-under {
    display: none;
  }

  .role-tabs {
    padding: 2px;
    gap: 2px;
  }

  .role-tab-btn {
    font-size: 9px;
    padding: 3px 6px;
  }

  .header-status {
    gap: 6px;
  }

  .metric-pill {
    display: none;
  }

  .header-kpi-pill {
    padding: 3px 6px;
    font-size: 8.5px;
    gap: 3px;
  }

  .header-kpi-pill .pill-val {
    font-size: 9.5px;
  }

  #btn-header-notifs {
    padding: 3px 6px;
    font-size: 9px;
  }

  /* Vista Gerencia y Mapa al 100% */
  .view-container {
    height: calc(100dvh - 54px - 56px);
    min-height: auto;
  }

  #view-gerencia {
    flex-direction: column;
    position: relative;
    height: 100%;
  }

  #ger-subview-twin {
    position: relative;
    width: 100%;
    height: 100%;
  }

  .map-viewport {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
  }

  /* PANELES LATERALES SE CONVIERTEN EN BOTTOM SHEETS FLOTANTES */
  .side-panel.panel-left,
  .side-panel.panel-right {
    position: absolute;
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto !important;
    height: 68dvh;
    max-height: 540px;
    border-radius: 12px;
    transform: translateY(115%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 950;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.95), 0 0 20px rgba(255, 224, 102, 0.2);
    border: 1.5px solid var(--border-gold);
    background: rgba(10, 12, 22, 0.98);
  }

  .side-panel.panel-left.mobile-sheet-open,
  .side-panel.panel-right.mobile-sheet-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .btn-panel-close-responsive {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fca5a5;
  }

  /* BARRA DE NAVEGACIÓN TÁCTICA INFERIOR FIJA */
  .mobile-tactical-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(8, 8, 16, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-gold);
    z-index: 1000;
    padding: 0 4px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.85);
  }

  .mob-nav-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 8.5px;
    font-weight: 700;
    transition: all 0.2s ease;
    flex: 1;
    border-radius: 4px;
  }

  .mob-nav-btn .mob-icon {
    font-size: 16px;
  }

  .mob-nav-btn:hover {
    color: #fff;
  }

  .mob-nav-btn.active {
    color: #FFE066;
    background: rgba(255, 224, 102, 0.12);
  }

  /* HUDs flotantes de mapa adaptados para no colisionar con la barra inferior */
  .map-drawing-hud {
    bottom: 64px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
  }

  .map-pin-hud {
    bottom: 64px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    transform: none !important;
  }

  .map-style-switch-bar {
    top: 8px !important;
    right: 8px !important;
    gap: 4px !important;
  }

  .map-style-btn {
    font-size: 8.5px !important;
    padding: 3px 6px !important;
  }

  .map-draw-toolbar {
    top: 44px !important;
    right: 8px !important;
  }

  /* MODALES FLUIDOS EN MÓVILES */
  .modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 85dvh !important;
    padding: 12px !important;
  }

  .matriz-nodos-grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)) !important;
    gap: 6px !important;
    max-height: 52dvh !important;
  }

  .nodo-operario-card {
    padding: 5px !important;
    gap: 4px !important;
  }

  .hoja-vida-grid-data {
    grid-template-columns: 1fr !important;
  }

  /* Grids de Vistas Secundarias (Planificación, Métricas, etc.) */
  .planning-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 10px;
    height: auto;
    overflow-y: auto;
  }

  .metrics-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }

  .lider-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .mobile-phone-frame {
    width: 100% !important;
    max-width: 360px !important;
  }
}

/* 5. PANTALLAS ULTRA PEQUEÑAS (< 420px) */
@media (max-width: 420px) {
  .tactical-header {
    height: 50px;
    min-height: 50px;
    max-height: 50px;
  }

  .matriz-nodos-grid {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)) !important;
  }

  .header-kpi-pill {
    padding: 2px 4px;
    font-size: 8px;
  }
}

/* ==========================================================================
   ESTILOS: HISTORIAL DE ACCIONES, HOJA DE VIDA & BANNER DE CIERRE
   ========================================================================== */
.action-history-card {
  background: rgba(10, 10, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #00F0FF;
  border-radius: 6px;
  padding: 8px 10px;
  transition: all 0.2s ease;
}

.action-history-card:hover {
  background: rgba(15, 20, 35, 0.95);
  border-color: rgba(0, 240, 255, 0.5);
  transform: translateX(2px);
}

.closure-approval-card {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
  animation: slideDown 0.3s ease;
}

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

.hoja-vida-stat {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 10px;
}

.hoja-vida-stat .k {
  font-size: 8.5px;
  font-family: var(--font-mono);
  color: #9ca3af;
  text-transform: uppercase;
}

.hoja-vida-stat .v {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
  margin-top: 2px;
}

/* ==========================================================================
   TARJETA INTERACTIVA DE TELEMETRÍA Y MÉTRICAS EN EL DASHBOARD
   ========================================================================== */
.dashboard-agent-card {
  background: rgba(14, 16, 28, 0.96);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-gold);
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85);
  transition: all 0.25s ease;
  overflow: hidden;
  animation: slideDown 0.25s ease;
}

.dashboard-agent-card.minimized {
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 240, 255, 0.2);
  background: rgba(10, 14, 26, 0.95);
}

.dashboard-card-mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.45);
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-card-mini-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}

.dashboard-card-expanded-content {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.dashboard-metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.dashboard-summary-stat {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 12px;
}

.dashboard-summary-stat .lbl {
  font-size: 8.5px;
  font-family: var(--font-mono);
  color: #9ca3af;
  text-transform: uppercase;
}

.dashboard-summary-stat .val {
  font-size: 17px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  margin-top: 2px;
}

.dashboard-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dashboard-telemetry-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 10px;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-actions-pills-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.dashboard-action-pill {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 6px 4px;
  text-align: center;
}

.dashboard-action-pill .p-name {
  font-size: 8.5px;
  display: block;
}

.dashboard-action-pill .p-val {
  font-size: 14px;
  font-weight: bold;
  font-family: var(--font-mono);
  color: #fff;
  margin-top: 2px;
}

.dashboard-photo-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.dashboard-photo-thumb {
  width: 95px;
  height: 68px;
  border-radius: 4px;
  overflow: hidden;
  border: 1.5px solid rgba(0, 240, 255, 0.4);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.dashboard-photo-thumb:hover {
  transform: scale(1.05);
  border-color: #00F0FF;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

@media (max-width: 900px) {
  .dashboard-metrics-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-telemetry-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-actions-pills-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   V5.3: BOTÓN DE NOTIFICACIONES EN CABECERA & CENTRO DE NOTIFICACIONES
   ========================================================================== */
.btn-header-notifications {
  background: rgba(16, 16, 28, 0.85);
  border: 1px solid var(--border-gold);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.btn-header-notifications:hover {
  background: rgba(197, 160, 89, 0.2);
  border-color: var(--gold-light);
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.4);
}

.badge-notif-count {
  background: #E61F24;
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 0 8px rgba(230, 31, 36, 0.6);
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ==========================================================================
   V5.3: RADAR DE PERSONAL MINIMIZABLE & BOTÓN DASHBOARD
   ========================================================================== */
.side-panel.panel-left {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
  contain: layout;
}

.side-panel.panel-left.minimized {
  width: 48px;
  min-width: 48px;
  overflow: hidden;
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.side-panel.panel-left .radar-header-title-box,
.side-panel.panel-left #radar-panel-body {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.side-panel.panel-left.minimized .radar-header-title-box,
.side-panel.panel-left.minimized #radar-panel-body {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.side-panel.panel-left.minimized .panel-header {
  padding: 12px 4px;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.radar-minimized-vertical-strip {
  display: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold-accent);
  letter-spacing: 2px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color 0.2s ease;
}

.radar-minimized-vertical-strip:hover {
  color: var(--gold-light);
  text-shadow: 0 0 8px rgba(255, 224, 102, 0.6);
}

.side-panel.panel-left.minimized .radar-minimized-vertical-strip {
  display: block;
}

/* ==========================================================================
   KPIS INTERACTIVOS DEL DASHBOARD Y FILTROS ACTIVOS
   ========================================================================== */
.kpi-stat-card.interactive-kpi {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
}

.kpi-stat-card.interactive-kpi:hover {
  transform: translateY(-2px);
  border-color: var(--gold-light);
  box-shadow: 0 4px 18px rgba(197, 160, 89, 0.25);
}

.kpi-stat-card.interactive-kpi.active-kpi-filter {
  border-color: #00F0FF;
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
}

.kpi-click-hint {
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--gold-accent);
  opacity: 0.85;
  margin-left: 4px;
}

.active-kpi-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid #00F0FF;
  border-radius: 4px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #00F0FF;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-radar-minimize {
  padding: 2px 6px;
  font-size: 8.5px;
  background: #1e1e38;
  border-color: #38bdf8;
  color: #bae6fd;
}

.btn-radar-dash {
  padding: 2px 5px;
  font-size: 8.5px;
  background: #1e293b;
  border-color: #38bdf8;
  color: #38bdf8;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.btn-radar-dash:hover {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  transform: scale(1.08);
}

/* ==========================================================================
   V5.3: SECCIONES MINIMIZABLES DE LA FICHA DE TELEMETRÍA (ACCORDION)
   ========================================================================== */
.telemetry-collapsible-block {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.telemetry-collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.18s ease;
  user-select: none;
}

.telemetry-collapsible-header:hover {
  background: rgba(197, 160, 89, 0.1);
}

.telemetry-arrow {
  font-size: 8.5px;
  color: var(--gold-accent);
  transition: transform 0.2s ease;
  display: inline-block;
  width: 10px;
}

.telemetry-toggle-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: #00F0FF;
}

.telemetry-collapsible-content {
  margin-top: 4px;
  transition: all 0.2s ease;
}

/* ==========================================================================
   V5.3: CATÁLOGO DE PRESETS DE ACTIVIDAD (GERENCIA C-LEVEL)
   ========================================================================== */
.preset-item-card {
  background: rgba(15, 15, 26, 0.85);
  border: 1px solid rgba(197, 160, 89, 0.3);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.preset-item-card:hover {
  border-color: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   V5.3: MODAL CENTRO DE NOTIFICACIONES & HILOS DE CONTESTACIÓN
   ========================================================================== */
.notif-filter-btn {
  background: #111122;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.notif-filter-btn:hover,
.notif-filter-btn.active {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #fff;
  font-weight: bold;
}

.notif-card {
  background: rgba(15, 15, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.2s ease;
}

.notif-card.sev-alta {
  border-left: 4px solid #ef4444;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.15) 0%, rgba(15, 15, 26, 0.9) 100%);
}

.notif-card.sev-media {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(90deg, rgba(120, 53, 15, 0.12) 0%, rgba(15, 15, 26, 0.9) 100%);
}

.notif-card.sev-baja {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.12) 0%, rgba(15, 15, 26, 0.9) 100%);
}

.notif-thread-container {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.notif-reply-item {
  background: rgba(255, 255, 255, 0.03);
  border-left: 2.5px solid var(--gold-accent);
  padding: 4px 8px;
  border-radius: 0 4px 4px 0;
  font-size: 9.5px;
}

.notif-reply-item.role-gerente {
  border-left-color: #FFE066;
  background: rgba(245, 158, 11, 0.08);
}

.notif-reply-item.role-coordinador {
  border-left-color: #00F0FF;
  background: rgba(0, 240, 255, 0.08);
}

.notif-reply-item.role-lider {
  border-left-color: #10B981;
  background: rgba(16, 185, 129, 0.08);
}

/* ==========================================================================
   V5.5: ESTILOS TÁCTICOS PARA CREACIÓN Y GUARDADO DE POLÍGONOS EN MAPA
   ========================================================================== */
#modal-guardar-poligono-actividad .modal-box {
  border: 1.5px solid #00F0FF;
  box-shadow: 0 20px 60px rgba(0, 240, 255, 0.35);
}

.map-style-btn#btn-draw-save-act {
  animation: pulseGlowGreen 2s infinite ease-in-out;
}

@keyframes pulseGlowGreen {
  0%, 100% {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    border-color: #10B981;
  }
  50% {
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
    border-color: #34d399;
  }
}

.poly-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
}

.poly-status-badge.has-poly {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid #00F0FF;
  color: #00F0FF;
}

.poly-status-badge.no-poly {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.poly-status-badge.no-poly:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #f87171;
  transform: translateY(-1px);
}

/* ==========================================================================
   V5.6: MATRIZ TÁCTICA 60 NODOS, AVATARS CUADRADOS & MODO MISIÓN LIMPIO
   ========================================================================== */

/* 1. MODO GEOESPACIAL LIMPIO (TERRENO PURO) */
.hud-mision-limpio-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: rgba(10, 15, 26, 0.94);
  border: 1px solid #FFE066;
  box-shadow: 0 0 28px rgba(255, 224, 102, 0.4), 0 8px 32px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  backdrop-filter: blur(10px);
  animation: fadeInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.pulse-satellite-icon {
  animation: pulseSatellite 2s infinite ease-in-out;
  display: inline-block;
}

@keyframes pulseSatellite {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #00F0FF); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 10px #FFE066); }
  100% { transform: scale(1); filter: drop-shadow(0 0 2px #00F0FF); }
}

.modo-terreno-limpio #panel-radar-left {
  transform: translateX(-110%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease !important;
}

.modo-terreno-limpio #panel-telemetria-right {
  transform: translateX(110%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease !important;
}

.modo-terreno-limpio #btn-kpi-mision {
  background: rgba(255, 224, 102, 0.25) !important;
  border-color: #FFE066 !important;
  box-shadow: 0 0 15px rgba(255, 224, 102, 0.5) !important;
}

/* 2. MATRIZ DE 60 NODOS */
.matriz-nodos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 4px;
}

.nodo-operario-card {
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(255, 224, 102, 0.22);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.nodo-operario-card:hover {
  border-color: #FFE066;
  box-shadow: 0 0 16px rgba(255, 224, 102, 0.35);
  transform: translateY(-3px);
  background: #151d2a;
}

.nodo-operario-card.asignado {
  border-color: rgba(16, 185, 129, 0.4);
}
.nodo-operario-card.asignado:hover {
  border-color: #10B981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

.nodo-operario-card.disponible {
  border-color: rgba(0, 240, 255, 0.3);
}
.nodo-operario-card.disponible:hover {
  border-color: #00F0FF;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

.nodo-operario-card.alerta {
  border-color: rgba(239, 68, 68, 0.5);
  animation: pulseCardAlert 2s infinite ease-in-out;
}

@keyframes pulseCardAlert {
  0% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 14px rgba(239, 68, 68, 0.6); }
  100% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.3); }
}

/* 3. ESPACIO CUADRADO PARA DIBUJOS DE PERFIL */
.avatar-cuadrado-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 240, 255, 0.35);
  position: relative;
  background: #070a12;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-cuadrado-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Retícula táctica de esquina en la foto cuadrada */
.avatar-cuadrado-box::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid rgba(255, 224, 102, 0.8);
  border-left: 1.5px solid rgba(255, 224, 102, 0.8);
  pointer-events: none;
  z-index: 2;
}

.avatar-cuadrado-box::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-bottom: 1.5px solid rgba(255, 224, 102, 0.8);
  border-right: 1.5px solid rgba(255, 224, 102, 0.8);
  pointer-events: none;
  z-index: 2;
}

.btn-matriz-filter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 224, 102, 0.25);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-matriz-filter:hover {
  background: rgba(255, 224, 102, 0.15);
  border-color: #FFE066;
  color: #FFE066;
}

.btn-matriz-filter.active {
  background: rgba(255, 224, 102, 0.22);
  border-color: #FFE066;
  color: #FFE066;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(255, 224, 102, 0.25);
}

.hoja-vida-grid-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 224, 102, 0.2);
  border-radius: 6px;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
}


