:root {
  --green-900: #0a2f5c;
  --green-700: #0f5bb0;
  --green-500: #1a6fc4;
  --green-100: #e7f0fa;
  --gold: #3dba7e;
  --gold-600: #188552;
  --gold-100: #e4f6ec;
  --ink: #0f1b2d;
  --muted: #5a6678;
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
  --danger: #b4442f;
  --wa: #1fa855;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(12, 30, 60, .06), 0 8px 24px rgba(12, 30, 60, .06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
a { color: var(--green-700); }
[hidden] { display: none !important; }
.wrap { width: min(880px, 100% - 2rem); margin-inline: auto; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--green-700); color: var(--gold-100); display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.brand strong { display: block; font-size: .98rem; }
.brand small { display: block; color: var(--muted); font-size: .76rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1.5px solid transparent; border-radius: 999px; padding: .78rem 1.3rem; font: 600 .96rem/1 var(--font); cursor: pointer; text-decoration: none; transition: background .15s, transform .05s, border-color .15s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 60%, transparent); outline-offset: 2px; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-900); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-600); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: #178a45; }
.btn-ghost { background: transparent; color: var(--green-700); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green-500); }
.btn-link { background: none; color: var(--muted); padding-inline: .5rem; text-decoration: underline; }
.btn-sm { padding: .55rem .95rem; font-size: .88rem; }
.btn-block { width: 100%; }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(61, 186, 126, .22), transparent 60%), linear-gradient(160deg, var(--green-900), var(--green-700)); color: #fff; padding: 2.6rem 0 4.6rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 700; color: var(--gold-100); opacity: .9; margin-bottom: .6rem; }
.hero h1 { font-size: clamp(2rem, 6vw, 2.9rem); }
.lede { font-size: 1.06rem; max-width: 60ch; opacity: .92; }
.trust { list-style: none; padding: 0; margin: 1.2rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.trust li { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); padding: .35rem .75rem; border-radius: 999px; font-size: .82rem; }

/* Calculator shell */
.calc { margin-top: -3rem; position: relative; }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; padding: 0; margin: 0 0 .8rem; }
.stepper li { background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .75); border-radius: 10px; padding: .5rem; font-size: .8rem; font-weight: 600; display: flex; align-items: center; gap: .45rem; justify-content: center; }
.stepper li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .2); font-size: .74rem; flex: none; }
.stepper li.active { background: var(--card); color: var(--green-900); box-shadow: var(--shadow); }
.stepper li.active span { background: var(--gold); color: #fff; }
.stepper li.done { background: rgba(255, 255, 255, .25); color: #fff; }
.stepper li.done span { background: var(--green-500); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1.2rem, 4vw, 2rem); }
.panel h2 { font-size: 1.5rem; }
.hint { color: var(--muted); font-size: .92rem; }

/* Fields */
.field { display: block; margin: 0 0 1rem; border: 0; padding: 0; }
.field > span, .field legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
.field em, summary em { font-style: normal; color: var(--muted); font-weight: 400; }
.field small { display: block; color: var(--muted); font-size: .78rem; margin-top: .3rem; }
input[type=text], input[type=tel], input[type=email] { width: 100%; padding: .78rem .9rem; border: 1.5px solid var(--line); border-radius: 10px; font: 500 1rem var(--font); background: #fff; color: var(--ink); }
input:focus { border-color: var(--green-500); outline: none; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice > span { display: block; border: 1.5px solid var(--line); border-radius: 12px; padding: .85rem 1rem; transition: border-color .15s, background .15s; }
.choice b { display: block; }
.choice small { color: var(--muted); font-size: .8rem; }
.choice input:checked + span { border-color: var(--green-500); background: var(--green-100); box-shadow: inset 0 0 0 1px var(--green-500); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--gold) 60%, transparent); }

details.deduct { border: 1px dashed var(--line); border-radius: 12px; padding: .8rem 1rem; margin: 0 0 1rem; background: #fbfcfe; }
details.deduct summary { cursor: pointer; font-weight: 600; }
details.deduct[open] summary { margin-bottom: .6rem; }

.net-box { background: var(--green-100); border-radius: 12px; padding: .9rem 1rem; font-size: .92rem; }
.net-box table { width: 100%; border-collapse: collapse; }
.net-box td { padding: .15rem 0; }
.net-box td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.net-box tr.total td { border-top: 1px solid rgba(15, 91, 176, .25); padding-top: .4rem; font-weight: 700; }
.warn { color: var(--danger); font-size: .82rem; }

.nav-btns { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.4rem; }
.error { color: var(--danger); font-weight: 600; font-size: .9rem; }

/* Heir groups */
.heir-group { margin-bottom: 1.2rem; }
.heir-group h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--green-700); margin-bottom: .4rem; }
.heir-group.collapsible > summary { cursor: pointer; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--green-700); font-weight: 700; margin-bottom: .4rem; }
.heir { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.heir:last-child { border-bottom: 0; }
.heir-name { font-weight: 600; font-size: .95rem; }
.heir-name small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }
.counter { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.counter button { width: 38px; height: 38px; border: 0; background: #fff; font: 600 1.2rem var(--font); color: var(--green-700); cursor: pointer; }
.counter button:hover { background: var(--green-100); }
.counter button:disabled { color: #c3cad6; cursor: default; background: #fff; }
.counter output { min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.counter.has { border-color: var(--green-500); }
.toggle { position: relative; flex: none; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { display: block; width: 92px; text-align: center; padding: .5rem 0; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--muted); }
.toggle input:checked + span { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.toggle input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--gold) 60%, transparent); }

/* Result */
.result-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: baseline; margin-bottom: 1rem; }
.result-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; margin-bottom: 1.2rem; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.stat small { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.badge { background: var(--gold-100); color: #17663f; border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; font-weight: 700; }

.summary-row { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.summary-row .stats { margin-bottom: 0; grid-template-columns: repeat(2, 1fr); }
.summary-row .chart svg { max-width: 170px; }
@media (min-width: 680px) { .summary-row { grid-template-columns: minmax(0, 1fr) 170px; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.faraid { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
table.faraid th { background: var(--green-900); color: #fff; text-align: left; font-weight: 600; padding: .65rem .7rem; font-size: .8rem; white-space: nowrap; }
table.faraid td { padding: .65rem .7rem; border-top: 1px solid var(--line); vertical-align: top; }
table.faraid td.num, table.faraid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.faraid tr.zero td { color: var(--muted); }
table.faraid tr.bm td { background: #f1f9f4; }
table.faraid tfoot td { font-weight: 700; background: var(--bg); }
@media screen and (max-width: 600px) {
  .table-wrap { border: 0; overflow: visible; }
  table.faraid { min-width: 0; }
  table.faraid thead { display: none; }
  table.faraid tr { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem .8rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .6rem; background: #fff; }
  table.faraid td { border: 0; padding: 0; }
  table.faraid td:first-child { grid-column: 1 / -1; }
  table.faraid td.num { text-align: left; }
  table.faraid td.num::before { content: attr(data-label); display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
  table.faraid td.m-hide { display: none; }
  table.faraid tfoot tr { background: var(--green-100); border-color: #cfe2f6; }
  table.faraid tr.bm { background: #f1f9f4; }
  table.faraid tr.bm td, table.faraid tfoot td { background: transparent; }
}
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .45rem; vertical-align: 1px; }
.basis { display: block; color: var(--muted); font-size: .76rem; }

.chart { text-align: center; }
.chart svg { width: 100%; max-width: 220px; height: auto; }
.chart-label { font: 700 13px var(--font); fill: var(--ink); }
.chart-sub { font: 500 10px var(--font); fill: var(--muted); }

.box { border-radius: 12px; padding: .9rem 1rem; margin-top: 1rem; font-size: .9rem; }
.box h4 { margin: 0 0 .4rem; font-size: .9rem; }
.box ul { margin: 0; padding-left: 1.1rem; }
.box li { margin: .2rem 0; }
.box-blocked { background: #fbf1ee; border: 1px solid #f0d6cf; }
.box-notes { background: var(--green-100); border: 1px solid #cfe2f6; }

.result-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.4rem 0 0; }
.cta-card { margin-top: 1.4rem; background: linear-gradient(140deg, var(--gold-100), #fff 70%); border: 1px solid #c9ecd9; border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.cta-card h3 { font-family: var(--serif); font-size: 1.25rem; color: var(--green-900); }

.disclaimer { font-size: .8rem; color: var(--muted); margin: 1.6rem auto 3rem; }

/* Modal & toast */
.modal { position: fixed; inset: 0; background: rgba(8, 20, 40, .55); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; width: min(440px, 100%); position: relative; max-height: 92vh; overflow: auto; }
.modal-x { position: absolute; top: .5rem; right: .6rem; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.check { display: flex; gap: .6rem; font-size: .8rem; color: var(--muted); margin-bottom: 1rem; align-items: flex-start; }
.check input { margin-top: .2rem; accent-color: var(--green-700); width: 18px; height: 18px; flex: none; }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 999px; font-size: .9rem; z-index: 60; }

/* Print / PDF */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .no-print, .modal, .toast { display: none !important; }
  .print-only { display: block; }
  table.faraid { min-width: 0; font-size: 9.5pt; }
  table.faraid th { background: #0a2f5c !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .swatch, .box, .badge, .stat, table.faraid tr.bm td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-wrap { overflow: visible; border: 0; }
  .summary-row { grid-template-columns: 1fr 130px; }
  .summary-row .chart svg { max-width: 130px; }
  .print-head { display: flex; justify-content: space-between; border-bottom: 2px solid #0a2f5c; padding-bottom: 8pt; margin-bottom: 12pt; }
  .print-head h1 { font-size: 18pt; margin: 0; }
  .print-head p { margin: 0; font-size: 9pt; color: #555; }
  .print-foot { margin-top: 14pt; font-size: 8pt; color: #555; border-top: 1px solid #ccc; padding-top: 6pt; }
  tr, .box { page-break-inside: avoid; }
}
