/* Copyright OSSO Foundation 2026. Designed by Mario Yandar. Licensed GPL-3.0-or-later
 * Description: Dashboard stylesheet: day/night theme variables, layout of
 * panels, filters, map, charts and reports mode.
 */

/* Day/night theme - a small, deliberately consistent palette (this
   file only ever reused a handful of literal colors) turned into
   semantic variables so a single toggle (see themeToggleBtn in
   app.js) can swap all of them at once. `:root` holds the light
   (default) values; `:root[data-theme="dark"]` (set on <html> by
   setTheme() in app.js, persisted to localStorage) overrides them.
   No `prefers-color-scheme` fallback - this is a manual toggle, not
   an OS-follows one, per the "display color (day-night)" control. */
:root {
  --bg: #e6ebee;
  --panel-bg: #f8fafb;
  --subtle-bg: #eef2f4;
  --hover-bg: #e1e8ec;
  --border: #cbd5db;
  --border-strong: #afbcc5;
  --border-subtle: #dbe3e8;
  --divider: #e3e9ed;
  --text: #13242f;
  --text-secondary: #1f3441;
  --text-muted: #46606f;
  --text-faint: #62798a;
  --text-faint2: #6f8593;
  --accent: #0f4c5c;
  --accent-hover: #0a3743;
  --mark: #e3a008;
  --on-accent: #f4faf9;
  --success: #17704f;
  --success-hover: #10593e;
  --success-bg: #e3f1ea;
  --success-bg-hover: #cfe6da;
  --danger: #b3382c;
  --danger-bg: #fbe9e6;
  --btn-bg: #d5dee4;
  --btn-bg-hover: #c3cfd7;
  --neutral-bg: #e9eff2;
  --neutral-bg-hover: #d9e2e8;
  --icon: #56707f;
  --icon-muted: #8a9ea9;
  --float-bg: rgba(248,250,251,.96);
  --float-shadow: 0 1px 2px rgba(15,36,47,.28), 0 6px 18px -6px rgba(15,36,47,.35);
  --font: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0b1419;
  --panel-bg: #111c23;
  --subtle-bg: #172530;
  --hover-bg: #1e303c;
  --border: #29404e;
  --border-strong: #3a5464;
  --border-subtle: #203543;
  --divider: #203543;
  --text: #e3ecf0;
  --text-secondary: #cdd9df;
  --text-muted: #9db1bd;
  --text-faint: #7f95a3;
  --text-faint2: #71879a;
  --accent: #67c3cc;
  --accent-hover: #8fd6dd;
  --mark: #f0b429;
  --on-accent: #082a33;
  --success: #4fb98d;
  --success-hover: #6cceA4;
  --success-bg: #14332a;
  --success-bg-hover: #1b443a;
  --danger: #ea8377;
  --danger-bg: #3a201d;
  --btn-bg: #29404e;
  --btn-bg-hover: #3a5464;
  --neutral-bg: #1e303c;
  --neutral-bg-hover: #29404e;
  --icon: #9db1bd;
  --icon-muted: #71879a;
  --float-bg: rgba(17,28,35,.95);
  --float-shadow: 0 1px 2px rgba(0,0,0,.6), 0 6px 18px -6px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
input, select, textarea, button { font-family: inherit; color: inherit; }
input, select, textarea { background: var(--panel-bg); font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .rtb-spinner { animation-duration: 2s; }
}

/* Any author rule that sets `display` on an element (flex/grid/etc.)
   otherwise beats the UA stylesheet's [hidden]{display:none} rule
   regardless of selector specificity (author origin always wins over
   UA origin) - this silently broke hidden toggling three times in this
   project (.filter-block--scroll, .layout, and the reports menu list)
   as one-off surprises, so it's a blanket !important rule instead of a
   per-selector patch applied reactively each time it bites again. */
[hidden] { display: none !important; }

/* Filters panel fixed at 300px; the remaining width (the "results" side -
   map + graphs) splits 60/40 between them via fr units (3fr:2fr), so the
   ratio holds at any viewport width rather than being pinned to a fixed
   graphs-panel pixel width. A second row holds #resultsTopBar, spanning
   both results columns above the map/charts - #filtersPanel spans both
   rows on the left since it has no top-bar counterpart. Every child is
   placed explicitly (not relying on grid auto-placement) since there
   are 4 direct children across a 2-row/3-column grid, not a simple
   1-per-column mapping. */
.layout {
  display: grid;
  grid-template-columns: 300px 3fr 2fr;
  grid-template-rows: auto 1fr;
  height: 100vh;
}
#filtersPanel { grid-column: 1; grid-row: 1 / 3; }
#resultsTopBar { grid-column: 2 / 4; grid-row: 1; }
#mainPanel { grid-column: 2; grid-row: 2; min-height: 0; }
#chartsPanel { grid-column: 3; grid-row: 2; min-height: 0; }

/* ---------- Filters panel ---------- */
/* The panel itself never scrolls - it always fits the viewport. Only
   the individual tree/asset-list sections scroll internally, each
   sharing the panel's fixed height via flexbox. */
.filters-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  padding: 10px 12px;
}
.filter-block { margin-bottom: 8px; flex-shrink: 0; }
.filter-block--scroll {
  flex: 1 1 0;
  min-height: 70px;
  display: flex;
  flex-direction: column;
}

/* Section headers ("Targets" / "Options") - one step more prominent
   than the per-block .hint mini-titles (Hazards/Geography), so the
   panel reads as two clear top-level groups. */
.filter-section-title {
  font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.01em;
  margin: 10px 0 6px; flex-shrink: 0;
}
.filter-section-title:first-child { margin-top: 2px; }

/* The Targets selector is the dashboard's one loud element: the chosen
   target fills solid ink with an amber edge (via :has() on the radio),
   every other row stays flat. */
.target-list {
  display: flex; flex-direction: column; gap: 1px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 2px 0;
}
.target-option {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer; padding: 6px 8px;
  border-left: 3px solid transparent; border-radius: 0 3px 3px 0;
}
.target-option:hover { background: var(--hover-bg); }
.target-option:has(input:checked) {
  background: var(--accent); color: var(--on-accent); border-left-color: var(--mark); font-weight: 600;
}
.target-option input[type="radio"] { margin: 0; flex-shrink: 0; }
.target-hint { font-size: 11px; color: var(--text-faint2); font-weight: 400; }
.target-source-link { font-size: 11px; color: var(--text-faint2); text-decoration: underline; font-weight: 400; }
.target-source-link:hover { color: var(--text); }
.target-option:has(input:checked) .target-hint,
.target-option:has(input:checked) .target-source-link { color: var(--on-accent); opacity: .8; }
.target-option:has(input:checked) input[type="radio"] { accent-color: var(--mark); }

.search-input {
  flex-shrink: 0;
  width: 100%; padding: 5px 8px; margin-bottom: 4px;
  border: 1px solid var(--border-strong); border-radius: 3px; font-size: 12px;
}
.hint { font-size: 11px; color: var(--text-faint2); font-weight: normal; }


.btn-primary, .btn-secondary {
  width: 100%; padding: 6px 10px; margin-top: 4px; border: 1px solid transparent; border-radius: 3px;
  cursor: pointer; font-size: 13px; font-weight: 500;
}
.btn-primary { background: var(--success); color: #fff; }
.btn-primary:hover { background: var(--success-hover); }
.btn-secondary { background: transparent; color: var(--text-secondary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--hover-bg); }
.btn-secondary:disabled { opacity: .45; cursor: default; }

/* ---------- Tree control ---------- */
.tree {
  font-size: 13px; border: 1px solid var(--border-subtle); background: var(--panel-bg); padding: 4px; border-radius: 3px;
  flex: 1; min-height: 0; overflow-y: auto;
}
.tree ul { list-style: none; margin: 0; padding-left: 16px; }
.tree > ul { padding-left: 0; }
.tree li { margin: 2px 0; }
.tree-node { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.tree-toggle {
  width: 14px; display: inline-block; text-align: center; user-select: none;
  color: var(--icon); font-size: 10px;
}
.tree-toggle.leaf { visibility: hidden; }
.tree-label { flex: 1; }
.tree-node.selected > .tree-label { font-weight: 600; color: var(--accent); }
.tree-children.collapsed { display: none; }
input.tree-checkbox { margin: 0; }

/* ---------- Date range ---------- */
.date-range-inputs { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.date-range-inputs label { color: var(--text-muted); }
.date-range-inputs input[type="text"] {
  width: 100%; padding: 5px 8px; margin-bottom: 4px; border: 1px solid var(--border-strong); border-radius: 3px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.date-range-inputs input[type="text"].invalid { border-color: var(--danger); background: var(--danger-bg); }

/* ---------- Asset list ---------- */
.asset-list {
  font-size: 13px; border: 1px solid var(--border-subtle); border-radius: 4px; padding: 4px;
  flex: 1; min-height: 0; overflow-y: auto;
}
.asset-list label { display: block; padding: 2px 0; cursor: pointer; }

/* Each asset node: its own radio row (exclusive - one asset at a
   time), then the 4 metric options (Total/Damaged/Destroyed/Economic)
   as a compact inline radio group underneath - one global choice
   (state.metric) shown consistently under every asset, not a separate
   dropdown. */
.asset-node { margin-bottom: 6px; }
.asset-node .asset-row { font-weight: 500; }
.asset-metrics {
  display: flex; flex-wrap: wrap; gap: 2px 10px;
  margin: 2px 0 0 18px; font-size: 11px; color: var(--text-muted);
}
.asset-metrics label { display: flex; align-items: center; gap: 3px; padding: 0; cursor: pointer; }
.asset-metrics input[type="radio"] { margin: 0; }

/* ---------- Results top bar: #1 totalization controls, #2 Reports
   button (#reportsNavHeader, relocated here from reports.js) ---------- */
.results-top-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel-bg); border-bottom: 1px solid var(--border); padding: 6px 10px;
}
.rtb-totals { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rtb-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; margin-right: 4px; }

/* Full-screen, centered, and deliberately blocking (it's the only thing
   under the cursor - nothing behind it is clickable) while a fetch is
   in flight - see showLoading()/hideLoading() in app.js. */
.loading-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,20,25,.35);
}
/* [hidden] and .loading-overlay are equal-specificity selectors, so
   without this the class rule above (loaded after the UA stylesheet)
   would win the cascade and the overlay would never actually hide -
   this attribute+class rule outranks both. */
.loading-overlay[hidden] { display: none; }
.loading-overlay-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-bg); color: var(--accent); font-size: 14px; font-weight: 600;
  padding: 16px 24px; border-radius: 6px; box-shadow: var(--float-shadow);
}
.loading-overlay-box .rtb-spinner { width: 16px; height: 16px; border-width: 3px; }
.rtb-spinner {
  width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--mark);
  border-radius: 50%; display: inline-block; animation: rtb-spin .7s linear infinite;
}
@keyframes rtb-spin { to { transform: rotate(360deg); } }
.rtb-field { display: flex; align-items: center; gap: 6px; }
.rtb-field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.rtb-field select {
  padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 3px; font-size: 12px; background: var(--panel-bg);
}
.rtb-field--prompt { position: relative; }
/* second variable (Reference) next to the AI Prompt */
.rtb-field--ref select#refVariableSelect { max-width: 260px; }
.rtb-ref-message { font-size: 11px; color: #b06000; max-width: 320px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ai-panel { position: fixed; top: 64px; right: 16px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 90px);
  overflow: auto; z-index: 900; background: var(--panel-bg); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-panel[hidden] { display: none; }
.ai-panel-head { display: flex; align-items: center; gap: 8px; }
.ai-panel-head h2 { font-size: 14px; margin: 0 auto 0 0; }
.ai-provider-label { font-size: 11px; color: var(--text-muted); }
.ai-panel-head .btn-secondary { width: auto; flex: 0 0 auto; padding: 3px 10px; font-size: 12px; }
.ai-close { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.ai-close:hover { color: var(--text); }
.ai-question { margin: 0; font-size: 12px; color: var(--text-muted); font-style: italic; }
.ai-body { font-size: 13px; line-height: 1.5; }
.ai-body h1, .ai-body h2, .ai-body h3, .ai-body h4 { font-size: 13px; margin: 10px 0 4px; }
.ai-body p, .ai-body ul, .ai-body ol { margin: 0 0 8px; }
.ai-body ul, .ai-body ol { padding-left: 20px; }
.ai-body table { border-collapse: collapse; margin: 4px 0 8px; font-size: 12px; width: 100%; }
.ai-body th, .ai-body td { border-bottom: 1px solid var(--border); padding: 3px 6px; text-align: left; }
.ai-body td.num, .ai-body th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ai-body code { background: var(--subtle-bg); padding: 0 3px; border-radius: 3px; font-size: 12px; }
.ai-body pre { background: var(--subtle-bg); padding: 8px; border-radius: 4px; overflow-x: auto; font-size: 12px; }
.ai-body .ai-working { color: var(--text-muted); }
.ai-body .ai-error { color: var(--danger); }
.ai-view-note { margin: 0; font-size: 12px; color: var(--success); }
.ai-query h3, .ai-results h3 { font-size: 12px; margin: 0 0 4px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.ai-query dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; font-size: 12px; }
.ai-query dt { color: var(--text-muted); }
.ai-query dd { margin: 0; overflow-wrap: anywhere; }
.ai-results-scroll { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 4px; }
.ai-results .rt-table { width: 100%; font-size: 12px; }
.ai-results .btn-secondary { width: auto; margin-top: 6px; padding: 3px 10px; font-size: 12px; }
.ai-tools { font-size: 12px; color: var(--text-muted); }
.ai-tools summary { cursor: pointer; }
.ai-tools ol { margin: 4px 0 0; padding-left: 20px; }
.ai-tools li code { font-size: 11px; word-break: break-all; }
.ai-meta { margin: 0; font-size: 11px; color: var(--text-faint2); }
#aiPromptInput {
  padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 3px; font-size: 12px;
  background: var(--panel-bg); color: var(--text); width: 220px;
}
.rtb-ai-message {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 6;
  background: var(--accent); color: var(--on-accent); font-size: 11px; padding: 4px 8px;
  border-radius: 3px; white-space: nowrap; box-shadow: var(--float-shadow);
}
/* .reports-nav-header's buttons normally stretch full-width (see below)
   for its other home, stacked at the top of #reportsCenter in Reports
   mode - here it shares a row with .rtb-totals instead, so keep the
   buttons their natural width. */
.results-top-bar .reports-nav-header { margin-bottom: 0; flex-shrink: 0; }
.results-top-bar .reports-nav-header button { flex: 0 0 auto; width: auto; }

/* ---------- Main / Map ---------- */
.main-panel { position: relative; display: flex; flex-direction: column; }
.map { flex: 1; width: 100%; }
.map-controls {
  position: absolute; top: 16px; right: 16px; background: var(--float-bg); color: var(--text);
  padding: 8px 10px; border-radius: 6px; box-shadow: var(--float-shadow);
  font-size: 11px; z-index: 5; display: flex; flex-direction: column; gap: 6px;
}
.map-control-field { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.map-control-field label { color: var(--text-muted); white-space: nowrap; }
.map-control-field select {
  padding: 2px 4px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 11px; background: var(--panel-bg);
}
.map-control-field input[type="number"] {
  width: 48px; padding: 2px 4px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 11px;
}
.map-control-field input[type="color"] {
  width: 32px; height: 22px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; cursor: pointer;
}
.map-control-field input[type="range"] { width: 80px; margin: 0; accent-color: var(--accent); }
.map-range-value { width: 30px; text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* zoom buttons bottom left (OpenLayers puts them top left, under the Layers box), the base map control below them */
.map .ol-zoom { top: auto; left: 16px; bottom: 50px; }
.map-base-box {
  position: absolute; left: 16px; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 6px;
  background: var(--float-bg); color: var(--text); padding: 4px 8px; border-radius: 6px; box-shadow: var(--float-shadow); font-size: 11px;
}
.map-base-box label { color: var(--text-muted); white-space: nowrap; }
.map-base-box select { padding: 2px 4px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 11px; background: var(--panel-bg); color: var(--text); }
.main-panel.reports-mode .map-base-box, .main-panel.reports-mode .ol-zoom { display: none; }
.map-layers-box {
  position: absolute; top: 16px; left: 16px; background: var(--float-bg); color: var(--text);
  padding: 8px 10px; border-radius: 6px; box-shadow: var(--float-shadow);
  font-size: 11px; z-index: 5; display: flex; flex-direction: column; gap: 6px;
}
/* Shared collapse header for both .map-controls and .map-layers-box -
   a click on .map-box-toggle (see initMapBoxToggles() in app.js) adds
   .collapsed to the box, which hides .map-box-body entirely, leaving
   only this header row - the "icon to hide/show" the map's own
   controls/legend boxes without navigating away from them. */
.map-box-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.map-box-title { font-weight: 600; color: var(--text-muted); }
.map-box-toggle {
  background: none; border: none; padding: 0 2px; margin: 0; width: auto; height: auto;
  font-size: 10px; line-height: 1; color: var(--text-muted); cursor: pointer;
}
.map-box-toggle:hover { color: var(--accent); }
.map-box-body { display: flex; flex-direction: column; gap: 6px; }
.map-controls.collapsed .map-box-body,
.map-layers-box.collapsed .map-box-body { display: none; }
.map-layers-section-title { font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.map-layers-list { max-width: 220px; max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.map-layer-option { display: flex; align-items: flex-start; gap: 6px; cursor: pointer; line-height: 1.3; }
.map-layer-option input { flex-shrink: 0; margin-top: 2px; }
.map-layer-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; margin-top: 3px; border: 1px solid rgba(0,0,0,.2); }

.map-legend {
  position: absolute; bottom: 90px; right: 16px; background: var(--float-bg); color: var(--text);
  padding: 10px 12px; border-radius: 6px; box-shadow: var(--float-shadow);
  font-size: 12px; max-width: 220px; z-index: 5; font-variant-numeric: tabular-nums;
}
.map-legend .legend-title { font-weight: 600; margin-bottom: 6px; }
.legend-row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend-swatch { width: 16px; height: 12px; border: 1px solid var(--icon-muted); flex-shrink: 0; }
/* bivariate key (map.js _renderBivariateLegend): 3x3, reference up, target right */
.map-legend:has(.bv-legend) { max-width: 260px; }
.bv-legend { display: flex; align-items: center; gap: 4px; }
.bv-axis-y { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; font-weight: 600;
  max-height: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-key { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto auto;
  grid-template-areas: "tl tr" "grid grid" "bl br"; column-gap: 8px; row-gap: 2px; }
.bv-grid { grid-area: grid; display: grid; grid-template-columns: repeat(3, 28px); grid-template-rows: repeat(3, 28px);
  justify-self: center; }
.bv-cell { display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.6);
  font-size: 10px; color: #222; }
.bv-cell.bv-dark { color: #fff; }
/* analysis summary under the key (map.js _bivariateSummaryHtml) */
.bv-summary { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--icon-muted); font-size: 11px; }
.bv-stitle { font-weight: 600; margin-bottom: 3px; }
.bv-srow { display: flex; justify-content: space-between; gap: 8px; margin: 1px 0; }
.bv-srow > span:last-child { white-space: nowrap; }
.bv-dim, .bv-sread, .bv-snames { color: var(--text-muted); }
.bv-sread { font-size: 10px; font-style: italic; margin-bottom: 2px; }
.bv-snames { font-size: 10px; margin: 0 0 2px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-corner { font-size: 10px; color: var(--text-muted); line-height: 1.2; }
.bv-tl { grid-area: tl; } .bv-tr { grid-area: tr; text-align: right; }
.bv-bl { grid-area: bl; } .bv-br { grid-area: br; text-align: right; }
.bv-axis-x { font-size: 11px; font-weight: 600; text-align: center; margin: 2px 0 4px 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-note { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.ol-tooltip {
  position: absolute; z-index: 1000;
  background: rgba(11,20,25,.92); color: #f4faf9; padding: 6px 10px; border-radius: 3px;
  font-size: 12px; white-space: nowrap; pointer-events: none;
}

.ogc-url-box {
  background: var(--panel-bg); border-top: 1px solid var(--border); padding: 6px 10px;
}
.ogc-url-box label { display: block; font-size: 11px; font-weight: 500; color: var(--text-faint); margin-bottom: 2px; }
.ogc-url-row { display: flex; gap: 6px; align-items: center; }
#ogcUrlInput {
  flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px;
  font-family: "Consolas", "Courier New", monospace; font-size: 11px; background: var(--subtle-bg); color: var(--text-secondary);
}
.ogc-url-row button, .ogc-url-open {
  flex-shrink: 0; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--neutral-bg); color: var(--accent); font-size: 11px; cursor: pointer; text-decoration: none;
}
.ogc-url-row button:hover, .ogc-url-open:hover { background: var(--neutral-bg-hover); }

/* ---------- Charts panel ---------- */
.charts-panel {
  overflow-y: auto; background: var(--panel-bg); border-left: 1px solid var(--border); padding: 8px;
}
/* Explicit height (not just a canvas max-height cap) - Chart.js's
   charts are created with maintainAspectRatio:false (see charts.js),
   so each canvas fills whatever height its .chart-card actually has
   instead of deriving its own height from its width via a fixed
   aspect ratio. That aspect-ratio math was the real cause of "graphs
   look distorted after Reports mode": #chartsPanel's live Chart.js
   instances are relocated (not recreated) between the normal full-
   width column and Reports mode's narrow 2-column reduced grid (see
   .charts-panel.reports-mode below) - a narrow width, run through a
   fixed aspect ratio, produces a near-zero height there, which looked
   like a broken/stale canvas but was actually Chart.js correctly
   computing height from an unrepresentatively small width. */
.chart-card { margin-bottom: 10px; height: 220px; }
.chart-card canvas { width: 100% !important; max-height: 220px; }

/* ---------- Results table (4th results card - replaced a fixed "Top
   Geographies" chart; now reflects whichever totalization is active,
   paginated) ---------- */
.results-table-card { display: flex; flex-direction: column; }
.rt-header { margin-bottom: 4px; }
.rt-title { font-size: 13px; font-weight: 700; color: var(--text); }
.rt-table-wrap { max-height: 220px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: 3px; }
.rt-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.rt-table th, .rt-table td { padding: 5px 8px; border-bottom: 1px solid var(--divider); text-align: left; }
.rt-table th { background: var(--subtle-bg); color: var(--text-muted); font-weight: 600; position: sticky; top: 0; }
.rt-table tbody tr:hover td { background: var(--hover-bg); }
.rt-table td:last-child, .rt-table th:last-child { text-align: right; }
.rt-empty { text-align: center; color: var(--text-faint); padding: 10px !important; }
.rt-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px;
}
.rt-pager button { padding: 4px 8px; font-size: 11px; width: auto; }
.rt-page-info { font-size: 11px; color: var(--text-muted); }

/* ---------- Matching records: count line + table that replaces the
   charts (the map stays). .records-mode on #chartsPanel shows the table
   card and hides every other card. ---------- */
.records-bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; font-size: 12px; color: var(--text-muted); }
.records-bar #recordsCount { font-weight: 600; color: var(--text); }
.records-bar a { color: var(--accent, #006837); font-weight: 600; text-decoration: underline; cursor: pointer; }
.records-bar a.busy { opacity: .5; pointer-events: none; }
.records-download-msg { color: var(--text-muted); }
.records-download-msg.error { color: #b00020; }
.records-card { display: none; height: auto; flex-direction: column; }
.charts-panel.records-mode .records-card { display: flex; }
.charts-panel.records-mode > .chart-card:not(.records-card) { display: none; }
.records-wrap { max-height: calc(100vh - 230px); overflow: auto; border: 1px solid var(--border-subtle); border-radius: 3px; }
.records-card .rt-table td { vertical-align: top; }
.records-card .rt-table td.num, .records-card .rt-table th.num { text-align: right; white-space: nowrap; }
.records-card .rt-table td:last-child, .records-card .rt-table th:last-child { text-align: left; }
.records-card .rec-serial { white-space: nowrap; font-size: 11px; color: var(--text-muted); }

/* Relocated wholesale between the top of #chartsPanel (normal mode)
   and the top of #reportsCenter (Reports mode, left column) - see
   reports.js. Both buttons share the row via flex:1, overriding
   .btn-secondary's width:100% which would otherwise fight that. */
.reports-nav-header { display: flex; gap: 6px; margin-bottom: 8px; flex-shrink: 0; }
.reports-nav-header button { flex: 1; width: auto; padding: 6px; font-size: 12px; }
/* Language/theme controls travel with #reportsNavHeader wherever it's
   relocated (normal mode's top bar, or Reports mode's nav row) - both
   contexts otherwise stretch every button to flex:1, which would blow
   these two up to full button width, so they're pinned compact here
   regardless of which context wins on specificity. */
.reports-nav-header .lang-select,
.reports-nav-header .theme-toggle-btn {
  flex: 0 0 auto; width: auto;
}
.lang-select {
  padding: 3px 4px; border: 1px solid var(--border-strong); border-radius: 4px;
  font-size: 11px; background: var(--panel-bg); color: var(--text); cursor: pointer;
}
.theme-toggle-btn {
  padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--panel-bg); font-size: 13px; line-height: 1; cursor: pointer;
}
.theme-toggle-btn:hover { background: var(--hover-bg); }
.reports-toggle-btn {
  border: 1px solid var(--accent); border-radius: 3px; font-weight: 600;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.reports-toggle-btn:hover { background: var(--accent-hover); }

/* =====================================================================
   Reports mode - #mainPanel and #chartsPanel are relocated (not
   cloned) into #reportsCenter when active, keeping the same live
   OpenLayers/Chart.js instances instead of running duplicates.
   ===================================================================== */

/* Row 1: #reportsTopBar, spanning every column (same pattern as
   #dashboardLayout's #resultsTopBar). Row 2: #1 analysis brief (query
   description + map + graphs, reduced) | #2 report design (editable
   tree, 600px) | #3 preliminary report (rendered preview, the rest of
   the available width). #reportsMenuPanel (a former 4th column - the
   Reports&Scenarios/References&Functions side menu) no longer exists;
   its buttons live in #reportsMenuBar, inside the top bar row instead. */
.reports-layout {
  grid-template-columns: 340px 600px 1fr;
  grid-template-rows: auto 1fr;
}
#reportsTopBar { grid-column: 1 / 4; grid-row: 1; }
#reportsCenter { grid-column: 1; grid-row: 2; }
#reportViewer { grid-column: 2; grid-row: 2; }
#reportPreview { grid-column: 3; grid-row: 2; }

/* While composing a scenario (see buildScenarioForm/setScenarioEditingMode):
   #3's (preview's) width is halved and the freed half handed to #2
   (viewer) - #1 is untouched. R = #3's normal width (100% - the 940px
   sum of the other two fixed tracks); #2 becomes its usual 600px plus
   R/2, #3 becomes R/2. Pure grid-template-columns swap, no DOM changes -
   the DOM-move approach tried earlier (moving a button between columns)
   shipped broken for reasons never pinned down, so this is deliberately
   just a class toggle plus calc(), nothing else. */
.reports-layout.scenario-editing {
  grid-template-columns: 340px calc(600px + (100% - 940px) / 2) calc((100% - 940px) / 2);
}

.reports-top-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-bg); border-bottom: 1px solid var(--border); padding: 6px 10px;
}
/* .reports-nav-header's buttons normally stretch full-width (see the
   dashboard's own #resultsTopBar override) - here too, they share the
   row with .reports-menu-bar, so keep their natural width. */
.reports-top-bar .reports-nav-header { margin-bottom: 0; flex-shrink: 0; }
.reports-top-bar .reports-nav-header button { flex: 0 0 auto; width: auto; }

.reports-menu-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.reports-menu-btn {
  width: auto; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--neutral-bg); color: var(--accent); font-size: 12px; cursor: pointer; text-align: left;
  white-space: nowrap;
}
.reports-menu-btn:hover { background: var(--neutral-bg-hover); }
.reports-menu-btn.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
#currentReportInfo { margin-left: 4px; }

/* "Open Report" deploys this panel directly below the button instead
   of occupying permanent layout space - closed by default, toggled by
   showReportsList()/setActiveMenuBtn() in reports.js, and closed on an
   outside click (see initReportsMenu()). */
.reports-dropdown { position: relative; }
.reports-dropdown-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20;
  width: 280px; max-height: 360px; display: flex; flex-direction: column;
  background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: 6px;
  box-shadow: var(--float-shadow); padding: 8px;
}
.reports-dropdown-panel .tree { flex: 1; min-height: 0; margin-top: 6px; }

/* Setup menu (Login/Language/Theme/version) - deliberately its OWN
   wrapper class, not .reports-dropdown, despite reusing .reports-
   dropdown-panel's box styling: reports.js's outside-click handler
   closes the "Open Report" panel on any click outside something
   matching .reports-dropdown - sharing that class here would make a
   click inside THIS menu also count as "inside a reports-dropdown" and
   suppress that handler. Narrower than the Reports list panel, and
   opens toward the LEFT (right:0, not left:0) - #setupMenuBtn sits at
   the right edge of the page in every layout this travels to
   (#resultsTopBar/#reportsTopBar), so a panel opening rightward would
   run off the viewport. */
.setup-menu-dropdown { position: relative; }
.setup-menu-panel { width: 220px; left: auto; right: 0; gap: 8px; }
.setup-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.setup-menu-row label { font-size: 12px; color: var(--text); flex-shrink: 0; }
.setup-menu-row .btn-secondary { width: auto; flex: 0 0 auto; }
/* Region names vary a lot in length ("Colombia" vs. "Lao People Dem
   Rep") - cap and truncate rather than let a long one blow out the
   panel's fixed width. */
.region-picker-btn { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.setup-menu-panel:has(.region-picker:not([hidden])) { width: 300px; }
.region-picker { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px; background: var(--subtle-bg); }
.region-search { padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 12px;
  background: var(--panel-bg); color: var(--text); }
.region-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.region-list label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); padding: 2px 2px;
  border-radius: 3px; cursor: pointer; }
.region-list label:hover { background: var(--hover-bg); }
.region-list label span.n { margin-left: auto; color: var(--text-faint2); font-size: 11px; font-variant-numeric: tabular-nums; }
.region-picker-actions { display: flex; align-items: center; gap: 6px; }
.region-picker-actions .btn-primary, .region-picker-actions .btn-secondary { width: auto; flex: 0 0 auto; padding: 4px 10px; font-size: 12px; }
.region-count { font-size: 11px; color: var(--text-muted); margin-right: auto; }
.region-message { font-size: 11px; color: var(--danger); margin: 0; }
.target-option.disabled { opacity: 0.5; }
#loginMessage { font-size: 11px; margin: -4px 0 0; }
.setup-menu-version {
  font-size: 11px; color: var(--text-faint2); text-align: center;
  border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px;
}

.reports-query-brief {
  flex-shrink: 0; font-size: 11px; color: var(--text-muted); line-height: 1.5;
  padding: 6px 8px; margin-bottom: 6px; background: var(--subtle-bg);
  border: 1px solid var(--border-subtle); border-radius: 4px;
}

.reports-center { display: flex; flex-direction: column; }

/* Map reduced to the upper portion of the center column ("central-upper"). */
.main-panel.reports-mode { flex: 0 0 38%; min-height: 200px; }
/* Classification/ranges/color controls and the legend are dashboard-only
   editing aids - just clutter on this small brief-column map preview,
   so both are hidden here (the map itself, and the OGC URL box, still
   show). */
.main-panel.reports-mode #mapControls,
.main-panel.reports-mode #mapLayersBox,
.main-panel.reports-mode #mapLegend { display: none; }

/* Charts moved to the lower portion ("central-down"), stacked single-
   column (not 2x2) so each of the 3 graphs gets the column's full
   width instead of ~160px - a 2-up grid was too narrow to read
   alongside the map in this 340px column. The results table isn't a
   graph, so it's excluded from this compact brief view entirely (it
   stays part of the full dashboard, not the Reports left column). */
.charts-panel.reports-mode {
  flex: 1; min-height: 0; overflow-y: auto;
  border-left: none; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr; gap: 8px; align-content: start;
}
.charts-panel.reports-mode .results-table-card { display: none; }
/* Overrides .chart-card's normal-mode 220px height with a shorter one -
   Chart.js fills whatever height it's given (maintainAspectRatio:false),
   so this is what keeps 3 stacked charts from eating the whole column. */
.charts-panel.reports-mode .chart-card { margin-bottom: 0; height: 170px; }

/* ---------- Report viewer / editor ---------- */
.report-viewer { overflow-y: auto; }
.report-viewer h3 { font-size: 14px; color: var(--accent); margin: 0 0 4px; }
.rv-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.rv-summary { font-size: 12px; margin-bottom: 10px; }

.report-section, .report-citations { border: 1px solid var(--border-subtle); border-radius: 4px; padding: 8px; margin-bottom: 10px; }
.report-section h4, .report-citations h4 { font-size: 12px; margin: 0; color: var(--accent); }
.report-section .rv-obs { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }

.report-query { border-left: 2px solid var(--border); margin: 6px 0 6px 6px; padding-left: 8px; }
.report-query .rq-name { font-weight: 600; font-size: 12px; }
/* the query's definition: one short paragraph under its name; the author's note, two lines at most */
.rq-def { font-size: 11px; color: var(--text-muted); line-height: 1.4; margin: 1px 0 2px; }
.report-query .rq-desc {
  font-size: 11px; color: var(--text-faint); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rv-subitem { font-size: 11px; color: var(--text-muted); margin: 2px 0 2px 10px; }

.rv-item-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rv-item-row h4, .rv-item-row .rq-name, .rv-item-row .rv-subitem { flex: 1; min-width: 0; }
.rv-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.rv-icon-btn {
  border: none; background: none; cursor: pointer; font-size: 12px; line-height: 1;
  padding: 2px 4px; border-radius: 3px; color: var(--text-faint);
}
.rv-icon-btn:hover { background: var(--hover-bg); color: var(--accent); }
.rv-icon-btn:disabled { opacity: .3; cursor: default; }
.rv-icon-btn:disabled:hover { background: none; color: var(--text-faint); }

.rv-add-btn {
  font-size: 11px; padding: 3px 8px; border: 1px dashed var(--icon-muted); border-radius: 4px;
  background: var(--subtle-bg); color: var(--text-muted); cursor: pointer; margin-top: 4px;
}
.rv-add-btn:hover { background: var(--neutral-bg); }

.rv-form { border: 1px solid var(--border-strong); border-radius: 4px; padding: 8px; margin-top: 6px; background: var(--subtle-bg); }
.rv-form label { display: block; font-size: 11px; color: var(--text-muted); margin: 6px 0 2px; }
.rv-form input, .rv-form select, .rv-form textarea {
  width: 100%; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 12px;
}
.rv-form textarea { font-family: "Consolas", "Courier New", monospace; font-size: 11px; min-height: 70px; }
.qf-preview {
  min-height: 120px; background: var(--hover-bg); color: var(--text-secondary); cursor: default;
}
.rv-form-actions { display: flex; gap: 6px; margin-top: 8px; }
.rv-form-actions button {
  flex: 1; padding: 5px; border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.rv-form-actions .rv-save { background: var(--success); color: #fff; }
.rv-form-actions .rv-cancel { background: var(--btn-bg); color: var(--text-secondary); }
.rv-error { color: var(--danger); font-size: 11px; margin-top: 4px; }
.rv-success { color: var(--success); font-size: 11px; margin-top: 4px; }

/* ---------- Scenario model builder (buildScenarioForm) ----------
   Input (query) -> Model (reference/function) -> Output (result),
   wired left-to-right; wraps to a stacked column on narrow viewports. */
.sc-canvas { display: flex; align-items: stretch; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.sc-node {
  flex: 1 1 220px; min-width: 200px; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px; background: var(--panel-bg);
}
.sc-node-input { border-top: 3px solid var(--accent); }
.sc-node-model { border-top: 3px solid var(--success); }
.sc-node-output { border-top: 3px solid var(--mark); }
.sc-node-title {
  font-size: 12px; font-weight: 700;
  color: var(--accent); margin-bottom: 4px;
}
.sc-node .hint { margin: 2px 0 4px; }
.sc-node-sub { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sc-wire {
  flex: 0 0 auto; align-self: center; font-size: 20px; color: var(--icon-muted); padding: 0 2px;
}
.sc-chip {
  font-size: 10px; padding: 2px 6px; border-radius: 10px; background: var(--hover-bg); color: var(--text-secondary);
}
.sc-query-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; width: 100%; }
.sc-chip-name { font-weight: 600; }
.sc-wires { margin-top: 4px; }
.sc-wire-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 11px;
  padding: 4px 0; border-top: 1px dashed var(--border-subtle);
}
.sc-wire-row code { color: var(--accent); font-weight: 600; }
.sc-wire-row select { width: auto; flex: 1 1 auto; }
.sc-wire-arrow { color: var(--icon-muted); }
.sc-wire-src { color: var(--text-muted); font-style: italic; }
.sc-ref-chip {
  font-size: 10px; padding: 2px 6px; border-radius: 10px; background: var(--success-bg); color: var(--success);
  font-weight: 600;
}
.sc-subbox { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--border-subtle); }
.sc-subbox-title { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 3px; }
.sc-node select { width: 100%; }
.sc-node label code { font-size: 10px; }
/* the scenario's table: its title names the function and the references */
.sc-result { margin-top: 8px; padding: 6px 8px; border: 1px solid var(--border-subtle); border-radius: 4px; }
.sc-result-title { font-size: 12px; font-weight: 600; margin: 2px 0 4px; }
.rp-scenario-caption { caption-side: top; text-align: left; font-weight: 600; font-size: 12px; padding: 2px 0 6px; }
.rp-scenario-source { margin: 4px 0 0; font-size: 11px; color: var(--text-muted); }

/* A "scenario_value" result - a single computed number, no map/chart. */
.rp-value-card { padding: 10px 4px; text-align: center; }
.rp-value-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.rp-value-number { font-size: 28px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

.rv-list-item {
  padding: 6px; border: 1px solid var(--border-subtle); border-radius: 4px; margin-bottom: 6px;
  font-size: 12px; cursor: pointer;
}
.rv-list-item:hover { background: var(--bg); }
.rv-list-item .rv-list-title { font-weight: 600; color: var(--accent); }
.rv-list-item .rv-list-sub { font-size: 11px; color: var(--text-faint); }
.rv-list-item.active { border-color: var(--success); background: var(--success-bg); }

/* ---------- Reference/function detail (rendered in #reportPreview) ---------- */
.rp-detail-list { margin-top: 6px; }
.rp-detail-row {
  display: flex; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--divider); font-size: 12px;
}
.rp-detail-label { flex: 0 0 140px; color: var(--text-faint); font-weight: 600; }
.rp-detail-value { flex: 1; color: var(--text); word-break: break-word; }
.rp-detail-subheading { font-size: 11px; font-weight: 600; color: var(--accent); margin-top: 8px; }

.rp-ref-map-section { margin-top: 10px; }
.rp-ref-year-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.rp-ref-year-row input[type="range"] { flex: 1; }
.rp-ref-year-row span { font-size: 12px; font-weight: 600; color: var(--accent); min-width: 3.5em; text-align: right; }

/* ---------- CSV import wizard (rendered in #reportViewer) ---------- */
.csv-table-wrap { overflow-x: auto; margin: 8px 0; max-height: 180px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: 4px; }
.csv-preview-table, .csv-geo-table { border-collapse: collapse; width: 100%; font-size: 11px; }
.csv-preview-table th, .csv-preview-table td,
.csv-geo-table th, .csv-geo-table td {
  padding: 4px 6px; border-bottom: 1px solid var(--divider); text-align: left; white-space: nowrap;
}
.csv-preview-table th { background: var(--subtle-bg); color: var(--accent); position: sticky; top: 0; }
.csv-geo-table td:nth-child(2) { white-space: normal; }
.csv-geo-table select { width: 100%; font-size: 11px; padding: 2px 4px; }
.csv-skip-list { font-size: 11px; color: var(--danger); margin: 4px 0; padding-left: 18px; max-height: 120px; overflow-y: auto; }

/* ---------- Formula builder wizard (rendered in #reportPreview) ---------- */
.fw-entry-row {
  display: flex; align-items: center; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid var(--divider); font-size: 12px;
}
.fw-entry-row code { flex: 0 0 130px; color: var(--accent); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.fw-entry-value {
  flex: 1; font-family: "Consolas", "Courier New", monospace; font-size: 11px;
  color: var(--text-secondary); word-break: break-word;
}
.fw-dummy-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.fw-dummy-row code { flex: 0 0 130px; color: var(--accent); font-weight: 600; }
.fw-dummy-row input { flex: 1; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 12px; }

.fw-quickadd-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.fw-quickadd-row .fw-quickadd { margin-top: 0; }

.fw-chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.fw-chip {
  font-family: "Consolas", "Courier New", monospace; font-size: 11px;
  padding: 3px 7px; border: 1px solid var(--success); border-radius: 12px;
  background: var(--success-bg); color: var(--success); cursor: pointer;
}
.fw-chip:hover { background: var(--success-bg-hover); }

.fw-op-keyboard { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.fw-op-btn {
  min-width: 32px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--subtle-bg); color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
}
.fw-op-btn:hover { background: var(--hover-bg); }

/* Live preview of the formula-so-far, shown next to the Build/Edit
   formula button in the New Function form. */
.fw-preview { max-height: 220px; overflow-y: auto; }

/* ---------- Report preview (rendered maps/charts, export/share) ---------- */
.report-preview { overflow-y: auto; border-left: 1px solid var(--border); }
.rp-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; flex-shrink: 0;
}
.rp-header-title { font-size: 14px; color: var(--accent); margin: 0; }
.rp-header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.rp-header-actions .rv-add-btn { margin-top: 0; border-style: solid; }
.rp-header-actions .rv-add-btn:disabled { opacity: .5; cursor: default; }

.rp-section { border: 1px solid var(--border-subtle); border-radius: 4px; padding: 8px; margin-bottom: 10px; }
.rp-section h4 { font-size: 12px; margin: 0 0 4px; color: var(--accent); }

.rp-result { border-top: 1px solid var(--divider); padding-top: 8px; margin-top: 8px; }
.rp-result:first-of-type { border-top: none; margin-top: 4px; padding-top: 0; }
.rp-result-title { font-weight: 600; font-size: 12px; color: var(--accent); }
.rp-result-desc { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.rp-preview-map { width: 100%; height: 220px; margin-top: 4px; border: 1px solid var(--border-subtle); border-radius: 4px; }
.rp-result canvas { width: 100% !important; max-height: 220px; margin-top: 4px; }

.rp-scenarios { margin-top: 8px; border-top: 1px solid var(--divider); padding-top: 6px; }
.rp-scenarios-title { font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }

/* report_type: "infographic" - same rendered results as "plain", laid
   out as a grid of compact cards instead of a linear section flow. */
.rp-infographic-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px; margin-top: 8px;
}
.rp-infocard {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px; background: var(--subtle-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.rp-infocard-section { font-size: 11px; color: var(--success); font-weight: 600; margin-bottom: 2px; }
.rp-infocard .rp-preview-map { height: 160px; }
.rp-infocard canvas { max-height: 160px; }

/* report_type: "json" - the report tree itself, formatted, instead of
   any maps/charts. */
.rp-json-block {
  white-space: pre-wrap; word-break: break-word;
  font-family: "Consolas", "Courier New", monospace; font-size: 11px;
  background: #1b1f24; color: #d7e0ea; padding: 10px; border-radius: 6px;
  margin-top: 8px;
}

/* Export = browser print-to-PDF: isolate the preview panel's content
   and let it flow onto the page instead of clipping to its normal
   fixed-height scroll box. */
@media print {
  body * { visibility: hidden; }
  #reportPreview, #reportPreview * { visibility: visible; }
  #reportPreview {
    position: absolute; top: 0; left: 0; width: 100%; height: auto;
    overflow: visible; border: none; padding: 0;
  }
  .rp-header-actions { display: none; }
}


/* ---- DIX_5 additions ---- */

/* References: the embedded Reference module (/ref/ui) takes both report panels. */
.reports-layout.references-mode #reportViewer { display: none; }
.reports-layout.references-mode #reportPreview { grid-column: 2 / 4; border-left: 0; }
.reports-layout.references-mode .rp-header { display: none; }
.ref-module-frame { display: block; width: 100%; height: calc(100vh - 110px); border: 0; }

/* Export menu under the preview's Export button. */
.rp-header-actions { position: relative; }
.export-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 230px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.15);
}
.export-option { text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 4px; cursor: pointer; color: inherit; font: inherit; }
.export-option:hover { background: var(--border); }
.export-option:disabled { opacity: 0.6; cursor: default; }

/* Token dialog (Settings > Login, or any 401). */
.token-dialog { border: 1px solid var(--border); border-radius: 8px; background: var(--panel-bg); color: inherit; width: min(480px, calc(100vw - 32px)); padding: 0; }
.token-dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.token-dialog input { width: 100%; box-sizing: border-box; }

/* ---------- Time Series analysis (tsanalysis.js) ----------
   The icon sits right of the chart's own title (charts.js places it after each
   draw); the window floats over the page and is dragged by its header. */
.ts-card { position: relative; }
.tsa-open-btn { position: absolute; width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel-bg); color: var(--icon); cursor: pointer; }
.tsa-open-btn[hidden] { display: none; }
.tsa-open-btn:hover { background: var(--hover-bg); color: var(--accent); }
.tsa-open-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tsa-panel { position: fixed; z-index: 1200; width: 340px; max-height: calc(100vh - 24px); display: flex; flex-direction: column;
  background: var(--panel-bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--float-shadow); font-size: 12px; }
.tsa-panel[hidden] { display: none; }
.tsa-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; cursor: move; user-select: none;
  border-bottom: 1px solid var(--divider); font-weight: 700; color: var(--accent); touch-action: none; }
.tsa-close { border: 0; background: transparent; color: var(--icon); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.tsa-close:hover { color: var(--danger); }
.tsa-body { overflow-y: auto; padding: 6px 10px; }
.tsa-body fieldset { border: 1px solid var(--border-subtle); border-radius: 5px; margin: 0 0 8px; padding: 4px 8px 6px; }
.tsa-body legend { font-weight: 600; color: var(--text-muted); padding: 0 4px; }
.tsa-body label { display: block; margin: 3px 0; color: var(--text-secondary); }
.tsa-body select, .tsa-body input[type=number] { font: inherit; font-size: 12px; padding: 2px 4px; color: var(--text); background: var(--panel-bg);
  border: 1px solid var(--border); border-radius: 3px; max-width: 100%; }
.tsa-body input[type=number] { width: 56px; }
.tsa-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tsa-row label { display: inline-block; }
.tsa-check input { vertical-align: middle; margin: 0 4px 0 0; }
.tsa-note { color: var(--text-faint); font-size: 11px; }
.tsa-note:empty { display: none; }
.tsa-stats { font-variant-numeric: tabular-nums; }
.tsa-table { width: 100%; border-collapse: collapse; }
.tsa-table th, .tsa-table td { padding: 2px 4px; border-bottom: 1px solid var(--divider); text-align: right; font-weight: normal; }
.tsa-table th { text-align: left; color: var(--text-muted); }
.tsa-table td.tsa-h { color: var(--text-faint); font-size: 11px; }
.tsa-table tr.tsa-best td, .tsa-table tr.tsa-best th { font-weight: 700; color: var(--success); }
.tsa-dim { color: var(--text-faint); font-size: 11px; white-space: nowrap; }
.tsa-sub { margin: 8px 0 2px; font-weight: 600; color: var(--text-muted); }
.tsa-foot { display: flex; gap: 6px; padding: 7px 10px; border-top: 1px solid var(--divider); }
.tsa-foot .btn-secondary { width: auto; flex: 1; padding: 4px 8px; font-size: 12px; }

/* ---------- Working space: query | map | graphs (layout.js) ----------
   The graphs' width is a variable the movable separator sets (40% of the
   results side until it is moved); the map takes the rest. The separator is
   the map panel's right edge, so it travels with the panel and is switched
   off in Reports mode, which lays both panels out differently. */
.layout:not(.reports-layout) {
  grid-template-columns: 300px minmax(0, 1fr) var(--charts-w, calc((100vw - 300px) * 0.4));
}
.pane-splitter { position: absolute; top: 0; right: -4px; bottom: 0; width: 9px; z-index: 20; cursor: col-resize;
  display: flex; align-items: center; justify-content: center; touch-action: none; }
.pane-splitter span { width: 3px; height: 44px; border-radius: 2px; background: var(--border); transition: background .12s, height .12s; }
.pane-splitter:hover span, .pane-splitter:focus-visible span, .pane-splitter.dragging span { background: var(--accent); height: 72px; }
.pane-splitter:focus-visible { outline: none; }
.pane-splitter::before { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: transparent; transition: background .12s; }
.pane-splitter:hover::before, .pane-splitter.dragging::before, .pane-splitter:focus-visible::before { background: var(--accent); }
.main-panel.reports-mode .pane-splitter { display: none; }
body.pane-resizing { cursor: col-resize; user-select: none; }
body.pane-resizing .map, body.pane-resizing canvas { pointer-events: none; }

/* Focus: one graph over the whole graphs column. */
.chart-card[data-focus] { position: relative; }
.card-focus-btn { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--icon); cursor: pointer; opacity: .45; z-index: 2; }
.chart-card:hover .card-focus-btn, .card-focus-btn:focus-visible, .card-focus-btn[aria-pressed="true"] { opacity: 1; }
.card-focus-btn:hover { background: var(--hover-bg); border-color: var(--border); color: var(--accent); }
.card-focus-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* Zoom of the Time Series' time axis, left of the focus button. */
.ts-zoom { position: absolute; top: 2px; right: 28px; display: inline-flex; gap: 2px; opacity: .45; z-index: 2; }
.chart-card:hover .ts-zoom, .ts-zoom:focus-within, .ts-zoom.zoomed { opacity: 1; }
.ts-zoom button { width: 22px; height: 22px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent;
  color: var(--icon); cursor: pointer; font-size: 14px; line-height: 1; }
.ts-zoom button:hover { background: var(--hover-bg); border-color: var(--border); color: var(--accent); }
.ts-zoom.zoomed button[data-zoom="reset"] { color: var(--accent); }
.ts-card canvas { cursor: grab; }
.ts-card canvas:active { cursor: grabbing; }
.charts-panel.reports-mode .card-focus-btn { display: none; }
.charts-panel.focus-mode:not(.reports-mode) { display: flex; flex-direction: column; }
.charts-panel.focus-mode:not(.reports-mode) > .chart-card:not(.focused):not(.records-card) { display: none; }
.charts-panel.focus-mode:not(.reports-mode) > .chart-card.focused { flex: 1 1 auto; min-height: 220px; height: auto; margin-bottom: 0; }
.charts-panel.focus-mode:not(.reports-mode) > .chart-card.focused canvas { max-height: none; }
.charts-panel.focus-mode:not(.reports-mode) > .results-table-card.focused .rt-table-wrap { flex: 1; max-height: none; }
.charts-panel.focus-mode.records-mode:not(.reports-mode) > .chart-card.focused { display: none; }

/* Time Series analysis: the three steps, the pattern buttons and their results. */
.tsa-tabs { display: flex; border-bottom: 1px solid var(--divider); }
.tsa-tabs button { flex: 1; padding: 6px 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted);
  font: inherit; font-weight: 600; cursor: pointer; }
.tsa-tabs button b { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; font-size: 10px;
  background: var(--subtle-bg); color: var(--text-muted); }
.tsa-tabs button:hover { background: var(--hover-bg); }
.tsa-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tsa-tabs button.used b { background: var(--accent); color: var(--on-accent); }
.tsa-intro { margin: 2px 0 6px; color: var(--text-muted); }
.tsa-seg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tsa-seg button { flex: 1 1 30%; padding: 5px 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-bg); color: var(--text);
  font: inherit; cursor: pointer; }
.tsa-seg button:hover:not(:disabled) { background: var(--hover-bg); }
.tsa-seg button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.tsa-seg button:disabled { opacity: .45; cursor: default; }
.tsa-verdict { margin: 4px 0 6px; padding: 5px 8px; border-left: 3px solid var(--border); background: var(--subtle-bg); border-radius: 0 4px 4px 0; color: var(--text); }
.tsa-verdict--yes { border-left-color: var(--success); }
.tsa-verdict--mid { border-left-color: #c98a00; }
.tsa-verdict--no { border-left-color: var(--text-faint); }
.tsa-verdict--na { border-left-color: var(--border); color: var(--text-muted); }
.tsa-shares { display: grid; gap: 3px; }
.tsa-share { display: grid; grid-template-columns: 82px 1fr 34px; align-items: center; gap: 6px; color: var(--text-muted); }
.tsa-share i { display: block; height: 7px; min-width: 1px; border-radius: 2px; background: var(--border); }
.tsa-share b { text-align: right; font-weight: normal; }
.tsa-share.on { color: var(--text); font-weight: 600; }
.tsa-share.on i { background: var(--accent); }
.tsa-share.on b { font-weight: 700; }
.tsa-season { display: flex; align-items: stretch; gap: 2px; height: 74px; margin-top: 2px; }
.tsa-season div { flex: 1; position: relative; }
.tsa-season i { position: absolute; left: 1px; right: 1px; border-radius: 1px; }
.tsa-season i.up { bottom: calc(50% + 6px); background: var(--accent); }
.tsa-season i.down { top: calc(50% - 6px); background: var(--text-faint); }
.tsa-ccf i.up { background: var(--text-faint); }
.tsa-ccf i.sig { background: var(--accent); }
.tsa-season span { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 10px; color: var(--text-muted); }
.tsa-table tr.tsa-used th::after { content: " ●"; color: var(--accent); font-size: 9px; }

/* Spatial analysis (spatial.js): its button on the map; the window reuses the
   Time Series analysis window's styles (.tsa-*). */
.spa-map-btn { top: 8px; left: calc(50% - 13px); z-index: 15; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 4px; width: 26px; height: 26px; }
.main-panel.reports-mode .spa-map-btn { display: none; }
#spaPanel { width: 360px; }
#spaPanel .tsa-body > .tsa-row { margin-bottom: 2px; color: var(--text-muted); }
#spaPanel select { max-width: 100%; }
#spaPanel .tsa-table th .tsa-note { font-size: 10px; white-space: normal; }
#spaBand { width: 64px; }

/* ---------- Multi-hazard analysis (multihazard.js): the graph in the By Hazard card ---------- */
.mh-card { position: relative; }
.mh-card.mha-on canvas { visibility: hidden; }
.mha-view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--panel-bg); overflow: hidden; }
.mha-view[hidden] { display: none; }
.mha-title { flex: 0 0 22px; line-height: 22px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 58px 0 30px; }
.mha-view svg { flex: 1 1 auto; min-height: 0; width: 100%; display: block; }
.mha-msg { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 12px; padding: 8px; text-align: center; }
.mha-lab { font-size: 10px; fill: var(--text-muted); pointer-events: none; }
.mha-sel-lab { font-weight: 700; fill: var(--text); }
.mha-val, .mha-more { fill: var(--text-faint); }
.mha-head { font-weight: 600; }
.mha-web path.e { fill: none; stroke-width: 0.7; opacity: 0.22; }
.mha-web.hl path.e { opacity: 0.035; }
.mha-web path.e.out { stroke: #e8590c; opacity: 0.9; stroke-width: 1.3; }
.mha-web path.e.in { stroke: #1c7ed6; opacity: 0.9; stroke-width: 1.3; }
.mha-arc { fill: none; stroke-width: 4; stroke-linecap: butt; }
.mha-view circle.n { stroke-width: 0.8; cursor: pointer; }
.mha-view circle.n:hover { stroke: var(--text); stroke-width: 1.6; }
.mha-view circle.n.sel { stroke: var(--text); stroke-width: 2.2; }
.mha-bars .row, .mha-tree .tn, .mha-matrix .cell { cursor: pointer; }
.mha-bars .hit { fill: transparent; }
.mha-bars .row:hover .hit, .mha-bars .row.sel .hit { fill: var(--hover-bg); }
.mha-tree path.e { fill: none; opacity: 0.3; }
.mha-tree path.e.act { opacity: 0.75; }
.mha-matrix .cell:hover rect, .mha-matrix .cell.sel rect { stroke: var(--text); stroke-width: 1.5; }
.mha-cellv { fill: var(--text); }
#mhaPanel { width: 350px; }
#mhaPanel select { max-width: 100%; }
#mhaPanel .tsa-body > .tsa-row { margin-bottom: 2px; color: var(--text-muted); }
#mhaPanel input[type="range"] { vertical-align: middle; width: 150px; }
#mhaPanel .tsa-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
#mhaPanel a[data-i], #mhaPanel a[data-go] { color: inherit; cursor: pointer; text-decoration: none; }
#mhaPanel a[data-i]:hover, #mhaPanel a[data-go] { color: var(--accent); text-decoration: underline; }
.mha-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: baseline; }
.mha-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 6px 0; color: var(--text-muted); font-size: 11px; }
.mha-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }
.mha-path { line-height: 1.7; }
.mha-path b { color: var(--text-faint); font-weight: normal; }

/* ---------------- Embedded guide (tutorial.js) ---------------- */
.tut-open-btn { font-weight: 700; color: var(--accent); min-width: 26px; }
.tut-pulse { animation: tut-pulse 1.6s ease-in-out 6; }
@keyframes tut-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--mark) 55%, transparent); } }
.tsa-head .tut-help-btn { margin-left: auto; margin-right: 4px; font-size: 13px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--border); border-radius: 50%; width: 18px; height: 18px; padding: 0; line-height: 16px; }
.tsa-head .tut-help-btn:hover { color: var(--accent-hover); background: var(--hover-bg); }
.tut-root { position: fixed; inset: 0; z-index: 1300; }
.tut-block { position: absolute; inset: 0; }
.tut-dim .tut-block { background: rgba(8, 20, 27, .55); }
.tut-spot { position: absolute; border-radius: 6px; border: 2px solid var(--mark); pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(8, 20, 27, .55); transition: left .25s, top .25s, width .25s, height .25s; }
.tut-card { position: absolute; width: 340px; max-width: calc(100vw - 20px); max-height: calc(100vh - 20px);
  display: flex; flex-direction: column; background: var(--panel-bg); color: var(--text); font-family: var(--font);
  border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--float-shadow); font-size: 13px; outline: none; }
.tut-card.tut-wide { width: 440px; }
.tut-head { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-bottom: 1px solid var(--divider); }
.tut-chapters { flex: 1; min-width: 0; }
.tut-title { margin: 10px 14px 4px; font-size: 15px; color: var(--accent); }
.tut-body { overflow-y: auto; padding: 0 14px 6px; line-height: 1.45; }
.tut-body p { margin: 6px 0; }
.tut-body ul { margin: 4px 0 6px; padding-left: 18px; }
.tut-body li { margin: 3px 0; }
.tut-keys { color: var(--text-faint); font-size: 12px; }
.tut-foot { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--divider); }
.tut-count { flex: 1; color: var(--text-faint); font-size: 12px; }
.tut-foot button { width: auto; padding: 5px 12px; }

/* ---------- Geography from the map (geopick.js) ---------- */
.hint-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.hint-row .hint { margin: 0; }
.geo-pick-btn { width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--icon); cursor: pointer; }
.geo-pick-btn:hover { background: var(--hover-bg); color: var(--accent); }
.geo-pick-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* while picking, the map shows only the boundaries: its other boxes step aside */
body.geo-picking #mapControls, body.geo-picking #mapLayersBox, body.geo-picking #mapLegend, body.geo-picking #spaMapBtn { display: none; }
.geo-pick-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 24px);
  background: var(--float-bg); color: var(--text); padding: 8px 10px; border-radius: 6px; box-shadow: var(--float-shadow);
  font-size: 11px; display: flex; flex-direction: column; gap: 6px; }
.geo-pick-bar[hidden] { display: none; }
.geo-pick-head { display: flex; align-items: baseline; gap: 8px; }
.geo-pick-level { color: var(--text-muted); }
.geo-pick-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.geo-pick-tools button { height: 26px; min-width: 28px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel-bg); color: var(--icon); cursor: pointer; font-size: 11px; }
.geo-pick-tools button:hover { color: var(--accent); background: var(--hover-bg); }
.geo-pick-tools button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.geo-pick-tools .geo-pick-text { color: var(--text); }
.geo-pick-tools #geoPickClearBtn { margin-left: 8px; }
.geo-pick-tools .geo-pick-done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.geo-pick-info { color: var(--text-muted); max-width: 420px; line-height: 1.35; }
/* while picking, a refresh does not block the drawing: the spinner shows at the bottom, clicks pass */
body.geo-picking .loading-overlay { pointer-events: none; background: transparent; align-items: flex-end; padding-bottom: 28px; }

/* report citations, one bullet each (tree and preview); function operations */
.rv-citation-list, .rp-citation-list { margin: 4px 0 6px; padding-left: 18px; list-style: disc; }
.rv-citation-list > li.rv-item-row { display: list-item; }
.rv-citation-list > li .hint, .rv-citation-list > li .rv-item-actions { float: right; margin-left: 6px; }
.rp-citation-list > li { font-size: 12px; margin: 2px 0; }
.fn-ops { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* records list: every stored effect of a record, one line per kind */
.records-card .rt-table td.rec-effects, .records-card .rt-table th.rec-effects { text-align: left; min-width: 260px; }
.rec-eff-line { font-size: 11px; line-height: 1.35; }
.rec-eff-kind { color: var(--text-muted); font-weight: 600; }
