:root {
  --bg: #F7F3EC; --surface: #FFFDF9; --sunk: #EFE9DF; --line: #E2D9CB;
  --fg: #1C1D2B; --muted: #696677;
  --accent: #0E7490; --accent-ink: #FFFFFF; --accent-soft: #DDF0F3;
  --warn: #A1361F;
  --display: "Fraunces", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgb(40 30 10 / .05), 0 6px 18px rgb(40 30 10 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14151F; --surface: #1D1E2B; --sunk: #262838; --line: #34364A;
    --fg: #ECEAF2; --muted: #A3A1B3;
    --accent: #67C7D9; --accent-ink: #0F1A1F; --accent-soft: #173640;
    --warn: #F0907A; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14151F; --surface: #1D1E2B; --sunk: #262838; --line: #34364A;
  --fg: #ECEAF2; --muted: #A3A1B3;
  --accent: #67C7D9; --accent-ink: #0F1A1F; --accent-soft: #173640;
  --warn: #F0907A; --shadow: none; color-scheme: dark;
}
:root { --good: #2F7A3E; --good-soft: #E1F1E3; --wait: #A86A06; --wait-soft: #FBEFD6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --good: #7FD08C; --good-soft: #1C3522; --wait: #F2C26B; --wait-soft: #3A2E14; } }
:root[data-theme="dark"] { --good: #7FD08C; --good-soft: #1C3522; --wait: #F2C26B; --wait-soft: #3A2E14; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: 1.2rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.brand img { border-radius: 8px; }
main { display: flex; flex-direction: column; gap: 18px; }
.section-title { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 6px 0 -6px; }

.btn { font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--warn); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .6; cursor: progress; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; font-size: 1.1rem; }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--sunk); position: sticky; top: calc(6px + env(safe-area-inset-top, 0px)); z-index: 2; }
.tabs button { flex: 1; font: inherit; font-weight: 600; font-size: .92rem; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.tabs .dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--wait); color: #fff; font-size: .72rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.kid-head { display: flex; align-items: center; gap: 12px; }
.kid-head .grow { flex: 1; min-width: 0; }
.face { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; flex: none; background: var(--k, var(--accent)); }
.face.big { width: 64px; height: 64px; font-size: 2.1rem; }
.money { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.money.huge { font-size: clamp(2.6rem, 12vw, 3.6rem); line-height: 1; letter-spacing: -.02em; }
.money.neg { color: var(--warn); }
.money.pos { color: var(--good); }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px; border-top: 6px solid var(--k, var(--accent)); }

.goal { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--bg); border: 1px dashed var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; margin-top: 6px; }
.bar { height: 10px; border-radius: 999px; background: var(--sunk); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--k, var(--accent)); border-radius: inherit; transition: width .4s ease; }

.chores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chore { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.chore .em { font-size: 1.6rem; width: 36px; text-align: center; flex: none; }
.chore .grow { flex: 1; min-width: 0; }
.chore .t { font-weight: 600; }
.chore .sub { color: var(--muted); font-size: .84rem; }
.chore .box { width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-weight: 700; }
.chore.pending { border-color: var(--wait); background: var(--wait-soft); }
.chore.pending .box { border-color: var(--wait); color: var(--wait); }
.chore.approved { border-color: var(--good); background: var(--good-soft); }
.chore.approved .box { border-color: var(--good); background: var(--good); color: #fff; }
.chore.approved .t { text-decoration: line-through; text-decoration-thickness: 2px; }
.chore.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .chore.pop { animation: none; } .bar > i { transition: none; } }
.chore.plain { cursor: default; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .sub { color: var(--muted); font-size: .84rem; }
.empty { color: var(--muted); font-size: .95rem; text-align: center; padding: 18px 8px; }

dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--fg); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(10 10 25 / .45); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-body { padding: 4px 16px 16px; }
.sheet-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.sheet-foot .left { margin-right: auto; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-weight: 600; font-size: .9rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
input, select { font: inherit; font-size: 1rem; padding: 10px 12px; min-height: 44px; border-radius: 12px; min-width: 0; width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: .88rem; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.emojis { display: flex; flex-wrap: wrap; gap: 6px; }
.emojis label { width: 42px; height: 42px; display: grid; place-items: center; font-size: 1.4rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.emojis input { position: absolute; opacity: 0; pointer-events: none; }
.emojis label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
.emojis label:has(input:focus-visible) { outline: 3px solid var(--accent); }
.msg { color: var(--warn); font-size: .92rem; margin-top: 10px; }
.msg:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: calc(100vw - 32px);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem; box-shadow: 0 8px 24px rgb(0 0 0 / .2); z-index: 10; }
@media (max-width: 420px) { .pair { grid-template-columns: 1fr; } }
