:root {
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface-2: #efebe3;
  --ink: #1c2421;
  --muted: #6a736e;
  --line: #e2ddd3;
  --brand: #2f5d50;
  --brand-ink: #ffffff;
  --brand-soft: #dde9e3;
  --warn: #b85a2e;
  --warn-soft: #f7e3d8;
  --ok: #2f7a4f;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .06);
  --radius: 14px;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --surface: #1b2320;
    --surface-2: #232d29;
    --ink: #e9eeeb;
    --muted: #93a09a;
    --line: #2c3833;
    --brand: #7fb8a5;
    --brand-ink: #0f1a16;
    --brand-soft: #22352e;
    --warn: #e59268;
    --warn-soft: #3a2519;
    --ok: #79c497;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- boot ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.92); } }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); }
.login h1 { margin: 12px 0 2px; font-size: 24px; }
.login p { margin: 0 0 20px; color: var(--muted); }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.who button { padding: 14px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; }
.who button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.pin { width: 100%; padding: 14px; font-size: 22px; letter-spacing: .4em; text-align: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.login .err { color: var(--warn); min-height: 1.4em; margin: 8px 0; font-size: 14px; }
.logo { width: 52px; height: 52px; }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 8px;
}
.top-row { display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 26px; margin: 0; flex: 1; letter-spacing: -.01em; }
.me { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); opacity: .8; }
.sync-dot.off { background: var(--warn); }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

main { padding: 4px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 90px); max-width: 720px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; padding-left: 2px; padding-right: 2px;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { flex: 1 1 auto; padding-left: 3px !important; padding-right: 3px !important; min-width: 0; overflow: hidden; height: var(--tabbar); border: 0; background: none; display: grid; place-items: center; gap: 2px; color: var(--muted); font-size: 10px; letter-spacing: -.01em; font-weight: 600; padding: 8px 0 6px; white-space: nowrap; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--brand); }
.tabbar .badge.alert { background: var(--warn); }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-size: 11px; line-height: 18px; }
.tabbar button { position: relative; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font-weight: 500; opacity: .6; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ---------- add bar ---------- */
.addbar {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding: 10px 12px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.addbar form { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.addbar input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.addbar select { max-width: 38%; padding: 0 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.addbar button { width: 48px; border-radius: 12px; border: 0; background: var(--brand); color: var(--brand-ink); font-size: 26px; line-height: 1; }

/* ---------- lists ---------- */
.group { margin-top: 18px; }
.group-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin: 0 2px 8px; }
.group-h .n { color: var(--muted); font-weight: 500; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); min-height: 56px; }
.row:first-child { border-top: 0; }
.tick { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: none; display: grid; place-items: center; padding: 0; }
.tick svg { width: 16px; height: 16px; opacity: 0; }
.done .tick { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.done .tick svg { opacity: 1; }
.row-body { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.done .row-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.row-meta { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.qty { flex: none; font-size: 13px; font-weight: 700; background: var(--surface-2); padding: 3px 8px; border-radius: 8px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.tag.urgent { background: var(--warn-soft); color: var(--warn); }
.tag.who { background: var(--brand-soft); color: var(--brand); }
.overdue { color: var(--warn); font-weight: 600; }

.usuals { margin-top: 14px; }
.usuals .label { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 2px 6px; }
.usuals .chips { padding-top: 2px; }
.usuals .chip { font-weight: 500; }
.usuals .chip::before { content: "+"; font-weight: 700; color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.fold { margin-top: 22px; }
.fold-h { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; }
.fold-h button.link { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 0; }
.fold-h button.clear { border: 0; background: none; color: var(--warn); font-weight: 600; font-size: 14px; padding: 6px 0; }

/* ---------- meals ---------- */
.weeknav { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.weeknav .label { flex: 1; text-align: center; font-weight: 700; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; padding: 0; }
.iconbtn svg { width: 20px; height: 20px; }
.day { display: flex; gap: 14px; align-items: stretch; padding: 12px 14px; border-top: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.day:first-child { border-top: 0; }
.day-date { flex: none; width: 44px; text-align: center; }
.day-date .dow { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day-date .dn { font-size: 22px; font-weight: 700; line-height: 1.1; }
.day.today .day-date .dn { color: var(--brand); }
.day.today { background: var(--brand-soft); }
.day-main { flex: 1; min-width: 0; align-self: center; }
.day-main .plan { font-weight: 600; }
.day-main .plan.none { color: var(--muted); font-weight: 400; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- buttons ---------- */
.btn { padding: 13px 16px; border-radius: 12px; border: 0; background: var(--brand); color: var(--brand-ink); font-weight: 700; width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: none; color: var(--warn); }
.btn:disabled { opacity: .5; }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 15, 12, .45); z-index: 50; animation: fade .15s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 18px);
  max-width: 720px; margin: 0 auto;
  animation: up .2s cubic-bezier(.2,.8,.2,1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.field textarea { min-height: 96px; resize: vertical; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; font-weight: 600; }
.switch input { width: 22px; height: 22px; accent-color: var(--warn); }
.hint { font-size: 13px; color: var(--muted); margin: -6px 0 14px; }
.sheet .foot { display: grid; gap: 8px; margin-top: 6px; }
.sheet .foot-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; transform: translate(-50%, 20px); z-index: 60;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 84px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { background: none; border: 0; color: var(--brand-soft); font-weight: 700; padding: 0; }
@media (prefers-color-scheme: dark) { #toast button { color: var(--brand-ink); } }

/* ---------- messages ---------- */
.bell { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; padding: 0; }
.bell svg { width: 20px; height: 20px; }
.bell[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.msgs { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.msg { max-width: 82%; display: flex; flex-direction: column; gap: 3px; align-self: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 4px; }
.msg .bubble { background: var(--surface); box-shadow: var(--shadow); border-radius: 16px 16px 16px 4px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; border: 0; text-align: left; font: inherit; color: inherit; }
.msg.mine .bubble { background: var(--brand); color: var(--brand-ink); border-radius: 16px 16px 4px 16px; }
.msg .when { font-size: 11px; color: var(--muted); padding: 0 4px; }
.daysep { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; margin: 8px 0 2px; }

/* ---------- kids ---------- */
.kid-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kid-card { text-align: left; background: var(--surface); border: 2px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 14px 12px 18px; font: inherit; color: inherit; position: relative; overflow: hidden; }
.kid-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--kid); }
.kid-card[aria-pressed="true"] { border-color: var(--kid); }
.kid-name { font-size: 20px; font-weight: 800; }
.kid-age { font-size: 15px; font-weight: 700; color: var(--kid); margin: 2px 0 6px; }
.kid-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mem { display: block; width: 100%; text-align: left; padding: 0; border: 0; font: inherit; color: inherit; margin-bottom: 10px; }
.mem-photo { display: block; width: 100%; max-height: 440px; object-fit: cover; background: var(--surface-2); }
.mem-body { padding: 12px 14px 13px; }
.mem-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.4; }
.mem-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.tag.kid { background: color-mix(in srgb, var(--kid) 16%, transparent); color: var(--kid); }
.mem-full { display: block; width: 100%; max-height: 55dvh; object-fit: contain; border-radius: 12px; background: var(--surface-2); margin-bottom: 14px; }
.photo-pick { width: 48px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--brand); display: grid; place-items: center; }
.photo-pick svg { width: 24px; height: 24px; }
.sheet label.btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.sheet label.btn svg { width: 20px; height: 20px; }

/* ---------- bins ---------- */
.bin-card { margin-top: 12px; padding: 14px 16px 16px; }
.bin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bin-name { font-size: 17px; font-weight: 700; }
.bin-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bin-when { text-align: right; font-size: 14px; font-weight: 700; flex: none; }
.bin-when.soon { color: var(--warn); }
.bin-date { font-weight: 500; color: var(--muted); font-size: 13px; margin-top: 2px; }
.bin-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bin-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.bin-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.bin-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.bin-later { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: grid; gap: 4px; }

/* ---- passwords vault ---- */
.vault-lock { padding: 24px 20px; margin-top: 12px; text-align: center; }
.vault-lock h2 { margin: 10px 0 6px; font-size: 20px; }
.vault-lock p { color: var(--muted); margin: 0 0 14px; font-size: 15px; }
.vault-lock .field { text-align: left; }
.vault-lock .pin { letter-spacing: normal; font-size: 18px; }
.vault-lock .err, .sheet .err { color: var(--warn); min-height: 1.4em; margin: 6px 0 8px; font-size: 14px; }
.vault-lock .warn-note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; text-align: left; font-size: 14px; }
.vault-ico { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.vault-ico svg { width: 30px; height: 30px; }
.vault-av { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.icon-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted); text-decoration: none; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn[hidden] { display: none; }
.vault-inp { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding-right: 2px; }
.field .vault-inp input { flex: 1; min-width: 0; border: 0; background: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chip.lock-chip svg { width: 16px; height: 16px; }
.sheet-h3 { font-size: 15px; margin: 4px 0 10px; }
.field[hidden] { display: none; }
.vault-sec { margin-top: 16px; }
.vault-sec .sec-h { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.vault-sec .sec-h .link { text-transform: none; letter-spacing: 0; font-size: 14px; }
.vault-av svg { width: 20px; height: 20px; }
.vault-av.t-email { background: var(--warn-soft); color: var(--warn); }
.vault-av.t-web { background: var(--surface-2); color: var(--ink); }
.vault-add3 { display: grid; gap: 8px; }
.vault-add3 .btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.vault-add3 .btn svg { width: 20px; height: 20px; }
.vault-sec .sec-h button.link { border: 0; background: none; color: var(--brand); font-weight: 700; padding: 4px 0; }

/* ---------- returns ---------- */
.tag.return { background: var(--surface-2); color: var(--ink); border: 1px dashed var(--muted); }
.addbar .kind { flex: none; width: auto; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; line-height: 1; font-weight: 700; }
.addbar .kind[aria-pressed="true"] { background: var(--warn); color: #fff; border-color: var(--warn); }

/* ---------- rewards cards ---------- */
.cards-row { display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.cards-row::-webkit-scrollbar { display: none; }
.card-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 0; background: var(--card, var(--brand)); color: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap; }
.card-chip .card-dot { width: 18px; height: 12px; border-radius: 3px; background: rgba(255,255,255,.35); border: 1.5px solid rgba(255,255,255,.8); }
.card-chip.add { background: var(--surface); color: var(--brand); border: 1px dashed var(--line); box-shadow: none; }
.card-face { background: var(--card, var(--brand)); color: #fff; border-radius: 16px; padding: 18px 18px 28px; margin-bottom: -14px; }
.card-name { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.card-holder { opacity: .85; font-size: 13px; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.barcode { background: #fff; border-radius: 14px; padding: 14px 10px 8px; box-shadow: var(--shadow); position: relative; }
.barcode svg { width: 100%; height: 120px; display: block; }
.barcode.qr svg { height: 220px; }
.barcode-bad { color: var(--warn); text-align: center; padding: 20px; }
.scan { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 50dvh; }
.scan video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan .reticle { position: absolute; inset: 18% 8%; border: 2px solid rgba(255,255,255,.85); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); pointer-events: none; }
.btn.scan-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.scan-btn svg { width: 20px; height: 20px; }

/* ---------- parkrun ---------- */
.pr-next { background: var(--brand); color: var(--brand-ink); border-radius: var(--radius); padding: 14px 16px; margin-top: 10px; display: flex; align-items: center; gap: 12px; }
.pr-next b { font-size: 18px; display: block; }
.pr-next span { opacity: .85; font-size: 13px; }
.pr-person { padding: 14px; border-top: 1px solid var(--line); }
.pr-person:first-child { border-top: 0; }
.pr-person-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pr-person-h b { flex: 1; font-size: 16px; }
.pr-person-h .pr-id { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: 13px; }
.pr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pr-stat { background: var(--surface-2); border-radius: 10px; padding: 8px 6px; text-align: center; }
.pr-stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pr-stat span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.pr-milestone { margin-top: 10px; font-size: 13px; color: var(--muted); }
.pr-bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.pr-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.pr-actions { display: flex; gap: 8px; margin-top: 12px; }
.pr-actions .btn { padding: 10px 12px; font-size: 14px; }
.pr-time { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px; flex: none; }
.pr-time.pb { color: var(--brand); }
.links a { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.links a:first-child { border-top: 0; }
.links a::after { content: "↗"; color: var(--muted); font-weight: 400; }

/* ---------- cricket ---------- */
.fmt-pill { flex: none; width: 44px; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; padding: 5px 0; border-radius: 8px; background: var(--fmt, var(--brand)); color: #fff; }
.tag.live { background: var(--warn); color: #fff; }
.row.done .fmt-pill { opacity: .5; }
.sq-head { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.sq-head b { font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.sq-group { display: flex; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: flex-start; }
.sq-group:nth-of-type(2) { border-top: 0; }
.sq-label { flex: none; width: 92px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 4px; }
.sq-names { display: flex; flex-wrap: wrap; gap: 6px; }
.sq-name { background: var(--surface-2); border-radius: 8px; padding: 4px 9px; font-size: 14px; font-weight: 600; }
.sq-name.cap { background: var(--brand-soft); color: var(--brand); }

/* ---------- money ---------- */
:root { --c1: #2a8a66; --c2: #3a6fd0; --over: #b3261e; --over-soft: #fbe4e1; }
@media (prefers-color-scheme: dark) { :root { --c1: #34a078; --c2: #6390ea; --over: #f08a80; --over-soft: #3b1f1c; } }
.fin-nav { margin-top: 2px; }
.fin-nav .chip[aria-pressed="true"], .fc-chips .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.stat { display: block; text-align: left; padding: 14px; border: 0; font: inherit; color: inherit; }
.stat span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-grid.three .stat b { font-size: 17px; }
.stat em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.fin-sec { margin-top: 18px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 15px; margin: 0 2px 8px; }
.sec-h .link { border: 0; background: none; color: var(--brand); font-weight: 700; font-size: 14px; padding: 0; }
.sec-note { font-weight: 500; color: var(--muted); font-size: 13px; }
.card.pad { padding: 14px; }
.fin-setup { padding: 16px; margin-top: 12px; }
.fin-setup p { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.fin-setup .link { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--brand); font-weight: 700; }
.fin-alert { display: block; width: 100%; text-align: left; margin-top: 12px; padding: 12px 14px; border: 0; font: inherit; color: inherit; border-left: 5px solid var(--warn); }
.fin-alert b { display: block; }
.fin-alert span { font-size: 13px; color: var(--muted); }
.fin-actions { display: grid; gap: 8px; margin: 18px 0 8px; }
.fin-foot { text-align: center; margin: 4px 0 16px; }
.fin-row { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; }
.card > .fin-row:first-child, .card > .row:first-child { border-top: 0; }
.fin-row .row-body { flex: 1; min-width: 0; }
.amt { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; }
.amt.in { color: var(--ok); }
.amt.neg { color: var(--ink); }
.tag.cat { background: var(--surface-2); color: var(--ink); }
.tag.cat.uncat { background: var(--warn-soft); color: var(--warn); }
.fin-month { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 6px; }
.fin-month b { font-size: 17px; }
.fin-month .icon-btn { font-size: 28px; line-height: 1; color: var(--ink); }
.fin-month .icon-btn:disabled { opacity: .25; }
.fin-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.fin-filters select { width: 100%; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.fin-sync { background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.fin-sync-l { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.fin-sync-l span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-amt-big { font-size: 30px; font-weight: 800; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.fin-amt-big.in { color: var(--ok); }
/* bars: one hue, values in text ink */
.bars { display: grid; gap: 12px; }
.bar-row[data-act] { cursor: pointer; }
.bar-l { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.bar-l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-l b { flex: none; font-variant-numeric: tabular-nums; }
.bar-l em { font-style: normal; font-weight: 500; color: var(--muted); }
.bar-track { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--c1); }
.bar-fill.over { background: var(--over); }
.bar-pace { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .45; z-index: 1; }
.bar-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.budgets { display: grid; gap: 16px; }
.budget { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 7px; }
.flag svg { width: 14px; height: 14px; }
.flag.over { color: var(--over); background: var(--over-soft); }
.flag.ahead { color: var(--warn); background: var(--warn-soft); }
p.flag { display: flex; margin: 10px 0 0; padding: 8px 10px; font-size: 13px; }
.bud-f span em { font-style: normal; font-weight: 500; float: right; }
/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.ch-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-x { stroke: var(--muted); stroke-width: 1; }
.ch-dot { fill: var(--c1); stroke: var(--surface); stroke-width: 2; }
.ch-mark { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.ch-t { font-size: 10px; fill: var(--muted); }
.ch-tip[hidden] { display: none !important; }
.ch-tip { position: absolute; top: -6px; width: 130px; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 5px 8px; font-size: 12px; pointer-events: none; display: grid; }
.ch-tip span { opacity: .8; }
.chart-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 8px; }
.fc-note { margin: 8px 0 0; }
.fc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.fc-stats b { display: block; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.fc-stats b.neg { color: var(--over); }
.fc-chips { padding-top: 0; }
.legend { display: flex; gap: 14px; font-size: 13px; margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.s1, .pbar-cols .s1 { background: var(--c1); }
.sw.s2, .pbar-cols .s2 { background: var(--c2); }
.pbars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; height: 150px; align-items: end; }
.pbar { display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.pbar-cols { display: flex; gap: 2px; align-items: flex-end; justify-content: center; height: 100%; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.pbar-cols i { width: 40%; max-width: 16px; min-height: 2px; border-radius: 4px 4px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* bills calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-h { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.cal-c { min-height: 50px; border: 0; border-radius: 8px; background: var(--surface-2); padding: 3px 2px; display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; color: inherit; font-size: 10px; }
.cal-c.empty { background: none; }
.cal-c.today { outline: 2px solid var(--brand); }
.cal-n { font-size: 12px; font-weight: 700; }
.cal-in { color: var(--ok); font-weight: 700; }
.cal-out { color: var(--ink); font-weight: 600; }
.cal-c:not(.has) .cal-n { color: var(--muted); font-weight: 500; }
.cal-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 10px; }
.cal-foot b { color: var(--ink); }
.steps { padding-left: 20px; margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.steps li { margin-bottom: 8px; }
.steps code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
#fin-search, #fin-quick { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }

/* ---------- typed suggestions + custom shops ---------- */
.suggest { position: absolute; left: 0; right: 0; bottom: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; background: var(--bg); border-top: 1px solid var(--line); scrollbar-width: none; }
.suggest[hidden] { display: none; }
.suggest::-webkit-scrollbar { display: none; }
.addbar .suggest .chip { flex: none; width: auto; height: auto; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.2; }
.suggest .chip .n { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 2px; }
.chip.add-shop { border-style: dashed; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatch[aria-pressed="true"] { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Pokédex ---------- */
.dex-tools .chip svg, .dex-favbtn svg { width: 16px; height: 16px; }
.chip.dex-go { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.dex-types { padding-top: 2px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 8px; }
.dex-card { position: relative; display: grid; justify-items: center; gap: 0; padding: 8px 4px 10px; border: 0; border-radius: var(--radius); font: inherit; color: var(--ink);
  background: color-mix(in srgb, var(--t, var(--surface-2)) 26%, var(--surface)); box-shadow: var(--shadow); min-height: 140px; }
.dex-card:active { transform: scale(.97); }
.dex-card img { width: 88px; height: 88px; image-rendering: pixelated; }
.dex-no { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dex-nm { font-size: 14px; font-weight: 700; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.dex-star { position: absolute; top: 6px; right: 6px; color: var(--ink); }
.dex-star svg { width: 14px; height: 14px; fill: currentColor; }
.dex-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.dex-bar-no { font-weight: 800; font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dex-favbtn { width: 44px; height: 40px; justify-content: center; padding: 0; }
.dex-favbtn svg { width: 20px; height: 20px; }
.dex-favbtn[aria-pressed="true"] svg { fill: currentColor; }
.dex-hero { position: relative; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; border-radius: 24px; overflow: hidden; padding: 10px 0;
  background: linear-gradient(140deg, color-mix(in srgb, var(--t) 70%, var(--surface)), color-mix(in srgb, var(--t2) 45%, var(--surface))); }
.dex-art { display: block; width: 100%; max-width: 300px; height: auto; aspect-ratio: 1; object-fit: contain; margin: 0 auto; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .22)); }
.dex-art.px { image-rendering: pixelated; }
.dex-arrow { width: 40px; height: 56px; margin: 0 auto; border: 0; border-radius: 14px; background: color-mix(in srgb, var(--surface) 78%, transparent); font-size: 32px; line-height: 1; color: var(--ink); padding: 0 0 4px; }
.dex-arrow:active { background: var(--surface); }
.dex-scan { position: absolute; left: 0; right: 0; top: 0; height: 30%; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .55), transparent); animation: dex-scan 1.1s linear infinite; }
@keyframes dex-scan { from { transform: translateY(-100%); } to { transform: translateY(340%); } }
.dex-name { text-align: center; font-size: 32px; letter-spacing: -.02em; margin: 14px 0 0; }
.dex-genus { text-align: center; color: var(--muted); font-size: 16px; min-height: 1.4em; }
.dex-genus b { color: var(--ink); }
.dex-typerow { display: flex; justify-content: center; gap: 8px; margin: 10px 0 14px; min-height: 30px; }
.dex-type { display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.dex-type b { font-weight: 800; opacity: .85; }
.dex-actions { display: grid; gap: 8px; margin-bottom: 12px; }
.dex-actions .btn { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; padding: 15px 16px; }
.dex-actions .btn.ghost { font-size: 16px; padding: 12px 16px; }
.dex-actions .btn svg, .sheet .btn svg { width: 22px; height: 22px; flex: none; }
.dex-text { font-size: 18px; line-height: 1.45; }
.dex-match { display: grid; gap: 12px; }
.dex-mrow > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.dex-mrow > div, .dex-abil { display: flex; flex-wrap: wrap; gap: 6px; }
.dex-match .dex-type { padding: 4px 11px; font-size: 13px; }
.dex-abil .tag { font-size: 14px; padding: 5px 10px; }
.dex-abil em { font-style: normal; font-weight: 500; color: var(--muted); }
.dex-evos { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.dex-stage { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 100%; }
.dex-evo { display: grid; justify-items: center; width: 92px; padding: 4px 2px 6px; border: 2px solid transparent; border-radius: 12px; background: none; font: inherit; color: inherit; }
.dex-evo.cur { border-color: var(--t); background: color-mix(in srgb, var(--t) 14%, transparent); }
.dex-evo img { width: 72px; height: 72px; image-rendering: pixelated; }
.dex-evo span { font-size: 13px; font-weight: 700; text-align: center; line-height: 1.15; }
.dex-evo em { font-style: normal; font-size: 11px; color: var(--muted); text-align: center; }
.dex-evo-arrow { color: var(--muted); font-size: 20px; }
.dex-fact { justify-content: space-between; min-height: 46px; }
.dex-fact span { color: var(--muted); font-size: 14px; }
.dex-fact b { text-align: right; font-size: 14px; }
.dex-credit { text-align: center; margin: 18px 0 8px; font-size: 12px; }
#dex-search { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.tabbar button { font-size: 9.5px; padding-left: 1px !important; padding-right: 1px !important; }

/* ================= iPad / tablet layout =================
   Wide screens get a side menu instead of the bottom bar, wider multi-column pages and centred dialogs.
   Width-based, so an iPad in Slide Over or a narrow Split View falls back to the phone layout. */
html { -webkit-text-size-adjust: 100%; }
.tag.who { display: inline-block; margin: 0; white-space: nowrap; }
.tabbar button { overflow: visible; }
.tabbar .badge { left: auto; right: max(0px, calc(50% - 25px)); top: 4px; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; font-size: 10px; font-style: normal; text-align: center; border-radius: 8px; box-shadow: 0 0 0 2px var(--surface); }
@media (min-width: 700px) and (min-height: 500px) {
  :root { --side: 88px; --tabbar: 0px; --content: 1080px; }
  #app:has(> main[data-page="messages"]), #app:has(> main[data-page="money"][data-view="tx"]) { --content: 760px; }
  #app:has(> main[data-page="bins"]) { --content: 820px; }
  #app:has(> .tabbar) { padding-left: calc(var(--side) + env(safe-area-inset-left)); }

  /* side menu */
  .tabbar { top: 0; bottom: 0; right: auto; width: calc(var(--side) + env(safe-area-inset-left)); flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none;
    padding: calc(env(safe-area-inset-top) + 14px) 8px calc(env(safe-area-inset-bottom) + 14px) calc(8px + env(safe-area-inset-left)); }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar button { flex: none; width: 100%; height: 62px; border-radius: 14px; font-size: 11.5px; letter-spacing: 0; padding: 8px 2px 6px !important; }
  .tabbar button svg { width: 26px; height: 26px; }
  .tabbar button[aria-current="page"] { background: var(--brand-soft); }
  .tabbar .badge { right: calc(50% - 26px); top: 5px; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; border-radius: 9px; box-shadow: none; }

  /* page frame */
  .top { padding: calc(env(safe-area-inset-top) + 18px) max(24px, calc((100% - var(--content)) / 2 + 24px)) 10px; }
  .top h1 { font-size: 32px; }
  .sub { font-size: 15px; }
  .me, .bell { width: 42px; height: 42px; }
  main { max-width: var(--content); padding: 8px 24px calc(env(safe-area-inset-bottom) + 110px); }
  .chips, .cards-row { margin: 0 -24px; padding-left: 24px; padding-right: 24px; flex-wrap: wrap; overflow: visible; }
  .addbar { left: calc(var(--side) + env(safe-area-inset-left)); padding: 12px 24px calc(env(safe-area-inset-bottom) + 12px); }
  .addbar form, #fin-search, #fin-quick, #dex-search { max-width: min(760px, calc(var(--content) - 48px)); }
  .addbar input { padding: 14px 16px; font-size: 17px; }
  .addbar select { font-size: 15px; padding: 0 12px; }
  .addbar button { width: 54px; }
  .suggest { padding-left: 24px; padding-right: 24px; justify-content: center; }
  #toast { left: calc(50% + (var(--side) + env(safe-area-inset-left)) / 2); bottom: calc(env(safe-area-inset-bottom) + 96px); font-size: 15px; }
  .empty { padding: 64px 20px; }
  .login-card { max-width: 400px; padding: 34px 28px; }

  /* dialogs instead of bottom sheets */
  .sheet { left: 50%; right: auto; top: 50%; bottom: auto; width: min(580px, calc(100% - 48px)); max-width: none; max-height: min(88dvh, 920px); margin: 0;
    border-radius: 22px; padding: 24px 26px 26px; transform: translate(-50%, -50%); animation: pop .18s ease; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
  .sheet .grab { display: none; }
  .sheet h2 { font-size: 22px; }

  /* multi-column pages: the blocks flow into as many columns as fit */
  main[data-page="shop"], main[data-page="jobs"], main[data-page="cricket"], main[data-page="vault"], main[data-page="bins"],
  main[data-page="money"]:not([data-view="tx"]) { columns: 280px; column-gap: 20px; }
  main > .chips, main > .cards-row, main > .usuals, main > .fold, main > .empty, main > .weeknav, main > .btn-row, main > .vault-lock, main > .vault-add3,
  main > .pr-next, main > .card:has(> .cal), main[data-view="budgets"] > .card, main > .fin-sync, main > .stat-grid, main > .fin-actions, main > .fin-month, main > .fin-filters, main > .fin-foot, main > .fin-alert, main > .fin-setup, main > .hint { column-span: all; }
  main[data-page="shop"] > .group, main[data-page="jobs"] > .group, main[data-page="cricket"] > .group, main[data-page="vault"] > .vault-sec, main[data-page="bins"] > .bin-card,
  main[data-page="money"] > .fin-sec, main[data-page="money"] > .card { break-inside: avoid; margin-top: 0; margin-bottom: 20px; }
  main[data-page="shop"] > *, main[data-page="jobs"] > *, main[data-page="cricket"] > *, main[data-page="vault"] > *, main[data-page="bins"] > *, main[data-page="money"] > * { break-inside: avoid; }
  main > .chips, main > .stat-grid, main > .fin-month, main > .fin-filters, main > .pr-next, main > .card:has(> .cal), main[data-view="budgets"] > .card { margin-bottom: 18px; }
  .budgets { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px 32px; }
  main > .card:has(> .cal) { padding: 18px; }
  main > .vault-lock, main > .fin-setup { max-width: 460px; margin-left: auto; margin-right: auto; }
  main > .fin-actions, main > .vault-add3, main > .btn-row { max-width: 460px; margin-left: auto; margin-right: auto; }
  main > .fin-actions { grid-template-columns: 1fr 1fr; max-width: 620px; }
  main > .stat-grid { gap: 16px; }
  .stat b { font-size: 28px; }

  /* meals: the week as a calendar strip */
  main[data-page="meals"] > .card { display: grid; grid-template-columns: repeat(4, 1fr); }
  main[data-page="meals"] .day { flex-direction: column; gap: 10px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 150px; padding: 14px; }
  main[data-page="meals"] .tag { white-space: nowrap; }
  main[data-page="meals"] .day.today { background: var(--brand-soft); }
  main[data-page="meals"] .day-date { width: auto; display: flex; align-items: baseline; gap: 8px; text-align: left; }
  main[data-page="meals"] .day-main { align-self: stretch; }
  .weeknav { max-width: 460px; margin-left: auto; margin-right: auto; }

  /* chat */
  .msg { max-width: 70%; }
  .msg .bubble { font-size: 17px; }

  /* kids: photo wall */
  .kid-grid { gap: 16px; max-width: 760px; }
  main[data-page="kids"] .group { columns: 280px; column-gap: 16px; }
  main[data-page="kids"] .group-h { column-span: all; }
  main[data-page="kids"] .mem { break-inside: avoid; margin-bottom: 16px; }

  /* money */
  .fin-month { max-width: 460px; margin-left: auto; margin-right: auto; }
  .fin-filters { max-width: 620px; margin-left: auto; margin-right: auto; }
  .cal { gap: 6px; }
  .cal-c { min-height: 76px; font-size: 13px; padding: 6px 4px; border-radius: 10px; }
  .cal-n { font-size: 15px; }
  .cal-h { font-size: 13px; }

  /* Pokédex */
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
  .dex-card { min-height: 172px; padding: 12px 6px 14px; }
  .dex-card img { width: 108px; height: 108px; }
  .dex-nm { font-size: 16px; }
  .dex-no { font-size: 12px; }
  .dex-cols { display: grid; grid-template-columns: minmax(300px, 5fr) 6fr; gap: 28px; align-items: start; }
  .dex-left { position: sticky; top: calc(env(safe-area-inset-top) + 104px); }
  .dex-name { font-size: 40px; }
  .dex-genus { font-size: 18px; }
  .dex-type { font-size: 16px; padding: 6px 16px; }
  .dex-text { font-size: 20px; }
  .dex-right > .fin-sec:first-child, .dex-right > .card:first-child { margin-top: 0; }
  .dex-evo { width: 108px; }
  .dex-evo img { width: 84px; height: 84px; }
  .dex-evo span { font-size: 14px; }
  .dex-arrow { width: 46px; height: 64px; }
}
@media (min-width: 1024px) and (min-height: 500px) {
  :root { --side: 216px; }
  .tabbar { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: 12px; gap: 2px; }
  .tabbar::before { content: "Jackson Home"; flex: none; display: block; font-weight: 800; font-size: 19px; letter-spacing: -.01em; color: var(--ink); padding: 6px 12px 16px; }
  .tabbar button { display: flex; align-items: center; justify-content: flex-start; gap: 14px; height: 50px; padding: 0 12px !important; font-size: 16px; font-weight: 600; }
  .tabbar button span { flex: 1; text-align: left; }
  .tabbar .badge { position: static; flex: none; min-width: 22px; height: 22px; line-height: 22px; font-size: 12px; border-radius: 11px; padding: 0 6px; }
  main[data-page="meals"] > .card { grid-template-columns: repeat(7, 1fr); }
  main[data-page="meals"] .day { min-height: 190px; }
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .dex-card img { width: 120px; height: 120px; }
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -47%); } }

/* ---------- Pokédex hunt cards (print) ---------- */
.dex-tools .chip svg { width: 16px; height: 16px; }
.dex-bar-r { display: flex; gap: 6px; align-items: center; }
.dex-bar .chip svg { width: 16px; height: 16px; }
.field[data-for][hidden] { display: none; }
#dex-print { position: fixed; inset: 0; z-index: 90; overflow: auto; background: #5d6662; padding-bottom: 40px; -webkit-overflow-scrolling: touch; }
.dp-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dp-bar .btn { width: auto; padding: 10px 22px; }
.dp-tip { color: #fff; text-align: center; font-size: 14px; margin: 12px 16px 0; }
.dp-pages { display: grid; justify-content: center; gap: 16px; padding: 14px 12px; }
.dp-page { width: 210mm; height: 297mm; zoom: var(--s, 1); background: #fff; color: #111; display: grid; padding: 8mm; box-shadow: 0 4px 24px rgba(0, 0, 0, .35); }
.per-9 .dp-page { grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.per-4 .dp-page { grid-template: repeat(2, 1fr) / repeat(2, 1fr); }
.dp-card { border: .3mm dashed #8a8a8a; display: grid; grid-template-rows: auto 1fr auto auto; justify-items: center; align-items: center; gap: 1.5mm; padding: 3mm 3mm 2.5mm; overflow: hidden; text-align: center; min-width: 0; min-height: 0;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.dp-name { width: 100%; font-weight: 800; font-size: 5.2mm; line-height: 1.1; padding-bottom: 1.4mm; border-bottom: 1.4mm solid var(--t); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-pic { width: 100%; height: 44mm; display: grid; place-items: center; min-height: 0; }
.dp-pic img { max-width: 100%; max-height: 44mm; object-fit: contain; display: block; }
.dp-pic img.px { image-rendering: pixelated; height: 36mm; }
.dp-qr { width: 25mm; height: 25mm; }
.dp-qr svg { display: block; width: 100%; height: 100%; }
.dp-no { font-size: 2.7mm; color: #333; font-weight: 600; }
.per-4 .dp-name { font-size: 8.5mm; padding-bottom: 2mm; border-bottom-width: 2mm; }
.per-4 .dp-pic { height: 74mm; }
.per-4 .dp-pic img { max-height: 74mm; }
.per-4 .dp-qr { width: 37mm; height: 37mm; }
.per-4 .dp-no { font-size: 3.6mm; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body.dex-printing > *:not(#dex-print) { display: none !important; }
  body.dex-printing .no-print { display: none !important; }
  #dex-print { position: static; overflow: visible; background: none; padding: 0; }
  .dp-pages { display: block; padding: 0; }
  .dp-page { zoom: 1; box-shadow: none; break-after: page; page-break-after: always; break-inside: avoid; }
  .dp-page:last-child { break-after: auto; page-break-after: auto; }
}

/* ---------- Pokédex cut-outs to scale ---------- */
.field[data-for2][hidden] { display: none; }
.dp-page.ct { display: block; position: relative; padding: 0; }
.ct-area { position: absolute; left: 8mm; top: 8mm; width: 194mm; height: 281mm; overflow: hidden; }
.ct-area.join-b { border-bottom: .25mm solid #b5b5b5; }
.ct-area.join-r { border-right: .25mm solid #b5b5b5; }
.ct-note { position: absolute; left: 8mm; right: 8mm; bottom: 2.2mm; font-size: 2.6mm; color: #555; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-fig { position: absolute; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ct-out { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ct-img { position: absolute; max-width: none; }
.ct-qr { position: absolute; width: 22mm; height: 22mm; background: #fff; }
.ct-label { position: absolute; left: 50%; width: 28mm; margin-left: -14mm; text-align: center; font-size: 2.5mm; line-height: 1.2; color: #222; }
.ct-label b { display: block; font-size: 2.9mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Pokédex: hidden until found ---------- */
.dex-card.locked { background: var(--surface-2); box-shadow: none; }
.dex-card.locked img, .dex-evo.locked img { filter: brightness(0); opacity: .17; }
.dex-card.locked .dex-nm, .dex-evo.locked span { color: var(--muted); letter-spacing: .1em; }
.dex-card.locked:active { transform: none; }
@media (prefers-color-scheme: dark) { .dex-card.locked img, .dex-evo.locked img { filter: brightness(0) invert(1); opacity: .2; } }

/* tiles of a taped-together cut-out must never widen the page (that makes the printer shrink everything) */
.ct-area { contain: strict; overflow: clip; }
.dp-page.ct { overflow: hidden; contain: layout paint; }
/* ---------- print sheet: name suggestions ---------- */
.pick-sugg { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.pick-sugg::-webkit-scrollbar { display: none; }
.pick-sugg[hidden] { display: none; }
.pick-sugg .chip { padding: 3px 12px 3px 4px; gap: 4px; }
.pick-sugg .chip img { width: 28px; height: 28px; image-rendering: pixelated; }
.pick-sum { font-size: 13px; color: var(--muted); margin-top: 6px; min-height: 1.3em; }
.pick-sum b { color: var(--ink); }
.pick-sum .bad { color: var(--warn); }

/* ---------- Pokédex: big round scan button ---------- */
.dex-fab { position: fixed; z-index: 26; right: 14px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 84px); display: grid; justify-items: center; gap: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); }
.dex-detail ~ .dex-fab, .dex-detail .dex-fab { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 18px); }
.dex-fab-ball { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .28), 0 0 0 4px color-mix(in srgb, var(--surface) 70%, transparent); overflow: hidden; }
.dex-fab-ball img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dex-fab-ball img.px { image-rendering: pixelated; width: 168%; height: 168%; max-width: none; }
.dex-fab-ball img + svg { display: none; }
.dex-fab-ball svg { width: 44px; height: 44px; color: var(--brand); }
.dex-fab b { margin-top: -12px; padding: 3px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.dex-fab:active .dex-fab-ball { transform: scale(.94); }
.dex-unfind { margin-top: 18px; }
@media (min-width: 700px) and (min-height: 500px) {
  .dex-fab { right: 28px; bottom: calc(env(safe-area-inset-bottom) + 100px); }
  .dex-detail ~ .dex-fab, .dex-detail .dex-fab { bottom: calc(env(safe-area-inset-bottom) + 28px); }
  .dex-fab-ball { width: 120px; height: 120px; }
  .dex-fab b { font-size: 16px; padding: 4px 18px; }
}
@media print { .dex-fab { display: none !important; } }

/* Pokédex voice choice */
#dx-voice-f[hidden] { display: none !important; }
#dx-using { font-weight: 600; color: var(--ink); }
.tab-ball { display: grid; place-items: center; width: 26px; height: 26px; font-style: normal; }
.tab-ball img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tab-ball img.px { image-rendering: pixelated; width: 170%; height: 170%; max-width: none; }
.tab-ball img + svg { display: none; }
.tabbar button .tab-ball svg { width: 24px; height: 24px; }
@media (min-width: 700px) and (min-height: 500px) { .tab-ball { width: 28px; height: 28px; flex: none; } }

/* Kid profile: Pokédex only, no menu */
html.kid { --tabbar: 0px; --side: 0px; }
html.kid .tabbar, html.kid #bell { display: none !important; }
.who .kidp { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 17px; }
.who .kidp img { width: 30px; height: 30px; flex: none; }

/* Forgot your PIN / reset email */
.login .err.ok { color: var(--ok); }
.forgot { display: block; width: 100%; margin: 12px 0 0; padding: 8px; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700; font-size: 15px; }
.forgot:disabled { opacity: .5; }
.field > .acc-row { display: flex; gap: 8px; align-items: stretch; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; }
.field > .acc-row input { flex: 1; min-width: 0; width: auto; }
.field > .acc-row .btn { flex: none; width: auto; padding: 0 18px; }
.sheet .field .pin { letter-spacing: .3em; font-size: 20px; }

/* Print sheet: generation picker */
.gen-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gen-chips .chip { padding: 8px 12px; }
.gen-chips .chip[aria-pressed="true"] .n { opacity: .8; }

/* Print-from-Safari sheet */
.sheet .foot a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
body.dex-printing #sheet-root .scrim { z-index: 95; }
body.dex-printing #sheet-root .sheet { z-index: 96; }

.dp-alt { margin-top: 4px; opacity: .9; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: inherit; font-weight: 700; text-decoration: underline; }

/* ---------- receipts ---------- */
.rc-drop { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; padding: 16px; margin-top: 10px; border: 2px dashed var(--line); box-shadow: none; }
.rc-drop-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.rc-drop-ico svg { width: 24px; height: 24px; }
.rc-drop-t b { display: block; font-size: 16px; }
.rc-drop-t span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.rc-drop-btns { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.rc-drop-btns .btn:only-child { grid-column: 1 / -1; }
body.rc-dragging .rc-drop { border-color: var(--brand); background: var(--brand-soft); }
body.rc-dragging::after { content: "Drop to add receipts"; position: fixed; inset: 12px; z-index: 90; display: grid; place-items: center; border: 3px dashed var(--brand); border-radius: 22px; background: color-mix(in srgb, var(--bg) 86%, transparent); color: var(--brand); font-size: 22px; font-weight: 800; pointer-events: none; }
.rc-job { margin-top: 10px; }
.rc-job.err .row-meta { color: var(--warn); }
.rc-job .link { border: 0; background: none; color: var(--brand); font-weight: 700; padding: 6px; }
.spin { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: rcspin .8s linear infinite; }
@keyframes rcspin { to { transform: rotate(360deg); } }
.rc-chips { margin-top: 8px; }
.rc-chips .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rc-thumb { flex: none; width: 44px; height: 56px; border-radius: 8px; object-fit: cover; object-position: top; background: var(--surface-2); border: 1px solid var(--line); }
.rc-thumb-none { display: grid; place-items: center; color: var(--muted); }
.rc-thumb-none svg { width: 22px; height: 22px; }
.tag.rc-ok { background: var(--brand-soft); color: var(--ok); }
.tag.rc-sug { background: var(--warn-soft); color: var(--warn); }
.rc-mark { display: inline-flex; align-items: center; gap: 3px; color: var(--brand); font-weight: 600; }
.rc-mark svg { width: 13px; height: 13px; }
.btn.rc-link-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.btn.rc-link-btn svg { width: 18px; height: 18px; }
.rc-prev { position: relative; display: grid; place-items: center; min-height: 120px; max-height: 46vh; overflow: hidden; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.rc-prev img { display: block; max-width: 100%; max-height: 46vh; object-fit: contain; cursor: zoom-in; }
.rc-prev.zoom { max-height: 70vh; overflow: auto; place-items: start; }
.rc-prev.zoom img { max-width: none; max-height: none; width: 180%; cursor: zoom-out; }
.rc-prev-msg { position: absolute; left: 8px; bottom: 8px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); padding: 2px 8px; border-radius: 6px; }
.rc-prev-msg:empty { display: none; }
.rc-file-btns { margin-bottom: 14px; }
.rc-file-btns .btn { padding: 10px; }
.rc-items { margin: -4px 0 14px; font-size: 14px; }
.rc-items summary { cursor: pointer; color: var(--brand); font-weight: 700; padding: 4px 0; }
.rc-items div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.rc-items b { font-variant-numeric: tabular-nums; }
.rc-match { display: grid; gap: 6px; }
.rc-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.rc-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.rc-opt input { flex: none; accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
.rc-opt-b { flex: 1; min-width: 0; }
.rc-opt-b b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-opt-b em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.rc-none { font-size: 14px; color: var(--muted); padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.rc-match .link { justify-self: start; border: 0; background: none; color: var(--brand); font-weight: 700; padding: 4px 0; font-size: 14px; }
.rc-alert { border-left-color: var(--brand); }
.rc-prev canvas.rc-pdf-page { display: block; width: 100%; height: auto; align-self: start; }
.rc-prev.pdf { place-items: start center; overflow: auto; }
