:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --text: #1d2321;
  --muted: #5b6561;
  --border: #dedad0;
  --brand: #1f6f5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0ec;
  --warn-bg: #fff6e0;
  --warn-ink: #6b4a00;
  --danger: #a3332b;
  --focus: #2a7fff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 24px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615; --surface: #1a201e; --surface-2: #222a27; --text: #e8ece9; --muted: #a2ada8;
    --border: #2f3935; --brand: #4fb89c; --brand-ink: #0c1311; --brand-soft: #1d332c;
    --warn-bg: #3a2f12; --warn-ink: #f3d68a; --danger: #ef7d73; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121615; --surface: #1a201e; --surface-2: #222a27; --text: #e8ece9; --muted: #a2ada8;
  --border: #2f3935; --brand: #4fb89c; --brand-ink: #0c1311; --brand-soft: #1d332c;
  --warn-bg: #3a2f12; --warn-ink: #f3d68a; --danger: #ef7d73; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin: 0 0 .5rem; }
h2 { font-size: 1.6rem; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

header.site { border-bottom: 1px solid var(--border); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.logo { font-weight: 750; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: .9rem; }
nav.site a { color: var(--muted); text-decoration: none; margin-left: 1.1rem; font-size: .95rem; }
nav.site a:hover { color: var(--text); }

footer.site { margin-top: 4rem; border-top: 1px solid var(--border); padding: 2rem 0 3rem; font-size: .9rem; color: var(--muted); }
footer.site a { color: var(--muted); margin-right: 1rem; }

.hero { padding: 3.5rem 0 2rem; }
.hero .lede { font-size: 1.2rem; color: var(--muted); max-width: 40rem; }
.cta-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1.5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand);
  padding: .8rem 1.3rem; border-radius: 10px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.small { padding: .5rem .9rem; font-size: .9rem; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) { .grid.three { grid-template-columns: repeat(3, 1fr); } .grid.two { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; margin-bottom: .5rem; }

.note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: .9rem 1rem; font-size: .95rem; }
.note.info { background: var(--brand-soft); color: var(--text); }

.price { font-size: 2.4rem; font-weight: 750; }
ul.check { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.check li { padding-left: 1.6rem; position: relative; margin: .35rem 0; }
ul.check li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }

details { border-bottom: 1px solid var(--border); padding: .9rem 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: .6rem 0 0; color: var(--muted); }

/* Forms */
.form-step { display: none; }
.form-step.active { display: block; }
.field { margin-bottom: 1.15rem; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .hint { display: block; color: var(--muted); font-size: .9rem; margin: -.15rem 0 .4rem; }
input[type=text], input[type=date], select, textarea {
  width: 100%; padding: .7rem .8rem; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px;
}
textarea { min-height: 130px; resize: vertical; }
.row2 { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .row2 { grid-template-columns: 1fr 1fr; } }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 9px; margin-bottom: .5rem; background: var(--surface); cursor: pointer; }
.choice input { margin-top: .3rem; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .9rem; display: none; }
.field.invalid .err { display: block; }
.progress { display: flex; gap: .4rem; margin: 1rem 0 1.5rem; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.progress span.done { background: var(--brand); }
.form-nav { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* Results */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1.5rem 0 1rem; }
.tab { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: .5rem .9rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: .95rem; }
.tab[aria-selected=true] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.doc { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; line-height: 1.65; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; overflow-wrap: anywhere; }
.doc-tools { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0 2rem; }
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-weight: 650; font-size: .85rem; background: var(--brand-soft); color: var(--brand); }
.badge.needs_more_evidence { background: var(--warn-bg); color: var(--warn-ink); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin: 2rem auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-box { margin-top: 1rem; }
.result-box table { width: 100%; border-collapse: collapse; }
.result-box td { padding: .55rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.result-box td:first-child { color: var(--muted); padding-right: 1rem; width: 45%; }

article.guide h2 { margin-top: 2rem; }
article.guide li { margin: .3rem 0; }

@media print {
  header.site, footer.site, .no-print, .tabs, .doc-tools { display: none !important; }
  body { background: #fff; color: #000; }
  .doc { border: none; padding: 0; white-space: pre-wrap; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
