/* ==========================================================================
   RADAR PERÚ — Panel de análisis meteorológico
   ========================================================================== */

:root {
    --bg: #070b14;
    --bg-2: #0a1120;
    --panel: #0d1628;
    --panel-2: #111e34;
    --panel-3: #17253f;
    --line: rgba(160, 178, 203, .17);
    --line-strong: rgba(160, 178, 203, .31);
    --text: #f3f7ff;
    --text-2: #d9e4f5;
    --muted: #adbacd;
    --muted-2: #8c9db6;
    --cyan: #22d3ee;
    --cyan-soft: rgba(34, 211, 238, .14);
    --violet: #9aa4ff;
    --green: #34d399;
    --amber: #fbbf24;
    --red: #f87171;
    --magenta: #e879f9;
    --radius: 15px;
    --radius-sm: 11px;
    --topbar-h: 68px;
    --timeline-h: 102px;
    --shadow: 0 20px 52px rgba(0, 0, 0, .5);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    background:
        radial-gradient(900px 600px at 18% -10%, rgba(34, 211, 238, .07), transparent 60%),
        radial-gradient(800px 600px at 100% 0%, rgba(129, 140, 248, .08), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button, select, input { font: inherit; }
button { color: inherit; }
a { color: var(--cyan); }

::selection { background: rgba(34, 211, 238, .3); }

/* Scrollbars ------------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .26) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .22);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .38); background-clip: padding-box; }

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 5000;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--cyan);
    color: #04121a;
    font-weight: 700;
    text-decoration: none;
    transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* Layout ----------------------------------------------------------------- */
.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
}

.workspace {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 464px;
    min-height: 0;
    position: relative;
}

/* Topbar ----------------------------------------------------------------- */
.topbar {
    height: var(--topbar-h);
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 0 14px 0 16px;
    background: var(--header-bg, rgba(8, 13, 24, .9));
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    z-index: 1800;
}

.topbar__left,
.topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.topbar__right { justify-self: end; }
.topbar__center {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.brand__mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: radial-gradient(circle at 30% 20%, rgba(34, 211, 238, .16), rgba(129, 140, 248, .08));
    border: 1px solid rgba(34, 211, 238, .18);
    box-shadow: inset 0 0 18px rgba(34, 211, 238, .08);
}
.brand__mark.brand__mark--wide { width: 104px; height: 54px; }
.brand__mark.brand__mark--wide img, .brand__mark.brand__mark--wide .brand__tint { width: 96px; height: 46px; }
.brand__mark svg { width: 30px; height: 30px; display: block; }
.brand__mark img { width: 30px; height: 30px; display: block; object-fit: contain; }
.brand__mark picture { display: block; }
.brand__tint { display: block; width: 30px; height: 30px; background: var(--brand-dark-color, #fff); -webkit-mask: var(--brand-dark-image) center / contain no-repeat; mask: var(--brand-dark-image) center / contain no-repeat; }
body[data-header-theme="light"] .brand__tint { background: var(--brand-light-color, #165caa); -webkit-mask-image: var(--brand-light-image); mask-image: var(--brand-light-image); }
@media (prefers-color-scheme: light) {
    body[data-header-theme="auto"] .brand__tint { background: var(--brand-light-color, #165caa); -webkit-mask-image: var(--brand-light-image); mask-image: var(--brand-light-image); }
}
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .13em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--header-strong, inherit);
}
.brand__title em {
    font-style: normal;
    background: linear-gradient(120deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.brand__sub {
    font-size: 10.5px;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--header-muted, var(--muted-2));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 8px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .025);
    color: var(--header-muted, var(--muted));
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}
.status-pill__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-2);
    flex: 0 0 auto;
}
.status-pill[data-state="live"] { color: var(--header-live, #a7f3d0); border-color: rgba(52, 211, 153, .3); }
.status-pill[data-state="live"] .status-pill__dot {
    background: var(--green);
    box-shadow: 0 0 9px rgba(52, 211, 153, .9);
    animation: dotPulse 2s infinite;
}
.status-pill[data-state="stale"] { color: var(--header-stale, #fde68a); border-color: rgba(251, 191, 36, .3); }
.status-pill[data-state="stale"] .status-pill__dot { background: var(--amber); box-shadow: 0 0 9px rgba(251, 191, 36, .8); }
.status-pill[data-state="error"] { color: var(--header-error, #fecaca); border-color: rgba(248, 113, 113, .35); }
.status-pill[data-state="error"] .status-pill__dot { background: var(--red); box-shadow: 0 0 9px rgba(248, 113, 113, .8); }

.time-readout {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.time-readout__local {
    font-family: var(--mono);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--header-strong, #f5fbff);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 24px rgba(34, 211, 238, .22);
}
.time-readout__meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-size: 11px;
    color: var(--header-muted, var(--muted));
    letter-spacing: .03em;
    font-family: var(--mono);
}
.time-readout__tz { color: var(--header-muted, var(--muted-2)); font-size: 10px; letter-spacing: .08em; }
.time-utc {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--header-muted, var(--muted-2));
    padding-left: 14px;
    border-left: 1px solid var(--line);
    letter-spacing: .03em;
}

.refresh-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
    color: var(--header-muted, var(--muted));
    font-family: var(--mono);
    font-size: 11.5px;
    background: rgba(255, 255, 255, .02);
}
.refresh-chip svg { width: 13px; height: 13px; }

/* Icon buttons ----------------------------------------------------------- */
.icon-btn { 
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .025);
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
    flex: 0 0 auto;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover {
    border-color: rgba(34, 211, 238, .42);
    background: rgba(34, 211, 238, .08);
    color: #e7feff;
}
.icon-btn:active { transform: scale(.95); }
.icon-btn:focus-visible { outline: 2px solid rgba(34, 211, 238, .65); outline-offset: 2px; }
.icon-btn--tiny { width: 24px; height: 24px; border-radius: 7px; }
.icon-btn--tiny svg { width: 14px; height: 14px; }

/* Sólo la cabecera cambia de fondo; el mapa base se configura por separado. */
body[data-header-theme="light"] {
    --header-bg: #f8fbff;
    --header-strong: #163a69;
    --header-muted: #466281;
    --header-live: #08754a;
    --header-stale: #885400;
    --header-error: #a32935;
    --header-border: #c8d8e9;
}
@media (prefers-color-scheme: light) {
    body[data-header-theme="auto"] {
        --header-bg: #f8fbff;
        --header-strong: #163a69;
        --header-muted: #466281;
        --header-live: #08754a;
        --header-stale: #885400;
        --header-error: #a32935;
        --header-border: #c8d8e9;
    }
}
.topbar {
    color: var(--header-strong, inherit);
    border-bottom-color: var(--header-border, var(--line));
}
.topbar .icon-btn,
.topbar .status-pill,
.topbar .refresh-chip { color: var(--header-muted, var(--text-2)); border-color: var(--header-border, var(--line)); }
.topbar .icon-btn:hover { color: var(--header-strong, #e7feff); }
.topbar .time-utc { border-left-color: var(--header-border, var(--line)); }
.topbar .status-pill[data-state="live"] { color: var(--header-live, #a7f3d0); }
.topbar .status-pill[data-state="stale"] { color: var(--header-stale, #fde68a); }
.topbar .status-pill[data-state="error"] { color: var(--header-error, #fecaca); }

.only-mobile { display: none; }

/* Sidebar ---------------------------------------------------------------- */
.sidebar {
    background: linear-gradient(180deg, #0a1324 0%, #080e1a 100%);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 16px 16px 0;
    z-index: 1200;
}

.panel-section {
    padding: 17px 0 18px;
    border-bottom: 1px solid var(--line);
}
.panel-section:first-child { padding-top: 2px; }
.panel-section--alerts { border-bottom: 0; }

.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 11px;
}

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 5px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(3, 8, 16, .55);
}
.segmented button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 9px 6px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.segmented button:hover { color: var(--text-2); background: rgba(255, 255, 255, .04); }
.segmented button.is-active {
    color: #d9fbff;
    background: linear-gradient(180deg, rgba(34, 211, 238, .22), rgba(34, 211, 238, .09));
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .42), 0 4px 14px rgba(34, 211, 238, .12);
}
.segmented button:focus-visible { outline: 2px solid rgba(34, 211, 238, .6); outline-offset: 1px; }

.hint {
    margin: 10px 0 0;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.55;
}

.ref-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* Fields ----------------------------------------------------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 13px;
}
.field:last-child { margin-bottom: 0; }
.field > span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}
.field output {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0;
    color: var(--text-2);
}

select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background-color: rgba(4, 9, 18, .72);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238ea0bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    color: var(--text);
    padding: 10px 34px 10px 12px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
select:hover { border-color: var(--line-strong); background-color: rgba(9, 16, 30, .9); }
select:focus {
    outline: none;
    border-color: rgba(34, 211, 238, .55);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .12);
}
select option { background: #0c1526; color: var(--text); }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    opacity: .85;
}
input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    background: #f0fdff;
    border: 2px solid #0891b2;
    box-shadow: 0 0 10px rgba(34, 211, 238, .65);
}
input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f0fdff;
    border: 2px solid #0891b2;
    box-shadow: 0 0 10px rgba(34, 211, 238, .65);
}
input[type="range"]:focus-visible { outline: 2px solid rgba(34, 211, 238, .5); outline-offset: 2px; border-radius: 8px; }

/* Switches --------------------------------------------------------------- */
.switch {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 0;
    cursor: pointer;
    user-select: none;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.switch__ui {
    position: relative;
    width: 34px;
    height: 19px;
    flex: 0 0 auto;
    border-radius: 99px;
    background: #1a2538;
    border: 1px solid var(--line-strong);
    transition: background .18s ease, border-color .18s ease;
}
.switch__ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #94a3b8;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.switch input:checked + .switch__ui {
    background: rgba(34, 211, 238, .2);
    border-color: rgba(34, 211, 238, .55);
}
.switch input:checked + .switch__ui::after {
    transform: translateX(15px);
    background: var(--cyan);
    box-shadow: 0 0 10px rgba(34, 211, 238, .8);
}
.switch input:focus-visible + .switch__ui { outline: 2px solid rgba(34, 211, 238, .6); outline-offset: 2px; }
.switch__label { font-size: 13px; color: var(--text-2); line-height: 1.4; }

/* Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .035);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    padding: 9px 13px;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .12s ease;
}
.btn:hover {
    border-color: rgba(34, 211, 238, .4);
    background: rgba(34, 211, 238, .08);
    color: #e7feff;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid rgba(34, 211, 238, .6); outline-offset: 2px; }
.btn--ghost { background: rgba(255, 255, 255, .025); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn--icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .03);
}
.btn--icon svg { width: 16px; height: 16px; fill: currentColor; }
.btn--play {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, #22d3ee, #818cf8);
    color: #04121a;
    box-shadow: 0 7px 22px rgba(34, 211, 238, .32);
}
.btn--play svg { width: 20px; height: 20px; fill: currentColor; }
.btn--play .icon-pause { display: none; }
.btn--play.is-playing .icon-play { display: none; }
.btn--play.is-playing .icon-pause { display: block; }
.btn--play:hover { filter: brightness(1.08); }
.btn--live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(52, 211, 153, .32);
    background: rgba(52, 211, 153, .08);
    color: #6ee7b7;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .1em;
    cursor: pointer;
    transition: all .18s ease;
}
.btn--live .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: dotPulse 1.8s infinite;
}
.btn--live.is-live {
    background: rgba(52, 211, 153, .18);
    border-color: rgba(52, 211, 153, .6);
    color: #d1fae5;
}
.btn--live:hover { background: rgba(52, 211, 153, .16); }

.badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .14);
    color: var(--muted);
    font-size: 10.5px;
    font-family: var(--mono);
    letter-spacing: 0;
}
.badge.has-alerts { background: rgba(248, 113, 113, .18); color: #fecaca; }

/* Alerts ----------------------------------------------------------------- */
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item {
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    border-radius: 10px;
    padding: 9px 11px;
    background: rgba(251, 191, 36, .045);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.alert-item:hover { background: rgba(251, 191, 36, .09); }
.alert-item[data-sev="severe"] {
    border-left-color: var(--red);
    background: rgba(248, 113, 113, .06);
}
.alert-item[data-sev="severe"]:hover { background: rgba(248, 113, 113, .12); }
.alert-item__title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.alert-item__meta { font-size: 11px; color: var(--muted-2); margin-top: 3px; font-family: var(--mono); line-height: 1.45; }

.sidebar__footer {
    padding: 14px 0 16px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted-2);
    font-size: 10.5px;
    letter-spacing: .02em;
}

/* Map -------------------------------------------------------------------- */
.map-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: #05080f;
    overflow: hidden;
}
.map { position: absolute; inset: 0; z-index: 1; }
.map-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 400;
    pointer-events: none;
    background: radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(2, 5, 10, .25) 100%);
}

/* Layer control ---------------------------------------------------------- */
.layer-control {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 700;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}
.layer-control > * { pointer-events: auto; }
.layer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 13px;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 11px;
    background: rgba(9, 15, 28, .93);
    color: #dbeafe;
    font: 600 12px/1 var(--font);
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .38);
    backdrop-filter: blur(10px);
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.layer-toggle svg { width: 18px; height: 18px; color: #67e8f9; }
.layer-toggle:hover { border-color: rgba(34, 211, 238, .5); background: rgba(8, 32, 48, .95); }
.layer-toggle:active { transform: translateY(1px); }
.layer-toggle:focus-visible { outline: 2px solid rgba(34, 211, 238, .7); outline-offset: 2px; }
.layer-toggle[aria-expanded="true"] {
    border-color: rgba(34, 211, 238, .55);
    background: rgba(8, 47, 73, .96);
}
.layer-toggle__dot {
    width: 7px;
    height: 7px;
    margin-left: 1px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 9px rgba(34, 211, 238, .9);
}
.layer-toggle__dot[hidden] { display: none; }

.layers-panel {
    width: min(340px, calc(100vw - 24px));
    max-height: calc(100vh - var(--topbar-h) - var(--timeline-h) - 68px);
    overflow: auto;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(7, 12, 24, .99));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .58);
    color: var(--text-2);
    backdrop-filter: blur(16px);
    overscroll-behavior: contain;
}
.layers-panel[hidden] { display: none; }
.layers-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.layers-panel__head strong {
    display: block;
    margin-top: 2px;
    color: #f0f9ff;
    font-size: 15px;
    line-height: 1.2;
}
.layers-section {
    padding: 11px 0;
    border-top: 1px solid rgba(148, 163, 184, .14);
}
.layers-section:first-of-type { border-top: 0; }
.layers-section__title {
    margin-bottom: 8px;
    color: #7dd3fc;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.layers-section .switch { margin-top: 7px; }
.layers-section .switch:first-of-type { margin-top: 0; }
.layers-section .hint { margin: 8px 0 0; }
.layer-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.layer-choice {
    min-height: 34px;
    padding: 7px 8px;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
    color: var(--text-2);
    font: 500 12px/1.2 var(--font);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.layer-choice:hover { border-color: rgba(34, 211, 238, .36); color: #e0f2fe; }
.layer-choice.is-active {
    border-color: rgba(34, 211, 238, .62);
    background: rgba(34, 211, 238, .13);
    color: #ecfeff;
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .1);
}
.layer-choice:focus-visible { outline: 2px solid rgba(34, 211, 238, .6); outline-offset: 1px; }
.layers-satellite {
    display: grid;
    gap: 8px;
    margin-top: 11px;
}
.layers-satellite[hidden] { display: none; }
.layers-satellite .field { margin: 0; }
.layers-satellite .field > span { font-size: 11px; }
.layers-satellite .field select { font-size: 12px; }
.layers-panel__foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, .14);
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}
.layers-panel__note { color: #475569; }

.leaflet-container {
    background: #05080f;
    font-family: var(--font);
    outline: none;
}
.leaflet-control-zoom a {
    background: rgba(9, 15, 28, .92) !important;
    color: #dbeafe !important;
    border-color: var(--line) !important;
    backdrop-filter: blur(8px);
}
.leaflet-control-zoom a:hover { background: rgba(34, 211, 238, .16) !important; }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: 0 8px 26px rgba(0, 0, 0, .4) !important; }
.leaflet-control-attribution {
    background: rgba(5, 8, 15, .72) !important;
    color: #64748b !important;
    font-size: 9px !important;
    padding: 2px 6px !important;
}
.leaflet-control-attribution a { color: #94a3b8 !important; }
.leaflet-popup-content-wrapper {
    background: #0d1526;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.leaflet-popup-content { margin: 12px 14px; font-size: 12px; }
.leaflet-popup-tip { background: #0d1526; }
.leaflet-popup-close-button { color: var(--muted) !important; }

.map-hud {
    position: absolute;
    z-index: 620;
    pointer-events: none;
}
.map-hud--top-left { top: 16px; left: 16px; }

.hud-card {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 148px;
    padding: 11px 14px;
    border-radius: var(--radius);
    background: rgba(9, 15, 28, .8);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.hud-card__label {
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.hud-card__value {
    font-family: var(--mono);
    font-size: 27px;
    font-weight: 600;
    line-height: 1.15;
    color: #f2fdff;
    font-variant-numeric: tabular-nums;
}
.hud-card__value small { font-size: 12px; color: var(--muted); margin-left: 2px; }
.hud-card__meta { font-size: 10px; color: var(--muted); font-family: var(--mono); }

/* Legend ----------------------------------------------------------------- */
.legend-card {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 620;
    width: min(390px, calc(100% - 32px));
    padding: 9px 12px 10px;
    border-radius: var(--radius);
    background: rgba(9, 15, 28, .82);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.legend-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}
.legend-card__head > span:first-child {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--text-2);
}
.legend-card__unit {
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--muted-2);
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(148, 163, 184, .12);
}
.legend-card__head .icon-btn { margin-left: auto; }
.legend-card.is-collapsed .legend-card__body { display: none; }
.legend-bar {
    display: flex;
    height: 13px;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45);
}
.legend-bar span { flex: 1 1 0; min-width: 0; }
.legend-scale {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    margin-top: 4px;
    font-family: var(--mono);
    font-size: 8.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.legend-scale span { flex: 1 1 0; text-align: center; }
.legend-note {
    margin-top: 5px;
    font-size: 9px;
    color: var(--muted-2);
    letter-spacing: .02em;
}
.legend-help {
    margin-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, .14);
    padding-top: 5px;
}
.legend-help summary {
    cursor: pointer;
    list-style: none;
    font-size: 9px;
    font-weight: 700;
    color: var(--cyan);
    letter-spacing: .02em;
}
.legend-help summary::-webkit-details-marker { display: none; }
.legend-help summary::before {
    content: '+';
    display: inline-block;
    width: 12px;
    font-family: var(--mono);
}
.legend-help[open] summary::before { content: '−'; }
.legend-help__body {
    max-height: 190px;
    overflow-y: auto;
    margin-top: 5px;
    padding-right: 4px;
    font-size: 10px;
    line-height: 1.45;
    color: var(--muted);
}
.legend-help__body p { margin: 0 0 5px; }
.legend-help__body ul { margin: 3px 0 5px; padding-left: 14px; }
.legend-help__body li { margin: 2px 0; }
.legend-help__body strong { color: var(--text-2); }

.map-note {
    position: absolute;
    top: 16px;
    left: 50%;
    bottom: auto;
    transform: translateX(-50%);
    z-index: 610;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: 42%;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(9, 15, 28, .76);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    color: var(--muted);
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity .15s ease, visibility .15s ease;
}
.layer-control.is-open ~ .map-note {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.map-note .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 8px rgba(34, 211, 238, .8);
    flex: 0 0 auto;
}

/* Toasts ----------------------------------------------------------------- */
.toasts {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100% - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    background: rgba(10, 16, 30, .94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.2);
}
.toast[data-sev="severe"] { border-left-color: var(--red); }
.toast[data-sev="info"] { border-left-color: var(--cyan); }
.toast__icon {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(251, 191, 36, .14);
    color: var(--amber);
    font-weight: 800;
    font-size: 12px;
}
.toast[data-sev="severe"] .toast__icon { background: rgba(248, 113, 113, .16); color: var(--red); }
.toast[data-sev="info"] .toast__icon { background: rgba(34, 211, 238, .14); color: var(--cyan); }
.toast__body { min-width: 0; }
.toast__title { font-size: 13px; font-weight: 700; line-height: 1.4; }
.toast__meta { font-size: 11px; color: var(--muted-2); margin-top: 2px; line-height: 1.45; }

/* Loading ---------------------------------------------------------------- */
.loading {
    position: absolute;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(4, 8, 16, .76);
    backdrop-filter: blur(7px);
    color: var(--text);
    transition: opacity .25s ease;
}
.loading[hidden] { display: none !important; }
.loading.is-hiding { opacity: 0; }
.loading__spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: conic-gradient(from 90deg, transparent, var(--cyan), transparent 70%);
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: spin 1s linear infinite;
}
.loading strong { display: block; font-size: 13px; }
.loading span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Insights --------------------------------------------------------------- */
.insights {
    background: linear-gradient(180deg, #0a1324 0%, #080e1a 100%);
    border-left: 1px solid var(--line);
    overflow-y: auto;
    min-height: 0;
    padding: 18px 18px 14px;
    z-index: 1200;
}
.insights__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
}
.insights__head .section-label { margin-bottom: 5px; }
.insights__head h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.25;
    color: #f5f9ff;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 13px 0 16px;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
}
.stat__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.stat strong {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: #f5fbff;
    font-variant-numeric: tabular-nums;
}
.stat small { font-size: 10.5px; color: var(--muted-2); letter-spacing: .03em; }

.insights__section {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}
.insights__section:first-of-type { border-top: 0; }
.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 11px;
}
.section-row .muted { white-space: nowrap; }
.section-row h3 {
    margin: 0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #c3d0e3;
    line-height: 1.4;
}
.muted { font-size: 11px; color: var(--muted-2); font-family: var(--mono); line-height: 1.4; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, .08);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}
.pill[data-tone="good"] { color: #a7f3d0; border-color: rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .1); }
.pill[data-tone="warn"] { color: #fde68a; border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .09); }
.pill[data-tone="bad"] { color: #fecaca; border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .1); }

.insights__section--reading { padding-top: 11px; }
.reading {
    padding: 15px 16px 14px;
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 13px;
    background:
        radial-gradient(120% 130% at 0% 0%, rgba(34, 211, 238, .1), transparent 58%),
        rgba(255, 255, 255, .03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
    transition: opacity .2s ease;
}
.reading.is-pending { opacity: .55; }
.reading__headline {
    margin: 0 0 9px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.32;
    letter-spacing: -.015em;
    color: #f5f9ff;
}
.reading__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.reading__tags:empty { display: none; }
.reading__tag {
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .2);
    background: rgba(148, 163, 184, .08);
    color: #c0ccdc;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .01em;
    white-space: nowrap;
}
.reading__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #d7e2f1;
    white-space: pre-line;
}
.reading__trend {
    margin: 11px 0 0;
    padding: 9px 11px;
    border-left: 2px solid rgba(154, 164, 255, .6);
    border-radius: 0 8px 8px 0;
    background: rgba(129, 140, 248, .08);
    font-size: 12.5px;
    line-height: 1.6;
    color: #d7ddff;
}
.reading__trend[hidden] { display: none; }
.reading__forecast {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(148, 163, 184, .22);
}
.reading__label {
    margin-bottom: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #67e8f9;
}
.reading__forecast p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.65;
    color: #e4ecf9;
}
.reading__tech {
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid rgba(148, 163, 184, .14);
}
.reading__tech summary {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--muted);
    user-select: none;
}
.reading__tech summary::-webkit-details-marker { display: none; }
.reading__tech summary::before {
    content: '+';
    width: 13px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted-2);
}
.reading__tech[open] summary::before { content: '–'; }
.reading__tech ul {
    margin: 8px 0 0;
    padding: 0 0 0 14px;
}
.reading__tech li {
    margin-bottom: 5px;
    font-size: 11.5px;
    line-height: 1.6;
    color: #a9b8cd;
}
.reading__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    margin-top: 11px;
}
.reading__copy {
    padding: 5px 10px;
    border: 1px solid rgba(34, 211, 238, .26);
    border-radius: 8px;
    background: rgba(34, 211, 238, .08);
    color: #a5f3fc;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.reading__copy:hover {
    background: rgba(34, 211, 238, .15);
    border-color: rgba(34, 211, 238, .45);
}
.reading__note {
    flex: 1 1 100%;
    margin-top: 1px;
    text-align: left;
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--muted-2);
}

.reading__ai {
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px dashed rgba(154, 164, 255, .3);
}
.reading__ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}
.reading__ai-title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #c0c6ff;
}
.reading__ai-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: #e0e9f7;
    white-space: pre-line;
}
.reading__ai.is-loading .reading__ai-text {
    color: var(--muted-2);
}
.reading__ai-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 9px;
    margin-top: 9px;
}
.reading__ai-btn {
    padding: 6px 11px;
    border: 1px solid rgba(154, 164, 255, .45);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(34, 211, 238, .18), rgba(129, 140, 248, .22));
    color: #e6ebff;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.reading__ai-btn:hover {
    background: linear-gradient(135deg, rgba(34, 211, 238, .28), rgba(129, 140, 248, .32));
    border-color: rgba(129, 140, 248, .7);
}
.reading__ai-btn:disabled {
    opacity: .5;
    cursor: progress;
}

.cell-hint {
    margin: 0 0 9px;
    color: var(--muted-2);
    font-size: 11.5px;
    line-height: 1.55;
}
.cell-table { display: flex; flex-direction: column; gap: 1px; }
.cell-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 9px 7px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .15s ease;
}
.cell-row:hover { background: rgba(34, 211, 238, .07); }
.cell-row + .cell-row { box-shadow: inset 0 1px 0 rgba(148, 163, 184, .07); }
.cell-rank {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(148, 163, 184, .11);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
}
.cell-main { min-width: 0; }
.cell-main b {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-main span {
    display: block;
    font-size: 10.5px;
    color: var(--muted-2);
    font-family: var(--mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-dbz {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--amber);
    font-variant-numeric: tabular-nums;
}
.cell-dbz small { font-size: 9px; color: var(--muted-2); margin-left: 1px; }

/* Listado de lugares con lluvia --------------------------------------- */
.places-list { display: flex; flex-direction: column; gap: 1px; }
.places-more > summary {
    padding: 10px 7px;
    cursor: pointer;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 600;
}
.place-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 10px 7px;
    border-radius: 9px;
    transition: background .15s ease;
}
.place-row:hover { background: rgba(34, 211, 238, .07); }
.place-row + .place-row { box-shadow: inset 0 1px 0 rgba(148, 163, 184, .07); }
.place-row__head { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex-wrap: wrap; }
.place-row__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.place-row__dist {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--muted-2);
    white-space: nowrap;
}
.place-row__state {
    justify-self: end;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--cyan);
}
.place-row__state[data-tone="warn"] { color: var(--amber); }
.place-row__state[data-tone="bad"] { color: var(--rose, #fb7185); }
.place-row__state[data-tone="muted"] { color: var(--muted-2); }
.place-row__meta {
    grid-column: 1 / -1;
    font-size: 11.5px;
    line-height: 1.55;
    color: #a9b8cd;
    font-family: var(--mono);
}
.place-row__meta em { color: var(--muted); font-style: normal; }
.place-row__badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 5px;
    border: 1px solid var(--line);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .03em;
    color: var(--muted);
    vertical-align: 1px;
}
.places-note {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted-2);
}

/* Fuentes de datos ---------------------------------------------------- */
.sources-list { display: flex; flex-direction: column; gap: 7px; }
.source-item {
    display: grid;
    grid-template-columns: 9px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 8px 3px;
    font-size: 12px;
}
.source-item + .source-item { border-top: 1px solid rgba(148, 163, 184, .08); }
.source-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-2);
}
.source-item__dot[data-state="ok"] { background: var(--green, #34d399); }
.source-item__dot[data-state="stale"] { background: var(--amber); }
.source-item__dot[data-state="visual-only"] { background: var(--violet, #a78bfa); }
.source-item__dot[data-state="unavailable"],
.source-item__dot[data-state="disabled"] { background: var(--muted-2); }
.source-item__name {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.source-item__age {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--muted-2);
    white-space: nowrap;
}
.source-item__note {
    grid-column: 2 / -1;
    font-size: 11px;
    line-height: 1.55;
    color: var(--muted-2);
}

.motion-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
}
.motion-arrow {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 211, 238, .16), transparent 70%);
    color: var(--cyan);
}
.motion-arrow svg { width: 28px; height: 28px; transition: transform .4s ease; }
.motion-meta { min-width: 0; }
.motion-meta strong {
    display: block;
    font-family: var(--mono);
    font-size: 19px;
    font-weight: 600;
    color: #f5fbff;
}
.motion-meta span { font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); line-height: 1.5; }

.chart-wrap { height: 150px; position: relative; }
.chart-wrap canvas { width: 100% !important; height: 150px !important; }
.chart-legend {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
    font-size: 11px;
    color: var(--muted-2);
    letter-spacing: .02em;
}
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.dot--cyan { background: var(--cyan); box-shadow: 0 0 7px rgba(34, 211, 238, .8); }
.dot--violet { background: var(--violet); box-shadow: 0 0 7px rgba(154, 164, 255, .8); margin-left: 8px; }

.nowcast-body { display: flex; flex-direction: column; gap: 9px; }
.nowcast-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.nowcast-cell {
    padding: 9px 5px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(129, 140, 248, .06);
    text-align: center;
}
.nowcast-cell b {
    display: block;
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    color: #e4ecff;
}
.nowcast-cell span {
    display: block;
    font-size: 10.5px;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}
.nowcast-note {
    font-size: 11.5px;
    color: var(--muted-2);
    line-height: 1.55;
    margin: 0;
}

.outlook { display: flex; flex-direction: column; gap: 10px; }
.outlook__summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 11px;
    border: 1px solid rgba(34, 211, 238, .18);
    border-radius: 10px;
    background: rgba(34, 211, 238, .055);
}
.outlook__summary strong {
    font-size: 13.5px;
    line-height: 1.5;
    color: #e6f6ff;
}
.outlook__summary span {
    font-size: 11.5px;
    color: var(--muted-2);
    line-height: 1.5;
}
.outlook__grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
}
.outlook__hour {
    padding: 7px 4px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
    text-align: center;
}
.outlook__hour.is-wet {
    border-color: rgba(56, 189, 248, .4);
    background: rgba(56, 189, 248, .11);
}
.outlook__time,
.outlook__mm,
.outlook__prob {
    display: block;
    font-family: var(--mono);
    line-height: 1.4;
}
.outlook__time { font-size: 10.5px; color: var(--muted-2); }
.outlook__mm { font-size: 12.5px; font-weight: 700; color: #e4ecf9; }
.outlook__hour.is-wet .outlook__mm { color: #8bdcff; }
.outlook__prob { font-size: 10.5px; color: var(--muted-2); }
.outlook__credit {
    margin: 9px 0 0;
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--muted-2);
}
.outlook__env {
    padding: 10px 11px;
    border: 1px solid rgba(154, 164, 255, .2);
    border-radius: 10px;
    background: rgba(99, 102, 241, .07);
}
.outlook__env-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.outlook__env-head span {
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted-2);
    line-height: 1.4;
}
.outlook__env-head strong {
    font-size: 11px;
    font-weight: 700;
    color: #d5dcff;
    text-align: right;
}
.outlook__env-head strong[data-tone="warn"] { color: #fde68a; }
.outlook__env-head strong[data-tone="bad"] { color: #fecaca; }
.outlook__env-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.outlook__env-item {
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
}
.outlook__env-item span,
.outlook__env-item strong {
    display: block;
    font-family: var(--mono);
}
.outlook__env-item span {
    font-size: 10px;
    color: var(--muted-2);
    line-height: 1.4;
}
.outlook__env-item strong {
    margin-top: 3px;
    font-size: 12px;
    color: #e7ecff;
}
.outlook__env-note {
    margin: 8px 0 0;
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--muted-2);
}

.insights__footer {
    display: flex;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.insights__footer .btn { flex: 1 1 0; font-size: 12px; padding: 8px 7px; }

.empty {
    margin: 0;
    padding: 14px 7px;
    text-align: center;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.55;
}

/* Timeline --------------------------------------------------------------- */
.timeline {
    height: var(--timeline-h);
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 10px 16px;
    background: linear-gradient(180deg, #0a1120 0%, #070c16 100%);
    border-top: 1px solid var(--line);
    position: relative;
    z-index: 1800;
}
.timeline__controls { display: flex; align-items: center; gap: 5px; }
.timeline__main { min-width: 0; }
.timeline__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .03em;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
}
.timeline__meta span:last-child { color: var(--muted); }
.timeline__strip {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 36px;
    padding: 2px;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(3, 7, 14, .5);
    border: 1px solid rgba(148, 163, 184, .08);
}
.timeline__tick {
    flex: 1 0 6px;
    min-width: 5px;
    height: var(--h, 44%);
    padding: 0;
    border: 0;
    border-radius: 3px 3px 1px 1px;
    background: rgba(148, 163, 184, .22);
    cursor: pointer;
    transition: background .15s ease, height .25s ease, box-shadow .15s ease;
}
.timeline__tick:hover { background: rgba(34, 211, 238, .5); }
.timeline__tick:focus-visible { outline: 2px solid rgba(34, 211, 238, .7); outline-offset: 1px; }
.timeline__tick.is-active {
    height: 100%;
    background: linear-gradient(180deg, #a5f3fc, #22d3ee);
    box-shadow: 0 0 12px rgba(34, 211, 238, .75);
}
.timeline__tick.is-future { opacity: .55; }
.timeline__tick.is-storm { background: rgba(251, 191, 36, .48); }
.timeline__tick.is-storm:hover { background: rgba(251, 191, 36, .7); }
.timeline__tick.is-storm.is-active {
    background: linear-gradient(180deg, #fde68a, #fbbf24);
    box-shadow: 0 0 12px rgba(251, 191, 36, .7);
}

.timeline__options { display: flex; align-items: center; gap: 8px; }
.mini-field { display: flex; flex-direction: column; gap: 3px; }
.mini-field span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.mini-field select {
    width: auto;
    min-width: 92px;
    padding: 6px 28px 6px 9px;
    font-size: 12px;
    border-radius: 8px;
    background-position: right 8px center;
    background-size: 12px;
}

/* Scrim ------------------------------------------------------------------ */
.scrim {
    position: fixed;
    inset: 0;
    z-index: 1550;
    background: rgba(2, 5, 10, .62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.scrim[hidden] { display: none !important; }

.noscript {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4000;
    padding: 18px 22px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #0d1526;
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Place labels ----------------------------------------------------------- */
.place-label-icon {
    background: transparent;
    border: 0;
}
.place-label {
    display: inline-block;
    transform: translate(-50%, -50%);
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(4, 9, 18, .52);
    color: #cbd5e1;
    font-family: var(--sans);
    font-size: 9px;
    line-height: 1.2;
    letter-spacing: .01em;
    white-space: nowrap;
    text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
.place-label--province {
    padding: 1px 5px;
    background: rgba(4, 9, 18, .42);
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.place-label--district {
    background: rgba(4, 9, 18, .38);
    color: #dbe4ee;
    font-size: 9px;
    font-weight: 600;
}
.place-label--city {
    color: #f8fafc;
    font-size: 11px;
    font-weight: 700;
}
.place-label--town {
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 600;
}
.place-label--village {
    color: #cbd5e1;
    font-size: 9px;
}
.place-label--hamlet,
.place-label--suburb,
.place-label--neighbourhood {
    background: rgba(4, 9, 18, .3);
    color: #94a3b8;
    font-size: 8.5px;
}

/* Cell markers ----------------------------------------------------------- */
.cell-marker {
    --c: #fbbf24;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(4, 9, 18, .82);
    border: 2px solid var(--c);
    color: #fff;
    font-family: var(--mono);
    font-size: 9.5px;
    font-weight: 700;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, .12), 0 0 18px var(--c);
    position: relative;
    transform: translate(-50%, -50%);
}
.cell-marker::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1px solid var(--c);
    opacity: .45;
    animation: cellPulse 2.6s ease-out infinite;
}
.cell-marker.is-severe { --c: #f87171; }
.cell-marker.is-strong { --c: #fb923c; }
.cell-marker.is-moderate { --c: #fbbf24; }
.cell-marker__label { line-height: 1; transform: translateY(0); }

.ref-marker {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--cyan);
    border: 2px solid #04121a;
    box-shadow: 0 0 0 4px rgba(34, 211, 238, .2), 0 0 16px rgba(34, 211, 238, .9);
    transform: translate(-50%, -50%);
}
.ref-label {
    margin-top: 5px;
    transform: translate(-50%, 0);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #d9fbff;
    text-shadow: 0 1px 5px #000, 0 0 10px rgba(0, 0, 0, .9);
    white-space: nowrap;
}

/* Motion arrows on map --------------------------------------------------- */
.leaflet-nowcast-arrow { filter: drop-shadow(0 0 4px rgba(34, 211, 238, .5)); }

/* Animations ------------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}
@keyframes cellPulse {
    0% { transform: scale(.9); opacity: .55; }
    70%, 100% { transform: scale(1.35); opacity: 0; }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to { opacity: 1; transform: none; }
}

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1350px) {
    .workspace { grid-template-columns: 290px minmax(0, 1fr) 430px; }
    .brand__sub { display: none; }
    .status-pill { margin-left: 2px; }
}

@media (max-width: 1180px) {
    .topbar { grid-template-columns: minmax(0, 1fr) auto; }
    .topbar__right { grid-column: 2; }
    .workspace { grid-template-columns: 286px minmax(0, 1fr); }
    .insights {
        position: fixed;
        top: var(--topbar-h);
        right: 0;
        bottom: var(--timeline-h);
        width: 464px;
        max-width: 96vw;
        transform: translateX(104%);
        transition: transform .25s cubic-bezier(.2, .8, .2, 1);
        box-shadow: -20px 0 50px rgba(0, 0, 0, .5);
        z-index: 1600;
    }
    body.insights-open .insights { transform: none; }
    .topbar__center { display: none; }
    .map-note { max-width: 60%; }
}

@media (max-width: 940px) {
    :root { --timeline-h: 122px; }
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        bottom: var(--timeline-h);
        left: 0;
        width: min(360px, 90vw);
        transform: translateX(-104%);
        transition: transform .25s cubic-bezier(.2, .8, .2, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, .5);
        z-index: 1650;
    }
    body.sidebar-open .sidebar { transform: none; }
    .only-mobile { display: inline-flex; }
    .only-desktop { display: none !important; }
    .brand__sub { display: none; }
    .map-note { display: none; }
    .timeline {
        height: 122px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "main main" "controls options";
        gap: 8px 12px;
        padding: 8px 12px;
    }
    .timeline__main { grid-area: main; }
    .timeline__controls { grid-area: controls; }
    .timeline__options { grid-area: options; justify-self: end; }
    .timeline__strip { height: 26px; }
    .timeline__meta { margin-bottom: 3px; }
    .mini-field span { display: none; }
    .mini-field select { min-width: 70px; }
    .legend-card { width: min(340px, calc(100% - 24px)); left: 12px; bottom: 12px; }
    .map-hud--top-left { top: 12px; left: 12px; }
    .layer-control { top: 12px; right: 12px; }
    .layers-panel { max-height: calc(100vh - var(--topbar-h) - var(--timeline-h) - 68px); }
    .hud-card { min-width: 130px; padding: 9px 12px; }
    .hud-card__value { font-size: 23px; }
    .toasts { top: 12px; right: 12px; }
}

@media (max-width: 640px) {
    :root { --timeline-h: 132px; }
    .brand__text { display: none; }
    .brand__mark { width: 34px; height: 34px; }
    .brand__mark svg { width: 26px; height: 26px; }
    .status-pill { padding: 5px 9px; gap: 7px; margin-left: 8px; font-size: 10.5px; }
    .refresh-chip { display: none; }
    .topbar { gap: 8px; padding: 0 10px; }
    .timeline { height: 132px; padding: 7px 10px; }
    .timeline__meta { font-size: 10px; gap: 8px; }
    .timeline__meta span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .timeline__meta span:last-child { flex: 0 0 auto; }
    .timeline__options { gap: 5px; }
    .timeline__options .mini-field:nth-child(2) { display: none; }
    .btn--live { padding: 6px 9px; font-size: 10px; }
    .legend-scale { font-size: 7.5px; }
    .legend-bar { height: 11px; }
    .insights { width: 100vw; max-width: 100vw; }
    .stat strong { font-size: 19px; }
    .cell-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
    .layer-toggle { height: 36px; padding: 0 11px; font-size: 11.5px; }
    .layers-panel { width: calc(100vw - 24px); max-height: calc(100vh - var(--topbar-h) - var(--timeline-h) - 68px); }
}

/* Extended states -------------------------------------------------------- */
.switch.is-disabled {
    opacity: .42;
    cursor: not-allowed;
}
.switch.is-disabled .switch__ui { filter: grayscale(.5); }

.cell-marker.no-label {
    width: 15px;
    height: 15px;
    font-size: 0;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, .1), 0 0 12px var(--c);
}
.cell-marker.no-label .cell-marker__label { display: none; }
.cell-marker.no-label::after { inset: -4px; }

.source-credit {
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(5, 8, 15, .72);
    font-size: 9px;
    letter-spacing: .03em;
}
.source-credit a { color: #94a3b8; text-decoration: none; }
.source-credit a:hover { color: var(--cyan); }

.radar-tooltip {
    background: rgba(9, 15, 28, .96) !important;
    color: var(--text) !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow) !important;
    font-size: 10px !important;
    line-height: 1.5 !important;
    padding: 6px 8px !important;
}
.radar-tooltip strong { color: #e2f8ff; }
.leaflet-tooltip-top.radar-tooltip::before { border-top-color: rgba(9, 15, 28, .96); }

.nowcast-overlay { mix-blend-mode: screen; }

.map.map-pick,
.map.map-pick.leaflet-container,
.map.map-pick .leaflet-interactive,
.map.map-pick .leaflet-grab { cursor: crosshair !important; }

@media (min-width: 1181px) {
    body.insights-hidden .workspace { grid-template-columns: 300px minmax(0, 1fr) 0; }
    body.insights-hidden .insights { display: none; }
}
@media (min-width: 1181px) and (max-width: 1350px) {
    body.insights-hidden .workspace { grid-template-columns: 290px minmax(0, 1fr) 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ---------------------------------------------------------------------------
   Mezcla multifuente por horas

   Reutiliza las clases del bloque de Open-Meteo (.outlook__*) a proposito: los
   dos paneles deben verse iguales y alinearse columna a columna para poder
   compararlos de un vistazo. Aqui solo vive lo que el bloque del modelo no
   necesita: el marcador de desacuerdo entre fuentes y el detalle desplegable.
--------------------------------------------------------------------------- */

/* Horas en que las fuentes se contradicen. Es un tratamiento de borde, no una
   linea extra, de modo que no rompe el formato compartido. */
.outlook__hour.is-disagree {
    border-style: dashed;
    border-color: rgba(251, 191, 36, .7);
}
.outlook__hour.is-disagree.is-wet {
    border-color: rgba(251, 191, 36, .85);
}

.hybrid { display: flex; flex-direction: column; gap: 10px; }
.hybrid__detail { margin-top: 9px; }
.hybrid__detail > summary {
    cursor: pointer;
    font-size: 11px;
    color: var(--muted-2);
}
.hybrid__sources, .hybrid__limits {
    margin: 8px 0 0;
    padding-left: 2px;
    list-style: none;
    font-size: 10.5px;
    line-height: 1.6;
    color: var(--muted-2);
}
.hybrid__sources li[data-on="1"] { color: #c7d7f0; }
.hybrid__sources li[data-on="0"] { opacity: .65; }
.hybrid__note { margin: 8px 0 0; font-size: 10.5px; color: var(--muted-2); }
.hybrid__limits li { margin-top: 4px; }

/* ---------------------------------------------------------------------------
   Pronóstico de 6 horas

   Dos bandas con fundamento distinto, no una cuadrícula uniforme: 0–2 h sale
   de observación propia (radar/GOES) y 2–6 h del modelo numérico. La banda se
   marca en el encabezado y el borde punteado de cada celda, de modo que la
   procedencia se vea sin leer el pie.
--------------------------------------------------------------------------- */

.forecast6 { display: flex; flex-direction: column; gap: 10px; }
.forecast6__band { display: flex; flex-direction: column; gap: 6px; }
.forecast6__band-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.forecast6__band-head strong {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #b9c8de;
}
.forecast6__band-head span { font-family: var(--mono); letter-spacing: 0; text-transform: none; }
.forecast6__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    gap: 5px;
}
.forecast6__cell {
    padding: 7px 4px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
    text-align: center;
}
/*
 | Celda propia según su fundamento.
 |
 | La distinción es deliberada y no decorativa: una observación de radar
 | advectada y una frecuencia histórica de la hora local no merecen la misma
 | lectura, y una celda sin fundamento propio no debe parecerse a una con dato.
 */
.forecast6__cell[data-basis="climatologia"] {
    border-style: dotted;
    background: rgba(148, 163, 184, .03);
}
.forecast6__cell.is-nobasis {
    border-style: dotted;
    border-color: rgba(148, 163, 184, .28);
    background: transparent;
    opacity: .62;
}
.forecast6__cell.is-nobasis .forecast6__mm {
    font-size: 10px;
    font-weight: 500;
    color: var(--muted-2);
    letter-spacing: .02em;
}
.forecast6__cell[data-kind="model"] {
    border-style: dashed;
    background: rgba(148, 163, 184, .045);
}
.forecast6__cell.is-wet {
    border-color: rgba(56, 189, 248, .45);
    background: rgba(56, 189, 248, .12);
}
.forecast6__cell[data-kind="model"].is-wet {
    border-color: rgba(56, 189, 248, .32);
    background: rgba(56, 189, 248, .07);
}
.forecast6__cell.is-disagree {
    border-color: rgba(251, 191, 36, .7);
}
.forecast6__time,
.forecast6__mm,
.forecast6__prob {
    display: block;
    font-family: var(--mono);
    line-height: 1.4;
}
.forecast6__time { font-size: 10.5px; color: var(--muted-2); }
.forecast6__mm { font-size: 12.5px; font-weight: 700; color: #e4ecf9; }
.forecast6__cell.is-wet .forecast6__mm { color: #8bdcff; }
.forecast6__prob { font-size: 10.5px; color: var(--muted-2); }
.forecast6__text {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: #d7e2f1;
    white-space: pre-line;
}
.forecast6__credit {
    margin: 0;
    font-size: 10.5px;
    line-height: 1.6;
    color: var(--muted-2);
}
.forecast6__credit strong { color: #c7d7f0; font-weight: 600; }

/* Sección plegable: el detalle del modelo no compite en altura con el
   pronóstico de 6 h, que es la lectura principal. */
.section-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.section-details > summary::-webkit-details-marker { display: none; }
.section-details > summary::after {
    content: '+';
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted-2);
}
.section-details[open] > summary::after { content: '–'; }
.section-details > summary h3 { margin: 0; }
.section-details > summary {
    padding-bottom: 2px;
}
.section-details > summary h3 {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #c3d0e3;
    line-height: 1.4;
}
.section-details > summary .pill { margin-left: auto; }
.section-details[open] > summary { margin-bottom: 11px; }

.reading__forecast p { white-space: pre-line; }
