/* Bold blocks: thick outlines, hard offset shadows, bright flat colour. */
:root {
  --bg: #fff1d6;
  --surface: #ffffff;
  --surface-2: #fff8ea;
  --text: #111111;
  --muted: #5c4f38;
  --ink: #111111;          /* outlines and shadows */
  --on-color: #111111;     /* text on bright blocks, same in both modes */
  --yellow: #ffd23f;
  --pink: #ff8fab;
  --blue: #7cc6fe;
  --green: #3ddc84;
  --purple: #b79cff;
  --orange: #ff9f5a;
  --bad: #e5304f;
  --bad-block: #ff5c7a;
  --border-w: 2.5px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151f;
    --surface: #24212f;
    --surface-2: #2d293a;
    --text: #f7f3ea;
    --muted: #b9b1c9;
    --ink: #f7f3ea;
    --bad: #ff7a93;
  }
}

/* Evelyn's theme: light pink instead of cream (deep plum in dark mode). */
:root[data-theme="pink"] {
  --bg: #ffe0ec;
  --surface-2: #fff2f7;
  --muted: #6b3d52;
}
:root[data-theme="pink"] .money.hero { background: #ff5fa8; }       /* This week: hot pink */
:root[data-theme="pink"] .money:not(.hero) { background: var(--green); } /* Savings: green */
:root[data-theme="pink"] .day.selected,
:root[data-theme="pink"] #toast { background: #ff5fa8; }                 /* day highlight, thank-you sticker */
@media (prefers-color-scheme: dark) {
  :root[data-theme="pink"] {
    --bg: #23141d;
    --surface: #33202b;
    --surface-2: #3d2633;
    --muted: #d4aec0;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 56px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.loading { text-align: center; padding: 30vh 0; color: var(--muted); font-weight: 700; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 20px; }
.stack > * + * { margin-top: 18px; }

/* Blocks */
.card, .money, .kid, .banner, .day, .chore, dialog, .login {
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { background: var(--surface); padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.money-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.money { padding: 14px 16px; background: var(--blue); color: var(--on-color); }
.money.hero { background: var(--yellow); }
.money .label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.money .amount { font-size: 2.3rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; letter-spacing: -0.02em; }
.money .small, .money .muted { color: var(--on-color); opacity: 0.8; }

/* Buttons: press down into their shadow */
.btn {
  appearance: none; font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer;
  border: var(--border-w) solid var(--ink); border-radius: var(--radius); padding: 9px 16px; min-height: 44px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform 60ms ease, box-shadow 60ms ease;
}
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--green); color: var(--on-color); }
.btn.ghost { background: var(--surface); }
.btn.danger { background: var(--bad-block); color: var(--on-color); }
.btn.small { padding: 4px 12px; min-height: 34px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; font-size: 1.05rem; min-height: 52px; }
.linkbtn { background: none; border: none; color: var(--text); font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer; padding: 6px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.banner { padding: 14px; background: var(--purple); color: var(--on-color); font-size: 0.95rem; }
.banner.warn { background: var(--orange); }
.banner strong { display: block; margin-bottom: 4px; font-size: 1rem; }
.banner .btn { margin-top: 12px; }
/* Finish Week button with its info tooltip */
.finish-row { display: flex; gap: 10px; align-items: stretch; }
.finish-row > .btn.block { flex: 1; width: auto; }
.info-wrap { position: relative; display: flex; }
.btn.info-btn { width: 52px; min-height: 52px; padding: 0; border-radius: 50%; font-family: Georgia, serif; font-style: italic; font-size: 1.3rem; }
.info-wrap .tip {
  display: none; position: absolute; right: 0; bottom: calc(100% + 10px); z-index: 20; width: min(300px, 80vw);
  padding: 12px 14px; background: var(--surface); color: var(--text); font-size: 0.9rem; font-weight: 400; line-height: 1.4;
  border: var(--border-w) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.info-wrap.open .tip, .info-btn:focus-visible + .tip { display: block; }
@media (hover: hover) { .info-wrap:hover .tip { display: block; } }
.banner.has-close { position: relative; padding-right: 56px; }
.banner .btn.banner-close { position: absolute; top: 10px; right: 10px; margin: 0; width: 34px; padding: 0; font-size: 1.2rem; line-height: 1; }

/* Day strip */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  appearance: none; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
  padding: 7px 0 5px; font: inherit; cursor: pointer; text-align: center; min-width: 0; border-radius: 10px;
}
.day .dn { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.day .dd { font-size: 1.1rem; font-weight: 700; }
.day .dots { height: 7px; display: flex; justify-content: center; gap: 2px; margin-top: 2px; }
.day .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--green); border: 1px solid var(--ink); }
.day .dot.bad { background: var(--bad-block); }
.day.today .dn { color: var(--text); }
.day.today { outline: var(--border-w) dashed var(--ink); outline-offset: 2px; }
.day.selected { background: var(--yellow); color: var(--on-color); transform: translate(2px, 2px); box-shadow: none; }
.day.selected .dn { color: var(--on-color); }

/* Chores: each one its own block */
.chores { list-style: none; margin: 0; padding: 0; }
.chore {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 10px;
  background: var(--surface-2); box-shadow: var(--shadow-sm);
}
.chore.muted { justify-content: center; font-weight: 700; }
.chore .info { flex: 1; min-width: 0; }
.chore .title { font-weight: 700; }
.chore .meta { font-size: 0.85rem; color: var(--muted); }
.chore.missed { background: color-mix(in srgb, var(--bad-block) 22%, var(--surface)); }
.chore.missed .title { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 2px; }
.check {
  flex: none; width: 36px; height: 36px; border-radius: 9px; border: var(--border-w) solid var(--ink);
  background: var(--surface); cursor: pointer; display: grid; place-items: center;
  font-size: 1.15rem; font-weight: 700; color: transparent; box-shadow: var(--shadow-sm);
  transition: transform 60ms ease, box-shadow 60ms ease;
}
.check:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.check.on { background: var(--green); color: var(--on-color); animation: pop 220ms ease; }
.check:disabled { cursor: not-allowed; }
@keyframes pop { 50% { transform: scale(1.18) rotate(-6deg); } }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  border: 2px solid var(--ink); background: var(--surface); color: var(--text); white-space: nowrap;
}
.tag.good { background: var(--green); color: var(--on-color); }
.tag.bad { background: var(--bad-block); color: var(--on-color); }

.group-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 0; }

.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  appearance: none; font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; padding: 5px 14px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.seg button.on { background: var(--yellow); color: var(--on-color); transform: translate(2px, 2px); box-shadow: none; }

/* Parent: one colour per child */
.kids { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kid { padding: 12px; display: flex; flex-direction: column; gap: 6px; color: var(--on-color); background: var(--blue); }
.kid:nth-child(2) { background: var(--pink); }
.kid:nth-child(3) { background: var(--purple); }
.kid .name { font-weight: 700; font-size: 1.05rem; }
.kid .big { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kid .row { display: flex; justify-content: space-between; font-size: 0.82rem; font-weight: 500; }
.kid .btn { margin-top: auto; }
.kid .btn.primary { background: var(--surface); color: var(--text); }

.list { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); }
.list li:first-child { border-top: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }

details { padding: 4px 0; }
details summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 8px; }

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; background: var(--surface); padding: 20px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand img { width: 48px; height: 48px; border-radius: 10px; border: var(--border-w) solid var(--ink); }
label { display: block; font-size: 0.85rem; font-weight: 700; margin: 14px 0 6px; }
input[type=text], input[type=password] {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 10px;
  border: var(--border-w) solid var(--ink); background: var(--surface-2); color: var(--text);
}
input:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.error { color: var(--bad); font-size: 0.9rem; font-weight: 700; margin-top: 10px; min-height: 1.3em; }
.login .btn.block { margin-top: 4px; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) rotate(-1.5deg);
  background: var(--yellow); color: var(--on-color); padding: 10px 18px; border-radius: 10px; font-weight: 700;
  border: var(--border-w) solid #111; box-shadow: 4px 4px 0 #111;
  max-width: calc(100% - 32px); text-align: center; z-index: 10; animation: toast-in 180ms ease;
}
@keyframes toast-in { from { transform: translateX(-50%) translateY(16px) rotate(-1.5deg); opacity: 0; } }

dialog { padding: 20px; width: min(420px, calc(100% - 32px)); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(17, 17, 17, 0.5); }
#dialog-body { margin: 10px 0 18px; font-size: 0.95rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

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

@media (max-width: 420px) {
  .kids { grid-template-columns: 1fr; }
  .kid { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .kid .name { flex: 1 0 40%; }
  .kid .big { font-size: 1.4rem; }
  .kid .row { flex: 1 0 100%; }
  .kid .btn { margin-top: 0; flex: 1 0 100%; }
  .money .amount { font-size: 1.9rem; }
  .days { gap: 4px; }
}

/* Parent tabs and chore management */
.seg.tabs { display: flex; width: 100%; }
.seg.tabs button { flex: 1; padding: 8px 14px; font-size: 0.95rem; }
.chore .btn.small { flex: none; }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick button {
  appearance: none; font: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; padding: 8px 0;
  border: 2px solid var(--ink); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.daypick button.on { background: var(--yellow); color: var(--on-color); transform: translate(2px, 2px); box-shadow: none; }
.dayshort { display: flex; gap: 6px; margin-top: 4px; }
select {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: var(--border-w) solid var(--ink); background: var(--surface-2); color: var(--text);
}
.banner.agree { background: var(--green); }
.banner.agree .list li { border-top-color: color-mix(in srgb, #111 25%, transparent); }
.banner .list { margin-top: 8px; font-size: 0.92rem; }
.banner .muted { color: inherit; opacity: 0.75; }
.chore.manage .actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 420px) {
  .chore.manage { flex-wrap: wrap; }
  .chore.manage .actions { width: 100%; justify-content: flex-end; }
}
.banner .list li { display: block; }
.banner.agree .btn.primary { background: var(--surface); color: var(--text); margin-top: 12px; }
.banner .list strong { display: inline; margin: 0; font-size: inherit; }

/* Savings history */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger > li { padding: 10px 0; border-top: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); }
.ledger > li:first-child { border-top: none; }
.ledger summary { list-style: none; }
.ledger summary::-webkit-details-marker { display: none; }
.ledger summary, .ledger > li:not(:has(details)) { display: flex; justify-content: space-between; gap: 12px; }
.led-main { display: flex; flex-direction: column; min-width: 0; }
.led-main strong::after { content: ''; }
.ledger details > summary .led-main strong::after { content: ' ▸'; font-size: 0.8em; }
.ledger details[open] > summary .led-main strong::after { content: ' ▾'; }
.led-amt { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.num.plus { color: var(--good); }
@media (prefers-color-scheme: dark) { .num.plus { color: var(--green); } }
.seg.tabs button { padding: 8px 6px; }
.pending { background: var(--surface-2); border: 2px dashed var(--ink); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.pending .list { margin-top: 6px; }
.pending .list li { display: block; }

/* Gigs */
textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; resize: vertical;
  border: var(--border-w) solid var(--ink); background: var(--surface-2); color: var(--text);
}
input[type=date] {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: var(--border-w) solid var(--ink); background: var(--surface-2); color: var(--text);
}
.kidpick { display: flex; gap: 8px; flex-wrap: wrap; }
.kidbox {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; cursor: pointer;
  border: 2px solid var(--ink); border-radius: 999px; padding: 6px 12px; background: var(--surface);
}
.kidbox input { width: 18px; height: 18px; accent-color: #111; }
.chore.gig .title .num { margin-left: 4px; }
.chore.gig .meta + .meta { margin-top: 4px; }
.card-head .btn.small { flex: none; }
.seg.subtabs { display: flex; width: 100%; }
.seg.subtabs button { flex: 1; font-size: 0.9rem; }
.card-toggle {
  appearance: none; background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 8px; text-align: left;
}
.card-toggle .chev { font-size: 1.1rem; width: 1em; }
.collapse-body[hidden] { display: none; }
.collapse-body { margin-top: 4px; }
.linkbtn.card-toggle { display: inline-block; padding: 0; margin: -6px 0 10px; font-size: 0.9rem; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--bad-block); color: #111; border: 2px solid #111; font-size: 0.75rem; font-weight: 700;
}
.seg.subtabs button { white-space: nowrap; padding-left: 6px; padding-right: 6px; }
