:root {
  --bg: #f7f3ec; --card: #ffffff; --ink: #1c2421; --muted: #55605b; --line: #e3ddd2;
  --brand: #0f5c55; --brand-ink: #ffffff; --brand-soft: #e3f0ed; --focus: #f2a516;
  --likely: #13703f; --likely-bg: #e2f3e8; --maybe: #8a5a00; --maybe-bg: #fbf0d9;
  --check: #2b4f8a; --check-bg: #e5ecf8; --always: #5b4a8a; --always-bg: #eeeaf8;
  --fs: 17px; --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121614; --card: #1c2220; --ink: #eef2ef; --muted: #a8b3ae; --line: #2e3633;
          --brand: #4fb3a6; --brand-ink: #08201d; --brand-soft: #1d3330;
          --likely: #7bd49b; --likely-bg: #193325; --maybe: #f0c46a; --maybe-bg: #3a2f17;
          --check: #9dbaf0; --check-bg: #1d2a40; --always: #c2b2f2; --always-bg: #2a2440; }
}
html.big { --fs: 21px; }
* { box-sizing: border-box; }
html { font-size: var(--fs); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Devanagari", sans-serif; line-height: 1.55; padding-bottom: 84px; }
:lang(hi), :lang(mr) { line-height: 1.7; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 9; background: var(--card); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
       padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; } .brand b { display: block; font-size: 1.05rem; } .brand small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.3; max-width: 46ch; }
@media (max-width: 520px) { .brand small { display: none; } }
.tools { display: flex; gap: 8px; align-items: center; }
select, input, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.iconbtn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.iconbtn[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

main { max-width: 680px; margin: 0 auto; padding: 18px 16px 24px; outline: none; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 8px 0 10px; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
.sub { color: var(--muted); margin-top: 0; }
.hero { padding: 18px 0 6px; } .hero h1 { font-size: 1.9rem; }
button { font: inherit; cursor: pointer; }
.primary, .ghost, .btnlike { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 20px; border-radius: 14px; font-weight: 650; text-decoration: none; }
.primary { background: var(--brand); color: var(--brand-ink); border: 0; }
.primary.big { width: 100%; min-height: 60px; font-size: 1.08rem; margin: 10px 0 12px; }
.ghost, .btnlike { background: var(--card); color: var(--brand); border: 1.5px solid var(--brand); }
.link { background: none; border: 0; color: var(--brand); text-decoration: underline; min-height: 44px; padding: 0 8px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px 0; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.privacy { color: var(--muted); font-size: .88rem; margin-top: 18px; }
.fine { color: var(--muted); font-size: .8rem; } .disclaimer { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 12px; }

.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .3s ease; }
.step { color: var(--muted); font-size: .85rem; margin: 10px 0 4px; }
fieldset { border: 0; margin: 0; padding: 0; }
legend .qh { font-size: 1.45rem; margin: 0; }
legend { font-size: 1.45rem; font-weight: 700; line-height: 1.3; margin: 4px 0 6px; padding: 0; }
.hint { color: var(--muted); margin: 0 0 12px; }
.choice { display: flex; align-items: center; gap: 14px; background: var(--card); border: 2px solid var(--line); border-radius: var(--r);
          padding: 16px 18px; margin: 10px 0; min-height: 60px; cursor: pointer; font-weight: 600; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--brand); }
.choice input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; flex: none; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice.small { min-height: 52px; padding: 10px 14px; }
.choice .emoji { font-size: 1.4rem; }

.cards { list-style: none; padding: 0; margin: 0; }
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 14px 0; }
.card h2 { font-size: 1.12rem; margin: 6px 0 6px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.b-likely { color: var(--likely); background: var(--likely-bg); } .b-maybe { color: var(--maybe); background: var(--maybe-bg); }
.b-check { color: var(--check); background: var(--check-bg); } .b-always { color: var(--always); background: var(--always-bg); }
.card .why { margin: 4px 0 8px; }
.card details { border-top: 1px solid var(--line); padding: 8px 0; }
.card summary { cursor: pointer; font-weight: 650; min-height: 40px; display: flex; align-items: center; }
.card ul { margin: 6px 0; padding-left: 22px; }
.say { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; margin: 8px 0; font-size: 1.02rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions .ghost, .actions .btnlike { min-height: 44px; padding: 8px 14px; font-size: .9rem; }

.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 22px 0 8px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li label { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; min-height: 44px; cursor: pointer; }
.checklist input { width: 22px; height: 22px; accent-color: var(--brand); margin-top: 3px; flex: none; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }

textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
.billgrid { display: grid; gap: 10px; margin: 16px 0; }
.cat { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.cat .top2 { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.cat p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.total { font-size: 1.25rem; font-weight: 800; }
.flags { background: var(--maybe-bg); color: var(--ink); border-radius: 14px; padding: 12px 16px; }
.flags h2 { color: var(--maybe); } .flags li { margin: 6px 0; }

.form label { display: grid; gap: 6px; margin: 12px 0; font-weight: 600; }
.form label.choice { display: flex; margin: 8px 0; }
.form fieldset { margin: 6px 0 4px; } .form legend { font-size: 1rem; }
.letter { white-space: pre-wrap; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 18px; font-family: Georgia, "Noto Serif Devanagari", serif; font-size: .98rem; line-height: 1.6; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-top: 1px solid var(--line);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 6; }
.tabs button { display: grid; justify-items: center; gap: 2px; background: none; border: 0; color: var(--muted); padding: 6px 4px; min-height: 56px; border-radius: 12px; font-size: .78rem; font-weight: 650; }
.tabs button[aria-current=page] { color: var(--brand); background: var(--brand-soft); }
.tabs span[aria-hidden] { font-size: 1.3rem; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .top, .tabs, .actions, .row, #toast, .skip, textarea, form { display: none !important; }
  body { background: #fff; color: #000; padding: 0; } .card, .panel { border-color: #999; break-inside: avoid; }
  .view[hidden] { display: none !important; }
}
