@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/bricolage-grotesque-latin-78692770.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --linen: #eef2f7;
  --surface: #ffffff;
  --ink: #16233b;
  --muted: #5b6b82;
  --line: #d9e0ea;
  --note: #ffe066;
  --note-ink: #5c4a00;
  --good: #1e9e63;
  --bad: #d2423b;
  --c: var(--ink);
  --display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--linen); color: var(--ink); font: 16px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, .display { font-family: var(--display); font-optical-sizing: auto; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; line-height: 1.1; font-weight: 750; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 1.75rem 0 .6rem; }

.page { max-width: 880px; margin: 0 auto; padding: 1.25rem 1rem calc(var(--tabbar-h) + 2rem + env(safe-area-inset-bottom)); }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.inline { display: inline; }

/* ---------- Header + navigation ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.25rem; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); background: var(--ink); color: #fff; }
.brand { font: 800 1.25rem/1 var(--display); text-decoration: none; letter-spacing: -0.02em; }
.topnav { display: flex; gap: .15rem; flex: 1; }
.topnav a { text-decoration: none; padding: .4rem .75rem; border-radius: 8px; color: #c9d3e3; font-weight: 600; }
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topnav a[aria-current="page"] { color: var(--ink); background: #fff; }
.me-chip { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; font-weight: 600; margin-left: auto; }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--c); color: #fff; font: 700 .95rem/1 var(--display); flex: none; }

.tabbar { display: none; }

@media (max-width: 759px) {
  .topnav { display: none; }
  .topbar { padding: .55rem 1rem; padding-top: max(.55rem, env(safe-area-inset-top)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; text-decoration: none; font-size: .72rem; font-weight: 600; color: var(--muted); }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
}

.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; border-radius: 999px; background: var(--note); color: var(--note-ink); font: 800 .72rem/1 var(--body); margin-left: .3rem; }

/* ---------- Flash ---------- */
.flash { margin: 0 0 1rem; padding: .7rem 1rem; border-radius: 10px; background: #dff3e8; color: #0f5132; font-weight: 600; }
.flash-alert { background: #fbe3e1; color: #7a1f1a; }
.errors { color: var(--bad); font-weight: 600; margin-bottom: .5rem; }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: .5rem 1.15rem; border: 2px solid var(--ink); border-radius: 12px; background: var(--ink); color: #fff; font: 700 1rem/1.1 var(--body); text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(1.15); }
.button.secondary { background: transparent; color: var(--ink); }
.button.good { background: var(--good); border-color: var(--good); }
.button.danger { background: transparent; color: var(--bad); border-color: currentColor; }
.button.small { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; border-radius: 10px; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

/* ---------- Page header ---------- */
.heading-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.heading-row h1 { margin: 0; }

/* ---------- Forms ---------- */
.card { background: var(--surface); border-radius: 16px; padding: 1.25rem; }
.narrow { max-width: 460px; }
.form { display: grid; gap: .35rem; }
.form label { font-weight: 650; margin-top: .6rem; }
.form input:not([type=submit]):not([type=checkbox]):not([type=radio]):not([type=color]):not([type=hidden]),
.form select, .form textarea { font: inherit; padding: .65rem .75rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; width: 100%; color: var(--ink); }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--ink); outline: none; }
.form input[type=color] { width: 4rem; height: 2.6rem; border: 2px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }
.form .button { margin-top: 1rem; justify-self: start; }
.form .check { display: inline-flex; gap: .45rem; align-items: center; font-weight: 500; margin: 0; }
.form fieldset { border: 0; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.form legend { font-weight: 650; margin-bottom: .35rem; padding: 0; }
.form .hint { font-size: .9rem; color: var(--muted); margin: 0; }
.form .form { gap: .35rem; }

/* ---------- Lists ---------- */
.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: 16px; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; min-height: 56px; flex-wrap: wrap; text-decoration: none; }
.row form { display: inline; }
.row .title { font-weight: 650; }
.row .sub { display: block; font-size: .88rem; color: var(--muted); font-weight: 400; }
.stack { display: flex; flex-direction: column; min-width: 0; flex: 1; }
a.row:hover { background: #f7f9fc; }
.amount { font: 700 1.05rem/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount.plus { color: var(--good); }
.amount.minus { color: var(--bad); }
.dot { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; background: var(--c); flex: none; }
.swatch { width: .35rem; align-self: stretch; border-radius: 4px; background: var(--c); flex: none; }
.empty { background: var(--surface); border-radius: 16px; padding: 1.25rem; color: var(--muted); }
.empty a { color: var(--ink); font-weight: 650; }

.pill { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 6px; background: var(--linen); white-space: nowrap; }
.pill.waiting { background: var(--note); color: var(--note-ink); }
.pill.paid { background: #dff3e8; color: #0f5132; }
.pill.missed, .pill.rejected { background: #fbe3e1; color: #7a1f1a; }

/* ---------- Picker + PIN ---------- */
.picker { text-align: center; padding-top: 1.5rem; }
.picker h1 { font-size: 2.4rem; }
.people { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 1.5rem; margin: 1.5rem 0 2rem; }
.person { display: grid; justify-items: center; gap: .5rem; text-decoration: none; font: 700 1.05rem var(--display); }
.person .avatar { width: 96px; height: 96px; font-size: 2.6rem; box-shadow: 0 0 0 4px var(--linen), 0 0 0 4px var(--linen); transition: box-shadow .15s; }
.person.selected .avatar { box-shadow: 0 0 0 4px var(--linen), 0 0 0 8px var(--c); }
.person.parent-link .avatar { background: var(--surface); color: var(--ink); border: 2px dashed #b8c3d3; }
.person.parent-link .icon { width: 40px; height: 40px; }
.trust-note { max-width: 420px; margin: 1rem auto; }

.pin-form { max-width: 300px; margin: 0 auto; display: grid; gap: 1rem; justify-items: center; }
.pin-form .prompt { font: 700 1.2rem var(--display); }
.pin-dots { display: flex; gap: .9rem; height: 1.2rem; }
.pin-dots span { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--c); }
.pin-dots span.on { background: var(--c); }
.pin-input { font: 700 2rem var(--display) !important; letter-spacing: .5em; text-align: center; width: 9rem; padding: .4rem; border: 2px solid var(--line); border-radius: 12px; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: .7rem; }
.keypad button, .keypad input[type=submit] { height: 76px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); font: 700 1.7rem var(--display); cursor: pointer; }
.keypad button:active { background: var(--line); }
.keypad input.go { background: var(--c); color: #fff; font-size: 1.15rem; }
.keypad .back { background: transparent; font-size: 1.3rem; }
.pin-form.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- Kid home ---------- */
.hero { position: relative; overflow: hidden; display: block; padding: 1.25rem 1.25rem 1.4rem; border-radius: 22px; background: var(--c); color: #fff; text-decoration: none; }
.hero .greeting { font: 650 1.05rem var(--display); opacity: .92; }
.hero .balance { display: block; font: 800 clamp(3rem, 15vw, 4.6rem)/1 var(--display); letter-spacing: -0.03em; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.hero .caption { display: block; margin-top: .4rem; font-size: .92rem; opacity: .9; }
.hero::after { content: attr(data-initial); position: absolute; right: -.08em; bottom: -.32em; font: 800 11rem/1 var(--display); opacity: .14; pointer-events: none; }

.chores { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.chore { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem .8rem .8rem; background: var(--surface); border-radius: 16px; min-height: 72px; }
.chore .name { font: 650 1.12rem/1.25 var(--display); }
.chore .note { display: block; margin-top: .25rem; }
.tick { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--c); background: #fff; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0; }
.tick:hover { background: color-mix(in srgb, var(--c) 12%, #fff); }
.chore:not(.status-open) .tick { background: var(--c); animation: pop .35s ease-out; cursor: default; }
.chore.status-approved .name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ---------- Parent home ---------- */
.callout { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.1rem; border-radius: 16px; background: var(--note); color: var(--note-ink); text-decoration: none; font: 700 1.05rem var(--display); margin-bottom: 1rem; }
.kids-today { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: .6rem; }
.kid-card { display: flex; gap: .75rem; align-items: center; padding: 1rem; background: var(--surface); border-radius: 16px; text-decoration: none; border-left: 6px solid var(--c); }
.progress { height: 6px; border-radius: 3px; background: var(--linen); margin-top: .45rem; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--c); }

/* ---------- Approvals ---------- */
.approval { display: grid; grid-template-columns: auto 1fr auto; gap: .35rem .8rem; align-items: center; padding: 1rem; }
.approval .actions { grid-column: 1 / -1; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.approval details { flex: 1; min-width: 200px; }
.approval summary { cursor: pointer; display: inline-flex; list-style: none; }
.approval summary::-webkit-details-marker { display: none; }
.approval .sendback { display: flex; gap: .5rem; margin-top: .5rem; }
.approval .sendback input[type=text] { flex: 1; font: inherit; padding: .5rem .7rem; border: 2px solid var(--line); border-radius: 10px; min-width: 0; }

/* ---------- Calendar ---------- */
.cal-nav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.segmented { display: inline-flex; background: var(--surface); border-radius: 10px; padding: 3px; margin-left: auto; }
.segmented a { padding: .35rem .85rem; border-radius: 8px; text-decoration: none; font-weight: 650; font-size: .92rem; color: var(--muted); }
.segmented a[aria-current="page"] { background: var(--ink); color: #fff; }

.agenda { background: var(--surface); border-radius: 16px; overflow: hidden; }
.agenda .day { display: grid; grid-template-columns: 4.2rem 1fr; gap: .75rem; padding: .75rem 1rem; }
.agenda .day + .day { border-top: 1px solid var(--line); }
.agenda .date { text-align: center; line-height: 1.05; }
.agenda .date .dow { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); }
.agenda .date .num { display: block; font: 750 1.6rem/1.1 var(--display); }
.agenda .day.today .date { background: var(--note); color: var(--note-ink); border-radius: 12px; padding: .3rem 0; align-self: start; }
.agenda .day.today .date .dow { color: var(--note-ink); }
.agenda .day.quiet { padding-top: .5rem; padding-bottom: .5rem; }
.agenda .day.quiet .num { font-size: 1.15rem; }
.agenda .events { display: grid; gap: .35rem; align-content: center; }
.event { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 10px; background: color-mix(in srgb, var(--c) 10%, #fff); text-decoration: none; border-left: 4px solid var(--c); }
.event:hover { background: color-mix(in srgb, var(--c) 18%, #fff); }
.event .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; min-width: 4.4em; }
.event .what { font-weight: 650; }
.event .who { margin-left: auto; display: inline-flex; gap: 3px; }
.event .who .dot { width: .6rem; height: .6rem; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: 16px; overflow: hidden; }
.month .dow { background: var(--surface); font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; padding: .4rem 0; }
.month .cell { min-height: 96px; background: var(--surface); padding: .3rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.month .cell.other { background: #f7f9fc; }
.month .cell.other .num { color: #a5b0c0; }
.month .num { font: 700 .9rem var(--display); text-decoration: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; }
.month .cell.today .num { background: var(--note); color: var(--note-ink); }
.month .chip { display: block; font-size: .74rem; line-height: 1.3; padding: 1px 5px; border-radius: 5px; background: color-mix(in srgb, var(--c) 14%, #fff); border-left: 3px solid var(--c); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .month .cell { min-height: 64px; padding: 2px; }
  .month .chip { font-size: 0; height: 6px; padding: 0; border-left-width: 0; background: var(--c); }
}

.event-card .when { font: 700 1.15rem var(--display); margin: 0; }
.who-list { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.who-list .pill { background: color-mix(in srgb, var(--c) 14%, #fff); }

/* ---------- Lists ---------- */
.quick-add { margin-bottom: 1.25rem; }
.quick-add-row { display: flex; gap: .5rem; }
.quick-add input[type=text] { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: .75rem .9rem; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.quick-add input[type=text]:focus { border-color: var(--ink); outline: none; }
.note-toggle { margin-top: .4rem; }
.note-toggle summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.note-toggle input[type=text] { width: 100%; margin-top: .4rem; }
.items .item { display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem .55rem .9rem; min-height: 56px; }
.items .text { font-weight: 600; overflow-wrap: anywhere; }
.items .sub { overflow-wrap: anywhere; }
.items .sub a { color: var(--ink); }
.tick-box { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--ink); background: #fff; cursor: pointer; padding: 0; display: grid; place-items: center; }
.item.checked .tick-box { background: var(--ink); }
.item.checked .tick-box::after { content: "✓"; color: #fff; font-weight: 800; }
.item.checked .text { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.remove { flex: none; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; border-radius: 10px; }
.remove:hover { background: var(--linen); color: var(--bad); }
.items form { display: contents; }
.ticked-heading { margin: 1.5rem 0 .6rem; }
.ticked-heading h2 { margin: 0; }

/* ---------- More menu ---------- */
.menu a.row { font-weight: 650; }
.menu .chev { margin-left: auto; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
