:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1f2430; --muted: #6b7280; --accent: #4f46e5; --soft: #e8e6ff;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --line: rgba(0,0,0,.09); --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}
[data-dark="1"] { --muted: #a9adc4; --line: rgba(255,255,255,.12); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 520px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hidden { display: none !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card.tight { padding: 12px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--soft); font-size: .8rem; font-weight: 600; }
.pill.ok { background: #dcfce7; color: #166534; } .pill.warn { background: #fef3c7; color: #92400e; } .pill.bad { background: #fee2e2; color: #991b1b; }
.pill.prem { background: linear-gradient(90deg,#fde68a,#fbcfe8); color: #5b2a00; }

button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-height: 44px; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.soft { background: var(--soft); color: var(--ink); }
button.ok { background: var(--ok); } button.bad { background: var(--bad); }
button.link { background: none; color: var(--accent); padding: 4px; min-height: 0; }
button:disabled { opacity: .5; cursor: default; }
button.big { font-size: 1.1rem; padding: 14px 22px; border-radius: 14px; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); min-height: 44px; }
textarea { min-height: 70px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; margin-right: 6px; }
.check { display: flex; align-items: flex-start; gap: 6px; font-weight: 400; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.err { color: var(--bad); font-weight: 600; }

/* top bar + tabs (parent app) */
.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a.on { background: var(--soft); color: var(--ink); }
.badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 6px; margin-left: 4px; }

/* inbox items */
.item { display: flex; gap: 12px; align-items: flex-start; }
.item .face { font-size: 2rem; line-height: 1; }
.item .body { flex: 1; min-width: 0; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.proof { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.proof img, .proof video { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; background: #000; }

/* kid board */
.kid-top { padding: 16px; text-align: center; }
.kid-top .face { font-size: 3.4rem; background: none; border: 0; padding: 0; min-height: 0; cursor: pointer; }
.title-block { font-weight: 800; font-size: 1.3rem; }
.wallet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.wallet .card { text-align: center; padding: 12px 6px; }
.wallet .v { font-size: 1.4rem; font-weight: 800; }
.wallet .l { font-size: .8rem; color: var(--muted); }
.chores { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.chore { display: flex; flex-direction: column; gap: 8px; }
.chore .head { display: flex; gap: 10px; align-items: center; }
.chore .emo { font-size: 2.2rem; }
.chore .name { font-weight: 800; font-size: 1.1rem; }
.chore.done { opacity: .7; }
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slot { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--line); display: grid; place-items: center; font-size: .9rem; }
.slot.pending { border: 2px solid var(--warn); background: #fef3c7; }
.slot.approved { border: 2px solid var(--ok); background: #dcfce7; }
.timer { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cheer { display: flex; gap: 10px; align-items: center; }
.cheer .e { font-size: 1.8rem; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.picker button { flex-direction: column; background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 18px 8px; font-size: 1rem; }
.picker .f { font-size: 3rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; }
.pinpad button { height: 72px; font-size: 1.5rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.dots { font-size: 2rem; letter-spacing: 10px; text-align: center; min-height: 48px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button { background: var(--card); color: var(--ink); border: 2px solid var(--line); min-width: 52px; font-size: 1.4rem; padding: 6px 10px; }
.choices button.on { border-color: var(--accent); }
.choices button.locked { opacity: .45; }
.choices .lbl { font-size: .78rem; display: block; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: middle; }

/* sheet / dialog */
dialog { border: 0; border-radius: 18px; padding: 0; max-width: min(560px, calc(100vw - 24px)); width: 100%; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(10,10,20,.45); }
dialog .in { padding: 18px; max-height: 85vh; overflow: auto; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 120px); background: #111827; color: #fff; padding: 12px 18px;
  border-radius: 12px; transition: transform .25s; z-index: 50; max-width: calc(100vw - 32px); font-weight: 600; }
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

/* landing */
.hero { padding: 48px 0 24px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.hero p { font-size: 1.15rem; max-width: 640px; margin: 0 auto 1em; }
.features { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 24px 0; }
.features .card .i { font-size: 2rem; }
.price { text-align: center; }
.price .amt { font-size: 2.2rem; font-weight: 800; }
footer { padding: 24px 16px 40px; text-align: center; color: var(--muted); font-size: .9rem; }
.legal { max-width: 760px; }
.legal h2 { margin-top: 1.4em; }
.draft { background: #fef3c7; color: #78350f; border-radius: 12px; padding: 10px 14px; font-weight: 600; }

@media (max-width: 560px) {
  .wallet .v { font-size: 1.15rem; }
  .top .wrap { flex-wrap: wrap; }
  .tabs { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* utilities (no inline style attributes - our CSP forbids them) */
.center { text-align: center; }
.center-box { margin: 40px auto; }
.mt { margin-top: 12px; } .mt2 { margin-top: 24px; }
.emo-l { font-size: 1.8rem; line-height: 1; } .emo-xl { font-size: 3rem; margin: 0; }
.accent { color: var(--accent); }

/* start / break / finish */
.work { text-align: center; background: var(--soft); border-radius: 12px; padding: 8px; }
.work .timer { font-size: 2rem; }
.work.paused { opacity: .75; }
.work.paused .timer { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .work.paused .timer { animation: none; } }

/* admin */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat .v { font-size: 1.7rem; font-weight: 800; }
.stat .l { font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 80px; margin-top: 10px; }
.bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
button.fam { display: block; width: 100%; text-align: left; color: var(--ink); font-weight: 400; background: var(--card); border: 1px solid var(--line); }
.search { max-width: 260px; }

/* legal pages */
.legal table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.legal th, .legal td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.legal th { background: var(--soft); }
.legal .table { overflow-x: auto; }
.legal li { margin: .25em 0; }
