/* ChoreVault — phone-first family chore board.
   ============================================================================
   IDENTITY
   The app icon is the brief: a soft-3D clay toy — a deep vault-blue tile, a
   little house with a coral roof, a sky-blue safe with a golden wheel, and
   bubbly multicoloured lettering. The app is the family's vault: chores go
   in, Buddy Bucks come out. Everything here is derived from that artwork.

     - Vault navy (#16305E) is the ink. Surfaces sit on a soft daylight sky;
       dark mode is the vault at night — deep blue, never gray.
     - Vault blue (#1257BE) is the working accent: the primary action of a
       screen, the active tab, focus. Used like the icon's frame — structure,
       not decoration.
     - Coin gold (#FFC53D) is reserved for VALUE: Bucks, prices, payday, the
       "Vault" plate of the wordmark. If gold is on screen, money is moving.
     - Roof coral (#E0552F) is the small warm pop: notification dots and
       badges only — the one thing that should catch a passing eye.
     - Toy green / berry red / teal keep their jobs: done, trouble, waiting.

   TYPE
   Two faces, both bundled (no network fetch, cached by the service worker):
     - "Baloo 2" — the display face. Chunky and rounded like the icon's
       lettering. Wordmark, headings, buttons, tab labels, big numbers.
     - "Nunito" — the body face. Rounded, warm, extremely legible at arm's
       length. Everything else.
   Every figure is tabular so Bucks columns line up like a paper tally chart.

   SIGNATURE
   The moment a chore is checked: the box pops green and throws a soft ring,
   the one orchestrated animation in the app — the reward moment. Everything
   else moves quietly or not at all. The tally strip (one tick per chore)
   stays from v2: you see how much is left AND how many things that is.

   ACCESSIBILITY FLOOR (not negotiable)
   44px+ tap targets, env(safe-area-inset-*), both colour schemes first-class,
   nothing carried by colour alone (state always doubles as a word, a shape or
   a border style), body copy large enough to read at arm's length, reduced
   motion kills every transition and keyframe.
   ========================================================================== */

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/baloo2-var-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('/fonts/nunito-var-latin.woff2') format('woff2');
}

:root {
  /* --- surfaces: a soft daylight sky --- */
  --paper: #E9F1FA;
  --card: #FFFFFF;
  --card-2: #F1F6FC;
  --line: #C9DBEE;
  --line-soft: #DFEAF6;

  /* --- ink: vault navy, never black --- */
  --ink: #16305E;
  --ink-2: #4A6188;
  --ink-3: #6F84A8;

  /* --- brand: the vault-blue frame --- */
  --brand: #1257BE;
  --brand-ink: #FFFFFF;
  --brand-soft: #DBE8FA;

  /* --- coin gold: value only --- */
  --coin: #FFC53D;
  --coin-ink: #5C3D00;
  --coin-soft: #FFF2D2;

  /* --- roof coral: the small warm pop (badges, dots) --- */
  --roof: #E0552F;
  --roof-ink: #FFFFFF;

  /* --- states --- */
  --good: #1F8A3B;
  --good-ink: #FFFFFF;
  --good-soft: #DFF2E2;
  --wait: #0E7A91;
  --wait-ink: #FFFFFF;
  --wait-soft: #DEF0F4;
  --bad: #C0334B;
  --bad-ink: #FFFFFF;
  --bad-soft: #FBE4E8;

  --focus: #1257BE;

  /* --- shape: clay-chunky --- */
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* --- rhythm: one 4px scale, used everywhere, no ad-hoc values --- */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;

  /* clay shadows: low, soft, navy-tinted — an object resting on felt */
  --shadow: 0 1px 2px rgba(22, 48, 94, 0.06), 0 10px 24px -14px rgba(22, 48, 94, 0.35);
  --shadow-lift: 0 2px 6px rgba(22, 48, 94, 0.08), 0 24px 48px -20px rgba(22, 48, 94, 0.45);

  --display: 'Baloo 2', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sans: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", "Noto Sans", Arial, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* the vault at night: deep blue, never gray */
    --paper: #0C1730;
    --card: #152546;
    --card-2: #1C2F57;
    --line: #2D4272;
    --line-soft: #243761;

    --ink: #E9F0FB;
    --ink-2: #A9BAD8;
    --ink-3: #8195B8;

    --brand: #6FA3F5;
    --brand-ink: #0A1F45;
    --brand-soft: #1E3563;

    --coin: #FFCE57;
    --coin-ink: #3A2800;
    --coin-soft: #3B2E0F;

    --roof: #FF8A5E;
    --roof-ink: #3A1200;

    --good: #4FC072;
    --good-ink: #04220E;
    --good-soft: #17371F;
    --wait: #4FC2D6;
    --wait-ink: #062A31;
    --wait-soft: #123742;
    --bad: #FF8298;
    --bad-ink: #3A0512;
    --bad-soft: #3F1721;

    --focus: #8FB8FF;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 28px -14px rgba(0, 0, 0, 0.85);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.6), 0 26px 52px -20px rgba(0, 0, 0, 0.95);

    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

/* Every digit in the app is tabular: Bucks columns, counts and balances line
   up vertically down a card instead of shimmering as they change. */
body,
input,
button,
select {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

h1, h2, h3 { margin: 0; color: var(--ink); font-family: var(--display); }

h1 { font-size: 1.8rem; font-weight: 750; letter-spacing: -0.01em; line-height: 1.12; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.005em; }
h3 { font-size: 1.02rem; font-weight: 700; }

p { margin: 0 0 var(--s3); }

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
}

button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* The one structural device: an uppercase micro-label that names what a group
   of rows IS. Used for card sections, tiers and scopes — never as decoration. */
.eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s2);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.muted { color: var(--ink-2); font-size: 0.9rem; }

/* ---------- wordmark: the icon, set in type ---------- */
/* "Chore" in vault navy, "Vault" on the coin-gold plate — the same two
   materials as the icon's safe and wheel. Baloo carries the bubble feel. */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark b {
  display: inline-block;
  background: var(--coin);
  color: var(--coin-ink);
  border-radius: 8px;
  padding: 2px 7px 4px;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(92, 61, 0, 0.25);
}

/* ---------- app shell ---------- */

#root {
  display: block;
  max-width: 680px;
  margin: 0 auto;
  padding: var(--s4) var(--s4) calc(96px + env(safe-area-inset-bottom) + var(--s4));
  min-height: 100dvh;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: calc(env(safe-area-inset-top) + var(--s2)) var(--s4) var(--s2);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

#topbar .spacer { flex: 1 1 auto; }

.iconbtn {
  position: relative;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  padding: 0 var(--s2);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 1.15rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.iconbtn:hover { background: var(--card); border-color: var(--line); }
.iconbtn:active { transform: scale(0.96); }

/* the unread dot is roof-coral: the one warm thing that should catch the eye */
.iconbtn .dot {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--roof);
  color: var(--roof-ink);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.whoami {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s3);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--ink-2);
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.15s ease;
}

.whoami:hover { border-color: var(--ink-3); }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--s3));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  max-width: calc(100% - var(--s7));
  padding: var(--s3) var(--s5);
  border-radius: var(--r);
  font-weight: 800;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

#toast.ok { background: var(--ink); color: var(--paper); }
#toast.bad { background: var(--bad); color: var(--bad-ink); }

/* ---------- connection banner ---------- */
/* Persistent and unobtrusive — not a toast — so a dropped connection doesn't go
   unnoticed but also doesn't nag on every 5-second poll tick. */

#connbanner {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--wait);
  color: var(--wait-ink);
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
  padding: var(--s2) var(--s4);
}

/* ---------- render-error panel ---------- */
/* Shown in #root instead of a blank screen when a tab's renderer throws or a
   fetch inside it rejects. */

.errorpanel {
  background: var(--card);
  border: 2px solid var(--bad);
  border-left-width: 6px;
  border-radius: var(--r);
  padding: var(--s5);
  margin-top: var(--s4);
  box-shadow: var(--shadow);
}

.errorpanel h2 { color: var(--bad); margin-bottom: var(--s2); }
.errorpanel button { margin-top: var(--s3); }

/* ---------- bottom tab bar ---------- */

#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  gap: var(--s1);
  /* Plain colour first: a browser without color-mix() must still get an opaque
     bar, not a transparent one with the board scrolling through it. */
  background: var(--card);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom));
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: var(--s1) 2px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  position: relative;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.tab .tabicon {
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

/* The active tab is marked THREE ways — colour, a filled plate and the blue
   rule above it — so it never depends on colour alone. */
.tab.active { color: var(--brand); background: var(--brand-soft); }
.tab.active .tabicon { transform: translateY(-1px) scale(1.1); }

.tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 3.5px;
  border-radius: var(--r-pill);
  background: var(--brand);
}

.tab:active .tabicon { transform: scale(0.92); }

.badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 26px);
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--roof);
  color: var(--roof-ink);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}

/* ---------- buttons ---------- */

.btn {
  min-height: 48px;
  padding: 0 var(--s5);
  border-radius: var(--r);
  border: 2px solid transparent;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.975); }

/* The primary button is the vault-blue frame: one per screen. The inset
   bottom edge is the clay press — same trick as the wordmark plate. */
.btn.primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, var(--ink)); }

.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-3); }

.btn.good {
  background: var(--good);
  color: var(--good-ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}
.btn.danger {
  background: var(--bad);
  color: var(--bad-ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

/* Vault navy, for repeated row actions (Award, Buy). A screen with ten blue
   buttons has no accent left — blue stays on the ONE primary action. */
.btn.ink {
  background: var(--ink);
  color: var(--paper);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}
.btn.ink:hover { background: var(--ink-2); }

.btn.quiet {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}

.btn.block { width: 100%; }

.btn:disabled {
  background: var(--card-2);
  color: var(--ink-3);
  border-color: var(--line);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.sm {
  min-height: 44px;
  padding: 0 var(--s4);
  font-size: 0.9rem;
  border-radius: var(--r-sm);
}

/* ---------- auth screen ---------- */

.auth {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  max-width: 420px;
  margin: 7vh auto 0;
  padding: var(--s6);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.auth .authmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s1);
}

.auth .authmark .authicon {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth .authmark .wordmark { font-size: 2rem; gap: 6px; }
.auth .authmark .wordmark b { padding: 3px 10px 6px; border-radius: 11px; }

.auth .sub {
  text-align: center;
  color: var(--ink-2);
  margin: 0;
  font-size: 0.95rem;
}

.auth .btn { width: 100%; }

.notice {
  background: var(--wait-soft);
  border: 1px solid var(--wait);
  border: 1px solid color-mix(in srgb, var(--wait) 45%, transparent);
  border-left: 4px solid var(--wait);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: var(--s3) var(--s4);
  font-size: 0.92rem;
  margin: 0;
}

/* ---------- form fields ---------- */

label,
.field > .fieldlabel {
  display: block;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  margin-bottom: var(--s2);
}

label { display: flex; flex-direction: column; gap: var(--s2); }

.field { margin-bottom: var(--s4); }
.field:last-child { margin-bottom: 0; }

input, select, textarea {
  width: 100%;
  min-height: 50px;
  padding: var(--s3) var(--s3);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card-2);
  color: var(--ink);
  font-weight: 600;
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus { border-color: var(--brand); }

.fieldhint {
  display: block;
  margin-top: var(--s2);
  font-size: 0.8rem;
  color: var(--ink-3);
}

.fielderror {
  display: block;
  margin-top: var(--s2);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--bad);
}

.field.bad input, .field.bad select { border-color: var(--bad); }

/* day-of-week picker — replaces v1's "type 0=Sun 1=Mon…" prompt */
.daypick {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

.daypick button {
  flex: 1 1 0;
  min-width: 40px;
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card-2);
  color: var(--ink-2);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.daypick button.on {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

/* Chosen days are also spelled out underneath, so the selection is never
   carried by the blue fill alone. */
.daypick-read {
  margin-top: var(--s2);
  font-size: 0.8rem;
  color: var(--ink-3);
  font-weight: 700;
}

/* ---------- sheets (every prompt/confirm in v1 is now one of these) ---------- */

.scrimwrap {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 40, 0.55);
  border: none;
  padding: 0;
  animation: fade-in 0.18s ease;
}

.sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lift);
  animation: sheet-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}

@media (min-width: 620px) {
  .scrimwrap { align-items: center; }
  .sheet { border-radius: var(--r-lg); border-bottom: 1px solid var(--line); }
}

@keyframes sheet-up { from { transform: translateY(22px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-grip {
  width: 40px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--line);
  margin: var(--s2) auto 0;
  flex: 0 0 auto;
}

.sheet-head { padding: var(--s4) var(--s5) 0; flex: 0 0 auto; }
.sheet-head h2 { font-size: 1.3rem; }

.sheet-sub {
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}

.sheet-body {
  padding: var(--s4) var(--s5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}

.sheet-actions {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s5) calc(var(--s4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
  background: var(--card);
  flex: 0 0 auto;
}

.sheet-actions .btn { flex: 1 1 0; }

/* a scrollable list of choices inside a sheet (kids, behaviours, tabs) */
.optlist { display: flex; flex-direction: column; gap: var(--s2); }

.opt {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 54px;
  padding: var(--s2) var(--s3);
  text-align: left;
  background: var(--card-2);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

/* Column-stacked like .row .label — without this the option name and its
   meta line ("Sign out" / "You will need your password...") run together
   as one inline string. */
.opt .label { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.opt .optname { font-weight: 700; font-size: 0.98rem; }
.opt .optmeta { font-size: 0.82rem; color: var(--ink-2); }

.opt .pricetag {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 0.95rem;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-sm);
  background: var(--coin-soft);
  color: var(--ink);
}

.opt.on {
  border-color: var(--brand);
  background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--brand);
}

.opt.on .optname::after {
  content: " ✓";
  color: var(--good);
  font-weight: 900;
}

.opt:disabled { opacity: 0.5; cursor: not-allowed; }

.optgroup { margin-bottom: var(--s5); }
.optgroup:last-child { margin-bottom: 0; }

/* ---------- day heading ---------- */

.dayhead { margin-bottom: var(--s5); }

.dayhead-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
}

/* Payday is money: it gets the gold. */
.payday {
  background: var(--coin);
  color: var(--coin-ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--s1) var(--s3);
  border-radius: var(--r-pill);
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 rgba(92, 61, 0, 0.25);
}

.pagesub {
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s4);
  margin-bottom: var(--s4);
  box-shadow: var(--shadow);
}

.card > .eyebrow:first-child { margin-top: 0; }

.cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.cardhead h2 { min-width: 0; }

/* the count chip: tabular, goes green when the list is finished */
.count {
  flex: 0 0 auto;
  padding: var(--s1) var(--s3);
  border-radius: var(--r-pill);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  color: var(--ink-2);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
}

.count.full { background: var(--good-soft); border-color: var(--good); color: var(--good); }

/* ---------- the tally strip ---------- */

.tally {
  display: flex;
  gap: 3px;
  margin-bottom: var(--s4);
}

.tally .tick {
  flex: 1 1 0;
  min-width: 3px;
  height: 10px;
  border-radius: 4px;
  background: var(--card-2);
  border: 1px solid var(--line);
  transition: background-color 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.6);
}

.tally .tick.on {
  background: var(--good);
  border-color: var(--good);
  transform: scaleY(1.35);
}

.tally .tick.skip {
  background: repeating-linear-gradient(
    135deg, var(--card-2), var(--card-2) 3px, var(--line) 3px, var(--line) 5px);
}

.tally.empty .tick { background: var(--card-2); }

/* ---------- chore rows ---------- */

.chores { display: flex; flex-direction: column; gap: var(--s2); }

.chore {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 58px;
  padding: var(--s2) var(--s3);
  background: var(--card-2);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.chore:not(:disabled):active { transform: scale(0.99); }
.chore:not(:disabled):hover { border-color: var(--ink-3); }
.chore:disabled { cursor: not-allowed; }

/* A disabled row that is neither done nor pending (e.g. every row a guest
   sees) must not look identical to a tappable one, and the distinction can't
   ride on colour alone — dotted borders + reduced opacity carry it instead. */
.chore:disabled:not(.done):not(.pending):not(.requested) {
  opacity: 0.62;
  border-style: dotted;
}

.chore:disabled:not(.done):not(.pending):not(.requested) .box { border-style: dotted; }

.chore .box {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--ink-3);
  border-radius: 10px;
  color: var(--good-ink);
  font-weight: 900;
  font-size: 1rem;
  background: var(--card);
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s
              cubic-bezier(0.2, 0.9, 0.3, 1.7);
}

/* THE signature moment: checking off pops the box and throws a soft green
   ring — the reward. The ring is a one-shot keyframe on ::after so it plays
   when the .done class lands and never loops. */
.chore.done .box {
  background: var(--good);
  border-color: var(--good);
  transform: scale(1.08);
}

.chore.done .box::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  animation: check-ring 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes check-ring {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  to { box-shadow: 0 0 0 14px transparent; }
}

.chore .label {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chore .title { font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }

.chore .meta { font-size: 0.8rem; color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }

/* a note left on this chore for the day -- independent of done/not-done,
   so it reads the same whether the row above it is struck through or not */
.chore .chorenote {
  font-size: 0.8rem;
  color: var(--ink-2);
  font-style: italic;
  white-space: normal;
  word-break: break-word;
}

.chore.done .title { text-decoration: line-through; color: var(--ink-2); }
.chore.done { opacity: 0.78; }

.chore.pending { border-style: dashed; border-color: var(--wait); background: var(--wait-soft); }
.chore.pending .meta { color: var(--wait); }

/* a chore someone has ASKED you to take on: greyed, not checkable */
.chore.requested {
  border-style: dashed;
  border-color: var(--wait);
  background: var(--wait-soft);
  opacity: 0.9;
}

.chore.requested .meta { color: var(--wait); font-weight: 700; }
.chore.requested .box { border-style: dashed; color: var(--wait); }

/* A chore row that also carries edit/delete controls: the toggle button and
   the small icon buttons are SIBLINGS (a <button> can't nest another
   <button>), laid out side by side so tapping the row still just checks it
   off and the edit/delete controls are their own separate hit targets. */
.chorewrap {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
}

.chorewrap .chore { width: auto; flex: 1 1 auto; min-width: 0; }

.chorebtn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 1rem;
  color: var(--ink-2);
  transition: border-color 0.12s ease;
}

.chorebtn:hover { border-color: var(--ink-3); }
.chorebtn:active { transform: scale(0.94); }
.chorebtn.delete { color: var(--bad); }

/* ---------- add / ask buttons ---------- */

.addchore {
  width: 100%;
  min-height: 48px;
  margin: 0 0 var(--s4);
  background: transparent;
  border: 2px dashed var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.addchore:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- generic rows inside a card ---------- */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.row:last-child { border-bottom: none; }
.row:first-of-type { padding-top: 0; }

.row .label { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.row .label .name { font-weight: 700; }
.row .label .meta { font-size: 0.82rem; color: var(--ink-2); font-weight: 600; }

.rowactions { display: flex; gap: var(--s2); flex: 0 0 auto; }

/* Prices are money: gold plate, navy figures. */
.pricetag {
  flex: 0 0 auto;
  font-weight: 800;
  padding: var(--s1) var(--s3);
  border-radius: var(--r-sm);
  background: var(--coin-soft);
  color: var(--ink);
  font-size: 0.9rem;
}

.emptystate {
  margin: 0;
  padding: var(--s4) 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}

/* ---------- kid stats ---------- */

.kidstats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.kidstat {
  flex: 1 1 90px;
  padding: var(--s2) var(--s3);
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}

.kidstat b {
  display: block;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.kidstat span {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.screen {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s1) var(--s3);
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 800;
  border: 1.5px solid transparent;
  margin-bottom: var(--s3);
}

.screen.yes { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.screen.no { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

/* today's deductions on a kid's card */
.dockrow {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s2);
  background: var(--bad-soft);
  border: 1px solid var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  border-left: 4px solid var(--bad);
  border-radius: var(--r-sm);
}

/* Same stacked title-over-meta treatment as .row .label — without the column
   layout the title and the date/reason render as one run-together line. */
.dockrow .label { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dockrow .amount { font-weight: 800; color: var(--bad); flex: 0 0 auto; }

/* a kid's bonus-job claim history on their card -- same row shape as
   .dockrow, positively colored since it's Bucks coming IN, not out. */
.bonushistrow {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s2);
  background: var(--good-soft);
  border: 1px solid color-mix(in srgb, var(--good) 40%, transparent);
  border-left: 4px solid var(--good);
  border-radius: var(--r-sm);
}

.bonushistrow .label { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bonushistrow .amount { font-weight: 800; color: var(--good); flex: 0 0 auto; }

.dockrow .label .meta,
.bonushistrow .label .meta { font-size: 0.8rem; color: var(--ink-2); font-weight: 600; }

/* the written expectation shown by the ℹ️ guide button — authored with real
   line breaks (numbered steps, "You are done when..."), rendered verbatim */
.guide {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

/* ---------- bonus tab ---------- */

.chip {
  display: inline-flex;
  /* .label is a flex COLUMN, so without this the chip stretches to the full
     width of the row and shoves the row's buttons onto a line of their own. */
  align-self: flex-start;
  margin-top: 2px;
  align-items: center;
  gap: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 800;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  color: var(--ink-2);
}

.chip.hot { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.chip.soon { background: var(--coin-soft); border-color: var(--coin); color: var(--ink); }

.was {
  text-decoration: line-through;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---------- shop tab ---------- */

.kidpicker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.pick {
  min-height: 46px;
  padding: 0 var(--s4);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-2);
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.pick.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

/* ---------- summary tab ---------- */

.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.statbox {
  padding: var(--s3);
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}

.statbox b {
  display: block;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.statbox span {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.statbox .fineprint {
  margin-top: var(--s1);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--ink-3);
}

.statbox.live { border-left: 4px solid var(--coin); }
.statbox.settled { border-left: 4px solid var(--ink-3); }

/* Clark's exact ask: a chore that was not done is BOLD, RED and says NOT DONE.
   The words carry it as much as the colour, and the row keeps a heavy left rule
   so it still reads as an exception in greyscale or with colours inverted. */
.notdone {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  flex-wrap: wrap;
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s2);
  background: var(--bad-soft);
  border-left: 5px solid var(--bad);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.notdone .what {
  font-weight: 800;
  color: var(--bad);
  font-size: 1rem;
}

.notdone .flag {
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--bad-ink);
  background: var(--bad);
  padding: 1px var(--s2);
  border-radius: 4px;
  white-space: nowrap;
}

/* The positive counterpart to .notdone above -- what actually got done
   today, listed by title the same way what's left is, not just folded into
   a bare count. */
.donerow {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  flex-wrap: wrap;
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s2);
  background: var(--good-soft);
  border-left: 5px solid var(--good);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.donerow .what {
  font-weight: 700;
  color: var(--good);
  font-size: 0.95rem;
}

.donerow .flag {
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--good-ink);
  background: var(--good);
  padding: 1px var(--s2);
  border-radius: 4px;
  white-space: nowrap;
}

.alldone {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--good-soft);
  border-left: 5px solid var(--good);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--good);
  font-weight: 700;
  font-size: 0.9rem;
}

.personblock { margin-bottom: var(--s4); }
.personblock:last-child { margin-bottom: 0; }

.personblock > h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

/* ---------- notifications ---------- */

.notifystate {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-2);
}

.inboxitem {
  padding: var(--s3);
  margin-bottom: var(--s2);
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.inboxitem:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.inboxitem.unread {
  border-left: 4px solid var(--roof);
  background: var(--card);
}

.inboxitem .itemtitle { font-weight: 800; font-size: 0.95rem; }
.inboxitem .itembody { font-size: 0.88rem; color: var(--ink-2); }
.inboxitem .itemwhen { font-size: 0.72rem; color: var(--ink-3); font-weight: 700; margin-top: 2px; }

.unreadflag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: var(--roof);
  color: var(--roof-ink);
  padding: 1px var(--s2);
  border-radius: 4px;
  margin-left: var(--s2);
  vertical-align: 1px;
}

/* ---------- small phones: every control on screen, no horizontal clip ----- */
/* The admin's chore rows carry up to three 44px action buttons; on a 390px
   phone that clipped the delete button clean off the right edge (a v2 bug
   this overhaul inherited and kills). Tighter gutters + 40px buttons keep
   every target comfortably tappable AND on screen. */

@media (max-width: 480px) {
  #root { padding-left: var(--s3); padding-right: var(--s3); }
  .card { padding: var(--s3); }
  .chorewrap { gap: var(--s1); }
  .chorebtn { width: 40px; height: 40px; }
  .chore { gap: var(--s2); }
}

/* ---------- desktop: same app, more room, a floating dock ---------- */
/* One layout, two postures. On a PC the full-width bottom bar would be a
   40-inch-wide tap target; instead the tabs float as a centered dock — same
   order, same muscle memory as the phone, comfortable with a mouse. */

@media (min-width: 900px) {
  #root {
    max-width: 780px;
    padding-top: var(--s6);
    padding-bottom: calc(120px + var(--s4));
  }

  #topbar {
    padding-left: var(--s6);
    padding-right: var(--s6);
  }

  #tabs {
    left: 50%;
    right: auto;
    bottom: var(--s4);
    transform: translateX(-50%);
    width: min(620px, calc(100vw - var(--s7)));
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    padding: var(--s2) var(--s3);
    box-shadow: var(--shadow-lift);
  }

  .tab { border-radius: var(--r-pill); min-height: 56px; }
  .tab:hover { color: var(--ink); background: var(--card-2); }
  .tab.active:hover { color: var(--brand); background: var(--brand-soft); }

  /* the dock is a pill; the active rule above a tab would poke out of it,
     so the plate alone (colour + fill + label weight) carries active state */
  .tab.active::before { display: none; }

  .card { padding: var(--s5); }
}

@media (min-width: 1400px) {
  #root { max-width: 820px; }
}

/* ---------- reduced motion: kill every transition and keyframe ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .tally .tick.on { transform: none; }
  .chore.done .box { transform: none; }
  .chore.done .box::after { animation: none; }
}
