/* ==============================================================================
   SIEP NEIVA — SISTEMA INTEGRAL DE ESPACIO PÚBLICO
   DISEÑO Y SISTEMA VISUAL ULTRA MODERNO (UI/UX 2026 CON SISTEMA RBAC)
   ============================================================================== */

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

:root {
  /* Paleta Institucional Neiva (Verde Esmeralda + Oro Huilense) */
  --p-950: #042f24;
  --p-900: #064e3b;
  --p-800: #065f46;
  --p-700: #047857;
  --p-600: #059669;
  --p-500: #10b981;
  --p-400: #34d399;
  --p-100: #d1fae5;
  --p-50:  #ecfdf5;

  --oro-600: #d97706;
  --oro-500: #f59e0b;
  --oro-400: #fbbf24;
  --oro-100: #fef3c7;
  --oro-50:  #fffbeb;

  --danger-600: #dc2626;
  --danger-500: #ef4444;
  --danger-100: #fee2e2;
  --danger-50:  #fef2f2;

  --info-600: #0284c7;
  --info-500: #0ea5e9;
  --info-100: #e0f2fe;
  --info-50:  #f0f9ff;

  --purple-600: #7c3aed;
  --purple-500: #8b5cf6;
  --purple-100: #ede9fe;
  --purple-50:  #f5f3ff;

  /* Superficies y Neutros */
  --bg-app: #f1f5f4;
  --surface: #ffffff;
  --surface-subtle: #f8faf9;
  --border: #e2e8f0;
  --border-light: #edf2f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Sombras y Efectos */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(6, 78, 59, 0.05);
  --shadow-md: 0 8px 24px rgba(6, 78, 59, 0.08);
  --shadow-lg: 0 16px 40px rgba(6, 78, 59, 0.12);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.25);
  --shadow-gold: 0 0 20px rgba(245, 158, 11, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-app);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==============================================================================
   PANTALLA DE AUTENTICACIÓN (LOGIN) Y CONTROL DE ACCESO
   ============================================================================== */
.login-screen-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, #064e3b 0%, #042f24 50%, #021a14 100%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-modal-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  animation: loginCardPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header-banner {
  background: linear-gradient(135deg, var(--p-950), var(--p-900));
  color: #ffffff;
  padding: 30px 32px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid var(--oro-500);
}

.login-body {
  padding: 32px;
}

.demo-roles-selector {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.demo-roles-selector p {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.demo-chips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-chip-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  text-align: left;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.demo-chip-btn span {
  font-size: 10px;
  color: var(--p-700);
  font-weight: 600;
}

.demo-chip-btn:hover {
  background: var(--p-50);
  border-color: var(--p-500);
  transform: translateY(-2px);
}

/* ==============================================================================
   BARRA DE MODO ADMINISTRADOR (EDICIÓN EN VIVO)
   ============================================================================== */
.admin-toolbar {
  display: none;
  background: linear-gradient(90deg, #1e293b, #0f172a);
  color: #fff;
  padding: 8px 24px;
  font-size: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--oro-500);
  position: sticky;
  top: 0;
  z-index: 60;
  animation: slideDown 0.3s ease;
}

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

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--oro-400);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--oro-400);
  box-shadow: 0 0 8px var(--oro-400);
  animation: pulse 1.5s infinite;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.admin-btn.primary {
  background: var(--p-600);
  color: #fff;
}

.admin-btn.primary:hover {
  background: var(--p-500);
}

.editable-hint {
  outline: 2px dashed var(--oro-500) !important;
  outline-offset: 4px;
  position: relative;
  cursor: text;
  background: rgba(245, 158, 11, 0.03);
  border-radius: 4px;
}

/* ==============================================================================
   ESTRUCTURA PRINCIPAL (APP SHELL)
   ============================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--p-950);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-emblem {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--oro-400), var(--oro-600));
  color: var(--p-950);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.05em;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
}

.brand-info h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #ffffff;
}

.brand-info h2 span {
  color: var(--oro-400);
}

.brand-info p {
  font-size: 11px;
  color: rgba(209, 250, 229, 0.7);
  font-weight: 500;
  margin-top: 3px;
}

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
}

.nav-group-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(209, 250, 229, 0.45);
  padding: 0 12px 10px;
}

.nav-list {
  display: grid;
  gap: 4px;
  list-style: none;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: rgba(209, 250, 229, 0.8);
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
  transition: var(--transition);
  position: relative;
}

.nav-btn.hidden {
  display: none !important;
}

.nav-btn svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-btn .nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.nav-btn.active {
  background: #ffffff;
  color: var(--p-950);
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.nav-btn.active svg {
  color: var(--p-700);
  opacity: 1;
}

.nav-btn.active .nav-badge {
  background: var(--p-100);
  color: var(--p-900);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--oro-400), var(--oro-600));
  color: var(--p-950);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-meta strong {
  display: block;
  font-size: 13px;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta small {
  font-size: 10.5px;
  color: var(--oro-400);
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}

.logout-icon-btn {
  color: rgba(255, 255, 255, 0.6);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.logout-icon-btn:hover {
  color: var(--danger-500);
  background: rgba(255, 255, 255, 0.1);
}

/* Espacio de trabajo (Workspace) */
.workspace {
  margin-left: 280px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Barra Superior (Topbar) */
.topbar {
  height: 74px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 20px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-main);
  place-items: center;
  background: var(--surface);
}

.topbar-titles small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--p-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

.topbar-titles h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 20px;
  transition: 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--oro-500);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* Botones Principales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13.5px;
  transition: var(--transition);
  white-space: nowrap;
}

.btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--p-600), var(--p-800));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--p-500), var(--p-700));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
}

.btn-gold {
  background: linear-gradient(135deg, var(--oro-500), var(--oro-600));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.28);
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--oro-400), var(--oro-500));
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Área Principal de Contenido */
.main-content {
  padding: 32px;
  flex: 1;
}

.view-section {
  display: none;
  max-width: 1540px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

/* ==============================================================================
   DASHBOARD / TABLERO (ULTRA EXPLÍCITO Y MODERNO)
   ============================================================================== */
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dash-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.dash-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
}

/* Banner de Alerta Operativa */
.alert-banner {
  background: linear-gradient(90deg, #064e3b, #0f766e);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.alert-banner::after {
  content: '';
  position: absolute;
  right: -50px;
  top: -50px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.alert-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.alert-pulse-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.25);
  color: var(--oro-400);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}

.alert-pulse-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--oro-400);
  opacity: 0.6;
  animation: ripple 2s infinite;
}

.alert-banner-text strong {
  font-size: 15px;
  font-weight: 800;
  display: block;
}

.alert-banner-text p {
  font-size: 12.5px;
  color: rgba(209, 250, 229, 0.85);
  margin-top: 2px;
}

/* Tarjetas KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 26px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(5, 150, 105, 0.3);
}

.kpi-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.kpi-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi-icon-wrap.green { background: var(--p-50); color: var(--p-700); }
.kpi-icon-wrap.purple { background: var(--purple-50); color: var(--purple-600); }
.kpi-icon-wrap.gold { background: var(--oro-50); color: var(--oro-600); }
.kpi-icon-wrap.blue { background: var(--info-50); color: var(--info-600); }

.kpi-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  margin-top: 10px;
  line-height: 1;
}

.kpi-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.trend-badge.up { background: var(--p-100); color: var(--p-800); }
.trend-badge.alert { background: var(--danger-100); color: var(--danger-600); }

/* Dashboard Grids */
.dash-columns-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  margin-bottom: 26px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.panel-header p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Gráfico de Barras SVG Interactivo */
.chart-container {
  padding-top: 10px;
}

.svg-bar-chart {
  width: 100%;
  height: 240px;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.green { background: var(--p-600); }
.legend-dot.gold { background: var(--oro-500); }

/* Panel Territorial y Mini Mapa */
.territory-dark-card {
  background: linear-gradient(145deg, var(--p-950), #083b30);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.territory-dark-card .panel-header h3 {
  color: #ffffff;
}

.territory-dark-card .panel-header p {
  color: rgba(209, 250, 229, 0.7);
}

.mini-map-wrap {
  height: 200px;
  background: #062f27;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-image: 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.mini-map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--p-950);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 3px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  cursor: pointer;
}

.mini-map-pin:hover {
  transform: translate(-50%, -50%) scale(1.18);
  z-index: 10;
}

.mini-map-pin.hot {
  background: var(--oro-400);
  color: var(--p-950);
}

.comuna-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: auto;
}

.comuna-stats-row strong {
  font-size: 14px;
  color: #fff;
  display: block;
}

.comuna-stats-row small {
  color: rgba(209, 250, 229, 0.7);
  font-size: 11.5px;
}

/* ==============================================================================
   FOTOS INTERACTIVAS Y COMPARADOR "ANTES VS DESPUÉS"
   ============================================================================== */
.media-interactive-section {
  margin-bottom: 26px;
}

.before-after-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.before-after-container {
  position: relative;
  width: 100%;
  height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  cursor: ew-resize;
  background: #0f172a;
}

.before-after-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.before-after-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}

.before-after-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.before-after-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #ffffff;
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.before-after-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--p-900);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  font-size: 16px;
  font-weight: 800;
}

.before-label, .after-label {
  position: absolute;
  bottom: 16px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.before-label {
  left: 16px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
}

.after-label {
  right: 16px;
  background: rgba(5, 150, 105, 0.85);
  color: #fff;
}

/* Tarjetas Fotográficas 3D Tilt */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.photo-card-3d {
  perspective: 1000px;
  border-radius: var(--radius-lg);
}

.photo-card-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.15s ease-out, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.photo-card-3d:hover .photo-card-inner {
  box-shadow: var(--shadow-lg);
  border-color: rgba(5, 150, 105, 0.3);
}

.photo-img-wrap {
  position: relative;
  height: 200px;
  background: #1e293b;
  overflow: hidden;
  cursor: pointer;
}

.photo-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.photo-card-3d:hover .photo-img-wrap img {
  transform: scale(1.06);
}

.photo-badge-zone {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.photo-inspect-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 78, 59, 0.4);
  opacity: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  gap: 8px;
  transition: opacity 0.2s ease;
}

.photo-img-wrap:hover .photo-inspect-overlay {
  opacity: 1;
}

.photo-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.photo-card-body h4 {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.photo-card-body p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.photo-card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==============================================================================
   TABLAS Y VISTAS DE MÓDULOS (CASOS, OPERATIVOS, PERMISOS, ETC.)
   ============================================================================== */
.toolbar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--text-main);
  outline: none;
  font-size: 13.5px;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--p-600);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--p-600);
}

/* Tabla Estilizada */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  min-width: 960px;
}

.custom-table th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.custom-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  color: var(--text-main);
  vertical-align: middle;
  transition: background 0.15s ease;
}

.custom-table tbody tr:hover td {
  background: rgba(236, 253, 245, 0.4);
}

.case-code-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--p-700);
  background: var(--p-50);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 4px;
}

.case-main-title {
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.case-sub-type {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Badges de Estado y Prioridad */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-status.pendiente { background: var(--oro-100); color: var(--oro-600); }
.badge-status.en-inspeccion { background: var(--purple-100); color: var(--purple-600); }
.badge-status.en-gestion { background: var(--info-100); color: var(--info-600); }
.badge-status.resuelto { background: var(--p-100); color: var(--p-700); }

.badge-priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-priority::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge-priority.alta::before { background: var(--danger-500); }
.badge-priority.media::before { background: var(--oro-500); }
.badge-priority.baja::before { background: var(--p-400); }

/* Acciones de Fila */
.table-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  background: var(--surface);
  transition: var(--transition);
}

.action-icon-btn:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.action-icon-btn.danger:hover {
  background: var(--danger-50);
  color: var(--danger-600);
  border-color: var(--danger-100);
}

/* ==============================================================================
   MAPA TERRITORIAL GIS DE NEIVA (INTERACTIVO)
   ============================================================================== */
.gis-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
}

.gis-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.gis-comuna-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  max-height: 520px;
  overflow-y: auto;
}

.comuna-item-btn {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.comuna-item-btn:hover, .comuna-item-btn.active {
  background: #ffffff;
  border-color: var(--p-600);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
  transform: translateX(4px);
}

.comuna-item-info strong {
  font-size: 13.5px;
  color: var(--text-main);
  display: block;
}

.comuna-item-info small {
  font-size: 11.5px;
  color: var(--text-muted);
}

.comuna-count-badge {
  background: var(--p-50);
  color: var(--p-700);
  font-weight: 800;
  font-size: 12px;
  padding: 3px 9px;
/* ==============================================================================
   GIS & GOOGLE MAPS CONTROLS, BARRA DE CAPAS Y VISUALIZADOR
   ============================================================================== */
.gis-controls-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.muni-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.muni-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.map-view-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
}

.map-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.map-switch-btn:hover {
  color: var(--text-main);
}

.map-switch-btn.active {
  background: var(--surface);
  color: var(--p-800);
  box-shadow: var(--shadow-xs);
}

/* Barra de Capas Temáticas */
.gis-layers-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

.layers-bar-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

.layer-pill-checkbox {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.layer-pill-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.layer-pill-body {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
  user-select: none;
}

.layer-pill-checkbox:hover .layer-pill-body {
  border-color: #cbd5e1;
  color: var(--text-main);
}

.layer-pill-checkbox input:checked + .layer-pill-body {
  background: var(--p-50);
  border-color: rgba(5, 150, 105, 0.4);
  color: var(--p-900);
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.12);
}

.layer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.map-type-selector-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Canvas y Contenedor de Google Maps */
.gis-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 20px;
  align-items: start;
}

.gis-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  max-height: 680px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.gis-comuna-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comuna-item-btn {
  width: 100%;
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.comuna-item-btn:hover, .comuna-item-btn.active {
  background: var(--p-50);
  border-color: var(--p-600);
  transform: translateX(3px);
}

.comuna-item-info strong {
  font-size: 13px;
  color: var(--text-main);
  display: block;
}

.comuna-item-info small {
  font-size: 11px;
  color: var(--text-muted);
}

.comuna-count-badge {
  background: var(--p-50);
  color: var(--p-700);
  font-weight: 800;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.comuna-count-badge.critica {
  background: var(--danger-50);
  color: var(--danger-600);
  border-color: rgba(239, 68, 68, 0.2);
}

.gis-map-canvas-card {
  background: #e2e8f0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 680px;
  min-height: 680px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.google-map-element {
  width: 100%;
  height: 100%;
  min-height: 680px;
}

.gis-svg-container {
  width: 100%;
  height: 100%;
  min-height: 680px;
  background: #d5e6df;
  background-image: 
    linear-gradient(rgba(6, 78, 59, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 78, 59, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.gis-comuna-polygon {
  fill: rgba(255, 255, 255, 0.65);
  stroke: #059669;
  stroke-width: 1.5;
  transition: all 0.3s ease;
  cursor: pointer;
}

.gis-comuna-polygon:hover {
  fill: rgba(16, 185, 129, 0.35);
  stroke: #047857;
  stroke-width: 2.5;
}

.gis-comuna-polygon.active {
  fill: rgba(245, 158, 11, 0.4);
  stroke: var(--oro-600);
  stroke-width: 3;
}

.river-magdalena {
  fill: none;
  stroke: #60a5fa;
  stroke-width: 24;
  stroke-linecap: round;
  opacity: 0.65;
}

.river-ceibas {
  fill: none;
  stroke: #93c5fd;
  stroke-width: 10;
  stroke-linecap: round;
  opacity: 0.7;
}

.gis-floating-info {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  max-width: 290px;
  z-index: 10;
}

.gis-floating-legend {
  position: absolute;
  bottom: 18px;
  left: 18px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  font-weight: 700;
  z-index: 10;
  flex-wrap: wrap;
}

/* Banner de Aviso de Google Maps */
.gmaps-notice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.gmaps-notice-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

/* Estilos de InfoWindows de Google Maps */
.gmaps-infowindow {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #0f172a;
  max-width: 280px;
  padding: 4px;
}

.gmaps-infowindow h4 {
  font-size: 14px;
  font-weight: 800;
  color: #064e3b;
  margin: 0 0 4px;
  line-height: 1.3;
}

.gmaps-infowindow p {
  font-size: 12px;
  color: #475569;
  margin: 4px 0 8px;
  line-height: 1.4;
}

.gmaps-infowindow .iw-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.gmaps-infowindow .iw-btn {
  display: inline-block;
  background: #065f46;
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  margin-top: 4px;
}

.gmaps-infowindow .iw-btn:hover {
  background: #047857;
}

/* ==============================================================================
   MÓDULOS DE GESTIÓN: OPERATIVOS, INSPECCIONES, PERMISOS, ACTORES
   ============================================================================== */
.module-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.module-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.module-card-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(5, 150, 105, 0.3);
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-header-flex strong {
  font-size: 16px;
  color: var(--text-main);
  font-weight: 800;
}

.card-detail-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.card-detail-list span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-detail-list svg {
  width: 15px;
  height: 15px;
  color: var(--p-700);
  flex-shrink: 0;
}

/* ==============================================================================
   CENTRO DE GESTIÓN Y ADMINISTRACIÓN DE BASE DE DATOS
   ============================================================================== */
.db-status-banner {
  background: linear-gradient(135deg, #064e3b, #047857);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.db-status-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.db-status-pulse {
  width: 14px;
  height: 14px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.35);
  animation: pulse 2s infinite;
}

.db-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}

.db-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  cursor: pointer;
}

.db-table-card:hover, .db-table-card.active {
  border-color: var(--p-600);
  background: var(--p-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.db-table-card strong {
  font-size: 13px;
  color: var(--text-main);
  display: block;
}

.db-table-card small {
  font-size: 11px;
  color: var(--text-muted);
}

.db-badge-count {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--p-800);
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.db-schema-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-family: monospace;
  color: var(--p-900);
}

/* ==============================================================================
   DIÁLOGOS Y MODALES
   ============================================================================== */
dialog {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 680px;
  width: calc(100% - 32px);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  background: var(--surface);
  color: var(--text-main);
  margin: auto;
}

dialog::backdrop {
  background: rgba(4, 47, 36, 0.65);
  backdrop-filter: blur(4px);
}

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

.modal-header h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.close-modal-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 20px;
  transition: var(--transition);
}

.close-modal-btn:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 24px 28px;
  max-height: 75vh;
  overflow-y: auto;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  font-size: 13.5px;
  transition: var(--transition);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--p-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Modal Lightbox de Imágenes */
.lightbox-modal {
  max-width: 900px;
  background: #0b1320;
  color: #fff;
}

.lightbox-content {
  position: relative;
  height: 520px;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.lightbox-meta {
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Toast */
.toast-popup {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--p-950);
  color: #ffffff;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 700;
  z-index: 100;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-popup.show {
  transform: translateY(0);
  opacity: 1;
}

/* Overlay móvil */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 45;
  backdrop-filter: blur(2px);
}

/* ==============================================================================
   ANIMACIONES
   ============================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes loginCardPop {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes ripple {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ==============================================================================
   FORMATO IMPRIMIBLE OFICIAL (ACTAS E INFORMES)
   ============================================================================== */
@media print {
  .sidebar, .topbar, .admin-toolbar, .toolbar-card, .btn, .table-actions-cell, .action-icon-btn, .chart-container, .mini-map-wrap {
    display: none !important;
  }
  .workspace { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .panel { border: 1px solid #000 !important; box-shadow: none !important; }
}

/* ==============================================================================
   RESPONSIVIDAD (MÓVIL, TABLET Y PANTALLAS GRANDES)
   ============================================================================== */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-columns-2 { grid-template-columns: 1fr; }
  .gis-layout { grid-template-columns: 1fr; }
  .photo-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .module-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .workspace {
    margin-left: 0;
  }
  .menu-toggle-btn {
    display: grid;
  }
  .mobile-overlay.show {
    display: block;
  }
  .topbar {
    padding: 0 18px;
  }
  .main-content {
    padding: 20px 16px;
  }
  .photo-gallery-grid {
    grid-template-columns: 1fr;
  }
  .module-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-titles small { display: none; }
  .topbar-titles h1 { font-size: 17px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .before-after-container { height: 260px; }
  .admin-toolbar { flex-direction: column; gap: 8px; }
  .demo-chips-grid { grid-template-columns: 1fr; }
}
