/* Build a plan (#/build). Every class starts with bp- so these rules stay on this page.
   Colors come only from WONK tokens. */

.bp-layout { display: grid; gap: var(--ak-s8); align-items: start; }
.bp-controls-col { min-width: 0; display: grid; gap: var(--ak-s6); }
.bp-col-title { font-size: var(--ak-text-xl); margin: 0; }
.bp-col-title:focus { outline: none; }
.bp-muted { color: var(--ak-ink-3); }

/* ---- control groups ---- */
.bp-controls { display: grid; gap: var(--ak-s6); min-width: 0; container: bpctl / inline-size; }
.bp-group { border: 0; margin: 0; padding: var(--ak-s4) 0 0; min-width: 0; border-top: var(--ak-hairline-w) solid var(--ak-hairline); }
.bp-group > legend {
  float: left; width: 100%; padding: 0; margin: 0 0 var(--ak-s1);
  display: flex; align-items: center; gap: var(--ak-s2);
  font-weight: 700; font-size: var(--ak-text-lg); line-height: 1.25; color: var(--ak-ink);
}
.bp-group > legend + * { clear: both; }
.bp-step {
  display: inline-grid; place-items: center; flex: none; width: 1.5rem; height: 1.5rem;
  border-radius: var(--ak-radius); background: var(--ak-ink); color: var(--ak-ground);
  font-family: var(--ak-font-mono); font-size: var(--ak-text-xs); font-weight: 700;
}
.wonk .bp-hint { margin: 0 0 var(--ak-s3); max-width: 40rem; }
.bp-hint-line { display: block; }
.bp-hint-line + .bp-hint-line { margin-top: var(--ak-s1); }
.bp-def .wonk-term { color: var(--ak-ink-2); font-weight: 600; }
/* a short status line under a group whose choice has nothing to act on */
.wonk .bp-off { margin: var(--ak-s2) 0 0; font-size: var(--ak-text-sm); font-weight: 600; color: var(--ak-ink-2); }
.bp-off[hidden] { display: none; }
.bp-sub { margin: 0; font-weight: 700; font-size: var(--ak-text-sm); color: var(--ak-ink); }
.wonk .bp-src { margin: var(--ak-s2) 0 0; font-size: var(--ak-text-xs); color: var(--ak-ink-3); }

/* 1. start from */
.bp-presets { display: flex; flex-wrap: wrap; gap: var(--ak-s2); }
.bp-preset { min-height: 2.75rem; }
.bp-preset[aria-pressed="true"] { background: var(--ak-a1); border-color: var(--ak-a1); color: var(--ak-a1-ink); font-weight: 700; }
.bp-preset[aria-pressed="true"]:not([disabled]):hover { background: var(--ak-a1); filter: brightness(1.1); }
.bp-bversion { display: grid; gap: var(--ak-s3); margin-top: var(--ak-s4); padding: var(--ak-s3) var(--ak-s4) var(--ak-s4); border: 1px dashed var(--ak-hairline-strong); border-radius: var(--ak-radius); }
.bp-bversion .wonk-field { margin: 0; min-width: 0; gap: var(--ak-s1); }
.bp-bversion .wonk-select { width: 100%; min-width: 0; }
.wonk .bp-bversion-hint { margin: var(--ak-s3) 0 0; font-size: var(--ak-text-sm); color: var(--ak-ink-3); }
/* inside a dashed box the hint sits close under its title; outside, it must clear the box's border */
.wonk .bp-bversion .bp-bversion-hint { margin: calc(-1 * var(--ak-s2)) 0 0; }
.wonk .bp-matched { margin: var(--ak-s3) 0 0; font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
.wonk .bp-undo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ak-s2); margin: var(--ak-s2) 0 0; font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
.bp-undo[hidden] { display: none; }
.bp-undo-btn { padding: 0.3rem 0.6rem; border-color: var(--ak-hairline-strong); }

/* 2. valley school cards */
.bp-schools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ak-s3); }
.wonk-check.bp-school {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--ak-s3);
  padding: var(--ak-s3); border: 1px solid var(--ak-hairline-strong); border-radius: var(--ak-radius);
  background: var(--ak-surface-2); color: var(--ak-ink-2); line-height: 1.4;
}
.wonk-check.bp-school input { margin-top: 0.1rem; }
.bp-school:has(input:checked) { border-color: var(--ak-a1); background: var(--ak-wash); box-shadow: inset 0 0 0 1px var(--ak-a1); }
.bp-school.is-closed { border-style: dashed; background: transparent; }
.bp-school:has(input:focus-visible) { outline: 2px solid var(--ak-a1-text); outline-offset: 2px; }
.wonk .bp-school input:focus-visible { outline: none; }
.bp-school-name { display: block; font-weight: 700; font-size: var(--ak-text-md); color: var(--ak-ink); }
.bp-school.is-closed .bp-school-name { text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: var(--ak-ink-3); }
.bp-school-facts { display: block; font-size: var(--ak-text-sm); color: var(--ak-ink-2); font-variant-numeric: tabular-nums; }
.bp-school-facts > span:not(.wonk-sr):not(.bp-dot) { display: block; }
.bp-dot { display: none; }
.bp-school-status { display: block; margin-top: var(--ak-s2); padding-top: var(--ak-s2); border-top: 1px solid var(--ak-hairline); font-size: var(--ak-text-sm); font-weight: 600; color: var(--ak-ink); }
/* a narrow controls column (phones, or two columns on a small laptop): one card per row, facts run together */
@container bpctl (max-width: 27rem) {
  .bp-schools { grid-template-columns: minmax(0, 1fr); }
  .bp-school-facts > span:not(.wonk-sr):not(.bp-dot) { display: inline; }
  .bp-dot { display: inline; color: var(--ak-ink-3); }
  .bp-school-status { margin-top: var(--ak-s1); padding-top: var(--ak-s1); }
}
.bp-allclosed:empty { display: none; }
.bp-allclosed { margin-top: var(--ak-s3); }

/* 3-4. radio choices, stacked */
.choice.bp-choice-stack { display: grid; gap: var(--ak-s2); }
.choice.bp-choice-stack label { display: flex; align-items: flex-start; gap: var(--ak-s3); padding: var(--ak-s3); font-size: var(--ak-text-md); line-height: 1.35; }
.choice.bp-choice-stack input { margin-top: 0.2rem; flex: none; width: 1rem; height: 1rem; }
.choice.bp-choice-stack label:has(input:disabled) { cursor: not-allowed; border-style: dashed; background: transparent; box-shadow: none; color: var(--ak-ink-2); }
.bp-choice-title { display: block; font-weight: 600; color: var(--ak-ink); }
.bp-choice-sub { display: block; margin-top: 0.15rem; font-size: var(--ak-text-sm); color: var(--ak-ink-2); }

/* 5. program cuts */
.bp-cuts { display: grid; border-top: 1px solid var(--ak-hairline); }
.wonk-check.bp-cut {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--ak-s1) var(--ak-s3);
  padding: var(--ak-s3) var(--ak-s2); border-bottom: 1px solid var(--ak-hairline); color: var(--ak-ink-2); line-height: 1.4;
  border-radius: 0;
}
.wonk-check.bp-cut:hover { background: var(--ak-hover); }
.wonk-check.bp-cut input { margin-top: 0.15rem; }
.bp-cut:has(input:checked) { background: var(--ak-wash); }
.bp-cut:has(input:checked) .bp-cut-detail { color: var(--ak-ink-2); }
.bp-cut-name { display: block; font-weight: 600; font-size: var(--ak-text-md); color: var(--ak-ink); }
.bp-cut-detail { display: block; font-size: var(--ak-text-sm); color: var(--ak-ink-3); }
.bp-cut-amt { font-family: var(--ak-font-mono); font-variant-numeric: tabular-nums; font-size: var(--ak-text-sm); font-weight: 600; color: var(--ak-ink); white-space: nowrap; padding-top: 0.15rem; }

/* 6. building fixes */
.bp-fix { display: grid; gap: var(--ak-s1); padding: var(--ak-s3); border: 1px solid var(--ak-hairline); border-radius: var(--ak-radius); background: var(--ak-surface-2); }
.wonk-check.bp-fix-check { align-items: flex-start; gap: var(--ak-s3); font-size: var(--ak-text-md); color: var(--ak-ink); line-height: 1.35; }
.wonk-check.bp-fix-check input { margin-top: 0.1rem; flex: none; }
.bp-fix-name { font-weight: 600; }
.wonk .bp-fix-note { margin: 0; font-size: var(--ak-text-sm); color: var(--ak-ink-3); }
.bp-fix > .bp-fix-note { padding-left: calc(18px + var(--ak-s3)); }
.bp-fix-off { padding-left: calc(18px + var(--ak-s3)); font-size: var(--ak-text-sm); font-weight: 600; color: var(--ak-ink-2); }
.bp-fix.is-off .bp-fix-check { color: var(--ak-ink-3); cursor: not-allowed; }
.bp-portables { display: grid; gap: var(--ak-s2); margin-top: var(--ak-s4); }
.bp-ports { display: grid; border-top: 1px solid var(--ak-hairline); }
.bp-port {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name step" "have step" "extra step";
  align-items: center; column-gap: var(--ak-s3); padding: var(--ak-s2) 0; border-bottom: 1px solid var(--ak-hairline);
}
.bp-port[hidden] { display: none; }
.bp-port-name { grid-area: name; font-weight: 600; color: var(--ak-ink); }
.bp-port-have { grid-area: have; font-size: var(--ak-text-sm); color: var(--ak-ink-3); }
.bp-port-extra { grid-area: extra; font-family: var(--ak-font-mono); font-size: var(--ak-text-xs); font-weight: 600; color: var(--ak-a1-text); }
.bp-port-extra:empty { display: none; }
.bp-port .bp-stepper { grid-area: step; }

/* number steppers (portables and class sizes) */
.bp-stepper { display: inline-flex; align-items: stretch; }
.bp-step-btn {
  display: inline-grid; place-items: center; width: 2.75rem; min-height: 2.75rem; padding: 0;
  font-family: var(--ak-font-mono); font-size: var(--ak-text-lg); line-height: 1; color: var(--ak-ink);
  background: var(--ak-surface-2); border: 1px solid var(--ak-hairline-strong); cursor: pointer;
}
.bp-step-btn:first-child { border-radius: var(--ak-radius) 0 0 var(--ak-radius); border-right: 0; }
.bp-step-btn:last-child { border-radius: 0 var(--ak-radius) var(--ak-radius) 0; border-left: 0; }
.bp-step-btn:hover { background: var(--ak-hover); }
.bp-step-btn:active { background: var(--ak-active); }
.wonk-input.bp-num {
  width: 3.25rem; min-height: 2.75rem; padding: 0.3rem 0.25rem; border-radius: 0; text-align: center;
  font-family: var(--ak-font-mono); font-weight: 700; font-variant-numeric: tabular-nums;
  border-color: var(--ak-hairline-strong); -moz-appearance: textfield; appearance: textfield;
}
.bp-num::-webkit-inner-spin-button, .bp-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.wonk-input.bp-num:focus-visible { position: relative; z-index: 1; }

/* 7. advanced */
.bp-advanced > summary { font-size: var(--ak-text-md); font-weight: 600; color: var(--ak-ink); }
.bp-advanced > .body { max-width: none; display: grid; gap: var(--ak-s6); padding-top: var(--ak-s2); }
.bp-subgroup { border: 0; margin: 0; padding: 0; min-width: 0; }
.bp-subgroup > legend { padding: 0; margin-bottom: var(--ak-s1); font-weight: 700; font-size: var(--ak-text-md); color: var(--ak-ink); }
.bp-subgroup .hint { margin: 0 0 var(--ak-s3); }
.bp-cs { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--ak-s3); margin-bottom: var(--ak-s2); }
.bp-cs-field { margin: 0; }
.bp-recv { margin-bottom: var(--ak-s3); }
.bp-recv[hidden], .bp-recv-field[hidden], .bp-recv-only[hidden], .bp-recv-none[hidden] { display: none; }
.bp-recv-field { margin: 0; max-width: 22rem; }
.wonk .bp-recv-only, .wonk .bp-recv-none { margin: 0; font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
/* a closed town's shares: the school that takes the rest, then a percent stepper for each other open school */
.bp-shares { margin-top: var(--ak-s3); padding-left: var(--ak-s3); border-left: 2px solid var(--ak-hairline-strong); }
.bp-shares[hidden] { display: none; }
.bp-share-src { font-weight: 400; color: var(--ak-ink-3); }
.wonk .bp-share-main { margin: var(--ak-s1) 0 var(--ak-s2); font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
.bp-share {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name step" "n step";
  align-items: center; column-gap: var(--ak-s3); padding: var(--ak-s2) 0; border-top: 1px solid var(--ak-hairline);
}
.bp-share-name { grid-area: name; font-weight: 600; color: var(--ak-ink); }
.bp-share-n { grid-area: n; font-family: var(--ak-font-mono); font-size: var(--ak-text-xs); color: var(--ak-ink-3); }
.bp-share .bp-stepper { grid-area: step; }
.wonk .bp-share-btns { display: flex; flex-wrap: wrap; gap: var(--ak-s2); margin: var(--ak-s2) 0 0; }

/* ---- results ---- */
.bp-results { min-width: 0; background: var(--ak-surface); border: 1px solid var(--ak-hairline); border-radius: var(--ak-radius); scroll-margin-top: 4.5rem; }
.bp-results-head { padding: var(--ak-s4) var(--ak-s6); border-bottom: 1px solid var(--ak-hairline); background: var(--ak-surface); border-radius: var(--ak-radius) var(--ak-radius) 0 0; container: bphead / inline-size; }
.wonk .bp-results-match { margin: var(--ak-s1) 0 0; font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
.bp-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ak-s3); margin-top: var(--ak-s3); }
/* "Back to your choices": at the top of the results and after Share, on screens where the results sit below the controls */
.bp-back { min-height: 2.75rem; }
.bp-results-head .bp-back { margin-top: var(--ak-s3); }
.bp-kpi { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.bp-kpi .wonk-label { font-size: var(--ak-text-xs); line-height: 1.3; }
.bp-kpi-val { font-size: var(--ak-text-lg); line-height: 1.2; color: var(--ak-ink); }
.bp-kpi-sub { font-size: var(--ak-text-xs); color: var(--ak-ink-2); line-height: 1.3; }
.bp-kpi-sub .status { white-space: normal; }
@container bphead (max-width: 26rem) {
  .bp-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--ak-s3); }
}
.bp-results-body { padding: var(--ak-s6); display: grid; gap: var(--ak-s8); min-width: 0; container: bpres / inline-size; }
.bp-share { padding: var(--ak-s6); border-top: 1px solid var(--ak-hairline); }
@media (max-width: 640px) {
  .bp-results-head { padding: var(--ak-s4); }
  .bp-results-body, .bp-share { padding: var(--ak-s4); }
}

/* sections */
.bp-sec { display: grid; gap: var(--ak-s3); min-width: 0; }
.bp-sec > h3 { margin: 0; font-size: var(--ak-text-xl); }
.bp-sec h4 { margin: var(--ak-s3) 0 0; font-size: var(--ak-text-md); color: var(--ak-ink); }
.wonk .bp-sec p { margin: 0; }
.wonk .bp-sec .wonk-fold { margin-top: var(--ak-s1); }
.wonk .bp-sec .wonk-fold li + li { margin-top: var(--ak-s2); }
.bp-sec .prov, .bp-sec .cite { margin-left: 0.2em; }
.bp-sec .prov + .cite { margin-left: 0.6em; }
.wonk .bp-lead { font-size: var(--ak-text-lg); line-height: 1.35; color: var(--ak-ink-2); }
.wonk .bp-note { font-size: var(--ak-text-sm); color: var(--ak-ink-2); margin-top: calc(-1 * var(--ak-s1)); }

/* budget */
.wonk .bp-verdict { font-size: var(--ak-text-xl); line-height: 1.25; margin: 0; }
.bp-verdict .status { white-space: normal; }
/* why a plan may fall short: under the headline, at reading size */
.bp-verdict-why { display: block; margin-top: var(--ak-s1); font-size: var(--ak-text-md); line-height: 1.4; font-weight: 500; color: var(--ak-ink-2); }
.bp-meter { display: grid; gap: var(--ak-s1); }
.bp-meter .meter { height: 1.1rem; }
.bp-meter-scale { position: relative; height: 1.4rem; font-family: var(--ak-font-mono); font-size: var(--ak-text-xs); color: var(--ak-ink-2); }
.bp-meter-zero { position: absolute; left: 0; top: 0; }
.bp-meter-target { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; font-weight: 600; color: var(--ak-ink); }
.bp-meter-target.is-end { transform: translateX(-100%); }
.bp-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ak-hairline); }
.bp-items > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--ak-s1) var(--ak-s3); padding: var(--ak-s2) 0; border-bottom: 1px solid var(--ak-hairline); }
.bp-item-name { font-weight: 600; color: var(--ak-ink); }
.bp-item-amt { font-family: var(--ak-font-mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ak-ink); text-align: right; white-space: nowrap; }
.bp-item-amt.bp-unknown { font-family: var(--ak-font-sans); font-weight: 500; color: var(--ak-ink-2); }
.bp-item-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--ak-s1) var(--ak-s2); font-size: var(--ak-text-sm); color: var(--ak-ink-3); }
.bp-item-meta .prov, .bp-item-meta .cite { margin-left: 0; }
.bp-item-note { flex-basis: 100%; }
.bp-items > li.bp-total { border-bottom: 0; }
.bp-items > li.bp-total .bp-item-name, .bp-items > li.bp-total .bp-item-amt { font-weight: 700; font-size: var(--ak-text-md); }
.bp-empty { color: var(--ak-ink-2); font-style: italic; }
.bp-onetime { display: grid; gap: var(--ak-s2); padding: var(--ak-s3) var(--ak-s4); border: 1px dashed var(--ak-hairline-strong); border-radius: var(--ak-radius); }
.bp-onetime h4 { margin: 0; }
.bp-onetime .bp-items { border-top: 0; }
.bp-onetime .bp-items > li:last-child { border-bottom: 0; }
@container bpres (max-width: 24rem) {
  .bp-onetime .bp-items > li { grid-template-columns: minmax(0, 1fr); }
  .bp-onetime .bp-item-amt { text-align: left; }
}

/* buildings */
.bp-source { font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
.bp-caps { display: grid; gap: var(--ak-s4); }
.bp-cap-school { display: grid; gap: var(--ak-s2); padding-top: var(--ak-s3); border-top: 1px solid var(--ak-hairline); }
.bp-cap-school h4 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ak-s1) var(--ak-s3); }
.bp-receives { font-size: var(--ak-text-sm); font-weight: 500; color: var(--ak-ink-2); }
.bp-cap-school .cap { gap: var(--ak-s2); }
/* narrow by default (browsers without container queries keep this): name and numbers on one line, the bar and
   the verdict under them */
.bp-cap-school .cap-row {
  grid-template-columns: minmax(0, 1fr) 9.25rem; grid-template-areas: "name nums" "bar status";
  gap: var(--ak-s1) var(--ak-s3);
}
.bp-cap-school .cap-row .name { grid-area: name; }
.bp-cap-school .cap-row .cap-bar { grid-area: bar; }
.bp-cap-school .cap-row .nums { grid-area: nums; }
.bp-cap-school .cap-row .bp-cap-status { grid-area: status; text-align: right; }
.bp-cap-school .cap-row .name { font-weight: 500; font-size: var(--ak-text-sm); color: var(--ak-ink-2); }
.bp-cap-status { font-size: var(--ak-text-sm); }
.bp-cap-status .status { font-weight: 500; }
/* wide: one line each, name, bar, numbers, verdict */
@container bpres (min-width: 30.01rem) {
  .bp-cap-school .cap-row { grid-template-columns: 5.75rem minmax(0, 1fr) 9.25rem 6.75rem; grid-template-areas: "name bar nums status"; gap: var(--ak-s2) var(--ak-s3); }
  .bp-cap-school .cap-row .bp-cap-status { text-align: left; }
}
.wonk .bp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ak-s2); margin-top: var(--ak-s1); font-size: var(--ak-text-xs); color: var(--ak-ink-3); }
.bp-legend-bar { position: relative; display: inline-block; width: 3rem; height: 0.75rem; background: var(--ak-surface-2); border: 1px solid var(--ak-hairline); border-radius: 3px; }
.bp-legend-fill { position: absolute; inset: 0 auto 0 0; width: 55%; background: var(--ak-a1); border-radius: 2px; }
.bp-legend-line { position: absolute; top: -0.3rem; bottom: -0.3rem; left: 75%; width: 2px; background: var(--ak-ink); }

/* students */
.bp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ak-s3); }
.bp-stat { padding: var(--ak-s3); border: 1px solid var(--ak-hairline); border-radius: var(--ak-radius); background: var(--ak-surface-2); min-width: 0; }
.bp-stat .bp-stat-num { font-size: var(--ak-text-2xl); line-height: 1.1; color: var(--ak-ink); }
.bp-stat .bp-stat-sub { line-height: 1.35; }
@container bpres (max-width: 27rem) {
  .bp-stats { grid-template-columns: minmax(0, 1fr); gap: var(--ak-s2); }
  .wonk-stat.bp-stat { display: grid; grid-template-columns: 4rem minmax(0, 1fr); grid-template-areas: "num label" "num sub"; align-items: center; column-gap: var(--ak-s3); row-gap: 0; padding: var(--ak-s2) var(--ak-s3); }
  .bp-stat .bp-stat-num { grid-area: num; text-align: center; }
  .bp-stat .bp-stat-label { grid-area: label; }
  .bp-stat .bp-stat-sub { grid-area: sub; }
}
.bp-towns { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ak-s2); }
@container bpres (max-width: 24rem) { .bp-towns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bp-towns > li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--ak-s2); padding: var(--ak-s2) var(--ak-s3); border: 1px solid var(--ak-hairline); border-radius: var(--ak-radius); background: var(--ak-surface-2); font-size: var(--ak-text-sm); min-width: 0; }
.bp-towns > li.is-more { border-color: var(--ak-a1); }
.bp-town { color: var(--ak-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bp-town-n { white-space: nowrap; }
.bp-town-n strong { font-size: var(--ak-text-md); }
.bp-town-n small { color: var(--ak-a1-text); font-family: var(--ak-font-mono); font-weight: 600; }
.bp-moves ul { margin: var(--ak-s2) 0 0; padding-left: var(--ak-s6); }
.bp-moves li + li { margin-top: var(--ak-s1); }
.bp-sec .heat-block { display: grid; gap: var(--ak-s2); margin: var(--ak-s2) 0; }
.bp-sec .heat { border-spacing: 2px; }
.bp-sec .heat td { min-width: 2.05rem; height: 2.15rem; font-size: var(--ak-text-sm); }
.bp-sec .heat th { padding: var(--ak-s1); }
/* full opacity: axe misreads semi-transparent text inside the scrolling results panel */
.bp-sec .heat td .up { opacity: 1; }
.bp-sec .wonk-fold > .body { max-width: none; }

/* comparison */
/* tbody th: beats app.css's .wonk-table tbody th[scope="row"], which sets a larger size */
.bp-cmp tbody th[scope="row"] { font-family: var(--ak-font-sans); font-size: var(--ak-text-sm); text-transform: none; letter-spacing: 0; color: var(--ak-ink); font-weight: 500; }
.bp-cmp thead th.num { white-space: nowrap; vertical-align: bottom; }
.bp-cmp td.num { white-space: nowrap; color: var(--ak-ink); }
.bp-cmp-scroll:focus-visible { outline: 2px solid var(--ak-a1-text); outline-offset: 2px; }
/* narrow: tighter cells, and headers may wrap, so all three plans fit without sideways scrolling */
@container bpres (max-width: 27rem) {
  .bp-cmp th, .bp-cmp td { padding: var(--ak-s2) 0.35rem; }
  .bp-cmp tbody th[scope="row"] { padding-left: var(--ak-s2); }
  .bp-cmp thead th.num { white-space: normal; }
  .bp-cmp .bp-upto { display: block; }
  .bp-cmp .status--unsure { white-space: normal; }
}
@container bpres (max-width: 19rem) {
  .bp-cmp tbody th[scope="row"], .bp-cmp td { font-size: var(--ak-text-xs); }
}
.bp-cmp th.num:nth-child(2) { color: var(--ak-ink); font-weight: 600; box-shadow: inset 0 3px 0 var(--ak-a1); }
.bp-cmp td.num:nth-child(2) { font-weight: 700; }
.bp-cmp .status { font-weight: 500; }

/* an in-sentence action: reads as a link, behaves as a button */
.bp-textbtn {
  display: inline; margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--ak-a1-text);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em;
}
.bp-textbtn:hover { text-decoration-thickness: 2px; }
.bp-textbtn:focus-visible { outline: 2px solid var(--ak-a1-text); outline-offset: 2px; border-radius: var(--ak-radius); }

/* share */
.bp-share .wonk-btn { min-height: 2.75rem; }
.bp-share-fallback { margin: var(--ak-s3) 0 0; max-width: 36rem; }
.bp-share-fallback[hidden] { display: none; }

/* ---- the summary bar that follows the controls on narrower screens ---- */
.bp-bar {
  position: sticky; bottom: max(var(--ak-s2), env(safe-area-inset-bottom)); z-index: 20;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "save btn" "kids kids" "fits fits";
  align-items: center; gap: var(--ak-s1) var(--ak-s3);
  padding: calc(var(--ak-s2) + 4px) var(--ak-s3) var(--ak-s2) var(--ak-s4);
  background: var(--ak-surface); border: 1px solid var(--ak-hairline-strong); border-radius: var(--ak-radius);
  box-shadow: var(--ak-shadow); overflow: hidden;
}
.bp-bar-meter { position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--ak-surface-2); }
.bp-bar-fill { display: block; height: 100%; max-width: 100%; background: var(--ak-a1); }
.wonk .bp-bar-line { margin: 0; min-width: 0; font-size: var(--ak-text-sm); line-height: 1.35; color: var(--ak-ink-2); }
.bp-bar-save { grid-area: save; }
.bp-bar-kids { grid-area: kids; }
.bp-bar-fits { grid-area: fits; }
.bp-bar-fits .status { white-space: normal; }
.bp-bar-val { font-size: var(--ak-text-md); color: var(--ak-ink); }
.bp-bar-unit { color: var(--ak-ink-2); white-space: nowrap; }
/* the status stays beside the savings where it fits, or moves under them; a long one ("Short of lower target by
   $1.01M or more") wraps within the bar on narrow phones */
.wonk .bp-bar-save { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.3em; }
.bp-bar-sub { min-width: 0; }
.bp-bar-sub .status { font-size: var(--ak-text-sm); white-space: normal; }
.bp-bar-btn { grid-area: btn; padding: 0.5rem 0.75rem; min-height: 2.75rem; }
html:has(.bp-bar) { scroll-padding-bottom: 8.5rem; }

/* ---- two columns on wide screens: the results stay in view while the controls change ---- */
@media (min-width: 1100px) {
  .bp-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  /* scroll-padding-top: a fallback; build-results.js sets it to the sticky head's height as the head changes */
  .bp-results { position: sticky; top: var(--ak-s4); max-height: calc(100vh - 2 * var(--ak-s4)); overflow-y: auto; scroll-padding-top: 19rem; }
  /* -1px and a shadow above: scrolled content never shows between the panel's border and the head */
  .bp-results-head { position: sticky; top: -1px; z-index: 3; box-shadow: 0 -2px 0 var(--ak-surface); }
  .bp-bar { display: none; }
  html:has(.bp-bar) { scroll-padding-bottom: 0; }
  /* the controls stay beside the results */
  .bp-back, .bp-back-row { display: none; }
}
@media (max-width: 1099px) {
  .bp-strip { display: none; }
}

/* ---- print: the whole results panel, no sticky parts ---- */
@media print {
  .bp-layout { grid-template-columns: 1fr; }
  .bp-results, .bp-results-head { position: static; max-height: none; overflow: visible; }
  .bp-bar, .bp-share, .bp-back { display: none; }
}
.bp-brookside { font-size: var(--ak-text-sm); color: var(--ak-ink-2); margin: var(--ak-s3) 0 0; }
.bp-recv-host { margin-top: var(--ak-s4); }
.bp-center { display: grid; gap: var(--ak-s3); margin-top: var(--ak-s4); }
