/* Budget choices tool. Builds on global.css tokens. Decision colours follow the brand agreement
   scale: Deep Teal = current, sage = saves money, copper = costs more. */

:root {
  /* One type scale for the whole app (Beausite; 12px floor, brand guidelines). xs: labels, legends,
     sub-figures. sm: rows, tables, controls. md: reading text, nav, banners. lg: section titles and
     deltas. xl: page titles and key figures. 2xl: the overview's headline figure. */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 24px; --fs-2xl: 30px;
  /* One edge for every page: 24px, 40px from the 1100px desktop breakpoint. */
  --layout-gutter: 24px;
  /* The department drawer overlays the page, so the page only clears its tab on the left edge. */
  --dept-drawer-w: 340px;
  --dept-handle-w: 44px;
  --dept-tab-h: 44px;
  --page-inset-left: max(var(--layout-gutter), calc(var(--dept-handle-w) + 12px));
  /* Motion extras from the MRP: open on a long soft settle, close quick and plain. */
  --pf-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --pf-ease-in-quick: cubic-bezier(0.4, 0, 1, 1);
  /* Legacy names, aliased onto the PF Global tokens (pf-tokens.css) so the palette swaps here in
     one place. Components move onto --pf-color-* directly in the component pass, and these go.
     Save, cost and the bubbles palette keep their values until the data-colour pass. */
  --brand-indigo: var(--pf-color-text-primary);
  --indigo-soft: var(--pf-color-surface-warm);
  --indigo-border: var(--pf-teal-20);
  --c-anchor: var(--brand-indigo);   /* current position */
  --c-anchor-bg: var(--pf-color-surface-warm);
  --c-anchor-border: var(--indigo-border);
  --c-save: var(--pf-dataviz-agreement-strongly-agree);          /* saves money: Sage */
  --c-save-bg: rgb(153 185 168 / 0.3);                             /* Light sage at 30% */
  --c-save-border: var(--pf-green-light-sage);
  --c-cost: var(--pf-dataviz-agreement-strongly-disagree);       /* costs more: Copper */
  --c-cost-bg: var(--pf-copper-20);
  --c-cost-border: var(--pf-copper-40);
  --c-none: var(--pf-teal-80);                                     /* unchanged / neutral: Teal 80 reads at 12px */
  --line-rule: var(--pf-color-border-soft);
  --line-alt: var(--pf-color-surface-hover);
  --line-muted: var(--pf-color-text-secondary);
  --line-ink: var(--pf-color-text-primary);
  /* Corners: 3px on rectangular controls, 2px on a piece nested in one; panels stay square. */
  --pf-control-radius: 3px;
  --pf-control-radius-inner: 2px;
  /* Brand cross (MRP components.css: the 918-unit cross with an open centre), drawn as a CSS mask
     where a column edge meets a rule. 11px; desktop only. */
  --pf-cross: 11px;
  --pf-icon-grid-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 918 918'%3E%3Cpath d='M368 0h182v368H368zM368 550h182v368H368zM0 368h368v182H0zM550 368h368v182H550z'/%3E%3C/svg%3E");
  --card-w: min(620px, max(460px, 42vw), calc(100vw - 32px));
}
.bubbles__body::before,
.budget-drawer::before,
.dept-drawer__head::after {
  content: ""; display: none; pointer-events: none; z-index: 6;
  background-color: var(--pf-color-icon-primary);
  mask-image: var(--pf-icon-grid-cross), var(--pf-icon-grid-cross);
  mask-size: var(--pf-cross) var(--pf-cross);
  mask-repeat: no-repeat;
}
@media (min-width: 1100px) {
  .bubbles__body::before,
  .budget-drawer::before,
  .dept-drawer[data-state="open"] .dept-drawer__head::after { display: block; }
}
/* Department drawer: where its right edge meets the rule under its head. */
.dept-drawer__head::after {
  position: absolute; right: calc(var(--pf-cross) / -2 - 0.5px); bottom: calc(var(--pf-cross) / -2 + 0.5px);
  width: var(--pf-cross); height: var(--pf-cross); mask-position: center;
}
/* Results column: where its left edge meets the rule over the chart. */
.bubbles__body::before {
  grid-area: 1 / 2; align-self: start; justify-self: start;
  width: var(--pf-cross); height: var(--pf-cross);
  margin: calc(var(--pf-cross) / -2 - 0.5px) 0 0 calc(var(--pf-cross) / -2 + 0.5px);
  mask-position: center;
}
.bubbles.has-card .bubbles__body::before { display: none; }
.bubbles__body::after {
  content: ""; display: none; pointer-events: none; z-index: 6;
  grid-area: 1 / 2; align-self: end; justify-self: start;
  width: var(--pf-cross); height: var(--pf-cross);
  margin: 0 0 calc(var(--pf-cross) / -2 - 0.5px) calc(var(--pf-cross) / -2 + 0.5px);
  background-color: var(--pf-color-icon-primary);
  mask: var(--pf-icon-grid-cross) center / var(--pf-cross) var(--pf-cross) no-repeat;
}
@media (min-width: 1100px) { .bubbles__body:has(.bubbles__side)::after { display: block; } }
.bubbles.has-card .bubbles__body::after { display: none; }
/* Card drawer: where its edge meets the rule under its title. Fixed, so the drawer's own scrolling
   does not clip the half that lies outside it; the title stays pinned at the top. */
.budget-drawer::before {
  position: fixed; top: calc(var(--card-head-h, 0px) - var(--pf-cross) / 2 - 0.5px);
  width: var(--pf-cross); height: var(--pf-cross);
  mask-position: center;
}
.budget-drawer[data-side="right"]::before { right: calc(var(--card-w) - var(--pf-cross) / 2 - 0.5px); }
.budget-drawer[data-side="left"]::before { left: calc(var(--card-w) - var(--pf-cross) / 2 - 0.5px); }

/* A short page still fills the window. */
.dashboard { display: flex; flex-direction: column; min-height: 100vh; }
.dashboard-body { flex: 1 0 auto; }

/* ---- Department drawer ---------------------------------------------------- */
/* Collapsed to a tab on the left edge, vertically centred. Open, the drawer slides over the page
   (nothing moves aside) and the tab rides out on its right edge, still jutting past it. */
.dept-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 91;
  width: var(--dept-drawer-w);
  transform: translateX(-100%);
  transition: transform calc(var(--pf-duration-fast) * 1.33) var(--pf-ease-in-quick);
}
.dept-drawer[data-state="open"] {
  transform: none;
  transition: transform calc(var(--pf-duration-base) * 2) var(--pf-ease-out-expo);
}
.dept-drawer__panel {
  display: flex; flex-direction: column; height: 100%;
  background: var(--pf-color-surface-default);
  border-right: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
}
.dept-drawer__scrim {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in srgb, var(--pf-color-surface-inverse) 18%, transparent);
  opacity: 0; pointer-events: none;
  transition: opacity var(--pf-duration-base) var(--pf-easing-standard);
}
.dept-drawer__scrim.is-open { opacity: 1; pointer-events: auto; }

.dept-drawer__handle {
  position: absolute; top: 50%; left: 100%;
  display: flex; flex-direction: column; align-items: center; gap: var(--pf-space-100);
  width: var(--dept-handle-w); padding: var(--pf-space-200) 0;
  transform: translateY(-50%);
  border: 0; border-radius: 0 var(--pf-control-radius) var(--pf-control-radius) 0;
  background: var(--pf-color-action-primary-default); color: var(--pf-color-action-primary-text);
  font: inherit; font-size: var(--fs-md); font-weight: var(--pf-font-weight-semibold);
  line-height: 1; cursor: pointer;
  transition: background var(--pf-duration-fast) var(--pf-easing-standard);
}
/* A card drawer docked on the left would sit under the tab, so the tab steps aside until it closes. */
:root:has(.budget-drawer[data-side="left"]:not([hidden])) .dept-drawer__handle { visibility: hidden; }
.dept-drawer__chevron {
  width: 16px; height: 16px; flex: none;
  transition: transform var(--pf-duration-base) var(--pf-easing-standard);
}
.dept-drawer__handle[aria-expanded="true"] .dept-drawer__chevron { transform: rotate(180deg); }
/* Read bottom to top, as a spine label does. */
.dept-drawer__handle-label { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
/* The tab's lead: the orange square of the scroll indicators, so it reads as the way in. */
.dept-drawer__handle::before { content: ""; width: 8px; height: 8px; background: var(--pf-orange-insight); flex: none; }
.dept-drawer__handle:hover { background: var(--pf-teal-80); }
/* The home page's way into the departments, and into one from its drill-down. */
.overview-page__explore {
  margin-top: var(--pf-space-200); padding: 10px 16px; border: 0; border-radius: var(--pf-control-radius);
  background: var(--pf-color-action-primary-default); color: var(--pf-color-action-primary-text);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--pf-font-weight-semibold); cursor: pointer;
}
.overview-page__explore:hover { background: var(--pf-teal-80); }
.overview-page__actions { display: flex; flex-wrap: wrap; gap: var(--pf-space-100); margin-top: var(--pf-space-200); }
.overview-page__actions .overview-page__explore { margin-top: 0; }
/* Second button: unfilled, navy outline. */
.overview-page__explore--secondary {
  background: transparent; color: var(--pf-color-action-primary-default);
  box-shadow: inset 0 0 0 1px var(--pf-color-action-primary-default);
}
.overview-page__explore--secondary:hover { background: var(--pf-color-surface-mist); }

.dept-drawer__head {
  position: relative; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--pf-inline-sm);
  padding: var(--pf-inset-lg) var(--pf-inset-md) var(--pf-inset-md) var(--pf-inset-lg);
  border-bottom: var(--pf-border-width-rule) solid var(--line-rule);
}
.dept-drawer__title {
  display: flex; align-items: center; gap: var(--pf-space-150); margin: 0;
  font-size: var(--fs-md); font-weight: var(--pf-font-weight-semibold); color: var(--pf-color-text-primary);
}
.dept-drawer__mark { width: auto; height: 32px; }

/* A flat list of ruled rows (PF website menu pattern): a soft rule under each, a solid one under the
   department on screen. pfscroll.js draws the scroll position. */
.dept-tabs-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.dept-tabs {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: 16px;   /* the scroll square's own column (pfscroll.js lays its 16px track here) */
}
.dept-tabs__btn {
  flex: 0 0 auto; position: relative;
  display: flex; align-items: center;
  width: 100%; min-height: var(--dept-tab-h); padding: var(--pf-space-150) var(--pf-inset-lg);
  border: 0; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
  background: transparent; color: var(--pf-color-text-secondary);
  font: inherit; font-size: var(--fs-md); font-weight: var(--pf-font-weight-clear);
  line-height: 1.15; text-align: left; cursor: pointer;
  transition: color var(--pf-duration-fast) var(--pf-easing-standard), background var(--pf-duration-fast) var(--pf-easing-standard);
}
.dept-tabs__btn:hover { color: var(--pf-color-text-primary); background: var(--pf-color-surface-warm); }
.dept-tabs__btn.is-active {
  color: var(--pf-color-text-primary); font-weight: var(--pf-font-weight-semibold);
  border-bottom-color: var(--pf-color-border-rule);
}
/* Sections (core, departments, other spending): a small label over a solid rule. Core choices is a
   section of one row, unlabelled, and reads a step stronger than the rows below it. */
.dept-tabs__section { display: flex; flex-direction: column; flex: none; }
.dept-tabs__heading {
  margin: 0; padding: var(--pf-space-400) var(--pf-inset-lg) var(--pf-space-150);
  border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  color: var(--pf-color-text-primary);
  font-size: var(--fs-md); font-weight: var(--pf-font-weight-semibold); line-height: 1.2;
}
/* Core choices: set apart by weight and the solid rule under it, the page that gathers every
   department's biggest decisions. */
.dept-tabs__section--home .dept-tabs__btn,
.dept-tabs__section--core .dept-tabs__btn {
  color: var(--pf-color-text-primary); font-weight: var(--pf-font-weight-semibold);
  border-bottom-color: var(--pf-color-border-rule);
}
/* A draft department (no decisions yet) shows muted. */
.dept-tabs__btn--draft { color: var(--pf-color-text-secondary); font-style: italic; }
/* PF scroll indicator (pfscroll.js) on every scroll area and the page: a hairline track with a small
   Insight Orange square that turns a quarter per screen scrolled. The script sets the thumb's
   transform on every scroll event, so it has no transition; only the square inside it eases, for the
   hover grow. The wide box is the hit area; the native scrollbar is hidden. */
.pf-scroll-host, .pf-scroll-page { scrollbar-width: none; }
.pf-scroll-host::-webkit-scrollbar, .pf-scroll-page::-webkit-scrollbar { display: none; }
.pf-scroll {
  position: absolute; width: 16px; cursor: pointer; touch-action: none;
}
.pf-scroll[hidden] { display: none; }
/* The square runs down the panel's right padding, so the figures keep clear of it. */
.changes__panel.pf-scroll-host { padding-right: 26px; }
.pf-scroll--page { position: fixed; top: 0; bottom: 0; right: 0; z-index: 60; }
.pf-scroll::before {
  content: ""; position: absolute; top: var(--pf-space-150); bottom: var(--pf-space-150); left: 50%; width: 1px;
  background: var(--pf-color-border-soft);
}
.pf-scroll__thumb {
  position: absolute; top: var(--pf-space-150); left: 4px; width: 8px; height: 8px;
  cursor: grab; will-change: transform;
}
.pf-scroll__square {
  display: block; width: 100%; height: 100%; background: var(--pf-orange-insight);
  transition: transform 0.18s var(--pf-ease-out-expo);
}
.pf-scroll:hover .pf-scroll__square, .pf-scroll.is-dragging .pf-scroll__square { transform: scale(1.3); }
.pf-scroll.is-dragging .pf-scroll__thumb { cursor: grabbing; }
.dept-tabs__short { display: none; }
.dept-tabs__full {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}

.topbar-info { position: static; flex: none; }
.topbar-info__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border: 1px solid var(--pf-color-border-rule); border-radius: 999px;
  background: transparent; color: var(--pf-color-text-primary); font: inherit; font-size: var(--fs-xs);
  font-weight: var(--pf-font-weight-semibold); line-height: 1; cursor: pointer;
  transition: background var(--pf-duration-fast) var(--pf-easing-standard), color var(--pf-duration-fast) var(--pf-easing-standard);
}
.topbar-info__btn:hover,
.topbar-info__btn[aria-expanded="true"] {
  background: var(--pf-color-action-primary-default); color: var(--pf-color-action-primary-text);
}
/* Drops below the drawer head, across the drawer, over the top of the list. */
.topbar-info__panel {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 3;
  padding: var(--pf-inset-md) var(--pf-inset-lg);
  border-bottom: var(--pf-border-width-rule) solid var(--line-rule);
  background: var(--pf-color-surface-default);
}
.topbar-info__panel[hidden] { display: none; }
.topbar-info__panel p {
  margin: 0; font-size: var(--fs-sm); line-height: 1.55; color: var(--pf-color-text-primary);
}

@media (prefers-reduced-motion: reduce) {
  .pf-scroll__square { transition: none; }
}

/* Phones: the drawer leaves a strip of page showing for the tab, which shrinks to its chevron. */
@media (max-width: 699px) {
  :root { --dept-handle-w: 24px; }
  .dept-drawer { width: calc(100vw - var(--dept-handle-w) - 12px); }
  .dept-drawer__handle { padding: var(--pf-space-200) 0; }
  .dept-drawer__handle-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ---- Body --------------------------------------------------------------- */
.dashboard-body {
  max-width: none; margin: 0;
  /* The bottom padding lets the last cards clear the footer. */
  padding: 7px var(--layout-gutter) var(--pf-space-500) var(--page-inset-left);
}


.simulator-root { display: flex; flex-direction: column; gap: 18px; }
.load-status, .load-error { color: var(--text-muted); padding: 20px 0; }
/* PF cross loader (MRP components.css:2072-2139): the arms breathe on a sine while the cross turns
   a quarter, 1.8s loop. Arms are sized in the 918-unit grid of the brand cross. */
.pf-loader {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: var(--pf-space-1200, 96px) 0;
  color: var(--pf-color-text-secondary);
  font-size: var(--fs-md); line-height: var(--pf-type-small-line-height);
}
.pf-loader__mark { position: relative; display: block; flex: none; width: 38.4px; height: 38.4px; color: var(--pf-color-icon-primary); }
.pf-loader__spin, .pf-loader__axis { position: absolute; inset: 0; }
.pf-loader__spin { animation: pf-loader-turn 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.pf-loader__axis { transform: rotate(var(--pf-loader-angle)); }
.pf-loader__arm {
  position: absolute; top: 0; left: 40.087%; width: 19.826%; height: 40.087%;
  background: currentColor; transform-origin: 50% 0;
  animation: pf-loader-breathe 1.8s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}
@keyframes pf-loader-turn { to { transform: rotate(90deg); } }
@keyframes pf-loader-breathe { 50% { transform: translateY(-1.902%) scaleY(0.829); } }
@media (prefers-reduced-motion: reduce) { .pf-loader__spin, .pf-loader__arm { animation: none; } }
.load-error { color: var(--pf-color-text-primary); }
.share-notice {
  position: sticky; top: 0; z-index: 50; margin: 0; padding: 10px 44px 10px 16px;
  background: var(--pf-copper-20); color: var(--pf-color-text-primary); font-size: var(--fs-sm, 14px);
}
.share-notice__close {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit;
}

/* ---- All departments overview ------------------------------------------ */
/* The overview is laid on the page grid: two ruled cells (chart | text and table) under a solid rule,
   a soft rule between them running down to the footer's rule, and a brand cross where it meets each
   (brand cross grid style 1). Stacked, a soft rule divides the cells instead and the crosses go. */
.overview-page {
  display: flex; flex-direction: column;
  padding: 0;
  min-width: 0;
}
.dashboard-body:has(.overview-page) { padding-top: 0; padding-bottom: 0; }
.overview-page__body {
  --overview-cell-pad: clamp(24px, 3vw, 44px);
  --overview-foot-h: 56px;   /* the total row and the Core choices banner: one row across the page */
  display: grid; grid-template-columns: minmax(480px, 1.1fr) minmax(400px, 0.9fr);
  align-items: stretch; gap: 0;
  height: 100vh; min-height: 560px;
  min-width: 0; position: relative;
}
/* The right cell's rules run its full width, from the vertical rule to the page edge; only the text
   inside is inset, by --side-pad. */
.overview-page__side {
  --side-pad: var(--pf-space-400); padding: var(--pf-space-500) 0 0; position: relative;
}
.overview-page__side::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 8px; width: 1px; pointer-events: none;
  background: var(--pf-color-border-soft);
}
.overview-page__side :is(.overview-page__intro, .overview-detail__head) { padding-inline: var(--side-pad); }
.overview-page__side :is(.overview-list__colhead, .overview-list__item, .overview-list__foot) { padding-inline: var(--side-pad); }
.overview-list__item:last-child { border-bottom: 0; }
/* The chart sits in the middle of its cell; the cell runs the row's full height so its rule does. */
.overview-page__chart-panel {
  position: relative; align-self: stretch;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px;
  min-width: 0; padding: var(--overview-cell-pad) var(--overview-cell-pad) 0 0;
  border-right: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
}
.overview-page__chart-panel::after {
  content: ""; display: none; position: absolute; right: calc(var(--pf-cross) / -2 - 0.5px); z-index: 7;
  width: var(--pf-cross); height: var(--pf-cross); pointer-events: none;
  background-color: var(--pf-color-icon-primary);
  mask: var(--pf-icon-grid-cross) center / var(--pf-cross) var(--pf-cross) no-repeat;
  bottom: calc(var(--pf-cross) / -2 - 0.5px);
}
@media (min-width: 1100px) {
  :root { --layout-gutter: 40px; }
  .overview-page__chart-panel::after { display: block; }
}
.overview-page__chart-slot {
  display: flex; justify-content: center; width: 100%; margin: auto 0;
}
.overview-page__side {
  display: flex; flex-direction: column; align-items: stretch; gap: var(--pf-space-300);
  min-width: 0; min-height: 0; overflow: visible; text-align: left;
}
.overview-page__detail-slot {
  display: flex; flex: 1 1 auto; width: 100%; min-height: 0; overflow: visible;
}
.overview-page__intro {
  max-width: none;
  min-width: 0;
}
.overview-page__title {
  margin: 0 0 var(--pf-space-050);
  font-size: var(--fs-xl);
  line-height: 1.08; font-weight: 600; color: var(--line-ink);
  overflow-wrap: break-word;
}
.overview-page__lede {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.45; color: var(--line-muted);
}
.overview-page__side :is(.overview-list__colhead, .overview-list__foot)::before,
.overview-page__side :is(.overview-list__colhead, .overview-list__foot)::after {
  content: ""; display: none; position: absolute; z-index: 7; pointer-events: none;
  width: var(--pf-cross); height: var(--pf-cross); background-color: var(--pf-color-icon-primary);
  mask: var(--pf-icon-grid-cross) center / var(--pf-cross) var(--pf-cross) no-repeat;
}
.overview-page__side .overview-list__colhead::before { left: calc(var(--pf-cross) / -2 - 0.5px); bottom: calc(var(--pf-cross) / -2 - 0.5px); }
.overview-page__side .overview-list__colhead::after { right: calc(var(--pf-cross) / -2 - 0.5px); bottom: calc(var(--pf-cross) / -2 - 0.5px); }
.overview-page__side .overview-list__foot::after { right: calc(var(--pf-cross) / -2 - 0.5px); top: calc(var(--pf-cross) / -2 - 0.5px); }
.overview-page__body::after {
  content: ""; display: none; position: absolute; z-index: 7; pointer-events: none;
  right: calc(8px - var(--pf-cross) / 2 - 0.5px); bottom: calc(var(--pf-cross) / -2 - 0.5px);
  width: var(--pf-cross); height: var(--pf-cross); background-color: var(--pf-color-icon-primary);
  mask: var(--pf-icon-grid-cross) center / var(--pf-cross) var(--pf-cross) no-repeat;
}
@media (min-width: 1100px) {
  .overview-page__side .overview-list__colhead::before,
  .overview-page__side .overview-list__colhead::after,
  .overview-page__side .overview-list__foot::after,
  .overview-page__body::after { display: block; }
}
/* Total Package Cost: spending beside tax on one scale, across the foot of the chart cell, level with the
   total row. */
.paying {
  align-self: stretch; box-sizing: border-box; margin-top: auto; position: relative; min-height: var(--overview-foot-h);
  margin-left: calc(-1 * var(--page-inset-left)); margin-right: calc(-1 * var(--overview-cell-pad));
  padding: var(--pf-space-200) var(--overview-cell-pad) var(--pf-space-200) var(--page-inset-left);
  border-top: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--pf-space-100) var(--pf-space-200);
  align-items: center;
}
/* Where its top rule meets the cell's vertical rule. */
.paying::after {
  content: ""; display: none; position: absolute; z-index: 7; pointer-events: none;
  top: calc(var(--pf-cross) / -2 - 0.5px); right: calc(var(--pf-cross) / -2 - 0.5px);
  width: var(--pf-cross); height: var(--pf-cross); background-color: var(--pf-color-icon-primary);
  mask: var(--pf-icon-grid-cross) center / var(--pf-cross) var(--pf-cross) no-repeat;
}
@media (min-width: 1100px) { .paying::after { display: block; } }
.paying__title { grid-column: 1 / -1; margin: 0; }
.paying__title { font-size: var(--fs-md); font-weight: var(--pf-font-weight-semibold); }
.paying__row { display: contents; }
.paying__label { font-size: var(--fs-sm); }
.paying__track { height: 12px; background: var(--pf-color-surface-mist); }
.paying__bar { display: block; height: 100%; }
.paying__bar.is-save { background: var(--c-save); }
.paying__bar.is-cost { background: var(--c-cost); }
.paying__value { font-size: var(--fs-sm); text-align: right; white-space: nowrap; }
.paying__axis { grid-column: 2; justify-self: end; font-size: var(--fs-xs); color: var(--pf-color-text-secondary); }
/* How to use the chart: an "i" at the top left of the chart cell, its note shown on hover or focus. */
.overview-page__info { position: absolute; top: var(--pf-space-300); left: 0; z-index: 4; }
.overview-page__info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border: 1px solid var(--pf-color-border-rule); border-radius: 999px;
  background: transparent; color: var(--pf-color-text-primary); font: inherit; font-size: var(--fs-xs);
  font-weight: var(--pf-font-weight-semibold); line-height: 1; cursor: help;
}
.overview-page__info-btn:hover, .overview-page__info-btn:focus-visible { background: var(--pf-color-text-primary); color: var(--pf-base-white); }
.overview-page__info-tip {
  position: absolute; top: calc(100% + 8px); left: 0; width: max-content; max-width: 260px; margin: 0;
  padding: 8px 10px; border-radius: var(--pf-control-radius); background: var(--pf-sand-sand);
  color: var(--pf-color-text-primary); font-size: var(--fs-sm); line-height: 1.4;
  opacity: 0; visibility: hidden; transition: opacity var(--pf-duration-fast) var(--pf-easing-standard);
}
.overview-page__info:hover .overview-page__info-tip,
.overview-page__info:focus-within .overview-page__info-tip { opacity: 1; visibility: visible; }
.overview-sunburst {
  position: relative; width: min(100%, 660px, calc(100vh - 140px)); aspect-ratio: 1;
}
/* On desktop the page is one screen tall: the chart takes whatever height the Total Package Cost band
   leaves, so the cell never runs into the footer. */
@media (min-width: 1100px) {
  .overview-page__chart-slot { flex: 1 1 0; min-height: 0; margin: 0; align-items: center; container-type: size; }
  .overview-sunburst { width: min(100cqw, 100cqh, 660px); }
}
.overview-sunburst__svg {
  display: block; width: 100%; height: 100%; overflow: visible;
}
.overview-sunburst__hole { fill: var(--pf-color-surface-default); }
/* Arcs are separated by light sand hairlines, as the department bars are. Hover lifts by fading to
   the surface (an alpha of the brand colour), so no off-brand tint is ever drawn. */
.overview-sunburst__arc {
  stroke: var(--pf-color-surface-default); stroke-width: 0.55; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.15s ease;
}
.overview-sunburst__arc:hover,
.overview-sunburst__arc:focus-visible {
  opacity: 0.8; outline: none;
}
.overview-sunburst__arc.is-active { stroke: var(--pf-color-text-primary); stroke-width: 1.5; }
/* A table row under the pointer: its arcs stay, the rest fade back towards the sand. */
.overview-sunburst__arc.is-dim { opacity: 0.18; }
.overview-sunburst__arc.is-lit { opacity: 1; }
.overview-sunburst.is-highlighting .overview-sunburst__label { opacity: 0.35; transition: opacity 0.15s ease; }
.overview-sunburst__label {
  pointer-events: none;
  font-size: var(--fs-xs);
  line-height: 1;
  font-family: var(--pf-font-stack);
  font-weight: 400;
  fill: var(--pf-dataviz-chart-label-on-dark);
}
.overview-sunburst__label-path {
  fill: none;
  stroke: none;
}
.overview-sunburst__label--component {
  font-size: var(--fs-xs);
}
.overview-sunburst__label--policy {
  font-size: var(--fs-xs);
}
.overview-sunburst__center {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 34%; min-width: 126px; text-align: center; pointer-events: none;
}
.overview-sunburst__center-label {
  font-size: var(--fs-xs); line-height: 1.15; color: var(--line-muted);
  overflow-wrap: anywhere;
}
.overview-sunburst__center-value {
  margin-top: 3px;
  font-size: var(--fs-2xl); line-height: 1.02; font-weight: 600;
  color: var(--line-ink); font-variant-numeric: tabular-nums;
}
.overview-sunburst.is-expanded .overview-sunburst__center-label,
.overview-sunburst.is-expanded .overview-sunburst__center-value {
  color: var(--overview-center-ink, var(--pf-dataviz-chart-label-on-dark));
}
.overview-detail {
  width: 100%;
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  flex: 1 1 auto; min-height: 0; color: var(--line-ink);
}
/* A drilled-in level: one row above the column heads, in the table's own type. Back to the level up
   on the left, where this is, and the department's page on the right. */
.overview-detail__crumbs {
  display: flex; align-items: baseline; gap: var(--pf-space-150); margin-bottom: var(--pf-space-150);
}
.overview-detail__title {
  flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: var(--pf-font-weight-semibold); line-height: 1.3;
}
.overview-detail__back, .overview-detail__goto {
  flex: none; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-xs); line-height: 1.3; color: var(--line-muted); white-space: nowrap;
}
.overview-detail__goto { font-weight: var(--pf-font-weight-semibold); color: var(--pf-color-text-primary); }
.overview-detail__back:hover, .overview-detail__goto:hover,
.overview-detail__back:focus-visible, .overview-detail__goto:focus-visible { color: var(--pf-color-text-highlight); }
.overview-list {
  display: flex; flex-direction: column; gap: 0;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 16px;   /* the scroll square's column (pfscroll.js lays its track here) */
}
.overview-page__side .overview-list__item { padding-right: calc(var(--side-pad) - 24px); margin-right: -8px; width: calc(100% + 8px); }
.overview-page__side :is(.overview-list__colhead, .overview-list__foot) { padding-right: calc(var(--side-pad) - 8px); margin-right: 8px; position: relative; }
.overview-page__side .pf-scroll::before { top: 0; bottom: 0; }
.overview-page__side .overview-list__foot { height: var(--overview-foot-h); box-sizing: border-box; padding-block: 0; }
.overview-list__item {
  display: grid; grid-template-columns: 9px minmax(0, 1fr) max-content; align-items: center; gap: 10px;
  width: 100%; min-height: 40px; padding: var(--pf-space-100) 0;
  border: 0; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
  background: transparent; color: var(--line-ink); text-align: left; cursor: pointer;
  font: inherit;
}
.overview-list__item:hover,
.overview-list__item:focus-visible,
.overview-list__item.is-active {
  background: var(--pf-color-surface-mist); border-bottom-color: var(--pf-color-border-rule);
}
.overview-list__label {
  min-width: 0; overflow-wrap: anywhere;
  font-size: var(--fs-md); line-height: 1.25; font-weight: var(--pf-font-weight-clear);
}
.overview-list__dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--overview-color);
  box-shadow: inset 0 0 0 1px var(--pf-color-border-soft);   /* holds a Stone or Light sage dot on light sand */
}
.overview-list__value {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  font-size: var(--fs-md); line-height: 1.1; font-weight: var(--pf-font-weight-medium); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.overview-list__share {
  align-self: center; justify-self: end; text-align: right;
  font-size: var(--fs-sm); font-weight: 400; color: var(--line-muted); font-variant-numeric: tabular-nums;
}
/* Totals table: an extra "your change vs baseline" column on the right. */
.overview-list--totals .overview-list__item.has-change {
  grid-template-columns: 9px minmax(0, 1fr) 76px 52px 74px;
}
.overview-list__colhead {
  display: grid; grid-template-columns: 9px minmax(0, 1fr) 76px 52px 74px; align-items: center; gap: 10px;
  /* The rule under the column heads tops the table; the list's own right padding (room for the
     scroll square) would run a rule on the list past the columns. */
  padding: 0 0 var(--pf-space-100); margin: 0; line-height: 1;
  border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
}
.overview-list__colhead-label { grid-column: 1 / 3; }
.overview-list__colhead-label,
.overview-list__colhead-value,
.overview-list__colhead-share,
.overview-list__colhead-change {
  font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0.02em; color: var(--line-muted);
}
.overview-list__colhead-value, .overview-list__colhead-share { justify-self: end; }
.overview-list__colhead-change { justify-self: end; min-width: 74px; text-align: right; }
.overview-list__change {
  align-self: center; justify-self: end; min-width: 74px; text-align: right;
  font-size: var(--fs-sm); font-weight: var(--pf-font-weight-medium); white-space: nowrap; font-variant-numeric: tabular-nums;
  color: var(--line-muted);
}
.overview-list__foot {
  flex: none;
  display: grid; grid-template-columns: 9px minmax(0, 1fr) 76px 52px 74px; align-items: center; gap: 10px;
  padding: 10px 0; border-top: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  font-variant-numeric: tabular-nums;
}
.overview-list__foot .overview-list__foot-label { grid-column: 1 / 3; }
.overview-list__foot-label {
  font-size: var(--fs-md); font-weight: var(--pf-font-weight-semibold); color: var(--line-ink);
}
.overview-list__foot .overview-list__value,
.overview-list__foot .overview-list__change { font-size: var(--fs-md); font-weight: 600; }

/* ---- Colour key --------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-muted); }
.legend__swatch { width: 12px; height: 12px; border-radius: 4px; }
.legend__item--anchor .legend__swatch { background: var(--c-anchor); }
.legend__item--save .legend__swatch { background: var(--c-save); }
.legend__item--cost .legend__swatch { background: var(--c-cost); }
.legend__item--benchmark .legend__swatch {
  width: 2px; height: 15px; border-radius: 2px; background: var(--text-primary);
}

/* ---- DfE all-in-one budget map ----------------------------------------- */
.budget-map {
  /* Deep Teal: the context colour for an ink-heavy chart. */
  --dept-bar-color: var(--pf-dataviz-emphasis-context-high-ink);
  --dept-bar-text-color: var(--pf-dataviz-chart-label-on-dark);
  position: relative;
  display: flex; flex-direction: column; gap: 0;
  margin-left: calc(-1 * var(--layout-gutter)); margin-right: calc(-1 * var(--layout-gutter));
  padding: 17px var(--layout-gutter) 0; border: 0;   /* 24px to the first line */
}
.budget-map::after {
  display: none;
  content: "";
  position: absolute;
  left: var(--layout-gutter);
  right: var(--layout-gutter);
  height: 1px;
  background: var(--line-rule);
  pointer-events: none;
  z-index: 7;
  bottom: 0;
}
/* Page head, two rows. Title row: home link over the title, the two figures, then the actions on the
   right. Toolbar: controls each labelled beside itself, the key on the right. */
.budget-map__header {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--pf-space-150); padding-bottom: var(--pf-space-150);
}
.budget-map__header > .budget-map__titlebar, .budget-map__header > .budget-map__toolbar { align-self: stretch; }
.budget-map__header > .page-home { margin-bottom: var(--pf-space-050); }
.budget-map__titlebar {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--pf-space-150) var(--pf-space-500); width: 100%;
}
.budget-map__title-left {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--pf-space-100); min-width: 0;
}
.budget-map__toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--pf-space-150) var(--pf-space-300);
}
.budget-map__key .bubbles__key { margin: 0; }
.budget-map__key .legend { gap: 6px 14px; }
.budget-map__fig { display: flex; align-items: baseline; gap: var(--pf-space-100); }
.budget-map__fig-value { display: flex; align-items: baseline; gap: var(--pf-space-150); }
.budget-map__title { margin: 0; font-size: var(--fs-xl); font-weight: 600; color: var(--line-ink); }
.budget-map__key .legend__item { font-size: var(--fs-xs); }
.budget-map__key .legend__swatch { width: 10px; height: 10px; border-radius: 3px; }
.budget-map__key .legend__item--benchmark .legend__swatch { width: 2px; height: 13px; border-radius: 2px; }
.budget-map__controls {
  display: flex; align-items: center; gap: var(--pf-space-150) var(--pf-space-300); flex-wrap: wrap;
}
.budget-map__control {
  display: flex; align-items: center; gap: var(--pf-space-100); min-width: 0;
}
.budget-map__control-label {
  font-size: var(--fs-sm); line-height: 1; font-weight: 500; color: var(--line-muted);
}
/* Segmented control (MRP .pf-segmented, square variant): a soft outline, the chosen segment in a
   Deep Teal fill with white words, 3px corners outside and 2px inside. */
.budget-map__mode,
.panel-seg {
  display: inline-grid; grid-template-columns: 1fr 1fr; align-items: center; gap: var(--pf-space-025);
  width: auto; padding: var(--pf-space-025); overflow: hidden;
  border: var(--pf-border-width-rule) solid var(--pf-color-border-soft); border-radius: var(--pf-control-radius);
  background: var(--pf-color-surface-default);
}

.budget-map__mode-btn,
.panel-seg__btn {
  border: 0; border-radius: var(--pf-control-radius-inner); padding: 6px 12px;
  background: transparent; color: var(--pf-color-text-secondary);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--pf-font-weight-medium); line-height: 1.15; white-space: nowrap;
  cursor: pointer;
  transition: background var(--pf-duration-fast) var(--pf-easing-standard), color var(--pf-duration-fast) var(--pf-easing-standard);
}
.budget-map__mode-btn:not(.is-active):hover,
.panel-seg__btn:not([aria-pressed="true"]):hover { color: var(--pf-color-text-primary); background: var(--pf-color-surface-warm); }
.budget-map__mode-btn.is-active,
.panel-seg__btn[aria-pressed="true"] { background: var(--pf-color-state-selected-surface); color: var(--pf-color-state-selected-text); }
.budget-map__titlebar .changes { margin-left: 0; white-space: nowrap; }
.budget-map__total-value {
  font-size: var(--fs-xl); line-height: 1.05; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--line-ink);
}
.budget-map__total-delta {
  min-height: 1.2em; font-size: var(--fs-xs); font-weight: 600; color: var(--c-anchor);
  font-variant-numeric: tabular-nums;
}
.budget-map__overview-stack {
  display: grid; grid-template-columns: 1fr; gap: 7px; padding-bottom: 5px;
}
/* Heading over the bar; the bar's figure beside it, ranged left and centred on the bar itself. */
.budget-map__overview {
  display: grid; grid-template-columns: minmax(0, 1fr) 168px; grid-template-areas: "head ." "bar stat";
  align-items: center; gap: 6px var(--pf-space-200);
  padding: 5px 0; border: 0; border-radius: 0; background: var(--pf-color-surface-default);
}
.budget-map__overview-main { display: contents; }
.budget-map__overview-main > .budget-map__overview-head { grid-area: head; }
.budget-map__overview-main > .budget-map__overview-bar { grid-area: bar; }
.budget-map__overview-head {
  display: flex; align-items: baseline; justify-content: flex-start; gap: 8px;
}
.budget-map__overview-stat {
  grid-area: stat; align-self: center;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px;
  width: 168px; min-width: 0; padding-left: 0; border-left: 0;
  text-align: left; font-variant-numeric: tabular-nums;
}
.budget-map__overview-stat .budget-map__total-delta {
  font-size: var(--fs-lg); line-height: 1.05; font-weight: 600;
}
.budget-map__split-metrics {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px; width: max-content; min-width: 100%; align-self: flex-end;
}
.budget-map__split-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: var(--fs-xs); line-height: 1.2; color: var(--line-muted);
}
.budget-map__split-metrics[hidden],
.budget-map__split-row[hidden] {
  display: none !important;
}
.budget-map__split-label {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.budget-map__split-label::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  border: 1px solid var(--line-muted); background: var(--line-muted);
  box-sizing: border-box;
}
/* One line under the split when lending has moved: what lending does and does not change. */
.budget-map__split-note {
  width: 0; min-width: 100%;   /* wraps to the column, adding nothing to its width */
  font-size: var(--fs-xs); line-height: 1.3; color: var(--line-muted); text-align: left; white-space: normal;
}
.budget-map__split-value {
  color: var(--c-anchor); font-size: var(--fs-xs); font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.budget-map__overview-title {
  font-size: var(--fs-xs); font-weight: 600; color: var(--line-ink);
}
.budget-map__overview-helper {
  min-width: 0; font-size: var(--fs-xs); font-style: italic; font-weight: 400;
  line-height: 1.25; color: var(--line-muted); text-align: left;
}
.budget-map__overview-bar {
  display: flex; width: 100%; height: 49px; overflow: visible;
  border: 0; background: var(--pf-color-surface-warm); transition: width 0.2s ease;
}
.budget-map__overview-segment {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  min-width: 0; height: 100%; padding: 7px 8px; border: 0; border-right: var(--pf-border-width-rule) solid var(--pf-color-surface-default);
  border-radius: 0; color: var(--dept-bar-text-color); font: inherit; text-align: left; cursor: default;
  transition: width 0.2s ease;
  background: var(--dept-bar-color);
}
.budget-map__overview--live .budget-map__overview-bar[data-dir="save"] .budget-map__overview-segment {
  background: var(--c-save);
}
.budget-map__overview--live .budget-map__overview-bar[data-dir="cost"] .budget-map__overview-segment {
  background: var(--c-cost);
}
.budget-map__overview-segment:last-child { border-right: 0; }
.budget-map__overview-label,
.budget-map__overview-value {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.budget-map__overview-label {
  font-size: var(--fs-xs); font-weight: 400; line-height: 1.15;
}
.budget-map__overview-value {
  font-size: var(--fs-xs); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.budget-map__overview-segment.is-compact,
.budget-map__overview-segment.is-label-hidden {
  justify-content: center; padding: 8px 5px;
}
.budget-map__overview-segment:is(.is-compact, .is-label-hidden) :is(.budget-map__overview-label, .budget-map__overview-value) {
  display: none;
}
/* One rule tops the chart area on every page and view: the workspace owns it (the summary above and
   a panel row inside draw none), so the column and side rules below always start on it. */
.budget-map__workspace {
  position: relative;
  margin-left: calc(-1 * var(--page-inset-left)); padding-left: var(--page-inset-left);
  border-top: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
  border-right: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
}
.dashboard-body:has(.budget-map__workspace) { padding-bottom: 0; display: flex; flex-direction: column; }
.dashboard-body:has(.budget-map__workspace) > .simulator-root { flex: 1 0 auto; }
.simulator-root > .budget-map { flex: 1 0 auto; }
.budget-map > .budget-map__workspace { flex: 1 0 auto; }
.bubbles__chart { padding-bottom: var(--pf-space-300); }
.budget-map__workspace::after {
  content: ""; display: none; position: absolute; z-index: 7; pointer-events: none;
  top: calc(var(--pf-cross) / -2 - 1px); bottom: calc(var(--pf-cross) / -2 - 1px); right: calc(var(--pf-cross) / -2 - 1px);
  width: var(--pf-cross); background-color: var(--pf-color-icon-primary);
  mask: var(--pf-icon-grid-cross) center top / var(--pf-cross) var(--pf-cross) no-repeat,
        var(--pf-icon-grid-cross) center bottom / var(--pf-cross) var(--pf-cross) no-repeat;
}
@media (min-width: 1100px) { .budget-map__workspace::after { display: block; } }
.budget-map__mode-note {
  margin: 0;
  padding: 12px 14px 0;
  font-size: var(--fs-xs); line-height: 1.4; color: var(--line-muted);
}
.budget-map__families {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(430px, 100%), 1fr));
  align-items: stretch;
  gap: 0; margin-left: calc(-1 * var(--layout-gutter)); margin-right: calc(-1 * var(--layout-gutter));
  padding: 0 var(--layout-gutter); border-top: 0;
}
.budget-map__families[data-columns="1"] { grid-template-columns: minmax(0, 1fr); }
.budget-map__families[data-columns="2"] { grid-template-columns: repeat(auto-fit, minmax(min(430px, 100%), 1fr)); }
.budget-map__family-column {
  position: relative; display: flex; flex-direction: column; min-width: 0; padding: 0 var(--pf-space-150);
}

.budget-map__family {
  min-width: 0; padding: 10px 0; border: 0; border-radius: 0;
  --row-inset: 0px;   /* the column's own padding spaces the rows */
  background: var(--pf-color-surface-default); position: relative; z-index: 1;
}
.budget-map__family + .budget-map__family::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--pf-color-border-rule); pointer-events: none;
}
.budget-map__family-head {
  display: grid; grid-template-columns: minmax(0, 1fr);
  align-items: center; gap: 8px; width: 100%; padding: 0 var(--row-inset, 12px) 7px;
  border: 0; background: transparent;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.budget-map__family-head:hover .budget-map__family-name { color: var(--brand-indigo); }
.budget-map__family-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.budget-map__family-label,
.budget-map__item-label {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
}
.budget-map__family-label { flex-wrap: wrap; }
.budget-map__item-label { grid-column: 1; grid-row: 1; }
.budget-map__family-name {
  font-size: var(--fs-sm); font-weight: 600; color: var(--line-ink);
}
/* No track box and no baseline of its own: the fill stands on the row's rule. */
.budget-map__item-bar {
  position: relative; overflow: hidden; height: 8px; border-radius: 0; border: 0; grid-column: 1; grid-row: 2;
}
.budget-map__item-base {
  position: absolute; top: 0; bottom: 0; width: 2px; border-radius: 0;
  background: var(--pf-color-text-primary); transform: translateX(-1px); z-index: 2;
  transition: left 0.2s ease;
}
.budget-map__item-current {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 0;
  transition: left 0.2s ease, width 0.2s ease, background 0.2s ease;
  background: var(--dept-bar-color);
}
.budget-map__item-current[data-dir="save"] { background: var(--c-save); }
.budget-map__item-current[data-dir="cost"] { background: var(--c-cost); }
/* Receipts run the other way, from the right, hatched so they read as income rather than as spend
   that happens to be coloured differently. They take the saves-money colour, not costs-more: money
   coming in is the opposite of an overspend, and the legend's pink would say the reverse. */
.budget-map__item-current[data-receipt] {
  background: var(--c-save);
  background-image: repeating-linear-gradient(135deg,
    rgba(255, 255, 255, 0.45) 0 3px, rgba(255, 255, 255, 0) 3px 7px);
  opacity: 0.85;
}
/* A panel (DWP's benefits for non-citizens): one button above the sections that opens a set of
   choices in the drawer, whose savings land in each benefit's own section. */
/* A page-level set of choices (DWP's benefits for non-citizens): a toolbar control, the height of the
   segmented controls beside it, opening its choices in the drawer. */
.budget-map__panel-button {
  display: inline-flex; align-items: baseline; gap: var(--pf-space-100);
  padding: 7px 12px; border: var(--pf-border-width-rule) solid var(--pf-color-border-soft); border-radius: var(--pf-control-radius);
  background: var(--pf-color-surface-default); color: var(--pf-color-text-primary);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--pf-font-weight-medium); line-height: 1.15; white-space: nowrap; cursor: pointer;
}
.budget-map__panel-button::after { content: "\203A"; color: var(--pf-color-text-secondary); }
.budget-map__panel-button:hover { border-color: var(--pf-color-border-rule); color: var(--pf-color-text-highlight); }
.budget-map__panel-title { font-weight: inherit; }
.budget-map__panel-change { font-size: var(--fs-xs); color: var(--line-muted); }
.budget-map__panel-change:empty { display: none; }
.budget-map__panel-change[data-dir] { font-weight: 600; }
.budget-drawer__panel-blurb { margin: 0 0 12px; font-size: var(--fs-md); line-height: 1.45; }
.panel-all {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 12px 0; background: none; border: 0;
  border-top: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
}
.panel-all__text { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.panel-all__total { font-size: var(--fs-xs); color: var(--line-muted); }
.panel-all__total[data-dir] { font-weight: 600; }
.panel-seg { width: auto; flex: none; }
.panel-rows__note { margin: 4px 0 2px; font-size: var(--fs-sm); line-height: 1.4; color: var(--line-muted); }
.panel-rows__list { list-style: none; margin: 6px 0 0; padding: 0; }
.panel-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-top: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
}
.panel-row:first-child { border-top: 0; }
.panel-row__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.panel-row__name { font-size: var(--fs-md); }
.panel-row__meta { font-size: var(--fs-xs); color: var(--line-muted); }
.panel-row__meta[data-dir="save"] { font-weight: 600; }

/* A reference line's bar is money already counted on other cards: a dashed outline, never filled, so
   it can't be read as spending of its own. Its change shows on the cards the money is counted in. */
.budget-map__item--reference .budget-map__item-current {
  background: transparent; border: 1.5px dashed var(--pf-sand-warm-grey); box-sizing: border-box;
}
.budget-map__item--reference .budget-map__item-current[data-dir="save"] { background: transparent; border-color: var(--c-save); }
.budget-map__item--reference .budget-map__item-current[data-dir="cost"] { background: transparent; border-color: var(--c-cost); }
.budget-map__item--reference .budget-map__item-name,
.budget-map__item--reference .budget-map__item-value { color: var(--line-muted); }
.budget-map__family-value[data-receipt] { font-style: italic; }
.budget-map__family-meta {
  display: inline-flex; align-items: baseline; gap: 7px; flex: 0 0 auto;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.budget-map__family-value { font-size: var(--fs-sm); font-weight: 600; color: var(--line-ink); }
.budget-map__family-delta {
  font-size: var(--fs-xs); font-weight: 600; color: var(--c-anchor);
}
.budget-map__items { display: flex; flex-direction: column; gap: 0; padding-top: 0; }
.budget-map__item {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr);
  align-items: end; gap: 4px 8px; width: 100%; min-height: 39px;
  padding: 8px var(--row-inset, 12px) 0; border: 0; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft); border-radius: 0;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.budget-map__item:hover { background: var(--pf-color-surface-mist); border-bottom-color: var(--pf-color-border-rule); }
.budget-map__families:has(.budget-map__item.is-active) .budget-map__family:not(:has(.budget-map__item.is-active)) {
  opacity: 0.55;
}
.budget-map__families:has(.budget-map__item.is-active) .budget-map__family:has(.budget-map__item.is-active) {
  opacity: 1;
}
.budget-map__family:has(.budget-map__item.is-active) .budget-map__item:not(.is-active) {
  opacity: 0.6;
}
.budget-map__family:has(.budget-map__item.is-active) {
  box-shadow: none;
}
.budget-map__item.is-active {
  z-index: 3; opacity: 1;
  background: var(--pf-color-surface-mist); border-bottom-color: var(--pf-color-border-rule);
}
.budget-map__item-name {
  min-width: 9ch; font-size: var(--fs-xs); font-weight: 600; line-height: 1.18;
  color: var(--line-ink); overflow-wrap: anywhere;
}
/* With a card tag beside the funding pill the meta can outgrow a narrow column; let the pills wrap
   under the value rather than squeezing the line's name to a letter a row. */
.budget-map__item-meta {
  display: inline-flex; align-items: baseline; gap: 6px; flex: 0 1 auto; min-width: 0;
  flex-wrap: wrap; justify-content: flex-end; row-gap: 2px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.budget-map__item-value { font-size: var(--fs-xs); font-weight: 600; color: var(--line-muted); }
/* Tags are MRP light pill tags: a Sand fill, Deep Teal words, 3px corners, no outline. */
.budget-map__funding-tag {
  --funding-dot-fill: var(--pf-teal-80);
  --funding-dot-border: var(--pf-teal-80);
  display: inline-flex; align-items: center; gap: 4px; min-height: 18px;
  padding: 2px 6px; border: 0; border-radius: var(--pf-control-radius);
  background: var(--pf-sand-sand); color: var(--pf-color-text-primary);
  font-size: var(--fs-xs); font-weight: var(--pf-font-weight-clear); line-height: 1; letter-spacing: 0;
}
.budget-map__funding-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  border: 1px solid var(--funding-dot-border);
  background: var(--funding-dot-fill);
  box-sizing: border-box;
}
.budget-map__funding-tag--capital { --funding-dot-fill: transparent; }
/* Lending is part of capital: the capital ring, half filled. */
.budget-map__funding-tag--lending { --funding-dot-fill: linear-gradient(90deg, var(--pf-teal-80) 50%, transparent 50%); }
.budget-map__funding-tag--mixed::before { outline: 1px solid var(--pf-teal-80); outline-offset: 2px; }
/* Revenue takes the saves colour: money coming in. */
.budget-map__funding-tag--revenue { --funding-dot-fill: var(--c-save); --funding-dot-border: var(--c-save); }
.budget-map__item-value[data-receipt] { font-style: italic; }
.budget-map__card-tag { min-height: 18px; padding: 2px 6px; font-size: var(--fs-xs); }
.budget-map__item-delta { font-size: var(--fs-xs); font-weight: 600; color: var(--c-anchor); }

.budget-drawer {
  position: fixed; top: 0; bottom: 0; z-index: 80;
  width: var(--card-w); height: 100vh; max-height: none;
  overflow: auto; padding: 26px 30px 32px; border: 0;
  border-radius: 0; background: var(--pf-color-surface-default);
}
.budget-drawer[data-side="right"] { right: 0; left: auto; border-left: var(--pf-border-width-rule) solid var(--pf-color-border-soft); }
.budget-drawer[data-side="left"] { left: 0; right: auto; border-right: var(--pf-border-width-rule) solid var(--pf-color-border-soft); }
.budget-drawer[hidden] { display: none; }
.budget-drawer__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  /* The title, Reset and × stay pinned while the panel scrolls, so closing never means scrolling back up. */
  position: sticky; top: -26px; z-index: 20; background: var(--pf-color-surface-default);
  margin: -26px -30px 14px; padding: 26px 30px 14px;   /* full bleed, so its rule meets the drawer's edge */
}
.budget-drawer__titlewrap { min-width: 0; }
.budget-drawer__family {
  display: block; margin-bottom: 3px; font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--line-muted);
}
.budget-drawer__title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0; font-size: var(--fs-xl); line-height: 1.2; font-weight: 600;
}
.core-choice-suffix { font-weight: 400; }
.budget-drawer__actions {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
}
/* Reset is the MRP secondary small button (3px corners here); close is a bare icon button. */
.budget-drawer__reset {
  display: inline-flex; align-items: center; height: var(--pf-control-height-sm);
  padding: 0 var(--pf-control-padding-x-sm);
  border: var(--pf-border-width-rule) solid var(--pf-color-border-rule); border-radius: var(--pf-control-radius);
  background: var(--pf-color-surface-default); color: var(--pf-color-text-primary);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--pf-font-weight-medium); line-height: 1;
  cursor: pointer; transition: background var(--pf-duration-fast) var(--pf-easing-standard);
}
.budget-drawer__reset:hover { background: var(--pf-color-surface-warm); }
.budget-drawer__close {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: var(--pf-control-height-sm); height: var(--pf-control-height-sm); padding: 0;
  border: 0; border-radius: var(--pf-control-radius); background: none; color: var(--pf-color-text-primary);
  font: inherit; font-size: 24px; font-weight: var(--pf-font-weight-clear); line-height: 1; cursor: pointer;
  transition: color var(--pf-duration-fast) var(--pf-easing-standard);
}
.budget-drawer__close:hover { color: var(--pf-color-text-highlight); }
.budget-drawer .area__sub {
  margin: 0 0 10px; font-size: var(--fs-sm); line-height: 1.45; color: var(--line-muted);
}
.policy-tags {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px;
}
.policy-tags--compact { margin-top: 3px; }
.policy-tag {
  display: inline-flex; align-items: center; min-height: 18px;
  padding: 2px 6px; border: 0; border-radius: var(--pf-control-radius);
  background: var(--tag-bg, var(--pf-sand-sand)); color: var(--pf-color-text-primary);
  font-size: var(--fs-xs); font-weight: var(--pf-font-weight-clear); line-height: 1; letter-spacing: 0;
}
/* Tag kinds (TAG_KINDS, heldBy, legacyDept in main.js). Two fills only: Sand by default, Copper 20 for
   the kinds that flag the card itself (core, new, tentative, under review). The words carry the kind. */
.policy-tag:is(.policy-tag--core, .policy-tag--new, .policy-tag--tentative, .policy-tag--review, .policy-tag--ollie) { --tag-bg: var(--pf-copper-20); }
.policy-tag--revenue::before { background: var(--c-save); border-color: var(--c-save); }
.policy-tag--funding::before {
  content: ""; width: 6px; height: 6px; margin-right: 4px;
  border-radius: 999px; border: 1px solid var(--pf-teal-80);
  background: var(--pf-teal-80); box-sizing: border-box;
}
.budget-drawer__context {
  margin: 0 0 16px; padding: 0 0 14px; border-bottom: 1px solid var(--line-rule);
}
.budget-drawer__budget-type {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline;
  gap: 7px 10px; margin: 0 0 12px;
  font-size: var(--fs-xs); line-height: 1.35;
}
.budget-drawer__budget-type-label {
  color: var(--line-ink); font-weight: 600;
}
.budget-drawer__budget-type-value {
  display: inline-flex; align-items: center; gap: 5px; justify-self: start;
  color: var(--line-muted); font-weight: 600;
}
.budget-drawer__budget-type-value::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  border: 1px solid var(--line-muted); background: var(--line-muted);
  box-sizing: border-box;
}
.budget-drawer__budget-type-value--revenue { color: var(--pf-color-text-primary); }
.budget-drawer__budget-type-value--revenue::before {
  background: var(--c-save); border-color: var(--c-save);
}
.budget-drawer__budget-type-value--capital::before,
.budget-map__split-label--capital::before {
  background: transparent; border-color: var(--pf-teal-80);
}
.budget-drawer__budget-type-value--lending::before,
.budget-map__split-label--lending::before {
  background: linear-gradient(90deg, var(--pf-teal-80) 50%, transparent 50%); border-color: var(--pf-teal-80);
}
.budget-drawer__budget-type-value--mixed::before {
  background: var(--line-muted);
  border-color: var(--pf-teal-80);
  outline: 1px solid var(--pf-teal-80);
  outline-offset: 2px;
}
.budget-drawer__funding-split {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline;
  gap: 7px 10px;
  color: var(--line-muted); font-size: var(--fs-xs); line-height: 1.3;
}
.budget-drawer__funding-split-label {
  color: var(--line-ink); font-weight: 600;
}
.budget-drawer__funding-split-items {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 12px;
}
.budget-drawer__funding-split-row {
  display: inline-flex; align-items: baseline; gap: 5px;
}
.budget-drawer__funding-split-value {
  color: var(--line-muted); font-weight: 600; font-variant-numeric: tabular-nums;
}
.budget-drawer__context p { margin: 0; }
.budget-drawer__context p + p { margin-top: 8px; }
.budget-drawer__context-text {
  font-size: var(--fs-sm); line-height: 1.5; color: var(--line-ink);
}
.budget-drawer__context-source {
  font-size: var(--fs-xs); line-height: 1.45; color: var(--line-muted);
}
.budget-drawer__context-label { color: var(--line-ink); font-weight: 600; }
.budget-drawer__context-source a { color: var(--brand-indigo); }
.budget-drawer__body { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 0; }
.budget-drawer .options {
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)) !important;
}
.budget-drawer .levers {
  gap: 16px;
}
.budget-drawer .lever {
  padding: 0;
  border-top: 0;
}
.budget-drawer .lever__label {
  color: var(--line-muted);
}
.budget-drawer .lever__track::before {
  border: 0;
}
.budget-drawer .lever__ticks {
  display: block;
  height: 30px;
}
.budget-drawer .lever__tickline {
  top: -11px;
  height: 9px;
}
.budget-drawer .lever__tickdate {
  font-size: var(--fs-xs);
}
.budget-drawer .lever__tickspend {
  font-size: var(--fs-xs);
}
.budget-drawer .opt {
  min-height: auto; border-color: var(--line-rule); border-left-width: 2px; border-radius: 0;
  box-shadow: none;
}
.budget-drawer .opt:hover {
  background: var(--line-alt); box-shadow: none;
}
.budget-drawer .opt__check {
  border-radius: 0;
}
.budget-drawer .opt.is-selected[data-dir] {
  border-color: var(--line-rule);
}
.budget-drawer .result {
  border-radius: 0;
  border-left-width: 2px;
}
.budget-drawer .lever__track { margin-bottom: 2px; }
.budget-drawer__result { margin-top: 0; }
/* A read-only part on the recipient page (a merged housing line's social and private rows): a label,
   its figure and a Fixed pill, in place of a slider. */
.budget-drawer__fixed-line {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line-rule); font-size: var(--fs-sm);
}
.budget-drawer__fixed-label { flex: 1; font-weight: 600; }
.budget-drawer__fixed-value { font-variant-numeric: tabular-nums; }
.budget-drawer__linked-group {
  position: relative; padding-left: 14px;
}
.budget-drawer__linked-group::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 1px; background: var(--line-rule); pointer-events: none;
}
.budget-drawer__linked-group > .budget-drawer__control {
  padding-top: 0; border-top: 0;
}
.budget-drawer__breakdown {
  margin-top: 10px; padding-top: 0; border-top: 0;
}
.budget-drawer__breakdown--nested {
  margin-left: 14px;
}
.budget-drawer__break-toggle,
.budget-drawer__control-reset {
  border: 1px solid var(--line-rule); border-radius: 0; background: #fff;
  color: var(--line-ink); font: inherit; font-size: var(--fs-xs); line-height: 1;
  padding: 7px 10px; cursor: pointer; white-space: nowrap;
}
.budget-drawer__break-toggle:hover,
.budget-drawer__control-reset:hover {
  border-color: var(--brand-indigo); color: var(--brand-indigo);
}
.budget-drawer__breakdown .budget-drawer__breakdown { margin-top: 8px; }
.budget-drawer__break-section {
  margin: 14px 0 7px; font-size: var(--fs-xs); line-height: 1.2; font-weight: 600;
  color: var(--line-muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.budget-drawer__break-intro {
  margin: -2px 0 7px; font-size: var(--fs-xs); line-height: 1.4; color: var(--line-muted);
}
.budget-drawer__controls {
  display: flex; flex-direction: column; gap: 12px; margin-top: 12px;
}
.budget-drawer__control {
  position: relative; padding-top: 12px; border-top: 1px solid var(--line-rule);
}
.budget-drawer__control[data-depth="1"] { margin-left: 16px; }
.budget-drawer__control[data-depth="2"] { margin-left: 32px; }
.budget-drawer__control[data-depth="3"] { margin-left: 48px; }
.budget-drawer__control-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px;
}
.budget-drawer__control-titlewrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0;
}
.budget-drawer__control-title {
  margin: 0; font-size: var(--fs-md); line-height: 1.25; font-weight: 600; color: var(--line-ink);
}
.budget-drawer__control-note {
  margin: 0 0 10px; font-size: var(--fs-xs); line-height: 1.45; color: var(--line-muted);
}

.floating-tooltip {
  position: fixed; left: 0; top: 0; z-index: 9999;
  width: max-content; max-width: min(360px, calc(100vw - 24px));
  padding: 9px 11px; border: 0; border-radius: var(--pf-control-radius); box-shadow: none;
  background: var(--pf-sand-sand); color: var(--pf-color-text-primary);
  font-size: var(--fs-xs); font-weight: 400; line-height: 1.4; text-align: left; white-space: pre-line;
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.floating-tooltip.is-visible {
  opacity: 1; transform: translateY(0);
}
.floating-tooltip[hidden] { display: none; }
.floating-tooltip__title,
.floating-tooltip__body,
.floating-tooltip__action { display: block; }
.floating-tooltip__title {
  margin-bottom: 7px; color: var(--line-ink); font-weight: 600;
}
.floating-tooltip__action {
  margin-top: 7px; color: var(--pf-color-text-secondary); font-style: italic; font-weight: 400;
}

.decisions__money[data-dir="none"] { color: var(--c-anchor); }

/* ---- Card prose ------------------------------------------------------- */
.area__sub { margin: 2px 0 0; font-size: var(--fs-md); line-height: 1.45; color: var(--text-muted); }
.tip__source-link { color: var(--brand-indigo); font-style: normal; }

/* Sliders */
.levers { display: flex; flex-direction: column; gap: 16px; }
.lever-group-heading {
  margin: 4px 0 -6px;
  font-size: var(--fs-sm);
  line-height: 1.25;
  font-weight: 600;
  color: var(--text-primary);
}
.lever__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lever__label { font-size: var(--fs-sm); color: var(--text-muted); }
.lever__value { font-size: var(--fs-md); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
/* Secondary lever (e.g. FSM cost per student): smaller + muted so the primary lever leads. */
.lever--secondary .lever__label { font-size: var(--fs-xs); }
.lever--secondary .lever__value { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
/* Fixed multiplier (min === max): a static read-out, not a slider – so it doesn't look like a dead dial. */
.lever--fixed .lever__value { color: var(--text-muted); }
/* Editable value pill: type an exact dial value (clamped to the dial's min/max) instead of dragging. */
/* Underline only (MRP text field in the drawer): soft at rest, solid Deep Teal on hover and focus. */
.lever__pill { display: inline-flex; align-items: baseline; gap: 1px; padding: 3px 2px;
  border: 0; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft); border-radius: 0; background: none;
  font-variant-numeric: tabular-nums; transition: border-color 0.15s; }
.lever__pill:hover,
.lever__pill:focus-within { border-bottom-color: var(--pf-color-border-rule); }
.lever__pill-unit { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.lever__input { min-width: 2ch; border: 0; padding: 0; margin: 0; background: none; font: inherit;
  font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); text-align: right;
  font-variant-numeric: tabular-nums; appearance: none; }
.lever__input:focus { outline: none; }
.lever__pill:has(.lever__input:focus-visible) {
  outline: var(--pf-border-width-focus) solid var(--pf-color-border-focus); outline-offset: var(--pf-focus-offset);
}
.lever__input:disabled { color: var(--text-muted); }
.lever--secondary .lever__input { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
/* Derived quantity under the dial value (e.g. pupils beneath a £m breakfast-clubs cost). */
.lever__derived { display: block; margin-top: 2px; text-align: right; font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* A dial's own short explanation (student-loans reforms) – quiet prose under the label. */
.lever__blurb { margin: 2px 0 6px; font-size: var(--fs-xs); line-height: 1.45; color: var(--text-muted); }
.lever__below { margin: 4px 0 0; font-size: var(--fs-xs); line-height: 1.45; color: var(--text-muted); }
/* Clickable policy choices under a dial (see renderChoices): small pills that add together. */
.lever__choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.choice {
  font: inherit; font-size: var(--fs-xs); line-height: 1.2; padding: 5px 10px; border-radius: var(--pf-control-radius); cursor: pointer;
  background: #fff; color: var(--text-primary); border: 1px solid var(--pf-color-border-soft);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.choice:hover { border-color: var(--c-anchor); }
.choice[aria-pressed="true"] { background: var(--c-anchor); border-color: var(--c-anchor); color: var(--pf-base-white); }
.choice:disabled { opacity: 0.5; cursor: default; }
.lever__choices--rows { flex-direction: column; gap: 8px; }
.lever__choice-hint { margin: 0; font-size: var(--fs-xs); color: var(--text-muted); }
.lever__choice-row { display: flex; flex-direction: column; gap: 4px; }
.lever__choice-row-label { font-size: var(--fs-xs); font-weight: 600; color: var(--line-ink, inherit); }
.lever__choice-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Reserve headroom above the slider so a lifted tick label (see lever__ticklabel--above) has room. */
.lever--tick-above .lever__track { margin-top: var(--tick-above-space, 40px); }
/* The slider track stays light grey. The overlay segment and thumb show whether this moved
   up or down, and the reference line marks the original value. */
.lever__track {
  --lever-start: 0%;
  --lever-end: 0%;
  --lever-current: 0%;
  --lever-thumb: var(--c-anchor);
  position: relative; height: 24px; margin: 8px 0 2px;
}
.lever__track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 8px; transform: translateY(-50%);
  background: var(--pf-color-surface-warm); border: 1px solid var(--border);
}
.lever__track-fill {
  position: absolute; left: var(--lever-start); width: calc(var(--lever-end) - var(--lever-start));
  top: 50%; height: 8px; transform: translateY(-50%);
  background: var(--lever-thumb); z-index: 1;
}
.lever__track[data-dir="save"] { --lever-thumb: var(--c-save); }
.lever__track[data-dir="cost"] { --lever-thumb: var(--c-cost); }
.lever__track-ref {
  position: absolute; left: var(--lever-current); top: 2px; bottom: 2px;
  width: 2px; transform: translateX(-1px);
  background: var(--c-anchor); opacity: 1; z-index: 2;
}
.lever__range {
  position: absolute; inset: 0; width: 100%; height: 24px; margin: 0;
  appearance: none; -webkit-appearance: none; background: transparent;
  accent-color: var(--lever-thumb); cursor: pointer; z-index: 3;
}
.lever__range::-webkit-slider-runnable-track {
  height: 8px; background: transparent; border: 0;
}
.lever__range::-webkit-slider-thumb {
  width: 16px; height: 16px; margin-top: -4px; border-radius: 50%;
  border: 2px solid #fff; background: var(--lever-thumb);
  box-shadow: 0 0 0 1px var(--pf-color-text-primary);
  -webkit-appearance: none; appearance: none;
}
.lever__range::-moz-range-track {
  height: 8px; background: transparent; border: 0;
}
.lever__range::-moz-range-progress {
  height: 8px; background: transparent;
}
.lever__range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; background: var(--lever-thumb);
  box-shadow: 0 0 0 1px var(--pf-color-text-primary);
}
.lever__ticks { position: relative; height: 32px; }
/* connector line sits at the exact marker value; labels (positioned by layoutTicks) are centred on
   it, then nudged right only to avoid clipping a neighbour. Each label stacks date over its spend. */
.lever__tickline {
  --tick-color: var(--c-anchor);
  position: absolute; top: -13px; width: 1.5px; height: 11px;
  background: var(--tick-color); transform: translateX(-50%);
}
/* Unlabelled stop on a fixed-stop dial: a short, faint tick so the option is visible. */
.lever__tickline--stop { --tick-color: var(--text-muted); top: -20px; height: 10px; width: 2px; opacity: 0.9; border-radius: 1px; }
.budget-drawer .lever__tickline--stop { top: -19px; height: 10px; }
.lever__ticklabel {
  --tick-color: var(--text-muted);
  position: absolute; top: 0; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; line-height: 1.25;
}
:is(.lever__tickline, .lever__ticklabel)[data-dir="anchor"] { --tick-color: var(--c-anchor); }
:is(.lever__tickline, .lever__ticklabel)[data-dir="save"] { --tick-color: var(--c-save); }
:is(.lever__tickline, .lever__ticklabel)[data-dir="cost"] { --tick-color: var(--c-cost); }
/* Marker lines carry the save or cost colour; their words stay Teal 80, which reads at 12px. */
.lever__tickdate { font-size: var(--fs-xs); color: var(--pf-color-text-secondary); }
.lever__ticklabel--today .lever__tickdate { font-weight: 600; }
.lever__ticklabel--clickable { cursor: pointer; }
.lever__ticklabel--clickable:hover .lever__tickdate { text-decoration: underline; }
/* Extremes hug the track ends: min reads left-aligned, max right-aligned. */
.lever__ticklabel--min { align-items: flex-start; }
.lever__ticklabel--max { align-items: flex-end; text-align: right; }
/* A label lifted ABOVE the track (two close marks that won't fit side by side): its connector line
   runs back down to the track. layoutTicks sets --above-line to the gap height. */
.lever__ticklabel--above { align-items: center; }
.lever__ticklabel--above::after {
  content: ""; position: absolute; top: 100%; left: var(--above-x, 50%); transform: translateX(-50%);
  width: 1.5px; height: var(--above-line, 0); background: var(--tick-color);
}
.lever__tickspend { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Option cards – always a single row (columns set inline, one per option) */
.options { display: grid; gap: 8px; }
.opt {
  display: grid; grid-template-rows: auto auto 1fr; gap: 4px; min-width: 0;
  text-align: left; padding: 11px 12px 11px 14px; cursor: pointer;
  background: var(--pf-color-surface-default); border: 1px solid var(--border); border-left: 4px solid var(--c-none);
  border-radius: var(--pf-control-radius); font: inherit; color: var(--text-primary);
  position: relative; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.opt:hover { background: var(--pf-color-surface-hover-strong); }
.opt[data-dir="anchor"] { border-left-color: var(--c-anchor); }
.opt[data-dir="save"] { border-left-color: var(--c-save); }
.opt[data-dir="cost"] { border-left-color: var(--c-cost); }
.opt__check {
  position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 999px;
  border: 1.5px solid var(--border); background: #fff; transition: border-color 0.15s, background 0.15s;
}
.opt__label { font-size: var(--fs-md); font-weight: 600; line-height: 1.3; padding-right: 22px; overflow-wrap: break-word; }
.opt__detail { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.opt__delta {
  align-self: end; margin-top: 4px; font-size: var(--fs-xs); font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--c-none);
}
.opt__delta[data-dir="anchor"] { color: var(--c-anchor); }

/* Selected state – tint the card and fill the check in its own colour */
.opt.is-selected[data-dir="anchor"] { background: var(--c-anchor-bg); border-color: var(--c-anchor-border); }
.opt.is-selected[data-dir="save"] { background: var(--c-save-bg); border-color: var(--c-save-border); }
.opt.is-selected[data-dir="cost"] { background: var(--c-cost-bg); border-color: var(--c-cost-border); }
.opt.is-selected[data-dir="anchor"] .opt__check { border-color: var(--c-anchor); background: var(--c-anchor); }
.opt.is-selected[data-dir="save"] .opt__check { border-color: var(--c-save); background: var(--c-save); }
.opt.is-selected[data-dir="cost"] .opt__check { border-color: var(--c-cost); background: var(--c-cost); }
.opt.is-selected .opt__check::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg);
}

.locked-control {
  display: inline-flex; align-items: center; width: fit-content;
  padding: 7px 12px; border-radius: var(--pf-control-radius);
  background: var(--c-anchor-bg); border: 1px solid var(--c-anchor-border);
  color: var(--c-anchor); font-size: var(--fs-sm); font-weight: 600;
}

/* Result strip for the selected option */
.result {
  margin-top: 12px; padding: 12px 16px; border-radius: 0;
  background: var(--surface-muted); border-left: 4px solid var(--c-none);
}
.result[data-dir="anchor"],
.result[data-dir="none"] { border-left-color: var(--c-anchor); background: var(--c-anchor-bg); }
.result[data-dir="save"] { border-left-color: var(--c-save); background: var(--c-save-bg); }
.result[data-dir="cost"] { border-left-color: var(--c-cost); background: var(--c-cost-bg); }
.result p { margin: 0; }
.result p + p { margin-top: 5px; }
.result__desc { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-primary); }
.result__marker-note { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-primary); margin-top: 10px; }
.result__marker-note + .result__marker-note { padding-top: 8px; border-top: 1px solid var(--border); }
.result p + .result__spend { margin-top: 8px; }
.result__spend { font-size: var(--fs-md); color: var(--text-primary); }
.result__spend strong { font-variant-numeric: tabular-nums; }
.result__change { font-size: var(--fs-md); }

.result__affects { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-muted); }
/* An explainer above the map (the devolved page: how the Barnett formula works). */
/* Page context (what a page counts, how its budget is funded, where changes land): a ruled row with a
   chevron, closed until opened, between the toolbar and the chart. */
.budget-map > .context-block { margin: 0 0 0 calc(-1 * var(--page-inset-left)); padding-left: var(--page-inset-left); border-top: var(--pf-border-width-rule) solid var(--pf-color-border-soft); }
.context-block__toggle {
  display: flex; align-items: center; gap: var(--pf-space-100); width: 100%; padding: 10px 0;
  border: 0; background: none; color: var(--pf-color-text-primary); text-align: left; cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: var(--pf-font-weight-semibold);
}
.context-block__toggle::before {
  content: "\203A"; display: inline-block; width: 10px; color: var(--pf-color-text-secondary);
  transition: transform var(--pf-duration-fast) var(--pf-easing-standard);
}
.context-block__toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.context-block__toggle:hover { color: var(--pf-color-text-highlight); }
.context-block__body { padding: 0 0 var(--pf-space-200) 18px; max-width: 900px; }
.context-block__body[hidden] { display: none; }
.page-intro__p { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-primary); margin: 0 0 8px; }
.page-intro__equation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.page-intro__factor { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.page-intro__term { font-size: var(--fs-sm); font-weight: 600; color: var(--brand-indigo); background: #fff; border: 1px solid var(--pf-color-border-soft); border-radius: var(--pf-control-radius); padding: 5px 9px; }
.page-intro__times { font-size: var(--fs-md); font-weight: 600; color: var(--line-muted); }
.page-intro__options { margin: 0; padding-left: 18px; font-size: var(--fs-sm); line-height: 1.5; }
.page-intro__options li + li { margin-top: 4px; }
/* A devolved grant's pass-through, page by page. */
.barnett-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.4; margin: 4px 0 8px; }
.barnett-table th, .barnett-table td { padding: 4px 6px; border-bottom: 1px solid var(--line-rule); text-align: right; font-variant-numeric: tabular-nums; }
.barnett-table th:first-child { text-align: left; font-weight: 500; }
.barnett-table thead th { font-weight: 600; color: var(--text-muted); }
.barnett-table tfoot th, .barnett-table tfoot td { font-weight: 600; border-bottom: 0; }
.barnett-table--page { margin: 0; }
.barnett-table__dept { font: inherit; color: var(--brand-indigo); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.result__affects-label { font-weight: 600; color: var(--text-primary); }
/* A cited source inside supplied copy: the title carries the link, the URL stays hidden. Long
   titles wrap normally; the `anywhere` fallback only matters for a bare-URL link with no title. */
.copy-link {
  color: var(--pf-color-text-primary); text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: var(--pf-color-icon-accent); overflow-wrap: break-word;
}
.copy-link:hover { color: var(--pf-color-text-highlight); text-decoration-color: currentColor; }
button.copy-link--jump { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* Caveats collapse behind a disclosure. A health warning gets a warning triangle; a methodology
   note a neutral round "i". */
.caveat {
  margin-top: 8px; border-top: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
  font-size: var(--fs-xs); line-height: 1.5;
}
.caveat__summary {
  display: flex; align-items: center; gap: 7px; padding: 7px 0 6px;
  cursor: pointer; list-style: none; color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em;
}
.caveat__summary::-webkit-details-marker { display: none; }
.caveat__summary::after {
  content: ""; width: 6px; height: 6px; margin-left: 1px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-1px); transition: transform 120ms ease;
}
.caveat[open] > .caveat__summary::after { transform: rotate(-135deg) translateY(-1px); }
.caveat__summary:hover { color: var(--text-primary); }
.caveat__icon {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 600; color: #fff; background: var(--text-muted);
}
.caveat__body { padding: 0 0 8px; }
.caveat__text { margin: 0 0 6px; color: var(--text-muted); }
.caveat__text:last-child { margin-bottom: 0; }
/* A health warning: Deep Teal words (copper is too pale to read at 12px) under a copper triangle. */
.caveat--warning { border-top-color: var(--pf-color-icon-accent); }
.caveat--warning .caveat__summary { color: var(--pf-color-text-primary); }
.caveat--warning .caveat__summary:hover { color: var(--pf-color-text-highlight); }
.caveat--warning .caveat__text { color: var(--pf-color-text-primary); }
.caveat--warning .caveat__icon {
  width: 18px; height: 16px; border-radius: 0;
  background: var(--pf-color-icon-accent);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  align-items: flex-end; padding-bottom: 1px;
  font-size: var(--fs-xs); line-height: 1;
}

/* A signposted heading inside supplied copy (student loans, UKRI). */
.prose__head {
  margin: 10px 0 2px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em;
  color: var(--text-primary);
}
/* In the card, a section heading (Key information, Context) sits under a soft rule. */
.budget-drawer .prose__head {
  margin-top: 14px; padding-top: 12px;
  border-top: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
}
/* "- " lines in supplied copy: the list carries its paragraphs' class, so size and colour match. */
.prose__list { padding-left: 1.2em; }
.prose__list > li { margin: 1px 0; }
.budget-drawer__context-group > .prose__head:first-child,
.budget-drawer__control-note-group > .prose__head:first-child,
.lever__blurb-group > .prose__head:first-child { margin-top: 0; }
.budget-drawer .budget-drawer__context-group > .prose__head:first-child { margin-top: 4px; }
.budget-drawer__control-note-group > .budget-drawer__control-note { margin-bottom: 6px; }
.budget-drawer__context-group > .budget-drawer__context-text {
  margin-bottom: 6px;
}
.lever__blurb-group > .lever__blurb { margin-bottom: 8px; }
/* A dial blurb heading gets air below it, so the sub-heading and its text do not read as one block. */
.lever__blurb-group > .prose__head { margin-bottom: 6px; }
.lever__blurb-group > .prose__head + .lever__blurb { margin-top: 0; }
/* The dial label is the sub-heading of any text under it: give the explanation room to breathe. */
.lever__head + .lever__blurb-group, .lever__head + .lever__blurb { margin-top: 10px; }
/* A subtitle long enough to need a second paragraph: the wrapper takes the lead-in, not each line. */
.area__sub-group { margin-top: 2px; }
.area__sub-group > .area__sub { margin-top: 0; }
.area__sub-group > .area__sub + .area__sub { margin-top: 8px; }

/* ---- Your decisions (full recap at the bottom) ------------------------- */
.decisions__list { margin: 0 0 16px; padding: 0; list-style: none; }
.decisions__empty { color: var(--text-muted); font-size: var(--fs-sm); padding: 4px 0; }
.decisions__item {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.decisions__item:last-child { border-bottom: none; }
.decisions__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.decisions__area { font-size: var(--fs-xs); color: var(--text-muted); }
.decisions__choice { font-size: var(--fs-md); font-weight: 500; }
.decisions__money {
  font-size: var(--fs-md); font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums; color: var(--c-none);
}

/* "Your changes" dropdown */
.changes { position: relative; margin-left: auto; align-self: center; }
/* Home and revert on every department page: "<- Overview" over the title, and a revert button beside
   "Your changes" that turns into an undo for a few seconds. */
/* The way home: a box like "Reset changes" beside the title, so it reads as a control, not a caption. */
.page-home {
  display: inline-block; align-self: flex-start; padding: 7px 12px; line-height: 1;
  border: 1px solid var(--pf-color-border-soft); border-radius: var(--pf-control-radius); background: #fff;
  font-size: var(--fs-xs); font-weight: var(--pf-font-weight-medium); color: var(--text-primary);
  text-decoration: none;
}
.page-home:hover, .page-home:focus-visible { border-color: var(--pf-color-border-rule); color: var(--pf-color-text-highlight); }
.budget-map__actions { display: flex; align-items: center; gap: var(--pf-space-150); margin-left: auto; align-self: flex-end; }
.budget-map__actions .changes { margin-left: 0; }
.page-revert {   /* the same box as the "Your changes" button beside it */
  padding: 7px 12px; border: 1px solid var(--pf-color-border-soft); border-radius: var(--pf-control-radius);
  background: #fff; color: var(--text-primary); line-height: 1;
  font: inherit; font-size: var(--fs-xs); font-weight: 400; cursor: pointer;
}
.page-revert:hover:not(:disabled) { border-color: var(--pf-color-border-rule); color: var(--pf-color-text-highlight); }
.page-revert:disabled { color: var(--pf-color-text-secondary); opacity: 0.6; cursor: default; }
.page-revert[data-undo="yes"] { border-color: var(--pf-color-border-rule); font-weight: var(--pf-font-weight-semibold); }
.changes__btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: var(--pf-control-radius); cursor: pointer; font: inherit; font-size: var(--fs-xs); font-weight: 400; line-height: 1;
  background: #fff; color: var(--text-primary); border: 1px solid var(--pf-color-border-soft);
  transition: background 0.15s, border-color 0.15s;
}
.changes__btn:hover, .changes__btn[data-has="yes"] { border-color: var(--brand-indigo); }
.changes__count {
  min-width: 16px; padding: 1px 5px; border-radius: 999px; text-align: center;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.1; background: var(--pf-color-text-primary); color: var(--pf-color-text-inverse);
}
.changes__caret { font-size: var(--fs-xs); color: var(--text-muted); }
.changes__caret { display: inline-block; transition: transform 0.15s; }
.changes__btn[aria-expanded="true"] .changes__caret { transform: rotate(180deg); }
/* Overview: the open list covers the department table above its Total row (see positionChangesPanel). */
.changes--overview.changes--cover .changes__panel {
  height: var(--changes-panel-max-height); max-height: none; box-sizing: border-box;
  border-width: 0 0 var(--pf-border-width-rule);
}
.changes__panel {
  position: fixed;
  left: var(--changes-panel-left, 12px);
  top: var(--changes-panel-top, 72px);
  width: var(--changes-panel-width, min(520px, calc(100vw - 24px)));
  max-height: min(var(--changes-panel-max-height, 70vh), 560px); overflow: auto; z-index: 50;
  background: var(--pf-color-surface-default); border: 1px solid var(--border); border-radius: 0;
  padding: 12px 16px 14px;
}
.changes--above .changes__panel {
  top: auto;
  bottom: var(--changes-panel-bottom, 72px);
}
.changes__panel[hidden] { display: none; }
.changes__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.changes__head strong { font-size: var(--fs-md); }
.changes__actions { display: flex; align-items: center; gap: 6px; }
.changes__reset,
.changes__share {
  background: none; border: 1px solid var(--border); border-radius: var(--pf-control-radius); padding: 4px 10px;
  font: inherit; font-size: var(--fs-xs); cursor: pointer; color: var(--text-primary);
}
.changes__share { background: var(--brand-indigo); border-color: var(--brand-indigo); color: #fff; }
.changes__reset:hover,
.changes__share:hover { border-color: var(--brand-indigo); }
.changes__share:disabled { cursor: default; opacity: 0.72; }
.changes__share-status {
  display: block; min-height: 16px; margin: 0 0 4px;
  font-size: var(--fs-xs); line-height: 1.35; color: var(--text-muted);
}
.changes .decisions__list { margin: 0; }
.changes--overview { flex: none; margin: 0; align-self: flex-start; }
.overview-list__foot-label { display: flex; align-items: center; gap: var(--pf-space-200); }
.changes--inline { align-self: center; }
.changes--inline .changes__btn {
  padding: 4px 0; border: 0; background: none; color: var(--pf-color-text-secondary);
  font-size: var(--fs-sm); font-weight: var(--pf-font-weight-medium);
}
.changes--inline .changes__btn:hover, .changes--inline .changes__btn[aria-expanded="true"] { color: var(--pf-color-text-highlight); }
.changes--overview .changes__panel {
  max-height: min(var(--changes-panel-max-height, 58vh), 560px);
  padding: 16px 18px;
}
.changes--overview .decisions__item {
  align-items: flex-start;
  gap: 22px;
}
.changes--overview .decisions__area,
.changes--overview .decisions__choice {
  overflow-wrap: anywhere;
}
.changes--overview .decisions__money {
  padding-top: 1px;
}
/* A long list scrolls between a head (Copy link, Reset all) and a foot (the totals) that stay put. */
.changes__panel { display: flex; flex-direction: column; overflow: hidden; }
.changes__panel > .decisions__list { flex: 1 1 auto; min-height: 0; overflow: auto; padding-right: 14px; }   /* room for the scrollbar */
.changes__foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  margin-top: 8px; padding-top: 10px; border-top: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.changes__foot .decisions__money { font-size: var(--fs-sm); margin-left: 4px; }
/* One group per department: its name and net change, folding open to its changes. */
.decisions__group { border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule); }
.decisions__group:last-child { border-bottom: none; }
.decisions__group-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 8px 0; cursor: pointer; list-style: none; font-weight: var(--pf-font-weight-semibold);
}
.decisions__group-head::-webkit-details-marker { display: none; }
.decisions__group-name::before {
  content: "\203A"; display: inline-block; width: 14px; color: var(--text-muted); transition: transform 0.15s;
}
details[open] > .decisions__group-head .decisions__group-name::before { transform: rotate(90deg); }
.decisions__group-head:hover .decisions__group-name { color: var(--pf-color-text-highlight); }
.decisions__group-count { font-weight: 400; color: var(--text-muted); font-size: var(--fs-xs); }
.decisions__group .decisions__list {
  margin: 0 0 8px 5px; padding-left: 12px; border-left: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
}
/* Inside a department the rows are compact: the card's name, then the choice in small type. */
.changes--overview .decisions__group .decisions__item { padding: 4px 0; gap: 12px; border-bottom: 0; }
.decisions__group .decisions__area { font-size: var(--fs-sm); color: var(--text-primary); }
.decisions__group .decisions__choice { font-size: var(--fs-xs); font-weight: 400; color: var(--text-muted); }
.decisions__group .decisions__item .decisions__money { font-size: var(--fs-sm); font-weight: 500; }
/* ---- SEND placement: locked layer + layer hint ------------------------- */
.lever--locked { opacity: 0.5; }
.lever--locked .lever__range { cursor: not-allowed; }
.opt--locked { opacity: 0.5; cursor: not-allowed; }
.opt--locked:hover { background: var(--pf-color-surface-default); }
.result__hint {
  font-size: var(--fs-xs); line-height: 1.45; color: var(--brand-indigo);
  background: var(--indigo-soft); border-radius: 0; padding: 6px 10px; margin-top: 8px;
}

/* Every figure that carries a direction: the words themselves in sage (saves) or copper (costs), the
   legend's colours, set semibold. (Sage is 4.4:1 and copper 3.6:1 on light sand: below WCAG AA for
   body text, chosen over a leading dot for clarity; the sign and "Saves"/"Costs" carry it too.) */
:is(.budget-map__total-delta, .budget-map__split-value, .budget-map__family-delta, .budget-map__item-delta,
  .opt__delta, .decisions__money, .budget-map__panel-change, .panel-all__total, .panel-row__meta,
  .result__change)[data-dir="save"],
.overview-list__change.is-save,
.bubbles-summary [data-dir="save"],
.bubbles__list-delta--save,
.bubbles__chip--save .bubbles__chip-delta { color: var(--c-save); font-weight: 600; }
:is(.budget-map__total-delta, .budget-map__split-value, .budget-map__family-delta, .budget-map__item-delta,
  .opt__delta, .decisions__money, .budget-map__panel-change, .panel-all__total, .panel-row__meta,
  .result__change)[data-dir="cost"],
.overview-list__change.is-cost,
.bubbles-summary [data-dir="cost"],
.bubbles__list-delta--cost,
.bubbles__chip--cost .bubbles__chip-delta { color: var(--c-cost); font-weight: 600; }

/* ---- Polish ------------------------------------------------------------- */
/* Figures line up column to column: every money read-out, bar label and bubble label. */
:is(.overview-sunburst__center-value, .overview-list__value, .overview-list__share, .overview-list__change,
  .budget-map__total-value, .budget-map__total-delta, .budget-map__overview-value, .budget-map__overview-stat,
  .budget-map__split-value, .budget-map__family-value, .budget-map__family-delta, .budget-map__item-value,
  .budget-map__item-delta, .budget-map__panel-change, .budget-drawer__fixed-value, .budget-drawer__funding-split-value,
  .budget-drawer__budget-type-value, .lever__value, .lever__ticks, .opt__delta, .result__change, .decisions__money,
  .panel-all__total, .funding-panel, .changes__count, .bubble-label, .bubbles__row-value, .bubbles__list-delta,
  .bubbles__list-total, .bubbles__chip-value, .bubbles__chip-delta, .bubbles__tip-delta, .bubbles__money-in) {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* The overview stacks only below the 1100px desktop breakpoint. */
@media (max-width: 1099px) {
  .overview-page__body {
    grid-template-columns: 1fr; height: auto; min-height: 0;
  }
  .overview-page__side { overflow: visible; --side-pad: 0px; border-right: 0; }
  .overview-page__side::after { display: none; }
  .paying { margin: var(--pf-space-300) 0 0; padding-inline: 0; }
  .overview-page__chart-panel {
    padding: var(--overview-cell-pad) 0; border-right: 0;
    border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
  }
  .overview-page__side { padding: var(--pf-space-300) 0; }
  .overview-page__intro,
  .overview-detail,
  .overview-page__detail-slot {
    max-width: 680px; width: 100%;
  }
  .overview-sunburst {
    width: min(100%, 560px);
  }
}

@media (max-width: 1180px) {
  .budget-map__families {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* An odd last column would sit alone under the first, its rows stopping at the middle of the page:
     it takes the full width instead. */
  .budget-map__family-column:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  :root {
  }
  .dashboard-body { overflow-x: hidden; }
  .overview-page { padding-top: 18px; overflow-x: hidden; }
  .overview-page__title { font-size: var(--fs-xl); max-width: 310px; }
  .overview-page__lede { font-size: var(--fs-sm); max-width: 310px; }
  .overview-page__body { gap: 18px; min-height: 0; }
  .overview-page__chart-panel { align-items: flex-start; }
  .overview-sunburst { width: min(100%, 300px); }
  .overview-sunburst__label { display: none; }
  .overview-sunburst__center { width: 27%; min-width: 0; }   /* the hole: a 12px label wraps rather than spilling onto the arcs */
  .overview-sunburst__center-label { font-size: var(--fs-xs); }
  .overview-sunburst__center-value { font-size: var(--fs-md); }
  .overview-list__item {
    grid-template-columns: 9px minmax(0, 1fr);
    padding-left: 0;
  }
  .overview-list__label {
    white-space: normal;
  }
  .overview-list__value {
    grid-column: 2;
    align-items: flex-start;
  }
  /* On a phone the page itself scrolls: a capped inner scroll box hid ODA, DCMS and the Total row
     below what looked like the end of the table. */
  .overview-list,
  .overview-detail {
    max-height: none; overflow: visible;
  }
  /* The totals table keeps its value and change columns on a phone: the two-column stack above
     loses to the totals rule's specificity, which put the total on its own line over the share. */
  .overview-list--totals .overview-list__item.has-change {
    grid-template-columns: 9px minmax(0, 1fr) max-content max-content; gap: 8px;
  }
  .overview-list--totals .overview-list__value { grid-column: auto; align-items: flex-end; }
  .overview-list--totals .overview-list__change,
  .overview-list__colhead-change { min-width: 44px; }
  .overview-list__colhead { gap: 8px; }
  .budget-map__header { align-items: flex-start; }
  .budget-map__titlebar { width: 100%; gap: 12px; grid-template-columns: minmax(0, 1fr); }
  .budget-map__titlebar .changes { grid-column: 1; grid-row: auto; justify-self: start; }
  .budget-map__controls { width: 100%; margin-left: 0; }
  .budget-map__control { flex: 1 1 238px; }
  .budget-map__mode,
  .budget-map__mode--scale { width: 100%; }
  .budget-map__mode-btn { padding: 8px 9px; font-size: var(--fs-xs); }
  .budget-map__overview {
    grid-template-columns: 1fr; grid-template-areas: "head" "bar" "stat"; gap: 8px;
  }
  .budget-map__overview-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .budget-map__overview-stat { align-items: flex-start; padding-left: 0; padding-top: 8px; text-align: left; }
  .budget-map__overview-bar {
    height: 68px;
    width: calc(100vw - var(--page-inset-left) - var(--layout-gutter)) !important;
    max-width: 100%;
  }
  .budget-map__overview-segment { padding: 8px 6px; }
  .budget-map__overview-label { font-size: var(--fs-xs); }
  .budget-map__overview-value { font-size: var(--fs-xs); }
  .budget-map__families {
    display: flex; flex-direction: column;
  }
  .budget-map__family-column { display: contents; padding: 0; }
  .budget-map__family { order: var(--visual-order); padding: 14px 0; }
  .budget-map__family::before,
  .budget-map__family + .budget-map__family::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: var(--pf-color-border-rule); pointer-events: none;
  }
  .budget-map__family[data-order="1"]::before { display: none; }
  .budget-map__family-head { grid-template-columns: 1fr; }
  .budget-map__item { gap: 3px 8px; }
  .budget-drawer {
    /* !important beats the docked side rules (.budget-drawer[data-side]) and the desktop top. */
    left: 12px !important; right: 12px !important; top: auto !important; bottom: 12px;
    width: auto; height: auto; max-height: min(78vh, 680px); padding: 18px 16px 20px;
    border: var(--pf-border-width-rule) solid var(--pf-color-border-soft);
  }
  .budget-drawer__head { top: -18px; margin: -18px -16px 14px; padding: 18px 16px 14px; }
  .budget-drawer__title { font-size: var(--fs-lg); }
}

/* Toms radical redesign: nested, zoomable bubbles in the map's own navy and type */
.bubbles-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--pf-space-150) var(--pf-space-400); }
.bubbles-summary__label { font-size: var(--fs-xs); font-weight: 600; color: var(--line-muted); line-height: 1.5; }
.bubbles-summary .budget-map__total-value { font-size: var(--fs-lg); line-height: 1.05; }
.bubbles-summary .budget-map__total-delta { font-size: var(--fs-lg); line-height: 1.05; }
.bubbles-summary .budget-map__split-metrics { align-self: baseline; display: flex; flex-direction: row; align-items: baseline; width: auto; min-width: 0; margin: 0; gap: var(--pf-space-400); }
.bubbles-summary .budget-map__split-row { display: flex; flex-direction: row; align-items: baseline; gap: var(--pf-space-100); }
.bubbles-summary .budget-map__split-label { font-size: var(--fs-xs); font-weight: 600; color: var(--line-muted); line-height: 1.5; }
.bubbles-summary .budget-map__split-value { font-size: var(--fs-lg); line-height: 1.05; color: var(--line-ink); }
.bubbles-summary .budget-map__split-metrics[hidden] { display: none; }
.bubbles-summary .budget-map__split-metrics:has(.budget-map__split-note:not([hidden])) { flex-wrap: wrap; row-gap: 2px; }
.bubbles-summary .budget-map__split-note { width: auto; min-width: 0; flex-basis: 100%; }
.bubbles {
  position: relative; width: 100%; padding: 0; transition: padding-right 0.3s ease; box-sizing: border-box;
  /* Flat brand fills, no halos or heavy outlines: a section is a Sand ground, its lines Teal 40 dots,
     a line you can open Teal 80, Deep Teal on hover; sage and copper only where something changed. */
  --bubbles-muted: var(--pf-teal-80);         /* secondary text: 5.6:1 even on a Sand fill */
  --bubbles-line: var(--pf-teal-80);          /* a line's circle */
  --bubbles-section: var(--pf-sand-sand);     /* a section's circle */
  --bubbles-outline: var(--pf-teal-40);       /* faint inner circles and leaders */
  --bubbles-cost: var(--c-cost);              /* a line that costs more */
  --bubbles-save-ink: var(--c-save);
  --bubbles-cost-ink: var(--c-cost);
}
.bubbles__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 32px; }
.bubbles__crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: var(--fs-sm); }
.bubbles__crumb { font: inherit; font-weight: var(--pf-font-weight-medium); background: none; border: 0; padding: 2px 0; color: var(--pf-color-text-secondary); cursor: pointer; }
.bubbles__crumb:hover { color: var(--pf-color-text-highlight); }
.bubbles__crumb.is-current { color: var(--line-ink); font-weight: 600; cursor: default; }
.bubbles__sep { color: var(--bubbles-muted); }
.bubbles__actions { display: flex; gap: 6px; }
.bubbles__btn { font: inherit; font-size: var(--fs-sm); font-weight: var(--pf-font-weight-semibold); padding: 6px 12px; border-radius: var(--pf-control-radius); border: 1px solid var(--pf-color-border-rule); cursor: pointer; }
.bubbles__btn--primary { background: var(--pf-color-action-primary-default); border-color: var(--pf-color-action-primary-default); color: var(--pf-color-action-primary-text); }
.bubbles__btn--primary:hover { background: var(--pf-teal-80); border-color: var(--pf-teal-80); }
.bubbles__key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 18px; font-size: var(--fs-xs); color: var(--bubbles-muted); }
.bubbles__key-item { display: inline-flex; align-items: center; gap: 5px; }
.bubbles__key-swatch { width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box; }
.bubbles__key-swatch--parts { background: var(--bubbles-section); box-shadow: inset 0 0 0 1px var(--pf-color-border-soft); }
.bubbles__key-swatch--line { background: var(--bubbles-line); }
.bubbles__key-swatch--save { background: var(--c-save); }
.bubbles__key-swatch--cost { background: var(--bubbles-cost); }
.bubbles__body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 32%); gap: 0 18px; align-items: start;
}
.bubbles__chart { grid-area: 1 / 1; padding-top: 12px; min-width: 0; position: relative; }
.bubbles__side { grid-area: 1 / 2; }
.bubbles.has-card .bubbles__body { grid-template-columns: minmax(0, 1fr); }
.bubbles.has-card .bubbles__side { display: none; }
.bubbles__tip { position: absolute; z-index: 3; pointer-events: none; max-width: 240px; padding: 7px 10px; border-radius: var(--pf-control-radius); background: var(--pf-sand-sand); color: var(--pf-color-text-primary); font-size: var(--fs-xs); line-height: 1.35; box-shadow: none; display: flex; flex-direction: column; gap: 1px; }
.bubbles__tip[hidden] { display: none; }
.bubbles__tip-name { font-weight: 600; }
.bubbles__tip-fig { color: var(--pf-color-text-secondary); }
.bubbles__tip-tag { color: var(--pf-color-text-secondary); font-style: italic; }
.bubbles__tip-delta { font-weight: 600; }
.bubbles__tip-delta--save { color: var(--c-save); }
.bubbles__tip-delta--cost { color: var(--c-cost); }
.bubble-leader { stroke: var(--bubbles-outline); stroke-width: 1; }
.bubble-label.bubble-label--outside { fill: var(--line-ink); paint-order: stroke; stroke: var(--pf-color-surface-default); stroke-width: 3px; stroke-linejoin: round; }
.bubble-label.bubble-label--outside .bubble-label__value { fill: var(--bubbles-muted); }
.bubble-label.bubble-label--outside .bubble-label__name { font-weight: 600; }
.bubbles__svg { display: block; margin: 0 auto; max-width: 100%; height: auto; overflow: hidden; }
.bubbles__zoom { transform-origin: 0 0; transition: transform 0.65s cubic-bezier(.3,.1,.2,1); }
.bubble { outline: none; }
.bubble__disc { fill: var(--pf-base-white); stroke: var(--bubbles-outline); stroke-width: 1; transition: r 0.5s ease, cx 0.5s ease, cy 0.5s ease, fill 0.3s ease, stroke 0.3s ease, opacity 0.4s ease; }
.bubble[data-role="hidden"] { display: none; }
/* The circle you are inside: none at the top, a soft ground once zoomed in. */
.bubble[data-role="focus"][data-depth="0"] { display: none; }
.bubble[data-role="focus"] .bubble__disc { fill: var(--pf-sand-sand); stroke: none; }
.bubble[data-role="child"] { cursor: pointer; }
/* One rule: a pale circle has parts (zoom in); a teal fill is a line to adjust; sage or copper has changed. */
.bubble[data-role="child"].has-parts .bubble__disc { fill: var(--bubbles-section); stroke: none; }
.bubble[data-role="child"]:not(.has-parts) .bubble__disc { fill: var(--bubbles-line); stroke: none; }
.bubble[data-role="child"].is-hover .bubble__disc, .bubble[data-role="child"]:focus-visible .bubble__disc { stroke: var(--pf-color-text-primary); stroke-width: 1; }
.bubble[data-role="child"]:not(.has-parts).is-hover .bubble__disc { fill: var(--pf-color-text-primary); }
.bubble[data-role="child"].is-active .bubble__disc { stroke: var(--pf-color-text-primary); stroke-width: 1.5; }
.bubble[data-role="grandchild"] .bubble__disc { fill: var(--pf-teal-40); stroke: none; opacity: 1; pointer-events: none; }
/* A changed line inside a section shows its colour from the level above, so changes are visible without zooming in. */
.bubble[data-role="grandchild"][data-dir="save"] .bubble__disc { fill: var(--c-save); opacity: 1; }
.bubble[data-role="grandchild"][data-dir="cost"] .bubble__disc { fill: var(--bubbles-cost); opacity: 1; }
.bubble[data-role="child"].has-parts[data-dir="save"] .bubble__disc { fill: var(--bubbles-section); stroke: var(--c-save); stroke-width: 1.5; }
.bubble[data-role="child"].has-parts[data-dir="cost"] .bubble__disc { fill: var(--bubbles-section); stroke: var(--bubbles-cost); stroke-width: 1.5; }
.bubble[data-role="child"]:not(.has-parts)[data-dir="save"] .bubble__disc { fill: var(--c-save); }
.bubble[data-role="child"]:not(.has-parts)[data-dir="cost"] .bubble__disc { fill: var(--bubbles-cost); }
/* A display copy: the same money counted in another section, drawn as a dashed outline that adds nothing here. */
.bubble.is-display .bubble__disc, .bubble.is-display[data-dir] .bubble__disc { fill: none; stroke: var(--pf-teal-60); stroke-width: 1; stroke-dasharray: 4 3; opacity: 1; }
.bubble[data-role="child"].is-display.is-hover .bubble__disc { fill: var(--pf-sand-sand); stroke: var(--pf-color-text-primary); stroke-width: 1; }
.bubbles__labels { pointer-events: none; transition: opacity 0.25s ease; }
.bubbles__labels.is-hidden { opacity: 0; }
.bubble-label { font-family: var(--pf-font-stack); fill: var(--pf-base-white); }
.bubble-label__name { font-weight: 600; }
.bubble-label__value { font-weight: 600; fill: rgb(255 255 255 / 0.85); }
.bubble-label--parent { fill: var(--line-ink); paint-order: stroke; stroke: var(--bubbles-section); stroke-width: 3px; stroke-linejoin: round; }
.bubble-label--parent .bubble-label__value { fill: var(--bubbles-muted); }
.bubbles__side { position: relative; align-self: stretch; border-left: var(--pf-border-width-rule) solid var(--pf-color-border-soft); padding-left: 0; max-height: 620px; overflow: auto; }
.bubbles__list-head { border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule); }
.bubbles__list-head-static, .bubbles__list-head-btn { row-gap: 2px; padding: 6px 16px 8px; width: 100%; box-sizing: border-box; }
.bubbles__list-head-btn { font: inherit; text-align: left; background: none; border: 0; cursor: pointer; border-radius: 0; }
.bubbles__list-head-btn:hover { background: var(--pf-color-surface-mist); }
.bubbles__list-adjust { flex-basis: 100%; font-size: var(--fs-xs); font-weight: 600; color: var(--bubbles-line); grid-column: 1 / -1; }
.bubbles__list-head-btn:hover .bubbles__list-adjust { color: var(--pf-color-text-highlight); text-decoration: underline; }
.bubbles__list-title { font-size: var(--fs-md); font-weight: 600; color: var(--line-ink); }
.bubbles__list-total { font-size: var(--fs-sm); font-weight: 600; color: var(--line-ink); white-space: nowrap; justify-self: end; }
.bubbles__list { list-style: none; margin: 0; padding: 0; }
.bubbles__row { border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft); transition: border-color var(--pf-duration-fast) var(--pf-easing-standard); }
.bubbles__row:has(.bubbles__row-btn:hover), .bubbles__row.is-hover, .bubbles__row.is-active { border-bottom-color: var(--pf-color-border-rule); }
.bubbles__row-btn { width: 100%; padding: 7px 16px; font: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.bubbles__row.is-hover .bubbles__row-btn, .bubbles__row-btn:hover { background: var(--pf-color-surface-mist); }
.bubbles__row.is-active .bubbles__row-btn { background: var(--pf-color-surface-mist); }
.bubbles__row-name { font-size: var(--fs-sm); font-weight: var(--pf-font-weight-clear); color: var(--line-ink); line-height: 1.25; }
.bubbles__row-sub { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 500; color: var(--bubbles-muted); }
/* Spending and income rows share four columns, so figures line up down the whole panel. */
.bubbles__row-btn, .bubbles__money-in .bubbles__chip, .bubbles__list-head-static, .bubbles__list-head-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; align-items: baseline; column-gap: 8px;
}
.bubbles__row-figs { display: contents; }
.bubbles__row-value, .bubbles__chip-value, .bubbles__list-delta, .bubbles__chip-delta { justify-self: end; white-space: nowrap; }
.bubbles__row-value { font-size: var(--fs-sm); font-weight: 500; color: var(--line-ink); font-variant-numeric: tabular-nums; }
.bubbles__list-delta { font-size: var(--fs-xs); font-weight: 600; }
.bubbles__list-delta--save { color: var(--bubbles-save-ink); }
.bubbles__list-delta--cost { color: var(--bubbles-cost-ink); }
.bubbles__money-in { position: relative; display: flex; flex-direction: column; margin: var(--pf-space-300) 0 0; }
.bubbles__money-in .bubbles__changes-label {
  padding: 6px 16px 8px; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule);
  font-size: var(--fs-md); font-weight: 600; color: var(--line-ink); margin: 0;
}
.bubbles__money-in .bubbles__chip {
  width: 100%;
  padding: 7px 16px; border: 0; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-soft); border-radius: 0;
  background: none; text-align: left; font: inherit; font-size: var(--fs-sm); color: var(--line-ink); cursor: pointer;
}
.bubbles__money-in .bubbles__chip:hover { background: var(--pf-color-surface-mist); border-bottom-color: var(--pf-color-border-rule); }
.bubbles__money-in[hidden] { display: none; }

.bubbles__chip-value { font-size: var(--fs-sm); font-weight: 500; color: var(--line-ink); font-variant-numeric: tabular-nums; }
.bubbles__info { position: relative; top: auto; left: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--pf-space-200); padding: var(--pf-space-150) 0 0; }
/* Key on the left, the "i" at the top right of the chart, its note opening under it to the left. */
.bubbles__info > .overview-page__info-btn { order: 2; }
.bubbles__info > .bubbles__actions { order: 1; margin-left: auto; }
.bubbles__info > .budget-map__key { order: 0; }
.bubbles__info > .overview-page__info-tip { left: auto; right: 0; }
/* List view: the key is the chart area's first line, as in bubbles. */
.budget-map__workspace > .budget-map__key { padding: var(--pf-space-150) 0 var(--pf-space-100); }
.bubbles.is-empty .bubbles__info .overview-page__info-tip { opacity: 1; visibility: visible; }   /* "no lines": always shown */
/* Changes strip */
.bubbles__changes-label { font-size: var(--fs-xs); font-weight: 600; color: var(--bubbles-muted); margin-right: 2px; }
.bubbles__chip { display: inline-flex; align-items: baseline; gap: 6px; font: inherit; font-size: var(--fs-xs); padding: 4px 10px; border-radius: var(--pf-control-radius); border: 0; background: var(--pf-sand-sand); cursor: pointer; }
.bubbles__chip:hover { background: var(--pf-sand-stone); }
.bubbles__chip-name { font-weight: 600; color: var(--line-ink); }
.bubbles__chip-delta { font-weight: 600; }
.bubbles__chip--save { background: rgb(153 185 168 / 0.4); }
.bubbles__chip--save .bubbles__chip-delta { color: var(--bubbles-save-ink); }
.bubbles__chip--cost { background: var(--pf-copper-20); }
.bubbles__chip--cost .bubbles__chip-delta { color: var(--bubbles-cost-ink); }
.bubbles__list-sub { padding: 12px 4px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--bubbles-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: var(--pf-border-width-rule) solid var(--pf-color-border-rule); }

/* MHCLG context: "How councils are funded" panel and grant share bars. Context only, never counted. */
.funding-panel { margin: 0; }
.runby-key { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; margin: 0 0 12px; }
.runby-key__item { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-muted); }
/* Inside a context row: the row's rules frame it, so it draws none of its own. */
.funding-panel__body { border: 0; border-radius: 0; background: none; margin-top: 0; }
.funding-panel__body[hidden] { display: none; }
.funding-panel__intro { font-size: var(--fs-xs); color: var(--line-muted); margin: 0 0 8px; line-height: 1.45; }
.result__councils { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.result__councils-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.result__councils .result__marker-note { margin-top: 4px; }
.result__councils .result__marker-note + .result__marker-note { padding-top: 0; border-top: 0; }
.result__councils .share-bar__link { font-size: var(--fs-sm); }
.funding-panel__track { width: 100%; }
.funding-panel__bar { display: flex; height: 30px; border-radius: 0; overflow: hidden; transition: width 0.2s; }
.funding-panel__seg { display: flex; align-items: center; padding: 0 8px; min-width: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--pf-dataviz-chart-label-on-dark); background: var(--pf-dataviz-emphasis-context-high-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funding-panel__seg.is-own { background: var(--pf-base-white); color: var(--pf-color-text-secondary); border: 1px dashed var(--pf-teal-40); }
.funding-panel__seg + .funding-panel__seg { border-left: 1px solid var(--pf-color-surface-default); }
.share-bar { margin: 8px 0 12px; }
.share-bar__track { display: flex; height: 6px; border-radius: 0; overflow: hidden;
  background: linear-gradient(var(--pf-dataviz-chart-baseline), var(--pf-dataviz-chart-baseline)) left bottom / 100% 1px no-repeat; }
.share-bar__fill { display: block; height: 100%; background: var(--pf-dataviz-emphasis-context-high-ink); transition: width 0.3s ease; }
.share-bar__text { font-size: var(--fs-xs); color: var(--line-muted); margin: 5px 0 0; }
.share-bar__link { padding: 0; border: 0; background: none; color: var(--brand-indigo); font: inherit; text-decoration: underline; cursor: pointer; }
.funding-panel__seg-text { overflow: hidden; text-overflow: ellipsis; }
.funding-panel__key { display: none; list-style: none; margin: 8px 0 0; padding: 0; font-size: var(--fs-xs); color: var(--line-muted); }
.funding-panel__key li { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.funding-panel__key.is-needed { display: block; }
.funding-panel__swatch { width: 12px; height: 12px; border-radius: 0; background: var(--pf-dataviz-emphasis-context-high-ink); flex: none; }
.funding-panel__swatch.is-own { background: var(--pf-base-white); border: 1px dashed var(--pf-teal-40); }
.funding-panel__live { font-size: var(--fs-sm); color: var(--text-primary); margin: 10px 0 0; line-height: 1.45; }
.funding-panel .caveat { margin-top: 8px; }
.funding-panel__seg.is-other, .funding-panel__swatch.is-other { background: var(--pf-teal-80); color: var(--pf-base-white); }
@media (max-width: 860px) {
  .bubbles__body { grid-template-columns: minmax(0, 1fr); }
  .bubbles__side { grid-area: 2 / 1; border-left: 0; padding-left: 0; max-height: none; }
  .bubbles__list-head-static, .bubbles__list-head-btn, .bubbles__row-btn { padding-left: 4px; }
  .bubbles__row:last-child { border-bottom: 0; }
}
@media (max-width: 700px) {
  .barnett-table--page { font-size: var(--fs-xs); }
  .barnett-table--page th, .barnett-table--page td { padding: 4px 3px; }
  .funding-panel__seg-text { display: none; }
  .funding-panel__key { display: block; }
}
.bubbles__bar[hidden] { display: none; }
