:root {
  --green: #2f6b4f;
  --green-soft: #e6f0ea;
  --ink: #1d2420;
  --muted: #6b756f;
  --line: #e3e7e4;
  --bg: #f7f8f6;
  --card: #ffffff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green: #6fbf95;
    --green-soft: #1f3329;
    --ink: #e9eeea;
    --muted: #9aa59f;
    --line: #2c3430;
    --bg: #121614;
    --card: #1a1f1c;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 0;
}
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
h1 { font-size: 18px; margin: 0; }
.who { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.progress { height: 4px; background: var(--line); border-radius: 2px; margin: 10px 0 0; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--green); transition: width .25s; }
.tabs { display: flex; gap: 4px; }
.tab {
  flex: 1; background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 0; font: inherit; font-weight: 600; color: var(--muted);
}
.tab.active { color: var(--green); border-bottom-color: var(--green); }
main { max-width: 640px; margin: 0 auto; padding: 8px 12px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; padding: 6px 4px; }
.toggle { display: flex; gap: 6px; align-items: center; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 6px; }
.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.items li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.items li:first-child { border-top: 0; }
.items input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.items label { flex: 1; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; min-height: 28px; }
.name { font-weight: 500; }
.qty { color: var(--green); font-size: 14px; }
.for { flex-basis: 100%; color: var(--muted); font-size: 12px; }
li.checked .name, li.checked .qty { text-decoration: line-through; color: var(--muted); }
.del { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 8px; }
.add {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.add input, .add select {
  font: inherit; font-size: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); min-width: 0;
}
#add-name { flex: 3; }
#add-qty { flex: 1; }
#add-section { flex: 1.4; }
.add button { flex: none; width: 44px; border: 0; border-radius: 10px; background: var(--green); color: #fff; font-size: 24px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.day h3 { margin: 0 0 6px; font-size: 16px; display: flex; justify-content: space-between; }
.pro { color: var(--green); font-size: 14px; font-weight: 600; }
.day dl { display: grid; grid-template-columns: 78px 1fr; gap: 4px 10px; margin: 0; font-size: 14px; }
.day dt { color: var(--muted); }
.day dd { margin: 0; }
.notes { color: var(--muted); font-size: 13px; padding-left: 18px; }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; z-index: 10;
}
.center { max-width: 360px; margin: 18vh auto 0; padding: 0 20px; text-align: center; }
.center p { color: var(--muted); }
.btn {
  display: block; margin: 12px 0; padding: 14px; border-radius: 12px; text-decoration: none;
  background: var(--green); color: #fff; font-weight: 600;
}
.btn.alt { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
