/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --text: #1a2420;
  --text-muted: #5b6660;
  --border: #e1e5e2;
  --accent: #12664c;
  --accent-dark: #0b3d2e;
  --accent-gold: #f5a524;
  --danger: #b3261e;
  --sans: "Inter", system-ui, sans-serif;
  --display: "Manrope", var(--sans);
  --radius: 14px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101613;
    --surface: #18211c;
    --text: #eef1ef;
    --text-muted: #a3aca6;
    --border: #2a352e;
    --accent: #35a37c;
    --accent-dark: #12664c;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.01em; font-family: var(--display); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.container { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 900px; margin: 0 auto; padding: 1.25rem 1.25rem 0.5rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-family: var(--display); font-size: 1.05rem; text-decoration: none; }
.site-nav { display: flex; gap: 1.25rem; font-size: .9rem; }
.site-nav a { text-decoration: none; color: var(--text-muted); }
.site-nav a:hover { color: var(--accent); }

.site-footer {
  max-width: 900px; margin: 2rem auto 0; padding: 1.5rem 1.25rem 3rem;
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center;
  font-size: .85rem; color: var(--text-muted); border-top: 1px solid var(--border);
}
.site-footer a { text-decoration: underline; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { max-width: 900px; margin: 0 auto; padding: 0.5rem 1.25rem 1.25rem; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.hero .subtitle { color: var(--text-muted); margin-top: .6rem; font-size: 1.05rem; max-width: 620px; margin-inline: auto; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card {
  max-width: 900px; margin: 0 auto; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.field-grid {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
}
@media (min-width: 720px) {
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-checkbox { grid-column: 1 / -1; }
}
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label, .field-label-static { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.field input[type="number"], .field select {
  padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 1rem; font-family: var(--sans);
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-hint { font-size: .78rem; color: var(--text-muted); }
.radio-row { display: flex; gap: 1.25rem; font-size: .92rem; font-weight: 400; }
.radio-row label { display: flex; align-items: center; gap: .4rem; }
.field-checkbox label { display: flex; align-items: flex-start; gap: .5rem; font-size: .92rem; font-weight: 400; color: var(--text); line-height: 1.4; }
.field-checkbox input { margin-top: .2rem; }

.btn-primary {
  margin-top: 1.25rem; width: 100%; padding: .9rem 1.5rem;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem;
  border-radius: 10px; transition: background .2s var(--ease-out);
}
.btn-primary:hover { background: var(--accent-dark); }

.error-message {
  margin-top: .75rem; padding: .65rem .9rem; border-radius: 8px;
  background: rgba(179,38,30,.1); color: var(--danger); font-size: .9rem; font-weight: 600;
}

/* =============================================================
   7. Results
   ============================================================= */
.result-zone { margin-top: 1.75rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.result-headline {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .25rem; margin-bottom: 1.25rem;
}
.result-label { font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.result-value { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; font-family: var(--display); color: var(--accent); }

.result-grid { display: grid; gap: .55rem; margin-bottom: 1.5rem; }
.result-line { display: flex; justify-content: space-between; gap: 1rem; font-size: .95rem; padding: .5rem .1rem; border-bottom: 1px dashed var(--border); }
.result-line.highlight { color: var(--accent); font-weight: 600; }

.chart-wrap { margin: 1.5rem 0; }
.chart-wrap canvas { width: 100%; height: 320px; display: block; }
.chart-legend { display: flex; gap: 1.5rem; justify-content: center; margin-top: .5rem; font-size: .85rem; color: var(--text-muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; }
.dot-balance { background: var(--accent); }
.dot-interest { background: var(--accent-gold); }

.amort-details { margin-top: 1.25rem; }
.amort-details summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: .5rem 0; }
.amort-table-wrap { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: .5rem; }
.amort-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.amort-table th, .amort-table td { padding: .5rem .7rem; text-align: right; border-bottom: 1px solid var(--border); }
.amort-table th:first-child, .amort-table td:first-child { text-align: left; }
.amort-table thead th { position: sticky; top: 0; background: var(--surface); }

/* =============================================================
   8. Badges / notes / ads
   ============================================================= */
.privacy-badge, .limits-note {
  max-width: 900px; margin: .9rem auto 0; padding: 0 1.25rem;
  font-size: .85rem; color: var(--text-muted); text-align: center;
}
.ad-slot {
  max-width: 900px; margin: 1.5rem auto; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: 10px;
  color: var(--text-muted); font-size: .8rem; letter-spacing: .05em; text-transform: uppercase;
}

/* =============================================================
   9. Content blocks / FAQ
   ============================================================= */
.content-block { max-width: 720px; margin: 0 auto; padding: 1rem 1.25rem; }
.content-block h2 { font-size: 1.4rem; margin-bottom: .75rem; margin-top: 1.5rem; }
.content-block p { margin-bottom: 1rem; color: var(--text); }
.steps { padding-left: 1.25rem; display: grid; gap: .6rem; }
.content-block details {
  border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem; margin-bottom: .6rem; background: var(--surface);
}
.content-block summary { cursor: pointer; font-weight: 600; }
.content-block details p { margin: .6rem 0 0; color: var(--text-muted); }

/* =============================================================
   10. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
