/* Sticker-book look: cream paper, ink outlines, hard offset shadows, rounded system type. */
:root {
  --bg: #fff3dc; --card: #ffffff; --ink: #1f1b3a; --muted: #7d7696; --edge: #1f1b3a; --shadow: #1f1b3a;
  --accent: #ff5c39; --accent-ink: #ffffff; --sun: #ffc533; --mint: #35c98b; --sky: #5aa9ff; --late: #d97a00;
  --wash: #ffe7bd; --field: #fff9ec;
  --r: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15142a; --card: #211f3d; --ink: #f3efff; --muted: #a6a0c4; --edge: #4a4680; --shadow: #0b0a1a;
    --accent: #ff7452; --sun: #ffcf4d; --mint: #3fd699; --sky: #6fb4ff; --late: #ffb23e; --wash: #2c2950; --field: #1a1832;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 17px/1.35 var(--font); min-height: 100dvh;
  background-image: radial-gradient(var(--wash) 1.4px, transparent 1.6px); background-size: 22px 22px;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom));
}
main { max-width: 480px; margin: 0 auto; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 14px; gap: 10px; }
.brand { font-weight: 900; font-size: 1.45rem; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.brand i { font-style: normal; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--sun); border: 2.5px solid var(--edge); box-shadow: 0 3px 0 var(--shadow); transform: rotate(-6deg); font-size: 1.05rem; }
.top .right { display: flex; gap: 8px; align-items: center; }
.chip { font: inherit; font-weight: 800; font-size: .9rem; color: var(--ink); background: var(--card); border: 2.5px solid var(--edge); border-radius: 999px; padding: 6px 12px; box-shadow: 0 3px 0 var(--shadow); cursor: pointer; }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.chip.alert { background: var(--sun); color: #1f1b3a; }

/* cards */
.card { background: var(--card); border: 2.5px solid var(--edge); border-radius: var(--r); box-shadow: 0 5px 0 var(--shadow); padding: 16px; margin: 0 0 18px; }
.card.pad0 { padding: 0; overflow: hidden; }

/* Today: status */
.status { display: flex; gap: 14px; align-items: center; }
.avatar { flex: none; width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-size: 1.9rem; background: var(--sun); border: 2.5px solid var(--edge); transform: rotate(-4deg); transition: background .3s; }
.status.done .avatar { background: var(--mint); }
#status { font-weight: 900; font-size: 1.35rem; line-height: 1.15; letter-spacing: -.01em; }
#status small { display: block; font-weight: 700; font-size: .92rem; color: var(--muted); margin-top: 3px; }

/* big buttons */
.buttons { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 26px 0 10px; }
.btn {
  position: relative; border: 3px solid var(--edge); border-radius: 50%; color: var(--accent-ink); font: inherit; font-weight: 900;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.1; cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease, background .3s ease;
}
.btn { width: min(41vw, 172px); height: min(41vw, 172px); font-size: 1.5rem; }
.btn.in { background: radial-gradient(circle at 32% 24%, #ff8d68 0, var(--accent) 58%); box-shadow: 0 9px 0 var(--shadow); }
.btn.out { background: radial-gradient(circle at 32% 24%, #8cc4ff 0, var(--sky) 62%); box-shadow: 0 9px 0 var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(7px); box-shadow: 0 2px 0 var(--shadow); }
.btn:not(.done)::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid currentColor; opacity: 0; animation: ring 2.6s ease-out infinite; pointer-events: none; }
@keyframes ring { 0% { transform: scale(.92); opacity: .55; } 80%, 100% { transform: scale(1.1); opacity: 0; } }
.btn.in:not(.done)::after { color: var(--accent); } .btn.out:not(.done)::after { color: var(--sky); }
.btn.done { background: radial-gradient(circle at 32% 24%, #7cecb9 0, var(--mint) 60%); color: #0e3b28; cursor: default; box-shadow: 0 3px 0 var(--shadow); transform: translateY(5px); }
.btn.done .tick { font-size: 1.1em; margin-bottom: 1px; }
.btn.done span { font-size: .88rem; font-weight: 800; margin-top: 3px; }
.btn:disabled { opacity: 1; }
#undo { height: 2.5em; display: grid; place-items: center; }
#undo button { font: inherit; font-weight: 800; font-size: .95rem; background: var(--card); color: var(--ink); border: 2.5px solid var(--edge); border-radius: 999px; padding: 6px 16px; box-shadow: 0 3px 0 var(--shadow); cursor: pointer; }
#undo button b { color: var(--accent); }
#undo button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }

/* month card */
.month { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; background: var(--sun); }
@media (prefers-color-scheme: dark) { .month { color: #1f1b3a; } }
.month .k { font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.month .v { font-weight: 900; font-size: 2rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.month .s { font-weight: 700; font-size: .9rem; opacity: .8; }
.month .go { font-size: 1.6rem; font-weight: 900; }
.month:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--shadow); }

h2.sec { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 900; margin: 22px 4px 10px; }
.sec-row { display: flex; align-items: center; justify-content: space-between; }
.sec-row h2.sec { margin-right: 8px; }

/* lists + tables */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 2px solid var(--line, var(--wash)); cursor: pointer; }
.recent li:first-child { border-top: 0; }
.recent .dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--edge); background: var(--accent); }
.recent .dot.dropoff { background: var(--sky); }
.recent .what { font-weight: 800; flex: 1; }
.recent .what small { display: block; font-weight: 700; color: var(--muted); font-size: .82rem; }
.recent .when { font-weight: 900; font-variant-numeric: tabular-nums; text-align: right; }
.recent li.late .when { color: var(--late); }
.recent li.pending .when::after { content: " ⏳"; }
.who { display: inline-block; font-size: .72rem; font-weight: 900; padding: 1px 8px; border-radius: 999px; background: var(--wash); margin-left: 6px; vertical-align: 2px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 900; padding: 10px 8px 8px; background: var(--wash); position: sticky; top: 0; }
td { padding: 11px 8px; border-top: 2px solid var(--wash); font-weight: 800; vertical-align: top; }
th:first-child, td:first-child { padding-left: 14px; }
th:last-child, td:last-child { padding-right: 14px; }
td + td { white-space: nowrap; }
td small { display: block; font-weight: 700; font-size: .76rem; color: var(--muted); margin-top: 1px; }
th.r, td.r { text-align: right; }
tr[data-day] { cursor: pointer; }
tr[data-day]:active td { background: var(--field); }
td.late { color: var(--late); }
td small.early { color: var(--accent); }
td small.latefee { color: var(--late); }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-weight: 700; }
tfoot td { background: var(--wash); border-top: 2.5px solid var(--edge); }

/* Costs */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--card); border: 2.5px solid var(--edge); border-radius: 16px; box-shadow: 0 4px 0 var(--shadow); margin: 0 0 18px; }
.seg button { font: inherit; font-weight: 900; padding: 9px 0; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
.total { background: var(--mint); color: #0e3b28; }
.total .k { font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.total .v { font-weight: 900; font-size: 2.7rem; letter-spacing: -.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.total .s { font-weight: 700; opacity: .85; }
.note { color: var(--muted); font-size: .85rem; font-weight: 700; margin: -6px 6px 18px; }
.wide { width: 100%; font: inherit; font-weight: 900; padding: 13px; border: 2.5px solid var(--edge); border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--shadow); cursor: pointer; }
.wide:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }

/* tab bar */
nav { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 2.5px solid var(--edge); }
nav .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
nav button { font: inherit; font-weight: 900; font-size: .78rem; display: grid; justify-items: center; gap: 2px; padding: 7px 0 6px; color: var(--muted); background: transparent; border: 2.5px solid transparent; border-radius: 16px; cursor: pointer; }
nav button svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
nav button[aria-selected=true] { color: var(--ink); background: var(--sun); border-color: var(--edge); box-shadow: 0 3px 0 var(--shadow); }
@media (prefers-color-scheme: dark) { nav button[aria-selected=true] { color: #1f1b3a; } }

.tab { animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* dialogs */
dialog { border: 3px solid var(--edge); border-radius: 26px; background: var(--card); color: var(--ink); padding: 20px; width: min(92vw, 400px); box-shadow: 0 8px 0 var(--shadow); font-family: var(--font); }
dialog::backdrop { background: rgba(20, 16, 50, .55); }
dialog h2 { margin: 0 0 14px; font-size: 1.35rem; font-weight: 900; letter-spacing: -.01em; }
dialog label { display: block; margin: 0 0 12px; font-size: .8rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
dialog input, dialog select { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; font-weight: 800; font-size: 1.02rem; color: var(--ink); background: var(--field); border: 2.5px solid var(--edge); border-radius: 14px; min-height: 48px; }
dialog .pair { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
dialog .row { display: flex; gap: 10px; margin-top: 8px; }
dialog .row button, dialog .mini { flex: 1; padding: 12px; font: inherit; font-weight: 900; border-radius: 14px; border: 2.5px solid var(--edge); background: var(--card); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--shadow); }
dialog .row button:active, dialog .mini:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
dialog .row button[type=submit] { background: var(--accent); color: var(--accent-ink); }
dialog .mini { flex: none; padding: 6px 12px; font-size: .8rem; margin: 6px 6px 0 0; display: inline-block; }
dialog .hint { margin: 0 0 12px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.fine { background: var(--card); border: 2.5px solid var(--edge); border-radius: 18px; padding: 12px 14px; margin: 0 0 12px; }
.fine > label:last-child { margin-bottom: 0; }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); background: var(--ink); color: var(--bg); font-weight: 800; padding: 10px 16px; border-radius: 16px; border: 2.5px solid var(--edge); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#who { position: fixed; inset: 0; background: var(--bg); z-index: 20; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
#who.show { display: flex; }
#who h1 { font-size: 1.9rem; font-weight: 900; margin: 0 0 8px; letter-spacing: -.02em; }
#who button { width: 100%; max-width: 320px; padding: 22px; font: inherit; font-size: 1.5rem; font-weight: 900; border: 3px solid var(--edge); border-radius: 22px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 0 var(--shadow); cursor: pointer; }
#who button[data-who=Melissa] { background: var(--sky); }
#who button:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--shadow); }
.spark { position: fixed; width: 12px; height: 12px; border-radius: 4px; pointer-events: none; z-index: 30; }

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