[hidden] { display: none !important; }
:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1d2320; --muted: #5d6762; --line: #e3e1da;
  --brand: #1f6f5c; --brand-ink: #ffffff; --soft: #e7f1ee; --good: #1f7a4d; --warn: #a15c00;
  --bad: #b3261e; --bar: #cfe3dc; --bar-strong: #1f6f5c; --chip: #eeece6; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --card: #1a201d; --ink: #e8ece9; --muted: #a3ada8; --line: #2c3430;
    --brand: #5fc2a6; --brand-ink: #0c1411; --soft: #1f2d28; --good: #6fd39c; --warn: #f0b35a;
    --bad: #ff8a80; --bar: #24423a; --bar-strong: #5fc2a6; --chip: #252c29; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--brand); }
main { max-width: 760px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right)); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 16px 0; }
.brand { max-width: 760px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.logo { font-weight: 800; letter-spacing: .12em; color: var(--brand); }
.preview-badge { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #6d3b00; color: #fff; border-radius: 999px; padding: 2px 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tag { flex: 1 1 100%; color: var(--muted); font-size: .9rem; }
@media (min-width: 480px) {
  .tag { flex: 0 1 auto; }
}
.tabs { max-width: 760px; margin: 8px auto 0; display: flex; gap: 4px; }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 4px; font: inherit; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); font-weight: 600; }
.banner { background: #fff3d6; color: #5a4300; text-align: center; font-size: .85rem; padding: 6px 16px; }
@media (prefers-color-scheme: dark) { .banner { background: #3a3016; color: #f3d48a; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.form label { display: block; font-size: .9rem; color: var(--muted); margin: 10px 0 0; }
.form input, .form select, textarea { display: block; width: 100%; margin-top: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 16px; min-height: 44px; color: var(--ink); background: var(--bg); }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
label.check input { width: auto; margin: 0; }
fieldset { border: 0; padding: 0; margin: 14px 0 0; }
legend { font-size: .9rem; color: var(--ink); font-weight: 600; margin-bottom: 6px; padding: 0; }
.legend-note { font-weight: 400; color: var(--muted); }
.row { display: flex; gap: 12px; } .row > * { flex: 1; min-width: 0; }
.row.tight { align-items: end; gap: 8px; margin-top: 6px; }
details { margin-top: 14px; } summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 999px; padding: 10px 14px; font: inherit; font-size: .95rem; cursor: pointer; min-height: 44px; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; padding: 12px 10px; border: 0; background: var(--card); color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer; min-height: 48px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--soft); color: var(--brand); font-weight: 700; }
.seg.big button { padding: 14px 10px; font-weight: 600; }
.firm.needs .seg { outline: 2px solid var(--warn); }
button.primary { width: 100%; margin-top: 16px; padding: 14px 16px; border: 0; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; min-height: 48px; touch-action: manipulation; }
button.primary:disabled { opacity: .6; }
button.ghost, button.small { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 10px 14px; font: inherit; cursor: pointer; min-height: 44px; touch-action: manipulation; }
button.small { padding: 6px 10px; font-size: .88rem; }
button.go { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.center { text-align: center; }
.error { color: var(--bad); font-size: .92rem; }
.headline .big { font-size: 2.1rem; font-weight: 800; letter-spacing: -.01em; }
.headline .sub { color: var(--muted); }
.keep { color: var(--good); font-weight: 700; font-size: 1.1rem; margin-top: 6px; }
.range { position: relative; height: 12px; background: var(--chip); border-radius: 999px; margin: 14px 0 6px; }
.range .span { position: absolute; top: 0; bottom: 0; background: var(--bar); border-radius: 999px; }
.range .pt { position: absolute; top: -3px; width: 4px; height: 18px; background: var(--bar-strong); border-radius: 2px; }
.range .cap { position: absolute; top: -6px; width: 2px; height: 24px; background: var(--ink); }
.range.dashed .span { background: repeating-linear-gradient(90deg, var(--bar) 0 6px, transparent 6px 10px); }
.legend { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; background: var(--chip); color: var(--muted); }
.pill.good { background: #dff3e7; color: #155c39; } .pill.warn { background: #fff0d6; color: #6b4300; } .pill.gem { background: #efe6ff; color: #4b2a8a; }
@media (prefers-color-scheme: dark) { .pill.good { background: #1d3a2b; color: #8fe0b2; } .pill.warn { background: #3a2c14; color: #f3c27a; } .pill.gem { background: #2c2440; color: #c9b5ff; } }
.stat-row { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .9rem; margin-top: 8px; }
.stat-row b { color: var(--ink); }
.upgrades { display: grid; gap: 10px; }
.up { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center; }
.up .grow { flex: 1; }
.up .delta { font-weight: 700; }
.day h3 { display: flex; justify-content: space-between; }
.item { display: grid; grid-template-columns: 54px 1fr auto; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.item .amt { font-weight: 700; text-align: right; white-space: nowrap; }
.item .why, .item .kids { grid-column: 2 / 4; color: var(--muted); font-size: .85rem; }
.item .mini { grid-column: 2 / 4; }
.mini .range { height: 6px; margin: 4px 0 0; } .mini .range .pt { height: 10px; top: -2px; }
.lines { font-size: .92rem; } .lines div { display: flex; justify-content: space-between; padding: 4px 0; }
.opt { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.opt .row { align-items: center; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.sheet-body { background: var(--card); width: 100%; max-width: 760px; max-height: min(92vh, 100%); overflow: auto; border-radius: 18px 18px 0 0; padding: 16px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); -webkit-overflow-scrolling: touch; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.toast { position: fixed; left: 50%; bottom: max(24px, calc(12px + env(safe-area-inset-bottom))); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; z-index: 30; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
.toast button { background: none; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
.actions button { flex: 1; }
.warn-card { border-color: var(--warn); }
table.ex { width: 100%; border-collapse: collapse; font-size: .88rem; } table.ex td { padding: 4px 6px; border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.foot { max-width: 760px; margin: 0 auto; padding: 8px max(16px, env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right)); display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; color: var(--muted); font-size: .9rem; }
.foot button, .foot a { min-height: 44px; display: inline-flex; align-items: center; }
.foot button { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
textarea { resize: vertical; }
.tabs button { min-height: 44px; padding: 12px 6px; touch-action: manipulation; }
.top { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

@media (max-width: 600px) {
  .row { flex-direction: column; gap: 0; }
  .row > * { flex: 1 1 auto; width: 100%; }
  .row.tight { flex-direction: row; align-items: stretch; }
  .row.tight > .ghost { flex: 0 0 auto; align-self: stretch; }
  .seg { flex-direction: column; }
  .seg button + button { border-left: 0; border-top: 1px solid var(--line); }
  .item { grid-template-columns: 52px 1fr; grid-template-rows: auto auto; }
  .item .amt { grid-column: 2; text-align: left; white-space: normal; }
  .item .why, .item .kids, .item .mini { grid-column: 1 / -1; }
  .opt .row { flex-direction: column; align-items: stretch; }
  .actions { padding-bottom: env(safe-area-inset-bottom); }
  h1 { font-size: 1.25rem; }
  .card { padding: 14px; margin: 10px 0; }
}
@media (max-width: 420px) {
  .headline .big { font-size: 1.75rem; }
  .preview-badge + .tag { margin-top: -4px; }
}
