/* Flood Watch — Escalations widget. Theme-token only (honours data-theme).
   Self-contained, installable module — see flood-watch.js. No hardcoded hex
   except risk colours derived from the brand status tokens. */

.fw-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }   /* dashboard-card mode fills the card body */
#flood-root { position: absolute; inset: 0; }   /* nav-view mode fills the page */
/* catchment / region picker + title block in the bar */
.fw-titlewrap { min-width: 0; }
.fw-catchment {
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface-raised, var(--surface)); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 8px; cursor: pointer; max-width: 200px;
}
.fw-catchment:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.fw-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.fw-bar h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.fw-bar .fw-sub { font-size: 12px; color: var(--text-muted); }
.fw-bar .fw-spacer { flex: 1; }
.fw-asof { font-size: 11px; color: var(--text-muted); }
.fw-asof b { color: var(--text-secondary); font-weight: 600; }

/* Themed "as of" date+time picker (replaces the unthemeable native calendar
   popup). All colours come from theme tokens, so it follows dark/light + the
   tenant accent everywhere. */
.fw-dp { position: relative; }
.fw-dp-trig .fw-dp-lab { font-variant-numeric: tabular-nums; }
.fw-dp-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: 264px;
  background: var(--surface-raised, var(--surface)); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 8px 28px rgba(0,0,0,.35); padding: 10px; }
.fw-dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.fw-dp-mo { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.fw-dp-nav { width: 26px; height: 26px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 15px; line-height: 1; }
.fw-dp-nav:hover { border-color: var(--accent); color: var(--accent); }
.fw-dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.fw-dp-wd { text-align: center; font-size: 10px; color: var(--text-muted); padding: 2px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.fw-dp-day { height: 30px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none;
  color: var(--text-primary); font-size: 12px; cursor: pointer; font-family: inherit; font-variant-numeric: tabular-nums; }
.fw-dp-day:hover:not(.fw-dp-off) { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fw-dp-empty { visibility: hidden; }
.fw-dp-off { color: var(--text-muted); opacity: .4; cursor: not-allowed; }
.fw-dp-today:not(.fw-dp-sel) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.fw-dp-sel { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); font-weight: 700; }
.fw-dp-sel:hover { background: var(--accent); }
.fw-dp-time { display: flex; align-items: center; gap: 6px; margin: 9px 0 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.fw-dp-time b { color: var(--text-secondary); }
.fw-dp-time input { width: 44px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-primary); font-size: 12px; font-family: inherit; text-align: center; accent-color: var(--accent); }
.fw-dp-time input:focus { border-color: var(--accent); outline: none; }
.fw-dp-foot { display: flex; align-items: center; gap: 6px; }
.fw-dp-foot button { padding: 5px 11px; border-radius: var(--radius-sm); font-size: 11.5px; font-weight: 600; cursor: pointer; font-family: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); }
.fw-dp-foot button:hover { border-color: var(--accent); color: var(--accent); }
.fw-dp-apply { background: var(--accent) !important; color: var(--on-accent, #fff) !important; border-color: var(--accent) !important; }
.fw-dp-apply:hover { filter: brightness(1.06); }

.fw-body { flex: 1; display: flex; min-height: 0; }
.fw-mapwrap { flex: 1; position: relative; min-width: 0; }
/* Fallback layout only: fill the .fw-mapwrap. In shared-shell mode the SAME .fw-map is
   the shell's .pa-map, which must stay position:relative/flex:1 (the .pa-fleet-grid rule)
   — so this absolute rule MUST NOT leak there or the map covers the panel. */
.fw-mapwrap .fw-map { position: absolute; inset: 0; }
.fw-map { background: var(--primary-light); }
.fw-map .maplibregl-popup-content {
  background: var(--surface-raised); color: var(--text-primary); font-size: 12px;
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.fw-map .maplibregl-ctrl-group { background: var(--surface); border: 1px solid var(--border); }
/* ODbL attribution — discrete + collapsed in the bottom-right corner. Small, subtle, shows
   just the compact "i"; the credit text reveals on hover/focus (legally accessible, visually
   out of the way). Robust against builds that render the inner expanded by default. */
/* Default: NO box — just the faint SVG "i" glyph (MapLibre's own button icon), low-opacity.
   The credit text (with the OSM copyright link) reveals on hover/focus with a subtle backing. */
.fw-map .maplibregl-ctrl-attrib { background: transparent !important; box-shadow: none; font-size: 10px; line-height: 1.4; }
/* Replace MapLibre's filled-disc "i" with a clean ring+i glyph (no background), tinted with the
   theme token so it reads on light AND dark basemaps; very faint until hover. */
.fw-map .maplibregl-ctrl-attrib-button {
  width: 18px; height: 18px; border: 0; box-shadow: none; opacity: .35; transition: opacity .15s ease;
  background-color: var(--text-muted) !important; background-image: none !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 100 20 10 10 0 000-20zm0 18a8 8 0 110-16 8 8 0 010 16zm-1-9h2v6h-2zm0-4h2v2h-2z'/%3E%3C/svg%3E") center / 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 100 20 10 10 0 000-20zm0 18a8 8 0 110-16 8 8 0 010 16zm-1-9h2v6h-2zm0-4h2v2h-2z'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.fw-map .maplibregl-ctrl-attrib-button:hover, .fw-map .maplibregl-ctrl-attrib:focus-within .maplibregl-ctrl-attrib-button { opacity: .85; }
.fw-map .maplibregl-ctrl-attrib a { color: var(--text-muted); text-decoration: none; }
.fw-map .maplibregl-ctrl-attrib.maplibregl-compact:not(:hover):not(:focus-within) .maplibregl-ctrl-attrib-inner { display: none; }
.fw-map .maplibregl-ctrl-attrib.maplibregl-compact:hover,
.fw-map .maplibregl-ctrl-attrib.maplibregl-compact:focus-within {
  background: color-mix(in srgb, var(--surface) 86%, transparent) !important; border-radius: 5px 0 0 0; color: var(--text-muted);
}

/* right rail: escalations list + detail */
.fw-side {
  width: 360px; flex-shrink: 0; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; background: var(--surface);
}
.fw-side-head { padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.fw-list { overflow-y: auto; flex: 1; }
.fw-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; gap: 10px; transition: var(--transition);
}
.fw-item:hover { background: var(--surface-hover); }
.fw-item.active { background: var(--surface-active); }
.fw-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.fw-item-main { flex: 1; min-width: 0; }
.fw-item-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.fw-item-meta { font-size: 11px; color: var(--text-muted); }
.fw-empty { display: flex; align-items: center; justify-content: center; height: 100%; padding: 8px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Flood RAG (green / amber / red) is SAFETY-CRITICAL: the three tiers must stay
   perceptually distinct regardless of the tenant brand accent. Amber therefore
   uses a FIXED semantic amber here — NOT var(--accent) — so an amber alert never
   collapses into the brand colour (e.g. a green-branded tenant would otherwise
   render amber sites green, indistinguishable from a normal green site). Green
   (--success) and Red (--danger) are already fixed semantic tokens. */
.fw-root, #flood-root {
  --fw-amber:      #F5A623;
  --fw-amber-dim:  #E8970A;
  --fw-amber-glow: color-mix(in srgb, #F5A623 15%, transparent);
}
[data-theme="light"] .fw-root, [data-theme="light"] #flood-root { --fw-amber-dim: #9a7b00; }  /* darker amber for AA on light */

/* risk colours (3 tiers: green / amber / red) */
.fw-risk-red    { background: var(--danger); }
.fw-risk-amber  { background: var(--fw-amber); }
.fw-risk-green  { background: var(--success); }
.fw-risk-unknown{ background: var(--text-muted); }

/* Status pill — the currentColor border gives it definition on BOTH themes (the
   borderless tint read as a washed-out blob on the light theme, e.g. the
   "Elevated" pills in Past events). line-height pins the height so a pill can
   never collide with the row divider above it. */
.fw-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: capitalize;
  line-height: 1.4; border: 1px solid color-mix(in srgb, currentColor 32%, transparent); }
.fw-pill.red    { background: var(--pill-bg-danger);  color: var(--danger); }
.fw-pill.amber  { background: var(--fw-amber-glow);   color: var(--fw-amber-dim); }
.fw-pill.green  { background: var(--pill-bg-success); color: var(--success); }
.fw-pill.unknown{ background: color-mix(in srgb, var(--text-muted) 16%, transparent); color: var(--text-muted); }

/* Time-to-flood ETA — surfaced only when rising toward a tier or already in exceedance (a warning
   state), so it carries a tier-toned accent; nothing renders when a site is normal/steady. */
.fw-item-eta { font-size: 10.5px; line-height: 1.3; margin-top: 2px; font-weight: 600; color: var(--fw-amber-dim); }
.fw-item-eta.red { color: var(--danger); }
/* uncorroborated trend: informational, NEVER alarm-toned — the model's own
   forecast projects no exceedance, so the row must not read as a countdown */
.fw-item-eta.plain { color: var(--text-muted); font-weight: 500; }
.fw-kv.fw-eta .v { font-weight: 600; color: var(--fw-amber-dim); }
.fw-kv.fw-eta.red .v { color: var(--danger); }

/* Status summary banner (Green / Amber / Red — matches the set-point tiers) — above the list */
.fw-rag { display: flex; gap: 6px; padding: 8px 12px 4px; }
.fw-rag-seg { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 4px; border-radius: 8px; font-size: 13px; font-weight: 700; line-height: 1;
  background: color-mix(in srgb, var(--text-muted) 8%, transparent);
  color: var(--text-muted); border: 1px solid transparent; transition: background .15s, color .15s, box-shadow .15s;
  cursor: pointer; font-family: inherit; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
.fw-rag-seg:hover { filter: brightness(1.08); }
.fw-rag-seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fw-rag-seg.sel { box-shadow: 0 0 0 2px currentColor inset; }   /* active filter — ring in the segment's own colour */
.fw-rag-seg i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .4; flex: none; }
.fw-rag-seg em { font-style: normal; font-weight: 500; font-size: 11px; opacity: .9; }
.fw-rag-seg.on i { opacity: 1; }
.fw-rag-green.on { background: var(--pill-bg-success); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
/* single amber tier (DCC "Medium" alarm) — fixed semantic amber, readable in
   BOTH themes (--fw-amber-dim darkens on the light theme for AA contrast) */
.fw-rag-amber.on { background: var(--fw-amber-glow);   color: var(--fw-amber-dim); border-color: color-mix(in srgb, var(--fw-amber) 35%, transparent); }
.fw-rag-red.on   { background: var(--pill-bg-danger);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* map markers */
.fw-marker { position: relative; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff;
  cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.fw-marker.fw-risk-red    { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 30%, transparent); }
.fw-marker.fw-risk-amber  { box-shadow: 0 0 0 6px var(--fw-amber-glow); }
.fw-marker.fw-risk-green  { box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 22%, transparent); }

/* SELECTED site — a radar "ping" pulse draws the eye to the chosen pin, the way a
   delivery-tracking map marks the active stop. Functional (it marks the selection,
   not decoration), one accent, theme-tokened: the pin keeps its RAG colour and the
   ping is the tenant accent. Two staggered rings = a continuous, calm pulse. */
.fw-marker.fw-active { z-index: 6; }
.fw-marker.fw-active::before,
.fw-marker.fw-active::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%;
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
  animation: fw-ping 3s cubic-bezier(0, 0, .2, 1) infinite;
  pointer-events: none;
}
.fw-marker.fw-active::after { animation-delay: 1.5s; }
@keyframes fw-ping {
  0%   { opacity: .75; transform: translate(-50%, -50%) scale(1); }
  70%  { opacity: 0; }
  100% { opacity: 0;  transform: translate(-50%, -50%) scale(3.4); }
}
@media (prefers-reduced-motion: reduce) {
  .fw-marker.fw-active::before, .fw-marker.fw-active::after { animation: none; opacity: .6; }
}

/* detail panel (collapsible sections collapsed by default per house rule) */
.fw-detail { border-top: 1px solid var(--border); padding: 14px 16px; overflow-y: auto; max-height: 52%; }
/* collapsible + drag-resizable site-detail group (the head is the drag handle + the collapse toggle) */
.fw-detail-wrap { display: flex; flex-direction: column; border-top: 1px solid var(--border); min-height: 0; }
/* The structure is .fw-detail-wrap > .fw-detail-body > .fw-detail (the earlier `> .fw-detail` rules
   targeted a grandchild and never matched). JS sets the BODY height; it must CLIP so a collapsed or
   short body never spills its content onto the legend. The inner .fw-detail fills the body + scrolls. */
/* Content-sized: the BODY is its content (JS sets a max-height = available space) and scrolls if it
   exceeds that — so there's no fixed height taller than the content (= no void). The inner .fw-detail
   just flows; the body is the scroll container. */
.fw-detail-wrap > .fw-detail-body { flex: 0 0 auto; overflow-y: auto; min-height: 0; }
.fw-detail-body > .fw-detail { height: auto; max-height: none; overflow: visible; box-sizing: border-box; border-top: none; }
.fw-detail-wrap.collapsed > .fw-detail-body { height: 0 !important; }
.fw-detail-head { display: flex; align-items: center; gap: 8px; padding: 9px 16px; cursor: pointer;   /* click = collapse; the grip = resize */
  user-select: none; touch-action: none; background: color-mix(in srgb, var(--text-muted) 5%, transparent); }
.fw-detail-head:hover { background: color-mix(in srgb, var(--text-muted) 10%, transparent); }
.fw-detail-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fw-detail-title { flex: 1; min-width: 0; font-size: 11px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* visible drag-to-resize affordance (separate from the click-to-collapse chevron) */
.fw-detail-grip { width: 22px; height: 11px; flex: none; cursor: ns-resize; color: var(--text-muted); opacity: .5;
  background: repeating-linear-gradient(currentColor 0 1.5px, transparent 1.5px 4px); border-radius: 2px; }
.fw-detail-grip:hover { opacity: .85; }
.fw-chevron { width: 16px; height: 16px; color: var(--text-muted); flex: none; transition: transform .15s; }
.fw-detail-wrap.collapsed .fw-chevron { transform: rotate(-90deg); }
.fw-detail h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.fw-detail .fw-d-sub { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.fw-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 0; }
.fw-kv .k { color: var(--text-muted); }
.fw-kv .v { color: var(--text-primary); font-weight: 600; text-align: right; }
.fw-kv .v.fw-lvl-now { font-size: 15px; letter-spacing: .2px; }
/* uncorroborated level trend: a full-width, LEFT-aligned informational note —
   long sentences never squeeze into the right-aligned kv column */
.fw-trendnote { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: color-mix(in srgb, var(--text-muted) 7%, transparent);
  color: var(--text-muted); font-size: 11.5px; line-height: 1.45; }
.fw-trendnote svg { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; opacity: .8; }
.fw-trendnote b { color: var(--text-primary); font-weight: 600; }
.fw-sec { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.fw-sec > summary { cursor: pointer; padding: 8px 10px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: 6px; background: var(--surface-raised); }
.fw-sec > summary::-webkit-details-marker { display: none; }
.fw-sec[open] > summary { border-bottom: 1px solid var(--border); }
.fw-sec .fw-sec-body { padding: 8px 10px; font-size: 12px; color: var(--text-primary); line-height: 1.5; }
/* recommended response — PRIMARY content for an active escalation (always visible,
   not a collapsed section): accented card so the operator sees the action at a glance */
.fw-rec { margin-top: 10px; border: 1px solid var(--accent); border-radius: var(--radius-sm); overflow: hidden; }
/* Header text is the PRIMARY text token — accent-on-accent-glow was unreadable
   in dark mode (user report); the tinted background + accent border already
   carry the emphasis. */
.fw-rec-h { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-primary); background: var(--accent-glow); }
.fw-rec-b { padding: 8px 10px; font-size: 12px; color: var(--text-primary); line-height: 1.5; }
.fw-prov { font-size: 10px; color: var(--text-muted); font-style: italic; }
.fw-prov[title] { cursor: help; text-decoration: underline dotted; text-underline-offset: 2px; }
/* trend-vs-forecast reconciliation under the Time-to-flood row */
.fw-eta-note { font-size: 10.5px; color: var(--text-muted); font-style: italic; line-height: 1.4; margin: -2px 0 6px; }
.fw-driver { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 0; }

.fw-btn { padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-raised); color: var(--text-secondary); font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: var(--transition); }
.fw-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.fw-btn svg { width: 14px; height: 14px; }
.fw-input { padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-raised); color: var(--text-primary); font-size: 12px; }

/* ---- site search (autosuggest) ---- */
.fw-search { position: relative; display: flex; align-items: center; }
.fw-search-ic { position: absolute; left: 9px; width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.fw-search-in { padding: 6px 10px 6px 28px; width: 180px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--text-primary); font-size: 12px; }
.fw-search-in:focus { outline: none; border-color: var(--accent); }
.fw-suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 200px; z-index: 30;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); overflow: hidden; }
.fw-suggest:empty { display: none; }
.fw-sug { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 12px;
  color: var(--text-primary); cursor: pointer; }
.fw-sug:hover { background: var(--surface-hover); }
.fw-sug-empty { color: var(--text-muted); cursor: default; }
.fw-sug-empty:hover { background: transparent; }

/* ---- hover label (street / place name under the cursor) ---- */
.fw-maptip { position: absolute; z-index: 20; display: none; pointer-events: none; white-space: nowrap;
  padding: 3px 8px; font-size: 11px; border-radius: var(--radius-sm);
  background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,.35); transform: translateZ(0); }

/* ---- shared-shell integration (paMapPanelShell) ----
   The widget renders its map + panel through the platform's ONE shared map-panel shell
   so it gets the identical chrome (collapse toggle, drag-resize, branded scrollbars) as
   every other map widget. The shell owns the split layout; we only host content. */
.fw-shellhost { position: relative; flex: 1; min-height: 0; }
/* Inside the shared .pa-fleet-panel: a vertical SPLIT, not a single scroll surface. The list
   FLEXES to absorb the free space and the detail is anchored at the bottom (above the legend),
   so dragging the detail's top edge resizes list-vs-detail without ever leaving a void. */
.fw-shellhost .pa-fleet-panel { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.fw-shellhost .pa-fleet-panel .fw-list { flex: 1 1 0; min-height: 40px; overflow-y: auto; }
.fw-shellhost .pa-fleet-panel .fw-detail-wrap { flex: 0 0 auto; }       /* anchored bottom; JS sets its body height */
.fw-shellhost .pa-fleet-panel .fw-legend { flex: 0 0 auto; }
.fw-shellhost .pa-fleet-panel .fw-detail-wrap > .fw-detail { max-height: none; overflow-y: auto; border-top: none; }
.fw-shellhost .pa-fleet-panel .fw-side-head { padding: 0 16px 8px; }

/* mOD / data-attribution legend (collapsed-by-default spirit: a quiet muted footer) */
.fw-legend { font-size: 11px; color: var(--text-muted); padding: 10px 16px; border-top: 1px solid var(--border); line-height: 1.5; }
.fw-legend abbr { color: var(--text-secondary); text-decoration: underline dotted; cursor: help; }

/* Map marker hover tooltip (name + level) — dark, matches the widget chrome (not the white default). */
.fw-popup .maplibregl-popup-content { background: var(--surface-raised, var(--surface)); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; box-shadow: 0 6px 22px rgba(0,0,0,.45); }
.fw-popup .maplibregl-popup-tip { display: none; }

/* Interactive level-forecast chart (replaces the Nowcast/Forecast text rows in the detail). */
.fw-fc { position: relative; margin: 11px 0 5px; }
.fw-fc-host { width: 100%; height: 124px; }   /* ECharts canvas container (responsive via ResizeObserver) */
.fw-fc-title { font-size: 10.5px; color: var(--text-muted); margin-bottom: 5px; }
.fw-fc-note { text-decoration: underline dotted; cursor: help; }
/* visible honesty caveat (the full explanation is in its title tooltip) */
.fw-fc-cav { font-size: 9.5px; color: var(--text-muted); opacity: .85; text-decoration: underline dotted; cursor: help; }
/* set-point tier value labels (so the dashed reference lines are identifiable) */
.fw-fc-tierlab { font-size: 7.5px; opacity: .9; }
.fw-fc-tierlab.amber { fill: var(--fw-amber-dim); }
.fw-fc-tierlab.red   { fill: var(--danger); }
.fw-fc-svg { width: 100%; height: 92px; display: block; overflow: visible; }
.fw-fc-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.fw-fc-tier { stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; opacity: .85; }
.fw-fc-tier.amber { stroke: var(--fw-amber-dim); }
.fw-fc-tier.red   { stroke: var(--danger); }
.fw-fc-dot { stroke: var(--surface); stroke-width: 1.4; }
.fw-fc-dot.green  { fill: var(--success); }
.fw-fc-dot.amber  { fill: var(--fw-amber-dim); }
.fw-fc-dot.red    { fill: var(--danger); }
.fw-fc-dot.unknown{ fill: var(--text-muted); }
.fw-fc-xlab { font-size: 8px; fill: var(--text-muted); }
.fw-fc-cursor { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; display: none; }
.fw-fc-tip { position: absolute; top: 15px; transform: translateX(-50%); background: var(--surface-raised, var(--surface)); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; font-size: 11px; white-space: nowrap; pointer-events: none; display: none; color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.fw-fc-tip.red   { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.fw-fc-tip.amber { border-color: color-mix(in srgb, var(--fw-amber-dim) 55%, var(--border)); }

/* icon-only action button (add catchment / gear) — no label span, square */
.fw-icon-btn { padding: 6px; }

@media (max-width: 760px) {
  .fw-body { flex-direction: column; }
  .fw-side { width: auto; border-left: none; border-top: 1px solid var(--border); max-height: 45%; }
}

/* Feed-cadence panel (gear in the header): the DATABASE-driven pull intervals.
   Anchored under the bar; theme tokens only — honours light/dark. */
.fw-bar { position: relative; }
.fw-feeds-pop { position: absolute; top: calc(100% + 6px); right: 44px; z-index: 60; width: 384px; max-width: calc(100vw - 24px);
  background: var(--surface-raised, var(--surface)); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: 10px 12px; }
.fw-feeds-h { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.fw-feeds-hint { font-size: 10.5px; color: var(--text-muted); margin: 2px 0 8px; }
/* ONE line per feed: [enable] label · status-dot · every [n] min · save-icon.
   The dot carries the last-run status honestly (red = failed, tooltip = detail). */
.fw-feed-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding: 7px 0; }
.fw-feed-on { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-primary); min-width: 0; flex: 1; }
.fw-feed-on b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-feed-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; cursor: help; }
.fw-feed-dot.ok { background: var(--success); }
.fw-feed-dot.err { background: var(--danger); }
.fw-feed-dot.na { background: var(--text-muted); opacity: .6; }
.fw-feed-dot.saved { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 30%, transparent); }
.fw-feed-int { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.fw-feed-int input { width: 52px; padding: 3px 5px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-primary); font-size: 11.5px; }
.fw-feed-save { padding: 4px; }
.fw-rag-note { font-size: 10.5px; color: var(--text-muted); align-self: center; padding: 2px 6px; white-space: nowrap; }
/* add-catchment popover (shares the .fw-feeds-pop plate) */
.fw-ac-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-muted); margin: 6px 0; }
.fw-ac-row input { flex: 1; max-width: 210px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-primary); font-size: 11.5px; }
.fw-ac-chk { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); margin: 8px 0 6px; }
.fw-ac-save { margin-top: 4px; }


/* ===== shared modal plate (site settings / event feedback) ===== */
.fw-modal-ov { position: fixed; inset: 0; z-index: 1200; background: color-mix(in srgb, var(--primary-dark, #000) 55%, transparent);
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.fw-modal { width: 520px; max-width: 100%; max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface-raised, var(--surface)); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.fw-modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700; color: var(--text-primary); }
.fw-modal-b { padding: 12px 16px; overflow-y: auto; }
.fw-modal-f { display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 10px 16px; border-top: 1px solid var(--border); }
.fw-modal-msg { flex: 1; font-size: 11px; color: var(--text-muted); min-width: 0; }
.fw-modal-msg.ok { color: var(--success); }
.fw-modal-msg.err { color: var(--danger); }

/* site settings form */
.fw-ss-sub { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.fw-ss-l { display: block; font-size: 12px; font-weight: 600; color: var(--text-primary); margin: 10px 0 4px; }
.fw-ss-hint { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.fw-ss-notes { width: 100%; box-sizing: border-box; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); padding: 8px 10px; font: inherit; font-size: 12.5px; resize: vertical; }
.fw-ss-sp { display: flex; align-items: center; gap: 8px; }
.fw-ss-sp input { width: 96px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-primary); font-size: 12px; }
.fw-ss-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.fw-ss-tag.amber { background: var(--fw-amber-glow); color: var(--fw-amber-dim); }
.fw-ss-tag.red { background: var(--pill-bg-danger); color: var(--danger); }
.fw-ss-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; font-style: italic; }

/* event history rows (Past events) */
.fw-evrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-primary); cursor: default; }
.fw-evrow:first-child { border-top: 0; }
.fw-evrow-d { font-weight: 600; }
.fw-evrow-p { color: var(--text-muted); flex: 1; }
.fw-evrow-fb { position: relative; padding: 3px 5px; }
.fw-evrow-n { position: absolute; top: -4px; right: -4px; min-width: 13px; height: 13px; border-radius: 999px;
  background: var(--accent); color: var(--primary-dark, var(--surface)); font-size: 8.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* event feedback list + add form */
.fw-ev-head { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fw-fb-list { max-height: 230px; overflow-y: auto; }
.fw-fb-item { border-top: 1px solid var(--border); padding: 8px 0; }
.fw-fb-item:first-child { border-top: 0; }
.fw-fb-meta { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--text-muted); }
.fw-fb-txt { font-size: 12px; color: var(--text-primary); margin-top: 4px; line-height: 1.45; white-space: pre-wrap; }
.fw-fb-none { font-size: 11.5px; color: var(--text-muted); padding: 8px 0; }
.fw-fb-add { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 4px; }
.fw-fb-row { margin-bottom: 6px; }
.fw-fb-outcome { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-primary); font: inherit; font-size: 12px; }
.fw-fb-text { width: 100%; box-sizing: border-box; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); padding: 8px 10px; font: inherit; font-size: 12.5px; resize: vertical; }
.fw-fb-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.fw-fb-actions .fw-modal-msg { text-align: left; }

/* site-settings gear sits inline with the site name */
.fw-detail h3 { display: flex; align-items: center; gap: 8px; }
.fw-detail h3 .fw-site-gear { margin-left: auto; padding: 3px 5px; opacity: .75; }
.fw-detail h3 .fw-site-gear:hover { opacity: 1; }
.fw-detail h3 .fw-site-gear svg { width: 14px; height: 14px; }
