:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #5f6670;
  --line: #dcd8d0;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --good: #2e7d4f;
  --bad: #b3261e;
  --late-bg: #fff4e5;
  --late-line: #e0a040;
  --late-ink: #9a5b00;
  --chip: #e8e4dc;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --panel: #1f2226;
    --ink: #e8e6e3;
    --muted: #9aa1aa;
    --line: #34383e;
    --accent: #6fa3d6;
    --accent-ink: #0d1217;
    --good: #5fbf85;
    --bad: #ef7a72;
    --late-bg: #2e2413;
    --late-line: #b9822c;
    --late-ink: #f0b860;
    --chip: #2a2e33;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.topnav { display: flex; align-items: center; gap: .9rem; font-size: .92rem; }
.who { color: var(--muted); }
main { max-width: 720px; margin: 0 auto; padding: 1rem 16px 4rem; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.panel.narrow { max-width: 420px; margin: 2rem auto; }
.panel.late, .card.late { border-color: var(--late-line); background: var(--late-bg); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .25rem 0 .75rem; }
.bar h1 { margin: 0; }
.filters { display: flex; gap: .5rem; margin-bottom: 1rem; }
.chip {
  padding: .35rem .9rem; border-radius: 999px; background: var(--chip);
  color: var(--ink); text-decoration: none; font-size: .92rem;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }

.group { margin-bottom: 1.25rem; }
.group h2 { display: flex; align-items: center; gap: .5rem; text-transform: uppercase; letter-spacing: .04em; font-size: .85rem; color: var(--muted); }
.count { background: var(--chip); color: var(--ink); border-radius: 999px; padding: 0 .55rem; font-size: .8rem; }
details.done > summary { list-style: none; cursor: pointer; }
details.done > summary::-webkit-details-marker { display: none; }
details.done > summary h2::before { content: "▸"; }
details.done[open] > summary h2::before { content: "▾"; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem .9rem; margin-bottom: .6rem;
}
.card .title { font-weight: 600; text-decoration: none; color: var(--ink); display: block; }
.card .title:hover { text-decoration: underline; }
.meta { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.meta:empty { display: none; }
.warn, .latetext { color: var(--late-ink); }
.empty { color: var(--muted); font-style: italic; margin: .25rem 0 .75rem; }

details.claim { margin-top: .5rem; }
details.claim > summary { list-style: none; display: inline-block; }
details.claim > summary::-webkit-details-marker { display: none; }
details.claim[open] > summary { display: none; }

.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--chip); color: var(--ink);
  padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; min-height: 44px; line-height: 1.6;
}
.btn.small { padding: .3rem .8rem; min-height: 36px; font-size: .9rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad { background: transparent; border-color: var(--bad); color: var(--bad); }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

form.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin: .5rem 0; }
.row.compact { margin: 0; align-items: center; }
.row.between { justify-content: space-between; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line); }
.grow { flex: 1 1 200px; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .93rem; }
label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=date], textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: .55rem .7rem; width: 100%; min-height: 44px;
}
textarea { resize: vertical; }
input.code { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
input:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: .9rem 0; }
details.sub { border-top: 1px solid var(--line); padding-top: .7rem; margin-top: .7rem; }
details.sub > summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: .5rem; }
details.sub.danger > summary { color: var(--bad); }

.status-line { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.badge { font-size: .78rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--chip); }
.badge.open { background: var(--accent); color: var(--accent-ink); }
.badge.claimed { background: var(--late-line); color: #1a1205; }
.badge.done { background: var(--good); color: #fff; }
.badge.off { background: var(--bad); color: #fff; }
.details { white-space: pre-wrap; margin: .25rem 0 1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.history { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.history li { padding: .4rem 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.when { color: var(--muted); margin-right: .4rem; }

.people { list-style: none; padding: 0; margin: 0; }
.people li { padding: .75rem 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.people li:first-child { border-top: 0; }
.people li.inactive .person-head { opacity: .6; }
.person-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.person-actions input[type=text] { width: auto; flex: 1 1 140px; min-height: 36px; }

.alert, .notice { padding: .7rem .9rem; border-radius: 8px; margin: 0 0 1rem; }
.alert { background: var(--late-bg); border: 1px solid var(--bad); color: var(--bad); }
.notice { background: var(--panel); border: 1px solid var(--good); color: var(--good); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.backlink { text-decoration: none; font-size: .92rem; }
