
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; display: flex; height: 100vh; overflow: hidden; background: #f0f2f5; }

/* ===== ICON BAR (left) ===== */
.aside-icon-bar {
    width: 80px; min-width: 80px; height: 100vh; background: #1e293b;
    display: flex; flex-direction: column; align-items: center;
    z-index: 1100; flex-shrink: 0;
}
.aside-icon-bar .logo-box {
    width: 100%; height: 80px; display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,.08); padding: 10px;
}
.aside-icon-bar .logo-box img {
    width: 52px; height: 52px; object-fit: contain;
}
.aside-icon-bar .nav-icons { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 12px; width: 100%; }
.aside-icon-bar .nav-icon {
    width: 56px; height: 56px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; border-radius: 10px; cursor: pointer;
    color: #94a3b8; transition: all .15s; position: relative; border: none; background: none;
}
.aside-icon-bar .nav-icon:hover { color: #e2e8f0; background: rgba(255,255,255,.06); }
.aside-icon-bar .nav-icon.active { color: #fbbf24; background: rgba(251,191,36,.1); }
.aside-icon-bar .nav-icon.active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 28px; background: #fbbf24; border-radius: 0 3px 3px 0;
}
.aside-icon-bar .nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aside-icon-bar .nav-icon span { font-size: 9px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.aside-icon-bar .nav-bottom { padding-bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
/* Panel CERRADO */
.map-title-floating {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    box-sizing: border-box;

    z-index: 1000;
    pointer-events: none;

    padding: 10px 20px 10px 150px;
    margin: 0;

    border: none;
    border-radius: 0;
    box-shadow: none;

    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;

    transition: padding-left 0.25s ease;
}

/* Panel ABIERTO: pegado a los botones + / − */
.map-title-floating.shifted {
    left: 0;
    margin-left: 0;
    transform: none;
    padding-left: 530px;
}

.map-title-floating h1,
.map-title-floating p {
    margin-top: 0;
    margin-bottom: 0;
}

/* Adaptación para pantallas pequeñas */
@media (max-width: 768px) {
    .map-title-floating {
        padding: 8px 12px 8px 75px;
        min-height: 60px;
    }

    .map-title-floating h1 {
        font-size: 17px;
    }

    .map-title-floating p {
        font-size: 12px;
    }
}

/* Bajar controles de zoom (+ y -) 
.leaflet-top.leaflet-left .leaflet-control-zoom {
    margin-top: 100px;
}*/

/* Bajar selector de mapa base (satélite / calles)
.leaflet-top.leaflet-right .leaflet-control-layers {
    margin-top: 100px;
}*/

.map-title-floating h1 {
    color: #fff;
    margin: 0;
}

.map-title-floating p {
    color: #fff;
    margin: 3px 0 0;
}
/*.map-title-floating.shifted {
    left: 530px;
}*/
.map-title-floating h1 {
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,.7), 0 1px 3px rgba(0,0,0,.5);
    letter-spacing: .5px;
    line-height: 1.3;
}
.map-title-floating p {
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,.7), 0 1px 3px rgba(0,0,0,.5);
    letter-spacing: .5px;
    line-height: 1.3;
}

/* ===== HORIZONTAL FILTERS (below title, with minimize/maximize) ===== */
.horizontal-filters-wrapper {
    position: absolute;
    top: 85px;
    left: 140px;
    z-index: 1001;
    pointer-events: auto;
    transition: left .25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.horizontal-filters-wrapper.shifted {
    left: 530px;
}
.btn-toggle-hf {
    width: 42px; height: 42px; border: none;
    background: rgba(255,255,255,.95); border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.15); color: #1e293b; flex-shrink: 0;
}
.btn-toggle-hf:hover { background: #fff; }
.btn-toggle-hf svg { width: 20px; height: 20px; }
.horizontal-filters-content {
    display: flex;
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 10px 14px; gap: 12px; align-items: center;
    flex-wrap: nowrap; min-width: 0; transition: all .25s ease;
}
.horizontal-filters-content[data-open="0"] {
    display: none;
}
.hf-row {
    display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; min-width: 0;
}
.hf-group {
    display: flex; flex-direction: column; gap: 4px; min-width: 110px; flex-shrink: 0;
}
.hf-group label {
    font-size: 11px; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: .5px;
}
.hf-group select,
.hf-group input[type="date"] {
    width: 100%; padding: 7px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 13px; background: #fff;
}
.hf-group select:focus,
.hf-group input[type="date"]:focus {
    outline: none; border-color: #2563eb;
}
.hf-group select:disabled { background: #f1f5f9; color: #94a3b8; }
.hf-fecha { flex: 1; min-width: 200px; flex-direction: column; }
.hf-fecha label { margin-bottom: 0; }
.hf-date-range {
    display: flex; gap: 6px; align-items: center; width: 100%;
}
.hf-fecha-label {
    font-size: 11px; color: #64748b; font-weight: 600; flex-shrink: 0;
    white-space: nowrap;
}
.hf-date-range input[type="date"] { flex: 1; min-width: 0; }
.hf-actions {
    display: flex; gap: 8px; flex-shrink: 0;
}
.hf-btn-aplicar {
    padding: 7px 14px; background: #2563eb; color: #fff;
    border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.hf-btn-aplicar:hover { background: #1d4ed8; }
.hf-btn-limpiar {
    padding: 7px 14px; border: 1px solid #d1d5db;
    border-radius: 6px; background: #fffbeb; color: #92400e;
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.hf-btn-limpiar:hover { background: #fef3c7; }

/* ===== MOBILE: HORIZONTAL FILTERS ===== */
@media (max-width: 768px) {
    .horizontal-filters-wrapper {
        position: absolute;
        top: 110px; left: 90px;
        width: auto; max-width: calc(100vw - 110px);
        padding: 8px; background: #fff; border: 1px solid #e2e8f0;
        border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
        flex-direction: column; align-items: flex-start; gap: 8px;
        z-index: 1001;
    }
    .horizontal-filters-wrapper.shifted { left: 90px; top: 110px; }
    .btn-toggle-hf { width: 40px; height: 40px; align-self: flex-start; }
    .horizontal-filters-content {
        flex-wrap: wrap; gap: 8px; padding: 8px;
        border: none; box-shadow: none; background: transparent;
        width: 100%;
    }
    .hf-row { flex-wrap: wrap; gap: 8px; }
    .hf-group { min-width: auto; width: 140px; }
    .hf-fecha { min-width: auto; width: 100%; flex-direction: column; }
    .hf-date-range { flex-direction: column; gap: 4px; width: 100%; }
    .hf-actions { width: 100%; justify-content: space-between; }
    .hf-btn-aplicar, .hf-btn-limpiar { flex: 1; }
}

/* ===== SLIDE PANEL ===== */
.aside-slide-panel {
    width: 0; height: 100vh; background: #f8fafc; border-right: 1px solid #e2e8f0;
    overflow: hidden; transition: width .25s ease; z-index: 1050; flex-shrink: 0;
    box-shadow: none;
}
.aside-slide-panel.open { width: 380px; box-shadow: 4px 0 20px rgba(0,0,0,.08); }
.aside-slide-panel .panel-inner { width: 380px; height: 100vh; display: flex; flex-direction: column; }
.panel-header {
    padding: 18px 20px 14px; background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: #fff; flex-shrink: 0;
}
.panel-header h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-header h2::before { content: ''; display: inline-block; width: 4px; height: 16px; background: #60a5fa; border-radius: 2px; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; }

/* ===== UBIGEO FILTERS ===== */
.ubigeo-group { margin-bottom: 12px; }
.ubigeo-group label { display: block; font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 5px; }
.ubigeo-group select {
    width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; color: #0f172a; background: #fff; cursor: pointer;
    appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    transition: border-color .15s;
}
.ubigeo-group select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.ubigeo-group select:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }

.btn-limpiar {
    width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 12px; color: #92400e; background: #fffbeb; cursor: pointer;
    font-weight: 600; transition: all .15s; margin-top: 4px;
}
.btn-limpiar:hover { background: #fef3c7; border-color: #f59e0b; }

/* ===== LAYER ITEMS ===== */
.layers-section { margin-bottom: 18px; }
.layers-section h3 {
    font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase;
    letter-spacing: .7px; margin-bottom: 10px; padding: 8px 12px;
    background: #e2e8f0; border-radius: 6px;
    display: flex; align-items: center; gap: 6px;
}
.layers-section h3::before { content: ''; display: inline-block; width: 3px; height: 12px; background: #2563eb; border-radius: 2px; }
.info-badge {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af; padding: 10px 14px; border-radius: 8px;
    font-size: 12px; margin-bottom: 14px; line-height: 1.5; border: 1px solid #bfdbfe;
}

.aviso-group {
    border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 10px;
    overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: box-shadow .15s;
}
.aviso-group:hover { box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.aviso-title {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0; cursor: pointer; user-select: none;
    transition: background .15s;
}
.aviso-title:hover { background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%); }
.aviso-title .dot-aviso { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.aviso-title strong { font-size: 13px; color: #0f172a; flex: 1; }
.aviso-title .aviso-count { font-size: 10px; color: #64748b; background: #e2e8f0; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.aviso-title .chevron { font-size: 12px; color: #94a3b8; transition: transform .2s; }
.aviso-body { padding: 6px; display: none; }
.aviso-group.open .aviso-body { display: block; }
.aviso-group.open .chevron { transform: rotate(90deg); }

.layer-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border-radius: 8px; margin-bottom: 2px; font-size: 13px;
    transition: all .15s; cursor: default;
}
.layer-item:hover { background: #f1f5f9; }
.layer-item input[type="checkbox"] { display: none; }
.layer-item .toggle {
    position: relative; width: 38px; height: 20px; flex-shrink: 0;
    background: #cbd5e1; border-radius: 12px; cursor: pointer; transition: background .25s;
}
.layer-item .toggle::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: #fff; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .25s, background .25s;
}
.layer-item input:checked + .toggle { background: #2563eb; }
.layer-item input:checked + .toggle::after { transform: translateX(18px); }
.layer-item .layer-label { font-weight: 500; color: #0f172a; flex: 1; min-width: 0; }

.spinner-mini {
    width: 11px; height: 11px; border: 2px solid #dbeafe; border-top-color: #2563eb;
    border-radius: 50%; animation: spin .6s linear infinite; display: inline-block;
    vertical-align: -1px; margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LEGEND (in panel) ===== */
.legend-box { background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; padding: 14px; }
.legend-box strong { display: block; margin-bottom: 8px; color: #0f172a; font-size: 13px; }
.leyenda-item { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.leyenda-item:last-child { margin-bottom: 0; }
.leyenda-cuadro { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; margin-top: 1px; }
.leyenda-text strong { font-size: 12px; color: #374151; }
.leyenda-text span { font-size: 11px; color: #6b7280; }
.leyenda-sep { border: none; border-top: 1px solid #e2e8f0; margin: 10px 0; }
.leyenda-circulo { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 1px; }
.leyenda-linea { width: 22px; height: 0; border-top: 4px solid currentColor; flex-shrink: 0; margin-top: 6px; }
.leyenda-img { width: 22px; height: 26px; object-fit: contain; flex-shrink: 0; margin-top: -2px; }
.leyenda-fuego { font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 16px; flex-shrink: 0; margin-top: -1px; line-height: 1; }

/* ===== MAP ===== */
#mapa-wrap {
    flex: 1;
    height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}
#map { flex: 1; height: auto; min-height: 0; z-index: 1; position: relative; }

/* ===== BARRA DE COORDENADAS (GCS WGS94 + UTM) ===== */
#coordenadas-bar {
    position: absolute;
    left: 50%;
    bottom: 34px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    z-index: 900;
    pointer-events: none;
    overflow: visible;
    white-space: nowrap;
}
#coordenadas-bar::-webkit-scrollbar { height: 0; }
#coordenadas-bar .coord-box {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 26px;
    padding: 0 12px;
    border-radius: 4px;
    background: #15803d;
    color: #ffffff;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 600;
    flex-shrink: 0;
}
#coordenadas-bar .coord-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-right: 1px solid rgba(255, 255, 255, .45);
    padding-right: 10px;
}

/* ===== INCENDIOS ICON ===== */
.incendio-icon { background: none !important; border: none !important; }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(10px);
    padding: 12px 24px; border-radius: 8px; color: #fff; font-size: 14px;
    z-index: 99999; opacity: 0; transition: all .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

/* ===== PDF BUTTON ===== */
#btn-descargar {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 9999; background: #2563eb; color: #fff; border: none; border-radius: 8px;
    padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
    display: none; align-items: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(37,99,235,.4); transition: all .2s;
}
#btn-descargar:hover { background: #1d4ed8; transform: translateX(-50%) translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.5); }
#btn-descargar svg { width: 18px; height: 18px; fill: currentColor; }
#btn-descargar.visible { display: inline-flex; }

#btn-descargar-coes {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 10000; background: #dc2626; color: #fff; border: none; border-radius: 8px;
    padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
    display: none; align-items: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(220,38,38,.4); transition: all .2s;
}
#btn-descargar-coes:hover { background: #b91c1c; transform: translateX(-50%) translateY(-1px); box-shadow: 0 6px 16px rgba(220,38,38,.5); }
#btn-descargar-coes svg { width: 18px; height: 18px; fill: currentColor; }

#descarga-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: none; align-items: center; justify-content: center;
    z-index: 99999; flex-direction: column; gap: 12px;
}
#descarga-overlay.active { display: flex; }
#descarga-overlay .spinner-lg {
    width: 40px; height: 40px; border: 4px solid #dbeafe; border-top-color: #2563eb;
    border-radius: 50%; animation: spin .7s linear infinite;
}
#descarga-overlay span { color: #fff; font-size: 14px; font-weight: 500; }
/*TOOPLIP*/

.aviso-nombre-tooltip {
    position: relative;
    cursor: help;
}

.aviso-nombre-tooltip::after {
    content: attr(data-tooltip);

    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);

    background: #1f2937;
    color: #fff;

    padding: 6px 10px;
    border-radius: 6px;

    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;

    white-space: normal;
    width: max-content;
    max-width: 300px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    z-index: 99999;

    transition: opacity 0.15s ease;
}

.aviso-nombre-tooltip::before {
    content: "";

    position: absolute;
    left: 15px;
    bottom: calc(100% + 2px);

    border: 5px solid transparent;
    border-top-color: #1f2937;

    opacity: 0;
    visibility: hidden;

    z-index: 99999;
}

.aviso-nombre-tooltip:hover::after,
.aviso-nombre-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ===== ICONO INFO + TOOLTIP PROFESIONAL (avisos SENAMHI) ===== */
.aviso-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
    cursor: help;
    flex-shrink: 0;
    transition: color .15s ease, transform .15s ease;
}

.aviso-info-icon:hover,
.aviso-info-icon:focus-visible {
    color: #2563eb;
    transform: scale(1.15);
    outline: none;
}

.aviso-info-tooltip {
    position: fixed;
    z-index: 99999;

    max-width: 300px;
    width: max-content;

    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #f9fafb;

    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;

    padding: 9px 13px;

    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: .2px;

    box-shadow:
        0 10px 25px rgba(0, 0, 0, .35),
        0 2px 6px rgba(0, 0, 0, .2);

    pointer-events: none;
    animation: avisoTooltipIn .16s ease both;
}

.aviso-info-tooltip::before {
    content: '';
    display: block;
    width: 22px;
    height: 3px;
    margin-bottom: 5px;
    border-radius: 2px;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.aviso-info-tooltip::after {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);

    border: 6px solid transparent;
    border-right-color: #1f2937;
}

@keyframes avisoTooltipIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== POPUP FLOTANTE AFECTACIÓN ===== */
.popup-afectacion-flotante {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: calc(100vh - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 25px 60px rgba(0,0,0,.18),
        0 8px 20px rgba(0,0,0,.08),
        0 0 0 1px rgba(0,0,0,.04);
    z-index: 99998;
    overflow: hidden;
    animation: popupAfectacionIn .4s cubic-bezier(.16,1,.3,1) both;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(8px);
}

@keyframes popupAfectacionIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Header --- */
.popup-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #991b1b 0%, #dc2626 50%, #ef4444 100%);
    position: relative;
    flex-shrink: 0;
    user-select: none;
    overflow: hidden;
}

.popup-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,.08) 0%, transparent 60%);
    pointer-events: none;
}

.popup-header-arrastrable {
    cursor: grab;
}

.popup-header-arrastrable:active {
    cursor: grabbing;
}

.popup-drag-indicator {
    position: absolute;
    left: 16px;
    color: rgba(255,255,255,.5);
    font-size: 14px;
    transition: color .2s;
}

.popup-header-arrastrable:hover .popup-drag-indicator {
    color: rgba(255,255,255,.8);
}

.popup-header-titulo {
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
    position: relative;
    z-index: 1;
}

.popup-header-acciones {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 2;
}

.popup-min {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: all .2s ease;
    backdrop-filter: blur(4px);
}

.popup-min:hover {
    background: rgba(255,255,255,.25);
    border-color: rgba(255,255,255,.3);
    transform: scale(1.08);
}

/* --- Estado minimizado --- */
.popup-afectacion-flotante.minimizado {
    width: 320px;
    max-height: none;
    overflow: hidden;
    animation: none;
}

.popup-afectacion-flotante.minimizado .popup-header {
    padding: 10px 16px;
}

.popup-afectacion-flotante.minimizado .popup-contenido {
    display: none;
}

.popup-afectacion-flotante.minimizado .popup-header-titulo {
    font-size: 12px;
}

/* --- Contenido scrollable --- */
.popup-contenido {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 40px);
}

.popup-contenido::-webkit-scrollbar {
    width: 5px;
}

.popup-contenido::-webkit-scrollbar-track {
    background: transparent;
}

.popup-contenido::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.popup-contenido::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Resumen / Counter --- */
.popup-resumen {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    position: relative;
    overflow: hidden;
}

.popup-resumen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
}

.popup-numero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
    color: #fff;
    font-size: 36px;
    font-weight: 900;
    padding: 8px 20px;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow:
        0 4px 12px rgba(37,99,235,.35),
        inset 0 1px 0 rgba(255,255,255,.2);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: -1px;
    line-height: 1;
}

.popup-cantidad-texto {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.popup-subtexto {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
}

/* --- Tabs --- */
.popup-tabs {
    display: flex;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 16px;
    gap: 0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 4px;
}

.popup-tab {
    flex: 1;
    padding: 9px 6px;
    border: none;
    background: transparent;
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    transition: all .25s ease;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.popup-tab:hover {
    color: #475569;
    background: rgba(255,255,255,.8);
}

.popup-tab-activa {
    color: #dc2626;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* --- Subtabs (sismos/incendios) --- */
.popup-subtabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 10px;
}

.popup-subtab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all .25s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.popup-subtab i {
    font-size: 11px;
}

.popup-subtab:hover {
    color: #334155;
    background: rgba(255,255,255,.6);
}

.popup-subtab-activa {
    color: #fff;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 2px 6px rgba(220,38,38,.25);
}

.popup-subtab-contenido {
    font-size: 13px;
    line-height: 1.6;
}

/* --- Contenido tabs --- */
.popup-tab-contenido {
    font-size: 13px;
    line-height: 1.6;
}

/* --- Tarjeta de dato --- */
.popup-dato-item {
    padding: 14px;
    background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid #fecaca;
    transition: all .25s ease;
    position: relative;
    overflow: hidden;
}

.popup-dato-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #dc2626, #ef4444);
    border-radius: 0 2px 2px 0;
}

.popup-dato-item:hover {
    box-shadow:
        0 4px 12px rgba(220,38,38,.08),
        0 1px 3px rgba(0,0,0,.04);
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.popup-dato-item:last-child {
    margin-bottom: 0;
}

.popup-dato-tipo {
    font-size: 14px;
    font-weight: 800;
    color: #991b1b;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-dato-tipo i {
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc2626;
    color: #fff;
    border-radius: 8px;
    flex-shrink: 0;
}

.popup-dato-campo {
    font-size: 12.5px;
    color: #334155;
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.popup-dato-campo:last-of-type {
    margin-bottom: 0;
}

.popup-dato-campo i {
    font-size: 10px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    flex-shrink: 0;
    color: #dc2626;
    background: #fee2e2;
    border-radius: 5px;
}

.popup-dato-campo span {
    color: #64748b;
    font-weight: 600;
}

/* --- Evidencias --- */
.popup-dato-fotos {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #fca5a5;
    font-size: 12px;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.popup-dato-fotos i {
    color: #fff;
    font-size: 12px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #334155;
    border-radius: 6px;
}

/* --- Sin datos --- */
.popup-sin-datos {
    text-align: center;
    padding: 28px 16px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

.popup-sin-datos::before {
    content: '\f059';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    display: block;
    font-size: 28px;
    color: #cbd5e1;
    margin-bottom: 10px;
}

/* --- Museos cercanos (incendios) --- */
.popup-museos-cercanos {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #fca5a5;
}

.popup-museos-titulo {
    font-size: 12px;
    font-weight: 700;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.popup-museos-titulo i {
    color: #b45309;
    font-size: 13px;
}

.popup-museo-item {
    font-size: 12px;
    color: #334155;
    padding: 6px 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.popup-museo-item:last-child {
    margin-bottom: 0;
}

.popup-museo-item i {
    color: #b45309;
    font-size: 11px;
    flex-shrink: 0;
}

/* ===== FAB: HERRAMIENTAS ===== */
.tool-item:hover {
    background: rgba(255,255,255,.08);
}

.tool-item.active {
    background: #2563eb;
    color: #fff;
}

#fab-tools:hover {
    transform: scale(1.08);
}

/* Ocultar toolbar por defecto de Leaflet.Draw */
.leaflet-draw-toolbar {
    display: none !important;
}

.leaflet-draw-actions {
    display: none !important;
}

.leaflet-draw-edit-edit,
.leaflet-draw-edit-remove {
    display: none !important;
}

.leaflet-draw-tooltip {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.leaflet-draw-tooltip-subtext {
    color: #94a3b8;
}

/* ===== CAPAS DISPONIBLES - Estilos de agrupación ===== */

.grupo-capas {
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.grupo-capas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    color: #1e293b;
    user-select: none;
    border-bottom: 1px solid #e2e8f0;
    letter-spacing: .3px;
    transition: background .15s;
}
.grupo-capas-header:hover {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}
.grupo-capas-header .chevron {
    transition: transform 0.25s ease;
    font-size: 10px;
    color: #94a3b8;
}
.grupo-capas.open .grupo-capas-header .chevron {
    transform: rotate(90deg);
}
.grupo-capas-body {
    display: none;
    padding: 10px 12px 12px;
}
.grupo-capas.open .grupo-capas-body {
    display: block;
}
.grupo-capas-body .layers-section {
    margin-bottom: 10px;
}
.grupo-capas-body .layers-section:last-child {
    margin-bottom: 0;
}
.grupo-capas-body .layers-section h3 {
    font-size: 10px;
    padding: 6px 10px;
    margin-bottom: 6px;
}

/*BUFFER DISEÑO*/

/* ===== ÚLTIMO PELIGRO - Indicadores bajo botones de sismo/incendio ===== */

.ultimo-peligro-container {
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    animation: ultimoPeligroIn .3s ease both;
}

@keyframes ultimoPeligroIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ultimo-peligro-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ultimo-peligro-label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.ultimo-peligro-fecha {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.ultimo-peligro-departamento {
    font-size: 11px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.4;
}

.ultimo-peligro-departamento i {
    font-size: 10px;
    color: #dc2626;
    flex-shrink: 0;
}

.ultimo-peligro-loading {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
}

.spinner-ultimo-peligro {
    width: 10px;
    height: 10px;
    border: 2px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    flex-shrink: 0;
}

.ultimo-peligro-error {
    font-size: 11px;
    color: #dc2626;
    font-style: italic;
    padding: 4px 0;
}

/* Variante para incendio */
.ultimo-peligro-container.incendio .ultimo-peligro-departamento i {
    color: #ea580c;
}

/* === ACCORDION Popup === */
.popup-seccion-accordion {
    margin-top: 6px;
    border-radius: 6px;
}
.popup-seccion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    user-select: none;
    transition: background 0.2s;
    border-radius: 6px;
}
.popup-seccion-header:hover {
    filter: brightness(0.95);
}
.popup-seccion-header .popup-seccion-chevron {
    transition: transform 0.2s;
    font-size: 10px;
    flex-shrink: 0;
    margin-left: 8px;
}
.popup-seccion-accordion.abierto .popup-seccion-header .popup-seccion-chevron {
    transform: rotate(180deg);
}
.popup-seccion-body {
    display: none;
}
.popup-seccion-accordion.abierto .popup-seccion-body {
    display: block;
}
.popup-seccion-body-inner {
    padding: 4px 8px 8px 8px;
}


/* Pocos puntos */
.marker-cluster-small {
    background-color: rgba(37, 99, 235, 0.35) !important;
}

.marker-cluster-small div {
    background-color: #2563eb !important;
    color: #fff !important;
}

/* Cantidad media */
.marker-cluster-medium {
    background-color: rgba(124, 58, 237, 0.35) !important;
}

.marker-cluster-medium div {
    background-color: #7c3aed !important;
    color: #fff !important;
}

/* Muchos puntos */
.marker-cluster-large {
    background-color: rgba(220, 38, 38, 0.35) !important;
}

.marker-cluster-large div {
    background-color: #dc2626 !important;
    color: #fff !important;
}


/* Fondo del mapa oscuro: la costura deja de verse blanca */
.leaflet-container {
    background: #0b2a3a !important;
}

/* Evita la rendija entre tiles */
.leaflet-tile {
    outline: 1px solid transparent;
    margin: -0.5px 0 0 -0.5px;
    width: 256.5px !important;
    height: 256.5px !important;
}


.icono-foco-calor {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 4px;
}

/* ===== CONTENEDOR DE LA IMAGEN DEL MAPA (solo impresión) ===== */
#print-map-img {
    display: none;
}
@media print {
    html, body {
        margin: 0 !important;
        background: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .no-print,
    .aside-icon-bar,
    #slide-panel,
    #tools-panel,
    #fab-tools,
    .map-title-floating,
    #descarga-overlay,
    .toast,
    .leaflet-control-container,
    .leaflet-control-zoom,
    .leaflet-control-attribution,
    .leaflet-control-layers,
    .print-modal {
        display: none !important;
    }

    #print-header {
        display: block !important;
        position: static !important;
        width: 100% !important;
    }
    #print-header .print-header-inner {
        display: flex;
        align-items: center;
        gap: 14px;
        background: #fff;
        border-bottom: 2px solid #dc2626;
        padding: 0 0 8px 0;
        margin-bottom: 8px;
    }
    #print-header .print-titulo {
        text-align: center;
        margin: 4px 0 8px 0;
    }

    html.imprimiendo,
    html.imprimiendo body {
        height: auto !important;
        overflow: visible !important;
    }
    html.imprimiendo body {
        display: block !important;
        padding: 12mm !important;
        box-sizing: border-box;
    }
    html.imprimiendo #mapa-wrap {
        display: none !important;
    }
    html.imprimiendo #print-map-img {
        display: block !important;
        margin: 0 auto;
    }
    #print-map-img img {
        width: 100%;
        height: 100%;
        object-fit: fill;
        display: block;
    }
}

/* ===== MODAL DE IMPRESIÓN ===== */
.print-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.print-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
}
.print-modal-content {
    position: relative;
    z-index: 1;
    width: 360px;
    max-width: 92vw;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}
.print-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 14px;
}
.print-modal-cerrar {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.print-modal-cerrar:hover {
    color: #fff;
}
.print-modal-campo {
    margin-bottom: 12px;
}
.print-modal-campo label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #94a3b8;
    margin-bottom: 6px;
}
.print-modal-campo input,
.print-modal-campo select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 13px;
    box-sizing: border-box;
}
.print-modal-campo select {
    cursor: pointer;
}
.print-modal-nota {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 14px;
    line-height: 1.4;
}
.print-modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.print-modal-btn-secundario {
    padding: 8px 14px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: transparent;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.print-modal-btn-secundario:hover {
    background: rgba(255, 255, 255, 0.06);
}
.print-modal-btn-primario {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.print-modal-btn-primario:hover {
    background: #1d4ed8;
}

/* ===== ENCABEZADO DE IMPRESIÓN (oculto en pantalla) ===== */
.print-only {
    display: none !important;
}
#print-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
}
.print-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
}
.print-logo {
    height: 32px;
    width: auto;
}
.print-textos {
    flex: 1;
}
.print-sistema {
    font-size: 12px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.print-titulo {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    margin-top: 2px;
}

/* ===== TAMAÑO DE PÁGINA (solo afecta la impresión) ===== */
html.papel-a4 @page {
    size: A4;
    margin: 12mm;
}
html.papel-a3 @page {
    size: A3;
    margin: 12mm;
}

/* ===== IMPRESIÓN ===== */
@media print {
    body {
        background: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .no-print,
    .aside-icon-bar,
    #slide-panel,
    #tools-panel,
    #fab-tools,
    .map-title-floating,
    #descarga-overlay,
    .toast,
    .leaflet-control-container,
    .leaflet-control-zoom,
    .leaflet-control-attribution,
    .print-modal {
        display: none !important;
    }
    #print-header {
        display: block !important;
        position: static !important;
    }
    #print-header .print-header-inner {
        background: #fff;
        border-bottom: 2px solid #dc2626;
        padding: 10px 0;
        margin-bottom: 8px;
    }
    #mapa-wrap,
    #map {
        position: static !important;
        width: 100% !important;
        height: 220mm !important;
        margin: 0 !important;
        background: #fff !important;
    }
    .leaflet-container {
        background: #ffffff !important;
    }
}

.spinner-filtros {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #ccc;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin-filtros 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}
@keyframes spin-filtros {
    to { transform: rotate(360deg); }
}

/*CERRAR POPPUPS*/
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.btn-cerrar-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.btn-cerrar-panel:hover {
    background: rgba(255, 255, 255, 0.18);
}
/* ==========================================================
   MÓVIL (≤ 768px): barra inferior + panel como hoja inferior
   Debe ir AL FINAL del archivo. Todo está dentro del @media,
   así que el escritorio queda con sus estilos originales.
   ========================================================== */
   @media (max-width: 768px) {

    :root { --nav-h: 60px; }

    body {
        display: block;
        height: 100dvh;
    }

    /* ---- Barra de iconos: abajo, horizontal ---- */
    .aside-icon-bar {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        width: 100%; min-width: 0;
        height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        flex-direction: row;
        align-items: stretch;
        box-shadow: 0 -4px 16px rgba(0,0,0,.25);
        z-index: 1100;
    }
    .aside-icon-bar .logo-box {
        width: 56px; height: 100%;
        padding: 6px;
        border-bottom: none;
        border-right: 1px solid rgba(255,255,255,.08);
        flex-shrink: 0;
    }
    .aside-icon-bar .logo-box img { width: 40px; height: 40px; }

    .aside-icon-bar .nav-icons {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        gap: 0;
        padding-top: 0;
        height: 100%;
    }
    .aside-icon-bar .nav-icon {
        flex: 1;
        width: auto; height: 100%;
        border-radius: 0;
    }
    .aside-icon-bar .nav-icon.active::before {
        left: 50%; top: 0;
        transform: translateX(-50%);
        width: 28px; height: 3px;
        border-radius: 0 0 3px 3px;
    }
    .aside-icon-bar .nav-bottom { display: none; }

    /* ---- Mapa: pantalla completa sobre la barra ---- */
    #mapa-wrap {
        position: fixed;
        top: 0; left: 0; right: 0;
        bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
        height: auto;
        width: 100%;
    }

    /* ---- Panel: hoja inferior que se superpone al mapa ---- */
    .aside-slide-panel {
        position: fixed;
        left: 0; right: 0;
        bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
        width: 100%;
        height: 0;
        border-right: none;
        border-radius: 16px 16px 0 0;
        transition: height .25s ease;
        z-index: 1050;
    }
    .aside-slide-panel.open {
        width: 100%;
        height: 65dvh;
        max-height: calc(100dvh - var(--nav-h) - 80px);
        box-shadow: 0 -8px 24px rgba(0,0,0,.25);
    }

  

    /* Scroll del panel */
    .aside-slide-panel .panel-content { height: 100%; }
    .aside-slide-panel .panel-inner {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .aside-slide-panel .panel-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 12px 12px 24px;
    }

    /* ---- Capas compactas (SOLO móvil) ---- */
    .panel-header { padding: 10px 14px; border-radius: 16px 16px 0 0; }
    .panel-header h2 { font-size: 14px; }

    .grupo-capas { margin-bottom: 8px; }
    .grupo-capas-header { padding: 7px 10px; font-size: 11px; }
    .grupo-capas-body { padding: 6px 8px 8px; }

    .layers-section { margin-bottom: 8px; }
    .layers-section h3,
    .grupo-capas-body .layers-section h3 {
        font-size: 10px;
        padding: 5px 8px;
        margin-bottom: 4px;
    }

    .layer-item { padding: 3px 6px; gap: 8px; margin-bottom: 0; }
    .layer-item .layer-label { font-size: 11.5px; line-height: 1.25; }
    .layer-item .toggle { width: 32px; height: 17px; border-radius: 10px; }
    .layer-item .toggle::after { width: 13px; height: 13px; top: 2px; left: 2px; }
    .layer-item input:checked + .toggle::after { transform: translateX(15px); }

    .ultimo-peligro-container { margin-top: 4px; padding: 6px 10px; }
    .ultimo-peligro-fecha { font-size: 11px; }
    .ultimo-peligro-label { font-size: 9px; }

    .aviso-title { padding: 7px 10px; }
    .aviso-title strong { font-size: 12px; }

    /* ---- Título compacto con degradado ---- */
    .map-title-floating,
    .map-title-floating.shifted {
        padding: 8px 64px 18px 12px;
        min-height: 0;
        background: linear-gradient(to bottom, rgba(0,0,0,.65), rgba(0,0,0,0));
    }
    .map-title-floating h1 { font-size: 15px; line-height: 1.2; letter-spacing: 0; }
    .map-title-floating p  { font-size: 12px; line-height: 1.2; letter-spacing: 0; }

    /* ---- Controles de Leaflet ---- */
    .leaflet-control-zoom { display: none; }
    .leaflet-top.leaflet-right { top: 6px; }

    /* ---- Botón de herramientas ---- */
    #fab-tools {
        right: 12px !important;
        bottom: 16px !important;
        width: 48px !important;
        height: 48px !important;
    }
    #tools-panel {
        right: 12px !important;
        bottom: 74px !important;
    }

    /* ---- Popup flotante de afectación ---- */
    .popup-afectacion-flotante {
        left: 10px; right: 10px; bottom: 10px;
        width: auto;
        max-height: 60%;
    }
    .popup-afectacion-flotante.minimizado { width: auto; }

    /* ---- Toast por encima de la barra ---- */
    .toast { bottom: calc(var(--nav-h) + 16px); max-width: 90vw; text-align: center; }

    /* ---- Filtros horizontales: no se usan en móvil ---- */
    .horizontal-filters-wrapper { display: none !important; }
}