:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #12161C;
  --ink-2: #3D4450;
  --muted: #5A6270;
  --line: #E2E5EA;
  --line-2: #EEF0F3;
  --field: #D5DAE1;
  --dad: #1F4E8C;
  --dad-tint: #E6EEF8;
  --dad-light: #8FB2E6;
  --mom: #A9481A;
  --mom-2: #C2612F;
  --mom-tint: #FBEDE4;
  --mom-light: #E8A47A;
  --ok: #2F6B45;
  --ok-tint: #E7F3EB;
  --warn: #5C4600;
  --warn-tint: #FFF7E0;
  --danger: #A12B2B;
  --danger-ink: #8E2222;
  --danger-tint: #FBE9E9;
  --danger-line: #E9C4C4;
  --radius: 16px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--dad); }
a:hover { color: #163A6A; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { min-height: 100vh; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.brand:hover { color: var(--ink); }
.logo { position: relative; width: 34px; height: 22px; flex: none; }
.logo::before, .logo::after { content: ""; position: absolute; top: 0; width: 22px; height: 22px; border-radius: 50%; }
.logo::before { left: 0; background: var(--dad); }
.logo::after { left: 12px; background: var(--mom-2); mix-blend-mode: multiply; }
.topbar .family { color: var(--muted); font-size: 14px; }
.spacer { flex: 1; }
.icon-btn { flex: none; cursor: pointer; padding: 0; position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn .pip { position: absolute; top: 8px; right: 9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--mom-2); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: none; color: #fff; text-decoration: none; }
.avatar.dad { background: var(--dad); }
.avatar.mom { background: var(--mom-2); }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.soft.dad { background: var(--dad-tint); color: var(--dad); }
.avatar.soft.mom { background: var(--mom-tint); color: var(--mom); }

.layout { max-width: 1280px; margin: 0 auto; padding: 20px 16px 110px; display: flex; gap: 24px; align-items: flex-start; }
.side { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.side a { height: 44px; border-radius: 10px; color: var(--ink-2); font-size: 14px; padding: 0 12px; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.side a:hover { background: #ECEEF2; color: var(--ink); }
.side a.on { background: var(--surface); color: var(--ink); font-weight: 600; }
.side .cta { background: var(--ink); color: #fff; font-weight: 600; margin-bottom: 10px; justify-content: center; }
.side .cta:hover { background: #2A303A; color: #fff; }

.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; height: 76px; padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; z-index: 20; }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 0; }
.bottomnav a.on { color: var(--ink); font-weight: 600; }
.bottomnav .fab { margin-top: -30px; color: var(--ink); font-weight: 600; }
.bottomnav .fab span { width: 60px; height: 60px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; border: 4px solid var(--bg); }

@media (min-width: 900px) {
  .layout { padding: 24px 24px 48px; }
  .side { display: flex; flex-direction: column; gap: 4px; flex: 0 0 220px; position: sticky; top: 16px; }
  .bottomnav { display: none; }
  h1 { font-size: 28px; }
}
@media (max-width: 899px) {
  .topbar .family, .topbar .desk { display: none; }
}

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.card.pad-l { padding: 20px; }
.card.flush { padding: 4px 16px; }
.card.dark { background: var(--ink); color: #fff; }
.card.dark .muted { color: #B8C0CC; }
.card.dark a.btn { background: #fff; color: var(--ink); }
.card.tint-mom { background: var(--mom-tint); }
.card.tint-dad { background: var(--dad-tint); }
.card.warn { background: var(--warn-tint); color: var(--warn); }
.card.danger { border: 1px solid var(--danger-line); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.row.end { align-items: flex-end; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .grid.tiles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.big { font-family: var(--font-display); font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.mid { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.dad { background: var(--dad); }
.dot.mom { background: var(--mom-2); }
.label-dot { display: inline-flex; align-items: center; gap: 6px; }
.c-dad { color: var(--dad); }
.c-mom { color: var(--mom); }
.c-danger { color: var(--danger-ink); }
.c-ok { color: var(--ok); }
.divider { border-top: 1px solid var(--line-2); padding-top: 12px; }

.bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; background: transparent; }
.bar span { display: block; height: 100%; }
.bar .dad { background: var(--dad-light); }
.bar .mom { background: var(--mom-light); }
.bar.light .dad { background: var(--dad); }
.bar.light .mom { background: var(--mom-2); }
.bar.thick { height: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--ink); background: #F7F8FA; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2A303A; color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { border-color: var(--danger); color: var(--danger); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.pill { border-radius: 999px; }
.btn[disabled] { background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn.dashed { border-style: dashed; border-color: #9AA1AC; }
.icon-sq { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; padding: 0; }
.icon-sq.danger { color: var(--danger); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { display: contents; }

.badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.danger { background: var(--danger-tint); color: var(--danger-ink); }
.badge.info { background: var(--dad-tint); color: var(--dad); }
.badge.mom { background: var(--mom-tint); color: var(--mom); }
.badge.grey { background: #EEF0F3; color: var(--ink-2); }

.alert { border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.alert.success { background: var(--ok-tint); color: var(--ok); }
.alert.info { background: var(--dad-tint); color: #163A6A; }
.alert.warning { background: var(--warn-tint); color: var(--warn); }
.alert.error { background: var(--danger-tint); color: var(--danger-ink); }
.messages { display: flex; flex-direction: column; gap: 8px; }

.list { background: var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.item:first-child { border-top: 0; }
a.item:hover { background: #FAFBFC; color: var(--ink); }
.item .title { font-size: 14px; font-weight: 600; }
.item .meta { font-size: 12px; color: var(--muted); }
.item .amt { font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; }
.thumb { width: 44px; height: 56px; flex: none; border-radius: 6px; background: #FBFAF6; border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.kv > div:first-child { border-top: 0; }
.kv dt, .kv .k { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 50px; border: 1px solid var(--field); border-radius: 12px; padding: 0 14px; font: inherit; font-size: 16px; background: var(--surface); color: var(--ink);
}
textarea { padding: 12px 14px; line-height: 1.45; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ink); }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger-ink); font-size: 13px; }
.help { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 36px; }
.inline-fields { display: flex; gap: 8px; align-items: center; }
.inline-fields input[type=number] { width: 90px; text-align: center; }

.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: #E6E9EE; border-radius: 12px; padding: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { height: 42px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--ink); }
.seg a { height: 42px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; }
.chips span, a.chip { min-height: 40px; border-radius: 999px; border: 1px solid var(--field); background: var(--surface); padding: 0 16px; display: inline-flex; align-items: center; font-size: 14px; cursor: pointer; color: var(--ink); text-decoration: none; }
.chips input:checked + span, a.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.chips input:focus-visible + span { outline: 2px solid var(--dad); }

.tabs2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tabs2 a { min-height: 60px; border-radius: 14px; border: 1px solid var(--field); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink); padding: 6px; }
.tabs2 a .t { font-size: 14px; font-weight: 600; }
.tabs2 a .s { font-size: 12px; color: var(--muted); }
.tabs2 a.on.dad { border: 2px solid var(--dad); background: var(--dad-tint); }
.tabs2 a.on.dad .t { color: var(--dad); }
.tabs2 a.on.mom { border: 2px solid var(--mom); background: var(--mom-tint); }
.tabs2 a.on.mom .t { color: #8A3A12; }

.capture { display: flex; flex-direction: column; gap: 12px; }
.capture .bigbtn { min-height: 120px; border-radius: 20px; background: var(--ink); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 600; cursor: pointer; }
.capture input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone { border: 2px dashed #B9C0CB; border-radius: 18px; background: var(--surface); padding: 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dropzone.over { border-color: var(--ink); background: #F0F2F5; }
.busy { display: none; align-items: center; gap: 10px; }
.is-busy .busy { display: flex; }
.is-busy .capture, .is-busy .dropzone { opacity: 0.5; pointer-events: none; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.receipt-view { background: #2A2F36; border-radius: 18px; padding: 14px; display: flex; align-items: center; justify-content: center; min-height: 200px; }
.receipt-view img { max-height: 560px; border-radius: 6px; background: #fff; }
.receipt-view a { color: #fff; }

.quote { font-size: 13px; line-height: 1.45; background: var(--bg); border-radius: 10px; padding: 8px 10px; color: var(--ink-2); white-space: pre-line; }
.thread { display: flex; flex-direction: column; gap: 8px; }
.msg { border-radius: 12px; padding: 8px 12px; font-size: 14px; background: var(--bg); }
.msg .by { font-size: 12px; color: var(--muted); }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tbl th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { text-align: right; padding: 12px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td.l, .tbl th.l { text-align: left; }
.tbl tr:last-child td { border-bottom: 0; }

.mrow { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line-2); font-size: 13px; align-items: center; text-decoration: none; color: var(--ink); }
.mrow.head { background: #F0F2F5; font-size: 11px; font-weight: 600; color: var(--muted); border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.mrow > span:not(:first-child) { text-align: right; }
a.mrow:hover { background: #FAFBFC; color: var(--ink); }

.auth { min-height: 100vh; display: flex; justify-content: center; padding: 48px 20px; }
.auth-in { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.auth h1 { font-size: 32px; line-height: 1.1; }

.empty { text-align: center; color: var(--muted); padding: 24px 12px; font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 4px; }
[hidden] { display: none !important; }
@media (max-width: 899px) { .no-mobile { display: none; } }
@media (min-width: 900px) { .capture .bigbtn { display: none; } }

a.card { text-decoration: none; color: inherit; }
a.card:hover { color: inherit; filter: brightness(0.98); }
.grid { align-items: start; }
.blk { display: block; }
.only-mob { display: block; }
.only-desk { display: none; }
.receipt-view img { max-height: 420px; }
@media (min-width: 900px) {
  .only-mob { display: none; }
  .only-desk { display: block; }
  .receipt-view img { max-height: 640px; }
}
.mrow .sub { display: block; font-size: 11px; color: var(--muted); }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.qr-box { align-items: center; text-align: center; }
.qr { width: 246px; height: 246px; image-rendering: pixelated; }
.secret, .codes code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 15px; letter-spacing: 0.04em; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: center; }
.codes code { background: var(--bg); border-radius: 8px; padding: 8px 4px; }

.print-only { display: none; }
@media print {
  .topbar, .side, .bottomnav, .no-print, .messages { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; }
  .layout { padding: 0; }
  .card { padding: 8px 0; }
  table.tbl { min-width: 0; }
}
