/* ============================================================
   抢单寄售平台 —— 移动端 H5 公共样式（无外部依赖）
   ============================================================ */

:root {
  --primary: #e23b2e;
  --primary-dark: #c42f24;
  --gradient: linear-gradient(135deg, #ff5f3c 0%, #e23b2e 60%, #c62f45 100%);
  --gold: #f2b01e;
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #26262b;
  --text-2: #6b6f76;
  --text-3: #9aa0a8;
  --line: #ececf2;
  --success: #0aa958;
  --warn: #ff7a1a;
  --info: #2f7cf6;
  --danger: #e0413a;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(30, 20, 20, 0.06);
  --tabbar-h: 56px;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

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

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 22px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 6px 16px rgba(226, 59, 46, 0.28);
  transition: opacity .15s, transform .1s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .55; box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { height: 50px; border-radius: 25px; font-size: 17px; }
.btn-plain { background: #fff; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn-ghost { background: #f1f2f5; color: var(--text-2); box-shadow: none; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; border-radius: 16px; box-shadow: none; }
.btn-success { background: linear-gradient(135deg, #21c46e, #0aa958); box-shadow: 0 4px 12px rgba(10, 169, 88, .25); }
.btn-warn { background: linear-gradient(135deg, #ffa02e, #ff7a1a); box-shadow: 0 4px 12px rgba(255,122,26,.25); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cell:last-child { border-bottom: none; }
.cell-label { color: var(--text-2); font-size: 14px; }
.cell-value { font-weight: 600; text-align: right; word-break: break-all; }
.cell-value.sub { font-weight: 400; color: var(--text-2); font-size: 13px; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.tag-red { background: #fdeaea; color: var(--danger); }
.tag-green { background: #e6f7ee; color: var(--success); }
.tag-orange { background: #fff3e6; color: var(--warn); }
.tag-blue { background: #e8f1ff; color: var(--info); }
.tag-gray { background: #f0f1f4; color: var(--text-2); }

.money { color: var(--danger); font-weight: 700; }
.money::before { content: "¥"; font-size: .78em; margin-right: 1px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  margin: 18px 2px 10px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--gradient);
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: .6; }

/* ---------- Toast ---------- */
#toast-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
  text-align: center;
}
#toast-box .toast {
  display: inline-block;
  max-width: 78vw;
  background: rgba(20, 20, 25, 0.86);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  margin-top: 6px;
  animation: toastIn .18s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Loading ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  color: var(--text-3);
  font-size: 13px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(226, 59, 46, .2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 11px;
}
.tabbar a .t-icon { font-size: 22px; line-height: 1; }
.tabbar a.active { color: var(--primary); font-weight: 700; }

/* ---------- 页面框架 ---------- */
.page { padding: 12px 14px calc(var(--tabbar-h) + 30px); animation: pageIn .2s ease-out; }
.page.no-tab { padding-bottom: 30px; }
@keyframes pageIn { from { opacity: .4; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 14px;
  background: var(--gradient);
  color: #fff;
}
.app-header h1 { flex: 1; text-align: center; font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.app-header .back { font-size: 20px; width: 28px; color: #fff; }
.app-header .back.placeholder { visibility: hidden; }
.app-header .right { width: 28px; }

/* ---------- 首页 Hero ---------- */
.hero {
  border-radius: var(--radius);
  background: var(--gradient);
  color: #fff;
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(226, 59, 46, 0.25);
}
.hero::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.hero .price-label { font-size: 13px; opacity: .9; }
.hero .price-num { font-size: 42px; font-weight: 800; line-height: 1.15; }
.hero .price-num small { font-size: 18px; font-weight: 600; }
.hero .price-sub { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; opacity: .95; }

.progress-block {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
}
.progress-block .p-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.progress-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.28); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ffd76a, #fff2b8); transition: width .5s; }

.quick-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.quick-btn {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-size: 12px;
}
.quick-btn .q-icon { font-size: 24px; line-height: 1; }
.quick-btn:active { transform: scale(0.96); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 13px; }
.stat-box .s-label { color: var(--text-3); font-size: 12px; }
.stat-box .s-value { font-size: 20px; font-weight: 800; margin-top: 4px; }
.stat-box .s-value small { font-size: 12px; font-weight: 500; color: var(--text-3); }

/* ---------- 表单 ---------- */
.form-card { padding: 8px 16px; }
.field { padding: 14px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: none; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; font-size: 16px; color: var(--text); }
.field textarea { resize: vertical; min-height: 44px; }
.field .tip { font-size: 12px; color: var(--text-3); margin-top: 5px; }

/* ---------- 订单 ---------- */
.order-item { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.order-no { font-size: 12px; color: var(--text-3); }
.order-body { display: flex; align-items: center; gap: 12px; }
.order-main { flex: 1; }
.order-amount { font-size: 20px; font-weight: 800; }
.order-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; line-height: 1.7; }
.order-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.seg { display: flex; background: #eef0f5; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; height: 34px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.seg button.active { background: #fff; color: var(--primary); font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ---------- 市场 ---------- */
.market-item { display: flex; gap: 12px; align-items: center; }
.market-avatar {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; flex-shrink: 0;
}
.countdown { font-variant-numeric: tabular-nums; }

/* ---------- 团队看板 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 12px 8px; text-align: center; }
.kpi .k-num { font-size: 22px; font-weight: 800; }
.kpi .k-num.fail { color: var(--warn); }
.kpi .k-num.ok { color: var(--success); }
.kpi .k-label { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.progress-line { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.progress-line .pl-label { width: 76px; font-size: 12px; color: var(--text-2); }
.progress-line .pl-track { flex: 1; height: 8px; border-radius: 4px; background: #eef0f5; overflow: hidden; }
.progress-line .pl-bar { height: 100%; background: var(--gradient); border-radius: 4px; transition: width .4s; }
.progress-line .pl-num { width: 60px; text-align: right; font-size: 12px; font-weight: 700; }

/* ---------- 对账单 ---------- */
.st-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.st-item:last-child { border-bottom: none; }
.st-left .st-role { font-size: 14px; font-weight: 600; }
.st-left .st-sub { font-size: 12px; color: var(--text-3); }
.st-right { text-align: right; }
.st-right .st-amt { font-size: 15px; font-weight: 700; }
.st-right .st-status { font-size: 12px; }

/* ---------- 我的 ---------- */
.profile-head {
  border-radius: var(--radius);
  background: var(--gradient);
  color: #fff;
  padding: 22px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(226, 59, 46, .22);
}
.profile-head::after { content: ""; position: absolute; right: -32px; bottom: -50px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.1); }
.profile-head .p-phone { font-size: 20px; font-weight: 800; }
.profile-head .p-tags { display: flex; gap: 8px; margin-top: 8px; }
.profile-head .p-id { font-size: 12px; opacity: .85; margin-top: 8px; }

.menu-list { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 0 16px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.menu-item:last-child { border-bottom: none; }
.menu-item .m-icon { font-size: 19px; width: 24px; text-align: center; }
.menu-item .m-label { flex: 1; }
.menu-item .m-arrow { color: var(--text-3); }

.wallet-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.wallet-item { background: rgba(255,255,255,.14); border-radius: 10px; padding: 10px 6px; text-align: center; }
.wallet-item .w-num { font-size: 15px; font-weight: 800; word-break: break-all; }
.wallet-item .w-label { font-size: 11px; opacity: .9; margin-top: 2px; }

/* ---------- 登录注册 ---------- */
.auth-page { min-height: 100vh; background: linear-gradient(175deg, #e23b2e 0%, #c62f45 42%, #f6f2ec 42.5%, #f4f5f9 100%); display: flex; flex-direction: column; }
.auth-brand { padding: 64px 28px 40px; color: #fff; text-align: center; }
.auth-brand .logo { font-size: 34px; font-weight: 900; letter-spacing: 2px; text-shadow: 0 4px 14px rgba(0,0,0,.18); }
.auth-brand .logo small { font-size: 13px; font-weight: 500; opacity: .9; display: block; margin-top: 6px; }
.auth-card { flex: 1; background: #fff; border-radius: 24px 24px 0 0; padding: 26px 22px 34px; margin-top: auto; }
.auth-tabs { display: flex; gap: 28px; padding: 4px 6px 18px; }
.auth-tabs button { font-size: 18px; font-weight: 700; color: var(--text-3); padding-bottom: 8px; border-bottom: 3px solid transparent; }
.auth-tabs button.active { color: var(--text); border-bottom-color: var(--primary); }
.auth-input {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  height: 50px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.auth-input.act { border-color: var(--primary); background: #fff; }
.auth-input .a-icon { font-size: 18px; color: var(--text-3); }
.auth-input input { flex: 1; height: 100%; font-size: 16px; }
.auth-tip { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 14px; }
.auth-err { background: #fdeaea; color: var(--danger); font-size: 13px; border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; display: none; }
.auth-err.show { display: block; }

/* ---------- 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 30px; }
.modal-mask.hidden { display: none; }
.modal { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 20px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal .m-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .m-actions .btn { flex: 1; }

/* 桌面放大 */
@media (min-width: 640px) {
  .page { max-width: 560px; margin: 0 auto; }
  .tabbar { max-width: 640px; left: 50%; transform: translateX(-50%); }
}