/* Pairent — palette drawn from the logo */
:root {
  --lagoon: #10c1c7;          /* brand teal (logo figures) */
  --lagoon-deep: #087c82;     /* actions & links, AA on white */
  --lagoon-wash: #e3f6f7;
  --navy: #16204a;            /* wordmark ink */
  --navy-2: #222d5c;
  --gold: #d5ad4a;            /* the child in the logo */
  --gold-deep: #8f6a12;
  --gold-wash: #fbf3dd;
  --coral: #e0705f;
  --coral-wash: #fdebe8;
  --slate: #5e6880;           /* tagline grey */
  --mist: #f1f7f8;            /* page background */
  --surface: #ffffff;
  --line: #dde7ea;
  --ink: #16204a;
  --ink-soft: #5e6880;
  --danger: #b8382a;
  --ok: #1f7a4d;
  --ok-wash: #e2f3ea;

  --p-teal: #10c1c7;
  --p-gold: #d5ad4a;
  --p-navy: #3b4a8c;
  --p-coral: #e0705f;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 74, .06), 0 8px 24px rgba(22, 32, 74, .06);
  --font-display: "Quicksand", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mist: #0e1431; --surface: #172045; --line: #2a3566; --ink: #eef2fb; --ink-soft: #a9b2cc;
    --lagoon-deep: #3fd3d8; --lagoon-wash: #12384a; --gold-wash: #3a3220; --gold-deep: #e6c56f;
    --coral-wash: #43262a; --ok-wash: #173a30; --ok: #6fd3a0; --danger: #ff8a7a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --mist: #0e1431; --surface: #172045; --line: #2a3566; --ink: #eef2fb; --ink-soft: #a9b2cc;
  --lagoon-deep: #3fd3d8; --lagoon-wash: #12384a; --gold-wash: #3a3220; --gold-deep: #e6c56f;
  --coral-wash: #43262a; --ok-wash: #173a30; --ok: #6fd3a0; --danger: #ff8a7a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--mist); color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .75em; }
a { color: var(--lagoon-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lagoon); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 999px; padding: .7rem 1.25rem; min-height: 44px;
  background: var(--lagoon-deep); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s;
}
:root[data-theme="dark"] .btn, .btn { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost):not(.quiet):not(.danger) { color: #0e1431; } }
:root[data-theme="dark"] .btn:not(.ghost):not(.quiet):not(.danger) { color: #0e1431; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--lagoon-deep); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.quiet { background: var(--lagoon-wash); color: var(--lagoon-deep); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: .4rem .9rem; font-size: .9rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--lagoon-deep); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; display: inline-grid; place-items: center; border: 0; background: transparent; cursor: pointer; color: inherit; position: relative; }
.icon-btn:hover { background: var(--lagoon-wash); }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- forms ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .92rem; }
.field .hint { font-size: .82rem; color: var(--ink-soft); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); padding: .6rem .8rem; transition: border-color .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--lagoon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lagoon) 25%, transparent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--lagoon-deep); }
.form-error { background: var(--coral-wash); color: var(--danger); border-radius: var(--radius-sm); padding: .65rem .85rem; margin-bottom: 1rem; font-size: .92rem; }
.segmented { display: flex; background: var(--mist); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: .55rem .8rem; font-weight: 600; cursor: pointer; color: var(--ink-soft); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- auth ---------- */
.auth {
  min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-brand {
  background: var(--surface); display: grid; place-items: center; padding: 3rem;
  position: relative; overflow: hidden;
}
.auth-brand::before {
  content: ""; position: absolute; width: 140%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--lagoon-wash) 0, transparent 60%);
  top: -20%; left: -20%;
}
.auth-brand img { width: min(360px, 70%); position: relative; }
.auth-brand .lede { position: relative; max-width: 30ch; text-align: center; color: #5e6880; margin-top: 1.5rem; }
/* The logo's navy wordmark needs a light ground, so the brand panel stays white in dark mode */
.auth-brand { background: #fff; }
.auth-brand::before { background: radial-gradient(circle at 50% 50%, #e3f6f7 0, transparent 60%) !important; }
.auth-panel { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin-bottom: .4rem; }
.auth-card > p.muted { margin-bottom: 1.5rem; }
.auth-mobile-logo { display: none; width: 120px; margin: 0 auto 1rem; }
img.auth-mobile-logo[src*="logo-full"] { background: #fff; border-radius: 18px; padding: 10px 14px; }
.steps { display: flex; gap: 6px; margin-bottom: 1.5rem; }
.steps span { height: 5px; flex: 1; border-radius: 99px; background: var(--line); }
.steps span.on { background: var(--lagoon); }
.choice { display: grid; gap: .75rem; margin-bottom: 1.25rem; }
.choice button {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 1rem 1.1rem; cursor: pointer; display: grid; gap: .2rem;
}
.choice button[aria-pressed="true"] { border-color: var(--lagoon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lagoon) 20%, transparent); }
.choice strong { font-family: var(--font-display); font-size: 1.05rem; }

/* PIN */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 1.25rem 0 1.5rem; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--lagoon-deep); transition: background .12s, transform .12s; }
.pin-dots span.on { background: var(--lagoon-deep); transform: scale(1.08); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; justify-content: center; }
.keypad button {
  width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  font: 600 1.6rem var(--font-display); cursor: pointer; color: var(--ink);
}
.keypad button:active { background: var(--lagoon-wash); }
.keypad button.k-alt { background: transparent; box-shadow: none; font-size: .95rem; font-family: var(--font-body); color: var(--lagoon-deep); }
.keypad svg.i { width: 30px; height: 30px; }
.who { display: flex; align-items: center; gap: .9rem; justify-content: center; margin-bottom: .25rem; }
.lock-center { text-align: center; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  background: var(--navy); color: #dfe5f6; padding: 1.25rem .9rem; position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .75rem; color: #fff; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand span { font: 700 1.5rem var(--font-display); letter-spacing: -0.01em; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .8rem; padding: .62rem .75rem; border-radius: 12px;
  color: #c8d0ea; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--lagoon) 18%, var(--navy)); color: #fff; }
.nav a[aria-current="page"] svg { color: var(--lagoon); }
.nav .badge { margin-left: auto; }
.nav-group { font-size: .8rem; color: #8b95ba; padding: .9rem .75rem .25rem; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: .65rem; padding: .75rem .5rem 0; border-top: 1px solid var(--navy-2); }
.sidebar-foot > div { min-width: 0; flex: 1; }
.sidebar-foot .name { font-weight: 600; color: #fff; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .icon-btn { width: 36px; height: 36px; }
.sidebar-foot .icon-btn { color: #c8d0ea; flex: none; }
.sidebar-foot .icon-btn:hover { background: var(--navy-2); }

#view:focus { outline: none; }
.main { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; color: var(--ink-soft); }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.badge { min-width: 22px; height: 22px; border-radius: 99px; background: var(--coral); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; }
.dot-badge { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); border: 2px solid var(--surface); }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 .95rem var(--font-display); color: #fff; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar.teal { background: var(--p-teal); color: #08353a; }
.avatar.gold { background: var(--p-gold); color: #3d2c05; }
.avatar.navy { background: var(--p-navy); }
.avatar.coral { background: var(--p-coral); color: #3d120c; }
.avatar.child { background: var(--gold-wash); color: var(--gold-deep); box-shadow: inset 0 0 0 2px var(--gold); }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 1.35rem; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.grid-2.cal-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-2 > div > .panel + .panel { margin-top: 1.25rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); }
.empty h3 { color: var(--ink); margin-bottom: .35rem; }
.empty .btn { margin-top: .75rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: .9rem; align-items: flex-start; padding: .85rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: .2rem; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { font-size: .86rem; color: var(--ink-soft); }
.list .side { text-align: right; flex: none; }
.list li.unread .title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); margin-right: .45rem; vertical-align: middle; }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--lagoon-wash); color: var(--lagoon-deep); flex: none; }
.tile-icon.gold { background: var(--gold-wash); color: var(--gold-deep); }
.tile-icon.coral { background: var(--coral-wash); color: var(--danger); }
.tile-icon svg.i { width: 20px; height: 20px; }

.chip { display: inline-flex; align-items: center; gap: .3rem; border-radius: 99px; padding: .15rem .6rem; font-size: .8rem; font-weight: 600; background: var(--mist); color: var(--ink-soft); white-space: nowrap; }
.chip.pending { background: var(--gold-wash); color: var(--gold-deep); }
.chip.approved, .chip.settled { background: var(--ok-wash); color: var(--ok); }
.chip.declined, .chip.disputed { background: var(--coral-wash); color: var(--danger); }
.chip.teal { background: var(--lagoon-wash); color: var(--lagoon-deep); }

/* ---------- dashboard ---------- */
.hello { margin-bottom: 1.4rem; }
.hello h1 { font-size: 2rem; }
.hello p { color: var(--ink-soft); margin: .25rem 0 0; }
.ribbon-wrap { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.35rem 1.35rem 1.1rem; margin-bottom: 1.25rem; }
.today-line { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.today-line h2 { font-size: 1.5rem; }
.today-line .with { display: inline-flex; align-items: center; gap: .5rem; }
.ribbon { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.ribbon .day { display: grid; gap: 6px; text-align: center; font-size: .78rem; color: var(--ink-soft); position: relative; }
.ribbon .bar { height: 42px; border-radius: 10px; background: var(--mist); display: grid; place-items: center; font: 700 .85rem var(--font-display); }
.ribbon .day.today .bar { box-shadow: 0 0 0 2.5px var(--navy) inset; }
:root[data-theme="dark"] .ribbon .day.today .bar { box-shadow: 0 0 0 2.5px #fff inset; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ribbon .day.today .bar { box-shadow: 0 0 0 2.5px #fff inset; } }
.ribbon .handover::after { content: ""; position: absolute; left: -4px; top: 22px; width: 4px; height: 24px; }
.ribbon .ev { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin: 0 auto; }
.ribbon .ev.none { background: transparent; }
.legend { display: flex; gap: 1rem; margin-top: .9rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.bg-teal { background: color-mix(in srgb, var(--p-teal) 32%, var(--surface)) !important; color: #075459; }
.bg-gold { background: color-mix(in srgb, var(--p-gold) 38%, var(--surface)) !important; color: #5c430a; }
.bg-navy { background: color-mix(in srgb, var(--p-navy) 28%, var(--surface)) !important; color: #24306a; }
.bg-coral { background: color-mix(in srgb, var(--p-coral) 30%, var(--surface)) !important; color: #6b2015; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.bg-teal,.bg-gold,.bg-navy,.bg-coral) { color: #fff; } }
:root[data-theme="dark"] :is(.bg-teal,.bg-gold,.bg-navy,.bg-coral) { color: #fff; }
.swatch-teal { background: var(--p-teal); } .swatch-gold { background: var(--p-gold); } .swatch-navy { background: var(--p-navy); } .swatch-coral { background: var(--p-coral); }

.attention a { text-decoration: none; color: inherit; }
.attention li { align-items: center; }
.checklist li .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done .title { text-decoration: line-through; color: var(--ink-soft); }
.daygroup { font-weight: 700; font-family: var(--font-display); margin: .9rem 0 .2rem; color: var(--ink-soft); font-size: .92rem; }
.daygroup:first-child { margin-top: 0; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.cal-toolbar h2 { min-width: 11ch; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: .8rem; color: var(--ink-soft); text-align: center; padding-bottom: .25rem; font-weight: 600; }
.cal .cell {
  min-height: 104px; border-radius: 12px; background: var(--mist); padding: .4rem .45rem; text-align: left; border: 0; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden; color: var(--ink);
}
.cal .cell.out { opacity: .45; }
.cal .cell.today { box-shadow: 0 0 0 2.5px var(--navy) inset; }
:root[data-theme="dark"] .cal .cell.today { box-shadow: 0 0 0 2.5px #fff inset; }
.cal .cell.sel { outline: 3px solid var(--lagoon); outline-offset: 1px; }
.cal .num { font: 700 .95rem var(--font-display); }
.cal .evt { font-size: .74rem; background: var(--surface); border-radius: 6px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--gold); color: var(--ink); }
.cal .more { font-size: .72rem; color: var(--ink-soft); }

/* ---------- messages ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 210px); min-height: 420px; padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.msg { max-width: min(72%, 560px); padding: .65rem .9rem; border-radius: 18px; background: var(--mist); align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--lagoon-wash); }
.msg .when { display: block; font-size: .74rem; color: var(--ink-soft); margin-top: .25rem; }
.chat-day { align-self: center; font-size: .8rem; color: var(--ink-soft); background: var(--mist); border-radius: 99px; padding: .15rem .7rem; margin: .5rem 0; }
.chat-form { display: flex; gap: .6rem; padding: .9rem; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { min-height: 46px; max-height: 160px; flex: 1; }
.record-note { font-size: .82rem; color: var(--ink-soft); padding: 0 1.25rem .9rem; display: flex; align-items: center; gap: .4rem; }
.tone-warn { margin: 0 .9rem; background: var(--gold-wash); color: var(--gold-deep); border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .9rem; }

/* ---------- expenses ---------- */
.balance { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.balance .amount { font: 700 2.2rem var(--font-display); }
.amount.pos { color: var(--ok); }
.amount.neg { color: var(--danger); }
.money { font: 700 1.05rem var(--font-display); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: .35rem .85rem; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-soft); }
.filters button[aria-pressed="true"] { border-color: var(--lagoon); color: var(--lagoon-deep); background: var(--lagoon-wash); }
.btn-row { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }

/* ---------- children ---------- */
.child-card { display: flex; gap: 1rem; align-items: center; text-decoration: none; color: inherit; }
.child-card:hover h3 { color: var(--lagoon-deep); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .84rem; color: var(--ink-soft); }
.facts dd { margin: .1rem 0 0; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.alert-allergy { background: var(--coral-wash); color: var(--danger); border-radius: var(--radius); padding: .75rem 1rem; display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; font-weight: 600; }
.tabs { display: flex; gap: .25rem; border-bottom: 1.5px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .7rem .9rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--lagoon); }

/* ---------- family ---------- */
.code-box { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: var(--mist); border-radius: var(--radius); padding: .9rem 1rem; }
.code-box code { font: 700 1.5rem var(--font-display); letter-spacing: .08em; }
.colour-pick { display: flex; gap: .6rem; }
.colour-pick button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.colour-pick button[aria-pressed="true"] { border-color: var(--ink); }


/* ---------- custom schedule day picker ---------- */
.day-picker { background: var(--mist); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.paint-who { display: flex; flex-wrap: wrap; gap: .45rem; }
.paint-who button { display: inline-flex; align-items: center; gap: .45rem; border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: .4rem .85rem; font-weight: 600; cursor: pointer; min-height: 40px; }
.paint-who button[aria-pressed="true"] { border-color: var(--lagoon-deep); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lagoon) 25%, transparent); }
.paint-who i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.swatch-clear { background: repeating-linear-gradient(45deg, var(--line) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1.5px var(--ink-soft); }
.cal.picker { user-select: none; -webkit-user-select: none; }
.cal.picker .cell { min-height: 54px; background: var(--surface); align-items: center; justify-content: center; gap: 0; }
.cal.picker .cell .num { font-size: .9rem; }
.cal.picker .cell .who-initial { font: 700 .72rem var(--font-display); opacity: .8; }
.cal.picker .cell.range-start { outline: 3px dashed var(--lagoon-deep); outline-offset: -3px; }
.cal.picker .cell:hover { box-shadow: inset 0 0 0 2px var(--lagoon); }
@media (max-width: 860px) { .cal.picker .cell { min-height: 44px; } .day-picker { padding: .75rem; } }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(14, 20, 49, .55); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.5rem; box-shadow: 0 24px 64px rgba(0,0,0,.25); animation: rise .18s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; gap: 1rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .75rem 1.15rem; border-radius: 99px; box-shadow: var(--shadow); z-index: 60; font-weight: 600; animation: rise .2s; max-width: calc(100vw - 2rem); }
.toast.err { background: var(--danger); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--lagoon); border-radius: 50%; animation: spin .8s linear infinite; margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { width: 96px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .7; } }

/* ---------- mobile nav ---------- */
.tabbar { display: none; }
.sheet .nav a { color: var(--ink); }
.sheet .nav a:hover { background: var(--lagoon-wash); color: var(--ink); }
.sheet .nav a[aria-current="page"] { background: var(--lagoon-wash); color: var(--ink); }
.sheet .nav-group { color: var(--ink-soft); }

/* ---------- records (print) ---------- */
.records table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.records th, .records td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.records th { color: var(--ink-soft); font-weight: 600; }
.records section { margin-bottom: 2rem; }
.records td.body { white-space: pre-wrap; }
@media print {
  .sidebar, .topbar, .tabbar, .no-print { display: none !important; }
  .shell { display: block; } .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; padding: 0; }
  body { background: #fff; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid-2, .grid-2.cal-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .auth-mobile-logo { display: block; }
  .auth-card { text-align: left; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
    padding: calc(.4rem + env(safe-area-inset-top)) .6rem .4rem 1rem; border-bottom: 1px solid var(--line);
  }
  .topbar .brand { color: var(--ink); padding: 0; }
  .topbar .brand img { width: 32px; height: 32px; }
  .topbar .brand span { font-size: 1.3rem; }
  .main { padding: 1.1rem 1rem calc(6rem + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; font-size: .7rem; font-weight: 600; color: var(--ink-soft); text-decoration: none; background: none; border: 0; padding: .3rem 0; cursor: pointer; position: relative; }
  .tabbar [aria-current="page"] { color: var(--lagoon-deep); }
  .tabbar .badge { position: absolute; top: 0; left: 55%; height: 18px; min-width: 18px; font-size: .68rem; }
  .sheet { position: fixed; inset: 0; z-index: 40; background: rgba(14,20,49,.5); display: flex; align-items: flex-end; }
  .sheet-inner { background: var(--surface); width: 100%; border-radius: 22px 22px 0 0; padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); max-height: 85dvh; overflow-y: auto; animation: rise .2s; }
  .hello h1 { font-size: 1.6rem; }
  h1 { font-size: 1.55rem; }
  .ribbon { grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 10px; }
  .cal .cell { min-height: 64px; padding: .3rem; }
  .cal .evt { font-size: 0; height: 6px; width: 6px; padding: 0; border-radius: 50%; border: 0; background: var(--gold); }
  .cal .more { display: none; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .chat { height: calc(100dvh - 260px); }
  .msg { max-width: 85%; }
  .modal-back { align-items: end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92dvh; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .keypad { grid-template-columns: repeat(3, 68px); gap: 12px 18px; }
  .keypad button { width: 68px; height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
