:root { --ink:#16211f; --muted:#64716e; --line:#e3e8e6; --bg:#f5f7f6; --card:#fff; --brand:#0f766e; --sale:#c2410c; --saleBg:#fff3e8; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin:0; font:17px/1.4 -apple-system, "Segoe UI", Arial, sans-serif; color:var(--ink); background:var(--bg); padding-bottom:calc(92px + env(safe-area-inset-bottom)); }
button { font:inherit; color:inherit; border:0; background:none; cursor:pointer; }
a { color:inherit; }
header { display:flex; justify-content:space-between; align-items:center; padding:14px 16px 6px; max-width:720px; margin:auto; }
h1 { margin:0; font-size:24px; }
h2 { font-size:15px; color:var(--muted); margin:22px 16px 6px; font-weight:600; }
.sub { padding:2px 0; color:var(--muted); font-size:14px; text-align:right; text-decoration:underline dotted; }
.sync { width:10px; height:10px; border-radius:50%; background:#22c55e; }
.sync.busy { background:#f59e0b; } .sync.off { background:#ef4444; }

.add { position:sticky; top:0; z-index:5; background:var(--bg); padding:8px 12px; max-width:720px; margin:auto; }
#q { width:100%; font:inherit; font-size:18px; padding:13px 14px; border:2px solid var(--brand); border-radius:12px; background:#fff; outline:none; -webkit-appearance:none; }
.pickHint { font-size:14px; color:var(--brand); padding:6px 4px 0; }
.suggest { list-style:none; margin:6px 0 0; padding:0; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 8px 24px rgba(0,0,0,.12); max-height:60vh; overflow:auto; }
.suggest li { display:flex; gap:10px; justify-content:space-between; align-items:center; padding:11px 14px; border-bottom:1px solid var(--line); cursor:pointer; }
.suggest li:last-child { border-bottom:0; }
.suggest li.free { color:var(--brand); font-weight:600; }
.suggest .nm { min-width:0; }
.suggest small, .row small { display:block; color:var(--muted); font-size:13px; }
.price { white-space:nowrap; text-align:left; font-weight:600; }
.price s { color:var(--muted); font-weight:400; font-size:13px; margin-inline-start:4px; }
.price.sale b, .saleTxt { color:var(--sale); }
.badge { display:inline-block; background:var(--saleBg); color:var(--sale); border-radius:6px; padding:1px 7px; font-size:13px; font-weight:600; margin-top:3px; }

main { max-width:720px; margin:auto; }
.list { list-style:none; margin:6px 12px; padding:0; background:var(--card); border-radius:14px; border:1px solid var(--line); }
.list:empty { display:none; }
.row { display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center; padding:10px 12px; border-bottom:1px solid var(--line); }
.row:last-child { border-bottom:0; }
.check { width:30px; height:30px; border-radius:50%; border:2px solid #9aa8a4; display:grid; place-items:center; font-size:18px; color:#fff; flex:none; }
.done .check { background:var(--brand); border-color:var(--brand); }
.done .nm { text-decoration:line-through; color:var(--muted); }
.row .nm { min-width:0; }
.row .nm a { text-decoration:none; font-weight:600; }
.row .nm a::after { content:" ↗"; color:var(--brand); font-weight:400; font-size:14px; }
.row .match { color:var(--brand); font-size:13px; text-decoration:underline; padding:0; }
.side { display:flex; flex-direction:column; align-items:flex-end; gap:6px; }
.qty { display:flex; align-items:center; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.qty button { width:34px; height:34px; font-size:20px; background:#f0f4f3; }
.qty span { min-width:28px; text-align:center; font-weight:600; }
.empty { text-align:center; color:var(--muted); margin:40px 20px; }

footer { position:fixed; inset:auto 0 0 0; background:#fff; border-top:1px solid var(--line); padding:10px 12px calc(10px + env(safe-area-inset-bottom)); display:flex; gap:8px; align-items:center; justify-content:center; z-index:6; }
.total { display:flex; flex-direction:column; line-height:1.15; margin-inline-end:auto; }
.total span { font-size:12px; color:var(--muted); } .total b { font-size:20px; }
.primary { background:var(--brand); color:#fff; padding:13px 16px; border-radius:12px; font-weight:700; }
.ghost { border:1px solid var(--line); background:#fff; padding:12px 14px; border-radius:12px; font-weight:600; }
.small { padding:7px 12px; border-radius:9px; font-size:15px; white-space:nowrap; }

.sheet { position:fixed; inset:0; background:var(--bg); z-index:10; display:flex; flex-direction:column; }
.sheet[hidden] { display:none; }
.sheetHead { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; background:#fff; border-bottom:1px solid var(--line); }
.sheetHead h2 { margin:0; font-size:20px; color:var(--ink); }
.sheetBody { overflow:auto; padding:0 0 40px; max-width:720px; width:100%; margin:auto; -webkit-overflow-scrolling:touch; }
.summary { margin:12px; padding:14px 16px; background:var(--brand); color:#fff; border-radius:14px; }
.summary b { font-size:28px; display:block; } .summary span { opacity:.9; font-size:15px; display:block; }
.card { margin:8px 12px; padding:12px 14px; background:#fff; border:1px solid var(--line); border-radius:14px; }
.card .top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.card .alt { display:flex; justify-content:space-between; gap:10px; align-items:center; padding-top:10px; margin-top:10px; border-top:1px dashed var(--line); }
.card small { display:block; color:var(--muted); font-size:13px; }
.note { margin:6px 16px; color:var(--muted); font-size:14px; }
.storeOpt { display:block; width:100%; text-align:right; }
.storeOpt.on { border-color:var(--brand); box-shadow:0 0 0 1px var(--brand); }
