/* keyissue look (same in every app; only the accent changes): soft grey ground,
   white cards, the phone's own font. Light and dark follow the phone. */
:root {
  --bg: #F2F2F5; --surface: #FFFFFF; --sunk: #EDEDF1; --line: #E4E4E9;
  --fg: #111114; --muted: #5F5F6B;
  --accent: #A21CAF; --accent-ink: #FFFFFF; --accent-soft: #F7E6F8;
  --warn: #B42318; --good: #15803D; --good-soft: #E3F4E8; --wait: #A15C07; --wait-soft: #FBEFD9;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgb(17 17 20 / .04), 0 4px 16px rgb(17 17 20 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0B0E; --surface: #1C1C21; --sunk: #26262C; --line: #2E2E35;
    --fg: #F4F4F6; --muted: #A1A1AA;
    --accent: #E879F9; --accent-ink: #0B0B0E; --accent-soft: #33123A;
    --warn: #F97066; --good: #4ADE80; --good-soft: #12301C; --wait: #F5B954; --wait-soft: #3A2C12; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0B0E; --surface: #1C1C21; --sunk: #26262C; --line: #2E2E35;
    --fg: #F4F4F6; --muted: #A1A1AA;
    --accent: #E879F9; --accent-ink: #0B0B0E; --accent-soft: #33123A;
    --warn: #F97066; --good: #4ADE80; --good-soft: #12301C; --wait: #F5B954; --wait-soft: #3A2C12; --shadow: none; color-scheme: dark;
}
* { 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; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 2.125rem; line-height: 1.1; letter-spacing: -.025em; }
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: 2.125rem; line-height: 1.1; letter-spacing: -.025em; }
.brand img { display: none; }
main { display: flex; flex-direction: column; gap: 18px; }
.section-title { font-size: .82rem; letter-spacing: .01em; color: var(--muted); font-weight: 600; margin: 6px 4px -8px; }

.btn { font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid transparent; background: var(--sunk); transition: transform .1s ease, filter .15s ease; color: var(--fg); }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.97); }
.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: 0; background: var(--surface); box-shadow: var(--shadow); 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 { background: #E4E4EA; padding: 3px; border-radius: 12px; }
.tabs button { min-height: 36px; border-radius: 9px; }
.tabs button[aria-selected="true"] { box-shadow: 0 1px 3px rgb(17 17 20 / .12); }
.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 transparent; 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; }

.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: 8px; 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 14px; border-radius: 16px; border: 1px solid transparent; background: var(--surface); box-shadow: var(--shadow); color: var(--fg); font: inherit; text-align: left; cursor: pointer; transition: transform .1s ease; }
.chore:active { transform: scale(.985); }
.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: 30px; height: 30px; border-radius: 999px; border: 2px solid #C7C7D1; 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: 0; border-radius: 22px; 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 (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs { background: var(--sunk); } :root:not([data-theme="light"]) .chore .box { border-color: #4A4A52; } }
@media (max-width: 420px) { .pair { grid-template-columns: 1fr; } }
.card .chore:not(.pending):not(.approved) { background: var(--bg); box-shadow: none; }


/* Shared Key Issue finish: consistent surfaces, controls, and motion. */
:root {
  --ki-card-radius: 18px;
  --ki-control-radius: 12px;
  --ki-card-shadow: 0 2px 5px rgb(17 17 20 / .035), 0 10px 26px rgb(17 17 20 / .045);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ki-card-shadow: none; }
}
:root[data-theme="dark"] { --ki-card-shadow: none; }
.card {
  border-radius: var(--ki-card-radius);
  border-color: color-mix(in srgb, var(--line) 72%, transparent);
  box-shadow: var(--ki-card-shadow);
}
.btn, .icon-btn, button {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
.btn { border-radius: var(--ki-control-radius); }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select, textarea {
  border-radius: var(--ki-control-radius);
}
:focus-visible {
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ---------- Wishlists ---------- */
.top { flex-direction: column; align-items: flex-start; gap: 2px; }
.back { display: inline-flex; align-items: center; gap: 2px; margin-left: -6px; padding: 4px 6px; min-height: 36px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 1.02rem; cursor: pointer; }
.lists { display: flex; flex-direction: column; gap: 8px; }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; border: 1px solid transparent; background: var(--surface); box-shadow: var(--ki-card-shadow); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.lrow:active { transform: scale(.985); }
.lrow .grow { flex: 1; min-width: 0; }
.lrow .t { font-weight: 600; }
.lrow .sub { color: var(--muted); font-size: .84rem; }
.lrow .chev { color: var(--muted); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--k, var(--accent)); color: #fff; font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--fg); border-radius: 14px; padding: 12px 14px; font-size: .9rem; }
.note svg { flex: none; color: var(--accent); margin-top: 2px; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--ki-card-shadow); display: flex; flex-direction: column; gap: 8px; }
.item .head { display: flex; gap: 10px; align-items: flex-start; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow-wrap: anywhere; }
.item .sub { color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.item .price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item a { color: var(--accent); }
.item.taken { opacity: .72; }
.item.done .t { text-decoration: line-through; text-decoration-thickness: 2px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--sunk); color: var(--muted); }
.tag.want { background: var(--accent-soft); color: var(--accent); }
.tag.secret { background: var(--wait-soft); color: var(--wait); }
.tag.mine { background: var(--good-soft); color: var(--good); }
.tag.bought { background: var(--good); color: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 0; color: var(--muted); font-size: .9rem; }
.total b { color: var(--fg); font-variant-numeric: tabular-nums; }
textarea { font: inherit; font-size: 1rem; padding: 10px 12px; min-height: 76px; border-radius: 12px; width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--fg); resize: vertical; }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--sunk); }
.seg label { flex: 1; text-align: center; padding: 8px 6px; border-radius: 9px; font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgb(17 17 20 / .12); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { width: 34px; height: 34px; border-radius: 50%; background: var(--k); cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--k); }
.swatches label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 4px; }
details.done-list summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; padding: 6px 4px; }
details.done-list .items { margin-top: 8px; }
