/* ================= 抢单9+9 H5 样式 ================= */
:root {
  --primary: #e02020;
  --primary-dark: #c01a1a;
  --gold: #f5a623;
  --gold-light: #fff5e0;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #222222;
  --text-sub: #888888;
  --border: #eeeeee;
  --green: #07c160;
  --orange: #ff6b00;
  --radius: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: 14px; outline: none; border: none; }
ul, li { list-style: none; }

#app { min-height: 100vh; position: relative; }

.page-container {
  padding-bottom: calc(60px + var(--safe-bottom));
  min-height: 100vh;
}
.page-container.no-tab { padding-bottom: var(--safe-bottom); }

/* ============ 顶部导航 ============ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #e02020, #ff5c5c);
  color: #fff;
  height: 46px;
  display: flex; align-items: center;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
}
.navbar .nav-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.navbar .nav-back, .navbar .nav-right { width: 50px; font-size: 15px; }
.navbar .nav-back { cursor: pointer; }
.navbar .nav-right { text-align: right; }
.navbar.plain { background: linear-gradient(135deg, #e02020, #ff5c5c); color: #fff; border-bottom: none; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,.04);
}
.tab-item {
  flex: 1; text-align: center; padding: 6px 0 5px;
  color: var(--text-sub); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab-item .tab-icon { font-size: 21px; line-height: 1; }
.tab-item.active { color: var(--primary); font-weight: 600; }

/* ============ 通用卡片 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  margin: 10px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title .more { font-size: 12px; color: var(--text-sub); font-weight: normal; }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.flex1 { flex: 1; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sub { color: var(--text-sub); }
.text-primary { color: var(--primary); }
.text-green { color: var(--green); }
.text-gold { color: var(--gold); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 17px; }
.bold { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ellipsis2 { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px; border-radius: 20px;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer; border: none;
}
.btn:active { opacity: .85; }
.btn.block { display: flex; width: 100%; border-radius: 8px; }
.btn.gold { background: linear-gradient(135deg, #f5a623, #ffb63c); }
.btn.outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: #f0f0f0; color: #888; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 15px; }
.btn.disabled { background: #ccc !important; pointer-events: none; }

/* ============ 表单 ============ */
.form-item {
  display: flex; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.form-item:last-child { border-bottom: none; }
.form-item label { width: 80px; color: var(--text-sub); flex-shrink: 0; }
.form-item input, .form-item select, .form-item textarea {
  flex: 1; background: transparent; border: none; font-size: 14px;
}
.form-item select { appearance: none; -webkit-appearance: none; background: transparent; }
.input-line {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  margin-bottom: 12px;
}

/* ============ 首页 ============ */
.home-header {
  background: linear-gradient(135deg, #e02020, #ff5c5c);
  padding: 12px 14px calc(46px) 14px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  color: #fff;
  position: relative;
}
.home-header .logo-row { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.home-header .notice {
  margin-top: 10px; background: rgba(255,255,255,.18); border-radius: 16px;
  padding: 5px 12px; font-size: 12px; display: flex; align-items: center; gap: 6px;
}

.banner { margin: -36px 10px 0; border-radius: var(--radius); overflow: hidden; background: #ddd; height: 150px; position: relative; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner .ph { display: flex; align-items: center; justify-content: center; height: 100%; color: #fff; background: linear-gradient(135deg,#f5a623,#ff7a45); font-size: 15px; }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 0; padding: 12px 0; }
.cat-item { text-align: center; }
.cat-item .cat-icon { width: 44px; height: 44px; margin: 0 auto 5px; border-radius: 50%; background: var(--gold-light); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cat-item .cat-name { font-size: 12px; color: #555; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 0; padding: 6px 0; }
.quick-item { text-align: center; }
.quick-item .qi-icon { font-size: 26px; }
.quick-item .qi-name { font-size: 12px; color: #555; margin-top: 2px; }

/* 会员卡片 */
.member-card {
  margin: 10px; border-radius: 12px; padding: 16px;
  background: linear-gradient(135deg, #2b2b2b, #4a4a4a);
  color: #f7e2b8; position: relative; overflow: hidden;
}
.member-card .mc-top { display: flex; justify-content: space-between; align-items: center; }
.member-card .mc-level { font-size: 16px; font-weight: 700; color: #f9d98a; }
.member-card .mc-money { margin-top: 12px; display: flex; gap: 20px; }
.member-card .mc-money .m { font-size: 20px; font-weight: 700; color: #fff; }
.member-card .mc-money .l { font-size: 11px; color: #c9b48a; }

/* ============ 商品列表 ============ */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
.product-item { background: #fff; border-radius: var(--radius); overflow: hidden; }
.product-item .pi-img { height: 140px; background: linear-gradient(135deg,#f7f7f7,#ececec); display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 30px; }
.product-item .pi-img img { width: 100%; height: 100%; object-fit: cover; }
.product-item .pi-body { padding: 8px 10px 10px; }
.product-item .pi-title { font-size: 13px; height: 36px; overflow: hidden; }
.product-item .pi-price { color: var(--primary); font-weight: 700; font-size: 16px; margin-top: 4px; }
.product-item .pi-price small { font-size: 11px; }
.product-item .pi-mkt { font-size: 11px; color: #aaa; text-decoration: line-through; margin-left: 4px; font-weight: normal; }

/* ============ 抢单 ============ */
.qd-banner {
  margin: 10px; border-radius: 12px; padding: 16px;
  background: linear-gradient(135deg, #ff6b00, #ff3d00); color: #fff;
}
.qd-banner .qd-t { font-size: 16px; font-weight: 700; }
.qd-banner .qd-countdown { margin-top: 8px; font-size: 26px; font-weight: 700; letter-spacing: 2px; }

.qd-item {
  background: #fff; border-radius: var(--radius); margin: 10px; padding: 12px;
  display: flex; gap: 12px; align-items: center;
}
.qd-item .qdi-img { width: 70px; height: 70px; border-radius: 8px; background: #f2f2f2; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #ccc; }
.qd-item .qdi-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.qd-item .qdi-body { flex: 1; min-width: 0; }
.qd-item .qdi-title { font-size: 14px; font-weight: 600; }
.qd-item .qdi-meta { font-size: 12px; color: var(--text-sub); margin-top: 3px; }
.qd-progress { height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.qd-progress .bar { height: 100%; background: linear-gradient(90deg, #ff6b00, #ff3d00); }

.countdown-box { display: inline-flex; gap: 3px; align-items: center; }
.countdown-box .cd-num { background: #333; color: #fff; border-radius: 3px; padding: 1px 4px; font-size: 12px; min-width: 20px; text-align: center; }

/* ============ 仓库 ============ */
.asset-item {
  background: #fff; border-radius: var(--radius); margin: 10px; padding: 12px;
  display: flex; gap: 12px; position: relative;
}
.asset-item .ai-img { width: 66px; height: 66px; border-radius: 8px; background: #f2f2f2; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #ccc; }
.asset-item .ai-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.asset-item .ai-body { flex: 1; min-width: 0; }
.asset-item .ai-profit { text-align: right; flex-shrink: 0; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px;
  background: #f0f0f0; color: #888; margin-right: 4px;
}
.tag.red { background: #ffeaea; color: var(--primary); }
.tag.gold { background: var(--gold-light); color: #b8791f; }
.tag.green { background: #e7f8ee; color: var(--green); }
.tag.blue { background: #e8f1ff; color: #2f6fd0; }
.tag.gray { background: #f2f2f2; color: #999; }

/* ============ 列表 ============ */
.list-item {
  background: #fff; padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-left { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 14px; }
.list-item .li-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.list-item .li-right { text-align: right; flex-shrink: 0; }
.arrow { color: #ccc; font-size: 16px; margin-left: 4px; }

/* ============ 空状态 ============ */
.empty { padding: 60px 20px; text-align: center; color: #bbb; }
.empty .e-icon { font-size: 46px; margin-bottom: 10px; }
.empty .e-text { font-size: 13px; }

/* ============ Toast ============ */
#toast-root { position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.toast {
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 6px;
  font-size: 13px; max-width: 76%; text-align: center; animation: toastIn .2s;
}
@keyframes toastIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

/* ============ Modal ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .18s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 340px; overflow: hidden;
  animation: modalIn .2s;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.modal .m-title { padding: 20px 18px 8px; font-size: 16px; font-weight: 600; text-align: center; }
.modal .m-body { padding: 4px 18px 18px; font-size: 14px; color: #555; text-align: center; line-height: 1.6; }
.modal .m-foot { display: flex; border-top: 1px solid var(--border); }
.modal .m-foot .m-btn { flex: 1; height: 46px; display: flex; align-items: center; justify-content: center; font-size: 15px; cursor: pointer; }
.modal .m-foot .m-btn + .m-btn { border-left: 1px solid var(--border); }
.modal .m-foot .m-btn.confirm { color: var(--primary); font-weight: 600; }
.modal .m-foot .m-btn.cancel { color: #888; }

/* 底部弹层 */
.sheet-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10000; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; border-radius: 14px 14px 0 0; animation: sheetIn .22s; max-height: 78vh; overflow-y: auto; padding-bottom: var(--safe-bottom); }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet .s-head { padding: 14px; text-align: center; font-weight: 600; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.sheet .s-body { padding: 14px; }
.sheet .s-close { position: absolute; right: 14px; top: 14px; color: #999; font-size: 18px; }

/* ============ 加载 ============ */
.loading { padding: 40px; text-align: center; color: #bbb; font-size: 13px; }
.spinner { width: 26px; height: 26px; border: 2px solid #eee; border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 10px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 订单状态条 ============ */
.status-bar { display: flex; align-items: center; gap: 6px; font-size: 12px; }

/* ============ 统计块 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.stat-grid .st { background: #fff; padding: 14px 6px; text-align: center; }
.stat-grid .st .st-v { font-size: 18px; font-weight: 700; }
.stat-grid .st .st-l { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

/* 筛选条 */
.filter-bar { display: flex; background: #fff; overflow-x: auto; border-bottom: 1px solid var(--border); position: sticky; top: 46px; z-index: 50; }
.filter-bar .fb-item { flex-shrink: 0; padding: 11px 16px; font-size: 13px; color: #666; position: relative; }
.filter-bar .fb-item.active { color: var(--primary); font-weight: 600; }
.filter-bar .fb-item.active::after { content: ''; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); width: 20px; height: 2px; background: var(--primary); border-radius: 1px; }

/* 登录页 */
.login-wrap { min-height: 100vh; background: linear-gradient(160deg, #e02020 0%, #ff6b4a 40%, #f5f6f8 40.1%); padding: 0 24px; }
.login-wrap .lw-logo { padding: 60px 0 30px; text-align: center; color: #fff; }
.login-wrap .lw-logo .l-icon { font-size: 56px; }
.login-wrap .lw-logo .l-name { font-size: 22px; font-weight: 700; margin-top: 8px; }
.login-box { background: #fff; border-radius: 14px; padding: 24px 20px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }

/* 分享页 */
.share-wrap { min-height: 100vh; background: linear-gradient(160deg, #2b2b2b, #4a4a4a); padding: 20px; display: flex; flex-direction: column; align-items: center; }
.share-card { background: #fff; border-radius: 14px; width: 100%; max-width: 340px; overflow: hidden; margin-top: 20px; }
.share-card .sc-img { height: 200px; background: linear-gradient(135deg,#f7f7f7,#ececec); display: flex; align-items: center; justify-content: center; font-size: 46px; color: #ccc; }
.share-card .sc-body { padding: 16px; }
.share-qr { text-align: center; margin-top: 20px; color: #fff; }
.share-qr img { width: 170px; height: 170px; background: #fff; padding: 8px; border-radius: 10px; }

/* 步骤条 */
.steps { padding: 4px 0 0; }
.step { display: flex; gap: 10px; }
.step .s-dot { width: 18px; display: flex; flex-direction: column; align-items: center; }
.step .s-dot .d { width: 9px; height: 9px; border-radius: 50%; background: #ddd; margin-top: 4px; flex-shrink: 0; }
.step .s-dot .line { flex: 1; width: 2px; background: #eee; margin: 3px 0; }
.step.done .s-dot .d { background: var(--green); }
.step.done .s-dot .line { background: var(--green); }
.step:last-child .s-dot .line { display: none; }
.step .s-body { flex: 1; padding-bottom: 14px; }
.step .s-title { font-size: 13px; }
.step.done .s-title { color: var(--green); }
.step .s-time { font-size: 11px; color: #bbb; }
