/* EASI — StreamStats-style app chrome + STAF-style screening report.
   Mirrors the STAF design tokens (docs/assets/css/custom.css) so the EASI report
   popup reads like the STAF screening summary. Served automatically from www/. */

@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --easi-accent: #2f4b7c;
  --easi-accent-dark: #243a61;
  /* outcome borders / titles (STAF) */
  --phys-border: #4a7fb5; --phys-title: #3b6d9c;
  --chem-border: #b5873a; --chem-title: #9a7332;
  --bio-border:  #3a8a5c; --bio-title:  #327a50;
  --eci-title:   #1f3f6e;
  /* Good / Fair / Poor band colors (STAF) */
  --band-poor: #f5b5b5; --band-fair: #f5e7a6; --band-good: #c8d9f2;
  /* surfaces */
  --card-border: #d5deea; --rule: #e5e8ee; --surface-soft: #f6f8fb;
  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}

body { font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6, .card-header { font-family: var(--font-head); }

/* --------------------------------------------------------------------------- */
/* StreamStats-style chrome                                                     */
/* --------------------------------------------------------------------------- */
.bslib-sidebar-layout > .sidebar { background: var(--surface-soft); }
.sidebar h4 { color: var(--eci-title); font-weight: 700; }
.btn-primary { background: var(--easi-accent); border-color: var(--easi-accent); }
.btn-primary:hover, .btn-primary:focus {
  background: var(--easi-accent-dark); border-color: var(--easi-accent-dark);
}
.card-header { color: var(--eci-title); font-weight: 600; }
.leaflet-container { border-radius: 6px; }
.easi-snap-note { font-size: 12px; margin: 4px 0 0; }
.easi-snap-note.warn { color: #9a6a00; }
.easi-snap-note.ok { color: #1a7f37; }

/* --------------------------------------------------------------------------- */
/* Report tables / chips / bars (migrated from app.py inline CSS)               */
/* --------------------------------------------------------------------------- */
.easi-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.easi-tbl th, .easi-tbl td {
  border-bottom: 1px solid var(--rule); padding: 4px 7px;
  text-align: left; vertical-align: top;
}
.easi-tbl th { background: #fafbfd; font-weight: 600; border-bottom: 2px solid #d7dce5; }
.easi-disc td { background: #f3f5f9; font-weight: 600; color: var(--easi-accent); }
.easi-chip { padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
.easi-bar-row { display: flex; gap: 8px; align-items: center; margin: 3px 0; }
.easi-bar-row.indent { margin-left: 18px; }
.easi-bar-label { width: 184px; flex: none; font-size: 12px; line-height: 1.2; }
.easi-bar-track { flex: 1; background: #edeef2; border-radius: 3px; height: 15px; }
.easi-bar-fill { height: 15px; border-radius: 3px; }
.easi-bar-val { width: 34px; flex: none; text-align: right; font-size: 12px; font-weight: 600; }
/* in-table rating override (chip-styled native <select>) + per-metric notes */
.easi-rate-sel {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  border: 1px solid rgba(0, 0, 0, .22); border-radius: 10px;
  padding: 2px 19px 2px 9px; font-weight: 600; font-size: 11.5px; cursor: pointer;
  width: fit-content; min-width: 58px; white-space: nowrap;   /* snug to the rating word */
  transition: border-color .12s, box-shadow .12s;
  background-repeat: no-repeat; background-position: right 6px center; background-size: 10px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23334155'/%3E%3C/svg%3E");
}
.easi-rate-sel.rate-Good { background-color: var(--band-good); color: #1f3f6e; }
.easi-rate-sel.rate-Fair { background-color: var(--band-fair); color: #6b5310; }
.easi-rate-sel.rate-Poor { background-color: var(--band-poor); color: #7a2e2e; }
.easi-rate-sel.rate-auto { background-color: #eef2f8; color: #55607a; }
/* the closed chip is colored, but the expanded option list stays neutral white */
.easi-rate-sel option { background-color: #fff; color: #2a3344; }
.easi-rate-cell { display: flex; align-items: center; gap: 5px; }
.easi-rate-sel:hover, .easi-rate-sel:focus {
  border-color: var(--easi-accent); box-shadow: 0 1px 5px rgba(20, 40, 80, .18); outline: none;
}
/* manually overridden row: accent stripe + faint tint. Cross-section-derived rows are
   intentionally NOT tinted (they aren't manual overrides — see _metric_table). */
.easi-row-ovr td { background: #f3f7fd; }
.easi-row-ovr td:first-child { box-shadow: inset 3px 0 0 var(--easi-accent); }
/* per-metric note: icon button + expandable textarea sub-row */
.easi-note-cell { width: 46px; text-align: center; }
.easi-note-btn {
  cursor: pointer; padding: 1px 6px; line-height: 1.2; font-size: 12px;
  color: #5b6b85; background: #fff; border: 1px solid var(--card-border); border-radius: 5px;
  transition: border-color .12s, color .12s, background .12s;
}
.easi-note-btn:hover { color: var(--easi-accent); border-color: var(--easi-accent); background: #eef2f8; }
.easi-note-btn.has-note { color: #fff; background: var(--easi-accent); border-color: var(--easi-accent); }
.easi-note-row { display: none; }
.easi-note-row.open { display: table-row; }
.easi-note-row td { background: #f8fafc; padding: 6px 10px; }
.easi-note-ta {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 38px;
  border: 1px solid var(--card-border); border-radius: 6px; padding: 6px 8px;
  font-size: 12px; color: #2a3344; background: #fff;
}
.easi-note-ta:focus {
  outline: none; border-color: var(--easi-accent); box-shadow: 0 0 0 2px rgba(47, 75, 124, .12);
}

/* --------------------------------------------------------------------------- */
/* Metric-table display toggles (STAF "screening" controls; www/report-controls.js) */
/* Detail columns/rows/badges are always rendered but hidden until the matching     */
/* checkbox flips a class on #easi-report — purely client-side, so a toggle never    */
/* re-renders a Shiny output (no flicker / no .recalculating spinner).               */
/* --------------------------------------------------------------------------- */
.easi-metric-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  margin: 2px 0 8px; padding: 7px 10px;
  background: #f6f8fc; border: 1px solid var(--card-border); border-radius: 8px;
}
.easi-toggle-item {
  display: inline-flex; align-items: center; gap: 5px; margin: 0; font-weight: 500;
  font-size: 12px; color: #33415c; cursor: pointer; user-select: none;
}
.easi-toggle-item input { cursor: pointer; margin: 0; }

/* default-hidden detail (revealed by the wrapper classes below) */
.easi-col-adv, .easi-col-map { display: none; }
.easi-fnf-badge, .easi-auto-cue { display: none; }
.easi-rollup-row { display: none; }

#easi-report.show-adv .easi-col-adv { display: table-cell; }
#easi-report.show-map .easi-col-map { display: table-cell; }
#easi-report.show-rollup .easi-rollup-row { display: table-row; }
#easi-report.show-fnf .easi-fnf-badge { display: inline-block; }
#easi-report.show-suggested .easi-auto-cue { display: inline; }

/* mapping cells (D / i / –) read as compact centered codes */
.easi-col-map { text-align: center; font-weight: 600; color: #46536e; }

/* function-score cell: score + band badge + auto cue on one line */
.easi-fs-cell { white-space: nowrap; }
.easi-fnf-badge {
  margin-left: 6px; padding: 0 6px; border-radius: 9px; vertical-align: middle;
  font-size: 10px; font-weight: 700; color: #2a3344;
}
.easi-auto-cue { margin-left: 6px; font-size: 11px; color: #8791a6; font-style: italic; }

/* Function Score: read-only STAF-style slider vs the plain number, chosen by the
   "show-slider" toggle (wrapper ships .show-slider, so the slider is the default). Both are
   emitted in the cell; CSS shows one — flipping is instant, no re-render. */
#easi-report.show-slider .easi-fscore-plain { display: none; }
.easi-fslider { display: none; align-items: center; gap: 8px; vertical-align: middle; }
#easi-report.show-slider .easi-fslider { display: inline-flex; }
.easi-fslider-bars { width: 108px; }
.easi-fslider-labels { display: none; }              /* NF/AR/F above the track (Show F/AR/NF) */
#easi-report.show-slider.show-fnf .easi-fslider-labels { display: flex; margin-bottom: 2px; }
.easi-fslider-labels span {
  flex: 1; text-align: center; font-size: 8px; font-weight: 700; color: #6b7280; line-height: 1;
}
.easi-fslider-track {
  position: relative; height: 6px; border-radius: 3px;
  background: linear-gradient(to right, #f5b5b5 0 33.33%, #f5e7a6 33.33% 66.66%,
                              #c8d9f2 66.66% 100%);
}
.easi-fslider-knob {
  position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid #33415c; transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.easi-fslider-num { font-weight: 700; font-variant-numeric: tabular-nums; }

/* integrated outcome rollup: two renderings toggled purely by the mappings state (no
   re-render). Aligned <tfoot> — values sit under the P/C/B columns — shows when mappings
   are ON; the right-justified standalone table shows when mappings are OFF. */
.easi-metrics-block { margin: 0 0 6px; }
#easi-report:not(.show-map) .easi-rollup-foot { display: none; }
#easi-report.show-map .easi-rollup-standalone { display: none; }
/* center the mapping column (header, D/i/– codes, and the aligned rollup values) so they
   line up in-column — beats the base left-aligned .easi-tbl th/td */
.easi-tbl th.easi-col-map, .easi-tbl td.easi-col-map { text-align: center; }
.easi-tbl th.easi-rollup-lbl { text-align: right; font-weight: 700; color: var(--easi-accent); }
.easi-rollup-foot td, .easi-tbl.easi-rollup-standalone td { font-variant-numeric: tabular-nums; }
.easi-tbl.easi-rollup-standalone td { text-align: center; min-width: 3.4rem; }
.easi-tbl.easi-rollup-standalone thead th { text-align: center; }
/* full-width: the label column stretches so the values sit at the right; the label text is
   right-justified (like the mappings-on footer) so it hugs the values */
.easi-tbl.easi-rollup-standalone th.easi-rollup-lbl { text-align: right; width: 100%; }
.easi-rollup-foot td.easi-band, .easi-rollup-standalone td.easi-band {
  font-weight: 700; color: #26324a;
}
/* standalone (mappings hidden): full-width block — label far left, values on the right
   under its own P/C/B header (the aligned tfoot uses the table's headers instead) */
.easi-rollup-standalone { width: 100%; margin: 6px 0 0; }

/* --------------------------------------------------------------------------- */
/* STAF screening-summary layout (report modal)                                */
/* --------------------------------------------------------------------------- */
.easi-summary-head { margin-bottom: 0.7rem; }
.easi-summary-head h3 { margin: 0 0 0.45rem; color: var(--eci-title); font-weight: 700; }
.easi-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.easi-fact {
  background: #eef2f8; border: 1px solid var(--card-border); border-radius: 12px;
  padding: 2px 10px; font-size: 12px; color: #33415c;
}
.easi-fact b { color: var(--eci-title); font-weight: 600; }

/* two-panel summary plots: function scores (grouped by category) | condition indices */
.easi-summary-plots {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  align-items: start; margin: 6px 0 14px;
}
@media (max-width: 760px) { .easi-summary-plots { grid-template-columns: 1fr; } }
.easi-plot-panel { min-width: 0; }
.easi-plot-title {
  font-family: var(--font-head); font-weight: 700; font-size: 0.95rem;
  color: var(--eci-title); margin: 0 0 4px;
}
.easi-plot-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; }
.easi-leg-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #556; }
.easi-leg-sw {
  width: 11px; height: 11px; border-radius: 2px; display: inline-block;
  border: 1px solid rgba(0, 0, 0, .18);
}
.easi-fn-block { margin-bottom: 7px; }
.easi-fn-group {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #3a6ea5; margin: 4px 0 2px;
}

/* cross-section block: summary table + editable inputs (left) beside the plot (right) */
.easi-xsection-wrap {
  display: grid; grid-template-columns: 300px 1fr; gap: 10px;
  align-items: stretch; margin: 12px 0;   /* plot column matches the left card's height */
}
.easi-xsection {
  border: 1px solid var(--card-border); border-radius: 8px; padding: 8px;
  background: #fff; text-align: center; min-width: 0;
  display: flex; flex-direction: column; justify-content: flex-start;
  flex: 1; min-height: 300px;              /* fill the column height (safety floor 300px) */
}
.easi-xsection img { max-width: 100%; height: auto; }
.easi-xsection-cap { font-size: 11px; color: #667; margin: 4px 0 0; }

.easi-xs-panel {
  border: 1px solid var(--card-border); border-radius: 8px; padding: 8px 10px 10px;
  background: #f7f9fc; display: flex; flex-direction: column; min-width: 0;
}
.easi-xs-panel-title {
  font-family: var(--font-head); font-weight: 600; color: var(--eci-title);
  font-size: 0.9rem; margin-bottom: 6px;
}
.easi-xs-tbl { margin-bottom: 8px; }
.easi-xs-tbl th { background: transparent; font-weight: 600; white-space: nowrap; }
.easi-xs-tbl td { text-align: right; }
.easi-xs-foot { font-size: 10.5px; color: #993366; margin: 0 0 8px; }
.easi-xs-fields { display: flex; gap: 10px; }
.easi-xs-fields .shiny-input-container { flex: 1; margin-bottom: 6px; }
.easi-xs-panel label { font-size: 11.5px; font-weight: 600; color: #33415c; }
.easi-xs-panel .form-control { padding: 3px 8px; height: auto; }
.easi-xs-panel .shiny-options-group { font-size: 12px; }
.easi-xs-panel .btn { margin-top: 2px; align-self: flex-start; }

/* plot column: a header row (title + candidate selector) sits above the Plotly plot,
   clear of the modebar (which stays top-right inside the plot). */
.easi-xs-right { display: flex; flex-direction: column; min-width: 0; }
.easi-xs-plot-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 2px;
}
.easi-xs-plot-title {
  font-family: var(--font-head); font-weight: 600; color: var(--eci-title);
  font-size: 0.95rem;
}
.easi-xs-switch {
  display: flex; align-items: center; gap: 2px; flex: none;
  background: rgba(255, 255, 255, .9); border: 1px solid var(--card-border);
  border-radius: 7px; padding: 1px 3px; box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
.easi-xs-arrow {
  border: none; background: transparent; cursor: pointer;
  padding: 0 5px; font-size: 12px; line-height: 1.4; color: var(--easi-accent);
}
.easi-xs-arrow:hover { color: var(--eci-title); }
.easi-xs-switch-lbl { font-size: 11px; color: #33415c; min-width: 92px; text-align: center; }

@media (max-width: 640px) {
  .easi-xsection-wrap { grid-template-columns: 1fr; }
}

.easi-section-title {
  font-family: var(--font-head); font-weight: 600; color: var(--eci-title);
  margin: 16px 0 6px; font-size: 0.98rem;
}

/* collapsible "Outcome rollup" (native <details>/<summary>), collapsed by default */
.easi-rollup { margin: 16px 0 6px; }
summary.easi-rollup-sum {
  cursor: pointer; list-style: none; user-select: none;
  display: flex; align-items: center; gap: 6px; margin: 0;
}
summary.easi-rollup-sum::-webkit-details-marker { display: none; }
summary.easi-rollup-sum::before {
  content: ""; flex: none; width: 0; height: 0;
  border-left: 5px solid var(--easi-accent);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
details.easi-rollup[open] > summary.easi-rollup-sum::before { transform: rotate(90deg); }
.easi-disclaimer { color: #667; font-size: 11.5px; margin-top: 12px; }

/* --------------------------------------------------------------------------- */
/* Report modal sizing (target Bootstrap classes — robust across Shiny vers.)   */
/* --------------------------------------------------------------------------- */
/* The report (the only size="xl" modal) fills the viewport height and scrolls ONLY in its
   body. The background page is already locked (html, body overflow:hidden), so this removes
   the outer modal scrollbar and the wasted space above the popup. */
.modal-dialog.modal-xl {
  max-width: min(1180px, 96vw);
  height: calc(100vh - 1.5rem);     /* fill the viewport, ~0.75rem gap top + bottom */
  margin: 0.75rem auto;
}
.modal-xl .modal-content { max-height: 100%; overflow: hidden; }   /* no outer scroll */
.modal-xl .modal-body   { overflow-y: auto; }                      /* the only scroll region */
/* The report must sit ABOVE the absolutely-positioned header (1200) and left pane
   (1100) so it's fully visible; its backdrop covers them too, so the user has to
   close the report (✕ or click-outside) before interacting with the map/pane. */
.modal-backdrop { z-index: 1290 !important; }
.modal { z-index: 1300 !important; }
.easi-modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid var(--rule); margin-top: 14px; padding-top: 10px;
}

@media (max-width: 920px) {
  .outcome-cards { grid-template-columns: 1fr; }
}

/* ========================================================================== */
/* StreamStats-style full-screen shell                                         */
/* ========================================================================== */
html, body { height: 100%; margin: 0; overflow: hidden; }
.bslib-page-fillable { height: 100vh !important; }
.bslib-page-fillable, .bslib-page-fillable > .container-fluid { padding: 0 !important; gap: 0 !important; margin: 0 !important; }
.easi-shell { position: absolute; inset: 0; overflow: hidden; }

/* top header bar */
.easi-header {
  position: absolute; top: 0; left: 0; right: 0; height: 50px; z-index: 1200;
  background: var(--easi-accent-dark); color: #fff;
  display: flex; align-items: center; padding: 0 16px;
}
.easi-header .easi-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.easi-header .easi-brand small { font-weight: 400; opacity: .8; font-size: .8rem; margin-left: 8px; }
.easi-header .easi-nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.easi-header .easi-nav a { color: #cdd8ec; text-decoration: none; font-size: 13px; cursor: pointer; }
.easi-header .easi-nav a:hover { color: #fff; }

/* STAF site link in the header (cross-app links removed to keep the banner minimal). */
.easi-header .staf-topnav {
  display: flex; align-items: center; gap: 14px;
  margin-left: 22px; padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}
.easi-header .staf-topnav-link {
  color: #cdd8ec; text-decoration: none; font-size: 12px;
  white-space: nowrap; cursor: pointer;
}
.easi-header .staf-topnav-link:hover { color: #fff; }

@media (max-width: 600px) {
  .easi-header { padding: 0 10px; }
  .easi-header .easi-brand small { display: none; }
  .easi-header .staf-topnav { margin-left: 10px; padding-left: 10px; }
  .easi-header .easi-nav { gap: 4px 8px; flex-wrap: wrap; align-items: center; }
  .easi-header .easi-nav a { font-size: 12px; white-space: nowrap; }
}

/* map fills everything below the header */
.easi-map-wrap { position: absolute; top: 50px; left: 0; right: 0; bottom: 0; z-index: 0; }
.easi-map-wrap > div, .easi-map-wrap .shiny-html-output,
.easi-map-wrap .jupyter-widgets { height: 100% !important; width: 100% !important; }
.easi-map-wrap .leaflet-container { height: 100% !important; width: 100% !important; border-radius: 0; }
.easi-map-wrap .leaflet-top { margin-top: 4px; }

/* left workflow pane, overlaying the map's left edge */
.easi-leftpane {
  position: absolute; top: 62px; left: 12px; width: 352px; max-height: calc(100vh - 86px);
  z-index: 1100; background: #fff; border: 1px solid var(--card-border); border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18); overflow-y: auto; overflow-x: hidden;
}
.easi-pane-head {
  background: var(--easi-accent); color: #fff; padding: 9px 14px;
  font-family: var(--font-head); font-weight: 600; border-radius: 8px 8px 0 0;
}
.easi-pane-body { padding: 12px 14px 16px; }
.easi-pane-body hr { margin: 8px 0; }   /* the search-to-coordinates divider */
.easi-instr {
  background: #f5f8fb; border-left: 3px solid var(--easi-accent); padding: 8px 10px;
  font-size: 12.5px; color: #33415c; margin-bottom: 10px; border-radius: 0 4px 4px 0;
}

/* stepper */
.easi-steps { display: flex; gap: 4px; margin-bottom: 12px; }
.easi-step {
  flex: 1; text-align: center; font-size: 10px; color: #8a93a3;
  padding: 5px 2px 6px; border-top: 3px solid #e2e7ef;
  text-decoration: none; cursor: pointer; border-radius: 0 0 3px 3px;
}
.easi-step:hover { background: #eef2f8; color: var(--easi-accent); text-decoration: none; }
.easi-step.active { color: var(--easi-accent); font-weight: 700; border-top-color: var(--easi-accent); }
.easi-step.done { color: var(--bio-title); border-top-color: var(--bio-border); }

/* basin summary card */
.easi-basin-card {
  background: #fbfdff; border: 1px solid var(--card-border); border-radius: 6px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 10px;
}
.easi-basin-card h5 { font-family: var(--font-head); color: var(--eci-title); font-size: 0.95rem; margin: 0 0 6px; }
.easi-basin-card .b-row { display: flex; justify-content: space-between; padding: 2px 0; }
.easi-basin-card .b-row b { color: var(--eci-title); font-weight: 600; }

/* configure panel */
.easi-cfg-group {
  font-family: var(--font-head); font-weight: 700; color: var(--easi-accent);
  font-size: 12.5px; margin: 12px 0 2px; border-bottom: 1px solid var(--rule); padding-bottom: 2px;
}
.easi-cfg-row { padding: 3px 0; border-bottom: 1px solid #eef1f6; }
.easi-cfg-row .form-group, .easi-cfg-row .shiny-input-container { margin-bottom: 0; }
.easi-cfg-row .shiny-input-container { margin-top: 2px; }       /* dropdown sits just below the name */
/* metric name (replaces the old checkbox label) — its own line; keep it in the 12-13px
   scale so it doesn't dwarf the discipline (12.5) / function (12) headers above it */
.easi-metric-name { display: block; font-size: 13px; font-weight: 500; color: #2a3344; line-height: 1.35; }
.easi-cfg-row select, .easi-cfg-row .shiny-input-container select { font-size: 12.5px; }
/* small circled-"i" info button — sits inline right after each name (function name
   or metric name); custom tooltip on hover. */
.easi-info {
  margin-left: 5px; flex: none; cursor: help; vertical-align: middle;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #eef3fb; border: 1px solid #b9c8e0; color: var(--easi-accent);
  font: italic 700 10.5px/1 Georgia, "Times New Roman", serif; user-select: none;
}
.easi-info:hover { background: var(--easi-accent); border-color: var(--easi-accent); color: #fff; }
/* light floating tooltip box (positioned on <body> by www/tooltip.js) */
.easi-tip {
  position: absolute; z-index: 1400; max-width: 270px;
  background: #fff; color: #33415c;
  border: 1px solid var(--card-border); border-radius: 7px;
  box-shadow: 0 6px 22px rgba(20, 40, 80, .16);
  padding: 8px 11px; font-size: 11.5px; line-height: 1.5;
  white-space: pre-line; pointer-events: none;
}

/* rich metric tooltip card (data-tip-html): definition / calculation / scoring */
.easi-tip--html { max-width: 340px; white-space: normal; }
.easi-tip-title { font-weight: 700; font-size: 12px; color: #22304d; margin-bottom: 5px; }
.easi-tip-sec { margin-top: 7px; }
.easi-tip-sec:first-of-type { margin-top: 0; }
.easi-tip-lbl {
  display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #3a6ea5; margin-bottom: 1px;
}
.easi-tip-sub { color: #6b7689; font-size: 10.5px; margin-top: 2px; }
.easi-tip-default { color: #6b7689; font-size: 10.5px; font-style: italic; margin-left: 5px; }
.easi-tip-crit { display: flex; align-items: baseline; gap: 5px; margin-top: 3px; }
.easi-tip-dot {
  flex: none; width: 9px; height: 9px; border-radius: 2px; margin-top: 1px;
  border: 1px solid rgba(0, 0, 0, .18);
}
.easi-tip-dot.good { background: var(--band-good); }
.easi-tip-dot.fair { background: var(--band-fair); }
.easi-tip-dot.poor { background: var(--band-poor); }

/* collapsible disciplines (native <details>/<summary>) */
.easi-disc { margin: 0; }
summary.easi-cfg-group {
  cursor: pointer; list-style: none; user-select: none;
  display: flex; align-items: center; gap: 6px;
}
summary.easi-cfg-group::-webkit-details-marker { display: none; }
summary.easi-cfg-group::before {
  content: ""; flex: none; width: 0; height: 0;
  border-left: 5px solid var(--easi-accent);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
details[open] > summary.easi-cfg-group::before { transform: rotate(90deg); }
.easi-disc-body { padding-left: 2px; }
/* function sub-header (name + ⓘ statement tooltip) with its metric(s) indented beneath */
.easi-fn-group { display: flex; align-items: center; gap: 6px; margin: 6px 0 1px; }
.easi-fn-name { font-size: 12px; font-weight: 600; color: #2a3344; }
.easi-fn-block { margin-bottom: 3px; }
.easi-fn-block .easi-cfg-row { padding-left: 10px; margin-left: 2px; border-left: 2px solid #e7ebf2; }

/* place/stream search type-ahead dropdown (Photon) */
.easi-ac-menu {
  position: absolute; z-index: 1300; background: #fff;
  border: 1px solid var(--card-border); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
  max-height: 280px; overflow-y: auto; padding: 4px 0;
  font-family: var(--font-body, system-ui);
}
.easi-ac-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #f1f4f9;
}
.easi-ac-item:last-child { border-bottom: none; }
.easi-ac-item:hover { background: #eef3fb; }
.easi-ac-name { font-size: 12.5px; color: #2a3344; font-weight: 600; }
.easi-ac-meta { font-size: 10.5px; color: #8a93a3; }

/* lat/lon + zoom readout, bottom-left */
.easi-readout {
  position: absolute; left: 12px; bottom: 12px; z-index: 1100;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--card-border); border-radius: 5px;
  padding: 4px 9px; font-size: 11px; color: #33415c; font-variant-numeric: tabular-nums;
}

/* "Loading streams…" cue while NHD vectors fetch (bottom-center, identify step) */
.easi-flow-loading {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1100;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--card-border); border-radius: 16px;
  box-shadow: 0 2px 11px rgba(20, 40, 80, .15);
  padding: 5px 14px 5px 11px; font-size: 12px; font-weight: 500; color: var(--easi-accent);
}

/* busy/stage indicator — a TEXT output (.easi-busy-text) updated in place; the spinner is
   a ::before on this persistent element so it spins smoothly. It collapses to nothing
   when idle (:empty). */
.easi-busy-text:not(:empty) {
  display: flex; align-items: center; gap: 8px;
  color: var(--easi-accent); font-size: 13px; margin-top: 10px;
}
.easi-busy-text:not(:empty)::before {
  content: ""; width: 15px; height: 15px; flex: none;
  border: 2px solid #cdd8ec; border-top-color: var(--easi-accent);
  border-radius: 50%; animation: easi-spin .8s linear infinite;
}
/* Suppress Shiny's automatic "recalculating" spinner overlay on this output. Shiny
   stamps every output with .recalculating while it recomputes, which adds min-height:
   32px + a 32px ::after spinner + opacity:0.3. The progress label recomputes ~3x/s, so
   that overlay flickered the row height (the jitter) and dimmed it. We have our own
   spinner, so neutralize Shiny's here only. */
.easi-busy-text.recalculating { min-height: 0 !important; opacity: 1 !important; }
.easi-busy-text.recalculating::after { display: none !important; }
/* Same overlay, same fix, inside the report modal. Every in-modal recompute (candidate
   switch, rating/note edit) is an instant, cached operation, so Shiny's .recalculating
   overlay (opacity:0.3 + min-height:32px + ::after spinner) only turns those swaps into a
   full-report flash. Neutralize it so the numbers just update in place. */
.modal-body .recalculating { min-height: 0 !important; opacity: 1 !important; }
.modal-body .recalculating::after { display: none !important; }
/* Same overlay, same fix, for the worksheet outputs (the rails re-render on every
   keystroke): their recomputes are instant local swaps; Shiny's overlay would flash
   the columns and shift the layout on every edit. */
.sfari-worksheet .recalculating { min-height: 0 !important; opacity: 1 !important; }
.sfari-worksheet .recalculating::after { display: none !important; }
.easi-spinner {
  width: 15px; height: 15px; border: 2px solid #cdd8ec; border-top-color: var(--easi-accent);
  border-radius: 50%; animation: easi-spin .8s linear infinite; flex: none;
}
@keyframes easi-spin { to { transform: rotate(360deg); } }
.easi-spinner.easi-lookup-spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
}
@media (prefers-reduced-motion: reduce) {
  .easi-lookup-spinner { animation: none; }
}

/* row of pane action buttons */
/* wrap, because .btn below cannot shrink past its nowrap label: without this an
   over-long label overflows the 352px pane and .easi-leftpane's overflow-y turns that
   into a horizontal scrollbar */
.easi-pane-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* keep labels on one line so a narrow button (e.g. "Compute & report") does not
   wrap to two lines and stretch the whole row taller via align-items: stretch;
   trim the vertical padding so the single-line buttons stay compact */
.easi-pane-actions .btn { flex: 1; white-space: nowrap; padding-top: 7px; padding-bottom: 7px; }

/* bottom-right toasts (StreamStats placement) */
#shiny-notification-panel { top: auto !important; bottom: 14px !important; right: 14px !important; left: auto !important; width: 330px; }

/* modal close X (Shiny Core doesn't render one, so we inject our own) */
.modal-header { border-bottom: 1px solid var(--rule); }
.modal-content { position: relative; }
.easi-modal-x {
  position: absolute; top: 7px; right: 12px; z-index: 5;
  border: none; background: transparent; font-size: 21px; line-height: 1;
  color: #66708a; padding: 2px 9px; cursor: pointer;
}
.easi-modal-x:hover { color: var(--eci-title); }

/* --------------------------------------------------------------------------- */
/* SFARI field-review worksheet (Phase 2)                                       */
/* --------------------------------------------------------------------------- */
/* sits above the (empty) left workflow pane, the map readout, and the coverage panel (all
   z 1100) so no Identify-step chrome bleeds through; still under the header (1200), modals
   (1300), and tooltips (1400) */
.sfari-worksheet { position: absolute; top: 50px; left: 0; right: 0; bottom: 0; z-index: 1150;
  background: var(--surface-soft); display: flex; overflow: hidden; }

/* Assessment picker, opened as a modal from the Basin pane's "Change" link. */
.deep-assess-cards { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.deep-assess-card { background: #fff; border: 1px solid var(--card-border); border-radius: 10px;
  padding: 14px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .12s, box-shadow .12s, background .12s; }
.deep-assess-card:hover { border-color: var(--easi-accent); box-shadow: 0 2px 10px rgba(31,63,110,.08); }
.deep-assess-card.is-selected { border-color: var(--easi-accent); background: #f7faff;
  box-shadow: inset 0 0 0 1px var(--easi-accent); }
.deep-assess-card .btn { margin-top: auto; width: 100%; }
.deep-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deep-card-name { font-weight: 600; color: #223; }
.deep-card-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; padding: 2px 7px; border-radius: 999px; }
/* the status badges, in the assessment regions' colors (owner, 2026-10-08) */
.deep-badge-draft { background: #eceff3; color: #475569; }
.deep-badge-prelim { background: #fdf0d5; color: #92400e; }
.deep-badge-cert { background: #e8eaf6; color: #303f9f; }
.deep-card-region { font-size: 12px; color: #5a6478; }
.deep-card-verrow { display: flex; align-items: center; gap: 8px; }
.deep-card-tierrow { display: flex; align-items: baseline; gap: 6px; }
.deep-card-tier { font-size: 12px; color: #33415c; }
.deep-card-verlabel { font-size: 11px; color: #8a93a3; text-transform: uppercase;
  letter-spacing: .03em; }

/* The resolved assessment, stated under the basin card. One accent edge, so the corners
   stay square: rounding a single-sided border reads as a rendering fault. */
.deep-pane-assess { margin-top: 10px; padding: 8px 10px; background: #f7faff;
  border: 1px solid var(--card-border); border-left: 3px solid var(--easi-accent);
  border-radius: 0; }
.deep-pane-assess.is-blocked { background: #fdf9ec; border-color: #e0cf94;
  border-left-color: #c9a227; }
.deep-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deep-pane-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: #8a93a3; }
.deep-pane-name { font-size: 12.5px; font-weight: 600; color: #223; line-height: 1.35;
  margin-top: 3px; }
.deep-pane-line { font-size: 11.5px; color: #5a6478; margin-top: 3px; }
.deep-pane-assess.is-blocked .deep-pane-name,
.deep-pane-assess.is-blocked .deep-pane-line { color: #7a5b12; }
.deep-pane-note { font-size: 11px; color: #5a6478; margin-top: 4px; font-style: italic; }
.deep-pane-caution { font-size: 11.5px; color: #a3521f; margin-top: 4px; }
.deep-pane-change { text-align: right; margin-top: 5px; }
.deep-pane-change a { font-size: 11.5px; color: var(--easi-accent); }
/* The worksheet rail, SFARI's (2026-10-04): the same width, scrollbar and type in EASI,
   SFARI and DEEP. The width is the narrowest that keeps the bold "Low flow and baseflow
   dynamics" on one line with the scrollbar showing. */
.sfari-nav { width: 276px; flex: none; background: #fff; border-right: 1px solid var(--card-border);
  overflow: hidden auto; padding: 0 0 14px; }
/* slim, quiet scrollbars for the worksheet columns and modals: the default chunky
   Windows bar reads as clutter; the thumb stays faint until the column is hovered */
.sfari-nav, .sfari-fnpanel, .sfari-rollup, .modal-body {
  scrollbar-width: thin; scrollbar-color: #e4e9f1 transparent; }
.sfari-nav:hover, .sfari-fnpanel:hover, .sfari-rollup:hover, .modal-body:hover {
  scrollbar-color: #c3cbda transparent; }
.sfari-nav-cat { font-family: var(--font-head); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: #98a1b1; padding: 11px 14px 2px; }
.sfari-nav-fn { display: flex; align-items: flex-start; gap: 7px; padding: 5px 14px;
  font-size: 14px; line-height: 1.3; color: #33415c; cursor: pointer;
  border-left: 3px solid transparent; }
.sfari-nav-fn:hover { background: #eef2f8; }
.sfari-nav-fn.active { background: #eaf0f9; border-left-color: var(--easi-accent);
  font-weight: 600; color: var(--easi-accent); }
.sfari-nav-fn.unassessed:not(.active) { color: #8a93a3; }
/* small borderless dot, top-aligned to the first line of wrapped names; scored band
   colors (inline style) become the only color accents in the list */
.sfari-nav-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 5.5px;
  background: #e3e8f0; }
.sfari-fnpanel { flex: 1; overflow-y: auto; padding: 16px 26px 6px; }
.sfari-fnpanel-inner { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; min-height: 100%; }
/* function heading: the position and discipline over the name (SFARI's) */
.sfari-fn-head { margin: 2px 0 12px; }
.sfari-fn-eyebrow { font-family: var(--font-head); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: #8a93a3; margin-bottom: 3px; }
.sfari-fn-name { font-family: var(--font-head); color: var(--eci-title); font-size: 1.5rem;
  font-weight: 700; line-height: 1.25; margin: 0; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; }
/* numbered section headers: 1 Metrics / 2 Function score */
.sfari-step-num { flex: none; width: 21px; height: 21px; border-radius: 50%; background: #33415c;
  color: #fff; font-family: var(--font-head); font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
/* one card holds the section header and every metric row (divider lines between rows) */
.sfari-ev-card { background: #fff; border: 1px solid var(--card-border); border-radius: 10px;
  margin-bottom: 14px; overflow: hidden; }
.sfari-sec-lbl { font-family: var(--font-head); font-size: 14.5px; font-weight: 700;
  color: var(--eci-title); margin: 0; padding: 12px 16px 11px;
  display: flex; align-items: center; gap: 9px; }
.sfari-sec-count { font-size: 12.5px; font-weight: 600; color: #98a1b1; margin-left: auto; }
/* the metric rows themselves are the shared staf/metric-rows.css (EASI, SFARI and DEEP) */
/* the function statement on the score card, as EASI and SFARI show it */
.sfari-fn-statement { font-size: 15.5px; color: #3d4a63; margin: 0 0 10px; line-height: 1.55; }
.sfari-nav-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.sfari-btn { border: 1px solid var(--card-border); background: #fff; border-radius: 7px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; color: #33415c; cursor: pointer; }
.sfari-btn:hover { border-color: var(--easi-accent); color: var(--easi-accent); }
.sfari-btn.primary { background: var(--easi-accent); color: #fff; border-color: var(--easi-accent); }
.sfari-btn.primary:hover { background: var(--easi-accent-dark); color: #fff; }
.sfari-btn[disabled] { opacity: .5; cursor: default; }
/* left-rail stepper (SFARI's): each step sized to its label */
.sfari-nav .easi-pane-head { border-radius: 0; }
.sfari-nav-steps { padding: 10px 14px 0; }
.sfari-nav-steps .easi-steps { margin-bottom: 4px; }
.sfari-nav-steps .easi-step { flex: 1 1 auto; white-space: nowrap; padding: 5px 4px 6px; }
/* Get Forms: the one assessment-wide action, labeled, under the stepper. Two classes:
   .sfari-btn above would otherwise win on color and border. */
.sfari-btn.sfari-nav-desktop { display: block; width: calc(100% - 28px); margin: 8px 14px 6px;
  padding: 8px 10px; font-size: 13.5px; font-weight: 600; text-align: center;
  color: var(--easi-accent); border-color: #b9c8e0; }
.sfari-btn.sfari-nav-desktop:hover { border-color: var(--easi-accent); background: #eef2f8; }
/* sticky navigation footer — always reachable without scrolling the metrics */
.sfari-fn-footer { position: sticky; bottom: 0; z-index: 5; margin-top: auto;
  background: var(--surface-soft); padding: 9px 0 10px;
  box-shadow: 0 -10px 14px -10px rgba(20, 40, 80, .16); }
.sfari-fn-footer .sfari-nav-actions { margin-top: 0; justify-content: space-between; align-items: center; }
.sfari-foot-left { display: flex; gap: 8px; }
.sfari-foot-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #98a1b1; }
.sfari-foot-rated { color: #55607a; font-weight: 600; }
/* rollup rail */
.sfari-rollup { width: 302px; flex: none; background: #fff; border-left: 1px solid var(--card-border);
  overflow-y: auto; padding: 15px 17px; }
.sfari-rollup h4 { font-family: var(--font-head); color: var(--eci-title); font-size: 13px; margin: 0 0 6px; }
.sfari-eci-box { text-align: center; background: var(--surface-soft); border: 1px solid var(--card-border);
  border-radius: 8px; padding: 10px; margin-bottom: 14px; }
.sfari-eci { font-family: var(--font-head); font-size: 2.1rem; font-weight: 700; color: var(--eci-title); line-height: 1; }
.sfari-eci-lbl { font-size: 10.5px; color: #8a93a3; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.sfari-cat-chips { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.sfari-cat-chip { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px;
  font-weight: 600; padding: 4px 9px; border-radius: 7px; background: var(--surface-soft); }
.sfari-cat-chip .lab { color: #45506a; font-weight: 600; }
.sfari-cat-chip .val { padding: 1px 8px; border-radius: 9px; font-size: 10.5px; }
.sfari-progress { font-size: 11.5px; color: #8a93a3; margin-top: 12px; text-align: center; }
/* framework coverage, a different denominator from the progress line above it:
   that one counts data entry, this one counts the 20 STAF functions */
.sfari-coverage-note { font-size: 11px; color: #8a93a3; margin-top: 3px; text-align: center; font-style: italic; }
/* the results column's call to action; turns primary once every function is scored */
.sfari-rollup-report { display: block; width: 100%; margin-top: 12px; text-align: center; }

/* --------------------------------------------------------------------------- */
/* Polish pass: responsive, photos, progress, sticky report headers            */
/* --------------------------------------------------------------------------- */

/* the header's actions (New, Open, Save, About, Help) are styled in staf/staf.css, the same in every tool */

/* per-metric site photos */
.sfari-photos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sfari-thumb-wrap { position: relative; width: 54px; height: 54px; border-radius: 5px;
  overflow: hidden; border: 1px solid var(--card-border); background: #f2f4f8; }
.sfari-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.sfari-photo-rm { position: absolute; top: 1px; right: 1px; width: 16px; height: 16px;
  line-height: 13px; text-align: center; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(20,30,50,.72); color: #fff; font-size: 12px; padding: 0; }
.sfari-photo-rm:hover { background: #b23b3b; }
.sfari-photo-btn { display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--easi-accent); border: 1px dashed #b9c6da;
  border-radius: 6px; padding: 5px 10px; background: #fff; }
.sfari-photo-btn:hover { background: #eef2f8; border-color: var(--easi-accent); }
.sfari-photo-btn input { display: none; }

/* progress + empty / loading states */
.sfari-progress-bar { height: 6px; background: #edeef2; border-radius: 3px; overflow: hidden; margin: 10px 0 3px; }
.sfari-progress-bar > span { display: block; height: 100%; background: var(--easi-accent); border-radius: 3px; transition: width .25s; }
.sfari-nav-empty { font-size: 11px; color: #8a93a3; padding: 9px 14px; font-style: italic; line-height: 1.4; }

/* report modal: sticky header while scrolling the metric table; per-metric photo thumbs */
#deep-report .easi-tbl thead th { position: sticky; top: 0; z-index: 3; }
#deep-report .sfari-report-photos { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
#deep-report .sfari-report-photos img { width: 46px; height: 46px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--card-border); }
.sfari-minimap { border: 1px solid var(--card-border); border-radius: 6px; background: #fbfcfe; }

/* --- Responsive: tablet / narrow windows --- */
@media (max-width: 1024px) {
  /* the same narrower rail in EASI, SFARI and DEEP */
  .sfari-nav { width: 240px; }
  .sfari-rollup { width: 264px; padding: 13px 14px; }
  .sfari-fnpanel { padding: 14px 16px 26px; }
  .easi-leftpane { width: 322px; }
  .easi-shell { --staf-pane-width: 322px; }   /* the same width, for the zoom cue (staf/staf.css) */
}
@media (max-width: 820px) {
  .sfari-worksheet { flex-direction: column; }
  .sfari-nav { width: 100%; max-height: 210px; order: 1; overflow-y: auto;
    display: flex; flex-wrap: wrap; align-content: flex-start;
    border-right: none; border-bottom: 1px solid var(--card-border); padding: 4px 6px 8px; }
  .sfari-nav-cat { width: 100%; padding: 7px 8px 1px; }
  .sfari-nav-fn { flex: 0 0 auto; border-left: none; border: 1px solid transparent;
    border-radius: 6px; margin: 2px 3px; padding: 4px 9px; }
  .sfari-nav-fn.active { border-color: var(--easi-accent); background: #eaf0f9; }
  .sfari-fnpanel { order: 2; }
  .sfari-fnpanel-inner { max-width: 100%; }
  .sfari-rollup { width: 100%; order: 3; max-height: 230px; border-left: none;
    border-top: 1px solid var(--card-border); }
  .sfari-btn.sfari-nav-desktop { flex: 1 1 100%; width: auto; margin: 4px 3px 2px; }
  .sfari-nav .easi-pane-head, .sfari-nav-steps,
  .sfari-nav > .shiny-html-output { flex: 1 1 100%; }         /* header + stepper span the strip */
  /* Keep the map controls exposed above the scrollable Identify/Basin pane. */
  .easi-shell { --map-pane-height: min(40vh, 360px); }
  .easi-leftpane {
    top: auto; bottom: 8px; left: 8px; right: 8px; width: auto;
    max-width: calc(100vw - 16px); max-height: var(--map-pane-height);
  }
  .easi-map-wrap { bottom: calc(var(--map-pane-height) + 16px); }
  .easi-readout { bottom: calc(var(--map-pane-height) + 28px); }
  .easi-flow-loading { bottom: calc(var(--map-pane-height) + 30px); }
  .easi-header .easi-nav { gap: 10px 12px; flex-wrap: wrap; }
}

/* Get Forms dialog (SFARI's rules, 2026-09-19): a static tab strip with the
   downloads (styled in staf/staf.css, the same in every tool), the metrics table scrolling in its own box under a header that
   stays put, and the generated worksheet previewed inline. The modal body is a column so the scroll box
   and the preview take the height the dialog has. */
.modal-dialog.modal-xl:has(.ff-modal-body) .modal-content { height: 100%; }
.modal-xl .modal-body.ff-modal-body { display: flex; flex-direction: column; gap: 8px;
  flex: 1; min-height: 0; overflow: hidden; }
.ff-modal-body .nav-pills { flex: none; align-items: center; gap: 4px; }
.ff-modal-body .nav-pills .nav-link { font-size: 12.5px; padding: 4px 12px; }
.ff-modal-body .nav-pills .bslib-nav-spacer { flex: 1; }
.ff-modal-body .tab-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ff-modal-body .tab-content > .tab-pane.active { flex: 1; min-height: 0; display: flex;
  flex-direction: column; gap: 8px; }
.ff-site { font-size: 12.5px; color: #45506a; }
.ff-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: #2f3a52; }
.ff-table-wrap { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--card-border);
  border-radius: 6px; background: #fff; }
.ff-table-wrap .ff-table { border-collapse: separate; border-spacing: 0; }
.ff-table-wrap .ff-table thead th { position: sticky; top: 0; z-index: 3; background: #f4f6fa;
  border-bottom: none; box-shadow: inset 0 -1px 0 #d7dce5; }
.ff-badge { display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.ff-src-sub { display: block; font-size: 10.5px; color: #66708a; }
.ff-preview { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.ff-preview-frame { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--card-border);
  border-radius: 6px; background: #fff; }

/* Stream legend (www/legend-dock.js docks #easi-legend-panel under the top-right
   layers button; the absolute position is the fallback when docking fails). The
   card look lives on the rendered .easi-legend, so an empty output shows nothing.
   EASI's rules (2026-09-07). */
.easi-legend-panel { position: absolute; top: 62px; right: 12px; z-index: 1100; }
.easi-legend-panel.leaflet-control {
  position: relative; top: auto; right: auto; z-index: auto; margin: 10px 10px 0 0;
}
/* The top-right corner as a column, so the legend keeps its place below the
   layers button even after ipyleaflet re-appends that control on a layer change
   (floats are ignored on flex items; the margins still space the controls). */
.easi-map-wrap .leaflet-top.leaflet-right {
  display: flex; flex-direction: column; align-items: flex-end;
}
.easi-map-wrap .leaflet-top.leaflet-right .leaflet-control { float: none; }
.easi-map-wrap .leaflet-top.leaflet-right .leaflet-control-layers { order: 1; }
.easi-map-wrap .leaflet-top.leaflet-right .easi-legend-panel { order: 2; }
.easi-legend-panel > .shiny-html-output.recalculating { min-height: 0 !important; opacity: 1 !important; }
.easi-legend-panel > .shiny-html-output.recalculating::after { display: none !important; }
.easi-legend {
  display: flex; flex-direction: column; gap: 4px; max-width: 250px;
  background: rgba(255, 255, 255, .94); border: 1px solid var(--card-border);
  border-radius: 6px; padding: 6px 9px 7px; font-size: 11px; color: #33415c;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .15);
}
.easi-legend-title { font-weight: 700; font-size: 11px; color: var(--easi-accent);
  text-transform: uppercase; letter-spacing: .03em; }
.easi-legend-row { display: flex; align-items: center; gap: 7px; line-height: 1.25; }
.easi-legend-sw { width: 18px; height: 3px; border-radius: 2px; flex: none;
  background: var(--swatch-color); }
.easi-legend-sw-dashed { height: 2px; border-radius: 0;
  background: repeating-linear-gradient(to right, var(--swatch-color) 0 6px, transparent 6px 10px); }
.staf-coverage-control { margin-top: 5px; padding-top: 5px; border-top: 1px solid #ddd; }
.staf-coverage-toggle { margin: 0 4px 0 0; vertical-align: middle; }
.staf-coverage-toggle:focus-visible { outline: 2px solid #1f6feb; outline-offset: 2px; }
.easi-legend-sw-glow { height: 9px; opacity: .3; }
.easi-legend-sw-fill { width: 12px; height: 12px; border-radius: 2px; opacity: .6;
  border: 1px solid #caa700; }
.easi-legend-label { font-weight: 600; }
.easi-legend-sub, .easi-legend-note { color: #6b7480; }
/* The stream service did not answer: a short notice and the Try again button. */
.easi-legend-alert { display: flex; align-items: flex-start; gap: 8px; max-width: 220px; }
.btn.easi-legend-retry { flex: none; display: inline-flex; align-items: center;
  justify-content: center; width: 24px; height: 24px; padding: 0; line-height: 1;
  border-radius: 5px; color: var(--easi-accent); background: #fff;
  border: 1px solid var(--card-border); }
.btn.easi-legend-retry:hover { color: #fff; background: var(--easi-accent);
  border-color: var(--easi-accent); }
.btn.easi-legend-retry:focus-visible { outline: 2px solid #1f6feb; outline-offset: 2px; }
.easi-legend-retry svg { display: block; }
