:root {
  --brand-blue: #28579f;
  --brand-blue-dark: #173866;
  --brand-green: #5d9f3b;
  --ink: #172033;
  --line: #d9e1ec;
  --surface: #fff;
  --page: #f3f6fa;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

#cont,
#content {
  width: 100%;
}

#content {
  min-height: 0;
  background-color: var(--page);
  background-image: none;
}

#menu {
  width: min(100%, 900px);
  padding: 20px 16px 0;
  font: inherit;
  color: #fff;
}

.site-header {
  overflow: visible;
  border: 1px solid #dce5f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(22 45 78 / 12%);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 18px 22px;
  border-radius: 18px 18px 0 0;
  background:
    radial-gradient(circle at 12% 20%, rgb(93 159 59 / 16%), transparent 32%),
    linear-gradient(135deg, #fff 0%, #f5f8fc 100%);
  color: var(--brand-blue-dark);
  text-decoration: none;
}

.site-brand:visited {
  color: var(--brand-blue-dark);
}

.site-brand:hover,
.site-brand:focus-visible {
  color: var(--brand-blue);
  text-decoration: none;
}

.site-brand__logo {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 6px 16px rgb(23 56 102 / 18%);
}

.site-brand__copy {
  display: grid;
  gap: 2px;
}

.site-brand__title {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.2;
}

.site-brand__tagline {
  color: #53647a;
  font-size: 0.96rem;
}

.site-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  min-height: 52px;
  padding: 6px 18px;
  border-radius: 0 0 17px 17px;
  background: var(--brand-blue-dark);
}

.site-nav a,
.site-nav a:visited {
  color: #fff;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-nav__links {
  flex: 1 1 auto;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__toggle {
  display: none;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

#main {
  width: min(calc(100% - 32px), 868px);
  margin: 20px auto 0;
  padding: clamp(20px, 4vw, 38px) !important;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(22 45 78 / 9%);
  overflow-x: auto;
}

#sent {
  width: auto;
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--brand-blue-dark);
  line-height: 1.3;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(1.65rem, 4vw, 2.15rem);
}

h2 {
  margin-top: 32px;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
}

h3:hover,
h4:hover,
.aye {
  text-shadow: none;
}

a,
a:visited {
  color: var(--brand-blue);
}

a:hover {
  color: var(--brand-blue-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(93 159 59 / 55%);
  outline-offset: 3px;
}

#main > table:not(.blueTable),
#sent table.form {
  width: min(100%, 640px);
  border-collapse: separate;
  border-spacing: 0 10px;
}

.calculator-form {
  table-layout: fixed;
}

.calculator-form td:first-child {
  width: 48%;
  padding-inline-end: 18px !important;
  color: #263a54;
  font-weight: 700;
  vertical-align: middle !important;
}

.calculator-form td:last-child {
  width: 52%;
  vertical-align: middle !important;
}

.calculator-form label {
  cursor: pointer;
}

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: stretch;
  gap: 8px;
  width: min(100%, 270px);
}

.input-with-unit--short {
  width: min(100%, 270px);
}

.input-with-unit input {
  width: 100% !important;
  text-align: right;
}

.input-unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #eef3f8;
  color: #40546e;
  font-weight: 700;
  white-space: nowrap;
}

.repayment-methods {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.calculator-form__actions td {
  padding-top: 10px !important;
}

#main > table:not(.blueTable) td,
#sent table.form td,
#sent table.form th {
  padding: 5px 8px;
  vertical-align: top;
}

#sent table.form th {
  text-align: right;
}

input:not([type="radio"]):not([type="checkbox"]),
textarea,
select {
  max-width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #aeb9c8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

input[type="radio"],
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-blue);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

fieldset > div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-inline-end: 18px;
}

#ara,
#calcMortageButton,
#calcMortageButton2 {
  width: auto;
  min-width: 170px;
  height: auto;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #3973c3, var(--brand-blue));
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 4px 10px rgb(40 87 159 / 20%);
}

#ara:hover,
#calcMortageButton:hover,
#calcMortageButton2:hover {
  background: var(--brand-blue-dark);
}

#mortageRes {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #b9cbea;
  border-radius: 12px;
  background: #eef4ff;
}

.content-note {
  margin-top: 24px;
  padding: 14px 16px;
  border-right: 4px solid var(--brand-green);
  border-radius: 8px;
  background: #f3f8ef;
  color: #384234;
  font-size: 0.95rem;
}

.content-section {
  margin-top: 38px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.tool-form {
  margin-top: 18px;
}

.tool-form__overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.tool-form--compact .tool-form__overview {
  width: min(100%, 660px);
}

.form-field {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.form-field > span:first-child {
  color: #263a54;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field .input-with-unit {
  width: 100%;
}

.form-field small,
.form-help {
  color: #5a687c;
  font-size: 0.9rem;
}

.form-help {
  margin: 0 0 14px;
}

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

.offer-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #cdd8e7;
  border-radius: 12px;
  background: #f8fafc;
}

.offer-card--optional {
  border-style: dashed;
  background: #fbfcfe;
}

.offer-card > legend {
  position: static;
  width: auto;
  height: auto;
  margin: 0 0 10px;
  padding: 0 4px;
  overflow: visible;
  clip: auto;
  color: var(--brand-blue-dark);
  font-size: 1.08rem;
  font-weight: 800;
  white-space: normal;
}

.offer-card > legend small {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 400;
}

.offer-card .form-field + .form-field {
  margin-top: 11px;
}

.offer-card .form-field > span:first-child {
  font-size: 0.92rem;
}

.offer-card .input-with-unit {
  grid-template-columns: minmax(0, 1fr) 48px;
}

.tool-form__actions {
  margin-top: 18px;
}

.calculator-button {
  width: auto;
  min-width: 190px;
  min-height: 46px;
  padding: 11px 20px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #3973c3, var(--brand-blue));
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgb(40 87 159 / 20%);
}

.calculator-button:hover,
.calculator-button:focus-visible {
  background: var(--brand-blue-dark);
}

.calculator-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.calculator-results:empty {
  display: none;
}

.calculator-loading {
  margin: 18px 0 0;
  color: #40546e;
  font-weight: 700;
}

.tool-results h2 {
  margin-top: 0;
}

.result-callout {
  padding: 14px 16px;
  border-right: 4px solid var(--brand-blue);
  border-radius: 8px;
  background: #f8fbff;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

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

.result-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #cbd8ea;
  border-radius: 10px;
  background: #fff;
}

.result-card span,
.result-card small {
  color: #5a687c;
}

.result-card strong {
  color: var(--brand-blue-dark);
  font-size: 1.06rem;
}

.comparison-table-wrap {
  max-width: 100%;
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.comparison-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.92rem;
}

.comparison-table th,
.comparison-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

.comparison-table thead th {
  background: #eaf1fb;
  color: #263a54;
  white-space: nowrap;
}

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

.comparison-table .is-best {
  background: #f3f8ef;
}

.result-insights {
  margin: 18px 0 0;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.strategy-card {
  padding: 18px;
  border: 1px solid #cbd8ea;
  border-radius: 12px;
  background: #fff;
}

.strategy-card--preferred {
  border-color: #a9c98f;
  background: #f7fbf4;
}

.strategy-card h3 {
  margin: 0 0 12px;
  color: var(--brand-blue-dark);
}

.strategy-card dl {
  margin: 0;
}

.strategy-card dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.strategy-card dl > div:last-child {
  border-bottom: 0;
}

.strategy-card dt {
  color: #526176;
}

.strategy-card dd {
  margin: 0;
  font-weight: 800;
  text-align: left;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.info-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.info-card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.info-card p {
  margin: 0;
}

.faq-list details {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.faq-list summary {
  color: var(--brand-blue-dark);
  font-weight: 700;
  cursor: pointer;
}

.faq-list details p {
  margin-bottom: 0;
}

.page-meta {
  color: #627086;
  font-size: 0.9rem;
}

.formula {
  direction: ltr;
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--brand-blue-dark);
  font-family: Consolas, "Courier New", monospace;
  text-align: left;
}

.pwa-notice {
  position: fixed;
  z-index: 1000;
  inset-inline: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 12px 16px;
  border-radius: 10px;
  background: #172033;
  color: #fff;
  box-shadow: 0 12px 30px rgb(0 0 0 / 24%);
}

.pwa-notice button {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: var(--brand-blue-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

table.blueTable {
  width: 100%;
  min-width: 560px;
  border: 1px solid #b8c5d6;
  border-collapse: collapse;
  background: #fff;
  text-align: right;
}

table.blueTable th,
table.blueTable td {
  padding: 9px 10px;
  border: 1px solid #d5deea;
}

table.blueTable thead {
  background: var(--brand-blue);
}

table.blueTable thead th {
  color: #fff;
  text-align: center;
}

table.blueTable tbody tr:nth-child(even) {
  background: #f0f5fb;
}

.result-page-links {
  display: grid;
  gap: 4px;
  min-width: 96px;
}

.result-page-links a {
  white-space: nowrap;
}

img,
iframe {
  max-width: 100%;
}

#footer {
  width: min(calc(100% - 32px), 868px);
  height: auto;
  min-height: 64px;
  margin: 20px auto 0;
  padding: 18px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #4569a3, #284f8b);
  color: #fff;
  font-size: 1rem;
  line-height: 1.55;
  text-align: right;
}

#footer a,
#footer a:visited {
  color: #fff;
}

.footer-links {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 24px;
}

.footer-links__group strong {
  display: block;
  margin-bottom: 9px;
  color: #fff;
  font-size: 1.1rem;
}

.footer-links__group ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links__group a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 5px 3px;
  font-size: 1rem;
  line-height: 1.4;
  text-underline-offset: 3px;
}

.footer-links__group a:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 5px rgb(20 49 91 / 72%);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 18px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgb(255 255 255 / 28%);
  font-size: 0.9rem;
  opacity: 0.92;
}

@media (max-width: 700px) {
  #menu {
    padding: 10px 10px 0;
  }

  .site-header {
    border-radius: 14px;
  }

  .site-brand {
    gap: 12px;
    min-height: 84px;
    padding: 14px;
    border-radius: 14px 14px 0 0;
  }

  .site-brand__logo {
    width: 52px;
    height: 52px;
  }

  .site-brand__tagline {
    font-size: 0.86rem;
  }

  .site-nav {
    align-items: flex-start;
    min-height: 50px;
    padding: 6px 12px;
    border-radius: 0 0 13px 13px;
  }

  .site-nav__toggle {
    display: block;
  }

  .site-nav__links {
    display: none !important;
    position: absolute;
    z-index: 20;
    inset-inline: 0;
    top: 100%;
    gap: 0;
    margin-top: 10px;
    padding: 8px;
    border-radius: 10px;
    background: var(--brand-blue-dark);
    box-shadow: 0 12px 28px rgb(9 28 55 / 28%);
  }

  .site-nav__links.is-open {
    display: grid !important;
  }

  .site-nav__links li a {
    display: block;
    padding: 10px 12px;
  }

  #main {
    width: min(calc(100% - 20px), 868px);
    margin-top: 12px;
    padding: 20px 16px !important;
    border-radius: 12px;
  }

  #main > table:not(.blueTable),
  #main > table:not(.blueTable) tbody,
  #main > table:not(.blueTable) tr,
  #main > table:not(.blueTable) td,
  #sent table.form,
  #sent table.form tbody,
  #sent table.form tr,
  #sent table.form th,
  #sent table.form td {
    display: block;
    width: 100%;
  }

  #main > table:not(.blueTable) tr,
  #sent table.form tr {
    margin-bottom: 10px;
  }

  #main > table:not(.blueTable) input:not([type="radio"]):not([type="checkbox"]),
  #sent table.form input:not([type="radio"]):not([type="checkbox"]),
  #sent table.form textarea {
    width: 100% !important;
  }

  .calculator-form td:first-child,
  .calculator-form td:last-child {
    width: 100%;
    padding-inline: 0 !important;
  }

  .calculator-form td:first-child {
    padding-bottom: 2px !important;
  }

  .input-with-unit,
  .input-with-unit--short {
    width: 100%;
  }

  .repayment-methods {
    min-height: 40px;
  }

  #ara,
  #calcMortageButton,
  #calcMortageButton2 {
    width: 100%;
  }

  #footer {
    width: min(calc(100% - 20px), 868px);
    padding: 14px;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-links__group a {
    width: 100%;
    min-height: 44px;
    padding-block: 8px;
  }

  .footer-legal {
    display: grid;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .tool-form__overview,
  .offer-grid,
  .result-cards,
  .result-cards--two,
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .calculator-button {
    width: 100%;
  }

  .offer-card {
    padding: 14px;
  }

  .strategy-card dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .strategy-card dd {
    text-align: right;
  }

  .pwa-notice {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
