/* 茶语鲜饮 · 用户端 H5 点单（零依赖设计系统，移动端优先） */
:root {
  --brand: #0f7a52;
  --brand-deep: #0a573b;
  --brand-soft: #e6f4ec;
  --ink: #1c2b24;
  --ink-2: #5c6c63;
  --ink-3: #8d9a93;
  --surface: #ffffff;
  --bg: #f7f5ef;
  --line: #e9e7df;
  --price: #e2543c;
  --warn: #d98a1f;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-s: 10px; --r-m: 14px; --r-l: 20px; --r-pill: 999px;
  --f-xs: 11px; --f-sm: 12px; --f-md: 14px; --f-lg: 16px; --f-xl: 19px; --f-2xl: 24px;
  --tap: 44px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-size: var(--f-md); line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--s2); }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--r-s);
  background: var(--brand); color: #fff; display: grid; place-items: center;
}
.brand-text { font-weight: 800; font-size: var(--f-lg); letter-spacing: .3px; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: var(--f-xs); font-weight: 500; color: var(--ink-3); letter-spacing: 1px; }
.topbar-right { font-size: var(--f-sm); color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); display: inline-block; }
.dot.off { background: var(--ink-3); }

.view { padding: var(--s4) var(--s4) calc(var(--tabbar-h) + var(--safe-b) + var(--s6)); min-height: 60vh; }
.page-head { margin-bottom: var(--s4); }
.page-title { font-size: var(--f-2xl); font-weight: 800; letter-spacing: -.4px; }
.page-sub { font-size: var(--f-sm); color: var(--ink-2); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: var(--s4); margin-bottom: var(--s3); }
.section-title { font-weight: 700; font-size: var(--f-lg); margin: var(--s5) 0 var(--s3); display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--ink-3); }
.small { font-size: var(--f-sm); }
.price { color: var(--price); font-weight: 800; }

.notice { background: var(--brand-soft); color: var(--brand-deep); border-radius: var(--r-s); padding: var(--s3); font-size: var(--f-sm); margin-bottom: var(--s3); }
.notice.warn { background: #fff5e6; color: #8a5a10; }
.notice.err { background: #fdeceb; color: #a3352a; }

.btn {
  min-height: var(--tap); padding: 0 var(--s5); border: 1px solid var(--line);
  border-radius: var(--r-pill); background: var(--surface); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-main { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-ghost { background: var(--brand-soft); color: var(--brand-deep); border-color: transparent; }
.btn-danger { background: #fdeceb; color: #a3352a; border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 var(--s3); font-size: var(--f-sm); }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.btn:disabled { opacity: .5; pointer-events: none; }

.field { margin-bottom: var(--s3); }
.field label { display: block; font-size: var(--f-sm); color: var(--ink-2); margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 9px var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); }
.textarea { min-height: 72px; resize: vertical; }

.chips { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s2); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 34px; padding: 0 var(--s4); border-radius: var(--r-pill);
  background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-size: var(--f-sm); font-weight: 600;
  display: inline-flex; align-items: center;
}
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 分类 + 商品双栏 */
.menu-layout { display: grid; grid-template-columns: 88px 1fr; gap: var(--s3); align-items: start; }
.cat-col { position: sticky; top: 68px; max-height: calc(100vh - 150px); overflow-y: auto; }
.cat-item {
  min-height: 46px; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 6px; border-radius: var(--r-s); font-size: var(--f-sm); color: var(--ink-2); cursor: pointer;
}
.cat-item.on { background: #fff; color: var(--brand-deep); font-weight: 700; box-shadow: 0 2px 10px rgba(15,122,82,.08); }
.dish-card {
  display: flex; gap: var(--s3); background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-m); padding: var(--s3); margin-bottom: var(--s3);
}
.dish-thumb { width: 84px; height: 84px; flex: none; border-radius: var(--r-s); overflow: hidden; background: var(--brand-soft); }
.dish-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dish-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish-name { font-weight: 700; font-size: var(--f-lg); }
.dish-desc { font-size: var(--f-xs); color: var(--ink-3); margin: 2px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish-meta { font-size: var(--f-xs); color: var(--ink-3); }
.dish-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.dish-price { font-size: var(--f-lg); font-weight: 800; color: var(--price); }
.tag { display: inline-block; font-size: var(--f-xs); padding: 1px 7px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-deep); margin-right: 4px; }
.tag.warn { background: #fff3e0; color: #95610f; }
.tag.ok { background: #e7f6ec; color: #156c3c; }
.tag.muted { background: #f0f1ee; color: var(--ink-2); }

.detail-cover { width: 100%; height: 220px; object-fit: cover; border-radius: var(--r-l); background: var(--brand-soft); }
.opt-group { margin-bottom: var(--s4); }
.opt-title { font-weight: 700; margin-bottom: var(--s2); display: flex; justify-content: space-between; }
.opt-list { display: flex; flex-wrap: wrap; gap: var(--s2); }
.opt {
  min-height: 36px; padding: 0 var(--s4); border-radius: var(--r-pill);
  border: 1px solid var(--line); background: #fff; font-size: var(--f-sm);
  display: inline-flex; align-items: center; gap: 4px;
}
.opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }

/* 套餐槽位：按菜品真实分类浏览，候选仍只来自门店勾选的具体菜品 */
.combo-cat-chips { margin-bottom: var(--s2); }
.combo-cat-group { margin-bottom: var(--s3); }
.combo-cat-head { font-size: var(--f-xs); font-weight: 700; color: var(--ink-2); margin-bottom: var(--s2); }

.cart-item { display: flex; gap: var(--s3); align-items: flex-start; }
.cart-thumb { width: 58px; height: 58px; border-radius: var(--r-s); object-fit: cover; flex: none; background: var(--brand-soft); }
.qty { display: inline-flex; align-items: center; gap: var(--s2); }
.qty button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; line-height: 1; }
.total-bar { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) 0; font-weight: 700; }
.total-num { font-size: var(--f-2xl); color: var(--price); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s4) var(--s5); border-left: 2px solid var(--line); margin-left: 5px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline li.pending::before { background: var(--ink-3); }
.timeline .t-time { font-size: var(--f-xs); color: var(--ink-3); }

.state { text-align: center; padding: var(--s8) var(--s4); color: var(--ink-3); }
.state-title { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.state-desc { font-size: var(--f-sm); }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line); backdrop-filter: blur(10px);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: var(--f-xs); color: var(--ink-3); }
.tab svg { width: 21px; height: 21px; }
.tab.on { color: var(--brand); font-weight: 700; }
.badge {
  position: absolute; top: 5px; left: 56%; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--price); color: #fff;
  font-size: 10px; font-style: normal; line-height: 17px; text-align: center;
}
.badge[hidden] { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translate(-50%, 12px); z-index: 60; max-width: 84%;
  background: rgba(28,43,36,.94); color: #fff; padding: 10px var(--s4);
  border-radius: var(--r-pill); font-size: var(--f-sm); opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .2s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { background: linear-gradient(90deg, #f0efe9 25%, #f8f7f2 50%, #f0efe9 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-s); }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view > * { animation: rise .28s ease-out both; }

@media (max-width: 360px) {
  .menu-layout { grid-template-columns: 74px 1fr; }
  .dish-thumb { width: 68px; height: 68px; }
}
