/* Funding visualizations (ported from the classic grants page; VD-7b puts each one in an Atlas chart card).
 * Cards, stat tiles and the Chart/Table control come from design/components.css. The SVG text keeps the
 * Framework theme variables. Rules are scoped to .fv-root. The Sankey box and the table boxes scroll
 * horizontally on their own, so the page never scrolls sideways at 375 px. */
.fv-root { margin: 0; min-width: 0; max-width: 100%; }
.fv-root [hidden] { display: none !important; }
.fv-root .atlas-chart__head h2 { font: 650 var(--atlas-type-subsection-size) / 1.25 var(--atlas-font-display); }
.fv-root .atlas-callout { margin: var(--atlas-space-3) 0; }
.fv-root .atlas-callout p { margin: 0; }
.fv-intro, .fv-note { margin: 0.35rem 0 0; color: var(--atlas-muted); font-size: 0.9rem; }
.fv-note { margin-top: 0.5rem; }
.fv-muted { color: var(--atlas-muted); }
.fv-empty { margin: 0.5rem 0; padding: 1rem; border: 1px dashed var(--atlas-boundary); border-radius: var(--atlas-radius-control); color: var(--atlas-muted); text-align: center; }
.fv-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fv-root :focus-visible { outline: 3px solid var(--theme-foreground-focus); outline-offset: 2px; }

.fv-tiles { min-width: 0; }
.fv-tiles .atlas-kpis { margin-top: var(--atlas-space-4); }

.fv-sankey-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--atlas-line); border-radius: var(--atlas-radius-control); background: var(--atlas-surface); }
.fv-sankey-svg { display: block; }
.fv-col-head { font-size: 11px; font-weight: 700; fill: var(--theme-foreground-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.fv-label { font-size: 12px; fill: var(--theme-foreground); paint-order: stroke; stroke: var(--theme-background); stroke-width: 3px; stroke-linejoin: round; }
.fv-link { fill: none; opacity: 0.38; }
.fv-sankey-svg .fv-link:hover { opacity: 0.75; }
.fv-node rect { stroke: none; }
.fv-node:hover rect { stroke: var(--theme-foreground); stroke-width: 2; }
.fv-node { cursor: pointer; }
.fv-root .fv-node:focus { outline: none; }
.fv-node:focus-visible rect, .fv-node.is-focus rect { stroke: var(--theme-foreground); stroke-width: 3; }
.fv-focus-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.fv-focus-bar:has(.fv-focus-clear:not([hidden])) { margin-block: 0.5rem; }
.fv-focus-text { margin: 0; }
.fv-focus-clear, .fv-heat-clear { min-height: 40px; padding: 0 0.9rem; border: 1px solid var(--atlas-boundary); border-radius: var(--atlas-radius-control); background: var(--atlas-surface); color: var(--atlas-brand-strong); font: inherit; cursor: pointer; }

/* Heatmap selection: "N cells selected · Clear" above each heatmap. */
.fv-heat-selection { margin: 0.5rem 0 0; font-size: 0.9rem; }
.fv-heat-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; margin: 0; color: var(--atlas-muted); }
.fv-heat-status .fv-heat-count { font-weight: 650; color: var(--atlas-ink); }

.fv-root .fv-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; align-items: center; margin: 0.6rem 0; font-size: 0.9rem; }
.fv-fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; min-width: 0; }
.fv-fieldset legend { padding: 0; font-size: 0.85rem; font-weight: 700; color: var(--atlas-muted); }
.fv-fieldset label, .fv-controls > label { display: inline-flex; gap: 0.4rem; align-items: center; min-height: 2.4rem; }
.fv-topn input[type="range"] { width: 8rem; height: 24px; min-height: 24px; margin: 0; }
.fv-controls input[type="radio"], .fv-controls input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0; }

.fv-scroll { overflow-x: auto; max-width: 100%; }
.fv-root table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.fv-root th, .fv-root td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--atlas-line); text-align: left; vertical-align: top; }
.fv-root th { font-weight: 700; color: var(--atlas-muted); }
.fv-root td.num, .fv-root th.num { text-align: right; font-variant-numeric: tabular-nums; }

.fv-legend { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; margin: 0.5rem 0; padding: 0; list-style: none; font-size: 0.85rem; }
.fv-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.fv-legend i { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: var(--atlas-radius-control); }
.fv-year-svg { display: block; }
.fv-year-svg text { font-size: 11px; fill: var(--theme-foreground-muted); }

.fv-orgs-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.fv-orgs-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; font-size: 0.9rem; }
.fv-org-name { flex: 1 1 12rem; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.fv-bar { flex: 1 1 8rem; min-width: 4rem; height: 10px; background: var(--atlas-sunken); border-radius: var(--atlas-radius-control); }
.fv-bar span { display: block; height: 100%; background: var(--atlas-brand); border-radius: var(--atlas-radius-control); }
.fv-count { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.fv-matrix { min-width: max-content; width: auto; }
.fv-matrix th, .fv-matrix td { padding: 2px 4px; border: 0; }
.fv-matrix thead th { font-size: 0.75rem; vertical-align: bottom; }
.fv-matrix tbody th { font-size: 0.8rem; white-space: nowrap; padding-right: 0.6rem; }
/* A chart cell fills its table cell. A selected cell gets a 2 px ink outline and a gold inset (the money plane),
 * so the selection reads without colour; the check mark is text. Focus keeps the page focus ring. */
.fv-matrix .fv-cell { display: block; box-sizing: border-box; width: 100%; min-width: 2.6rem; min-height: 2.1rem; margin: 0; padding: 0 0.2rem; border: 0; border-radius: var(--atlas-radius-control); font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; cursor: pointer; }
.fv-root .fv-cell[aria-pressed="true"] { outline: 2px solid var(--atlas-ink); outline-offset: -2px; box-shadow: inset 0 0 0 4px var(--atlas-task-money); }
.fv-root .fv-cell:not(:disabled):not([aria-pressed="true"]):hover { outline: 1px solid var(--atlas-ink); outline-offset: -1px; }
.fv-root .fv-cell:disabled { cursor: default; }
.fv-check { margin-right: 0.1em; }
@media (prefers-reduced-motion: no-preference) {
  .fv-root .fv-cell { transition: box-shadow 0.12s ease-out, outline-color 0.12s ease-out; }
}
.fv-matrix td.num { min-width: 2.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.fv-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; }

/* The Sankey table: names get room on one line where the width allows, and wrap once when they do not. The
 * table scrolls inside its box below its minimum width. */
.fv-sankey-table { min-width: 36rem; }
.fv-sankey-table td.fv-name { min-width: 14rem; }
.fv-sankey-table td.num { white-space: nowrap; }
