/* =============================================================================
   App shell — desktop persistent rail + mobile slide-over drawer.

   Layout strategy:
   - Desktop (>= 960px): CSS Grid two-column [rail | main]. The rail is always
     visible; no MudDrawer involved.
   - Mobile (< 960px): the rail is hidden; a MudDrawer with Variant=Temporary
     handles the slide-over. The hamburger in the top bar opens it.

   These rules are GLOBAL (not scoped CSS) because they target MudBlazor-rendered
   DOM; Razor scoped CSS attaches a [b-xxx] attribute only to elements authored
   directly in the .razor file, so scoped rules silently fail on MudBlazor DOM.
   ============================================================================= */

/* Defensive: clip horizontal overflow at the viewport. Without this, any
   position:fixed element with transform:translateX(100%) (slide-in panels,
   off-screen drawers) extends the body's scroll width and creates a phantom
   horizontal scrollbar plus dead space to the right of the content. */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    overflow: hidden;
    background-color: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
}

.app-shell__rail {
    display: flex;
    flex-direction: column;
    background-color: var(--mud-palette-drawer-background);
    color: var(--mud-palette-drawer-text);
    border-right: 1px solid var(--mud-palette-divider);
    overflow-y: auto;
    overflow-x: hidden;
}

.app-shell__nav {
    flex: 1;
    padding: 4px 0;
    overflow-y: auto;
}

.app-shell__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.app-shell__topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--mud-palette-divider);
    background-color: var(--mud-palette-surface);
    flex-shrink: 0;
}

.app-shell__content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Hamburger is mobile-only; hidden on desktop */
.app-shell__hamburger {
    display: none !important;
}

.app-shell__mobile-drawer {
    display: none;
}

/* Mobile: < 960px → swap to drawer-mode */
@media (max-width: 959.98px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-shell__rail {
        display: none;
    }

    .app-shell__hamburger {
        display: inline-flex !important;
    }

    .app-shell__mobile-drawer {
        display: block;
    }
}

/* =============================================================================
   Top bar pieces
   ============================================================================= */

.app-shell__search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 360px;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    background-color: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-secondary);
    cursor: text;
    transition: border-color 120ms ease;
}

    .app-shell__search:hover {
        border-color: var(--mud-palette-text-secondary);
    }

.app-shell__search-placeholder {
    flex: 1;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
    user-select: none;
}

.app-shell__search-hint {
    font-family: inherit;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-secondary);
    background-color: transparent;
}

.app-shell__topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-shell__notif-wrap {
    position: relative;
}

.app-shell__notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--mud-palette-error);
    border: 2px solid var(--mud-palette-surface);
    pointer-events: none;
}

.app-shell__avatar-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 18px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background-color 120ms ease;
}

    .app-shell__avatar-button:hover {
        background-color: var(--mud-palette-action-default-hover);
    }

    /* The activator is a <div role="button"> not a real <button> (see MainLayout.razor
       comment). The browser doesn't provide focus-visible styling for div+tabindex,
       so we add it explicitly for keyboard users. */
    .app-shell__avatar-button:focus-visible {
        outline: 2px solid var(--mud-palette-primary);
        outline-offset: 2px;
    }

.app-shell__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-size: 12px;
    font-weight: 500;
}

.app-shell__avatar-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

/* On narrow screens the avatar name disappears so just the circle shows */
@media (max-width: 599.98px) {
    .app-shell__avatar-name {
        display: none;
    }

    .app-shell__search {
        max-width: none;
    }

    .app-shell__search-placeholder,
    .app-shell__search-hint {
        display: none;
    }
}

/* =============================================================================
   Avatar dropdown menu (MudMenu popover)
   ============================================================================= */

/* The popover container — MudMenu renders MudPopover with this class. */
.app-shell__avatar-menu {
    min-width: 220px;
    padding: 4px 0;
}

.app-shell__avatar-menu-header {
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--mud-palette-divider);
    margin-bottom: 4px;
}

.app-shell__avatar-menu-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

.app-shell__avatar-menu-email {
    font-size: 11px;
    margin-top: 1px;
}

/* The "Educational overlays" toggle row — custom (not a MudMenuItem) because
   it has a switch on the right and shouldn't navigate when clicked. */
.app-shell__avatar-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: default;
    color: var(--mud-palette-text-primary);
    font-size: 13px;
}

.app-shell__avatar-menu-toggle-label {
    flex: 1;
    user-select: none;
}

.app-shell__avatar-menu-divider {
    height: 1px;
    background-color: var(--mud-palette-divider);
    margin: 4px 0;
}

/* =============================================================================
   Brand lockup (used in the rail and mobile drawer)
   ============================================================================= */

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-primary);
    text-decoration: none;
    flex-shrink: 0;
}

    .brand-lockup:hover {
        text-decoration: none;
        background-color: var(--mud-palette-action-default-hover);
    }

    .brand-lockup:focus-visible {
        outline: 2px solid var(--mud-palette-primary);
        outline-offset: -2px;
    }

.brand-lockup__logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-lockup__wordmark {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--mud-palette-primary);
}

/* =============================================================================
   Main menu — section headers, footer, and badges
   ============================================================================= */

.main-menu {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 8px 0;
}

.main-menu__section-header {
    margin: 16px 16px 4px 16px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-disabled);
    user-select: none;
}

/* Unacknowledged-event count on the Risk > Events child link.
   // TODO: stage 2 — currently unused (badge markup not yet ported). */
.main-menu__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 8px;
    border-radius: 9px;
    background-color: var(--mud-palette-error);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.main-menu__footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--mud-palette-divider);
}

/* =============================================================================
   Generic helpers
   ============================================================================= */

.text-secondary {
    color: var(--mud-palette-text-secondary) !important;
}

/* =============================================================================
   STAGE 2 — Fire Danger feature styles.
   Ported from the prototype app.css (Fire-Danger subset only). Global because
   they target MudBlazor- and Leaflet-rendered DOM. Excludes favorite-card and
   fire-detections-page (out of scope this stage).
   ============================================================================= */
/* =============================================================================
   Fire Danger page
   ============================================================================= */

.fire-danger-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    height: 100%; /* fill the .app-shell__content area */
    overflow: hidden; /* prevent the page from scrolling â€” internal panes scroll */
    min-height: 0; /* flex children can collapse properly */
}

/* The page header (breadcrumb / title / subtitle) now comes from the shared
   PageHeader component (.page-header*). The old .fire-danger-page__header,
   __breadcrumb, __title, and __subtitle rules were removed. */

.fire-danger-page__product-selector {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.product-chip {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-divider);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 120ms ease;
}

    .product-chip:hover {
        border-color: var(--mud-palette-primary);
        color: var(--mud-palette-text-primary);
    }

.product-chip--active {
    background-color: rgba(38, 166, 154, 0.18);
    color: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
}

/* KPI strip */
.fire-danger-page__kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex-shrink: 0;
}

.fire-danger-kpi {
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    padding: 12px 14px;
}

.fire-danger-kpi__label {
    font-size: 11px;
    margin-bottom: 4px;
}

.fire-danger-kpi__value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.fire-danger-kpi__value {
    font-size: 22px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

.fire-danger-kpi__value--danger {
    color: var(--mud-palette-error);
}

.fire-danger-kpi__delta {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
}

.fire-danger-kpi__delta--worse {
    color: var(--mud-palette-error);
}

.fire-danger-kpi__delta--better {
    color: var(--mud-palette-success);
}

/* Off-Today (slice 3c): the crossings value (no honest forecast equivalent) and the
   "no prior-day data" comparator are de-emphasised rather than showing a fabricated
   number. */
.fire-danger-kpi__value--dim {
    color: var(--mud-palette-text-disabled);
}

.fire-danger-kpi__delta--muted {
    color: var(--mud-palette-text-disabled);
    font-style: italic;
}

/* Map */
.fire-danger-page__map-wrap {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--mud-palette-divider);
    flex: 1 1 0; /* grow to fill remaining vertical space */
    min-height: 0; /* allow flex shrink below natural content */
    min-width: 0;
}

.fire-danger-map {
    width: 100%;
    height: 100%;
    background-color: #0d1218;
}

.fire-danger-legend {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: rgba(20, 25, 33, 0.85);
    border-radius: 6px;
    font-size: 11px;
    color: #ddd;
    backdrop-filter: blur(4px);
}

.fire-danger-legend__chip {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-left: 6px;
}

    .fire-danger-legend__chip:first-child {
        margin-left: 0;
    }

/* Leaflet overrides */
.fire-danger-map .leaflet-container {
    background-color: #0d1218;
    font-family: inherit;
}

.fire-danger-map .leaflet-control-zoom a {
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border-color: var(--mud-palette-divider);
}

    .fire-danger-map .leaflet-control-zoom a:hover {
        background-color: var(--mud-palette-action-default-hover);
    }

/* Timeline scrubber */
.fire-danger-timeline {
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    padding: 12px 16px;
    flex-shrink: 0; /* never get squeezed; map shrinks instead */
}

.fire-danger-timeline__controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

/* The play button + date/subtitle readout are now the shared <ScrubberChrome>
   (.fd-scrubber__head / __play / __date / __sub) used by both presets — the old
   .fire-danger-timeline__date* chrome classes were removed to prevent drift. */
.fire-danger-timeline__ranges {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.range-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-divider);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 120ms ease;
}

    .range-chip:hover:not(.range-chip--locked) {
        color: var(--mud-palette-text-primary);
    }

.range-chip--active {
    background-color: rgba(38, 166, 154, 0.18);
    color: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
}

.range-chip--locked {
    cursor: pointer; /* clickable â€” routes to billing */
    opacity: 0.6;
}

    /* Subtle brightening on hover suggests interactivity without losing the
       "locked" visual cue. The tooltip carries the verbal explanation. */
    .range-chip--locked:hover {
        opacity: 0.85;
    }

    .range-chip--locked .mud-icon-root {
        color: currentColor;
    }

/* Historical slider wears the SAME skin as the forecast scrubber (slice 3b pivot):
   40px track height + 15px teal handle. It stays continuous-drag (timeline-slider.js);
   only the 7-day preset adds daily ticks. */
.fire-danger-timeline__track {
    position: relative;
    height: 40px;
}

.fire-danger-timeline__track-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    background-color: var(--mud-palette-divider);
    border-radius: 2px;
    transform: translateY(-50%);
}

.fire-danger-timeline__track-fill {
    position: absolute;
    left: 0;
    top: 50%;
    height: 4px;
    background-color: var(--mud-palette-primary);
    border-radius: 2px;
    transform: translateY(-50%);
}

.fire-danger-timeline__track-thumb {
    position: absolute;
    top: 50%;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: var(--mud-palette-primary);
    transform: translate(-50%, -50%);
    border: 2px solid var(--mud-palette-surface);
    cursor: pointer;
}

/* ── 7-day forecast scrubber (Item 8, slice 3b) ───────────────────────────── */
.fd-scrubber { display: flex; flex-direction: column; gap: 14px; }

.fd-scrubber__head { display: flex; align-items: center; gap: 12px; }

.fd-scrubber__play {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    border: 1px solid var(--mud-palette-divider); background: transparent;
    color: var(--mud-palette-primary); cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.fd-scrubber__play:disabled { opacity: .4; cursor: default; }

.fd-scrubber__date { font-size: 15px; font-weight: 500; color: var(--mud-palette-text-primary); }
.fd-scrubber__sub { font-size: 12px; color: var(--mud-palette-text-secondary); margin-top: 1px; }
.fd-scrubber__sub--live { color: var(--mud-palette-primary); }

.fd-scrubber__track { position: relative; height: 40px; outline: none; }
.fd-scrubber__track:focus-visible {
    outline: 2px solid var(--mud-palette-primary); outline-offset: 4px; border-radius: 6px;
}
.fd-scrubber__rail {
    position: absolute; top: 50%; left: 0; right: 0; height: 2px;
    background: var(--mud-palette-divider); transform: translateY(-50%);
}
.fd-scrubber__solid {
    position: absolute; top: 50%; left: 0; height: 3px;
    background: var(--mud-palette-primary); transform: translateY(-50%);
}
.fd-scrubber__dashed {
    position: absolute; top: 50%; height: 0;
    border-top: 2px dashed var(--mud-palette-text-disabled); transform: translateY(-50%);
}
.fd-scrubber__todaymark {
    position: absolute; top: 50%; width: 2px; height: 16px;
    background: var(--mud-palette-text-secondary); transform: translate(-50%, -50%);
}
.fd-scrubber__tick {
    position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; padding: 0;
    background: var(--mud-palette-surface); border: 1.5px solid var(--mud-palette-text-secondary);
    transform: translate(-50%, -50%); cursor: pointer; z-index: 2;
}
/* Observed (past) ticks are filled dots on the solid-teal left half; forecast ticks
   stay hollow rings on the dashed right half. */
.fd-scrubber__tick--past {
    background: var(--mud-palette-text-secondary); border-color: var(--mud-palette-text-secondary);
}
/* Today seam: a clickable teal "now" marker sitting over the seam bar — larger hit
   area than the dots/rings, ringed so it reads as live, never mistaken for a divider. */
.fd-scrubber__tick--today {
    width: 14px; height: 14px;
    background: var(--mud-palette-surface); border: 2px solid var(--mud-palette-primary);
}
/* Today fills teal ONLY when it's the selected tick (the handle sits on it), so the
   only filled-teal marker at any time is the selected one. Unselected Today stays a
   hollow teal "now" ring — still discoverable + clickable, never read as selected. */
.fd-scrubber__tick--today.fd-scrubber__tick--sel {
    background: var(--mud-palette-primary); border-color: var(--mud-palette-surface);
    box-shadow: 0 0 0 1.5px var(--mud-palette-primary);
}
.fd-scrubber__tick--sel { border-color: var(--mud-palette-primary); }
.fd-scrubber__tick--past.fd-scrubber__tick--sel {
    background: var(--mud-palette-primary); border-color: var(--mud-palette-primary);
}
.fd-scrubber__lab {
    position: absolute; top: calc(50% + 14px); font-size: 11px;
    color: var(--mud-palette-text-disabled); transform: translateX(-50%); white-space: nowrap;
}
.fd-scrubber__lab--today { color: var(--mud-palette-text-secondary); }
.fd-scrubber__handle {
    position: absolute; top: 50%; width: 15px; height: 15px; border-radius: 50%;
    background: var(--mud-palette-primary); border: 2px solid var(--mud-palette-surface);
    transform: translate(-50%, -50%); z-index: 3; pointer-events: none; transition: left .12s;
}

/* =============================================================================
   PSA detail panel â€” slide-in from right edge of the viewport.

   We use a custom position:fixed sheet because the app shell isn't built on
   MudLayout â€” MudDrawer expected a MudLayout ancestor to dock to, and without
   one it rendered inside the page flow rather than overlaying the viewport.
   ============================================================================= */

/* Backdrop covers the whole viewport, sits below the sheet. */
.psa-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1390;
    background-color: rgba(13, 18, 24, 0.42);
    backdrop-filter: blur(1px);
    cursor: pointer;
}

/* The sheet itself. Always in the DOM (for transitions); off-screen when closed. */
.psa-detail-sheet {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    z-index: 1400; /* above the backdrop, below MudBlazor's snackbars (1500+) */
    background-color: var(--mud-palette-surface);
    border-left: 1px solid var(--mud-palette-divider);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.24);
    transform: translateX(100%);
    transition: transform 220ms ease;
    overflow-y: auto;
    /* Hidden from screen readers + tab order when closed */
    visibility: hidden;
}

.psa-detail-sheet--open {
    transform: translateX(0);
    visibility: visible;
}

.psa-detail {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}

.psa-detail__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.psa-detail__title {
    font-size: 16px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

.psa-detail__subtitle {
    font-size: 11px;
    margin-top: 2px;
}

.psa-detail__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
}

.psa-detail__kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* Eyebrow above the current-conditions trio — kills the "all WFPI" misread. */
.psa-detail__eyebrow {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mud-palette-text-disabled);
    margin-bottom: 6px;
}

/* KPI cards are now a measure selector (clickable buttons). */
.psa-detail__kpi {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    background-color: var(--mud-palette-background);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 10px;
    transition: border-color .12s, background-color .12s;
}

.psa-detail__kpi:hover {
    border-color: var(--mud-palette-divider);
}

/* Active measure card — teal border + faint teal bg + teal acronym (the panel's
   "what's selected" cue; same teal as the active product chip). */
.psa-detail__kpi--active {
    border-color: var(--mud-palette-primary);
    background-color: rgba(38, 166, 154, 0.12);
}

.psa-detail__kpi--active .psa-detail__kpi-label {
    color: var(--mud-palette-primary);
}

.psa-detail__kpi-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

/* Muted, compact info affordance (measure-zone title). */
.psa-detail__info-btn.mud-icon-button {
    padding: 1px;
    min-width: 0;
    color: var(--mud-palette-text-disabled);
}

.psa-detail__info-btn .mud-icon-root {
    font-size: 14px;
}

.psa-detail__info-btn:hover {
    color: var(--mud-palette-text-secondary);
}

/* Rich measure tooltip content. */
.psa-detail__tip {
    max-width: 260px;
}

.psa-detail__tip-head {
    font-weight: 600;
    margin-bottom: 4px;
}

.psa-detail__tip-body {
    font-size: 12px;
    line-height: 1.4;
}

.psa-detail__kpi-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 18px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

.psa-detail__kpi-cat {
    font-size: 10px;
    font-weight: 400;
    padding: 1px 5px;
    border-radius: 3px;
    background-color: var(--mud-palette-divider);
}

.psa-detail__kpi-cat--low {
    color: #b18020;
    background-color: rgba(254, 250, 220, 0.18);
}

.psa-detail__kpi-cat--moderate {
    color: #d68a35;
    background-color: rgba(250, 199, 117, 0.18);
}

.psa-detail__kpi-cat--high {
    color: #e07a25;
    background-color: rgba(239, 159, 39, 0.18);
}

.psa-detail__kpi-cat--veryhigh {
    color: #d85a30;
    background-color: rgba(216, 90, 48, 0.18);
}

.psa-detail__kpi-cat--extreme {
    color: #e24b4a;
    background-color: rgba(226, 75, 74, 0.18);
}

/* ── 7-day forecast strip (Item 8, slice 2) ───────────────────────────────── */
.psa-detail__forecast-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.psa-detail__forecast-strip {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.psa-detail__forecast-cell {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 7px 2px 6px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .12s, background .12s;
}

.psa-detail__forecast-cell:hover {
    background: rgba(255, 255, 255, 0.03);
}

.psa-detail__forecast-cell--selected {
    border-color: var(--mud-palette-text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.psa-detail__forecast-tag {
    font-size: 9px;
    line-height: 1;
    height: 11px;
    color: var(--mud-palette-text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.psa-detail__forecast-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.psa-detail__forecast-bar-track {
    width: 100%;
    height: 72px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.psa-detail__forecast-bar {
    width: 62%;
    min-height: 4px;
    border-radius: 6px 6px 2px 2px;
    transition: height .18s;
}

.psa-detail__forecast-dow {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    margin-top: 2px;
}

.psa-detail__forecast-date {
    font-size: 10px;
    color: var(--mud-palette-text-disabled);
}

.psa-detail__forecast-summary {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--mud-palette-text-secondary);
}

.psa-detail__forecast-summary b {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.psa-detail__forecast-selected {
    margin-top: 8px;
    font-size: 12px;
    color: var(--mud-palette-text-disabled);
}

.psa-detail__chart-header {
    margin-top: 4px;
}

.psa-detail__chart-title {
    font-size: 11px;
}

.psa-detail__chart {
    background-color: var(--mud-palette-background);
    border-radius: 6px;
    padding: 8px;
}

.psa-detail__sparkline {
    width: 100%;
    height: 80px;
    display: block;
}

.psa-detail__actions {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--mud-palette-divider);
}

/* =============================================================================
   Fire Danger map â€” hover info panel and reset zoom control
   ============================================================================= */

/* Info panel anchored top-left of the map, shows hovered PSA details. */
.fire-danger-map-info {
    position: absolute;
    top: 12px;
    left: 60px; /* clear of the zoom controls */
    z-index: 1000;
    min-width: 200px;
    max-width: 280px;
    padding: 10px 12px;
    background-color: rgba(20, 25, 33, 0.92);
    color: #ddd;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none; /* don't intercept mouse events headed for the map */
}

.fire-danger-map-info__hint {
    color: rgba(255, 255, 255, 0.55);
    font-style: italic;
}

.fire-danger-map-info__name {
    color: #fff;
    font-weight: 500;
    font-size: 13px;
}

.fire-danger-map-info__sub {
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    margin-top: 2px;
}

.fire-danger-map-info__value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.fire-danger-map-info__value {
    font-size: 18px;
    font-weight: 500;
    color: #fff;
}

.fire-danger-map-info__cat {
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fire-danger-map-info__cat--low {
    background-color: rgba(254, 250, 220, 0.20);
    color: #fefadc;
}

.fire-danger-map-info__cat--moderate {
    background-color: rgba(250, 199, 117, 0.20);
    color: #fac775;
}

.fire-danger-map-info__cat--high {
    background-color: rgba(239, 159, 39, 0.20);
    color: #ef9f27;
}

.fire-danger-map-info__cat--veryhigh {
    background-color: rgba(216, 90, 48, 0.20);
    color: #d85a30;
}

.fire-danger-map-info__cat--extreme {
    background-color: rgba(226, 75, 74, 0.20);
    color: #e24b4a;
}

/* Reset-view button â€” styled to match Leaflet's native zoom +/- buttons */
.fire-danger-map-reset a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border-color: var(--mud-palette-divider);
}

    .fire-danger-map-reset a:hover {
        background-color: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-primary);
    }

/* =============================================================================
   Fire Danger educational overlay
   ============================================================================= */

.fd-edu-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100; /* above MudBlazor's default drawer/dialog z-index (1300) */
    background-color: rgba(13, 18, 24, 0.62);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.fd-edu-overlay__panel {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* the inner __body scrolls; header + actions stay pinned */
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    padding: 24px 28px;
    color: var(--mud-palette-text-primary);
}

/* Scrollable middle: keeps the close header and the actions row (checkbox /
   Learn more / Got it) reachable on short screens even as content grows. The
   negative side margins let the scroll track sit at the panel edge while text
   stays aligned with the header. */
.fd-edu-overlay__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0 -28px;
    padding: 0 28px;
}

.fd-edu-overlay__psa {
    margin-bottom: 16px;
}

.fd-edu-overlay__section-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.fd-edu-overlay__psa-body {
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 10px;
}

.fd-edu-overlay__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.fd-edu-overlay__title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fd-edu-overlay__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: rgba(239, 159, 39, 0.18);
    color: #ef9f27;
}

.fd-edu-overlay__title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
    letter-spacing: -0.01em;
}

.fd-edu-overlay__lede {
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 16px;
}

.fd-edu-overlay__products {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.fd-edu-product {
    background-color: var(--mud-palette-background);
    border-radius: 8px;
    padding: 10px 12px;
}

.fd-edu-product__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.fd-edu-product__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

.fd-edu-product__sub {
    font-size: 11px;
}

.fd-edu-product__body {
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
}

.fd-edu-overlay__legend {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 14px;
    margin-bottom: 14px;
}

.fd-edu-overlay__legend-title {
    font-size: 12px;
    margin-bottom: 8px;
}

.fd-edu-overlay__legend-chips {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.fd-edu-overlay__legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
}

.fd-edu-overlay__legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.fd-edu-overlay__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    /* Pinned footer beneath the scrollable body — separate it from the content. */
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--mud-palette-divider);
}

.fd-edu-overlay__opt-out {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.fd-edu-overlay__buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}



/* =============================================================================
   PSA detail panel â€” additional sections (trend, context, nearby, fires)
   ============================================================================= */

.psa-detail__section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psa-detail__section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

/* Active-measure callout heading the measure zone — full measure name, same teal
   as the selected product toggle (.product-chip--active), semibold, TITLE-CASE as
   stored (no uppercase transform), one line. */
.psa-detail__measure {
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Measure zone — brackets everything scoped to the selected measure (forecast
   strip + 30-day history + context) with a subtle teal left-accent. */
.psa-detail__measure-zone {
    margin-top: 18px;
    padding-left: 12px;
    border-left: 2px solid rgba(38, 166, 154, 0.55);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psa-detail__measure-zone-head {
    display: flex;
    align-items: center;
    gap: 2px;
}

.psa-detail__measure-zone-sub {
    font-size: 11px;
    margin-top: -4px;
}

/* Inline measure tag appended to the Nearby PSAs header (teal, inherits the
   label's uppercase). */
.psa-detail__measure-inline {
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.psa-detail__section-sub {
    text-transform: none;
    letter-spacing: 0;
    font-size: 10px;
    color: var(--mud-palette-text-disabled);
}

/* KPI trend row (under each value+category) */
.psa-detail__kpi-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    margin-top: 4px;
}

.psa-detail__kpi-trend--rising {
    color: var(--mud-palette-error);
}

.psa-detail__kpi-trend--falling {
    color: var(--mud-palette-success);
}

.psa-detail__kpi-trend--stable {
    color: var(--mud-palette-text-secondary);
}

.psa-detail__kpi-trend-delta {
    font-weight: 500;
}

/* "preview" tag for stub data */
.psa-detail__stub-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 5px;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--mud-palette-text-secondary);
    border: 1px solid var(--mud-palette-divider);
}

/* Context strip */
.psa-detail__context {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.psa-detail__context-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background-color: var(--mud-palette-background);
    border-radius: 6px;
}

.psa-detail__context-key {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.psa-detail__context-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.psa-detail__context-value--text {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
}

.psa-detail__context-sub {
    font-size: 10px;
    font-weight: 400;
}

.psa-detail__threshold-firing {
    color: var(--mud-palette-error);
}

/* Nearby PSAs table */
.psa-detail__nearby-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

    .psa-detail__nearby-table td {
        padding: 8px 6px;
        border-bottom: 1px solid var(--mud-palette-divider);
        vertical-align: middle;
    }

    .psa-detail__nearby-table tr:last-child td {
        border-bottom: none;
    }

.psa-detail__nearby-name {
    color: var(--mud-palette-text-primary);
}

.psa-detail__nearby-code {
    font-size: 10px;
    margin-top: 1px;
}

.psa-detail__nearby-value {
    font-weight: 500;
    color: var(--mud-palette-text-primary);
    text-align: right;
    white-space: nowrap;
    padding-right: 4px !important;
}

.psa-detail__nearby-cat {
    text-align: right;
    white-space: nowrap;
}

/* Recent fire activity */
.psa-detail__fires-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

/* "Investigate ->" deep-link into the FireDetections sub-page (Item 5). */
.psa-detail__fires-investigate {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--mud-palette-primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 120ms ease;
    white-space: nowrap;
}

    .psa-detail__fires-investigate:hover {
        background-color: var(--mud-palette-action-default-hover);
    }

/* S8b header cross-link (Smoke ↔ Fire) — a quiet teal text action beside the header info "i". */
.page-header__crosslink {
    display: inline-flex;
    align-items: center;
    color: var(--mud-palette-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    transition: background-color 120ms ease;
    vertical-align: middle;
}

    .page-header__crosslink:hover {
        background-color: var(--mud-palette-action-default-hover);
    }

.psa-detail__fires-count {
    font-size: 22px;
    font-weight: 500;
    color: var(--mud-palette-warning);
}

.psa-detail__fires-empty {
    font-size: 12px;
    padding: 8px 0;
    font-style: italic;
}

.psa-detail__fires-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.psa-detail__fire-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    padding: 6px 10px;
    background-color: var(--mud-palette-background);
    border-radius: 4px;
    font-size: 11px;
}

.psa-detail__fire-time {
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}

.psa-detail__fire-loc {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: right;
    font-size: 10px;
}

.psa-detail__fire-frp {
    grid-column: 1 / -1;
    font-size: 10px;
}

.psa-detail__fires-more {
    font-size: 11px;
    text-align: center;
    padding-top: 4px;
    font-style: italic;
}

/* =============================================================================
   PSA detail panel â€” labeled chart, forecast attribution, threshold empty state
   ============================================================================= */

/* Increased chart container height to accommodate axis labels in the SVG. */
.psa-detail__chart-svg {
    width: 100%;
    height: auto;
    max-height: 180px;
    display: block;
}

/* Override the original .psa-detail__sparkline height â€” replaced by chart-svg
   but kept in case any reference remains. */
.psa-detail__sparkline {
    width: 100%;
    height: 80px;
    display: block;
}

/* Forecast attribution sub-line, small + muted */
.psa-detail__context-attribution {
    font-size: 10px;
    margin-top: 4px;
    font-style: italic;
}

/* Empty-state context row (no rules configured yet) */
.psa-detail__context-row--empty {
    background-color: transparent;
    border: 1px dashed var(--mud-palette-divider);
}

    .psa-detail__context-row--empty .psa-detail__context-value {
        font-style: italic;
    }

/* =============================================================================
   Pin/unpin star toggle in PsaDetailPanel header
   ============================================================================= */

.psa-detail__header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.psa-detail__star--pinned {
    color: #FFB300 !important;
}

/* Tier-limit message banner shown inline when user hits favorites cap */
.psa-detail__pin-limit-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-top: -8px;
    background-color: rgba(255, 179, 0, 0.10);
    border: 1px solid rgba(255, 179, 0, 0.30);
    border-radius: 6px;
    font-size: 12px;
    color: var(--mud-palette-text-primary);
}

    .psa-detail__pin-limit-message > span {
        flex: 1;
    }

/* =============================================================================
   PSA detail panel â€” star toggle for favorites
   ============================================================================= */

.psa-detail__header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Star button â€” outlined when unpinned, gold-filled when pinned.
   We override the MudIconButton default color via the parent class so we don't
   have to thread Color through every consumer. */
.psa-detail__star {
    color: var(--mud-palette-text-secondary);
    transition: color 120ms ease, transform 120ms ease;
}

    .psa-detail__star:hover {
        color: var(--mud-palette-warning);
    }

.psa-detail__star--pinned {
    color: #f5b800; /* MudBlazor's warning isn't quite the right gold for a star */
}

    .psa-detail__star--pinned:hover {
        color: #f5b800;
        /* Subtle nudge on hover when already pinned, to signal "click to unpin" */
        transform: rotate(-8deg);
    }

/* Pin-limit info message that appears inside the panel when the user has
   hit their tier cap. */
.psa-detail__pin-limit-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background-color: var(--mud-palette-info-darken);
    color: var(--mud-palette-text-primary);
    border-left: 3px solid var(--mud-palette-info);
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
}

    .psa-detail__pin-limit-message > span {
        flex: 1;
    }

/* =============================================================================
   Favorite marker on the Fire Danger map (gold star overlay)
   ============================================================================= */
.fire-danger-map__favorite-marker {
    background: transparent;
    border: none;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

/* =============================================================================
   PageHeader — reusable page header (breadcrumb / title / badge / subtitle /
   trailing slot). Reproduces the prototype fires-page header treatment, themed
   via tokens. See Components/PageHeader.razor.
   ============================================================================= */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.page-header__breadcrumb {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.page-header__crumb--link {
    color: var(--mud-palette-primary);
    text-decoration: none;
}

    .page-header__crumb--link:hover {
        text-decoration: underline;
    }

.page-header__crumb--current,
.page-header__crumb-sep {
    color: var(--mud-palette-text-secondary);
}

.page-header__title {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header__badge {
    font-size: 13px;
    font-weight: 400;
}

.page-header__subtitle {
    font-size: 13px;
    max-width: 720px;
}

.page-header__trailing {
    margin-top: 12px;
}

/* Inline title-level adornment (info/help/status). The title row is
   align-items:baseline and an icon has no text baseline, so center it against
   the title's cap-height. */
.page-header__title-action {
    align-self: center;
    display: inline-flex;
    align-items: center;
}

/* =============================================================================
   FireDetections sub-page (/fire-danger/psa/{code}/fires) — Item 5.
   Ported from the prototype; header uses the shared PageHeader so the prototype's
   bespoke header/title/breadcrumb rules are intentionally not carried over.
   ============================================================================= */
.fire-detections-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 32px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.fire-detections-page__breadcrumb-link {
    color: var(--mud-palette-primary);
    text-decoration: none;
}

    .fire-detections-page__breadcrumb-link:hover {
        text-decoration: underline;
    }

/* ── Filter controls ── */
.fire-detections-page__controls {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
    padding: 16px;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
}

.fire-detections-page__filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fire-detections-page__filter-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.fire-detections-page__chips {
    display: inline-flex;
    background-color: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.fire-detections-page__chip {
    background: transparent;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: background-color 120ms ease, color 120ms ease;
    white-space: nowrap;
}

    .fire-detections-page__chip:hover {
        background-color: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-text-primary);
    }

.fire-detections-page__chip--active {
    background-color: var(--mud-palette-primary);
    color: #04342C;
    font-weight: 500;
}

    .fire-detections-page__chip--active:hover {
        background-color: var(--mud-palette-primary);
        color: #04342C;
    }

.fire-detections-page__controls-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fire-detections-page__reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: border-color 120ms ease, color 120ms ease;
}

    .fire-detections-page__reset-btn:hover {
        border-color: var(--mud-palette-primary);
        color: var(--mud-palette-primary);
    }

/* ── FRP-band tiles ── */
.fire-detections-page__stats {
    display: flex;
    gap: 16px;
    align-items: stretch;
    flex-wrap: wrap;
}

.fire-detections-page__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    min-width: 130px;
    border-left-width: 3px;
}

.fire-detections-page__stat--small { border-left-color: #9aa0a6; }
.fire-detections-page__stat--medium { border-left-color: var(--mud-palette-warning); }
.fire-detections-page__stat--significant { border-left-color: #e26a17; }
.fire-detections-page__stat--major { border-left-color: var(--mud-palette-error); }
.fire-detections-page__stat--total { border-left-color: var(--mud-palette-primary); margin-left: auto; }

.fire-detections-page__stat-value {
    font-size: 22px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
    font-variant-numeric: tabular-nums;
}

.fire-detections-page__stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.fire-detections-page__stat-divider { flex: 1; }

/* ── Split layout ── */
.fire-detections-page__split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 16px;
    height: 600px;
    min-height: 400px;
}

@media (max-width: 900px) {
    .fire-detections-page__split {
        grid-template-columns: 1fr;
        height: auto;
    }

    .fire-detections-page__map-wrap {
        height: 400px;
    }
}

/* ── Map ── */
.fire-detections-page__map-wrap {
    position: relative;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--mud-palette-background);
}

.fire-detections-page__map {
    width: 100%;
    height: 100%;
}

.fire-detections-page__map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    backdrop-filter: blur(2px);
    z-index: 500;
}

/* Detection markers + flash pulse */
.fire-detections-map__marker {
    background: transparent;
    border: none;
}

.fire-detections-map__marker--pulse {
    animation: fire-detection-pulse 1.5s ease-out;
}

@keyframes fire-detection-pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(38, 166, 154, 1)); }
    50% { transform: scale(1.6); filter: drop-shadow(0 0 6px rgba(38, 166, 154, 0.9)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(38, 166, 154, 0)); }
}

/* Leaflet layer-control reads on the light control box (matches the national map). */
.fire-detections-page__map .leaflet-control-layers-toggle { filter: none; }
.fire-detections-page__map .leaflet-control-layers label { color: #2c3340; }
.fire-detections-page__map .leaflet-control-layers-separator { border-top-color: #c2c8d0; }

/* ── List (right pane) ── */
.fire-detections-page__list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background-color: var(--mud-palette-surface);
    overflow: hidden;
    min-height: 0;
}

.fire-detections-page__list-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--mud-palette-divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--mud-palette-background);
}

.fire-detections-page__list-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

/* ── Natural Events surface (reuses the fire-detections chrome + these additions) ── */
/* Data-currency line between the controls and the split. */
.fire-detections-page__currency {
    font-size: 12px;
    margin: -4px 0 4px;
}
/* Category selector — wrapping chip row, each chip a label + live count. */
.natural-events-page__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.natural-events-page__cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 16px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}
    .natural-events-page__cat:hover { background: var(--mud-palette-action-default-hover); }
    .natural-events-page__cat--active {
        border-color: var(--mud-palette-primary);
        color: var(--mud-palette-primary);
        font-weight: 600;
    }
.natural-events-page__cat-count {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-action-default-hover);
    border-radius: 10px;
    padding: 0 6px;
    min-width: 18px;
    text-align: center;
}
    .natural-events-page__cat--active .natural-events-page__cat-count {
        color: var(--mud-palette-primary);
    }
/* Detail key/value rows. */
.natural-events-page__kv {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    padding: 2px 0;
}
    .natural-events-page__kv > span:first-child { color: var(--mud-palette-text-secondary); }
/* Custom recency range (start–end date inputs), shown when the Custom window chip is active. */
.natural-events-page__range {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
}
.natural-events-page__date {
    font: inherit;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: 6px;
    padding: 3px 8px;
}
    .natural-events-page__date:focus { outline: none; border-color: var(--mud-palette-primary); }
/* Footer source attribution. */
.natural-events-page__attribution {
    font-size: 11.5px;
    margin-top: 8px;
}

/* ── Ice / Winter Hazard (WSSI) surface ───────────────────────────────────── */
/* The frame scrubber sits in the controls row; give it room to breathe. */
.ice-page__scrubber-group { min-width: 280px; flex: 1 1 280px; }
.ice-page__scrubber-group .fd-scrubber { margin-top: 2px; }

/* Map wrap is position:relative so the legend + empty-state can overlay it. Unlike the
   Natural-Events map, this wrap has NO __split grid parent to give it height, so it must set
   its own — else the Leaflet container collapses to 0 and esri-leaflet exports size=W,0 (NOAA
   500s → null removeLayer crash). Mirrors the __split's 600px desktop / 400px mobile sizing. */
.ice-page__map-wrap {
    position: relative;
    height: 600px;
    min-height: 400px;
}
@media (max-width: 900px) {
    .ice-page__map-wrap { height: 400px; }
}

/* Impact legend — bottom-left card over the map. */
.ice-page__legend {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 500;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    font-size: 12px;
}
.ice-page__legend-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.ice-page__legend-item { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.ice-page__swatch {
    display: inline-block;
    width: 14px; height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, .35);
    flex: none;
}
.ice-page__swatch--lg { width: 20px; height: 20px; }

/* Honest empty-state — centered over the map when the current layer has no features. */
.ice-page__empty {
    position: absolute;
    inset: 0;
    z-index: 450;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    pointer-events: none;   /* let the user still pan/click the map underneath */
    color: var(--mud-palette-text-secondary);
}
.ice-page__empty-title { font-size: 15px; font-weight: 600; color: var(--mud-palette-text-primary); }

/* Identify detail — impact row in the slide-over. */
.ice-page__impact-row { display: flex; align-items: center; gap: 10px; }
.ice-page__impact-label { font-size: 15px; font-weight: 600; }

.fire-detections-page__list-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.fire-detections-page__row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--mud-palette-divider);
    cursor: pointer;
    transition: background-color 120ms ease;
    color: var(--mud-palette-text-primary);
}

    .fire-detections-page__row:hover {
        background-color: var(--mud-palette-action-default-hover);
    }

.fire-detections-page__row--highlighted {
    background-color: rgba(38, 166, 154, 0.12);
    border-left: 3px solid var(--mud-palette-primary);
    padding-left: 13px;
}

.fire-detections-page__row-time { font-size: 13px; font-weight: 500; }

.fire-detections-page__row-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    flex-wrap: wrap;
}

.fire-detections-page__row-frp {
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.fire-detections-page__row-frp--small { background-color: rgba(154, 160, 166, 0.18); color: #c8ccd1; }
.fire-detections-page__row-frp--medium { background-color: rgba(245, 184, 0, 0.18); color: var(--mud-palette-warning); }
.fire-detections-page__row-frp--significant { background-color: rgba(226, 106, 23, 0.22); color: #f3934a; }
.fire-detections-page__row-frp--major { background-color: rgba(226, 75, 74, 0.22); color: var(--mud-palette-error); }

.fire-detections-page__row-confidence { font-size: 11px; }

.fire-detections-page__row-coords {
    margin-left: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

/* ── Settings hub (Slice A) — 2×2 nav-card grid; matches the outlined card look ── */
.settings-hub__card {
    transition: border-color .14s ease, background-color .14s ease;
}
.settings-hub__card[role="button"] {
    cursor: pointer;
}
.settings-hub__card[role="button"]:hover {
    border-color: var(--mud-palette-primary);
}
.settings-hub__card[role="button"]:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
.settings-hub__card--soon {
    opacity: .75;   /* deliberately scaffolded, not broken */
}
.settings-hub__icon {
    width: 44px; height: 44px; border-radius: 10px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: var(--mud-palette-primary-hover);
    color: var(--mud-palette-primary);
}
.settings-hub__icon--soon {
    background: var(--mud-palette-action-disabled-background);
    color: var(--mud-palette-text-secondary);
}
.settings-hub__title {
    font-weight: 600;
}
.settings-hub__soon-chip {
    flex: 0 0 auto; white-space: nowrap;
    font-size: 11px; font-weight: 600; letter-spacing: .02em;
    color: var(--mud-palette-text-secondary);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px; padding: 2px 10px;
}

.fire-detections-page__list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
    gap: 4px;
}

/* ── Air Quality surface (Item 6, Slice 2) — app navy/teal chrome; EPA hex only on swatches ── */
/* Viewport-fill column (F2) — copies Fire Danger's mechanism (.fire-danger-page):
   .app-shell__content is a height-constrained flex:1 scroll area, the page root fills it
   (height:100%), and the map flexes to consume the leftover height, pinning the disclaimer
   to the bottom of the viewport. Unlike FD (overflow:hidden, never scrolls), AQ keeps a
   min-height floor on the map and lets short windows scroll below it. */
.air-quality-page {
    display: flex; flex-direction: column;
    height: 100%; min-height: 0;
}
.air-quality-page__stack {
    flex: 1 1 auto; min-height: 0;
}

/* Favorites chips row (R3) — starred monitors between the toggle row and the KPI strip.
   New chrome (FD has no chips-row prior art — its favorites are map star markers);
   styled consistent with the app's chip idioms. */
.air-quality-page__favchips {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.air-quality-page__favchip {
    display: inline-flex; align-items: center;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 16px; overflow: hidden;
}
.air-quality-page__favchip-body {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 4px 4px 5px; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: 12.5px; color: var(--mud-palette-text-primary);
}
.air-quality-page__favchip-body:hover { background: var(--mud-palette-action-default-hover); }
.air-quality-page__favchip-aqi {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 20px; padding: 0 5px;
    border-radius: 10px; font-size: 11px; font-weight: 700; color: #06140f;
}
.air-quality-page__favchip-name { white-space: nowrap; }
.air-quality-page__favchip-nodata {
    font-size: 10.5px; font-style: italic; color: var(--mud-palette-text-disabled);
}
.air-quality-page__favchip-x {
    border: 0; background: none; cursor: pointer;
    padding: 4px 9px 4px 6px; font-size: 11px; line-height: 1;
    color: var(--mud-palette-text-secondary);
    border-left: 1px solid var(--mud-palette-divider);
}
.air-quality-page__favchip-x:hover { color: var(--mud-palette-error); background: var(--mud-palette-action-default-hover); }
/* Degraded: the favorite isn't in the current snapshot (dropped/missing) — greyed, kept. */
.air-quality-page__favchip--absent { opacity: .62; }

/* KPI strip (R4): 3-card row above the map — same grid as Fire Danger's
   .fire-danger-page__kpis (the cards themselves reuse the fire-danger-kpi* chrome). */
.air-quality-page__kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex-shrink: 0;
}
.air-quality-page__kpi-sub {
    font-size: 11px;
    margin-top: 2px;
}

/* Search row (F1/F2): its own row under the mode toggle, left-aligned flush with the
   map's left edge. */
.air-quality-page__searchrow {
    display: flex; justify-content: flex-start;
}
.air-quality-page__tabs {
    display: inline-flex; gap: 4px; padding: 4px;
    background: var(--mud-palette-background-grey);
    border: 1px solid var(--mud-palette-divider); border-radius: 11px; width: max-content;
}
.air-quality-page__search {
    width: 480px; max-width: 100%;   /* F3: wider field; still shrinks on narrow windows */
}
.air-quality-page__map {
    position: relative;
    flex: 1 1 0;          /* F2: grow to fill the remaining viewport height */
    min-height: 420px;    /* floor on short windows — page scrolls below this, never collapses */
    border: 1px solid var(--mud-palette-divider); border-radius: 12px; overflow: hidden;
}
.air-quality-map { position: absolute; inset: 0; }

/* Guidance hint, centered over the map while no monitor is selected (the detail panel is
   a slide-in, à la Fire Danger). pointer-events:none so map pan/zoom passes through; the
   card re-enables its own pointer events for legibility. */
.air-quality-page__hint {
    position: absolute; inset: 0; z-index: 450;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; pointer-events: none;
}
.air-quality-page__hint-card {
    pointer-events: auto;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    max-width: 320px; padding: 20px 24px;
    background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-divider);
    border-radius: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
/* "as of {time}" snapshot-freshness chip, top-left — offset to clear the zoom/home
   control stack (matches Fire Danger's .fire-danger-map-info left:60px). */
.air-quality-page__asof {
    position: absolute; left: 60px; top: 12px; z-index: 500;
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-divider);
    border-radius: 8px; padding: 4px 9px; font-size: 11.5px;
    color: var(--mud-palette-text-secondary);
}
.air-quality-page__asof--stale {
    color: var(--mud-palette-warning-text, #a05a00);
    border-color: var(--mud-palette-warning, #ed6c02);
    background: rgba(237, 108, 2, .10);
}
/* Transient map note (S4b/S7b): clean-day / fetch-failure / zoom-gate messages, top-center
   of the map (clear of the zoom stack and the layer control). Teal accent + elevation (F-pass
   restyle) so it actually reads against the dark basemap. */
.air-quality-page__contour-note {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500;
    max-width: 70%; text-align: center;
    background: var(--mud-palette-surface);
    border: 1.5px solid var(--mud-palette-primary);
    border-radius: 8px; padding: 6px 14px;
    font-size: 12.5px; font-weight: 600;
    color: var(--mud-palette-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .45);
}
/* Smoke-lens empty-fires note (S8a) — deliberately distinct from the transient failure
   note above: BOTTOM-centre, subtler (no heavy shadow), an info pill rather than an alert. */
.air-quality-page__fires-note {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 500;
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-primary);
    border-radius: 999px; padding: 4px 12px;
    font-size: 12px; font-weight: 500;
    color: var(--mud-palette-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
/* Home/reset control — styled to match Leaflet's zoom buttons (mirrors .fire-danger-map-reset). */
.air-quality-map-reset a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border-color: var(--mud-palette-divider);
}
    .air-quality-map-reset a:hover {
        background-color: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-primary);
    }
/* Inactive (carried-forward) monitor badge in the panel header (F3). */
.air-quality-page__stale-badge {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 5px; font-size: 11px; font-weight: 600;
    color: var(--mud-palette-warning-text, #a05a00);
    background: rgba(237, 108, 2, .10); border: 1px solid var(--mud-palette-warning, #ed6c02);
    border-radius: 10px; padding: 2px 8px;
}
.air-quality-page__legend {
    position: absolute; left: 12px; bottom: 12px; z-index: 500;
    background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-divider);
    border-radius: 10px; padding: 9px 11px; font-size: 12px;
}
.air-quality-page__legend-head {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--mud-palette-text-secondary); margin-bottom: 6px;
}
.air-quality-page__legend-hint {
    text-transform: none; letter-spacing: 0; opacity: .75; font-style: italic;
}
/* F4 — non-interactive "★ Starred" key line (no role/hover/cursor — visually a key, not a toggle). */
.air-quality-page__legend-key {
    cursor: default;
    border-top: 1px solid var(--mud-palette-divider);
    margin-top: 5px; padding-top: 5px;
    color: var(--mud-palette-text-secondary);
}
.air-quality-page__legend-star {
    color: #f5b800;   /* the panel-star / map-star gold */
    font-size: 13px; line-height: 1; width: 12px; text-align: center; flex: 0 0 auto;
}
/* Smoke-lens legend sub-header ("Active fires") — groups the FRP ramp below it. */
.air-quality-page__legend-subhead {
    font-weight: 600; border-top: none; margin-top: 2px; padding-top: 2px;
}
/* The star divIcon wrapper (divIcon's default class would add a white box). */
.air-quality-map__star { background: none; border: none; }

/* F1 — legend bands are filter toggles. */
.air-quality-page__legend li[role="button"] { cursor: pointer; user-select: none; border-radius: 5px; padding: 1px 3px; margin-left: -3px; }
.air-quality-page__legend li[role="button"]:hover { background: var(--mud-palette-action-default-hover); }
.air-quality-page__legend-band--off { opacity: .42; text-decoration: line-through; }
.air-quality-page__legend-band--off .air-quality-page__swatch { filter: grayscale(.8); }
.air-quality-page__legend ul,
.air-quality-edu__cats {
    list-style: none; margin: 0; padding: 0;
}
.air-quality-page__legend li,
.air-quality-edu__cats li {
    display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
    color: var(--mud-palette-text-primary);
}
.air-quality-edu__cats { margin: 10px 0 14px; }
.air-quality-edu__cats li { margin-bottom: 6px; font-size: 13px; }
.air-quality-page__swatch {
    width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto;
    border: 1px solid rgba(0,0,0,.25);
}

/* Monitor detail panel (S3, restructured F3) */
/* Hero — headline AQI with a category-colored left accent; border-left-color + the light
   background tint (8-digit hex alpha) are set inline per the dominant category. */
.air-quality-page__hero {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 14px; border-radius: 8px;
    border-left: 4px solid transparent;
}
.air-quality-page__aqi { font-size: 44px; font-weight: 700; line-height: 1; }
/* Smoke-lens no-PM2.5 hero (S8a Item A): icon + absence headline instead of an AQI number. */
.air-quality-page__nopm-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.air-quality-page__chip {
    display: inline-block; font-size: 12px; font-weight: 700; color: #06140f;
    padding: 3px 10px; border-radius: 20px;
}
.air-quality-page__poll {
    display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.air-quality-page__poll-name { width: 52px; color: var(--mud-palette-text-secondary); }
.air-quality-page__poll-bar {
    flex: 1; height: 7px; border-radius: 4px; overflow: hidden;
    background: var(--mud-palette-background-grey);
}
.air-quality-page__poll-fill { display: block; height: 100%; border-radius: 4px; }
.air-quality-page__poll-val { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
/* Tiny per-row EPA category chip (pollutant rows + forecast rows, F3). */
.air-quality-page__poll-cat {
    flex: 0 0 auto; font-size: 10px; font-weight: 700; color: #06140f;
    padding: 1px 7px; border-radius: 10px; white-space: nowrap;
}
.air-quality-page__fc {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.air-quality-page__fc-day { width: 78px; flex: 0 0 auto; font-weight: 600; font-size: 12px; }
/* Health guidance line (static EPA phrasing for the dominant category, F3). */
.air-quality-page__guidance {
    font-size: 12.5px; line-height: 1.45; color: var(--mud-palette-text-secondary);
}
/* Freshness footer — snapshot time vs site-reported time, quietly at the content bottom. */
.air-quality-page__freshness {
    font-size: 11px; color: var(--mud-palette-text-disabled);
}