:root {
    --bg: #0b1220;
    --panel: rgba(15, 23, 42, 0.92);
    --border: rgba(148, 163, 184, 0.22);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #ec4899;
}

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

html, body { height: 100%; }

body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

#map { position: fixed; inset: 0; background: var(--bg); }

.brand {
    position: fixed;
    top: 12px;
    left: 56px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.brand strong { font-size: 14px; letter-spacing: 1px; }
.brand span { font-size: 10px; color: var(--muted); }

.panel {
    position: fixed;
    z-index: 1000;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.panel h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 10px;
}

.panel h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin: 12px 0 6px;
}

.panel h3 small { font-weight: 400; }

.muted { color: var(--muted); font-size: 12px; }

#layer-panel { top: 12px; right: 12px; width: 230px; max-height: 44vh; display: flex; flex-direction: column; }
.layer-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }

.layer-actions { margin-bottom: 8px; }

.layer-actions button {
    width: 100%;
    padding: 5px 8px;
    font-size: 11px;
    color: var(--text);
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}
.layer-actions button:hover { border-color: var(--accent); }

.layer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    cursor: pointer;
    padding: 3px 4px;
    border-radius: 6px;
}
.layer-row:hover { background: rgba(148, 163, 184, 0.12); }
.layer-row input { accent-color: var(--accent); }

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: 0 0 6px currentColor;
}

#hud { left: 12px; bottom: 12px; width: 320px; max-height: 60vh; overflow-y: auto; }

.hud-name { font-size: 18px; font-weight: 700; line-height: 1.2; }
.hud-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.metric {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric span { font-size: 10px; color: var(--muted); }
.metric strong { font-size: 15px; }

.act-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.15);
}
.act-row span { color: var(--muted); }
.act-row b { font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }

.chip {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #bae6fd;
}

.hud-status { font-size: 11px; margin-top: 10px; color: var(--muted); min-height: 14px; }
.hud-status.error { color: #fca5a5; }

#radius-panel { right: 12px; bottom: 12px; width: 230px; }

.radius-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.radius-head strong { color: var(--text); }

#radio-slider { width: 100%; margin: 10px 0 6px; accent-color: var(--accent); }

.radius-buttons { display: flex; gap: 6px; }

.radius-buttons button {
    flex: 1;
    padding: 5px 0;
    font-size: 12px;
    color: var(--text);
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}
.radius-buttons button:hover { border-color: var(--accent); }
.radius-buttons button.active { background: var(--accent); border-color: var(--accent); color: #0b1220; font-weight: 700; }

/* Marcadores de entidades */
.entity-icon { background: transparent; border: none; }

.dot {
    display: block;
    border-radius: 50%;
    background: var(--c);
    border: 2px solid rgba(11, 18, 32, 0.9);
    box-shadow: 0 0 8px var(--c);
    position: relative;
}

.dot.pulse::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid var(--c);
    animation: halo 1.8s ease-out infinite;
    pointer-events: none;
}

@keyframes halo {
    0% { transform: scale(0.55); opacity: 0.95; }
    70% { opacity: 0.25; }
    100% { transform: scale(2.1); opacity: 0; }
}

/* Marcador de centro del análisis */
.center-icon { background: transparent; border: none; }
.center-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.9);
}

/* Popups */
.leaflet-popup-content-wrapper {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { font-size: 12px; line-height: 1.45; }
.popup-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.popup-meta { color: var(--muted); }

.leaflet-control-attribution { background: rgba(11, 18, 32, 0.7) !important; color: #64748b !important; }
.leaflet-control-attribution a { color: #94a3b8 !important; }

@media (max-width: 900px) {
    #hud { width: 280px; }
    #layer-panel { width: 190px; }
    #radius-panel { width: 190px; }
}
