.afford-page {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 245, 239, 0.96) 430px),
    var(--paper);
}

.afford-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: clamp(26px, 5vw, 64px);
  align-items: end;
  padding: clamp(48px, 8vw, 88px) clamp(18px, 4vw, 56px) clamp(28px, 5vw, 48px);
  border-bottom: 1px solid rgba(13, 27, 42, 0.08);
}

.afford-hero-copy {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 900px;
}

.afford-back-link {
  width: fit-content;
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 900;
}

.afford-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 76px);
  font-weight: 700;
  line-height: 1.04;
  text-wrap: balance;
}

.afford-hero-copy p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.74;
}

.afford-hero-media {
  position: relative;
  overflow: hidden;
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.afford-hero-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.afford-hero-media figcaption {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: grid;
  gap: 5px;
  padding: 14px;
  color: var(--white);
  background: rgba(7, 9, 13, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.afford-hero-media strong {
  font-size: 14px;
}

.afford-hero-media span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.5;
}

.afford-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
  gap: clamp(20px, 4vw, 42px);
  align-items: start;
  padding: clamp(26px, 5vw, 54px) clamp(18px, 4vw, 56px);
}

.afford-control-panel,
.afford-results-panel,
.afford-breakdown-section,
.afford-scenario-section,
.afford-insight-section,
.afford-faq-section {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 42px rgba(11, 17, 29, 0.07);
}

.afford-control-panel,
.afford-results-panel {
  padding: clamp(18px, 2.8vw, 28px);
}

.afford-results-panel {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 18px;
}

.afford-panel-head {
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
}

.afford-panel-head h2,
.afford-chart-panel h2,
.afford-section-head h2,
.afford-insight-copy h2 {
  font-size: clamp(25px, 3.1vw, 38px);
  line-height: 1.18;
}

.afford-panel-head p:not(.section-kicker),
.afford-section-head p,
.afford-insight-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.afford-form {
  display: grid;
  gap: 20px;
}

.afford-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.afford-fieldset legend {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.afford-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  grid-auto-rows: minmax(116px, auto);
}

.afford-form label {
  display: grid;
  grid-template-rows: minmax(34px, auto) minmax(44px, auto) auto;
  align-content: start;
  gap: 8px;
  min-width: 0;
  height: 100%;
  padding: 12px;
  border: 1px solid rgba(13, 27, 42, 0.09);
  border-radius: 8px;
  color: #2d3442;
  background: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.afford-form input,
.afford-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(13, 27, 42, 0.16);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfaf6;
  font-size: 15px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.afford-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.afford-form input:focus,
.afford-form select:focus {
  outline: none;
  border-color: rgba(200, 164, 93, 0.72);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(200, 164, 93, 0.16);
}

.afford-mode-field {
  grid-column: 1 / -1;
  grid-template-rows: minmax(24px, auto) minmax(44px, auto);
  min-height: 0;
}

.afford-field-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.afford-form-note {
  margin: -4px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(200, 164, 93, 0.28);
  border-radius: 8px;
  color: #4f5665;
  background: rgba(200, 164, 93, 0.1);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.62;
}

[data-loan-only].is-hidden {
  display: none;
}

.afford-input-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  min-height: 44px;
  border: 1px solid rgba(13, 27, 42, 0.16);
  border-radius: 8px;
  background: #fbfaf6;
}

.afford-input-suffix input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.afford-input-suffix small {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.afford-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.afford-score-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid rgba(200, 164, 93, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(200, 164, 93, 0.16), rgba(255, 255, 255, 0.94)),
    var(--white);
}

.afford-score-card span,
.afford-score-card small,
.afford-metric span,
.afford-metric small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.afford-score-card strong {
  color: var(--ink);
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.afford-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.afford-metric {
  display: grid;
  gap: 6px;
  min-height: 126px;
  padding: 16px;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfaf6);
}

.afford-metric strong {
  align-self: center;
  color: var(--ink);
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.afford-card-status {
  display: block;
}

.afford-metric.is-ok {
  border-color: rgba(38, 133, 86, 0.28);
  background: linear-gradient(180deg, #ffffff, rgba(38, 133, 86, 0.08));
}

.afford-metric.is-review {
  border-color: rgba(200, 164, 93, 0.44);
  background: linear-gradient(180deg, #ffffff, rgba(200, 164, 93, 0.12));
}

.afford-metric.is-danger {
  border-color: rgba(217, 97, 76, 0.36);
  background: linear-gradient(180deg, #ffffff, rgba(217, 97, 76, 0.1));
}

.afford-metric.is-ok .afford-card-status {
  color: #267f56;
}

.afford-metric.is-review .afford-card-status {
  color: #9c7230;
}

.afford-metric.is-danger .afford-card-status {
  color: #9f2d1f;
}

.afford-alert {
  padding: 14px 16px;
  border: 1px solid rgba(13, 27, 42, 0.12);
  border-radius: 8px;
  color: #263140;
  background: #f6f3ea;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.afford-alert.is-ok {
  border-color: rgba(38, 133, 86, 0.28);
  background: rgba(38, 133, 86, 0.09);
}

.afford-alert.is-review {
  border-color: rgba(200, 164, 93, 0.44);
  background: rgba(200, 164, 93, 0.13);
}

.afford-alert.is-danger {
  border-color: rgba(217, 97, 76, 0.36);
  background: rgba(217, 97, 76, 0.1);
}

.afford-chart-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.afford-chart-panel canvas {
  width: 100%;
  height: 260px;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 8px;
  background: #fbfaf6;
}

.afford-breakdown-section,
.afford-scenario-section,
.afford-insight-section,
.afford-faq-section {
  margin: clamp(22px, 4vw, 42px) clamp(18px, 4vw, 56px);
  padding: clamp(20px, 3.6vw, 34px);
}

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

.afford-section-head p {
  max-width: 520px;
}

.afford-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.afford-breakdown-grid article {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 8px;
  background: var(--white);
}

.afford-breakdown-grid span {
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 900;
}

.afford-breakdown-grid h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.afford-breakdown-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
}

.afford-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.afford-scenario-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 14px;
}

.afford-scenario-table th,
.afford-scenario-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.afford-scenario-table th {
  color: var(--ink);
  background: #f4f0e6;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.afford-scenario-table td {
  color: #2d3442;
  font-weight: 700;
}

.afford-scenario-table tr:last-child td {
  border-bottom: 0;
}

.afford-insight-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.72fr);
  gap: clamp(22px, 5vw, 54px);
  align-items: start;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 245, 239, 0.92)),
    linear-gradient(90deg, rgba(200, 164, 93, 0.14), rgba(13, 27, 42, 0.04));
}

.afford-insight-copy {
  display: grid;
  gap: 14px;
}

.afford-insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.afford-related-links {
  display: grid;
  gap: 12px;
}

.afford-related-links a {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 8px;
  background: var(--white);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.afford-related-links a:hover {
  border-color: rgba(200, 164, 93, 0.48);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.afford-related-links span {
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.afford-related-links strong {
  color: var(--ink);
  line-height: 1.4;
}

.afford-faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.afford-faq-grid details {
  padding: 18px;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 8px;
  background: var(--white);
}

.afford-faq-grid summary {
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.afford-faq-grid p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.afford-disclaimer {
  max-width: 1120px;
  margin: 0 clamp(18px, 4vw, 56px) clamp(34px, 5vw, 58px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.65;
}

@media (max-width: 1100px) {
  .afford-hero,
  .afford-workspace,
  .afford-insight-section {
    grid-template-columns: 1fr;
  }

  .afford-results-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .afford-hero {
    padding-top: 34px;
    padding-bottom: 20px;
  }

  .afford-hero h1 {
    font-size: clamp(34px, 10vw, 44px);
  }

  .afford-hero-copy p {
    font-size: 16px;
    line-height: 1.66;
  }

  .afford-hero-media {
    display: none;
  }

  .afford-input-grid,
  .afford-summary-grid,
  .afford-breakdown-grid,
  .afford-faq-grid {
    grid-template-columns: 1fr;
  }

  .afford-input-grid {
    grid-auto-rows: auto;
    gap: 10px;
  }

  .afford-form label {
    grid-template-rows: auto;
    min-height: 0;
    padding: 11px;
  }

  .afford-section-head {
    display: grid;
    align-items: start;
  }

  .afford-actions,
  .afford-insight-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .afford-actions .button,
  .afford-insight-actions .button {
    width: 100%;
  }

  .afford-chart-panel canvas {
    height: 230px;
  }

  .afford-scenario-table {
    display: block;
    min-width: 0;
    font-size: 13px;
  }

  .afford-scenario-table thead {
    display: none;
  }

  .afford-scenario-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .afford-scenario-table tr {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
  }

  .afford-scenario-table td {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    overflow-wrap: anywhere;
  }

  .afford-scenario-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-align: left;
    text-transform: uppercase;
  }

  .afford-scenario-table td:last-child {
    border-bottom: 0;
  }
}
