        :root {
            --bg-dark: #0f172a;
            --surface-glass: rgba(15, 23, 42, 0.92);
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --border-light: rgba(255, 255, 255, 0.12);
            --area-centro: #0284c7;
            --area-este: #9333ea;
            --area-oeste: #059669;
            --area-sur: #d97706;
            --primary: #38bdf8;
        }

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

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background-color: var(--bg-dark);
            color: var(--text-main);
            height: 100vh;
            width: 100vw;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .map-workspace {
            position: relative;
            flex: 1;
            width: 100%;
            height: calc(100vh - 70px);
            overflow: hidden;
        }

        #map {
            width: 100%;
            height: 100%;
            background-color: #e2e8f0;
            z-index: 1;
        }

        /* Animación de Parpadeo Luminoso para Efectores y Polígonos */
        @keyframes markerPulseBlink {
            0%, 100% {
                transform: scale(1);
                filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
                opacity: 1;
            }
            50% {
                transform: scale(1.6);
                filter: drop-shadow(0 0 18px #ffffff) drop-shadow(0 0 30px #f97316);
                opacity: 1;
            }
        }

        .marker-blinking {
            animation: markerPulseBlink 0.45s ease-in-out 6 !important;
            z-index: 999999 !important;
        }

        /* Animación Permanente de Alerta (Creciente de Río) */
        @keyframes pulseDangerRed {
            0% {
                transform: scale(1);
                box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
            }
            70% {
                transform: scale(1.1);
                box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
            }
            100% {
                transform: scale(1);
                box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
            }
        }

        .hidro-pulse-danger > div {
            animation: pulseDangerRed 1.5s infinite !important;
        }

        /* Panel Lateral (Sidebar) */
        .sidebar {
            position: absolute;
            top: 20px;
            left: 20px;
            bottom: 20px;
            width: 410px;
            max-width: calc(100vw - 40px);
            background: var(--surface-glass);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid var(--border-light);
            border-radius: 20px;
            box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
            z-index: 1000;
            display: flex;
            flex-direction: column;
            transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
            overflow-y: auto;
            overflow-x: hidden;
        }

        .sidebar.collapsed {
            transform: translateX(-440px);
        }

        .sidebar-toggle-btn {
            position: absolute;
            left: calc(100% + 12px);
            top: 20px;
            width: 44px;
            height: 44px;
            background: var(--surface-glass);
            backdrop-filter: blur(10px);
            border: 1px solid var(--border-light);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--primary);
            font-size: 1.2rem;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
            transition: all 0.2s ease;
        }

        .sidebar-toggle-btn:hover {
            background: var(--primary);
            color: #ffffff;
            transform: scale(1.05);
        }

        .sidebar-header {
            padding: 22px 24px 16px 24px;
            border-bottom: 1px solid var(--border-light);
            background: linear-gradient(180deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
            flex-shrink: 0;
        }

        .badge-pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(56, 189, 248, 0.18);
            border: 1px solid rgba(56, 189, 248, 0.35);
            color: #7dd3fc;
            padding: 4px 10px;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 8px;
        }

        .badge-pill::before {
            content: '';
            width: 6px;
            height: 6px;
            background: #38bdf8;
            border-radius: 50%;
            box-shadow: 0 0 8px #38bdf8;
        }

        .sidebar-header h1 {
            font-size: 1.35rem;
            font-weight: 800;
            color: #ffffff;
            line-height: 1.2;
            letter-spacing: -0.02em;
        }

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

        .modules-matrix {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
            gap: 10px;
        }

        .module-btn {
            background-color: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px 5px;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            color: var(--text-primary);
        }

        .module-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
            border-color: rgba(255, 255, 255, 0.3);
        }

        .module-btn.active {
            background-color: rgba(56, 189, 248, 0.15);
            border-color: #38bdf8;
            box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.3);
            transform: scale(0.95);
            color: #38bdf8;
        }

        .module-btn .icon {
            font-size: 1.5rem;
            line-height: 1;
        }

        .module-btn .label {
            font-size: 0.75rem;
            font-weight: 600;
            text-align: center;
            word-break: break-word;
            line-height: 1.1;
        }

        /* Leyenda ThermoScan Flotante */
        .thermo-legend {
            position: absolute;
            bottom: 30px;
            right: 20px;
            z-index: 1000;
            background-color: var(--surface-glass);
            padding: 12px 15px;
            border-radius: 12px;
            box-shadow: var(--shadow);
            border: 1px solid var(--border-light);
            pointer-events: none;
            backdrop-filter: blur(8px);
        }

        /* Selector de Áreas Programáticas */
        .areas-tabs {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            padding: 12px 18px 6px 18px;
            flex-shrink: 0;
        }

        .area-tab-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-light);
            border-radius: 10px;
            padding: 8px 4px;
            color: #cbd5e1;
            font-size: 0.75rem;
            font-weight: 700;
            cursor: pointer;
            text-align: center;
            transition: all 0.2s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }

        .area-tab-btn .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }

        .area-tab-btn[data-area="todas"] .dot { background: #94a3b8; }
        .area-tab-btn[data-area="centro"] .dot { background: var(--area-centro); box-shadow: 0 0 6px var(--area-centro); }
        .area-tab-btn[data-area="este"] .dot { background: var(--area-este); box-shadow: 0 0 6px var(--area-este); }
        .area-tab-btn[data-area="oeste"] .dot { background: var(--area-oeste); box-shadow: 0 0 6px var(--area-oeste); }
        .area-tab-btn[data-area="sur"] .dot { background: var(--area-sur); box-shadow: 0 0 6px var(--area-sur); }

        .area-tab-btn:hover {
            background: rgba(255, 255, 255, 0.12);
            color: #ffffff;
        }

        .area-tab-btn.active {
            background: rgba(255, 255, 255, 0.18);
            border-color: #ffffff;
            color: #ffffff;
            box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
        }

        /* Filtro de Categorías de Establecimientos */
        .category-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            padding: 6px 14px;
            flex-shrink: 0;
        }

        .category-filters::-webkit-scrollbar {
            display: none;
        }

        .cat-chip {
            padding: 4px 8px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-light);
            font-size: 0.73rem;
            font-weight: 600;
            color: #cbd5e1;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
        }

        .cat-chip span {
            background: rgba(255, 255, 255, 0.2);
            padding: 1px 5px;
            border-radius: 8px;
            margin-left: 4px;
            font-size: 0.85em;
        }

        .cat-chip:hover, .cat-chip.active {
            background: #0284c7;
            border-color: #38bdf8;
            color: #ffffff;
        }

        #btnCardio.active {
            background: #e11d48;
            border-color: #fb7185;
            color: #ffffff;
            box-shadow: 0 0 10px rgba(225, 29, 72, 0.4);
        }

        /* Buscador */
        .search-box {
            padding: 8px 18px;
        }

        .search-input-wrapper {
            position: relative;
            display: flex;
            align-items: center;
        }

        .search-input-wrapper svg {
            position: absolute;
            left: 12px;
            width: 16px;
            height: 16px;
            fill: none;
            stroke: var(--text-muted);
            stroke-width: 2;
        }

        .search-input {
            width: 100%;
            padding: 10px 12px 10px 38px;
            background: rgba(15, 23, 42, 0.65);
            border: 1px solid var(--border-light);
            border-radius: 10px;
            color: var(--text-main);
            font-size: 0.85rem;
            font-family: inherit;
            outline: none;
            transition: all 0.2s ease;
        }

        .search-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
        }

        /* Contador de resultados */
        .results-count {
            padding: 4px 18px 8px 18px;
            font-size: 0.75rem;
            color: var(--text-muted);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        /* Lista de Efectores */
        .efectores-list {
            flex: 1;
            overflow-y: auto;
            padding: 4px 14px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .efectores-list::-webkit-scrollbar {
            width: 5px;
        }
        .efectores-list::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.18);
            border-radius: 4px;
        }

        .efector-card {
            padding: 10px 14px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.06);
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .efector-card:hover {
            background: rgba(56, 189, 248, 0.12);
            border-color: rgba(56, 189, 248, 0.4);
            transform: translateX(4px);
        }

        .efector-card.active {
            background: rgba(56, 189, 248, 0.22);
            border-color: #38bdf8;
            box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
        }

        .efector-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 8px;
        }

        .efector-name {
            font-size: 0.88rem;
            font-weight: 700;
            color: #ffffff;
            line-height: 1.25;
        }

        .efector-badge {
            font-size: 0.68rem;
            font-weight: 700;
            padding: 2px 6px;
            border-radius: 6px;
            color: #ffffff;
            white-space: nowrap;
        }

        .efector-card-details {
            font-size: 0.75rem;
            color: var(--text-muted);
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        /* Footer de la Sidebar y enlaces PDF oficiales */
        .sidebar-footer {
            padding: 14px 18px;
            border-top: 1px solid var(--border-light);
            background: rgba(15, 23, 42, 0.5);
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .pdf-links-title {
            font-size: 0.75rem;
            font-weight: 700;
            color: #94a3b8;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .pdf-report-btn {
            background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
            border: 1px solid rgba(56, 189, 248, 0.4);
            border-radius: 10px;
            padding: 9px 12px;
            color: #ffffff;
            text-decoration: none;
            font-size: 0.82rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
            transition: all 0.2s ease;
            margin-bottom: 4px;
        }

        .pdf-report-btn:hover {
            background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
            transform: translateY(-1px);
            box-shadow: 0 6px 16px rgba(2, 132, 199, 0.5);
            color: #ffffff;
        }

        .pdf-links-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
        }

        .pdf-link-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            padding: 6px 8px;
            color: #e2e8f0;
            text-decoration: none;
            font-size: 0.75rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            transition: all 0.2s ease;
        }

        .pdf-link-btn:hover {
            background: rgba(56, 189, 248, 0.2);
            border-color: #38bdf8;
            color: #ffffff;
        }

        /* Controles Superiores Flotantes */
        .top-controls {
            position: absolute;
            top: 20px;
            right: 20px;
            z-index: 1000;
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .control-pill {
            background: var(--surface-glass);
            backdrop-filter: blur(12px);
            border: 1px solid var(--border-light);
            border-radius: 14px;
            padding: 8px 14px;
            display: flex;
            align-items: center;
            gap: 14px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
            font-size: 0.82rem;
            font-weight: 600;
        }

        .control-pill label {
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            color: #e2e8f0;
            user-select: none;
        }

        .control-pill input[type="checkbox"] {
            accent-color: var(--primary);
            width: 16px;
            height: 16px;
            cursor: pointer;
        }

        .btn-reset {
            background: var(--surface-glass);
            backdrop-filter: blur(12px);
            border: 1px solid var(--border-light);
            border-radius: 14px;
            padding: 8px 14px;
            color: #e2e8f0;
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .btn-reset:hover {
            background: var(--primary);
            color: #ffffff;
        }

        /* Ficha Informativa Flotante */
        .info-card-floating {
            position: absolute;
            top: 74px;
            bottom: 20px;
            right: 20px;
            left: auto;
            z-index: 1002;
            width: 390px;
            max-width: calc(100vw - 40px);
            max-height: calc(100vh - 94px);
            background: var(--surface-glass);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(56, 189, 248, 0.4);
            border-radius: 16px;
            padding: 16px 18px;
            box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75);
            display: none;
            overflow-y: auto;
            animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .search-box-top {
            display: flex;
            align-items: center;
            background: var(--surface-glass);
            backdrop-filter: blur(12px);
            border: 1px solid var(--border-light);
            border-radius: 14px;
            padding: 0 12px;
            height: 38px;
            width: 250px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
            transition: all 0.2s ease;
        }
        .search-box-top:focus-within {
            border-color: #38bdf8;
            box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(12px); }
            to { opacity: 1; transform: translateY(0); }
        }

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

        .info-card-title {
            font-size: 1.1rem;
            font-weight: 800;
            color: #ffffff;
            line-height: 1.25;
        }

        .info-card-close {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 1.3rem;
            line-height: 1;
        }

        .info-card-close:hover {
            color: #ffffff;
        }

        .info-field {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.07);
            font-size: 0.82rem;
            gap: 12px;
        }

        .info-field:last-child {
            border-bottom: none;
        }

        .info-label {
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .info-val {
            font-weight: 600;
            color: #fdba74;
            text-align: right;
            word-break: break-word;
        }
        
        .pronostico-day-row:hover {
            background: rgba(56, 189, 248, 0.15) !important;
            border-color: rgba(56, 189, 248, 0.4) !important;
            transform: translateX(4px);
        }

        /* Estilos de Iconos de Marcadores */
        .custom-efector-pin {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: 2px solid #ffffff;
            box-shadow: 0 2px 6px rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            font-size: 10px;
            font-weight: 800;
            transition: all 0.2s ease;
        }

        /* Custom Popup Leaflet */
        .leaflet-popup-content-wrapper {
            background: var(--surface-glass) !important;
            backdrop-filter: blur(12px);
            color: #ffffff !important;
            border: 1px solid rgba(56, 189, 248, 0.5) !important;
            border-radius: 14px !important;
            box-shadow: 0 15px 30px rgba(0,0,0,0.5) !important;
        }

        .leaflet-popup-tip {
            background: var(--surface-glass) !important;
        }

        .popup-title {
            font-size: 1rem;
            font-weight: 800;
            color: #38bdf8;
            margin-bottom: 4px;
        }

        .popup-row {
            font-size: 0.8rem;
            color: #cbd5e1;
            margin-top: 3px;
        }

        /* Cluster Badges */
        .marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
            background-color: rgba(56, 189, 248, 0.4) !important;
        }
        .marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
            background-color: #0284c7 !important;
            color: #ffffff !important;
            font-family: 'Inter', sans-serif !important;
            font-weight: 700 !important;
        }

        /* Zoom Control */
        .leaflet-top.leaflet-left {
            left: 440px !important;
            right: unset !important;
            top: unset !important;
            bottom: 25px !important;
            z-index: 999 !important;
            transition: left 0.35s ease;
        }

        /* Leyendas Informativas (Ubicadas abajo a la izquierda para no tapar paneles de la derecha) */
        .thermo-legend {
            position: absolute;
            bottom: 25px;
            left: 440px;
            right: auto;
            z-index: 998;
            background: var(--surface-glass);
            backdrop-filter: blur(12px);
            border: 1px solid var(--border-light);
            border-radius: 12px;
            padding: 10px 14px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            transition: left 0.35s ease;
        }

        .leaflet-bar {
            border: 1px solid var(--border-light) !important;
            border-radius: 12px !important;
            overflow: hidden;
            box-shadow: 0 8px 20px rgba(0,0,0,0.4) !important;
        }

        .leaflet-bar a {
            background-color: var(--surface-glass) !important;
            color: #ffffff !important;
            border-bottom: 1px solid var(--border-light) !important;
        }

        .leaflet-bar a:hover {
            background-color: var(--primary) !important;
            color: #ffffff !important;
        }

        @media (max-width: 640px) {
            .sidebar {
                width: calc(100vw - 40px);
            }
            .info-card-floating {
                left: 20px;
                right: 20px;
                width: auto;
                bottom: 20px;
            }
        }
        
/* === Pines GeoVisor v1 (AgroClima) === */
.pin-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transform: translate(-50%, -100%);
  transition: transform 0.2s ease;
}
.pin-container:hover {
  transform: translate(-50%, -110%) scale(1.15);
  z-index: 1000 !important;
}

.pin-badge {
  background: #ffffff;
  border: 2px solid #94a3b8;
  border-radius: 16px;
  padding: 2px 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.7rem;
  color: #0f172a;
}
.pin-dot { width: 6px; height: 6px; border-radius: 50%; }

.pin-container.eeaoc .pin-badge { border-color: #f59e0b; }
.pin-container.eeaoc .pin-dot { background: #f59e0b; }
.pin-container.inta .pin-badge { border-color: #2563eb; }
.pin-container.inta .pin-dot { background: #2563eb; }
.pin-container.smn .pin-badge { border-color: #d97706; }
.pin-container.smn .pin-dot { background: #d97706; }

.pin-needle {
  width: 2px;
  height: 8px;
  background: #64748b;
}

/* Pines de Hidrometría INA */
.pin-container.hidro .pin-badge {
  border-color: #0284c7;
  color: #0369a1;
  position: relative;
}
.pin-container.hidro .pin-dot { background: #0284c7; }

/* Variantes de alerta hidrológica */
.pin-container.hidro.alert-crecida .pin-badge {
  border-color: #ef4444;
  color: #b91c1c;
  background: #fef2f2;
}
.pin-container.hidro.alert-crecida .pin-dot { background: #ef4444; }

.pin-container.hidro.alert-alza .pin-badge {
  border-color: #f59e0b;
  color: #b45309;
  background: #fffbeb;
}
.pin-container.hidro.alert-alza .pin-dot { background: #f59e0b; }

.pin-container.hidro.alert-bajante .pin-badge {
  border-color: #06b6d4;
  color: #0e7490;
  background: #ecfeff;
}
.pin-container.hidro.alert-bajante .pin-dot { background: #06b6d4; }

.pin-container.hidro.alert-normal .pin-badge {
  border-color: #10b981;
  color: #065f46;
  background: #f0fdf4;
}
.pin-container.hidro.alert-normal .pin-dot { background: #10b981; }

.pin-pulse-alert {
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 18px;
  border: 2px solid #ef4444;
  animation: hydro-pulse 1.8s ease-out infinite;
  pointer-events: none;
}

/* Pines de Cardio */
.pin-container.cardio.operativo .pin-badge {
  border-color: #059669;
  color: #ffffff;
  background: #10b981;
}
.pin-container.cardio.operativo .pin-dot { background: #ffffff; }

.pin-container.cardio.no-operativo .pin-badge {
  border-color: #b91c1c;
  color: #ffffff;
  background: #ef4444;
}
.pin-container.cardio.no-operativo .pin-dot { background: #ffffff; }

.custom-inundaciones-pin, .custom-defensa-pin, .custom-police-pin, .custom-bomberos-pin {
  background: none !important;
  border: none !important;
}

@keyframes hydro-pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}
    
/* Fix Routing Box Colors for Dark Theme */
.leaflet-routing-container {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
}
.leaflet-routing-container h2,
.leaflet-routing-container h3 {
    color: #38bdf8 !important;
}
.leaflet-routing-alt,
.leaflet-routing-alt table {
    background: transparent !important;
    color: #cbd5e1 !important;
}
.leaflet-routing-alt tr:hover {
    background-color: #334155 !important;
}
.leaflet-routing-container {
    top: 90px !important; right: 20px !important; position: fixed !important; z-index: 9999 !important; margin: 0 !important;
    margin-right: 20px !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto;
}

/* Animación parpadeante para botón de alerta activa en barra lateral */
@keyframes alertPillPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
        border-color: rgba(245, 158, 11, 0.6);
    }
    50% {
        box-shadow: 0 0 16px 4px rgba(245, 158, 11, 0.85);
        border-color: #f59e0b;
        background: rgba(245, 158, 11, 0.18);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
        border-color: rgba(245, 158, 11, 0.6);
    }
}

@keyframes alertPillPulseRed {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
        border-color: rgba(239, 68, 68, 0.6);
    }
    50% {
        box-shadow: 0 0 18px 5px rgba(239, 68, 68, 0.9);
        border-color: #ef4444;
        background: rgba(239, 68, 68, 0.22);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        border-color: rgba(239, 68, 68, 0.6);
    }
}

.alert-btn-pulsing {
    animation: alertPillPulse 1.8s infinite ease-in-out !important;
}

.alert-btn-pulsing-red {
    animation: alertPillPulseRed 1.4s infinite ease-in-out !important;
}

.alert-bar-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

@media (max-width: 850px) {
    #panelAlertasDetalle {
        left: 20px !important;
        right: 20px !important;
        width: auto !important;
        max-width: none !important;
        bottom: 80px !important;
    }
}

/* ===============================================================
   MÓDULO: POLICÍA DE TUCUMÁN (145 DEPENDENCIAS) & BOMBEROS
   =============================================================== */
.pin-container.police, .pin-container.bomberos {
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pin-container.police:hover, .pin-container.bomberos:hover {
    transform: translateY(-4px) scale(1.12);
    z-index: 1000 !important;
}

.police-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1e293b;
    border: 2px solid #38bdf8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.police-marker-icon:hover {
    transform: scale(1.18);
    z-index: 1000 !important;
}
.police-marker-icon.URC { border-color: #06b6d4; box-shadow: 0 0 10px rgba(6, 182, 212, 0.7); }
.police-marker-icon.URN { border-color: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.7); }
.police-marker-icon.URE { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.7); }
.police-marker-icon.URO { border-color: #8b5cf6; box-shadow: 0 0 10px rgba(139, 92, 246, 0.7); }
.police-marker-icon.URS { border-color: #f43f5e; box-shadow: 0 0 10px rgba(244, 63, 94, 0.7); }

/* Clusters para Policía */
.marker-cluster-police {
    background-clip: padding-box;
    border-radius: 50%;
    background-color: rgba(30, 58, 138, 0.45);
}
.marker-cluster-police div {
    width: 36px;
    height: 36px;
    margin-left: 4px;
    margin-top: 4px;
    text-align: center;
    border-radius: 50%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #60a5fa;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.6);
}

/* Custom Popup Card Policía */
.leaflet-popup.police-custom-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 18px !important;
    padding: 0 !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.85) !important;
    overflow: hidden;
}
.leaflet-popup.police-custom-popup .leaflet-popup-content {
    margin: 16px 18px 18px 18px !important;
    line-height: 1.4;
    min-width: 320px;
    max-width: 380px;
}
.leaflet-popup.police-custom-popup .leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.96) !important;
}
.leaflet-popup.police-custom-popup a.leaflet-popup-close-button {
    color: #94a3b8 !important;
    padding: 8px 10px 0 0 !important;
    font-size: 1.3rem !important;
}
.leaflet-popup.police-custom-popup a.leaflet-popup-close-button:hover {
    color: #ffffff !important;
}

.police-popup-card {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #e2e8f0;
}
.police-popup-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}
.police-ur-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.police-ur-badge.URC { border: 1.5px solid #06b6d4; color: #06b6d4; background: rgba(6, 182, 212, 0.15); }
.police-ur-badge.URN { border: 1.5px solid #10b981; color: #10b981; background: rgba(16, 185, 129, 0.15); }
.police-ur-badge.URE { border: 1.5px solid #f59e0b; color: #f59e0b; background: rgba(245, 158, 11, 0.15); }
.police-ur-badge.URO { border: 1.5px solid #8b5cf6; color: #8b5cf6; background: rgba(139, 92, 246, 0.15); }
.police-ur-badge.URS { border: 1.5px solid #f43f5e; color: #f43f5e; background: rgba(244, 63, 94, 0.15); }

.police-tipo-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #cbd5e1;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.police-popup-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
    margin-bottom: 12px;
    letter-spacing: -0.2px;
}

.police-popup-fields {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.8rem;
}
.police-popup-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.police-field-label {
    color: #94a3b8;
    font-weight: 600;
    min-width: 95px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.police-field-val {
    color: #f1f5f9;
    font-weight: 600;
    word-break: break-word;
}
.police-coords-link {
    color: #38bdf8;
    text-decoration: none;
    font-family: monospace;
    font-weight: 600;
}
.police-coords-link:hover {
    text-decoration: underline;
}

.police-cobertura-box {
    background: rgba(14, 116, 144, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 10px;
    padding: 9px 12px;
    margin-top: 10px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.police-cobertura-label {
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.police-cobertura-val {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.76rem;
    line-height: 1.35;
}

.police-popup-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 8px;
}
.police-action-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}
.police-action-btn.btn-maps {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}
.police-action-btn.btn-maps:hover {
    background: #38bdf8;
    color: #0b1120;
}
.police-action-btn.btn-call {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.police-action-btn.btn-call:hover {
    background: #10b981;
    color: #ffffff;
}

/* ===============================================================
   MÓDULO: LUGAR / ANÁLISIS DE ÁREA (RADIO 1 KM)
   =============================================================== */
.lugar-bar-btn {
    transition: all 0.25s ease;
}
.lugar-bar-btn:hover {
    background: rgba(6, 182, 212, 0.2) !important;
    border-color: #06b6d4 !important;
    transform: translateY(-1px);
}
.lugar-bar-btn.active {
    background: rgba(6, 182, 212, 0.26) !important;
    border-color: #22d3ee !important;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.5) !important;
}

/* Marcador Central del Punto de Análisis */
.lugar-center-pin-container {
    background: none !important;
    border: none !important;
}
.lugar-center-marker {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}
.lugar-center-marker:active {
    cursor: grabbing;
}
.lugar-center-badge {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #0891b2, #0284c7);
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    z-index: 2;
    transition: transform 0.2s ease;
}
.lugar-center-marker:hover .lugar-center-badge {
    transform: scale(1.15);
}
.lugar-center-pulse {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.45);
    animation: lugar-pulse 2s infinite ease-out;
    z-index: 1;
}

@keyframes lugar-pulse {
    0% { transform: scale(0.8); opacity: 0.95; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* Panel Desplegable de Lugar */
#panelLugarDetalle {
    display: none;
    top: 74px;
    bottom: 20px;
    right: 20px;
    left: auto;
    width: 390px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 94px);
    overflow-y: auto;
    z-index: 1002;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(6, 182, 212, 0.45);
}

.lugar-stat-pill {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}
.lugar-stat-pill.active-stat {
    border-color: #06b6d4;
    color: #38bdf8;
    background: rgba(6, 182, 212, 0.15);
}

.lugar-result-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.lugar-result-item:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.45);
    transform: translateX(3px);
}
.lugar-result-item .item-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}
.lugar-result-item .item-sub {
    font-size: 0.69rem;
    color: #94a3b8;
    margin-top: 2px;
}
.lugar-result-item .item-dist {
    font-size: 0.72rem;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(6, 182, 212, 0.18);
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.lugar-radius-btn {
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.lugar-radius-btn:hover {
    background: rgba(6, 182, 212, 0.18);
    color: #38bdf8;
}
.lugar-radius-btn.active {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.3);
    color: #38bdf8;
    font-weight: 800;
}

@media (max-width: 850px) {
    #panelLugarDetalle {
        left: 20px !important;
        right: 20px !important;
        width: auto !important;
        max-width: none !important;
    }
}
