body {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    line-height: 1.3;
}


#calculated-area {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.8);
  padding: 0px 5px;
  border-radius: 12px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  text-align: center;
  display: none; /* oculto por defecto */
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 999;
}




#map {
    position: absolute;
    width: 100%;
    height: 100vh;
}

/* Contenedor de botones */
.bottom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 999;
}

/* === Menú flotante de mapas base === */
.menu-map-base {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  padding: 8px 0;
  display: none;
  z-index: 1000;
}

.menu-map-base.show {
  display: block;
}

.menu-map-base ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-map-base li {
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: #333;
}

.menu-map-base li:hover {
  background: #f0f0f0;
}

.btn-base {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white !important;
    cursor: pointer;
    font-family: sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.btn-base:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: white !important;
}

.btn-base * {
    color: white !important;
}

.btn-icon {
    font-size: 18px;
    margin-right: 6px;
    color: white !important;
}

/* Botón central circular */
.btn-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
}

/* Botones laterales (alargados) */
.btn-rounded {
    border-radius: 25px;
}

.windy-panel {
    position: absolute;
    top: 70px;
    left: 20px;
    width: min(48vw, calc(100vw - 40px));
    min-width: 720px;
    height: min(760px, calc(100vh - 120px));
    background: rgba(18, 30, 44, 0.82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 1800;
    opacity: 0;
    transform: translateX(-12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.windy-panel.open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.windy-panel__header {
    height: 48px;
    padding: 0 12px 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.windy-panel__header h3 {
    margin: 0;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
}

.windy-panel__close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

.windy-panel__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.windy-panel__body {
    flex: 1;
    min-height: 240px;
    position: relative;
}

.windy-panel__body iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 900px) {
    .windy-panel {
        top: 12px;
        left: 12px;
        min-width: 0;
        width: calc(100vw - 24px);
        height: min(78vh, calc(100vh - 110px));
    }
}

.layer-controls {
    position: absolute;
    top: 50%;
    left: 20px;
    width: 240px;
    max-height: var(--panel-max-h, 60vh);
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    padding-top: 32px;
    padding-right: 12px;
    font-family: 'Poppins', sans-serif;
    z-index: 1000;
    color: white !important;

    /* Animación de entrada */
    opacity: 0;
    transform: translate(-20px, -50%);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.layer-controls {
  scrollbar-width: thin;
  scrollbar-color: rgba(227, 239, 38, 0.78) rgba(255, 255, 255, 0.16);
}

.layer-controls::-webkit-scrollbar {
  width: 10px;
}

.layer-controls::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.layer-controls::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(227, 239, 38, 0.9), rgba(142, 188, 30, 0.95));
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
}

.layer-controls::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(235, 246, 56, 0.96), rgba(120, 173, 25, 1));
}

/* Asegurar que todo el texto dentro del panel sea blanco */
.layer-controls * {
    color: white !important;
}

.layer-controls.show {
    opacity: 1;
    transform: translate(0, -50%);
    pointer-events: all;
}

/* Variante para alinear arriba (por si en móviles se prefiere) */
.layer-controls.align-top {
    top: 20px;
    transform: translateX(-20px);
}

.layer-controls.align-top.show {
    transform: translateX(0);
}

/* Título */
.layer-controls h3 {
    margin: 6px 0 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 4px;
}

.layer-controls h3:not(:first-child) {
    margin-top: 8px;
}

/* ===== Acordeón de grupos (panel de capas) ===== */
.layer-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 0;
}

.group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: transparent;
    border: 0;
    padding: 6px 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: white !important;
    text-align: left;
}

.group-header:focus {
    outline: 2px solid #7aa7ff;
    outline-offset: 2px;
    border-radius: 6px;
}

.group-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.group-arrow {
    display: inline-block;
    width: 12px;
    height: 12px;
}

.group-arrow svg {
    display: block;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    /* cerrado: flecha a la derecha */
    transition: transform .2s ease;
    stroke: white;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.layer-group.open .group-arrow svg {
    transform: rotate(0deg);
    /* abierto: flecha hacia abajo */
}

.group-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}

.layer-group.open .group-body {
    /* La altura se ajusta por JS con scrollHeight; este estado permite transición fluida */
}

.layer-group:last-child {
    border-bottom: none;
}

/* Lista de capas */
.layer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.layer-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    gap: 6px;
}

.layer-list li:last-child {
    border-bottom: none;
}

/* Estilo del nombre de la capa */
.layer-name {
    color: white !important;
    font-size: 0.8rem;
    line-height: 1.1;
}

/* Switch moderno */

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

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

.layer-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 18px;
}

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

.layer-switch input:checked+.layer-slider {
    background-color: #333333;
}

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

/* Spinner para switches de capas (bloquea interacción durante la primera carga) */
.layer-switch.loading {
    position: relative;
    pointer-events: none;
    /* bloquea el click mientras carga */
    opacity: 0.6;
}

.layer-switch.loading .layer-slider {
    filter: grayscale(0.4);
}

.layer-switch .spinner {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.layer-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: white !important;
    transition: color 0.2s ease;
}

.layer-close-btn:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Acceder a las herramientas */
.go-management {
    text-decoration: None;
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white !important;
    padding: 6px 10px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 2000;
    transition: all 0.2s;
}

.go-management:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: white !important;
}

.go-management * {
    color: white !important;
}

.go-management i,
.go-management svg {
    color: white !important;
}

/* Dropdown de dashboards */
.dashboards-dropdown {
    position: absolute;
    top: 10px;
    right: 200px;
    z-index: 2000;
    display: none; /* Ocultado temporalmente */
}

.dashboards-dropdown .go-dashboards {
    text-decoration: None;
    background-color: rgba(255, 255, 255, 0.897);
    color: #333333;
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.dashboards-dropdown .go-dashboards:hover {
    background-color: #dedede;
}

.dashboards-dropdown .go-dashboards i.fa-chevron-down {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dashboards-dropdown.active .go-dashboards i.fa-chevron-down {
    transform: rotate(180deg);
}

.dashboards-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dashboards-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dashboards-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.dashboards-item:last-child {
    border-bottom: none;
}

.dashboards-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.dashboards-item i {
    width: 16px;
    text-align: center;
    color: #666;
}

.dashboards-item:hover i {
    color: #007bff;
}

.dashboards-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 8px 0;
}


/* Barra de usuario */
.user-bar {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 2000;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    position: relative;
    text-decoration: none;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-role {
    font-size: 0.7rem;
    color: #777;
}

.user-name {
    font-weight: 600;
    color: #222;
    font-size: 0.85rem;
    line-height: 1.2;
}

/* Avatar */
.user-avatar img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ccc;
}

/* Flechita al lado derecho del avatar */
.dropdown-arrow {
    width: 10px;
    height: 6px;
    background-color: #aaa;
    /* color gris sólido */
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    /* flecha hacia abajo */
    margin-left: 0.25rem;
    border-radius: 1px;
    /* sutil redondeo de esquinas */
}

/* Menú desplegable */
.user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 150px;
    z-index: 200;
}

.user-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.8rem;
    line-height: 1.2;
}

.user-menu a:hover {
    background-color: #f5f5f5;
}

.login-container {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.login-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: #222;
}


/* .user-bar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.login-link {
    color: black;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-link:hover {
    text-decoration: underline;
} */
.maplibregl-ctrl-group {
    background: #a6a6a66c;
    border-radius: 4px;
}

.maplibregl-ctrl-attrib.maplibregl-compact {
    background-color: #e6e6e6af;
    border-radius: 12px;
    box-sizing: content-box;
    color: #000;
    margin: 10px;
    min-height: 20px;
    padding: 2px 24px 2px 0;
    position: relative;
}

/* Logo en esquina inferior izquierda */
.logo-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.286);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    font-family: sans-serif;
    z-index: 2000;
}

.logo-box img {
    max-width: 80px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.powered-by {
    font-size: 12px;
    margin-top: 4px;
    color: #333;
}


/* Panel de mapas base */
.basemap-controls {
    position: absolute;
    right: 20px;
    bottom: 80px;
    /* encima de los botones */
    width: 240px;
    max-height: 50%;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.15);
    padding: 10px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s ease;
    z-index: 999;
}

.basemap-controls.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.basemap-close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.basemap-list {
    list-style: none;
    padding: 0;
    margin-top: 32px;
    /* espacio para el botón de cerrar */
}

.basemap-list li {
    padding: 8px;
    margin-bottom: 4px;
    background: #f7f7f7;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.basemap-list li:hover {
    background: #e0e0e0;
}

.basemap-thumbnail {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.basemap-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.basemap-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #333;
    line-height: 1.1;
}

/* Agrupa switch + botón y los alinea a la derecha */
.layer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    /* separación entre switch y botón */
    margin-left: auto;
    /* empuja el grupo hacia la derecha si hiciera falta */
}

/* Botón de Inicio */
.go-home {
    position: absolute;
    top: 10px;
    right: 200px;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white !important;
    padding: 6px 10px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-family: sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.go-home:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: white !important;
}

.go-home * {
    color: white !important;
}

.go-home i {
    font-size: 14px;
    color: white !important;
}

/* Estilos para popups de estaciones */
.estacion-popup .maplibregl-popup-content {
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    /* border: 1px solid rgba(255,255,255,0.35);*/
    overflow: hidden;
    min-width: 280px;
    background: rgba(255,255,255,0);
    -webkit-backdrop-filter: blur(200px);
    backdrop-filter: blur(10px);
}

.popup-container {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    min-width: 280px;
    max-width: 320px;
}

.popup-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgb(255, 255, 255);
    gap: 12px;
}

.popup-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.popup-icon i {
    color: white;
    font-size: 16px;
}

.popup-title h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #183024;
    line-height: 1.2;
}

.popup-tipo {
    display: inline-block;
    background: #3E6666;
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 8px;
    font-weight: 500;
    /* text-transform: uppercase*/;
    letter-spacing: 0.5px;
}

.popup-content {
    padding: 8px;
}

.popup-description {
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.2);
}

.popup-description p {
    color: rgba(255,255,255,0.9);
    font-size: 10px;
    line-height: 1.2;
    margin: 0;
}

.popup-item {
    display: flex;
    align-items: center;
    margin-bottom: 1px;
    padding: 5px 0;
    border-bottom: 1px solid #f1f3f4;
}

.popup-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.popup-item i {
    width: 20px;
    color: rgba(255,255,255,0.95);
    margin-right: 10px;
    font-size: 14px;
    text-align: center;
}

.popup-item span {
    color: rgba(255,255,255,0.95);
    font-size: 14px;
    line-height: 1.4;
}

.popup-item strong {
    color: #ffffff;
    font-weight: 600;
}

/* Flecha del popup */
.estacion-popup .maplibregl-popup-tip {
    border-top-color: rgba(255,255,255,0.18);
    border-bottom-color: rgba(255,255,255,0.18);
}

/* Botón de acciones en popup */
.popup-actions {
    margin-top: 20px;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.22);
}

.popup-btn {
    width: 100%;
    background: rgba(62, 102, 102, 0.75);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-btn:hover {
    background: rgba(62, 102, 102, 0.85);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(62, 102, 102, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.popup-btn * {
    color: white !important;
}

.popup-btn i {
    font-size: 16px;
    color: white !important;
}

/* Panel lateral de gráficas */
.chart-panel {
    position: fixed;
    top: 0;
    right: -800px;
    width: 70%;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    transition: right 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    display: block;
    visibility: hidden;
    opacity: 0;
}

/* Variante translúcida para panel (glassmorphism) */
.chart-panel.glass {
    background: rgba(255,255,255,0.18);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255,255,255,0.35);
}

/* Estilos para filtros del panel */
.panel-filters .filter-btn {
    transition: all 0.3s ease;
}

.panel-filters .filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.panel-filters .filter-btn.active {
    background: rgba(62, 102, 102, 0.75) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(62, 102, 102, 0.3);
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.panel-filters .filter-btn:not(.active) {
    background: rgba(108, 117, 125, 0.75) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.panel-filters .apply-date-btn {
    background: rgba(23, 162, 184, 0.75) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
}

.panel-filters .apply-date-btn:hover {
    background: rgba(19, 132, 150, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.chart-panel.show {
    right: 0;
    visibility: visible;
    opacity: 1;
}

.chart-panel-header {
    background: #3E6666;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-panel-header.glass {
    background: rgba(45,90,61,0.75);
}

/* Texto blanco para secciones informativas en panel translúcido */
.chart-panel.glass .chart-info p,
.chart-panel.glass .chart-info p strong {
    color: #ffffff !important;
}

.chart-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chart-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.chart-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chart-panel-content {
    padding: 20px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    background-color:rgba(229, 229, 229, 1);
}

.chart-panel-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(7, 102, 83, 0.75) rgba(12, 52, 44, 0.08);
}

.chart-panel-content::-webkit-scrollbar {
  width: 10px;
}

.chart-panel-content::-webkit-scrollbar-track {
  background: rgba(12, 52, 44, 0.08);
  border-radius: 999px;
}

.chart-panel-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(7, 102, 83, 0.88), rgba(12, 52, 44, 0.92));
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.45);
}

.chart-panel-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(10, 124, 101, 0.95), rgba(10, 69, 58, 0.98));
}

/* Base visual para sidecars: evita flash de estilo al abrir */
#chartPanel.sidecar-unified,
#chartPanel.sidecar-unified.glass {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14) !important;
}

#chartPanel.sidecar-unified .chart-panel-header,
#chartPanel.sidecar-unified .chart-panel-header.glass {
  background: transparent !important;
  border-bottom: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: visible !important;
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  pointer-events: none;
}

#chartPanel.sidecar-unified .chart-panel-header h3,
#chartPanel.sidecar-unified .chart-panel-header.glass h3 {
  display: none !important;
}

#chartPanel.sidecar-unified .chart-panel-close {
  margin-left: auto;
  background: rgba(243, 247, 243, .88) !important;
  color: #235b3c !important;
  border: 1px solid rgba(35, 91, 60, 0.14) !important;
  border-radius: 12px !important;
  width: 34px !important;
  height: 34px !important;
  position: absolute !important;
  top: 10px;
  right: 10px;
  pointer-events: auto;
}

#chartPanel.sidecar-unified .chart-panel-content {
  background: #ffffff !important;
  padding: 10px 12px 14px !important;
}

.sidecar-loading {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #334155;
}

.sidecar-loading p {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.chart-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3E6666;
}

.chart-info p {
    margin: 5px 0;
    color: #555;
    font-size: 14px;
}

.chart-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.chart-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.chart-btn {
    background: rgba(62, 102, 102, 0.75) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    color: white !important;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-btn:hover {
    background: rgba(62, 102, 102, 0.85) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(62, 102, 102, 0.3);
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.chart-btn * {
    color: white !important;
}

/* Botón Meteorológica (azul) */
.chart-btn[style*="background:#1e40af"],
.chart-btn[style*="background: #1e40af"],
.chart-btn[style*="background:#1e40af;"],
.chart-btn[style*="background: #1e40af;"] {
    background: rgba(30, 64, 175, 0.75) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    color: white !important;
}

.chart-btn[style*="background:#1e40af"]:hover,
.chart-btn[style*="background: #1e40af"]:hover,
.chart-btn[style*="background:#1e40af;"]:hover,
.chart-btn[style*="background: #1e40af;"]:hover {
    background: rgba(30, 64, 175, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.chart-btn i {
    font-size: 14px;
    color: white !important;
}

/* Animación de entrada del panel */
@keyframes slideInRight {
    from {
        right: -800px;
    }
    to {
        right: 0;
    }
}

.chart-panel[style*="display: block"] {
    animation: slideInRight 0.3s ease;
}

/* Estilos para filtros del panel */
.panel-filters {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3E6666;
}

.filter-section {
    margin-bottom: 15px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #3E6666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    gap: 8px;
}

.panel-filters .filter-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: white !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
}

.panel-filters .filter-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: white !important;
    background: rgba(255, 255, 255, 0.25);
}

.panel-filters .filter-btn.active {
    background: rgba(62, 102, 102, 0.75);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: white;
    border-color: rgba(255, 255, 255, 0.35);
}

.date-picker {
    margin-top: 5px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.panel-filters .date-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid rgba(62, 102, 102, 0.2);
    border-radius: 6px;
    font-size: 12px;
    background: white;
    color: #374151;
    box-sizing: border-box;
}

.panel-filters .date-input:focus {
    outline: none;
    border-color: #3E6666;
    box-shadow: 0 0 0 3px rgba(62, 102, 102, 0.1);
}

.apply-date-btn {
    width: 100%;
    margin-top: 8px !important;
}

/* Spinner de carga */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3E6666;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* === Descripción larga desplegable === */
.popup-description {
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 5px;
}

.popup-desc-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.3s;
}

.popup-desc-header:hover {
  color: #3E6666;
}

.popup-desc-header i {
  transition: transform 0.3s ease;
}

.popup-desc-header.open i {
  transform: rotate(180deg);
}

.popup-desc-body {
  display: none;
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.4;
  color: rgba(255,255,255,0.85);
}

.popup-desc-body.visible {
  display: block;
  animation: fadeIn 0.25s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Controles de MapLibre (top-right) - Mantener estilo original */
/* Los controles de navegación (zoom, compass, etc.) mantienen su estilo original sin efectos transparentes */

/* Estilos originales de MapLibre mantenidos - sin modificaciones */

/* =========================================================
   Observatorio Theme Sync (Admin visual language)
   ========================================================= */
:root {
  --obs-cream: #fffdee;
  --obs-mint: #e2fbce;
  --obs-lime: #e3ef26;
  --obs-green: #076653;
  --obs-deep: #0c342c;
  --obs-night: #06231d;
}

body {
  font-family: "Segoe UI", sans-serif;
  color: var(--obs-deep);
}

#calculated-area {
  border: 1px solid rgba(12, 52, 44, 0.16);
  background: rgba(255, 253, 238, 0.9);
  color: var(--obs-deep);
  box-shadow: 0 8px 18px rgba(12, 52, 44, 0.16);
}

.go-home,
.go-management,
.dashboards-dropdown .go-dashboards {
  border: 1px solid rgba(12, 52, 44, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: var(--obs-deep) !important;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(12, 52, 44, 0.16);
  font-weight: 700;
}

.go-home *,
.go-management *,
.dashboards-dropdown .go-dashboards * {
  color: var(--obs-deep) !important;
}

.go-home i,
.go-management i {
  color: #076653 !important;
}

.go-home:hover i,
.go-management:hover i {
  color: #0c342c !important;
}

.go-home:hover,
.go-management:hover,
.dashboards-dropdown .go-dashboards:hover {
  background: rgba(227, 239, 38, 0.28);
  border-color: rgba(12, 52, 44, 0.24);
}

.bottom-controls {
  gap: 0.7rem;
}

.btn-base {
  border: 1px solid rgba(12, 52, 44, 0.18);
  background: rgba(255, 255, 255, 0.88);
  color: var(--obs-deep) !important;
  box-shadow: 0 10px 22px rgba(12, 52, 44, 0.2);
  font-family: "Segoe UI", sans-serif;
  font-weight: 700;
}

.btn-base * {
  color: var(--obs-deep) !important;
}

.btn-base:hover {
  background: rgba(227, 239, 38, 0.3);
  border-color: rgba(12, 52, 44, 0.24);
}

.btn-circle {
  background: linear-gradient(90deg, #d8ff3e, #c6f51e);
}

.menu-map-base {
  border: 1px solid rgba(12, 52, 44, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 32px rgba(12, 52, 44, 0.2);
}

.menu-map-base li {
  color: var(--obs-deep);
  font-weight: 600;
}

.menu-map-base li:hover {
  background: rgba(227, 239, 38, 0.26);
}

.layer-controls {
  border: 1px solid rgba(12, 52, 44, 0.18);
  background: linear-gradient(160deg, rgba(6, 35, 29, 0.88), rgba(12, 52, 44, 0.8), rgba(7, 102, 83, 0.78));
  box-shadow: 0 18px 34px rgba(12, 52, 44, 0.26);
  border-radius: 18px;
}

.layer-close-btn {
  color: #ecffcb !important;
}

.layer-switch input:checked + .layer-slider {
  background: linear-gradient(135deg, #d8ff3e, #c6f51e);
}

.logo-box {
  border: 1px solid rgba(12, 52, 44, 0.18);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(12, 52, 44, 0.16);
}

.chart-panel.glass {
  background: linear-gradient(170deg, rgba(255, 253, 238, 0.95), rgba(226, 251, 206, 0.9));
  border-left: 1px solid rgba(12, 52, 44, 0.14);
}

.chart-panel-header,
.chart-panel-header.glass {
  background: linear-gradient(180deg, rgba(248, 252, 241, 0.98), rgba(237, 247, 228, 0.96));
  color: var(--obs-deep);
}

.chart-panel-content {
  background: transparent;
}

.panel-filters .filter-btn.active,
.chart-btn,
.popup-btn {
  background: linear-gradient(90deg, #d8ff3e, #c6f51e) !important;
  color: var(--obs-deep) !important;
  border: 1px solid rgba(12, 52, 44, 0.16) !important;
}

.panel-filters .filter-btn.active *,
.chart-btn *,
.popup-btn * {
  color: var(--obs-deep) !important;
}

@media (max-width: 860px) {
  .go-home {
    right: 10px;
    top: 60px;
  }

  .go-management {
    right: 10px;
    top: 10px;
  }

  .bottom-controls {
    width: calc(100% - 20px);
    bottom: 10px;
    gap: 0.45rem;
  }

  .btn-rounded {
    padding: 8px 10px;
    font-size: 13px;
  }

  .layer-controls {
    left: 10px;
    width: min(300px, calc(100vw - 20px));
  }
}

/* =========================================================
   Modal shape tune (rounded + padded, reference style)
   ========================================================= */
.chart-panel {
  top: 24px;
  right: -120%;
  width: min(1080px, calc(100vw - 48px));
  height: calc(100vh - 48px);
  border-radius: 34px;
  overflow: hidden;
  box-shadow: 0 28px 56px rgba(12, 52, 44, 0.3);
}

.chart-panel.show {
  right: 24px;
}

.chart-panel-header,
.chart-panel-header.glass {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(12, 52, 44, 0.12);
}

.chart-panel-header h3,
.chart-panel-header.glass h3 {
  color: #123c2e;
}

.chart-panel-close {
  color: #1e4a3a;
}

.chart-panel-close:hover {
  background: rgba(12, 52, 44, 0.08);
}

.chart-panel-content {
  padding: 1.1rem 1.2rem 1.3rem;
}

.estacion-popup .maplibregl-popup-content {
  padding: 12px !important;
  border-radius: 30px !important;
  border: 1px solid rgba(12, 52, 44, 0.16) !important;
  background: rgba(255, 253, 238, 0.97) !important;
  box-shadow: 0 20px 40px rgba(12, 52, 44, 0.24) !important;
}

.popup-container {
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(226, 251, 206, 0.65));
}

.popup-header {
  border-radius: 18px;
  margin-bottom: 8px;
  border: 1px solid rgba(12, 52, 44, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

.popup-title h3 {
  color: #0c342c;
}

.popup-tipo {
  background: linear-gradient(135deg, #076653, #0c342c);
}

.popup-content {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(12, 52, 44, 0.1);
}

.popup-item i,
.popup-item span,
.popup-item strong {
  color: #1f3f33 !important;
}

.popup-description {
  border-top: 1px solid rgba(12, 52, 44, 0.14);
}

.popup-description p,
.popup-desc-header,
.popup-desc-body {
  color: #2b4f41 !important;
}

.popup-actions {
  margin-top: 12px;
  padding: 0;
  border-top: none;
  background: transparent;
}

.popup-btn {
  border-radius: 999px;
  padding: 10px 14px;
}

@media (max-width: 760px) {
  .chart-panel {
    top: 8px;
    right: -120%;
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 24px;
  }

  .chart-panel.show {
    right: 8px;
  }
}

/* =========================================================
   Map Controls Visual Sync
   ========================================================= */
.maplibregl-ctrl-group {
  border: 1px solid rgba(12, 52, 44, 0.18) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 22px rgba(12, 52, 44, 0.18) !important;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.maplibregl-ctrl-group:hover,
.maplibregl-ctrl-group:focus-within {
  background: rgba(255, 255, 255, 0.96) !important;
  opacity: 1;
  box-shadow: 0 14px 24px rgba(12, 52, 44, 0.24) !important;
}

.maplibregl-ctrl-group button,
.mapbox-gl-draw_ctrl-draw-btn,
.mapbox-gl-draw_ctrl-draw-btn.mapbox-gl-draw_trash {
  border: 0 !important;
  border-bottom: 1px solid rgba(12, 52, 44, 0.1) !important;
  background: #ffffff !important;
}

.maplibregl-ctrl-group button:last-child,
.mapbox-gl-draw_ctrl-draw-btn:last-child {
  border-bottom: 0 !important;
}

.maplibregl-ctrl-group button:hover,
.mapbox-gl-draw_ctrl-draw-btn:hover {
  background: rgba(227, 239, 38, 0.18) !important;
}

.maplibregl-ctrl-group .maplibregl-ctrl-icon {
  opacity: 0.95;
  filter: invert(15%) sepia(16%) saturate(1371%) hue-rotate(117deg) brightness(32%) contrast(96%);
}

/* Attribution / credit badge */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact,
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib.maplibregl-compact {
  margin: 8px !important;
  padding: 2px 26px 2px 10px !important;
  min-height: 22px;
  border-radius: 999px !important;
  border: 1px solid rgba(12, 52, 44, 0.2) !important;
  background: rgba(255, 253, 238, 0.86) !important;
  color: #0c342c !important;
  font-size: 11px;
  line-height: 1.2;
  box-shadow: 0 8px 14px rgba(12, 52, 44, 0.18);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.maplibregl-ctrl-attrib a {
  color: #0c342c !important;
  text-decoration: none;
  font-weight: 600;
}

.maplibregl-ctrl-attrib-button {
  color: #0c342c !important;
  opacity: 1 !important;
}

/* Zoom / draw controls icon color sync */
.maplibregl-ctrl-group button .maplibregl-ctrl-icon,
.mapbox-gl-draw_ctrl-draw-btn {
  filter: invert(15%) sepia(16%) saturate(1371%) hue-rotate(117deg) brightness(32%) contrast(96%);
}

.maplibregl-ctrl-group button:hover .maplibregl-ctrl-icon,
.mapbox-gl-draw_ctrl-draw-btn:hover {
  filter: invert(12%) sepia(15%) saturate(1105%) hue-rotate(117deg) brightness(28%) contrast(98%);
}

/* Evita estados activos cian/verde fuerte en controles */
.maplibregl-ctrl-group button:focus,
.maplibregl-ctrl-group button:active,
.maplibregl-ctrl-group .maplibregl-ctrl-geolocate-active,
.mapbox-gl-draw_ctrl-draw-btn.active,
.mapbox-gl-draw_ctrl-draw-btn:active {
  background: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(12, 52, 44, 0.2) !important;
}

.terrain-ctrl {
  display: flex !important;
  align-items: center;
  gap: 0.32rem;
  padding: 0.16rem 0.34rem;
  background: rgba(255, 255, 255, 0.62) !important;
}

.terrain-ctrl .terrain-ctrl-btn {
  min-width: 34px;
  height: 28px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.8rem;
  color: #0c342c;
}

.terrain-ctrl .terrain-ctrl-btn.active {
  background: linear-gradient(90deg, #d8ff3e, #c6f51e) !important;
  color: #0c342c !important;
}

.terrain-ctrl .terrain-ctrl-slider {
  width: 108px;
  height: 14px;
  accent-color: #9fd114;
}

.terrain-ctrl .terrain-ctrl-slider::-webkit-slider-runnable-track {
  height: 6px;
}

.terrain-ctrl .terrain-ctrl-slider::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -3px;
}

.terrain-ctrl .terrain-ctrl-slider::-moz-range-track {
  height: 6px;
}

.terrain-ctrl .terrain-ctrl-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
}

.terrain-ctrl .terrain-ctrl-value {
  min-width: 24px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0c342c;
}

.logo-box {
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(12, 52, 44, 0.16);
  background: rgba(255, 253, 238, 0.58);
  opacity: 0.66;
  transition: opacity 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.logo-box:hover {
  background: rgba(255, 253, 238, 0.95);
  opacity: 1;
  box-shadow: 0 14px 24px rgba(12, 52, 44, 0.22);
}

.logo-box img {
  max-width: 76px;
  border-radius: 14px;
  display: block;
}

/* =========================================================
   Popup Card Refresh (Observatorio theme)
   ========================================================= */
.estacion-popup .maplibregl-popup-content {
  padding: 0 !important;
  border-radius: 10px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: 0 20px 38px rgba(7, 45, 35, 0.28) !important;
  min-width: 300px;
  max-width: 340px;
  overflow: visible !important;
}

.estacion-popup .maplibregl-popup-close-button {
  color: #0c342c;
  right: 0;
  top: 0;
  transform: translate(50%, -50%);
  font-size: 0.95rem;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 50% !important;
  display: grid;
  place-items: center;
  padding: 0 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(12, 52, 44, 0.22);
  box-shadow: 0 8px 14px rgba(12, 52, 44, 0.2);
  z-index: 4;
}

.popup-card-style {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(12, 52, 44, 0.14);
  border-radius: 10px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.popup-card-style .popup-top-panel {
  padding: 0.58rem 0.68rem 0.56rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(12, 52, 44, 0.14);
}

.popup-card-style .popup-header {
  margin: 0;
  padding: 0;
  gap: 0.52rem;
  border-radius: 0;
  background: transparent;
  border: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.popup-card-style .popup-icon {
  width: 30px;
  height: 30px;
  margin-right: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

.popup-card-style .popup-icon i {
  color: #f7ffee;
  font-size: 0.82rem;
}

.popup-card-style .popup-title h3 {
  margin: 0;
  color: #0c342c;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.15;
}

.popup-card-style .popup-subline {
  margin-top: 0.18rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  color: #2a5142;
  font-size: 0.69rem;
  font-weight: 600;
  white-space: nowrap;
}

.popup-card-style .popup-subline i {
  font-size: 0.62rem;
  opacity: 0.95;
}

.popup-card-style .popup-btn-top {
  background: transparent;
  border: 0;
  color: #1d4638;
  padding: 0.1rem 0.1rem 0.14rem;
  border-radius: 0;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  opacity: 0.92;
}

.popup-card-style .popup-inline-action {
  margin-top: 0.35rem;
  display: flex;
  justify-content: flex-end;
}

.popup-card-style .popup-inline-actions {
  margin-top: 0.42rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.36rem;
}

.popup-card-style .popup-inline-actions--barrios {
  flex-wrap: nowrap;
}

.popup-card-style .popup-btn-top--chip {
  border: 1px solid rgba(29, 70, 56, 0.34) !important;
  border-radius: 999px !important;
  padding: 0.34rem 0.58rem !important;
  text-decoration: none !important;
  text-underline-offset: 0;
  text-decoration-thickness: 0;
  background: rgba(255, 255, 255, 0.65) !important;
  color: #1d4638 !important;
  line-height: 1.1;
}

.popup-card-style .popup-btn-top--chip::after {
  content: "";
}

.popup-card-style .popup-btn-top--chip:hover {
  background: rgba(227, 239, 38, 0.25) !important;
  border-color: rgba(7, 102, 83, 0.48) !important;
  color: #0c342c !important;
}

.popup-card-style .popup-btn-top::after {
  content: "▾";
  font-size: 0.75rem;
  line-height: 1;
}

.popup-card-style .popup-content {
  margin: 0.12rem 0 0.16rem;
  padding: 0.22rem 0.44rem 0.28rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(1px);
  box-shadow: none;
}

.popup-card-style .popup-item {
  align-items: baseline;
  gap: 0.42rem;
  margin: 0;
  padding: 0.28rem 0;
  border-bottom: 0;
}

.popup-card-style .popup-item:last-child {
  border-bottom: 0;
}

.popup-card-style .popup-item i {
  width: 12px;
  margin-right: 0;
  color: #c6f51e !important;
  font-size: 0.7rem;
  margin-top: 0;
}

.popup-card-style .popup-item span,
.popup-card-style .popup-item strong {
  color: #1f3f33 !important;
  font-size: 0.8rem;
  line-height: 1.35;
}

.popup-card-style .popup-description-shell {
  margin: 0;
  background: linear-gradient(155deg, rgba(6, 35, 29, 0.8), rgba(12, 52, 44, 0.76), rgba(7, 102, 83, 0.7));
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0 0 8px 8px;
  padding: 0;
}

.popup-card-style .popup-description {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.popup-card-style .popup-desc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 0.5rem 0.68rem 0.44rem;
  cursor: pointer;
  list-style: none;
  color: #f2fff7 !important;
  font-size: 0.8rem;
  font-weight: 700;
}

.popup-card-style .popup-desc-header::-webkit-details-marker {
  display: none;
}

.popup-card-style .popup-description[open] .popup-desc-header i {
  transform: rotate(180deg);
}

.popup-card-style .popup-desc-header i {
  transition: transform 0.2s ease;
}

.popup-card-style .popup-desc-body {
  display: block;
  margin: 0;
  padding: 0.18rem 0.68rem 0.62rem;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #f2fff7 !important;
  white-space: normal;
}

.popup-card-style .popup-actions {
  margin: 0.2rem 0.52rem 0.56rem;
  padding: 0;
  border: 0;
  background: transparent;
}

.popup-card-style .popup-btn {
  width: auto;
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(7, 102, 83, 0.34);
  color: #076653;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: none;
}

.popup-card-style .popup-btn:hover {
  background: rgba(227, 239, 38, 0.22);
  border-color: rgba(7, 102, 83, 0.46);
  color: #0c342c;
  transform: none;
}

.popup-card-style .popup-btn i {
  display: none;
}

.popup-card-style .popup-btn.popup-btn-top {
  background: transparent;
  border: 0;
  color: #1d4638;
  font-weight: 700;
  margin-left: 0;
}

.popup-card-style .popup-btn.popup-btn-top:hover {
  background: transparent;
  color: #e3ef26;
  opacity: 1;
}

@media (max-width: 760px) {
  .estacion-popup .maplibregl-popup-content {
    min-width: 250px;
    max-width: 292px;
  }

  .popup-card-style .popup-title h3 {
    font-size: 0.88rem;
  }

  .popup-card-style .popup-btn-top {
    font-size: 0.64rem;
    padding: 0.28rem 0.46rem;
  }

  .popup-card-style .popup-inline-actions--barrios {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .popup-card-style .popup-item span,
  .popup-card-style .popup-item strong {
    font-size: 0.76rem;
  }
}

/* =========================================================
   Noise Sidecar Refresh (visual only, no logic changes)
   ========================================================= */
#chartPanel.noise-panel-v2 {
  background: linear-gradient(180deg, rgba(226, 243, 236, 0.94), rgba(236, 241, 245, 0.96));
  border-left: 1px solid rgba(255, 255, 255, 0.55);
}

#chartPanel.noise-panel-v2 .chart-panel-header.glass {
  background:
    radial-gradient(120% 140% at 8% 0%, rgba(227, 239, 38, 0.16), transparent 55%),
    radial-gradient(100% 120% at 100% 100%, rgba(111, 123, 255, 0.16), transparent 60%),
    linear-gradient(135deg, rgba(12, 52, 44, 0.92), rgba(7, 102, 83, 0.86), rgba(36, 74, 126, 0.72));
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  align-items: flex-start;
  gap: 12px;
}

#chartPanel.noise-panel-v2 .noise-panel-header-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

#chartPanel.noise-panel-v2 .noise-panel-kicker {
  display: inline-flex;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 255, 250, 0.88);
}

#chartPanel.noise-panel-v2 .chart-panel-header h3 {
  margin: 0;
  line-height: 1.2;
  font-size: 22px;
  font-weight: 800;
  color: #f7fff7;
}

#chartPanel.noise-panel-v2 .noise-panel-subtitle {
  margin: 0;
  font-size: 12px;
  color: rgba(238, 248, 245, 0.82);
}

#chartPanel.noise-panel-v2 .noise-panel-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#chartPanel.noise-panel-v2 .noise-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  color: #effff7;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#chartPanel.noise-panel-v2 .chart-panel-close {
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#chartPanel.noise-panel-v2 .chart-panel-content.noise-panel-content {
  background:
    radial-gradient(90% 65% at 12% 0%, rgba(162, 221, 173, 0.2), transparent 62%),
    radial-gradient(100% 90% at 100% 10%, rgba(132, 171, 255, 0.15), transparent 64%),
    linear-gradient(180deg, #e6eee9 0%, #e9edf2 100%);
  padding: 14px 14px 18px;
}

#chartPanel.noise-panel-v2 .noise-panel-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-left: 1px solid rgba(255, 255, 255, 0.36) !important;
  border-radius: 14px;
  padding: 14px 14px 12px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(227, 239, 38, 0.12), transparent 52%),
    radial-gradient(100% 130% at 100% 100%, rgba(124, 146, 255, 0.16), transparent 58%),
    linear-gradient(135deg, rgba(8, 89, 72, 0.62), rgba(15, 70, 61, 0.54), rgba(52, 91, 143, 0.42)) !important;
  box-shadow: 0 10px 24px rgba(12, 52, 44, 0.14);
}

#chartPanel.noise-panel-v2 .noise-panel-hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -18% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), rgba(255,255,255,0));
  pointer-events: none;
}

#chartPanel.noise-panel-v2 .noise-panel-hero p,
#chartPanel.noise-panel-v2 .noise-panel-hero p strong {
  color: #f8fff8 !important;
}

#chartPanel.noise-panel-v2 .noise-panel-hero p {
  margin: 4px 0;
  font-size: 13px;
}

#chartPanel.noise-panel-v2 .noise-panel-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f0fff6;
  font-size: 12px;
  font-weight: 700;
}

#chartPanel.noise-panel-v2 .noise-panel-filters {
  margin-top: 0 !important;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-left: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 18px rgba(12, 52, 44, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#chartPanel.noise-panel-v2 .noise-panel-filters .filter-section h4 {
  color: #214d3f;
  font-size: 11px;
  letter-spacing: 0.08em;
}

#chartPanel.noise-panel-v2 .noise-panel-filters .filter-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

#chartPanel.noise-panel-v2 .noise-panel-filters .filter-btn {
  background: rgba(255, 255, 255, 0.7) !important;
  color: #1a3f35 !important;
  border: 1px solid rgba(12, 52, 44, 0.1) !important;
  font-weight: 700;
}

#chartPanel.noise-panel-v2 .noise-panel-filters .filter-btn.active {
  background: linear-gradient(135deg, rgba(12, 52, 44, 0.92), rgba(7, 102, 83, 0.88)) !important;
  color: #f4fff9 !important;
  border-color: rgba(7, 102, 83, 0.4) !important;
  box-shadow: 0 6px 14px rgba(7, 102, 83, 0.22);
}

#chartPanel.noise-panel-v2 .noise-panel-filters .date-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#chartPanel.noise-panel-v2 .noise-panel-filters .date-input {
  border-radius: 10px;
  border: 1px solid rgba(12, 52, 44, 0.12);
  background: rgba(255, 255, 255, 0.88);
  min-height: 38px;
}

#chartPanel.noise-panel-v2 .noise-panel-filters .apply-date-btn {
  margin-top: 0 !important;
  background: linear-gradient(135deg, #d7fb45, #b8ea17) !important;
  color: #102f27 !important;
  border-color: rgba(179, 220, 37, 0.45) !important;
  box-shadow: 0 6px 12px rgba(163, 194, 38, 0.22);
}

#chartPanel.noise-panel-v2 .noise-panel-filters .apply-date-btn * {
  color: inherit !important;
}

#chartPanel.noise-panel-v2 .noise-panel-sections {
  display: grid;
  gap: 8px;
}

#chartPanel.noise-panel-v2 .noise-section-toggle {
  min-height: 42px;
  border-radius: 12px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(227, 239, 38, 0.12), transparent 45%),
    linear-gradient(135deg, rgba(12, 52, 44, 0.94), rgba(7, 102, 83, 0.88), rgba(39, 73, 121, 0.78)) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 10px 20px rgba(12, 52, 44, 0.16);
  justify-content: flex-start;
  gap: 8px;
}

#chartPanel.noise-panel-v2 .noise-section-toggle .chart-arrow {
  margin-left: auto;
  float: none !important;
}

#chartPanel.noise-panel-v2 .noise-section-body {
  padding: 2px 0 4px;
}

#chartPanel.noise-panel-v2 .noise-chart-shell {
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.52) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 250, 252, 0.92)) !important;
  box-shadow: 0 10px 22px rgba(12, 52, 44, 0.09);
  overflow: hidden;
  position: relative;
}

#chartPanel.noise-panel-v2 .noise-chart-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #d7fb45, #55c58c, #7ea2ff);
  opacity: 0.9;
}

#chartPanel.noise-panel-v2 #avg-grid.noise-kpi-grid {
  gap: 10px !important;
}

#chartPanel.noise-panel-v2 #avg-grid > div > div {
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(227, 239, 38, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(247,250,252,0.94)) !important;
  border: 1px solid rgba(255,255,255,0.55) !important;
  border-radius: 14px !important;
  text-align: left !important;
  box-shadow: 0 8px 18px rgba(12,52,44,0.08);
  padding: 14px 14px 12px !important;
}

#chartPanel.noise-panel-v2 #avg-grid > div > div > div:nth-child(1) {
  font-size: 11px !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: #5f7283 !important;
  margin-bottom: 10px !important;
}

#chartPanel.noise-panel-v2 #avg-grid > div > div > div:nth-child(2) {
  font-size: 30px !important;
  color: #1f5d47 !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.55);
}

#chartPanel.noise-panel-v2 #avg-grid > div > div > div:nth-child(3) {
  margin-top: 8px !important;
  color: #6f7f8d !important;
  font-size: 11px !important;
}

#chartPanel.noise-panel-v2 .spinner {
  border-top-color: #076653;
}

@media (max-width: 760px) {
  #chartPanel.noise-panel-v2 .chart-panel-header.glass {
    padding: 14px 14px 12px;
    flex-wrap: wrap;
  }

  #chartPanel.noise-panel-v2 .chart-panel-header h3 {
    font-size: 18px;
  }

  #chartPanel.noise-panel-v2 .noise-panel-header-actions {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  #chartPanel.noise-panel-v2 .noise-live-pill {
    font-size: 11px;
    padding: 6px 8px;
  }
}
