/*
 * Calculator pages (/calculators/*) in the Harbour design. Loaded after the
 * site CSS and blog.css, so the --b-* tokens, FAQ list and [data-animate]
 * reveal styles are shared with the blog. --b-serif is the display face
 * (heavy Schibsted Grotesk), not a serif.
 */

:root {
  --c-value: #0D1220;
  --c-loan: #B8965C;
  --c-usable: #1E4FD6;
  --c-locked: #DCE3EC;
  --c-initial: #0D1220;
  --c-contrib: #1E4FD6;
  --c-interest: #D9B77A;
}

.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-value, .sw-initial { background: var(--c-value); }
.sw-loan { background: var(--c-loan); }
.sw-usable, .sw-contrib { background: var(--c-usable); }
.sw-locked { background: var(--c-locked); border: 1px solid var(--b-border-strong); }
.sw-interest { background: var(--c-interest); }

/* ── Hero ──────────────────────────────────────────────────────────── */
.calc-hero { padding: clamp(32px, 4vw, 56px) 0 clamp(8px, 1vw, 16px); }
.calc-hero .back { display: table; }
.calc-hero h1 { margin: 0 0 18px; max-width: 16ch; }
.calc-hero .lede { max-width: 52ch; margin: 0; }

/* ── Layout ────────────────────────────────────────────────────────── */
.calc { display: grid; gap: 24px; margin: 40px 0 28px; align-items: start; }
@media (min-width: 960px) {
  .calc { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 32px; }
  .calc-results { position: sticky; top: 92px; }
}
.calc-narrow { max-width: 760px; margin: 0 auto; }

.calc-inputs {
  background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 22px;
  box-shadow: var(--b-shadow); padding: 8px 22px;
}
.calc-group { padding: 20px 0 22px; border-bottom: 1px solid var(--b-border); }
.calc-group:last-child { border-bottom: 0; }
.calc-group-title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px;
  font-family: var(--b-sans); font-size: 13.5px; font-weight: 700; color: var(--b-fg-3);
}
.calc-group-title span {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--b-brand-tint); color: var(--b-brand); font-size: 11px; letter-spacing: 0.04em;
}

/* ── Fields ────────────────────────────────────────────────────────── */
.cf { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; transition: opacity 250ms var(--b-ease); }
.cf:last-child { margin-bottom: 0; }
.cf.muted { opacity: 0.45; }
.cf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; padding: 0; width: 100%; }
.cf-head label, .cf-head > span:first-child { font-size: 14.5px; font-weight: 600; color: var(--b-fg-1); }
.cf-hint { font-size: 12.5px; color: var(--b-fg-3); text-align: right; }

.cf-input {
  display: flex; align-items: center; height: 50px; border-radius: 12px;
  background: var(--b-bg); border: 1px solid var(--b-border-strong);
  transition: border-color 200ms var(--b-ease), box-shadow 200ms var(--b-ease), background 200ms;
}
.cf-input:focus-within { border-color: var(--b-brand); background: #fff; box-shadow: 0 0 0 4px rgba(30, 79, 214, 0.16); }
.cf-input input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none;
  padding: 0 14px; font: 600 17px/1 var(--b-sans); color: var(--b-fg-1); font-variant-numeric: tabular-nums;
}
.cf-input.has-prefix input { padding-left: 4px; }
.cf-affix { padding: 0 0 0 14px; color: var(--b-fg-3); font-weight: 600; font-size: 16px; }
.cf-input.has-suffix .cf-affix:last-child { padding: 0 14px 0 0; }

.cf-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 8px 0 0; background: transparent; cursor: pointer;
  --p: 50%;
}
.cf-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--b-brand) var(--p), var(--b-border-strong) var(--p));
}
.cf-range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--b-border); }
.cf-range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--b-brand); }
.cf-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: #fff; border: 2px solid var(--b-brand); box-shadow: 0 2px 8px rgba(13, 18, 32, 0.22);
  transition: transform 180ms var(--b-ease);
}
.cf-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--b-brand); box-shadow: 0 2px 8px rgba(13, 18, 32, 0.22); }
.cf-range:active::-webkit-slider-thumb { transform: scale(1.18); }

/* Segmented control */
.cf-seg legend { float: left; }
.cf-seg .seg { clear: both; }
.seg {
  position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  background: var(--b-sunk); border-radius: 12px; padding: 4px; isolation: isolate; --i: 0;
}
.seg label { position: relative; z-index: 1; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label span {
  display: grid; place-items: center; min-height: 40px; padding: 4px 6px; border-radius: 9px; text-align: center;
  font-size: 13.5px; font-weight: 600; color: var(--b-fg-3); line-height: 1.2; transition: color 220ms var(--b-ease);
}
.seg input:checked + span { color: var(--b-fg-1); }
.seg input:focus-visible + span { outline: 2px solid var(--b-brand); outline-offset: 1px; }
.seg-pill {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / var(--n)); border-radius: 9px; background: #fff;
  box-shadow: 0 1px 2px rgba(13, 18, 32, 0.08), 0 4px 12px -4px rgba(13, 18, 32, 0.18);
  transform: translateX(calc(var(--i) * 100%)); transition: transform 320ms var(--b-ease);
}

/* Toggle */
.cf-toggle { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; cursor: pointer; }
.cf-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--b-border-strong); transition: background 240ms var(--b-ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(13, 18, 32, 0.25); transition: transform 280ms var(--b-ease); }
.cf-toggle input:checked + .switch { background: var(--b-brand); }
.cf-toggle input:checked + .switch::after { transform: translateX(18px); }
.cf-toggle input:focus-visible + .switch { outline: 2px solid var(--b-brand); outline-offset: 2px; }
.cf-toggle-text { display: flex; flex-direction: column; font-size: 14.5px; line-height: 1.35; }
.cf-toggle-text span { font-size: 12.5px; color: var(--b-fg-3); }

/* ── Results ───────────────────────────────────────────────────────── */
.calc-results { display: grid; gap: 16px; }
.result-card { border-radius: 22px; padding: 24px 22px; border: 1px solid var(--b-border); background: var(--b-surface); box-shadow: var(--b-shadow); }
.result-hero {
  /* The answer: the one blue block on the page. Inside it the chart colours switch to light ones. */
  --b-inverse: var(--b-brand); --b-on-dark-2: #DCE5FB;
  --c-loan: #D9B77A; --c-usable: #fff; --c-initial: #fff; --c-contrib: #9DB7F2; --c-interest: #D9B77A;
  background: var(--b-brand); border-color: var(--b-brand); color: var(--b-on-dark-2);
}
.result-kicker { display: block; font-size: 13.5px; font-weight: 700; color: var(--b-accent); }
.result-hero .result-kicker { color: #DCE5FB; }
.result-hero :focus-visible { outline-color: #fff; }
.result-big {
  margin: 8px 0 6px; font-family: var(--b-serif); color: var(--b-on-dark);
  font-size: clamp(2.6rem, 2rem + 3vw, 3.9rem); line-height: 1; font-weight: 800; letter-spacing: -0.05em; }
.result-sub { margin: 0 0 22px; font-size: 14.5px; line-height: 1.55; max-width: 520px; }

/* Value split bar */
.split { position: relative; display: flex; height: 18px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); margin: 4px 0 14px; }
.split-seg { display: block; height: 100%; width: 0; transition: width 700ms var(--b-ease); }
.split-seg:first-child { border-radius: 6px 0 0 6px; }
.split-seg:last-of-type { border-radius: 0 6px 6px 0; }
.seg-loan { background: var(--c-loan); }
.seg-usable { background: var(--c-usable); }
.seg-locked { background: rgba(255, 255, 255, 0.22); }
.split-marker { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--b-on-dark); left: 80%; transition: left 700ms var(--b-ease); border-radius: 2px; }
.split-marker em { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--b-on-dark); }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 9px; }
.legend li strong { margin-left: auto; color: var(--b-on-dark); font-variant-numeric: tabular-nums; font-weight: 600; }
.result-hero .sw-locked { background: rgba(255, 255, 255, 0.22); border-color: transparent; }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--b-fg-2); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 22px; border-radius: 12px; overflow: hidden; background: rgba(255, 255, 255, 0.12); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; background: var(--b-inverse); }
.kpi-label { font-size: 11.5px; letter-spacing: 0.04em; color: var(--b-on-dark-2); }
.kpi-value { font-family: var(--b-serif); font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); color: var(--b-on-dark); font-weight: 800; letter-spacing: -0.05em; }

/* Next purchase */
.result-next { display: flex; gap: 16px; align-items: flex-start; }
.next-icon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--b-accent-tint); color: var(--b-accent); }
.next-line { margin: 6px 0 2px; font-size: 15px; color: var(--b-fg-2); line-height: 1.5; }
.next-big { margin: 0; font-family: var(--b-serif); font-size: clamp(2rem, 1.6rem + 1.6vw, 2.7rem); color: var(--b-fg-1); font-weight: 800; letter-spacing: -0.05em; }
.next-break { margin: 6px 0 10px; font-size: 13.5px; color: var(--b-fg-2); line-height: 1.55; }
.next-note { margin: 0; font-size: 12.5px; color: var(--b-fg-3); line-height: 1.5; padding: 10px 12px; background: var(--b-sunk); border-radius: 8px; }

.calc-cta { justify-content: center; text-decoration: none; min-height: 54px; gap: 10px; }
.calc-cta .icon { transition: transform 250ms var(--b-ease); }
.calc-cta:hover .icon { transform: translateX(4px); }

/* Donut */
.donut-wrap { display: grid; grid-template-columns: 132px 1fr; gap: 20px; align-items: center; position: relative; }
.donut { width: 132px; height: 132px; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 16; }
.donut-track { stroke: rgba(255, 255, 255, 0.08); }
.donut-seg { stroke-dasharray: 0 400; }
.donut .seg-initial { stroke: var(--c-initial); }
.donut .seg-contrib { stroke: var(--c-usable); }
.donut .seg-interest { stroke: var(--c-interest); }
.result-hero .sw-initial { background: var(--c-initial); }
.donut-centre { position: absolute; left: 0; top: 0; width: 132px; height: 132px; display: grid; place-content: center; text-align: center; }
.donut-centre strong { font-family: var(--b-serif); font-size: 26px; color: var(--b-on-dark); line-height: 1; font-weight: 800; letter-spacing: -0.05em; }
.donut-centre span { font-size: 11px; color: var(--b-on-dark-2); margin-top: 3px; }
@media (max-width: 420px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .donut-centre { left: 50%; transform: translateX(-50%); } .donut-wrap .legend { width: 100%; } }

/* ── Chart ─────────────────────────────────────────────────────────── */
.calc-chart-card { background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 22px; padding: clamp(22px, 3vw, 36px); margin: 0 0 64px; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 14px; }
.calc-chart-title { margin: 6px 0 0; font-family: var(--b-serif); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); color: var(--b-fg-1); font-weight: 700; letter-spacing: -0.03em; }
.calc-plot { position: relative; width: 100%; touch-action: pan-y; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.calc-plot .grid { stroke: var(--b-border); stroke-dasharray: 3 4; }
.calc-plot .axis-base { stroke: var(--b-border-strong); }
.calc-plot .tick { font: 500 11.5px var(--b-sans); fill: var(--b-fg-3); font-variant-numeric: tabular-nums; }
.calc-plot .guide { stroke: var(--b-fg-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity 150ms; }
.calc-plot .guide.on { opacity: 0.6; }
.calc-plot .hit { cursor: crosshair; }

.area-usable { fill: var(--c-usable); opacity: 0.32; }
.area-loan { fill: var(--c-loan); opacity: 0.14; }
.line-value { fill: none; stroke: var(--c-value); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.line-loan { fill: none; stroke: var(--c-loan); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.line-limit { fill: none; stroke: var(--c-usable); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dot { stroke: #fff; stroke-width: 2; }
.dot-value { fill: var(--c-value); }
.dot-loan { fill: var(--c-loan); }
.dot-usable { fill: var(--c-usable); }
.focus .dot { pointer-events: none; }

.bar rect { transition: opacity 180ms; }
.bar-initial { fill: var(--c-initial); }
.bar-contrib { fill: var(--c-contrib); }
.bar-interest { fill: var(--c-interest); }
.bar.dim rect { opacity: 0.35; }

.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; min-width: 200px;
  background: var(--b-inverse); color: var(--b-on-dark-2); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 12px 32px -12px rgba(13, 18, 32, 0.5); font-size: 13px;
  opacity: 0; transform: translateY(4px); transition: opacity 150ms, transform 150ms;
}
.chart-tip.on { opacity: 1; transform: none; }
.tip-title { margin: 0 0 6px; font-weight: 600; color: var(--b-on-dark); }
.tip-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tip-row strong, .tip-total strong { margin-left: auto; color: var(--b-on-dark); font-variant-numeric: tabular-nums; }
.tip-total { display: flex; gap: 8px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.chart-tip .sw-initial { background: var(--c-initial); box-shadow: 0 0 0 1px rgba(255,255,255,0.4); }

.milestones { display: grid; gap: 10px; margin: 18px 0 6px; }
@media (min-width: 800px) { .milestones { grid-template-columns: repeat(3, 1fr); } }
.ms { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--b-surface-2); border: 1px solid var(--b-border); font-size: 14px; line-height: 1.5; color: var(--b-fg-2); }
.ms p { margin: 0; }
.ms strong { color: var(--b-fg-1); }
.ms > span { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--b-brand-tint); color: var(--b-brand); }

.calc-table { margin-top: 14px; }
.calc-table summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 600; color: var(--b-brand); padding: 8px 0;
}
.calc-table summary::-webkit-details-marker { display: none; }
.calc-table summary svg { transition: transform 250ms var(--b-ease); }
.calc-table[open] summary svg { transform: rotate(180deg); }
.calc-table table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 14px; font-variant-numeric: tabular-nums; }
.calc-table th, .calc-table td { text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--b-border); }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
.calc-table th { font-size: 13.5px; color: var(--b-fg-3); font-weight: 600; background: var(--b-sunk); position: sticky; top: 0; }
.calc-table tbody tr:nth-child(even) td { background: rgba(230, 238, 247, 0.5); }
.calc-table .table-scroll { max-height: 420px; overflow: auto; margin: 6px 0 0; }

/* ── Explainer ─────────────────────────────────────────────────────── */
.calc-explain { margin: 0 0 56px; }
.calc-explain h2 { margin: 0 0 28px; max-width: 20ch; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); counter-reset: step; }
.how-step { display: flex; flex-direction: column; gap: 14px; padding: 22px 20px; background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 14px; box-shadow: var(--b-shadow); }
.how-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--b-sunk); color: var(--b-brand); }
.how-step h3 { margin: 0 0 6px; font-family: var(--b-serif); font-size: 20px; color: var(--b-fg-1); font-weight: 700; letter-spacing: -0.03em; }
.how-step p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--b-fg-2); }

.calc-disclaimer { margin: 36px 0 clamp(64px, 8vw, 104px); padding: 24px 26px; border: 1px solid var(--b-border); border-radius: 22px; font-size: 13.5px; line-height: 1.65; color: var(--b-fg-3); }
.calc-disclaimer h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 700 13.5px var(--b-sans); color: var(--b-fg-2); }
.calc-disclaimer p { margin: 0 0 8px; }
.calc-disclaimer p:last-child { margin: 0; }

/* ── Index ─────────────────────────────────────────────────────────── */
.calc-cards { list-style: none; margin: 44px 0 20px; padding: 0; display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
/* Four calculators: a 2 × 2 grid instead of three plus one orphan. */
@media (min-width: 760px) { .calc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calc-card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; overflow: hidden;
  background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 22px; box-shadow: var(--b-shadow);
  transition: border-color 200ms, transform 200ms;
}
.calc-card:hover { border-color: var(--b-brand); transform: translateY(-2px); }
.calc-thumb { display: block; width: 100%; height: auto; }
.calc-card-body { position: relative; padding: 30px 24px 26px; display: flex; flex-direction: column; gap: 10px; }
.calc-card-icon { position: absolute; top: -24px; left: 24px; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--b-brand); color: #fff; box-shadow: 0 0 0 4px var(--b-surface); }
.calc-card h2 { margin: 6px 0 0; font-family: var(--b-serif); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; }
.calc-card p { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--b-fg-2); }
.featured-more { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 700; color: var(--b-brand); }
.featured-more .icon { transition: transform 250ms var(--b-ease); }
.calc-card:hover .featured-more .icon { transform: translateX(4px); }
.calc-index-note { display: flex; align-items: center; gap: 8px; margin: 0 0 clamp(64px, 8vw, 104px); font-size: 13.5px; color: var(--b-fg-3); }

/* Index thumbnails and hero cards animate in with the blog reveal styles */
@media (prefers-reduced-motion: reduce) {
  .split-seg, .split-marker, .seg-pill, .switch::after { transition: none; }
}

/* ── Household budget (/calculators/household-budget/) ─────────────── */
/* Five-step wizard. Everything is prefixed hb- so it can't collide with the
   shared .seg / .legend / .row styles above or blog.css. */
.hb {
  --hb-ess: #1E4FD6; --hb-life: #B8965C; --hb-com: #9DB7F2; --hb-prop: #0D1220; --hb-left: #D9B77A;
  --hb-neg: #B42318; --hb-neg-tint: rgba(180, 35, 24, 0.08);
  --hb-hair: rgba(13, 18, 32, 0.08);
  margin: 40px 0 56px; background: var(--b-surface); border: 1px solid var(--b-border); border-radius: 22px; box-shadow: var(--b-shadow);
}
.hb [hidden] { display: none !important; }
.hb small, .hb b, .hb strong { font-variant-numeric: tabular-nums; }

/* Steps */
.hb-steps { display: flex; gap: 4px; padding: 14px 14px 0; overflow-x: auto; scrollbar-width: none; }
.hb-steps::-webkit-scrollbar { display: none; }
.hb-step { flex: 1 0 auto; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; color: var(--b-fg-3); font: 600 14px/1.2 var(--b-sans); white-space: nowrap; }
.hb-step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--b-border-strong); font-size: 12px; }
.hb-step:hover { background: var(--b-surface-2); color: var(--b-fg-1); }
.hb-step[aria-current="step"] { color: var(--b-fg-1); background: var(--b-brand-tint); }
.hb-step[aria-current="step"] .hb-step-n { background: var(--b-brand); border-color: var(--b-brand); color: var(--b-on-dark); }
.hb-step.is-done .hb-step-n { border-color: var(--b-brand); color: var(--b-brand); }
.hb-step:focus-visible, .hb-seg button:focus-visible, .hb-itemise:focus-visible, .hb-link:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; }

/* Running strip */
.hb-strip { position: sticky; top: var(--hb-sticky, 80px); z-index: 5; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 14px 0; padding: 12px 16px; background: var(--b-surface-2); border: 1px solid var(--b-border); border-radius: 14px; }
.hb-strip > div { min-width: 0; }
.hb-strip span { display: block; font-size: 13.5px; font-weight: 600; color: var(--b-fg-3); }
.hb-strip strong { display: block; font-size: 19px; font-weight: 600; color: var(--b-fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-strip small { color: var(--b-fg-3); font-weight: 500; font-size: 12px; }
.hb-strip-left strong { color: var(--b-brand); }
.hb-strip-left.is-neg strong { color: var(--hb-neg); }

/* Panels */
.hb-panel { padding: 24px 26px 8px; }
.hb-panel > h2 { font-family: var(--b-serif); font-size: 28px; line-height: 1.15; margin: 0 0 6px; color: var(--b-fg-1); font-weight: 700; letter-spacing: -0.03em; }
.hb-sub { color: var(--b-fg-3); margin: 0 0 20px; max-width: 620px; font-size: 15px; line-height: 1.55; }
.hb-example { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; margin-bottom: 20px; border-radius: 12px; background: var(--b-accent-tint); font-size: 14px; color: var(--b-fg-2); }
.hb-link { border: 0; background: none; padding: 0; color: var(--b-brand); font: 600 14px var(--b-sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.hb-block { margin-bottom: 22px; }
.hb-block-title { font-size: 13.5px; font-weight: 700; color: var(--b-fg-3); margin: 0 0 8px; }

/* Rows and inputs */
.hb-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 130px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hb-hair); }
.hb-row:last-child { border-bottom: 0; }
.hb-row label { font-weight: 600; font-size: 14.5px; color: var(--b-fg-1); min-width: 0; }
.hb-row label small { display: block; font-weight: 400; color: var(--b-fg-3); font-size: 12.5px; }
.hb-row-single { grid-template-columns: minmax(0, 1fr) 150px; }
.hb-row-flat { border: 0; padding: 0 0 8px; }
.hb-money { display: flex; align-items: center; height: 44px; border: 1px solid var(--b-border-strong); border-radius: 10px; background: var(--b-bg); transition: border-color 160ms, box-shadow 160ms, background 160ms; }
.hb-money:focus-within { border-color: var(--b-brand); background: #fff; box-shadow: 0 0 0 4px rgba(30, 79, 214, 0.16); }
.hb-money span { padding-left: 12px; color: var(--b-fg-3); font-weight: 600; }
.hb-money input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; padding: 0 10px 0 4px; font: 600 16px var(--b-sans); color: var(--b-fg-1); font-variant-numeric: tabular-nums; text-align: right; }
.hb-money input[readonly] { color: var(--b-fg-3); }
.hb-freq { -webkit-appearance: none; appearance: none; height: 44px; border: 1px solid var(--b-border-strong); border-radius: 10px; padding: 0 40px 0 14px; font: 500 14px var(--b-sans); color: var(--b-fg-1); cursor: pointer;
  background: var(--b-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23515B6E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 12px; }
.hb-freq::-ms-expand { display: none; }
.hb-freq:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 1px; }

.hb-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--b-surface-2); border: 1px solid var(--b-border); border-radius: 12px; }
.hb-seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; cursor: pointer; font: 600 14px var(--b-sans); color: var(--b-fg-3); transition: background 160ms, color 160ms; }
.hb-seg button:hover { color: var(--b-fg-1); }
.hb-seg button[aria-pressed="true"] { background: var(--b-surface); color: var(--b-fg-1); box-shadow: 0 1px 3px rgba(13, 18, 32, 0.12); }
.hb-toggle-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--b-surface-2); margin-bottom: 18px; }
.hb-toggle-row p { margin: 0; color: var(--b-fg-2); font-size: 14.5px; }

/* Category cards */
.hb-cat { border: 1px solid var(--b-border); border-radius: 14px; margin-bottom: 10px; background: var(--b-surface); }
.hb-cat-head { display: grid; grid-template-columns: minmax(0, 1fr) 150px 130px; gap: 10px; align-items: center; padding: 12px 14px; }
.hb-cat-name { min-width: 0; }
.hb-cat-name strong { font-size: 15px; color: var(--b-fg-1); }
.hb-cat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--b-fg-3); }
.hb-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 700; }
.hb-tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.hb-tag-ess { color: var(--hb-ess); }
.hb-tag-life { color: var(--b-accent); }
.hb-itemise { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px 4px 10px; border: 1px solid var(--b-brand); border-radius: 999px; background: var(--b-brand-tint); font: 600 12.5px var(--b-sans); color: var(--b-brand); cursor: pointer; transition: background 160ms, color 160ms, border-color 160ms; }
.hb-itemise svg { width: 14px; height: 14px; flex: none; transition: transform 200ms var(--b-ease); }
.hb-itemise:hover { background: var(--b-brand); color: var(--b-on-dark); }
.hb-itemise[aria-expanded="true"] { background: var(--b-surface); border-color: var(--b-border-strong); color: var(--b-fg-2); }
.hb-itemise[aria-expanded="true"]:hover { border-color: var(--b-fg-3); color: var(--b-fg-1); }
.hb-itemise[aria-expanded="true"] svg { transform: rotate(180deg); }
.hb-cat-lines { margin: 0 14px; padding: 0 0 6px; border-top: 1px dashed var(--b-border); }
.hb-cat-lines .hb-row { padding: 8px 0; }
.hb-cat-lines .hb-row label { font-weight: 500; }

/* Nav */
.hb-nav { display: flex; justify-content: space-between; gap: 12px; padding: 18px 26px 24px; border-top: 1px solid var(--b-border); margin-top: 10px; }
.hb-nav .btn[disabled] { opacity: 0.4; cursor: default; }

/* Results */
.hb-res-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.hb-big { font-family: var(--b-serif); font-size: clamp(2.75rem, 2rem + 3vw, 4rem); line-height: 1; color: var(--b-brand); margin-top: 8px; font-weight: 800; letter-spacing: -0.05em; }
.hb-big.is-neg { color: var(--hb-neg); }
.hb-big-label { font-size: 15px; color: var(--b-fg-2); margin-top: 6px; }
.hb-warn { padding: 12px 14px; border-radius: 12px; background: var(--hb-neg-tint); color: var(--hb-neg); font-size: 14px; font-weight: 500; margin-bottom: 16px; }
.hb-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 860px) { .hb-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.hb-box { border: 1px solid var(--b-border); border-radius: 16px; padding: 18px 18px 16px; background: var(--b-surface); min-width: 0; }
.hb-box h3 { font: 700 13.5px var(--b-sans); color: var(--b-fg-3); margin: 0 0 14px; }
.hb-span2 { grid-column: 1 / -1; }
.hb-note { font-size: 13.5px; line-height: 1.5; color: var(--b-fg-3); margin: 12px 0 0; }
.hb-note-top { margin: 0 0 14px; }

.hb-wf { display: grid; gap: 9px; }
.hb-wf-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: 14px; }
.hb-wf-lbl { color: var(--b-fg-2); font-weight: 500; }
.hb-wf-amt { text-align: right; font-weight: 600; color: var(--b-fg-1); font-variant-numeric: tabular-nums; }
.hb-wf-track { position: relative; height: 22px; background: var(--b-sunk); border-radius: 6px; overflow: hidden; }
.hb-wf-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; transition: left 400ms var(--b-ease), width 400ms var(--b-ease); }
.hb-wf-row.is-total { padding-top: 8px; border-top: 1px solid var(--b-border); }
.hb-wf-row.is-total .hb-wf-lbl, .hb-wf-row.is-total .hb-wf-amt { color: var(--b-fg-1); font-weight: 700; }

.hb-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hb-tile { padding: 14px; border-radius: 12px; background: var(--b-surface-2); min-width: 0; }
.hb-tile span { display: block; font-size: 13px; color: var(--b-fg-3); }
.hb-tile strong { display: block; font-size: 24px; font-weight: 600; margin: 2px 0; color: var(--b-fg-1); }
.hb-tile small { color: var(--b-fg-3); font-size: 12.5px; }
.hb-tile-wide { margin-top: 12px; }
.hb .is-pos { color: var(--b-brand); }
.hb .is-neg { color: var(--hb-neg); }
.hb-wi-out { margin-top: 14px; }

.hb-stack { display: flex; height: 34px; border-radius: 8px; overflow: hidden; background: var(--b-sunk); }
.hb-stack div { flex: 0 0 0; min-width: 0; transition: flex-basis 400ms var(--b-ease); }
.hb-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 28px; margin-top: 16px; }
.hb-legend > div { display: grid; grid-template-columns: 12px minmax(0, 1fr); column-gap: 8px; row-gap: 2px; align-items: center; font-size: 13.5px; min-width: 0; }
.hb-legend i { width: 12px; height: 12px; border-radius: 3px; }
.hb-legend span { color: var(--b-fg-2); font-weight: 500; }
.hb-legend b { grid-column: 2; font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--b-fg-1); }
.hb-legend em { grid-column: 2; font-style: normal; color: var(--b-fg-3); font-size: 12.5px; }

.hb-rank { display: grid; gap: 10px; }
.hb-rank-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 14px; }
.hb-rank-n { font-weight: 700; color: var(--b-fg-3); }
.hb-rank-row.is-top .hb-rank-n { color: var(--b-accent); }
.hb-rank-nm { min-width: 0; }
.hb-rank-nm > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.hb-rank-nm span { font-weight: 500; color: var(--b-fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-rank-nm small { color: var(--b-fg-3); white-space: nowrap; }
.hb-rank-bar { height: 6px; margin-top: 5px; border-radius: 3px; background: var(--b-sunk); overflow: hidden; }
.hb-rank-bar i { display: block; height: 100%; border-radius: 3px; transition: width 400ms var(--b-ease); }
.hb-rank-amt { text-align: right; font-weight: 600; color: var(--b-fg-1); font-variant-numeric: tabular-nums; }

.hb-list { margin: 0; padding: 0; list-style: none; }
.hb-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hb-hair); font-size: 14.5px; color: var(--b-fg-1); }
.hb-list li.is-sum { font-weight: 700; border-top: 1px solid var(--b-border); border-bottom: 0; }

.hb-buffer { font-family: var(--b-serif); font-size: 46px; line-height: 1; color: var(--b-fg-1); font-weight: 800; letter-spacing: -0.05em; }
.hb-buffer small { font-family: var(--b-sans); font-size: 15px; color: var(--b-fg-3); margin-left: 6px; }
.hb-buf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-bottom: 14px; }
.hb-buf-head h3 { margin: 0; }
.hb-buf-head .hb-seg button { padding: 6px 10px; font-size: 13px; }
.hb-buf-head .hb-seg[hidden] { display: none; }
@media (max-width: 560px) {
  .hb-buf-head .hb-seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .hb-buf-head .hb-seg button { padding: 7px 4px; font-size: 12.5px; line-height: 1.25; white-space: normal; }
}
.is-covered .hb-buffer { color: var(--b-brand); }
.hb-meter { position: relative; height: 10px; margin-top: 14px; border-radius: 5px; background: var(--b-sunk); }
.hb-meter i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--hb-ess); transition: width 400ms var(--b-ease); }
.hb-ticks { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--b-fg-3); margin-top: 5px; }

.hb-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; margin-top: 18px; }
.hb-actions-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.hb-save { margin: 0; font-size: 13px; color: var(--b-fg-3); }
.hb-cta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin: 16px 0 8px; padding: 22px; border-radius: 16px; background: var(--b-sunk); }
.hb-cta h3 { font-family: var(--b-serif); font-size: 24px; margin: 0 0 4px; color: var(--b-fg-1); font-weight: 700; letter-spacing: -0.03em; }
.hb-cta p { margin: 0; color: var(--b-fg-2); max-width: 520px; font-size: 15px; }

@media (max-width: 640px) {
  .hb-panel { padding: 20px 16px 4px; }
  .hb-nav { padding: 16px; }
  .hb-row, .hb-cat-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hb-row label, .hb-cat-name { grid-column: 1 / -1; }
  .hb-row-single { grid-template-columns: minmax(0, 1fr); }
  .hb-strip { margin: 12px 10px 0; padding: 10px 12px; }
  .hb-strip strong { font-size: 16px; }
  .hb-wf-row { grid-template-columns: 92px minmax(0, 1fr) 78px; font-size: 13px; }
  .hb-pair { grid-template-columns: minmax(0, 1fr); }
  .hb-step-t { display: none; }
  .hb-step[aria-current="step"] .hb-step-t { display: inline; }
}
@media (prefers-reduced-motion: reduce) { .hb * { transition: none !important; } }

/* Print: results only, so it can be saved as a PDF and brought to a call. */
@media print {
  body * { visibility: hidden; }
  .hb-print-area, .hb-print-area * { visibility: visible; }
  .hb-print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 0; }
  .hb { box-shadow: none; border: 0; }
  .hb-actions, .hb-cta { display: none !important; }
  .hb-box { break-inside: avoid; }
  .hb-grid { grid-template-columns: 1fr 1fr; }
  .hb-wf-bar, .hb-stack div, .hb-rank-bar i, .hb-meter i, .hb-legend i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Schibsted's tabular figures set commas and points too wide; use its default figures everywhere */
.calc *, .calc-chart-card *, .hb * { font-variant-numeric: normal !important; }
