:root {
  --primary: #2f6bff;
  --primary-d: #1c4fd6;
  --primary-grad: linear-gradient(135deg, #3b6bff 0%, #1aa3ff 100%);
  --bg: #f4f6fb;
  --card: #fff;
  --text: #1f2937;
  --muted: #8a94a6;
  --line: #eef1f6;
  --price: #ff4d5e;
  --success: #16a34a;
  --danger: #ef4444;
  --safe: env(safe-area-inset-bottom, 0px);
  --shadow: 0 6px 20px rgba(24, 48, 96, .07);
  --shadow-sm: 0 2px 8px rgba(24, 48, 96, .05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: calc(58px + var(--safe)); }
a { color: inherit; text-decoration: none; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--primary-grad); color: #fff; box-shadow: 0 2px 12px rgba(28, 79, 214, .25); }
.topbar-inner { display: flex; align-items: center; padding: 11px 14px; gap: 10px; }
.logo { font-weight: 800; font-size: 17px; white-space: nowrap; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.22); color: #fff; font-size: 14px; font-weight: 800; flex: none; }
.search { flex: 1; display: flex; background: rgba(255,255,255,.95); border-radius: 20px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.04); }
.search input { flex: 1; border: 0; outline: 0; padding: 8px 14px; font-size: 13px; color: var(--text); background: transparent; }
.search button { border: 0; background: transparent; padding: 0 14px; font-size: 16px; cursor: pointer; }
.bell { position: relative; cursor: pointer; margin-left: 4px; font-size: 19px; line-height: 1; }

.view { padding: 12px; }

/* 卡片 */
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }

/* 横幅 */
.banner { border-radius: 14px; overflow: hidden; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.banner img { width: 100%; display: block; }

/* 分类快捷 */
.cat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; background: var(--card); border-radius: 14px; padding: 14px 8px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.cat-item { text-align: center; font-size: 12px; color: #555; cursor: pointer; }
.cat-item .ic { font-size: 26px; display: block; margin-bottom: 4px; transition: transform .15s; }
.cat-item:active .ic { transform: scale(.9); }

/* 商品网格 */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 12px; }
.section-title h3 { margin: 0; font-size: 16px; font-weight: 800; }
.section-title h3::before { content: ""; display: inline-block; width: 4px; height: 15px; background: var(--primary); border-radius: 4px; margin-right: 8px; vertical-align: -2px; }
.section-title .more { color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.goods { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.goods:active { transform: translateY(1px); }
.goods img { width: 100%; height: 150px; object-fit: cover; background: #eef2f8; transition: transform .3s; }
@media (hover: hover) { .goods:hover { box-shadow: var(--shadow); } .goods:hover img { transform: scale(1.05); } }
.goods .info { padding: 10px; }
.goods .name { font-size: 13px; height: 36px; overflow: hidden; color: #333; }
.goods .price { color: var(--price); font-weight: 800; margin-top: 6px; font-size: 16px; }
.goods .price small { font-size: 11px; font-weight: 600; }
.goods .sold { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* 底部导航 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: rgba(255,255,255,.98); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding-bottom: var(--safe); z-index: 60; box-shadow: 0 -2px 12px rgba(24,48,96,.05); }
.tabbar a { flex: 1; text-align: center; padding: 7px 0; color: #9aa3b2; font-size: 11px; position: relative; }
.tabbar a span { font-size: 21px; display: block; position: relative; }
.tabbar a.active { color: var(--primary); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 22px; height: 3px; border-radius: 3px; background: var(--primary); }
.tabbar a .badge { position: absolute; top: -2px; right: 50%; margin-right: -24px; background: var(--danger); color: #fff; border-radius: 10px; font-size: 10px; padding: 0 5px; min-width: 14px; border: 1.5px solid #fff; }

/* 按钮 */
.btn { display: inline-block; border: 0; border-radius: 22px; padding: 10px 20px; background: var(--primary-grad); color: #fff; font-size: 14px; text-align: center; font-weight: 600; box-shadow: 0 4px 12px rgba(47,107,255,.28); cursor: pointer; }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn.gray { background: #cdd5e0; box-shadow: none; }
.btn:active { opacity: .88; transform: translateY(1px); }
.btn.sm { padding: 6px 14px; font-size: 12px; border-radius: 16px; box-shadow: 0 3px 8px rgba(47,107,255,.22); }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: #667; margin-bottom: 5px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 14px; outline: 0; background: #fff; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.field .err { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* toast */
.toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%,-50%); background: rgba(20,28,45,.9); color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 999; opacity: 0; transition: opacity .2s; pointer-events: none; font-size: 13px; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; }
.loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); background: rgba(20,28,45,.8); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 998; display: none; }
.loading.show { display: block; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.empty .ic { font-size: 52px; opacity: .6; }
.empty .tip { margin-top: 10px; font-size: 13px; }

/* 列表 */
.list { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.list .item { display: flex; align-items: center; padding: 13px; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list .item .main { flex: 1; min-width: 0; }
.list .item .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.list .item .arrow { color: #cfd6e0; }

/* 商品详情 */
.detail-img { width: 100%; }
.detail-img img { width: 100%; display: block; }
.price-bar { display: flex; align-items: baseline; gap: 8px; }
.price-bar .now { color: var(--price); font-size: 24px; font-weight: 800; }
.price-bar .old { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.detail-tabs { display: flex; border-bottom: 1px solid var(--line); margin-top: 12px; }
.detail-tabs div { flex: 1; text-align: center; padding: 11px; color: #667; }
.detail-tabs div.active { color: var(--primary); font-weight: 700; border-bottom: 2px solid var(--primary); }
.detail-content { padding: 12px; color: #556; font-size: 13px; }

/* 底部操作条 */
.actionbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: rgba(255,255,255,.98); border-top: 1px solid var(--line); padding: 10px 14px; gap: 10px; z-index: 55; padding-bottom: calc(10px + var(--safe)); align-items: center; box-shadow: 0 -2px 12px rgba(24,48,96,.05); }
.actionbar .sub { flex: 1; color: var(--muted); font-size: 12px; }
.actionbar .sub b { color: var(--price); font-size: 19px; }

/* 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 200; display: none; }
.modal-mask.show { display: block; }
.modal { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; border-radius: 18px 18px 0 0; z-index: 201; padding: 18px; display: none; max-height: 82vh; overflow: auto; }
.modal.show { display: block; }
.modal h4 { margin: 0 0 14px; font-size: 16px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; background: #f5f7fb; width: 32px; height: 32px; font-size: 17px; cursor: pointer; }
.stepper input { width: 46px; text-align: center; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); height: 32px; }

/* 我的-入口 */
.user-head { background: var(--primary-grad); color: #fff; padding: 28px 18px 22px; border-radius: 0 0 20px 20px; box-shadow: 0 4px 16px rgba(28,79,214,.2); }
.user-head .avatar { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 12px; border: 2px solid rgba(255,255,255,.4); }
.user-head .uname { font-size: 18px; font-weight: 800; }
.user-head .row { display: flex; gap: 22px; margin-top: 14px; }
.user-head .row div { text-align: center; }
.user-head .row b { font-size: 18px; display: block; }
.user-head .row span { font-size: 12px; opacity: .85; }
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: center; background: #fff; border-radius: 14px; padding: 16px 8px; box-shadow: var(--shadow-sm); }
.menu-grid .it { font-size: 12px; color: #556; cursor: pointer; }
.menu-grid .it .ic { font-size: 25px; display: block; margin-bottom: 5px; }

.flex { display: flex; }
.flex.between { justify-content: space-between; }
.flex.center { align-items: center; }
.mt { margin-top: 10px; }
.muted { color: var(--muted); }
.tag { display: inline-block; background: #eaf1ff; color: var(--primary); font-size: 11px; padding: 2px 7px; border-radius: 5px; }
.right { text-align: right; }

/* 我的团队 */
.team-node { margin: 4px 0; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; }
.team-row .lv { background: var(--primary); color: #fff; font-size: 11px; border-radius: 5px; padding: 1px 6px; flex: none; }
.team-row .nm { font-weight: 600; }
.team-row .sub { color: var(--muted); font-size: 12px; }
.team-row .cnt { margin-left: auto; color: var(--primary); font-size: 12px; flex: none; }
.team-node .team-node .team-row { background: #f0f4fb; }
.team-node .team-node .team-node .team-row { background: #e9eef8; }

/* 代理中心 */
.agent-lv-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.agent-lv { flex: 1 1 calc(50% - 10px); border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fafcff; }
.agent-lv.on { border-color: var(--primary); background: #eef4ff; box-shadow: 0 4px 12px rgba(47,107,255,.12); }
.agent-lv .lv-name { font-weight: 800; }
.agent-lv .lv-rate { color: var(--primary); font-size: 13px; margin-top: 4px; font-weight: 700; }
.agent-lv .lv-min { color: #889; font-size: 12px; margin-top: 2px; }
.comm-row { padding: 11px 0; border-bottom: 1px solid #f0f0f0; }
.comm-row:last-child { border-bottom: none; }
