:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --ink: #1a2233;
  --muted: #5b6675;
  --line: #e2e8f0;
  --brand: #1d6fe0;
  --brand-dark: #1552ab;
  --accent: #0f9d63;
  --accent-soft: #e7f6ee;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.05);
  --maxw: 860px;
}

* { box-sizing: border-box; }

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

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

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--ink); letter-spacing: -.02em; }
.brand span { color: var(--brand); }
.nav a { text-decoration: none; color: var(--muted); margin-left: 18px; font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--brand); }

/* Typography */
h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -.02em; margin: 28px 0 10px; }
h2 { font-size: 1.4rem; margin: 40px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 1.12rem; margin: 26px 0 8px; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 22px; }
a { color: var(--brand); }

/* Ad slots */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; margin: 26px 0;
  border: 1px dashed #c3ccd8; border-radius: var(--radius);
  background: repeating-linear-gradient(45deg,#fafbfc,#fafbfc 10px,#f3f5f8 10px,#f3f5f8 20px);
  color: #97a2b0; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase;
}

/* Tool */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.calc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; }
.field label { font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--ink); }
.field input[type="number"] {
  padding: 11px 12px; font-size: 1rem; border: 1px solid var(--line); border-radius: 9px;
  background: #fcfdff; color: var(--ink); width: 100%;
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,111,224,.15); }
.field--check { grid-column: 1 / -1; justify-content: center; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.field--actions { grid-column: 1 / -1; flex-direction: row; gap: 10px; flex-wrap: wrap; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem;
  padding: 12px 22px; border-radius: 9px;
}
.btn:hover { background: var(--brand-dark); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn--ghost:hover { background: #f1f4f8; color: var(--ink); }

/* Results */
.results { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 22px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.card--accent { background: var(--accent-soft); border-color: #c6ebd6; }
.card-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.card-value { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.card--accent .card-value { color: var(--accent); }

.card--warn { background: #fdecec; border-color: #f3c9c9; }
.card--warn .card-value { color: #c0392b; }
.breakeven-note { font-size: .92rem; color: var(--muted); margin: 16px 0 0; text-align: center; }
.cross-link { margin-top: 26px; padding: 14px 16px; background: var(--accent-soft); border: 1px solid #c6ebd6; border-radius: 10px; font-weight: 500; }

.compare { margin-top: 20px; }
.compare-table, .schedule-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.compare-table th, .compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; color: var(--muted); }
.compare-table thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

.chart-wrap { margin: 24px 0 8px; }
.chart-wrap canvas { width: 100%; height: auto; background: #fcfdff; border: 1px solid var(--line); border-radius: 10px; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; text-align: center; }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.legend--base { background: #c0392b; }
.legend--new { background: var(--accent); }

.schedule { margin-top: 22px; }
.schedule summary { cursor: pointer; font-weight: 700; color: var(--brand); padding: 8px 0; }
.table-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; }
.schedule-table th, .schedule-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.schedule-table thead th { position: sticky; top: 0; background: #f8fafc; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.schedule-table tbody tr:nth-child(12n) { background: #f4f7fb; }

/* Debt calculator */
.debt-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.debt-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); text-align: left; padding: 6px 8px; }
.debt-table td { padding: 4px 8px; }
.debt-table input[type="text"], .debt-table input[type="number"] {
  width: 100%; padding: 9px 10px; font-size: .95rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fcfdff; color: var(--ink);
}
.debt-table input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,111,224,.15); }
.row-del { border: 0; background: #f1f4f8; color: #97a2b0; width: 30px; height: 30px; border-radius: 7px; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.row-del:hover { background: #fdecec; color: #c0392b; }
.debt-controls { margin: 12px 0 4px; }
.extra-field { margin-top: 16px; }
.debt-warning:not(:empty) { font-size: .9rem; color: #8a5a00; background: #fff7e6; border: 1px solid #ffe3a3; border-radius: 8px; padding: 10px 12px; margin: 14px 0 0; }
.compare-table small { font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }

.disclaimer { font-size: .88rem; color: var(--muted); background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-top: 22px; }

/* Content */
.content p, .content li { color: #2b3546; }
.content ul { padding-left: 20px; }
.content li { margin-bottom: 8px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 16px; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq details p { margin: 0; padding: 12px 16px; color: var(--muted); }

/* Footer */
.site-footer { margin-top: 50px; border-top: 1px solid var(--line); background: var(--surface); padding: 26px 0; }
.footer-nav a { color: var(--muted); text-decoration: none; margin-right: 18px; font-weight: 600; font-size: .92rem; }
.footer-nav a:hover { color: var(--brand); }
.footer-note { color: #97a2b0; font-size: .85rem; margin: 12px 0 0; }

/* Article / guide pages */
.byline { font-size: .9rem; color: var(--muted); margin: -4px 0 20px; }
.byline a { font-weight: 600; }
.page .lede { margin-bottom: 24px; }
.page h2 { font-size: 1.35rem; }
.page p, .page li { color: #2b3546; }
.page ul { padding-left: 20px; }
.page li { margin-bottom: 8px; }

/* Guides index */
.guide-list { display: grid; gap: 16px; margin-top: 8px; }
.guide-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: #fcfdff;
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.guide-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.guide-card h2 { margin: 0 0 8px; font-size: 1.15rem; color: var(--brand-dark); }
.guide-card p { margin: 0 0 12px; color: var(--muted); font-size: .96rem; }
.guide-tag { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 20px; }

/* Related guides block on tool pages */
.related-guides { margin-top: 28px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fcfdff; }
.related-guides h3 { margin: 0 0 10px; font-size: 1.05rem; }
.related-guides ul { margin: 0; padding-left: 20px; }
.related-guides li { margin-bottom: 6px; }
.related-guides a { font-weight: 600; }

/* Static content pages */
.page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin-top: 24px; }
.page h1 { margin-top: 0; }

/* Responsive */
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .calc-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .nav a { margin-left: 12px; font-size: .88rem; }
}
