:root {
  --bg: #f5f6f8; --card: #fff; --text: #1f2329; --muted: #7a818c; --line: #e6e8eb;
  --primary: #12a05c; --primary-dark: #0d7f48; --danger: #d93026; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-tap-highlight-color: transparent; }
#app { max-width: 720px; margin: 0 auto; padding: 0 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
.req { color: var(--danger); }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

.hero { padding: 20px 4px 8px; }
.hero h1 { font-size: 22px; margin: 0 0 4px; }
.hero p { margin: 4px 0; }
.notice { white-space: pre-line; line-height: 1.6; font-size: 14px; background: #fff7e6; border: 1px solid #ffe2b0; color: #8a5a00; padding: 8px 10px; border-radius: 8px; }
.deadline { font-size: 13px; color: var(--muted); }

.section { background: var(--card); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.section h2 { font-size: 17px; margin: 4px 0 12px; }

.sticky-tools { position: sticky; top: 0; background: var(--card); z-index: 5; padding: 8px 0 6px; margin: -12px -12px 8px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.search { width: 100%; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px; font-size: 15px; outline: none; background: #f7f8fa; }
.search:focus { border-color: var(--primary); background: #fff; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 16px; padding: 5px 14px; font-size: 14px; }
.cats button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.card img, .card .noimg { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #eef0f3; }
.card .noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.card .info { padding: 8px 8px 6px; flex: 1; }
.card .name { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .spec { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .row { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; }
.price { color: #e0432d; font-weight: 700; font-size: 15px; }
.price small { font-size: 11px; font-weight: 400; }
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--primary); background: #fff; color: var(--primary); font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.stepper button.plus { background: var(--primary); color: #fff; }
.stepper button:disabled { opacity: .35; }
.stepper .qty { min-width: 26px; text-align: center; font-size: 15px; }
.stepper .qty:empty { display: none; }
.stepper.zero button.minus, .stepper.zero .qty { display: none; }

form label { display: block; margin-bottom: 12px; font-size: 14px; color: #444; }
form input, form select, form textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 16px; background: #fff; color: var(--text); outline: none; }
form input:focus, form select:focus, form textarea:focus { border-color: var(--primary); }
form textarea { resize: vertical; }
.area { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.area select { margin-top: 4px; padding: 10px 6px; }

.spacer { height: 84px; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; z-index: 20; }
.bar-info { flex: 1; border: 0; background: none; text-align: left; font-size: 14px; color: var(--text); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 0; }
.bar-total { color: #e0432d; font-weight: 700; font-size: 18px; }
.bar-limit { font-size: 12px; color: var(--muted); width: 100%; }
.bar-limit.over { color: var(--danger); }
button.primary { background: var(--primary); color: #fff; border: 0; border-radius: 22px; padding: 11px 28px; font-size: 16px; font-weight: 600; }
button.primary:active { background: var(--primary-dark); }
button.primary:disabled { background: #b8c2bd; }
button.primary.wide { width: 100%; margin-top: 16px; }
button.link { border: 0; background: none; color: var(--primary); font-size: 14px; }

.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-mask { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 16px 16px 0 0; max-height: 70vh; overflow: auto; padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eef0f3; }
.cart-item .ci-name { flex: 1; font-size: 14px; }
.cart-item .ci-sub { font-size: 12px; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-body { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 420px; max-height: 85vh; overflow: auto; }
.modal-body h2 { margin: 0 0 12px; font-size: 18px; }
.receipt { font-size: 14px; }
.receipt dt { color: var(--muted); font-size: 12px; margin-top: 8px; }
.receipt dd { margin: 0; }
.receipt table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.receipt td { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.receipt td:last-child { text-align: right; white-space: nowrap; }

.closed { text-align: center; padding: 40px 12px; color: var(--muted); }
.loading .section, .loading .bar { visibility: hidden; }

.sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 0 0 6px; }
.sections button { border: 1px solid var(--line); background: #f7f8fa; color: var(--text); border-radius: 10px; padding: 10px 4px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.sections button small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.sections button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sections button.active small { color: rgba(255,255,255,.85); }
.price s { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.card .ship { display: inline-block; font-size: 11px; color: #0d7f48; background: #e8f7ee; border-radius: 4px; padding: 0 5px; margin: 4px 8px 0; }
.card .name { -webkit-line-clamp: 3; }
.card .spec { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

#nameNote { display: block; margin-top: 4px; }

.receipt tr.total td { border-top: 2px solid var(--text); border-bottom: 0; padding-top: 8px; font-weight: 700; font-size: 16px; color: #e0432d; }
.receipt tr.total td:first-child { color: var(--text); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 4px; font-size: 15px; }
.cart-total b { color: #e0432d; font-size: 20px; }
