.calculator-page .calculator-grid {
  grid-template-columns: minmax(0, 1.03fr) minmax(380px, .97fr);
  gap: 28px;
}

.calculator-page .calculator-form,
.calculator-page .calculator-result {
  border-radius: 16px;
  box-shadow: 0 22px 55px rgba(16, 34, 50, .08);
}

.calculator-page .calculator-form {
  padding: clamp(24px, 3vw, 42px);
}

.calculator-page .section-heading h2 {
  max-width: 680px;
}

.form-section {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.form-section h3,
.section-title h3 {
  color: var(--night);
  font-size: 18px;
  letter-spacing: -.015em;
}

.form-section p,
.section-title p {
  color: var(--muted);
  line-height: 1.55;
}

.profile-guidance {
  margin-top: 13px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 700;
}

.choice-grid input:focus-visible + span,
.period-toggle input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.choice-grid {
  align-items: stretch;
  gap: 12px;
  margin-top: 14px;
}

.choice-grid label {
  display: flex;
}

.choice-grid span {
  display: flex;
  width: 100%;
  min-height: 82px;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  line-height: 1.25;
}

.calculator-page .field-grid {
  align-items: start;
}

.calculator-page .field-grid label {
  align-self: start;
}

.scope-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 26px;
  align-items: start;
}

.scope-card {
  display: grid;
  min-height: 138px;
  align-content: start;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid #c7d5dc;
  border-radius: 14px;
  background: #f3f7f8;
}

.scope-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.scope-card h3 {
  margin: 4px 0 0;
}

.scope-card p,
.scope-card small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.scope-lock {
  align-content: start;
}

.scope-lock strong {
  color: var(--night);
  font-size: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}

.compact-select {
  display: grid;
  min-width: 185px;
  gap: 6px;
  align-self: start;
  padding: 12px 14px;
  border: 1px solid #d2e0e5;
  border-radius: 14px;
  background: #f3f7f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-select select,
.relief-input select {
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid #bdcbd3;
  border-radius: 10px;
  padding: 8px 11px;
  background: #fff;
  color: var(--night);
  font: 700 14px/1.2 KlaroText, Inter, sans-serif;
}

.plain-checks {
  margin-top: 22px;
  padding: 18px;
  border-radius: 12px;
  background: #f4f8f8;
}

.check-group + .check-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(23, 50, 77, .12);
}

.check-group h4 {
  margin: 0;
  color: var(--night);
  font-size: 15px;
}

.check-group p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.plain-checks .check:first-child {
  margin-top: 0;
}

.calculator-page .relief-section {
  margin: 34px 0 0;
  padding: 26px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.calculator-page .relief-section summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  min-height: 50px;
  align-items: center;
  padding: 0;
  list-style: none;
}

.calculator-page .relief-section summary::-webkit-details-marker {
  display: none;
}

.calculator-page .relief-section summary::after {
  content: "+";
  justify-self: end;
  color: var(--teal);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.calculator-page .relief-section[open] summary::after {
  content: "−";
}

.calculator-page .relief-section summary span {
  display: grid;
  gap: 3px;
}

.calculator-page .relief-section summary strong {
  font-size: 19px;
}

.calculator-page .relief-section summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.relief-fields {
  display: grid;
  gap: 12px;
}

.relief-input {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, .6fr) 112px;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.relief-input > label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--night);
  font-size: 13px;
  font-weight: 750;
}

.relief-input[data-relief="mortgage"] > label:first-child {
  font-size: 12px;
  line-height: 1.25;
}

.relief-input input,
.relief-input select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #bdcbd3;
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  color: var(--night);
  font: inherit;
}

.relief-input-static {
  grid-template-columns: 1fr;
}

.relief-input-static p {
  margin: 0;
  font-size: 13px;
}

.rent-input {
  grid-template-columns: minmax(0, 1fr) minmax(175px, .8fr);
}

.rent-year-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #eef5f7;
  color: var(--ink) !important;
  font-size: 13px;
}

.calculator-page .review-box {
  background: #f2f6f8;
  border: 1px solid #dce6eb;
}

.calculator-page .calculator-result {
  padding: 0;
  overflow: hidden;
  background: #f8fafb;
  border-radius: 28px;
  position: static;
  align-self: start;
}

.result-intro {
  padding: 34px 34px 22px;
  background: #fff;
}

.result-intro > span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.result-intro h2 {
  margin-top: 10px;
  font-size: clamp(30px, 4vw, 46px);
}

[data-result-content] {
  display: grid;
  gap: 14px;
  padding: 0 18px 22px;
}

.result-empty {
  display: grid;
  place-items: start;
  min-height: 330px;
  align-content: center;
  padding: 38px 28px;
  color: var(--muted);
}

.result-empty h3 {
  margin: 18px 0 8px;
  color: var(--night);
  font-size: 20px;
}

.empty-mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: conic-gradient(from 225deg, #176b75 0 72%, #dce8eb 72% 100%);
  box-shadow: inset 0 0 0 12px #f8fafb;
}

.result-summary {
  margin: 0 -18px;
  padding: 30px 34px 28px;
  background: linear-gradient(135deg, #103b66 0%, #124f68 58%, #176b75 100%);
  color: #fff;
  border-radius: 0 0 28px 28px;
}

.result-summary .result-total {
  margin: 0 0 5px;
  color: #dcebf0;
}

.result-summary .result-amount {
  color: #fff;
  font-size: clamp(40px, 5vw, 64px);
}

.result-summary .result-note {
  max-width: 52ch;
  color: #dcebf0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, .22);
}

.metric-grid div {
  padding: 13px;
  background: rgba(9, 31, 48, .38);
}

.metric-grid dt {
  color: #cfe2e8;
  font-size: 11px;
  line-height: 1.35;
}

.metric-grid dd {
  margin: 5px 0 0;
  color: #fff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-section {
  padding: 24px;
  border-radius: 14px;
  background: #fff;
}

.result-section h3 {
  margin: 0;
  color: var(--night);
  font-size: 20px;
}

.section-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.income-section {
  background: #edf7f5;
}

.relief-result-section {
  background: #f4f2fa;
}

.band-section {
  background: #eef4fa;
}

.source-chart {
  display: flex;
  height: 13px;
  margin: 22px 0 18px;
  overflow: hidden;
  border-radius: 8px;
  background: #dbe5e8;
}

.source-chart span {
  flex: 0 0 auto;
}

.source-chart span:nth-child(1) { background: #103b66; }
.source-chart span:nth-child(2) { background: #176b75; }
.source-chart span:nth-child(3) { background: #64a89f; }

.result-table {
  width: 100%;
  border-collapse: collapse;
}

.result-table th,
.result-table td {
  padding: 12px 0;
  border-bottom: 1px solid rgba(23, 50, 77, .12);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  color: var(--ink);
  font-weight: 700;
}

.result-table .income-row th {
  border-left: 3px dotted #103b66;
  padding-left: 12px;
}

.result-table .income-row.source-business th {
  border-left-color: #176b75;
}

.result-table .income-row.source-other th {
  border-left-color: #64a89f;
}

.result-table .total-note td {
  padding: 10px 0 2px;
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.result-table td {
  color: var(--night);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.result-table tr:last-child th,
.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table .total-row th,
.result-table .total-row td {
  padding-top: 16px;
  font-weight: 850;
}

.relief-table td span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.evidence-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(23, 50, 77, .14);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.band-chart {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.band-row {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 12px;
  align-items: center;
}

.band-rate {
  color: var(--night);
  font-size: 14px;
  font-weight: 850;
}

.band-track {
  height: 10px;
  overflow: hidden;
  border-radius: 8px;
  background: #d6e1eb;
}

.band-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: #176b75;
}

.band-value {
  color: var(--ink);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.band-tax {
  grid-column: 2 / -1;
  margin-top: -9px;
  color: var(--muted);
  font-size: 12px;
}

.explain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.explain-panel {
  padding: 22px;
  border-radius: 14px;
  background: #fff;
}

.explain-panel h3 {
  color: var(--night);
  font-size: 17px;
}

.explain-panel ul {
  margin: 12px 0 0;
  padding-left: 19px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.result-action {
  padding: 10px 6px 4px;
}

.result-action .button {
  width: 100%;
  text-align: center;
}

.result-trust {
  margin: 0;
  padding: 18px 6px 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 1040px) {
  .calculator-page .calculator-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .scope-section,
  .section-title,
  .relief-input,
  .rent-input,
  .explain-grid { grid-template-columns: 1fr; }
  .section-title { align-items: stretch; }
  .compact-select { min-width: 0; }
  .metric-grid { grid-template-columns: 1fr; }
  .relief-input { gap: 10px; }
  .band-row { grid-template-columns: 60px 1fr; }
  .band-value { grid-column: 2; text-align: left; }
  .band-tax { grid-column: 2; margin-top: -6px; }
  .scope-section { gap: 12px; }
}

@media (max-width: 480px) {
  .result-intro { padding: 26px 22px 18px; }
  [data-result-content] { padding: 0 10px 14px; }
  .result-summary { margin: 0 -10px; padding: 26px 22px; }
  .result-section,
  .explain-panel { padding: 19px; }
  .result-table th { width: 54%; }
}

/* Keep units inline and tie each ledger row to the matching source-chart colour. */
.calculator-page .field-grid label > span { display: inline; margin-left: 4px; }
.calculator-page .field-grid label > .field-unit-spacer {
  display: block;
  min-height: 15px;
  margin-left: 0;
  color: transparent;
  user-select: none;
}
.income-table .income-row th { position: relative; }
.income-table .income-row th::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: repeating-linear-gradient(to bottom, currentColor 0 4px, transparent 4px 8px);
}
.income-table .income-row.source-employment th { color: #103b66; }
.income-table .income-row.source-business th { color: #176b75; }
.income-table .income-row.source-other th { color: #5aa59f; }
.income-table .income-row.source-employment td { background: linear-gradient(90deg, rgba(16,59,102,.06), transparent 42%); }
.income-table .income-row.source-business td { background: linear-gradient(90deg, rgba(23,107,117,.08), transparent 42%); }
.income-table .income-row.source-other td { background: linear-gradient(90deg, rgba(90,165,159,.11), transparent 42%); }

/* Approved Option A: calm source cards with a chart-matched rail and icon cue. */
.income-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.income-table .income-row th,
.income-table .income-row td {
  border-bottom: 0;
  background-color: #f7fbfc;
}

.income-table .income-row th {
  width: 68%;
  padding: 14px 16px 14px 42px;
  border-left: 6px solid #103b66;
  border-radius: 12px 0 0 12px;
}

.income-table .income-row td {
  padding: 14px 16px;
  border-radius: 0 12px 12px 0;
  font-weight: 700;
}

.income-table .income-row th::before {
  left: 15px;
  top: 50%;
  bottom: auto;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: rgba(16, 59, 102, .12);
  content: "▣";
  color: #103b66;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.income-table .income-row.source-business th { border-left-color: #176b75; }
.income-table .income-row.source-business th::before { content: "▤"; color: #176b75; background: rgba(23, 107, 117, .12); }
.income-table .income-row.source-other th { border-left-color: #64a89f; }
.income-table .income-row.source-other th::before { content: "◆"; color: #64a89f; background: rgba(100, 168, 159, .14); }

.income-panel .section-title > div:first-child {
  position: relative;
  padding-right: 42px;
}

.income-panel .section-title h3 {
  margin-bottom: 4px;
  font-size: 24px;
}

.income-panel .section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.income-collapse-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--teal);
  font: 700 26px/1 Inter, Arial, sans-serif;
  cursor: pointer;
}

.income-collapse-toggle:hover,
.income-collapse-toggle:focus-visible {
  background: rgba(23, 107, 117, .10);
}

.source-chart-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.source-chart-key span { display: inline-flex; align-items: center; gap: 6px; }
.source-chart-key i { width: 8px; height: 8px; border-radius: 50%; background: #103b66; }
.source-chart-key span:nth-child(2) i { background: #176b75; }
.source-chart-key span:nth-child(3) i { background: #64a89f; }

.income-table .income-row th small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
