:root {
  --bg: #f4f1ea; --card: #fffdf8; --ink: #1d2b24; --muted: #6b7068; --line: #e2ddd1;
  --accent: #2f6b4f; --accent-ink: #fff; --sun: #e0a526; --warn: #b4442c; --cart: #2d6fa3; --skip: #9a9a92;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141a17; --card: #1c2420; --ink: #e9ece6; --muted: #9aa39b; --line: #2c3631; --accent: #5aa57f; --cart: #5b9bd0; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: #1d2b24; color: #f4f1ea; }
.title { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 18px; }
.who { display: flex; gap: 8px; align-items: center; font-size: 14px; opacity: .9; }
nav { position: sticky; top: calc(48px + env(safe-area-inset-top)); z-index: 4; display: flex; background: var(--card); border-bottom: 1px solid var(--line); }
nav button { flex: 1; padding: 12px 4px; border: 0; background: none; color: var(--muted); font-size: 15px; font-weight: 600; border-bottom: 3px solid transparent; }
nav button.on { color: var(--ink); border-bottom-color: var(--sun); }
main { max-width: 760px; margin: 0 auto; padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); }
.tab { display: none; } .tab.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.center { text-align: center; margin: 15vh auto; max-width: 360px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.stat b { display: block; font-size: 20px; } .stat span { font-size: 12px; color: var(--muted); }
.bar { grid-column: 1 / -1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.filters { position: sticky; top: calc(95px + env(safe-area-inset-top)); z-index: 3; background: var(--bg); padding: 4px 0 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 7px 12px; border-radius: 999px; font-size: 14px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.small { padding: 3px 9px; font-size: 12px; background: transparent; color: inherit; border-color: rgba(255,255,255,.4); }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; min-width: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; width: 100%; }
textarea { min-height: 60px; }
.toggle { flex: none; display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.toggle input { width: auto; }
.store-head { margin: 14px 2px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.store-head h3 { margin: 0; font-size: 17px; }
.store-head small { color: var(--muted); }
.store-note { font-size: 13px; color: var(--muted); margin: 0 2px 8px; }
.store-note a { color: var(--accent); }
.item { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.item.need { border-left-color: var(--sun); } .item.cart { border-left-color: var(--cart); }
.item.bought, .item.have { border-left-color: var(--accent); } .item.skip { border-left-color: var(--skip); opacity: .6; }
.item .top { display: flex; justify-content: space-between; gap: 10px; }
.item .name { font-weight: 650; }
.item .price { text-align: right; white-space: nowrap; font-weight: 650; }
.item .price small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.meta { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.meta a, .meta button.link { color: var(--accent); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; }
.sku { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--ink); background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.check { font-size: 13px; background: rgba(224,165,38,.15); border-radius: 8px; padding: 6px 8px; margin-top: 8px; }
.status { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.status button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 9px 2px; font-size: 14px; font-weight: 600; }
.status button.on[data-s=need] { background: var(--sun); color: #1d2b24; border-color: var(--sun); }
.status button.on[data-s=cart] { background: var(--cart); color: #fff; border-color: var(--cart); }
.status button.on[data-s=bought], .status button.on[data-s=have] { background: var(--accent); color: #fff; border-color: var(--accent); }
.status button.on[data-s=skip] { background: var(--skip); color: #fff; border-color: var(--skip); }
.more { margin-top: 8px; }
.more summary { font-size: 13px; color: var(--muted); cursor: pointer; }
.more .row { margin-top: 8px; }
.by { font-size: 12px; color: var(--muted); margin-top: 6px; }
.add summary { padding: 12px; text-align: center; color: var(--accent); font-weight: 600; cursor: pointer; }
.add form { display: grid; gap: 8px; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 12px; font-size: 16px; font-weight: 700; }
.phase h3 { margin: 0 0 6px; font-size: 16px; display: flex; justify-content: space-between; }
.phase h3 small { color: var(--muted); font-weight: 500; }
.step { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.step input[type=checkbox] { width: 24px; height: 24px; flex: none; accent-color: var(--accent); margin-top: 1px; }
.step .t { font-weight: 550; }
.step.done .t { text-decoration: line-through; color: var(--muted); }
.step.warn .t::before { content: "⚠ "; color: var(--warn); }
.step .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.step .note { margin-top: 6px; font-size: 14px; padding: 6px 8px; }
.q { padding: 8px 0; border-top: 1px solid var(--line); } .q:first-of-type { border-top: 0; }
.q p { margin: 0 0 6px; font-weight: 550; }
.prose h2 { font-size: 16px; margin: 16px 0 6px; } .prose h2:first-child { margin-top: 0; }
h2 { font-size: 17px; margin: 0 0 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.muted { color: var(--muted); font-size: 14px; }
.warn { color: var(--warn); font-weight: 600; }
.log-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-row time { color: var(--muted); flex: none; width: 92px; font-size: 12px; }
#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 9px 14px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
#login { position: fixed; inset: 0; background: var(--bg); z-index: 10; }
