:root {
  --wx-green: #07c160;
  --wx-green-dark: #06ad56;
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --sub: #888;
  --red: #fa5151;
  --orange: #ff976a;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding-bottom: 76px;
}
.app-bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--wx-green); color: #fff;
  text-align: center; padding: 14px; font-size: 17px; font-weight: 600;
}
.card {
  background: var(--card); border-radius: var(--radius);
  margin: 12px; padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.btn {
  display: block; width: 100%; border: none; border-radius: 24px;
  padding: 13px; font-size: 16px; font-weight: 600; color: #fff;
  background: var(--wx-green); cursor: pointer; transition: .15s;
}
.btn:active { background: var(--wx-green-dark); }
.btn.disabled { background: #c8c9cc; }
.btn.ghost { background: #fff; color: var(--wx-green); border: 1px solid var(--wx-green); }
.input {
  width: 100%; padding: 12px 14px; border: 1px solid #e5e5e5;
  border-radius: 10px; font-size: 15px; margin-bottom: 12px; outline: none;
}
.input:focus { border-color: var(--wx-green); }
.row { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--sub); font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #e8f8ee; color: var(--wx-green); }
.tag.win { background: #fff0e8; color: var(--orange); }
.tag.lose { background: #fdeaea; color: var(--red); }
.price { color: var(--wx-green); font-weight: 700; font-size: 22px; }
.product-img { width: 100%; height: 180px; object-fit: cover; border-radius: 12px; background: #eee; }
.progress { height: 10px; background: #eee; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.progress > i { display: block; height: 100%; background: var(--wx-green); }
.avatars { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #d8f3e2;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--wx-green-dark);
  position: relative; border: 2px solid #fff;
}
.avatar.win { background: #ffe7d4; color: var(--orange); }
.avatar .crown { position: absolute; top: -10px; right: -4px; font-size: 14px; }
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex; background: #fff;
  border-top: 1px solid #eee; z-index: 20;
}
.bottom-nav button {
  flex: 1; border: none; background: #fff; padding: 10px 0; font-size: 13px; color: var(--sub); cursor: pointer;
}
.bottom-nav button.active { color: var(--wx-green); font-weight: 600; }
.toast {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 100; max-width: 80%; text-align: center;
}
.center { text-align: center; }
.mt { margin-top: 12px; }
.hidden { display: none !important; }
.badge { background: var(--red); color:#fff; border-radius: 10px; font-size: 11px; padding: 1px 6px; }
.kv { display:flex; justify-content:space-between; padding: 9px 0; border-bottom: 1px dashed #f0f0f0; font-size: 14px; }
.kv:last-child { border-bottom: none; }

/* 页面内弹窗（替代被预览窗口屏蔽的原生 prompt） */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 18px;
  width: 100%; max-width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.modal h4 { font-size: 16px; margin-bottom: 12px; }
.modal .input { margin-bottom: 4px; }

/* 分类横向滚动 tab */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px; background: #fff; border-bottom: 1px solid #f0f0f0; -webkit-overflow-scrolling: touch; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 auto; border: 1px solid #e5e5e5; background: #fff; color: var(--sub); border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.cat.active { background: var(--wx-green); color: #fff; border-color: var(--wx-green); }

/* 商品列表网格 */
#mall-list { padding: 0 12px; }
.pcard { display: flex; background: #fff; border-radius: 12px; overflow: hidden; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.04); cursor: pointer; transition: .15s; }
.pcard:active { transform: scale(.99); }
.pcard-img { width: 110px; height: 110px; object-fit: cover; flex: 0 0 auto; background: #eee; }
.pcard-body { flex: 1; padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.pcard-name { font-size: 15px; font-weight: 600; }
.pcard-body .row { align-items: flex-end; }

/* 详情页 */
.detail-top { padding: 10px 12px; background: var(--wx-green); }
.detail-top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.7); background: transparent; }
.detail-img { width: 100%; border-radius: 10px; margin: 6px 0; background: #eee; }
.detail-p { font-size: 14px; line-height: 1.7; color: #333; margin: 6px 0; white-space: pre-wrap; word-break: break-word; }

/* 后台商品列表 */
.prod-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #f0f0f0; }
.prod-row:last-child { border-bottom: none; }
.prod-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; background: #eee; }
.prod-meta { flex: 1; }
.prod-acts { display: flex; gap: 6px; }
.detail-block { border: 1px solid #f0f0f0; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.detail-thumb { width: 100%; border-radius: 8px; background: #eee; }
.detail-text { font-size: 14px; line-height: 1.6; margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; }

/* 商品卡片内的参团入口（每个商品各自参团） */
.btn.sm { width: auto; padding: 7px 16px; font-size: 13px; border-radius: 18px; align-self: flex-start; flex: 0 0 auto; }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard-body .progress { margin: 2px 0 4px; height: 8px; }
.tag.gray { background: #f2f3f5; color: #999; }

/* 进行中的拼团概览 / 参团商品选择行 */
.og-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #f0f0f0; cursor: pointer; }
.og-row:last-child { border-bottom: none; }
.og-row:active { opacity: .7; }
.og-meta { flex: 1; font-size: 14px; }
.pick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #f0f0f0; cursor: pointer; }
.pick-row:active { opacity: .7; }
.modal .kv { padding: 6px 0; font-size: 13px; }
.modal textarea.input { resize: vertical; line-height: 1.5; }

/* 后台订单（待发货/已发货/已收货） */
.btn.ghost.on { background: var(--wx-green); color: #fff; border-color: var(--wx-green); }
.order-row { border: 1px solid #f0f0f0; border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #fff; }
.order-row .kv { font-size: 13px; padding: 6px 0; }
.order-row .kv b { font-weight: 600; }
