:root {
  color-scheme: light;
  --ink: #17243a;
  --muted: #69778c;
  --blue: #2459d3;
  --blue-dark: #1949ba;
  --line: #e3e9f2;
  --surface: #ffffff;
  --canvas: #f6f8fc;
  font-family: 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

button, input { font: inherit; }

.page-shell { width: min(100% - 40px, 1040px); margin: 0 auto; }
.site-header { display: flex; align-items: center; height: 78px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #e9efff; color: var(--blue); font-size: 24px; line-height: 1; }
.hero { max-width: 700px; margin: 52px auto 34px; text-align: center; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: .75rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: 'Segoe UI', sans-serif; }
h1 { margin-bottom: 14px; font-size: clamp(2rem, 5vw, 3.05rem); line-height: 1.14; letter-spacing: -.055em; }
.intro { max-width: 610px; margin: 0 auto; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.calculator-card { display: grid; grid-template-columns: 1fr .8fr; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 18px 55px rgb(37 55 92 / 8%); }
#mortgage-form { padding: 32px; }
.form-heading, .results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-heading h2, .results-heading h2, .formula-card h2 { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: -.035em; }
.form-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.private-note { flex: none; color: #748198; font-size: .72rem; }
.private-note span { margin-right: 5px; color: #24a77a; font-size: .6rem; }
.fields { display: grid; gap: 19px; margin: 29px 0 24px; }
.field label { display: block; margin-bottom: 8px; color: #293850; font-size: .87rem; font-weight: 600; }
.input-wrap { display: flex; align-items: center; min-height: 50px; border: 1px solid #d9e1ee; border-radius: 9px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: #7395eb; box-shadow: 0 0 0 3px rgb(36 89 211 / 11%); }
.input-wrap input { width: 100%; min-width: 0; height: 48px; padding: 0 13px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; font-weight: 600; }
.money-input input { padding-left: 0; }
.input-prefix, .input-suffix { flex: none; color: #8190a5; font-size: .88rem; }
.input-prefix { padding-left: 14px; padding-right: 9px; }
.input-suffix { padding: 0 14px 0 5px; }
.field small { display: block; margin-top: 7px; color: #8591a3; font-size: .73rem; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; }
.form-message { flex: 1; margin: 0; color: #b42318; font-size: .82rem; line-height: 1.4; }
.form-message:empty { display: none; }
.calculate-button { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 700; cursor: pointer; transition: background .15s, transform .15s; }
.calculate-button:hover { background: var(--blue-dark); }
.calculate-button:active { transform: translateY(1px); }
.calculate-button:focus-visible { outline: 3px solid #91adf5; outline-offset: 3px; }
.results { display: flex; flex-direction: column; justify-content: center; padding: 34px; background: #f0f4ff; }
.results-heading .eyebrow { margin-bottom: 7px; }
.results-heading h2 { margin: 0; font-size: 1.15rem; }
.result-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #dfe8ff; color: var(--blue); font-size: 1.15rem; }
.monthly-payment { margin: 27px 0 3px; color: #183e9c; font-family: 'Segoe UI', sans-serif; font-size: clamp(2.1rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.15; letter-spacing: -.06em; overflow-wrap: anywhere; }
.result-caption { margin: 0; color: #71809b; font-size: .82rem; }
.result-divider { height: 1px; margin: 25px 0 21px; background: #dbe3f4; }
.result-breakdown { display: grid; gap: 17px; margin: 0; }
.result-breakdown div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-breakdown dt { color: #67758c; font-size: .88rem; }
.result-breakdown dd { margin: 0; color: #253653; font-size: .95rem; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.formula-card { display: grid; grid-template-columns: 42px 1fr; gap: 17px; margin-top: 24px; padding: 25px 28px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.formula-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #eef2f9; color: #526580; font-size: .9rem; font-weight: 700; }
.formula-card h2 { font-size: 1rem; }
.formula-card p { margin: 0 0 10px; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.formula-card .formula { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: #263853; font-family: 'Segoe UI', sans-serif; font-size: .9rem; font-weight: 700; }
.fraction-bar { color: #8b98aa; }
.formula-card .formula-note { margin-bottom: 0; font-size: .78rem; }
.disclaimer { display: flex; gap: 12px; margin: 18px 0 32px; padding: 15px 17px; border-radius: 11px; background: #edf1f7; }
.info-icon { display: grid; flex: none; place-items: center; width: 20px; height: 20px; border: 1px solid #8796ab; border-radius: 50%; color: #687992; font-size: .75rem; font-weight: 700; }
.disclaimer p { margin: 0; color: #65738a; font-size: .78rem; line-height: 1.6; }
.disclaimer strong { color: #44536a; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; padding: 19px 0 25px; border-top: 1px solid var(--line); color: #8490a2; font-size: .74rem; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 28px, 560px); }
  .site-header { height: 66px; }
  .hero { margin: 38px auto 26px; }
  .calculator-card { grid-template-columns: 1fr; border-radius: 16px; }
  #mortgage-form { padding: 25px 22px 24px; }
  .results { padding: 27px 24px 29px; }
  .monthly-payment { margin-top: 19px; font-size: 2.5rem; }
  .formula-card { padding: 21px 19px; }
}

@media (max-width: 420px) {
  .page-shell { width: min(100% - 24px, 560px); }
  .brand { font-size: .9rem; }
  .hero { margin-top: 31px; }
  .intro { font-size: .94rem; }
  .form-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .private-note { font-size: .7rem; }
  #mortgage-form { padding: 22px 17px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .calculate-button { width: 100%; }
  .formula-card { grid-template-columns: 1fr; gap: 12px; }
  .site-footer { flex-direction: column; }
}
