:root {
  --bg: #faf7f2; --surface: #ffffff; --ink: #231f1a; --muted: #6b6258; --line: #e6dfd4;
  --accent: #c2410c; --accent-ink: #ffffff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c; --chip: #f3ede4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171411; --surface: #211d19; --ink: #f2ece4; --muted: #a89c8e; --line: #3a332c;
    --accent: #fb923c; --accent-ink: #1a1410; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --chip: #2c2621;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171411; --surface: #211d19; --ink: #f2ece4; --muted: #a89c8e; --line: #3a332c;
  --accent: #fb923c; --accent-ink: #1a1410; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --chip: #2c2621;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.brand { color: var(--accent); font-size: 1.6rem; letter-spacing: .02em; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
textarea { min-height: 4.5rem; resize: vertical; }
button { cursor: pointer; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.ghost { background: transparent; color: var(--accent); }
button.small { padding: .2rem .55rem; font-size: .85rem; font-weight: 500; }
button.wide { width: 100%; text-align: left; }
label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
.stack { display: grid; gap: .8rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row > input, .row > select { flex: 1 1 10rem; width: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.narrow { max-width: 26rem; margin: 8vh auto; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.msg { min-height: 1.2rem; margin: .8rem 0 0; } .msg.bad { color: var(--bad); }
body.auth { padding: 0 16px; }

header.top { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); padding: .6rem 16px; }
header.top .row { justify-content: space-between; }
nav.tabs { display: flex; gap: .25rem; overflow-x: auto; padding-top: .5rem; scrollbar-width: none; }
nav.tabs button { background: transparent; color: var(--muted); border: none; padding: .35rem .7rem; border-radius: 999px; white-space: nowrap; font-weight: 500; }
nav.tabs button[aria-current="page"] { background: var(--chip); color: var(--ink); }
main.app { max-width: 60rem; margin: 0 auto; padding: 1rem 16px 4rem; display: grid; gap: 1rem; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }
.item { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--chip); font-size: .8rem; color: var(--muted); }
.chip.overdue, .chip.shred { color: var(--bad); } .chip.due, .chip.act { color: var(--warn); } .chip.keep { color: var(--accent); } .chip.file, .chip.applied { color: var(--ok); }
.count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; margin-left: .25rem; }
pre.summary { white-space: pre-wrap; font: inherit; background: var(--chip); padding: .8rem; border-radius: 8px; margin: 0; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin-top: .15rem; accent-color: var(--accent); }
.empty { color: var(--muted); padding: .5rem 0; }
.row > * { min-width: 0; }
input[type="file"] { max-width: 100%; }
main.app > *, .grid2 > * { min-width: 0; }
.kidtile { display: grid; place-items: center; min-height: 8rem; text-decoration: none; border-width: 3px; }
.kidname { font-size: 2.2rem; font-weight: 800; margin: 0; }
.kidview { padding-top: .5rem; }
.stars { font-size: 1.8rem; font-weight: 700; }
.kidcards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); margin-top: 1rem; }
.kidcard { position: relative; display: grid; justify-items: center; gap: .5rem; padding: 1rem; background: var(--surface); color: var(--ink);
  border: 3px solid var(--line); border-radius: 18px; font-size: 1.7rem; font-weight: 800; line-height: 1.1; min-height: 12rem; }
.kidcard img { width: 7rem; height: 7rem; object-fit: contain; }
.kidcard.done { opacity: .45; border-color: var(--ok); }
.kidcard .tick { position: absolute; top: .3rem; right: .6rem; color: var(--ok); font-size: 2.4rem; }
.kidempty { font-size: 1.8rem; text-align: center; }
.putstep { cursor: pointer; align-items: center; }
.putstep.done .title { text-decoration: line-through; color: var(--muted); }
.thumb { width: 3.2rem; height: 3.2rem; object-fit: cover; border-radius: 6px; }
.bigcode { font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.kidsection { margin: 1.4rem 0 0; }
.kidcard.small { padding: .6rem; } .kidcard.small img { width: 4rem; height: 4rem; }
.kidcard small { font-size: .85rem; }
.kidcard.picked { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
button.big { font-size: 1.2rem; padding: .8rem 1.1rem; }
.bookpage { font-family: Georgia, "Iowan Old Style", serif; line-height: 1.55; max-height: 28rem; overflow-y: auto; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 8px; }
.bookpage p { margin: 0 0 .5em; text-indent: 1.2em; } .bookpage img { max-width: 100%; }
.bad { color: var(--bad); }
.frames { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; }
.frames a { flex: 0 0 auto; text-align: center; font-size: .75rem; color: var(--muted); text-decoration: none; }
.frames img { display: block; height: 7rem; border-radius: 6px; border: 1px solid var(--line); }
