:root {
  --red: #f42a41;
  --red2: #ff6050;
  --bg: #f4f5f7;
  --card: #ffffff;
  --tx: #17171c;
  --tx2: #90909a;
  --tx3: #b9b9c1;
  --line: #ececf0;
  --brand-brown: #b9662d;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e9eaee;
  color: var(--tx);
}
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ic-14 { width: 14px; height: 14px; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }
.ic-22 { width: 22px; height: 22px; }
.ic-24 { width: 24px; height: 24px; }
img { background: #f0f0f2; }
button { cursor: pointer; font-family: inherit; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 24px rgba(0, 0, 0, .06);
  padding-bottom: 96px;
}
.view { display: none; }
.view.active { display: block; }
.card { background: var(--card); border-radius: var(--radius); }

/* ---------- 首页顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  padding: 10px 14px;
}
.city {
  display: flex; align-items: center; gap: 2px;
  border: none; background: none;
  font-size: 17px; font-weight: 700; color: var(--tx);
  flex: none;
}
.searchbar {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: #f2f3f5; border-radius: 999px;
  padding: 0 4px 0 12px; height: 38px;
  color: var(--tx2);
}
.searchbar input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 16px; color: var(--tx);
}
.searchbar input::placeholder { color: var(--tx3); }
.search-btn {
  flex: none; border: none; color: #fff;
  background: var(--red);
  border-radius: 999px; height: 30px; padding: 0 14px;
  font-size: 13px; font-weight: 600;
}

/* ---------- 分类图标 ---------- */
.cats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 16px 8px 6px;
  background: var(--card);
  border-radius: 0 0 var(--radius) var(--radius);
}
.cat {
  border: none; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 12px; color: var(--tx);
  padding: 2px 0;
}
.cat-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; }

/* ---------- 大牌优惠 ---------- */
.featured { margin: 12px 12px 0; padding: 14px; }
.ftitle { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.hot {
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--red);
  border-radius: 7px 7px 7px 0;
  padding: 2px 6px;
}
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin-top: 12px; }
.fitem img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px;
}
.f-brand { font-size: 13px; font-weight: 600; color: var(--brand-brown); margin-top: 8px; }
.f-name {
  font-size: 13px; color: var(--tx); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.f-price { margin-top: 4px; font-size: 12px; color: var(--red); font-weight: 600; }
.f-price b { font-size: 15px; font-weight: 600; }
.f-price s { font-size: 11px; color: var(--tx3); font-weight: 400; margin-left: 2px; }

/* ---------- 优惠券条 ---------- */
.coupon {
  margin: 12px 12px 0;
  background: #ffeef0;
  border-radius: 999px;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
}
.c-ic { color: var(--red); font-weight: 800; font-size: 15px; }
.c-text { font-size: 13px; color: #6d4348; }
.c-text b { color: var(--red); }
.c-claim {
  margin-left: auto; border: none; background: none;
  color: var(--red); font-size: 13px; font-weight: 600;
}

/* ---------- 筛选 chips ---------- */
.chips {
  display: flex; gap: 8px;
  padding: 14px 12px 4px;
  overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: none; background: var(--card);
  border-radius: 999px; padding: 8px 15px;
  font-size: 14px; color: var(--tx);
}
.chip.active { color: var(--red); font-weight: 700; }

/* ---------- 商品列表 ---------- */
.deallist { padding: 10px 12px 0; display: grid; gap: 10px; }
.deal { padding: 12px; display: flex; gap: 12px; }
.d-img {
  width: 96px; height: 96px; flex: none;
  border-radius: 10px; object-fit: cover;
}
.d-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.d-title {
  font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.d-store { color: var(--brand-brown); font-weight: 600; }
.d-sep { color: #e3e3e8; margin: 0 5px; }
.d-meta {
  margin-top: 6px; font-size: 12px; color: var(--tx2);
  display: flex; justify-content: space-between; gap: 8px;
}
.d-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-priceline {
  margin-top: auto; padding-top: 6px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
}
.d-price { font-size: 12px; color: var(--red); font-weight: 600; }
.d-price b { font-size: 17px; font-weight: 600; }
.d-price s { font-size: 11px; color: var(--tx3); font-weight: 400; margin-left: 2px; }
.d-sub { font-size: 11px; color: var(--red); margin-top: 4px; }
.d-buy {
  flex: none; width: 48px; height: 30px;
  border: none; border-radius: 9px;
  background: linear-gradient(135deg, var(--red2), var(--red));
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 1px;
}
.d-buy.disabled { background: #d9d9de; color: #fff; letter-spacing: 0; font-size: 12px; }

/* ---------- 底部导航 ---------- */
.bottomnav {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  width: min(456px, calc(100% - 24px));
  background: #fff; border-radius: 999px;
  display: flex; padding: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  z-index: 20;
}
.bn {
  flex: 1; border: none; background: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 0; border-radius: 999px;
  font-size: 15px; font-weight: 600; color: var(--tx2);
}
.bn.active { background: #141419; color: #fff; }

/* ---------- 我的订单 ---------- */
.ohead {
  margin: 12px 12px 0; padding: 16px;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.me { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #1f1f28; color: #fff;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 600;
}
.nick { font-size: 16px; font-weight: 600; }
.subline { margin-top: 5px; font-size: 12px; color: var(--tx2); display: flex; align-items: center; gap: 8px; }
.switch {
  border: none; background: #f2f3f5; color: var(--tx2);
  border-radius: 999px; padding: 3px 10px; font-size: 11px;
}
.ohicons { display: flex; gap: 18px; padding-top: 4px; color: var(--tx); }

.otabs {
  margin: 12px 12px 0; padding: 2px 12px;
  display: flex; align-items: center;
}
.otab {
  border: none; background: none;
  padding: 13px 14px; font-size: 15px; color: var(--tx2);
  position: relative;
}
.otab.active { color: var(--tx); font-weight: 700; }
.otab.active::after {
  content: ''; position: absolute;
  left: 50%; transform: translateX(-50%); bottom: 6px;
  width: 16px; height: 3px; border-radius: 2px;
  background: var(--red);
}
.osearch { margin-left: auto; color: var(--tx); cursor: pointer; }

#ordersWrap { padding: 12px 12px 0; display: grid; gap: 10px; }
.order { padding: 14px; }
.o-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.o-store {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 2px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.o-chev { color: var(--tx3); flex: none; }
.o-status { flex: none; font-size: 13px; color: var(--tx2); }
.o-status.paid { color: var(--red); font-weight: 600; }
.o-item { display: flex; gap: 10px; margin-top: 12px; }
.o-item img { width: 68px; height: 68px; border-radius: 8px; object-fit: cover; flex: none; }
.o-mid { flex: 1; min-width: 0; }
.o-title {
  font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.o-time { font-size: 12px; color: var(--tx3); margin-top: 6px; }
.o-tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.o-tags i {
  font-style: normal; font-size: 11px; color: var(--tx2);
  background: #f5f5f7; border-radius: 4px; padding: 3px 7px;
}
.o-right { text-align: right; flex: none; }
.o-amount { font-size: 14px; font-weight: 600; }
.o-qty { font-size: 12px; color: var(--tx3); margin-top: 6px; }
.o-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.o-btn {
  border: 1px solid #dcdce2; background: #fff;
  border-radius: 999px; padding: 8px 16px;
  font-size: 13px; color: var(--tx);
}
.o-btn.primary { border-color: var(--red); color: var(--red); }
.o-btn.solid { border-color: #141419; background: #141419; color: #fff; }

/* ---------- 空态/加载 ---------- */
.empty { text-align: center; padding: 56px 20px; }
.empty-ic { width: 58px; height: 58px; margin: 0 auto; color: var(--tx3); stroke-width: 1.4; }
.empty p { margin-top: 14px; font-size: 14px; color: var(--tx2); }
.empty-go {
  margin-top: 16px; border: none;
  background: #141419; color: #fff;
  border-radius: 999px; padding: 9px 24px; font-size: 13px;
}
.loading { text-align: center; padding: 44px 0; font-size: 13px; color: var(--tx3); }

/* ---------- 手机号查询卡 ---------- */
.pcard { padding: 28px 18px; text-align: center; }
.pcard > p { font-size: 14px; color: var(--tx2); line-height: 1.6; }
.prow { display: flex; gap: 10px; margin-top: 18px; }
.prow input {
  flex: 1; min-width: 0;
  border: 1px solid #e2e2e8; border-radius: 10px;
  padding: 11px 13px; font-size: 16px; outline: none;
}
.prow input:focus { border-color: var(--tx); }
.prow button {
  flex: none; border: none; background: #141419; color: #fff;
  border-radius: 10px; padding: 0 18px; font-size: 14px; font-weight: 600;
}

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translate(-50%, 105%);
  width: min(480px, 100%); z-index: 45;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  transition: transform .28s ease;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-h { display: flex; gap: 12px; }
.sheet-h img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; }
.s-mid { flex: 1; min-width: 0; }
.s-store { font-size: 12px; color: var(--brand-brown); font-weight: 600; }
.s-title { font-size: 15px; line-height: 1.4; margin-top: 4px; }
.s-price { margin-top: 6px; font-size: 12px; color: var(--red); font-weight: 600; }
.s-price b { font-size: 17px; }
.s-price s { font-size: 11px; color: var(--tx3); font-weight: 400; margin-left: 2px; }
.s-close {
  flex: none; width: 28px; height: 28px; border: none;
  background: #f2f3f5; border-radius: 50%; color: var(--tx2);
  display: grid; place-items: center;
}
.s-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; font-size: 14px;
}
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.step { width: 34px; height: 32px; border: none; background: #f8f8fa; font-size: 17px; color: var(--tx); }
.step:disabled { color: var(--tx3); }
#qtyVal { width: 42px; text-align: center; font-size: 15px; font-weight: 600; }
#buyPhone {
  flex: 1; margin-left: 14px;
  border: none; border-bottom: 1px solid #e2e2e8; outline: none;
  font-size: 16px; padding: 6px 2px; background: none;
}
#buyPhone:focus { border-bottom-color: var(--tx); }
.s-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.s-tags i {
  font-style: normal; font-size: 11px; color: var(--tx2);
  background: #f5f5f7; border-radius: 4px; padding: 3px 7px;
}
.s-total { margin-top: 16px; text-align: right; font-size: 13px; color: var(--tx2); }
.s-total b { color: var(--red); font-size: 17px; margin-left: 6px; }
.s-buy {
  margin-top: 14px; width: 100%;
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--red2), var(--red));
  color: #fff; font-size: 16px; font-weight: 700;
  padding: 13px 0;
}
.s-buy:disabled { opacity: .6; }
.s-note { margin-top: 10px; text-align: center; font-size: 11px; color: var(--tx3); }

.succ-ic { width: 56px; height: 56px; margin: 14px auto 0; color: #12b76a; stroke-width: 2; }
#succPart h3 { text-align: center; font-size: 17px; margin-top: 12px; }
.ono { text-align: center; font-size: 12px; color: var(--tx3); margin-top: 6px; }
.succ-btns { display: flex; gap: 10px; margin-top: 20px; }
.succ-btns .o-btn { flex: 1; padding: 11px 0; font-size: 14px; }

.dialog {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.92);
  width: 78%; max-width: 320px; z-index: 50;
  background: #fff; border-radius: 14px; padding: 22px 18px 16px;
  opacity: 0; pointer-events: none; transition: all .2s;
}
.dialog.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.dlg-msg { font-size: 15px; text-align: center; line-height: 1.55; }
.dlg-btns { display: flex; gap: 10px; margin-top: 20px; }
.dlg-btns .o-btn { flex: 1; padding: 10px 0; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%);
  z-index: 60;
  background: rgba(17, 17, 17, .85); color: #fff;
  border-radius: 999px; padding: 9px 18px;
  font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 80%;
}
.toast.show { opacity: 1; }

/* ---------- 收银台 ---------- */
.cashbox { margin: 16px 12px 0; padding: 24px 18px; text-align: center; }
.c-label { font-size: 13px; color: var(--tx2); }
.c-amount { font-size: 24px; font-weight: 600; margin-top: 8px; }
.c-order { margin-top: 10px; font-size: 12px; color: var(--tx3); }
.c-deal {
  margin-top: 6px; font-size: 13px; color: var(--tx2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.paylinks { display: grid; gap: 10px; margin-top: 18px; }
.paylink {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 12px 0;
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.paylink.wxpay { background: #f3f9f4; color: #0f7a3d; border: 1px solid #bfe0cb; }
.paylink.wechat { background: #f3f9f4; color: #17924a; border: 1px solid #cfe8d8; }
.paylink.alipay { background: #eef4fd; color: #1677ff; border: 1px solid #cadef8; }
#paidBtn { margin-top: 16px; }
.cash-back {
  margin-top: 10px; width: 100%;
  border: 1px solid #dcdce2; background: #fff;
  border-radius: 999px; padding: 11px 0;
  font-size: 14px; color: var(--tx);
}

/* ---------- 订单状态色 ---------- */
.o-status.st-unpaid { color: var(--red); font-weight: 600; }
.o-status.st-paid { color: #ef9f18; font-weight: 600; }
.o-status.st-refunded { color: var(--tx2); }
