:root {
  --green: #0f7a4a;
  --green-d: #0a5c37;
  --green-l: #e7f5ee;
  --green-m: #c8e8d6;
  --ink: #14211b;
  --ink-2: #4a5a52;
  --line: #dde5e0;
  --bg: #f5f8f6;
  --card: #ffffff;
  --warn: #fff6e0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 33, 27, .05), 0 6px 20px rgba(20, 33, 27, .06);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Topbar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; justify-content: space-between; align-items: center; height: 56px; gap: 12px; }
.brand { font-weight: 700; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-l); }
.topbar-tag { color: var(--ink-2); font-size: .85rem; }

/* Hero */
.hero { background: linear-gradient(160deg, var(--green-d), var(--green) 60%, #17996000); background-color: var(--green); color: #fff; padding: 36px 0 72px; }
.hero-in { display: grid; gap: 24px; }
.eyebrow { margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; opacity: .85; }
h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 6vw, 2.8rem); line-height: 1.1; letter-spacing: -.02em; }
.lead { margin: 0; font-size: 1.05rem; opacity: .92; max-width: 46ch; }
.result-card { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.rc-label { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 600; }
.rc-big { margin: 4px 0 2px; font-size: clamp(2rem, 9vw, 2.9rem); font-weight: 800; letter-spacing: -.02em; color: var(--green-d); line-height: 1.1; font-variant-numeric: tabular-nums; }
.rc-sub { margin: 0 0 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rc-foot { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-top: 1px dashed var(--line); padding-top: 12px; font-size: .9rem; color: var(--ink-2); }
.rc-foot strong { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Stack of cards */
.stack { margin-top: -44px; padding-bottom: 40px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 14px; font-size: 1.15rem; letter-spacing: -.01em; }
h3 { margin: 18px 0 6px; font-size: 1rem; }

/* Form */
.field { margin-bottom: 18px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint, .note { margin: 6px 0 0; font-size: .84rem; color: var(--ink-2); }
.note { background: var(--green-l); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.grid-2 { display: grid; gap: 0 16px; }
.input-affix { position: relative; }
.input-affix input {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 40px 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.input-affix input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--green-l); }
.affix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-weight: 600; pointer-events: none; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.preset { font: inherit; font-size: .84rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.preset:hover { border-color: var(--green); color: var(--green-d); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.seg button { font: inherit; font-weight: 600; font-size: .92rem; padding: 10px 4px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); cursor: pointer; min-width: 0; }
.seg button.is-on { background: var(--green); color: #fff; box-shadow: 0 2px 6px rgba(15, 122, 74, .35); }
.seg button:focus-visible, .btn:focus-visible, .stepper button:focus-visible, .preset:focus-visible, summary:focus-visible { outline: 3px solid var(--green-m); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 0; font-weight: 400; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box { flex: none; width: 24px; height: 24px; border: 1.5px solid #b9c7bf; border-radius: 7px; background: #fff; margin-top: 1px; display: grid; place-items: center; }
.check input:checked + .check-box { background: var(--green); border-color: var(--green); }
.check input:checked + .check-box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 4px var(--green-l); }
.check-text { display: grid; gap: 2px; min-width: 0; }
.check-text strong { font-weight: 600; font-size: .95rem; }
.check-text small { color: var(--ink-2); font-size: .82rem; }
.check.is-disabled { opacity: .55; cursor: not-allowed; }

.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { font: inherit; font-size: 1.3rem; width: 46px; height: 44px; border: 0; background: var(--bg); cursor: pointer; color: var(--green-d); }
.stepper button:disabled { color: #aab7b0; cursor: not-allowed; }
.stepper output { min-width: 52px; text-align: center; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .88rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.tbl thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); border-bottom: 2px solid var(--line); }
.tbl tbody th { font-weight: 500; }
.tbl .num { text-align: right; }
.tbl-4 th:nth-child(1) { width: 34%; }
.tbl-4 th:nth-child(2) { width: 27%; }
.tbl-4 th:nth-child(3) { width: 14%; }
.tbl-4 th:nth-child(4) { width: 25%; }
.tbl-2 th:nth-child(1) { width: 62%; }
.tbl tr.strong th, .tbl tr.strong td { font-weight: 700; }
.tbl tr.muted th, .tbl tr.muted td { color: var(--ink-2); }
.tbl tr.total th, .tbl tr.total td { font-weight: 800; background: var(--green-l); color: var(--green-d); border-bottom: 0; }
.tbl tr.total th { border-radius: 8px 0 0 8px; }
.tbl tr.total td:last-child { border-radius: 0 8px 8px 0; }

/* Stats */
.stats { display: grid; gap: 10px; }
.stat, .cmp-col { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 2px; }
.stat-l { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 600; }
.stat strong, .cmp-col strong { font-size: 1.5rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat small, .cmp-col small { color: var(--ink-2); font-size: .8rem; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-col strong { font-size: 1.2rem; }
.saving { margin-top: 10px; background: var(--green); color: #fff; border-radius: 12px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.saving .stat-l { color: rgba(255, 255, 255, .85); }
.saving strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.saving.is-zero { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.saving.is-zero .stat-l { color: var(--ink-2); }
.total-band { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--green-d); color: #fff; border-radius: 12px; padding: 16px; font-weight: 600; }
.total-band strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { font: inherit; font-weight: 600; padding: 12px 10px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; min-width: 0; }
.btn:hover { border-color: var(--green); color: var(--green-d); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-d); color: #fff; }

/* Prose / FAQ */
.prose p, .prose li, .faq-item p { color: #2c3a33; }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { cursor: pointer; font-weight: 600; padding: 14px 28px 14px 0; position: relative; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--green); font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0 0 14px; }

.disclaimer { background: var(--warn); border: 1px solid #f0dca8; border-radius: var(--radius); padding: 14px 16px; font-size: .88rem; color: #5b4a12; }
.disclaimer p { margin: 0; }
.foot { border-top: 1px solid var(--line); background: #fff; padding: 20px 0; color: var(--ink-2); font-size: .84rem; }
.foot p { margin: 0; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) {
  .wrap { padding: 0 24px; }
  .card { padding: 26px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .btn-row { grid-template-columns: repeat(4, 1fr); }
  .tbl { font-size: .95rem; }
  .tbl th, .tbl td { padding: 10px 10px; }
  .tbl-2 th:nth-child(1) { width: 70%; }
}
@media (min-width: 860px) {
  .hero-in { grid-template-columns: 1.2fr 1fr; align-items: center; gap: 40px; }
  .hero { padding: 52px 0 88px; }
}
@media (max-width: 380px) {
  .tbl { font-size: .8rem; }
  .tbl th, .tbl td { padding: 8px 4px; }
  .card { padding: 18px 12px; }
  .cmp-col strong { font-size: 1.05rem; }
  .rc-foot { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

@media print {
  body { background: #fff; }
  .topbar, .actions, .presets, .stepper button, .toast, .faq, .prose, .foot { display: none !important; }
  .hero { background: #fff !important; color: #000; padding: 8px 0; }
  .hero .lead, .eyebrow { display: none; }
  .stack { margin-top: 0; }
  .card, .result-card { box-shadow: none; break-inside: avoid; }
  .saving, .total-band { background: #fff !important; color: #000 !important; border: 1px solid #000; }
}
