:root {
  --primary: #ff4e2e;
  --primary-dark: #e8431f;
  --gradient: linear-gradient(135deg, #ff6a3d, #ff2e63);
  --amber: #ff9f1a;
  --green: #17b978;
  --blue: #3d7bfd;
  --text: #23262f;
  --text-2: #7b7f8c;
  --text-3: #b6bac4;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #eceef1;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button { font-family: inherit; border: none; cursor: pointer; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; border: none; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 64px; }

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  height: 48px; background: var(--card); border-bottom: 1px solid var(--line);
  font-size: 16px; font-weight: 600;
}
.topbar .back { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); padding: 8px 12px; font-size: 18px; color: var(--text); }
.topbar .right { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--primary); font-weight: 500; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  height: 56px; background: var(--card); border-top: 1px solid var(--line);
  display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-3); font-size: 11px; }
.tabbar .tab.active { color: var(--primary); }
.tabbar .tab svg { width: 22px; height: 22px; }

/* 通用卡片 */
.card { background: var(--card); border-radius: var(--radius); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 44px; padding: 0 22px; border-radius: 22px; font-size: 15px; font-weight: 600;
  background: var(--gradient); color: #fff; transition: opacity .15s;
}
.btn:active { opacity: .85; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.small { height: 32px; padding: 0 16px; font-size: 13px; border-radius: 16px; }
.btn.plain { background: #fff4f0; color: var(--primary); }
.btn.disabled { opacity: .5; pointer-events: none; }
.btn.green { background: var(--green); }

.empty { text-align: center; color: var(--text-3); padding: 60px 0; font-size: 13px; }
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: .4; }

/* 首页 */
.searchbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); }
.searchbar .box {
  flex: 1; display: flex; align-items: center; gap: 6px; background: #f2f3f5; border-radius: 18px;
  padding: 8px 14px; color: var(--text-3);
}
.searchbar .box input { flex: 1; background: none; font-size: 13px; }
.searchbar .cart { position: relative; padding: 4px; color: var(--text); }
.searchbar .cart .badge {
  position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--primary); color: #fff; font-size: 10px; border-radius: 8px; line-height: 16px; text-align: center;
}
.banner { margin: 12px 14px; border-radius: var(--radius); overflow: hidden; position: relative; }
.banner img { width: 100%; height: 150px; object-fit: cover; }
.banner .dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.banner .dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.5); }
.banner .dots i.on { background: #fff; width: 14px; }

.cats { display: flex; gap: 8px; padding: 4px 14px 10px; overflow-x: auto; }
.cats .chip {
  flex-shrink: 0; padding: 6px 16px; border-radius: 16px; background: var(--card); color: var(--text-2); font-size: 13px;
  border: 1px solid var(--line);
}
.cats .chip.on { background: #fff1ec; color: var(--primary); border-color: #ffd5c8; font-weight: 600; }

.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 4px 14px 14px; }
.pcard { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.pcard .thumb { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pcard .info { padding: 10px 12px 12px; }
.pcard .name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .sub { font-size: 11px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.pcard .price { color: var(--primary); font-size: 17px; font-weight: 700; }
.pcard .price small { font-size: 11px; font-weight: 400; }
.pcard .cm { font-size: 10px; color: var(--amber); background: #fff8ec; padding: 2px 6px; border-radius: 8px; }

/* 商品详情 */
.detail .hero { background: var(--card); }
.detail .hero img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.detail .body { padding: 14px; }
.detail .price-line { display: flex; align-items: baseline; gap: 8px; }
.detail .price { color: var(--primary); font-size: 26px; font-weight: 800; }
.detail .cm-tag { font-size: 11px; color: var(--amber); background: #fff8ec; padding: 3px 8px; border-radius: 8px; }
.detail .name { font-size: 17px; font-weight: 700; margin-top: 8px; }
.detail .sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.detail .meta { display: flex; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.detail .desc { margin-top: 14px; padding: 14px; font-size: 13px; color: var(--text-2); line-height: 1.8; }
.detail .ops {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); z-index: 30;
}
.detail .ops .btn { flex: 1; height: 42px; border-radius: 21px; }

/* 数量选择 */
.qty { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 30px; height: 30px; background: #f7f8fa; font-size: 16px; color: var(--text-2); }
.qty span { width: 36px; text-align: center; font-size: 14px; }

/* 购物车 */
.cart-item { display: flex; gap: 12px; padding: 14px; align-items: center; }
.cart-item .thumb { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; }
.cart-item .mid { flex: 1; min-width: 0; }
.cart-item .name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item .cm { font-size: 10px; color: var(--amber); margin-top: 3px; }
.cart-item .row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cart-item .price { color: var(--primary); font-weight: 700; }
.cartbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 56px; width: 100%; max-width: 480px;
  display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  background: var(--card); border-top: 1px solid var(--line); z-index: 25;
}
.cartbar .total { font-size: 14px; }
.cartbar .total b { color: var(--primary); font-size: 20px; }

/* 列表页通用 */
.section { padding: 12px 14px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }

/* 订单 */
.otabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 48px; z-index: 10; }
.otabs .ot { flex: 1; text-align: center; padding: 12px 0; font-size: 13px; color: var(--text-2); position: relative; }
.otabs .ot.on { color: var(--primary); font-weight: 600; }
.otabs .ot.on::after { content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 20px; height: 3px; border-radius: 2px; background: var(--primary); }
.ocard { margin: 10px 14px; overflow: hidden; }
.ocard .head { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px dashed var(--line); font-size: 12px; color: var(--text-2); }
.ocard .head .st { color: var(--primary); font-weight: 600; }
.ocard .oitem { display: flex; gap: 10px; padding: 10px 14px; align-items: center; }
.ocard .oitem img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.ocard .oitem .mid { flex: 1; min-width: 0; }
.ocard .oitem .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocard .oitem .x { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.ocard .foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); }
.ocard .foot .amt { font-size: 13px; }
.ocard .foot .amt b { color: var(--primary); font-size: 16px; }
.ocard .foot .btns { display: flex; gap: 8px; }

/* 表单 */
.form { padding: 12px 14px; }
.form .fcard { padding: 0 14px; }
.form .frow { display: flex; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.form .frow:last-child { border-bottom: none; }
.form .label { width: 76px; color: var(--text-2); font-size: 14px; flex-shrink: 0; }
.form .frow input, .form .frow textarea { flex: 1; font-size: 14px; }
.form .frow textarea { resize: none; min-height: 48px; padding: 4px 0; }
.form .tip { color: var(--text-3); font-size: 12px; margin-top: 8px; }

/* 用户页 */
.profile-hero { background: var(--gradient); padding: 26px 18px 30px; color: #fff; }
.profile-hero .row { display: flex; align-items: center; gap: 14px; }
.profile-hero .avatar { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #fff; }
.profile-hero .name { font-size: 18px; font-weight: 700; }
.profile-hero .phone { font-size: 12px; opacity: .85; margin-top: 3px; }
.profile-hero .tag { display: inline-block; margin-top: 6px; font-size: 11px; background: rgba(255,255,255,.25); padding: 2px 10px; border-radius: 10px; }
.menu { margin: 12px 14px; }
.menu .mi { display: flex; align-items: center; gap: 12px; padding: 15px 14px; border-bottom: 1px solid var(--line); }
.menu .mi:last-child { border-bottom: none; }
.menu .mi .ico { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.menu .mi .txt { flex: 1; font-size: 14px; }
.menu .mi .arrow { color: var(--text-3); }

/* 分销中心 */
.dist-hero { background: var(--gradient); padding: 20px 18px; color: #fff; }
.dist-hero .title { font-size: 13px; opacity: .9; }
.dist-hero .big { font-size: 32px; font-weight: 800; margin-top: 4px; }
.dist-hero .sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.dist-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 14px; }
.dist-stats .s { background: var(--card); border-radius: var(--radius); padding: 14px 8px; text-align: center; }
.dist-stats .s .v { font-size: 18px; font-weight: 700; color: var(--primary); }
.dist-stats .s .k { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.dist-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 14px 14px; }
.dist-actions .a { background: var(--card); border-radius: var(--radius); padding: 16px 6px; text-align: center; }
.dist-actions .a .ico { font-size: 24px; }
.dist-actions .a .txt { font-size: 12px; color: var(--text-2); margin-top: 6px; }

.apply-card { margin: 12px 14px; padding: 20px 16px; text-align: center; }
.apply-card h3 { font-size: 17px; }
.apply-card p { color: var(--text-2); font-size: 13px; margin: 10px 0 16px; line-height: 1.8; text-align: left; }
.benefits { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; text-align: left; }
.benefits .b { display: flex; gap: 8px; font-size: 13px; color: var(--text-2); align-items: center; }
.benefits .b i { color: var(--green); font-style: normal; font-weight: 700; }

/* 团队 */
.team-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.team-item .ava { width: 40px; height: 40px; border-radius: 50%; background: #f2f3f5; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text-2); }
.team-item .mid { flex: 1; }
.team-item .nick { font-size: 14px; font-weight: 600; }
.team-item .meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.team-item .lvl { font-size: 11px; padding: 2px 8px; border-radius: 8px; }
.team-item .lvl.l1 { background: #fff1ec; color: var(--primary); }
.team-item .lvl.l2 { background: #eef3ff; color: var(--blue); }

/* 佣金 */
.cm-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.cm-item .mid { flex: 1; min-width: 0; }
.cm-item .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-item .meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.cm-item .amt { text-align: right; }
.cm-item .amt .v { font-size: 15px; font-weight: 700; color: var(--primary); }
.cm-item .amt .s { font-size: 11px; margin-top: 3px; }
.s-badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 8px; }
.s-badge.pending { background: #fff8ec; color: var(--amber); }
.s-badge.settled { background: #ecfdf3; color: var(--green); }

/* 提现 */
.wd-balance { background: var(--gradient); color: #fff; padding: 22px 18px; }
.wd-balance .k { font-size: 13px; opacity: .9; }
.wd-balance .v { font-size: 30px; font-weight: 800; margin-top: 4px; }
.wd-record { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.wd-record .mid { flex: 1; }
.wd-record .acc { font-size: 13px; font-weight: 600; }
.wd-record .time { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.wd-record .amt { font-weight: 700; }
.wd-record .amt.plus { color: var(--primary); }
.wd-record .s { font-size: 11px; margin-top: 3px; text-align: right; }

/* 邀请 */
.invite-card { margin: 14px; padding: 24px 18px; text-align: center; color: #fff; background: var(--gradient); border-radius: var(--radius); }
.invite-card .code { font-size: 28px; font-weight: 800; letter-spacing: 4px; margin: 14px 0 6px; }
.invite-card .tip { font-size: 12px; opacity: .9; }
.invite-card .btns { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.invite-card .btns .btn { background: #fff; color: var(--primary); }

/* 登录注册 */
.auth-wrap { padding: 40px 26px 0; }
.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo .logo { width: 68px; height: 68px; border-radius: 20px; background: var(--gradient); color: #fff; font-size: 32px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.auth-logo h2 { margin-top: 12px; font-size: 18px; }
.auth-logo p { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.auth-card { padding: 10px 18px; }
.auth-card .frow { border: none; background: #f4f5f7; border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; }
.auth-card input { background: none; width: 100%; font-size: 15px; }
.auth-extra { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin: 8px 2px 18px; }

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 30px; }
.pop { background: #fff; border-radius: 16px; width: 100%; max-width: 340px; padding: 22px 18px; }
.pop h3 { font-size: 16px; text-align: center; }
.pop .msg { text-align: center; color: var(--text-2); font-size: 14px; margin: 14px 0 20px; line-height: 1.7; }
.pop .btns { display: flex; gap: 10px; }
.pop .btns .btn { flex: 1; }
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 99;
  background: rgba(0,0,0,.78); color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px;
  max-width: 78%; text-align: center; animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* 确认收货等状态标签 */
.st-pending { color: var(--amber); }
.st-paid { color: var(--blue); }
.st-shipped { color: var(--amber); }
.st-completed { color: var(--green); }
.st-cancelled { color: var(--text-3); }

.hide { display: none !important; }
