* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f2f3f5;
  color: #1f1f1f;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f2f3f5;
  position: relative;
  box-shadow: 0 0 24px rgba(0,0,0,.08);
}

/* 顶部 */
.topbar {
  background: linear-gradient(135deg, #ff7a45, #ff4d4f);
  color: #fff;
  padding: 14px 16px 12px;
  flex: 0 0 auto;
}
.brand { font-size: 19px; font-weight: 800; letter-spacing: 1px; }
.brand-sub { font-size: 12px; opacity: .92; margin-top: 2px; }

/* 内容区 */
.content { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view { display: none; padding: 12px; }
.view.active { display: block; }

/* 搜索 */
.search {
  display: flex; align-items: center;
  background: #fff; border-radius: 22px;
  padding: 9px 14px; margin-bottom: 10px;
}
.search-ico { font-size: 14px; margin-right: 8px; }
.search input { border: 0; outline: 0; flex: 1; font-size: 14px; background: transparent; }

/* 分类 chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 16px;
  background: #fff; font-size: 13px; color: #555; border: 1px solid #eee; white-space: nowrap;
}
.chip.active { background: #ff4d4f; color: #fff; border-color: #ff4d4f; font-weight: 600; }

/* 商品网格 */
.product-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pcard {
  background: #fff; border-radius: 12px; padding: 12px; position: relative; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.pcard .disc {
  position: absolute; top: 0; right: 0;
  background: #ff4d4f; color: #fff; font-size: 11px;
  padding: 2px 8px; border-bottom-left-radius: 10px; font-weight: 700;
}
.pcard .picon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%; margin: 4px 0 8px;
  background: linear-gradient(135deg, #fff1e8, #ffe0cd); color: #ff7a45;
  font-size: 24px; font-weight: 800; line-height: 1;
}
.pcard .pname { font-size: 13px; line-height: 1.35; height: 35px; overflow: hidden; color: #333; }
.pcard .pno { font-size: 11px; color: #999; margin: 4px 0 6px; }
.pcard .prices { display: flex; align-items: baseline; gap: 6px; }
.pcard .sale { color: #ff4d4f; font-weight: 800; font-size: 17px; }
.pcard .orig { color: #bbb; font-size: 12px; text-decoration: line-through; }
.pcard .buy {
  margin-top: 8px; width: 100%; border: 0; border-radius: 18px;
  background: linear-gradient(135deg, #ff7a45, #ff4d4f); color: #fff;
  font-size: 13px; padding: 7px 0; font-weight: 600;
}
.pcard .buy:active { opacity: .85; }

.hint { text-align: center; color: #aaa; font-size: 12px; padding: 14px 0; }

/* 我的页 */
.balance-card {
  background: linear-gradient(135deg, #ff7a45, #ff4d4f);
  color: #fff; border-radius: 14px; padding: 18px 16px; margin-bottom: 14px;
}
.balance-label { font-size: 13px; opacity: .95; }
.balance-amount { font-size: 32px; font-weight: 800; margin: 4px 0; }
.balance-tip { font-size: 11px; opacity: .9; }
.balance-recharge {
  position: absolute; right: 16px; top: 18px;
  border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.18);
  color: #fff; font-size: 13px; font-weight: 700;
  padding: 5px 14px; border-radius: 16px;
}
.balance-recharge:active { background: rgba(255,255,255,.3); }
.balance-card { position: relative; }
.section-title { font-size: 15px; font-weight: 700; margin: 4px 2px 10px; }
.kf-box { margin: 14px 0 4px; }
.kf-btn {
  width: 100%; border: 0; border-radius: 24px; padding: 12px 0;
  background: linear-gradient(135deg, #1677ff, #4096ff); color: #fff;
  font-size: 15px; font-weight: 700;
}
.kf-btn:active { opacity: .88; }
.rc-presets { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.rc-pre {
  flex: 1; min-width: 60px; text-align: center; padding: 8px 0;
  border: 1px solid #eee; border-radius: 10px; font-size: 14px; color: #555; cursor: pointer;
}
.rc-pre:active { border-color: #ff7a45; color: #ff4d4f; }

.order-list { display: flex; flex-direction: column; gap: 10px; }
.order {
  background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-name { font-size: 14px; font-weight: 600; }
.order-meta { font-size: 12px; color: #999; margin: 6px 0 4px; }
.order-addr { font-size: 12px; color: #666; line-height: 1.4; word-break: break-all; }
.order-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.btn-refund {
  border: 1px solid #ff4d4f; color: #ff4d4f; background: #fff;
  border-radius: 16px; padding: 5px 14px; font-size: 12px; font-weight: 600;
}
.btn-refund:active { background: #fff0f0; }
.order-empty { text-align: center; color: #aaa; font-size: 13px; padding: 40px 0; }

.badge { font-size: 11px; padding: 3px 9px; border-radius: 11px; font-weight: 700; white-space: nowrap; }
.badge-await      { background: #fff1f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.badge-pending    { background: #fff4e6; color: #fa8c16; }
.badge-recharging { background: #e6f4ff; color: #1677ff; }
.badge-completed  { background: #e8f8ee; color: #18a058; }
.badge-refunding  { background: #f3e8ff; color: #8b5cf6; }
.badge-refunded   { background: #f0f0f0; color: #999; }

.mine-foot { text-align: center; margin: 18px 0 6px; }
.link-danger { background: none; border: 0; color: #bbb; font-size: 12px; text-decoration: underline; }

/* 底部 Tab */
.tabbar {
  flex: 0 0 auto; display: flex; background: #fff; border-top: 1px solid #eee;
}
.tab {
  flex: 1; border: 0; background: none; padding: 8px 0 9px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; color: #999;
}
.tab .ti { font-size: 20px; }
.tab.active { color: #ff4d4f; font-weight: 700; }

/* 购买弹层 */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
.mask.show { display: flex; }
.sheet {
  width: 100%; max-width: 480px; background: #fff;
  border-top-left-radius: 16px; border-top-right-radius: 16px;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: up .25s ease;
}
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid #f0f0f0; font-size: 16px; font-weight: 700;
}
.sheet-head .x { border: 0; background: none; font-size: 18px; color: #999; }
.sheet-body { padding: 16px; overflow-y: auto; }

.buy-prod { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px dashed #eee; }
.buy-prod .bi { font-size: 38px; }
.buy-prod .bn { font-size: 15px; font-weight: 600; }
.buy-prod .bp { margin-top: 4px; }
.buy-prod .bp .s { color: #ff4d4f; font-weight: 800; font-size: 18px; }
.buy-prod .bp .o { color: #bbb; font-size: 12px; text-decoration: line-through; margin-left: 6px; }

.field { margin-top: 14px; }
.field label { font-size: 13px; color: #555; display: block; margin-bottom: 6px; }
.field label .req { color: #ff4d4f; }
.field input, .field textarea {
  width: 100%; border: 1px solid #e5e5e5; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; outline: 0; resize: none; font-family: inherit;
}
.field input:focus, .field textarea:focus { border-color: #ff7a45; }

.pay-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid #f0f0f0;
}
.pay-row .pl { font-size: 13px; color: #666; }
.pay-row .pt { color: #ff4d4f; font-weight: 800; font-size: 20px; }
.pay-btn {
  margin-top: 16px; width: 100%; border: 0; border-radius: 24px;
  background: linear-gradient(135deg, #ff7a45, #ff4d4f); color: #fff;
  font-size: 16px; font-weight: 700; padding: 12px 0;
}
.pay-btn:active { opacity: .88; }
.pay-btn:disabled { opacity: .6; }

/* 商品卡图片 */
.pcard .pimg { font-size: 30px; margin: 4px 0 8px; height: 56px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px; }
.pcard .pimg img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }

/* 详情弹层 */
.detail-img { width: 100%; height: 200px; border-radius: 12px; background: #f6f6f6; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 14px; }
.detail-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.detail-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(135deg, #fff1e8, #ffe0cd); color: #ff7a45;
  font-size: 44px; font-weight: 800; line-height: 1;
}
.detail-name { font-size: 19px; font-weight: 800; }
.detail-prices { display: flex; align-items: baseline; gap: 8px; margin: 8px 0; }
.detail-prices .sale { color: #ff4d4f; font-weight: 800; font-size: 22px; }
.detail-prices .orig { color: #bbb; font-size: 13px; text-decoration: line-through; }
.detail-prices .disc2 { background: #ff4d4f; color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 8px; font-weight: 700; }
.detail-sales { font-size: 12px; color: #999; margin-bottom: 10px; }
.detail-desc { font-size: 14px; color: #444; line-height: 1.6; background: #fafafa; border-radius: 10px; padding: 12px; margin-bottom: 16px; word-break: break-all; }

/* 收款码支付 */
.qr-wrap { margin-top: 16px; padding: 14px; background: #f7f8fa; border-radius: 12px; text-align: center; }
.qr-title { font-size: 13px; color: #555; margin-bottom: 10px; }
.qr-img { width: 180px; height: 180px; object-fit: contain; background: #fff; border-radius: 8px; padding: 6px; }
.qr-tip { font-size: 13px; color: #f0883a; padding: 20px 6px; }
.qr-amount { margin-top: 10px; font-size: 14px; color: #333; }
.qr-amount span { color: #ff4d4f; font-weight: 800; font-size: 18px; }

/* 转账账户 */
.transfer-box { margin-top: 12px; padding: 12px; background: #eef7ff; border: 1px dashed #91caff; border-radius: 10px; }
.transfer-title { font-size: 13px; color: #1677ff; font-weight: 700; margin-bottom: 6px; }
.transfer-text { font-size: 14px; color: #333; line-height: 1.6; word-break: break-all; white-space: pre-wrap; }

/* 支付方式选择 */
.pm-head { margin-top: 18px; font-size: 13px; color: #555; font-weight: 600; }
.pm-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.pm-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1.5px solid #eee; border-radius: 12px;
  background: #fff; cursor: pointer; transition: border-color .15s, background .15s;
}
.pm-opt.active { border-color: #ff7a45; background: #fff7f2; }
.pm-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pm-name { font-size: 14px; font-weight: 700; color: #333; }
.pm-sub { font-size: 12px; color: #999; }
.pm-check {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #ddd;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: transparent; flex: 0 0 auto;
}
.pm-opt.active .pm-check { background: #ff7a45; border-color: #ff7a45; color: #fff; }
.pm-panel { margin-top: 4px; }
.pay-note { margin-top: 8px; font-size: 11px; color: #999; text-align: center; line-height: 1.6; }

/* 余额支付 */
.bal-box { margin-top: 14px; padding: 6px 14px; background: #f7f8fa; border-radius: 12px; }
.bal-line { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #666; padding: 8px 0; }
.bal-line + .bal-line { border-top: 1px dashed #e8e8e8; }
.bal-line b { font-size: 18px; color: #333; font-weight: 800; }
.bal-line b.neg { color: #ff4d4f; }


/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 22px; z-index: 99;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }

/* 未登录提示 */
.login-prompt {
  background: #fff; border-radius: 14px; padding: 36px 20px; margin-top: 10px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.login-prompt .lp-ico { font-size: 46px; }
.login-prompt .lp-title { font-size: 14px; color: #888; margin: 12px 0 18px; }
.lp-btn {
  border: 0; border-radius: 24px; padding: 11px 40px; font-size: 15px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #ff7a45, #ff4d4f);
}
.lp-btn:active { opacity: .88; }

/* 已登录用户条 */
.user-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 2px 14px;
}
.user-bar .ub-ico { font-size: 22px; }
.user-bar .ub-name { font-size: 16px; font-weight: 800; color: #333; flex: 1; }
.ub-logout {
  border: 1px solid #eee; background: #fff; color: #999; font-size: 13px;
  padding: 5px 14px; border-radius: 16px;
}
.ub-logout:active { background: #f5f5f5; }

/* 登录 / 注册弹层 */
.auth-tabs { display: flex; gap: 24px; margin-bottom: 14px; }
.auth-tab {
  font-size: 16px; color: #999; padding: 4px 0; position: relative; cursor: pointer; font-weight: 600;
}
.auth-tab.active { color: #ff4d4f; }
.auth-tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: #ff4d4f; border-radius: 2px;
}
.auth-tip { margin-top: 12px; text-align: center; font-size: 13px; color: #ff4d4f; min-height: 18px; }
.auth-tip:empty { margin: 0; }
