/* QOF Income, Phase E5. One stylesheet for every section, built on the shell's --hs-* tokens.
   Numbers never wrap; descriptions wrap to two lines and expand on request; tables size columns by
   their content type, not equally; charts sit near the top of each section and always have a table. */

.qi {
  --qi-ink: var(--hs-ink, #1f2937);
  --qi-muted: var(--hs-ink-muted, #55637a);
  --qi-faint: var(--hs-ink-faint, #7b8798);
  --qi-border: var(--hs-border, #dfe4ec);
  --qi-border-strong: var(--hs-border-strong, #c8d0dd);
  --qi-surface: var(--hs-surface, #fff);
  --qi-ground: var(--hs-ground, #f4f6fa);
  --qi-radius: var(--hs-radius, 10px);
  --qi-radius-sm: var(--hs-radius-sm, 6px);
  --qi-shadow: var(--hs-shadow, 0 1px 2px rgba(18, 35, 63, .06), 0 4px 12px rgba(18, 35, 63, .05));
  --qi-brand: #0d5bb8;
  --qi-brand-deep: #0d366b;
  --qi-brand-soft: #eaf2fd;
  --qi-info-bg: var(--hs-info-bg, #eef4fd);
  --qi-warn-bg: var(--hs-warn-bg, #fff8e6);
  --qi-warn-border: var(--hs-warn-border, #e6c34a);
  --qi-warn-ink: var(--hs-warn-ink, #6b5200);
  --qi-good: #0a7d0a;
  --qi-good-bg: #e8f6ea;
  --qi-partial: #8a5a00;
  --qi-partial-bg: #fff3d6;
  --qi-bad: #b42f2f;
  --qi-bad-bg: #fdecec;
  color: var(--qi-ink);
  margin: 0 auto;
  max-width: 1500px;
  min-width: 0;
}

/* ---- Header -------------------------------------------------------------------------------- */
.qi-eyebrow { color: var(--hs-teal-deep, #0b7d7d); font-size: .74rem; font-weight: 800; letter-spacing: .08em; margin: 0; text-transform: uppercase; }
.qi-title { font-size: 1.75rem; line-height: 1.2; margin: .2rem 0 .35rem; }
.qi-lead { color: var(--qi-muted); margin: 0 0 .75rem; max-width: 72ch; }
.qi .sr-only { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; }
.qi-caveat { max-width: none; align-items: baseline; background: var(--qi-info-bg); border-radius: var(--qi-radius-sm); display: flex; font-size: .88rem; gap: .5rem; margin: 0 0 1rem; padding: .55rem .8rem; }
.qi-caveat strong { white-space: nowrap; }

/* ---- Cards, controls and navigation ------------------------------------------------------- */
.qi-card { background: var(--qi-surface); border: 1px solid var(--qi-border); border-radius: var(--qi-radius); box-shadow: var(--qi-shadow); margin: 0 0 1rem; min-width: 0; padding: 1rem 1.1rem; }
.qi-card > h2, .qi-card-head h2 { font-size: 1.02rem; margin: 0; }
.qi-card-head { align-items: baseline; display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: space-between; margin-bottom: .75rem; }
.qi-card-sub { color: var(--qi-muted); font-size: .86rem; margin: .2rem 0 0; }
.qi-controls { align-items: end; display: flex; flex-wrap: wrap; gap: .6rem 1rem; }
.qi-field { display: grid; gap: .2rem; }
.qi-field label, .qi-label { color: var(--qi-muted); font-size: .78rem; font-weight: 700; }
.qi select, .qi input[type="number"], .qi input[type="search"], .qi input[type="text"] { background: var(--qi-surface); border: 1px solid var(--qi-border-strong); border-radius: var(--qi-radius-sm); color: var(--qi-ink); font: inherit; min-height: 2.25rem; padding: .3rem .55rem; }
.qi select:focus-visible, .qi input:focus-visible, .qi a:focus-visible, .qi button:focus-visible, .qi summary:focus-visible { outline: 3px solid #7fb3ff; outline-offset: 2px; }
.qi-button { background: var(--qi-brand); border: 0; border-radius: var(--qi-radius-sm); color: #fff; cursor: pointer; font: inherit; font-weight: 700; min-height: 2.25rem; padding: .35rem .95rem; }
.qi-button:hover { background: var(--qi-brand-deep); }
.qi-link { color: var(--qi-brand); font-weight: 600; }
.qi-help { color: var(--qi-muted); font-size: .84rem; margin: .5rem 0 0; max-width: 90ch; }

.qi-tabs { border-bottom: 1px solid var(--qi-border); display: flex; gap: .15rem; margin: 0 0 1rem; max-width: 100%; overflow-x: auto; }
.qi-tabs a { border-bottom: 3px solid transparent; color: var(--qi-ink); font-weight: 600; padding: .6rem .85rem; text-decoration: none; white-space: nowrap; }
.qi-tabs a:hover { border-bottom-color: var(--qi-border-strong); }
.qi-tabs a.is-active { border-bottom-color: var(--qi-brand); color: var(--qi-brand); }

/* ---- Context strip: tiles size themselves; there is never an empty filler cell ------------ */
.qi-context { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 0 0 1rem; }
.qi-context > div { background: var(--qi-surface); border: 1px solid var(--qi-border); border-radius: var(--qi-radius-sm); min-width: 0; padding: .6rem .8rem; }
.qi-context strong { display: block; font-size: 1rem; overflow-wrap: anywhere; }
.qi-context span { color: var(--qi-muted); display: block; font-size: .78rem; }

/* ---- Notices: one compact line each ------------------------------------------------------- */
.qi-notices { display: grid; gap: .4rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.qi-notice { background: var(--qi-info-bg); border-left: 4px solid var(--qi-brand); border-radius: var(--qi-radius-sm); font-size: .88rem; padding: .5rem .8rem; }
.qi-notice.is-warning { background: var(--qi-warn-bg); border-left-color: var(--qi-warn-border); color: var(--qi-warn-ink); }
.qi-notice strong { margin-right: .35rem; }
.qi-empty { background: var(--qi-warn-bg); border-left: 4px solid var(--qi-warn-border); border-radius: var(--qi-radius-sm); color: var(--qi-warn-ink); margin: 0 0 1rem; padding: .7rem .9rem; }

/* ---- Section intros (E6): one heading, one sentence, a tag saying editable or read-only ------- */
.qi-intro { border-left: 4px solid var(--qi-border-strong); margin: 0 0 1rem; padding: .1rem 0 .1rem .9rem; }
.qi-intro.is-editable { border-left-color: var(--qi-brand); }
.qi-intro h2 { font-size: 1.08rem; margin: 0 0 .2rem; }
.qi-intro p { color: var(--qi-muted); font-size: .9rem; margin: 0 0 .3rem; max-width: 95ch; }
.qi-intro .qi-button { display: inline-block; margin-right: .6rem; text-decoration: none; }
.qi-intro-tag { font-size: .82rem; }
.qi-tag { background: #eef1f5; border-radius: 99px; color: var(--qi-ink); display: inline-block; font-size: .76rem; font-weight: 700; margin-right: .35rem; padding: .12rem .6rem; }
.qi-tag.is-editable { background: var(--qi-brand-soft); color: var(--qi-brand-deep); }
.qi-tag.is-editable::before { content: "✎ "; }
.qi-icon-link { align-items: center; border-radius: var(--qi-radius-sm); color: var(--qi-faint); display: inline-flex; height: 1.5rem; justify-content: center; margin-left: .15rem; vertical-align: middle; width: 1.5rem; }
.qi-icon-link:hover { background: var(--qi-brand-soft); color: var(--qi-brand); }
.qi-icon-link:focus-visible { color: var(--qi-brand); }
.qi-icon { height: 1rem; width: 1rem; }
.qi-entry-head a, .qi-entry-head { color: var(--qi-brand-deep); }
.qi-table td.qi-entry { background: #f5f9ff; }
.qi input.qi-whatif-input { border-color: #8fb3e3; }
.qi input.qi-whatif-input.is-entered { background: var(--qi-brand-soft); border-color: var(--qi-brand); font-weight: 700; }
.qi-whatif-input::placeholder { color: var(--qi-faint); font-style: italic; }
.qi-table tbody tr.is-focus td, .qi-table tbody tr.is-focus th { background: #fff6dc; }
.qi-table tbody tr.is-focus th:first-child { box-shadow: inset 4px 0 0 var(--qi-warn-border); }
.qi-table .qi-sub.qi-wrap { max-width: 10rem; min-width: 6rem; white-space: normal; }
.qi-table thead th.qi-num, .qi-table thead th.qi-tight { white-space: normal; }
.qi-table td.qi-note-cell { min-width: 13rem; }

/* ---- KPIs --------------------------------------------------------------------------------- */
.qi-kpis { display: grid; gap: .75rem; grid-template-columns: 2fr repeat(3, minmax(0, 1fr)); margin: 0 0 1rem; }
.qi-kpi { background: var(--qi-surface); border: 1px solid var(--qi-border); border-radius: var(--qi-radius); box-shadow: var(--qi-shadow); min-width: 0; padding: .9rem 1rem; }
.qi-kpi-label { color: var(--qi-muted); font-size: .76rem; font-weight: 700; letter-spacing: .03em; margin: 0; text-transform: uppercase; }
.qi-kpi-value { display: block; font-size: 1.55rem; font-weight: 750; line-height: 1.2; margin: .25rem 0 .15rem; white-space: nowrap; }
.qi-kpi-note { color: var(--qi-muted); font-size: .8rem; margin: 0; }
.qi-kpi--hero { background: linear-gradient(180deg, var(--qi-brand-soft), var(--qi-surface)); border-color: #c5d9f5; }
.qi-kpi--hero .qi-kpi-value { color: var(--qi-brand-deep); font-size: 2.3rem; }
.qi-progress { appearance: none; background: #dde5f0; border: 0; border-radius: 99px; display: block; height: .55rem; margin: .5rem 0 .35rem; overflow: hidden; width: 100%; }
.qi-progress::-webkit-progress-bar { background: #dde5f0; border-radius: 99px; }
.qi-progress::-webkit-progress-value { background: var(--qi-brand); border-radius: 99px; }
.qi-progress::-moz-progress-bar { background: var(--qi-brand); border-radius: 99px; }

/* ---- Layout grids ------------------------------------------------------------------------- */
.qi-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.qi-grid > .qi-card { margin: 0; }
.qi-stack { display: grid; gap: 1rem; margin: 0 0 1rem; }

/* ---- Charts: fixed boxes that include the axis band; horizontal charts grow with their rows - */
.qi-chart { height: 300px; position: relative; width: 100%; }
.qi-chart--short { height: 220px; }
.qi-chart canvas { max-width: 100%; }
.qi-table-toggle { margin-top: .6rem; }
.qi-table-toggle > summary { color: var(--qi-brand); cursor: pointer; font-size: .86rem; font-weight: 600; }
.qi-table-toggle[open] > summary { margin-bottom: .5rem; }

/* ---- Lists of opportunities and domains -------------------------------------------------- */
.qi-bars { display: grid; gap: .7rem; list-style: none; margin: 0; padding: 0; }
.qi-bars li { display: grid; gap: .1rem .75rem; grid-template-columns: minmax(0, 1fr) auto; }
.qi-bars .qi-bars-name { font-weight: 650; min-width: 0; }
.qi-bars .qi-bars-name span { color: var(--qi-muted); display: block; font-size: .8rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-bars .qi-bars-value { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }
.qi-bars .qi-progress { grid-column: 1 / -1; margin: 0; }

/* ---- Tables ------------------------------------------------------------------------------- */
.qi-table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; position: relative; }
.qi-table { border-collapse: separate; border-spacing: 0; font-size: .88rem; table-layout: auto; width: 100%; }
.qi-table th, .qi-table td { border-bottom: 1px solid var(--qi-border); padding: .5rem .65rem; text-align: left; vertical-align: top; }
.qi-table thead th { background: #f7f9fc; color: var(--qi-muted); font-size: .74rem; font-weight: 700; letter-spacing: .03em; position: sticky; text-transform: uppercase; top: 0; vertical-align: bottom; z-index: 1; }
.qi-table tbody tr:hover td, .qi-table tbody tr:hover th { background: #fafcff; }
.qi-table tbody th { font-weight: 650; }
.qi-table .qi-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.qi-table .qi-code { white-space: nowrap; }
.qi-table .qi-desc { max-width: 46rem; min-width: 14rem; }
.qi-table .qi-tight { white-space: nowrap; width: 1%; }
.qi-table .qi-thresholds { max-width: 12rem; min-width: 6.5rem; }
.qi-table tfoot td, .qi-table tfoot th { border-bottom: 0; border-top: 2px solid var(--qi-border-strong); font-weight: 700; }
.qi-table--compact { font-size: .86rem; }
.qi-table--compact th, .qi-table--compact td { padding: .4rem .5rem; }
.qi-table a.qi-sort { color: inherit; text-decoration: none; }
.qi-table a.qi-sort:hover { color: var(--qi-brand); text-decoration: underline; }
.qi-table a.qi-sort[data-dir="ascending"]::after { content: " ▲"; }
.qi-table a.qi-sort[data-dir="descending"]::after { content: " ▼"; }
.qi-sub { color: var(--qi-muted); display: block; font-size: .78rem; font-weight: 400; }
.qi-num .qi-sub, .qi-tight .qi-sub { white-space: nowrap; }
.qi-muted { color: var(--qi-muted); }
.qi-table .qi-sub.qi-clamp { max-width: 24rem; min-width: 12rem; white-space: normal; }
.qi-clamp { -webkit-box-orient: vertical; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.qi-more > summary { cursor: pointer; display: flex; gap: .35rem; list-style: none; }
.qi-more > summary::before { color: var(--qi-brand); content: "▸"; flex: none; font-size: .8rem; line-height: 1.5; }
.qi-more[open] > summary::before { content: "▾"; }
.qi-more > summary::-webkit-details-marker { display: none; }
.qi-more > summary .qi-more-cue { color: var(--qi-brand); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.qi-more[open] > summary .qi-clamp { -webkit-line-clamp: unset; line-clamp: unset; }
.qi-more[open] > summary .qi-more-cue::after { content: " (less)"; }
.qi-inputs { background: #f7f9fc; border-radius: var(--qi-radius-sm); display: grid; font-size: .82rem; gap: .2rem 1rem; grid-template-columns: max-content minmax(0, 1fr); margin: .5rem 0 0; padding: .55rem .7rem; }
.qi-inputs dt { color: var(--qi-muted); font-weight: 650; }
.qi-inputs dd { margin: 0; overflow-wrap: anywhere; }

/* the first column stays visible while a wide table scrolls sideways */
.qi-sticky { background: var(--qi-surface); left: 0; position: sticky; z-index: 1; }
.qi-table thead .qi-sticky { background: #f7f9fc; z-index: 2; }

/* ---- Status, meters and badges ----------------------------------------------------------- */
.qi-chip { align-items: center; border-radius: 99px; display: inline-flex; font-size: .76rem; font-weight: 700; gap: .3rem; padding: .12rem .55rem; white-space: nowrap; }
.qi-chip::before { font-weight: 800; }
.qi-chip .qi-short { display: none; }
.qi-chip.is-achieved { background: var(--qi-good-bg); color: var(--qi-good); }
.qi-chip.is-achieved::before { content: "✓"; }
.qi-chip.is-partial { background: var(--qi-partial-bg); color: var(--qi-partial); }
.qi-chip.is-partial::before { content: "◐"; }
.qi-chip.is-below { background: var(--qi-bad-bg); color: var(--qi-bad); }
.qi-chip.is-below::before { content: "✕"; }
.qi-chip.is-unknown { background: #eef1f5; color: var(--qi-muted); }
.qi-chip.is-unknown::before { content: "–"; }
.qi-badge { background: #eef1f5; border-radius: var(--qi-radius-sm); color: var(--qi-muted); display: inline-block; font-size: .74rem; font-weight: 700; padding: .05rem .4rem; white-space: nowrap; }
.qi-badge.is-break { background: var(--qi-partial-bg); color: var(--qi-partial); }
.qi-badge.is-protect { background: var(--qi-warn-bg); color: var(--qi-warn-ink); }
.qi-meter-cell { align-items: center; display: flex; gap: .5rem; white-space: nowrap; }
.qi-meter { height: .6rem; width: 4.5rem; }
.qi-meter-cell .qi-num-inline { font-variant-numeric: tabular-nums; min-width: 4.2rem; text-align: right; }
.qi-up { color: var(--qi-good); }
.qi-down { color: var(--qi-bad); }

/* ---- Filters and segmented controls ------------------------------------------------------ */
.qi-filters { align-items: end; display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin: 0 0 .9rem; }
.qi-segments { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0 0 .9rem; padding: 0; }
.qi-segments a { background: var(--qi-surface); border: 1px solid var(--qi-border-strong); border-radius: 99px; color: var(--qi-ink); display: inline-block; font-size: .82rem; font-weight: 600; padding: .25rem .7rem; text-decoration: none; white-space: nowrap; }
.qi-segments a[aria-current="true"] { background: var(--qi-brand); border-color: var(--qi-brand); color: #fff; }

/* ---- What-if ------------------------------------------------------------------------------ */
.qi-whatif-input { text-align: right; width: 6.2rem; }
.qi-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin: .8rem 0 0; }
.qi-actions--top { margin: 0 0 .8rem; }

/* ---- Details panels (contract changes, per-year detail) ---------------------------------- */
.qi-panel > summary { cursor: pointer; font-weight: 700; }
.qi-panel[open] > summary { margin-bottom: .7rem; }
.qi-changes { display: grid; gap: .55rem; list-style: none; margin: 0; padding: 0; }
.qi-changes li { border-left: 3px solid var(--qi-brand); padding: .15rem 0 .15rem .7rem; }
.qi-changes span { color: var(--qi-muted); display: block; font-size: .84rem; }
.qi-exports { align-items: center; display: flex; flex-wrap: wrap; gap: .5rem; }
.qi-exports a { background: var(--qi-surface); border: 1px solid var(--qi-border-strong); border-radius: var(--qi-radius-sm); color: var(--qi-brand); font-size: .84rem; font-weight: 700; padding: .25rem .65rem; text-decoration: none; }

/* ---- Guide -------------------------------------------------------------------------------- */
.qi-guide-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 1rem; }
.qi-guide-grid > .qi-card { margin: 0; }
.qi-guide-step h3 { align-items: center; display: flex; font-size: 1rem; gap: .5rem; margin: 0 0 .5rem; }
.qi-step-no { align-items: center; background: var(--qi-brand); border-radius: 50%; color: #fff; display: inline-flex; flex: none; font-size: .8rem; height: 1.6rem; justify-content: center; width: 1.6rem; }
.qi-guide-step p, .qi-guide-step li { line-height: 1.55; }
.qi-guide-step ul { margin: .4rem 0 0; padding-left: 1.15rem; }
.qi-flow { align-items: stretch; display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: .4rem 0 0; padding: 0; }
.qi-flow li { background: var(--qi-brand-soft); border: 1px solid #c5d9f5; border-radius: var(--qi-radius-sm); flex: 1 1 8.5rem; font-size: .84rem; padding: .55rem .7rem; position: relative; }
.qi-flow li strong { display: block; font-size: .92rem; }
.qi-flow li + li::before { color: var(--qi-brand); content: "×"; font-weight: 800; left: -.42rem; position: absolute; top: 50%; transform: translate(-50%, -50%); }
.qi-flow li.is-result { background: var(--qi-brand); border-color: var(--qi-brand); color: #fff; }
.qi-flow li.is-result::before { content: "="; }
.qi-terms { display: grid; gap: .35rem 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin: .8rem 0 0; }
.qi-terms div { font-size: .84rem; }
.qi-terms dt { display: inline; font-weight: 700; }
.qi-terms dt::after { content: ": "; }
.qi-terms dd { color: var(--qi-muted); display: inline; margin: 0; }
.qi-worked { background: #f7f9fc; border-radius: var(--qi-radius-sm); font-variant-numeric: tabular-nums; margin: .6rem 0 0; padding: .6rem .8rem; }
.qi-scenario { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.qi-scenario-form { display: grid; gap: .75rem; }
.qi-scenario-form fieldset { border: 1px solid var(--qi-border); border-radius: var(--qi-radius-sm); display: grid; gap: .45rem .8rem; grid-template-columns: minmax(0, 1fr) 7.5rem; margin: 0; min-width: 0; padding: .7rem .85rem; }
.qi-scenario-form legend { font-weight: 700; padding: 0 .3rem; }
.qi-scenario-form label { align-self: center; font-size: .86rem; }
.qi-scenario-form input { text-align: right; width: 100%; }
.qi-compare { display: grid; gap: .6rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 .8rem; }
.qi-compare > div { border: 1px solid var(--qi-border); border-radius: var(--qi-radius-sm); padding: .6rem .75rem; }
.qi-compare .qi-kpi-value { font-size: 1.35rem; }
.qi-compare > div.is-delta { background: var(--qi-brand-soft); border-color: #c5d9f5; }

/* ---- Horizontal chart heights: one class per row count, so no inline style is needed ----- */
.qi-rows-1 { height: 86px; } .qi-rows-2 { height: 112px; } .qi-rows-3 { height: 138px; } .qi-rows-4 { height: 164px; }
.qi-rows-5 { height: 190px; } .qi-rows-6 { height: 216px; } .qi-rows-7 { height: 242px; } .qi-rows-8 { height: 268px; }
.qi-rows-9 { height: 294px; } .qi-rows-10 { height: 320px; } .qi-rows-11 { height: 346px; } .qi-rows-12 { height: 372px; }
.qi-rows-13 { height: 398px; } .qi-rows-14 { height: 424px; } .qi-rows-15 { height: 450px; } .qi-rows-16 { height: 476px; }
.qi-rows-17 { height: 502px; } .qi-rows-18 { height: 528px; } .qi-rows-19 { height: 554px; } .qi-rows-20 { height: 580px; }
.qi-rows-21 { height: 606px; } .qi-rows-22 { height: 632px; } .qi-rows-23 { height: 658px; } .qi-rows-24 { height: 684px; }
.qi-rows-25 { height: 710px; } .qi-rows-26 { height: 736px; } .qi-rows-27 { height: 762px; } .qi-rows-28 { height: 788px; }
.qi-rows-29 { height: 814px; } .qi-rows-30 { height: 840px; } .qi-rows-31 { height: 866px; } .qi-rows-32 { height: 892px; }
.qi-rows-33 { height: 918px; } .qi-rows-34 { height: 944px; } .qi-rows-35 { height: 970px; } .qi-rows-36 { height: 996px; }
.qi-rows-37 { height: 1022px; } .qi-rows-38 { height: 1048px; } .qi-rows-39 { height: 1074px; } .qi-rows-40 { height: 1100px; }
.qi-rows-41 { height: 1126px; } .qi-rows-42 { height: 1152px; } .qi-rows-43 { height: 1178px; } .qi-rows-44 { height: 1204px; }
.qi-rows-45 { height: 1230px; } .qi-rows-46 { height: 1256px; } .qi-rows-47 { height: 1282px; } .qi-rows-48 { height: 1308px; }
.qi-rows-49 { height: 1334px; } .qi-rows-50 { height: 1360px; } .qi-rows-51 { height: 1386px; } .qi-rows-52 { height: 1412px; }
.qi-rows-53 { height: 1438px; } .qi-rows-54 { height: 1464px; } .qi-rows-55 { height: 1490px; } .qi-rows-56 { height: 1516px; }
.qi-rows-57 { height: 1542px; } .qi-rows-58 { height: 1568px; } .qi-rows-59 { height: 1594px; } .qi-rows-60 { height: 1620px; }

/* ---- Responsive --------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .qi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qi-kpi--hero { grid-column: 1 / -1; }
  .qi-grid, .qi-guide-grid, .qi-scenario { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .qi-title { font-size: 1.45rem; }
  .qi-card { padding: .85rem .8rem; }
  .qi-kpi-value { font-size: 1.3rem; }
  .qi-kpi--hero .qi-kpi-value { font-size: 1.9rem; }
  .qi-controls { align-items: stretch; flex-direction: column; }
  .qi-controls .qi-field select { width: 100%; }
  .qi-table .qi-desc { min-width: 13rem; }
  .qi-table .qi-sticky { max-width: 11rem; }
  .qi-table .qi-sub.qi-clamp { max-width: 11rem; min-width: 0; }
  .qi-compare { grid-template-columns: minmax(0, 1fr); }
  .qi-caveat { display: block; }
}
@media (max-width: 420px) {
  .qi-kpis { grid-template-columns: minmax(0, 1fr); }
  .qi-table .qi-sticky, .qi-table .qi-sub.qi-clamp { max-width: 9.25rem; }
  .qi-table .qi-sticky .qi-code { display: block; }
  .qi-table .qi-sticky .qi-chip .qi-short { display: inline; }
  .qi-table .qi-sticky .qi-chip .qi-long { clip: rect(0 0 0 0); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
  .qi-scenario-form fieldset { grid-template-columns: minmax(0, 1fr); }
}

/* Phase V1a: current-year calculator provenance. Placeholder text is the untouched figure; a typed value
   (including 0) is a real attribute and styled apart. */
.qi input.qi-whatif-input.is-baseline::placeholder { color: var(--qi-faint); font-style: normal; }
.qi input.qi-whatif-input.is-estimate::placeholder { color: var(--qi-brand-deep); font-style: normal; font-weight: 600; }
.qi-source { border-radius: 4px; display: inline-block; white-space: nowrap; font-size: .72rem; font-weight: 700; padding: .05rem .4rem; }
.qi-source.is-baseline { background: #eef1f5; color: var(--qi-muted); }
.qi-source.is-estimate { background: var(--qi-partial-bg); color: var(--qi-partial); }
.qi-source.is-entered { background: var(--qi-brand-soft); color: var(--qi-brand-deep); }
.qi-basis-list, .qi-basis-reasons { display: grid; gap: .35rem; list-style: none; margin: .4rem 0 0; padding: 0; }
.qi-basis-reasons { font-size: .86rem; }
.qi-button--secondary { background: #fff; border: 1px solid var(--qi-brand); color: var(--qi-brand-deep); }
.qi-button--secondary:hover { background: var(--qi-brand-soft); }

/* ---- Phase V2: chart-led dashboards. Widths and positions are attributes or classes, never style="". ---- */
.qi-points { align-items: center; display: grid; gap: 1rem; grid-template-columns: minmax(130px, 170px) minmax(0, 1fr); }
.qi-ring-fig { margin: 0; text-align: center; }
.qi-ring { display: block; margin: 0 auto .35rem; max-width: 170px; width: 100%; }
.qi-ring-track { stroke: var(--qi-border, #e3e8ef); }
.qi-ring-fill { stroke: var(--qi-brand); stroke-linecap: round; }
.qi-ring-text { fill: var(--qi-brand-deep); font-size: 8px; font-weight: 800; }
.qi-ring-fig figcaption { color: var(--qi-muted); font-size: .84rem; }
.qi-heat { border-collapse: separate; border-spacing: 3px; width: 100%; }
.qi-heat th { color: var(--qi-muted); font-size: .78rem; font-weight: 700; padding: .2rem .4rem; text-align: left; }
.qi-heat td { border-radius: 4px; font-size: .82rem; font-weight: 700; padding: .45rem .3rem; text-align: center; }
.qi-heat .is-none { background: repeating-linear-gradient(45deg, #f1f3f7, #f1f3f7 4px, #e6eaf0 4px, #e6eaf0 8px); color: var(--qi-muted); font-weight: 500; }
.qi-heat-0 { background: #f3f7fd; color: #12233f; } .qi-heat-1 { background: #e5eefb; color: #12233f; }
.qi-heat-2 { background: #d4e4f8; color: #12233f; } .qi-heat-3 { background: #bfd6f3; color: #12233f; }
.qi-heat-4 { background: #a6c6ee; color: #12233f; } .qi-heat-5 { background: #8bb3e7; color: #0b2447; }
.qi-heat-6 { background: #6e9ede; color: #0b2447; } .qi-heat-7 { background: #4f86d1; color: #fff; }
.qi-heat-8 { background: #316fc0; color: #fff; } .qi-heat-9 { background: #1a58a8; color: #fff; }
.qi-heat-10 { background: #0d3f86; color: #fff; }
.qi-spark { display: block; height: 20px; width: 60px; }
.qi-spark polyline { fill: none; stroke: var(--qi-brand); stroke-linejoin: round; stroke-width: 1.6; }
.qi-spark circle { fill: var(--qi-brand-deep); }
.qi-diagrams { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.qi-diagram { margin: 0; }
.qi-diagram svg { display: block; max-width: 100%; width: 100%; }
.qi-diagram figcaption { color: var(--qi-muted); font-size: .84rem; margin-top: .3rem; }
.qi-d-bar { fill: var(--qi-brand); } .qi-d-bar2 { fill: #8bb3e7; } .qi-d-track { fill: #eef1f5; }
.qi-d-band { fill: #b7d3f6; } .qi-d-mark { fill: var(--qi-brand-deep); } .qi-d-box { fill: #fff; stroke: var(--qi-brand); stroke-width: 1.2; }
.qi-d-box.is-result { fill: var(--qi-brand-soft); stroke-width: 2; } .qi-d-box.is-outside { stroke: var(--qi-partial); stroke-dasharray: 4 3; }
.qi-d-text { fill: #1f2937; font-size: 5.4px; } .qi-d-small { fill: var(--qi-muted); font-size: 4.4px; } .qi-d-strong { fill: var(--qi-brand-deep); font-size: 6px; font-weight: 800; }
.qi-d-arrow { fill: none; stroke: var(--qi-muted); stroke-width: 1; }
@media (max-width: 640px) { .qi-points { grid-template-columns: minmax(0, 1fr); } }

.qi-diagram-title { font-size: .92rem; margin: 0 0 .35rem; }
.qi-diagram-result { color: var(--qi-brand-deep); font-weight: 800; margin: .15rem 0 0; }
.qi-d-text { font-size: 5px; } .qi-d-small { font-size: 4.2px; }
.qi-flow--worked { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); list-style: none; margin: 0; padding: 0; }
.qi-flow--worked li { background: var(--qi-brand-soft); border: 1px solid var(--qi-brand); border-radius: var(--qi-radius-sm); display: grid; font-size: .78rem; gap: .1rem; padding: .45rem .5rem; text-align: center; }
.qi-flow--worked li strong { color: var(--qi-brand-deep); font-size: 1rem; }
.qi-flow--worked li.is-result { background: var(--qi-brand); border-color: var(--qi-brand); color: #fff; } .qi-flow--worked li.is-result strong { color: #fff; }
.qi-versus { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.qi-versus-box { background: var(--qi-brand-soft); border: 2px solid var(--qi-brand); border-radius: var(--qi-radius-sm); padding: .7rem .9rem; }
.qi-versus-box.is-outside { background: #fff; border: 2px dashed var(--qi-partial); }
.qi-versus-box h3 { font-size: .95rem; margin: 0 0 .35rem; } .qi-versus-box ul { margin: 0; padding-left: 1.1rem; }

/* ---- Phase V3: QOF Points & Funding Evolution ---- */
.qi-subtabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.qi-subtabs a { border: 1px solid var(--qi-border-strong); border-radius: 99px; color: var(--qi-ink); font-size: .88rem; font-weight: 700; padding: .3rem .85rem; text-decoration: none; }
.qi-subtabs a.is-active { background: var(--qi-brand); border-color: var(--qi-brand); color: #fff; }
.qi-chart--tall { height: 380px; }
.qe-caution { background: var(--qi-warn-bg); border-left: 4px solid var(--qi-warn-border); border-radius: var(--qi-radius-sm); color: var(--qi-warn-ink); margin: .5rem 0 0; padding: .6rem .8rem; }
.qe-ok { color: var(--qi-good); } .qe-bad { color: var(--qi-bad); }
.qe-statements, .qe-links, .qe-sources { display: grid; gap: .5rem; list-style: none; margin: .4rem 0 .8rem; padding: 0; }
.qi-evid { border-radius: 4px; display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .4rem; white-space: nowrap; }
.qi-evid.is-verified { background: var(--qi-good-bg); color: var(--qi-good); }
.qi-evid.is-reported { background: var(--qi-partial-bg); color: var(--qi-partial); }
.qi-evid.is-conflicting { background: var(--qi-bad-bg); color: var(--qi-bad); }
.qi-evid.is-not_registered, .qi-evid.is-none { background: #eef1f5; color: var(--qi-muted); }
.qi-flow-fig { margin: .5rem 0; overflow-x: auto; }
.qi-fl { display: block; min-width: 560px; width: 100%; }
.qi-fl-edge { stroke: var(--qi-brand); stroke-width: 1.6; }
.qi-fl-edge.is-reported { stroke: var(--qi-partial); stroke-dasharray: 5 4; }
.qi-fl-node { fill: #fff; stroke: var(--qi-brand); stroke-width: 1.2; }
.qi-fl-node.is-reported { stroke: var(--qi-partial); stroke-dasharray: 4 3; }
.qi-fl-node.is-unexplained { fill: #f1f3f7; stroke: var(--qi-muted); stroke-dasharray: 3 3; }
.qi-fl-text { fill: #1f2937; font-size: 11.5px; font-weight: 700; } .qi-fl-points { fill: var(--qi-muted); font-size: 10.5px; } .qi-fl-rel { fill: var(--qi-muted); font-size: 10.5px; font-style: italic; }
@media (max-width: 640px) { .qi-chart--tall { height: 320px; } }
.qi-card h3.qi-label { margin: 1.1rem 0 .4rem; }
.qe-caution strong { margin-right: .25rem; }
