:root {
  --bg: #f5efe4;
  --surface: rgba(255, 252, 246, 0.92);
  --surface-strong: #fffaf0;
  --ink: #1f2933;
  --muted: #5c6b73;
  --line: rgba(31, 41, 51, 0.12);
  --coral: #dd6b4d;
  --gold: #d0a64f;
  --teal: #2f7c78;
  --cream: #ead8be;
  --shadow: 0 20px 60px rgba(75, 54, 33, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Be Vietnam Pro", sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(221, 107, 77, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(47, 124, 120, 0.18), transparent 28%),
    linear-gradient(180deg, #f7f1e7 0%, #efe5d4 100%);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 16px calc(54px + env(safe-area-inset-bottom, 0px));
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
  min-width: 0;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 34px;
}

.hero-card {
  padding: 30px;
  background:
    linear-gradient(160deg, rgba(31, 41, 51, 0.96), rgba(47, 124, 120, 0.88)),
    var(--surface);
  color: #fff9f0;
}

.eyebrow,
.mini-label,
.summary-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
}

.eyebrow {
  color: var(--coral);
}

.hero h1,
.panel h2,
.nested-heading h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  line-height: 1.04;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.8rem, 4vw, 4.6rem);
  margin-bottom: 18px;
}

.hero-text,
.muted,
.hero-list,
.insight-card p,
.trust-notes p,
.table-panel p,
.nested-heading p {
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.preset-chip,
.primary-button {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(31, 41, 51, 0.06);
  color: var(--ink);
  font-weight: 600;
}

.preset-chip:hover,
.preset-chip:focus-visible,
.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-2px);
}

.hero-list {
  padding-left: 18px;
  margin: 18px 0 0;
  color: rgba(255, 249, 240, 0.9);
}

.hero-list li + li {
  margin-top: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  min-width: 0;
  margin-bottom: 24px;
}

.panel {
  padding: 28px;
  min-width: 0;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
  min-width: 0;
}

.panel-heading > * {
  min-width: 0;
}

.loan-form {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.loan-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.loan-form label span {
  line-height: 1.4;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  min-width: 0;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.input-wrap small {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.select-wrap {
  padding-right: 10px;
}

.primary-button {
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  min-height: 56px;
  padding: 16px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--coral), #ea8e54);
  color: #fff;
  font-weight: 700;
  text-align: center;
  white-space: normal;
  box-shadow: 0 14px 30px rgba(221, 107, 77, 0.28);
}

.muted,
.hero-text,
.nested-heading p,
.trust-notes p,
.insight-card p,
.summary-card small {
  overflow-wrap: anywhere;
}

.trust-notes {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.trust-notes article,
.insight-card,
.nested-panel,
.faq-item,
.seo-copy-grid article,
.noscript-panel,
.partner-panel {
  border-radius: var(--radius-md);
  background: rgba(255, 250, 240, 0.82);
  border: 1px solid rgba(31, 41, 51, 0.08);
}

.trust-notes article {
  padding: 18px;
}

.seo-intro,
.seo-content,
.faq-panel,
.partner-panel {
  margin-bottom: 24px;
}

.partner-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.partner-copy {
  min-width: 0;
}

.partner-copy h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  line-height: 1.08;
}

.partner-copy p:last-child {
  margin-bottom: 0;
}

.partner-actions {
  display: grid;
  gap: 12px;
  min-width: min(320px, 100%);
}

.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.cta-link:hover,
.cta-link:focus-visible {
  transform: translateY(-2px);
}

.partner-primary {
  color: #fff;
  background: linear-gradient(135deg, #2f7c78, #63b5ab);
  box-shadow: 0 14px 26px rgba(47, 124, 120, 0.22);
}

.guide-secondary {
  color: var(--ink);
  background: rgba(31, 41, 51, 0.06);
}

.compact-heading {
  margin-bottom: 18px;
}

.seo-copy-grid,
.faq-list {
  display: grid;
  gap: 16px;
}

.seo-copy-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seo-copy-grid article,
.faq-item,
.noscript-panel {
  padding: 18px;
}

.seo-copy-grid h3,
.faq-item h3 {
  margin: 0 0 10px;
  font-size: 1.02rem;
}

.seo-copy-grid p,
.faq-item p,
.noscript-panel p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.trust-notes h3,
.insight-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.summary-grid,
.insight-grid {
  display: grid;
  gap: 14px;
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary-card {
  padding: 20px;
  border-radius: 22px;
  color: #172026;
  position: relative;
  overflow: hidden;
}

.summary-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.summary-card strong {
  display: block;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  line-height: 1.2;
  margin-bottom: 8px;
  word-break: break-word;
}

.summary-card small {
  color: rgba(23, 32, 38, 0.76);
}

.accent-coral { background: linear-gradient(135deg, #f5c7aa, #ee9d77); }
.accent-gold { background: linear-gradient(135deg, #efd69f, #d7b25f); }
.accent-teal { background: linear-gradient(135deg, #b7e0d3, #6db0a5); }
.accent-cream { background: linear-gradient(135deg, #f4e9d2, #e5cda0); }

.insight-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.insight-card,
.nested-panel {
  padding: 18px;
}

.nested-panel + .nested-panel {
  margin-top: 16px;
}

.nested-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.composition-bars {
  display: grid;
  gap: 14px;
}

.composition-bars span {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

.bar-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(31, 41, 51, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 360ms ease;
}

.principal-fill { background: linear-gradient(90deg, #2f7c78, #63b5ab); }
.interest-fill { background: linear-gradient(90deg, #dd6b4d, #efa987); }

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
}

thead th {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

tbody tr {
  animation: riseIn 320ms ease;
}

.results-panel,
.table-panel {
  scroll-margin-top: 16px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1060px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .partner-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .partner-actions {
    min-width: 0;
  }

  .hero h1 {
    max-width: 14ch;
  }

  .form-panel,
  .results-panel {
    padding: 24px;
  }

  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seo-copy-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding-inline: 10px;
    padding-top: 12px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .panel-heading,
  .nested-heading {
    flex-direction: column;
    gap: 10px;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(2rem, 9vw, 2.7rem);
  }

  .hero-text,
  .muted,
  .hero-list,
  .insight-card p,
  .trust-notes p,
  .table-panel p,
  .nested-heading p {
    line-height: 1.6;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .preset-chip {
    width: 100%;
    justify-content: center;
  }

  .loan-form {
    gap: 14px;
  }

  .loan-form label {
    gap: 6px;
  }

  .summary-grid,
  .insight-grid,
  .faq-list,
  .seo-copy-grid {
    grid-template-columns: 1fr;
  }

  .summary-card,
  .insight-card,
  .nested-panel,
  .trust-notes article,
  .faq-item,
  .seo-copy-grid article,
  .noscript-panel,
  .partner-panel {
    padding: 16px;
  }

  .cta-link {
    width: 100%;
  }

  .summary-card strong {
    font-size: 1.7rem;
  }

  .primary-button {
    margin-top: 14px;
    box-shadow: 0 18px 34px rgba(221, 107, 77, 0.34);
  }

  .form-panel,
  .results-panel,
  .hero-copy,
  .hero-card {
    overflow: hidden;
  }

  .table-panel {
    padding-right: 0;
    padding-left: 0;
    overflow: hidden;
  }

  .table-panel .nested-heading {
    padding: 0 18px;
  }

  .table-wrap {
    padding: 0 0 8px;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    padding: 12px 10px;
    white-space: nowrap;
  }

  thead th {
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .page-shell {
    padding-inline: 6px;
    padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  }

  .hero,
  .layout {
    gap: 14px;
  }

  .layout {
    margin-bottom: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 22px;
    padding: 16px;
  }

  .eyebrow,
  .mini-label,
  .summary-label {
    font-size: 0.7rem;
  }

  .input-wrap {
    min-height: 54px;
    padding: 10px 12px;
  }

  .input-wrap small {
    font-size: 0.75rem;
  }

  .primary-button {
    bottom: 8px;
    border-radius: 16px;
  }

  .summary-card strong {
    font-size: 1.55rem;
  }

  .table-panel .nested-heading {
    padding: 0 16px;
  }
}