*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #F7F6F2; --surface: #FFFFFF; --surface2: #F0EFE9;
    --text: #1A1916; --muted: #6B6860; --accent: #1B4FD8;
    --accent2: #1440B3; --green: #047857; --green-light: #ECFDF5;
    --gold: #92400E; --border: #E5E3DC;
  }
  body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
  header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 2rem; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
  .logo { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--accent); text-decoration: none; letter-spacing: -0.5px; }
  .logo em { font-style: italic; }
  .nav-links { display: flex; gap: 1.25rem; align-items: center; }
  .nav-links a { font-size: 13px; text-decoration: none; color: var(--muted); font-weight: 500; }
  .nav-links a:hover { color: var(--accent); }
  @media (max-width: 520px) { .nav-links a:not(.nav-home) { display: none; } }
  .hero { background: linear-gradient(135deg, #2E3250, #4A4F7A); padding: 2.5rem 2rem; text-align: center; color: white; }
  .hero-eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em; color: rgba(255,255,255,0.7); margin-bottom: 0.75rem; }
  .hero h1 { font-family: 'Playfair Display', serif; font-size: clamp(1.9rem, 5vw, 2.75rem); font-weight: 700; line-height: 1.15; margin-bottom: 0.5rem; }
  .hero h1 em { font-style: italic; }
  .hero p { font-size: 14px; color: rgba(255,255,255,0.82); font-weight: 300; max-width: 480px; margin: 0 auto; }
  main { flex: 1; max-width: 720px; margin: 0 auto; width: 100%; padding: 2rem 1.5rem; }
  .calc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.75rem; margin-bottom: 1.5rem; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  @media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }
  .field { margin-bottom: 0.25rem; }
  .field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
  .input-wrap { position: relative; }
  .input-wrap .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }
  .input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }
  input[type="number"], select { width: 100%; padding: 0.75rem 1rem; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; font-family: 'Inter', sans-serif; color: var(--text); background: var(--bg); outline: none; transition: border-color 0.2s; }
  input[type="number"]:focus { border-color: var(--accent); background: white; }
  input[type="number"].has-prefix { padding-left: 28px; }
  input[type="number"].has-suffix { padding-right: 40px; }
  input[type="range"] { width: 100%; margin-top: 0.5rem; accent-color: var(--green); }
  .range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }
  .results-card { background: linear-gradient(135deg, #2E3250, #4A4F7A); border-radius: 20px; padding: 1.75rem; margin-bottom: 1.5rem; color: white; display: none; }
  .results-card.show { display: block; animation: fadeUp 0.4s ease; }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
  .result-main { text-align: center; margin-bottom: 1.25rem; }
  .result-main .lbl { font-size: 12px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.25rem; }
  .result-main .val { font-family: 'Playfair Display', serif; font-size: clamp(2.5rem, 8vw, 3.5rem); font-weight: 700; line-height: 1; }
  .result-main .sub { font-size: 13px; opacity: 0.75; margin-top: 0.25rem; }
  .result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  @media (max-width: 400px) { .result-grid { grid-template-columns: 1fr; } }
  .r-item { background: rgba(255,255,255,0.15); border-radius: 12px; padding: 0.75rem; text-align: center; }
  .r-item .r-lbl { font-size: 10px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
  .r-item .r-val { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 700; }
  .progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; display: none; }
  .progress-card.show { display: block; }
  .progress-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 0.5rem; }
  .progress-bar { height: 12px; background: var(--surface2); border-radius: 100px; overflow: hidden; }
  .progress-fill { height: 100%; background: var(--green); border-radius: 100px; transition: width 0.6s ease; }
  .ad-block { background: #f9f9f9; border: 1px dashed #ddd; border-radius: 12px; text-align: center; font-size: 11px; color: var(--muted); margin-bottom: 1.5rem; min-height: 260px; display: flex; align-items: center; justify-content: center; }
  .content h2 { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 400; margin: 1.75rem 0 0.75rem; }
  .content p { font-size: 14px; color: #2C2B28; margin-bottom: 1rem; line-height: 1.7; }
  .content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
  .faq { margin: 2rem 0; }
  .faq h2 { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 400; margin-bottom: 1rem; }
  .faq-item { border-bottom: 1px solid var(--border); padding: 1rem 0; }
  .faq-item h3 { font-size: 14px; font-weight: 600; margin-bottom: 0.4rem; }
  .faq-item p { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0; }
  .related-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; }
  .related-box h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; }
  .related-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .related-links a { padding: 0.5rem 1rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 500; text-decoration: none; color: var(--text); }
  .related-links a:hover { border-color: var(--accent); color: var(--accent); }
  footer { background: var(--surface); border-top: 1px solid var(--border); padding: 1.5rem 2rem; text-align: center; font-size: 12px; color: var(--muted); }
  footer a { color: var(--accent); text-decoration: underline; }
  .affiliate-box{background:linear-gradient(135deg,#1a3c5e,#2563a8);color:white;border-radius:16px;padding:1.5rem;margin:1.5rem 0;text-align:center}
  .affiliate-box h3{font-size:15px;font-weight:600;margin-bottom:.4rem}
  .affiliate-box p{font-size:13px;opacity:.85;margin-bottom:1rem;line-height:1.5}
  .affiliate-btn{display:inline-block;background:white;color:#1a3c5e;padding:.7rem 1.5rem;border-radius:10px;font-weight:600;font-size:14px;text-decoration:none}

  /* Tracker inputs */
  input[type="text"] { width: 100%; padding: 0.75rem 1rem; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; font-family: 'Inter', sans-serif; color: var(--text); background: var(--bg); outline: none; transition: border-color 0.2s; }
  input[type="text"]:focus, select:focus { border-color: var(--accent); background: white; }
  .field-hint { font-size: 12px; color: var(--muted); margin-top: 0.35rem; line-height: 1.4; }
  .btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
  .btn-print { background: var(--green); color: white; border: none; border-radius: 10px; padding: 0.8rem 1.5rem; font-size: 15px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; }
  .btn-print:hover { background: #065F46; }
  .btn-clear { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: 10px; padding: 0.8rem 1.25rem; font-size: 15px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; }
  .btn-clear:hover { border-color: var(--muted); }
  .tracker-note { font-size: 13px; color: var(--muted); margin-top: 1rem; line-height: 1.5; }
  .tracker-note.warn { color: var(--gold); }


  .btn-print { background: #2E3250; }
  .btn-print:hover { background: #1F2238; }
  input[type="text"].sm, input[type="number"].sm { padding: 0.55rem 0.7rem; font-size: 14px; }
  input[type="number"].sm.has-prefix { padding-left: 22px; }
  .input-wrap.sm .prefix, .input-wrap.sm .suffix { font-size: 13px; left: 9px; }
  .input-wrap.sm .suffix { left: auto; right: 9px; }
  input[type="number"].sm.has-suffix { padding-right: 24px; }

  /* Method toggle */
  .method { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
  .method label { flex: 1; border: 1.5px solid var(--border); border-radius: 12px; padding: 0.75rem 0.9rem; cursor: pointer; background: var(--bg); font-size: 13px; color: var(--muted); line-height: 1.4; }
  .method label strong { display: block; font-size: 15px; color: var(--text); margin-bottom: 2px; }
  .method input { position: absolute; opacity: 0; pointer-events: none; }
  .method input:checked + label { border-color: #2E3250; background: #EEEFF6; }
  .method input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* Debt entry rows */
  .debt-head, .debt-row { display: grid; grid-template-columns: 2fr 1.3fr 0.9fr 1.1fr 32px; gap: 0.5rem; align-items: center; }
  .debt-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.35rem; }
  .debt-row { margin-bottom: 0.5rem; }
  .debt-row .rm { width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
  .debt-row .rm:hover { border-color: var(--muted); color: var(--text); }
  .row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0 1.25rem; }
  .btn-small { background: var(--surface); color: var(--text); border: 1.5px dashed var(--border); border-radius: 10px; padding: 0.5rem 0.9rem; font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; }
  .btn-small:hover { border-color: var(--muted); }
  @media (max-width: 560px) {
    .debt-head { display: none; }
    .debt-row { grid-template-columns: 1fr 1fr; padding: 0.6rem; border: 1px solid var(--border); border-radius: 12px; }
    .debt-row .d-name { grid-column: 1 / -1; }
    .debt-row .rm { grid-column: 2; justify-self: end; }
    .method { flex-direction: column; }
  }
  .compare { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .compare div { background: var(--bg); border-radius: 12px; padding: 0.8rem 0.9rem; font-size: 13px; color: var(--muted); line-height: 1.5; }
  .compare div.on { background: #EEEFF6; }
  .compare strong { display: block; color: var(--text); font-size: 14px; }
  @media (max-width: 480px) { .compare { grid-template-columns: 1fr; } }

  /* The worksheet (this is the only part that prints) */
  .chart-sheet { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.75rem; margin-bottom: 1.5rem; }
  .chart-title { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 700; line-height: 1.2; text-align: center; }
  .chart-sub { font-size: 13px; color: var(--muted); text-align: center; margin: 0.4rem 0 1.25rem; }
  .sheet-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.25rem 0 0.4rem; }
  .sheet-label:first-of-type { margin-top: 0; }
  .sheet-rule { font-size: 12px; color: #2C2B28; margin: 0 0 0.5rem; line-height: 1.5; }
  .plan, .log { width: 100%; border-collapse: collapse; font-size: 12px; }
  .plan th, .log th { text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 2px solid #1A1916; padding: 0.35rem 0.4rem; vertical-align: bottom; }
  .plan td, .log td { border-bottom: 1px solid #B9B6AC; height: 28px; padding: 0 0.4rem; }
  .plan td + td, .plan th + th, .log td + td, .log th + th { border-left: 1px solid #E5E3DC; }
  .plan .num { text-align: right; white-space: nowrap; }
  .plan th.num { text-align: right; }
  .plan .ord { width: 28px; text-align: center; font-weight: 600; }
  .plan .focus { font-weight: 600; }
  .plan .box { width: 44px; text-align: center; }
  .plan .box span { display: inline-block; width: 14px; height: 14px; border: 1.5px solid #1A1916; border-radius: 2px; vertical-align: middle; }
  .plan tfoot td { border-bottom: none; border-top: 2px solid #1A1916; font-weight: 600; }
  .log .c-mo { width: 16%; } .log .c-amt { width: 20%; }
  .chart-lines { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; justify-content: space-between; font-size: 13px; margin-top: 1.25rem; }
  .chart-lines span { white-space: nowrap; }
  .chart-credit { font-size: 11px; color: var(--muted); text-align: center; margin-top: 1rem; }
  @media (max-width: 560px) {
    .chart-sheet { padding: 1.1rem; }
    .plan, .log { font-size: 11px; }
    .plan .hide-sm, .log .hide-sm { display: none; }
  }

  @page { margin: 0.5in; }
  @media print {
    html, body { background: white !important; }
    body { padding: 0 !important; }
    body > *:not(main) { display: none !important; }
    main { max-width: none; width: 100%; padding: 0; margin: 0; }
    main > *:not(.chart-sheet) { display: none !important; }
    .chart-sheet { border: none; border-radius: 0; padding: 0; margin: 0; }
    .chart-title { font-size: 22pt; }
    .chart-sub { font-size: 10.5pt; color: #1A1916; margin-bottom: 0.18in; }
    .sheet-rule { font-size: 10pt; }
    .plan, .log { font-size: 10pt; }
    .plan td { height: 0.32in; }
    .log td { height: 0.29in; }
    .plan .hide-sm, .log .hide-sm { display: table-cell !important; }
    .chart-lines { font-size: 11pt; margin-top: 0.18in; }
    .chart-credit { font-size: 9pt; }
  }
  .content ul, .faq ul, .content ol { margin: 0 0 1rem 1.25rem; font-size: 14px; line-height: 1.7; color: #2C2B28; }
  .content li, .faq li { margin-bottom: 0.35rem; }
