:root {
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-50: #f0fdfa;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;
  --blue-50: #eff6ff;
  --ink-900: #1e293b;
  --ink-600: #475569;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--bg);
}

.site-header {
  background: linear-gradient(135deg, var(--teal-800), var(--blue-900));
  color: #ffffff;
  padding: 2rem 1rem 2.25rem;
}

.brand {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #99f6e4;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.25;
  max-width: 46rem;
}

.h1-sub {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: #bae6fd;
  margin-top: 0.35rem;
}

main {
  max-width: 60rem;
  margin: -1rem auto 0;
  padding: 0 1rem 3rem;
  display: grid;
  gap: 2rem;
}

h2 { font-size: 1.25rem; margin: 0 0 1rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }

/* Calculator form */
.calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

form {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--ink-900);
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #ffffff;
}

.field input:focus-visible,
button:focus-visible {
  outline: 3px solid var(--blue-700);
  outline-offset: 2px;
}

button {
  justify-self: start;
  padding: 0.65rem 1.4rem;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: var(--teal-700);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

button:hover { background: var(--teal-800); }

/* Results */
#results {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: var(--bg);
}

.card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--ink-600);
}

.card .big {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--teal-800);
}

.card-blue .big { color: var(--blue-700); }

.card-note {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-600);
}

.card-teal { background: var(--teal-50); border-color: #99f6e4; }
.card-blue { background: var(--blue-50); border-color: #bfdbfe; }

.impact {
  margin-top: 1rem;
  background: var(--teal-50);
  border: 1px solid #99f6e4;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.impact h3 { margin: 0 0 0.5rem; color: var(--teal-800); }
.impact-list { margin: 0; padding-left: 1.2rem; }

/* Amortization table */
.table-wrap {
  margin-top: 1.25rem;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

caption {
  text-align: left;
  font-weight: 700;
  padding-bottom: 0.5rem;
  color: var(--ink-600);
}

th, td {
  padding: 0.45rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

th:first-child, td:first-child { text-align: left; }

thead th {
  background: var(--teal-700);
  color: #ffffff;
  white-space: nowrap;
}

tbody tr:nth-child(even) { background: var(--bg); }

td.phase-draw { color: var(--teal-800); font-weight: 600; }
td.phase-repayment { color: var(--blue-700); font-weight: 600; }

/* Content + FAQ */
article p { max-width: 46rem; }

.faq { margin: 0; max-width: 46rem; }
.faq h3 { margin: 1.25rem 0 0.25rem; }
.faq p { margin: 0 0 0.75rem; }

.noscript-note {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-600);
}

.site-footer p { margin: 0 auto; max-width: 46rem; }

@media (min-width: 720px) {
  h1 { font-size: 2rem; }
  form { grid-template-columns: repeat(2, 1fr); }
  form button { grid-column: 1 / -1; }
}
