/* ==========================================================
   panicbuy H5 前端样式
   移动端优先，桌面端居中显示（最大宽度 480px）
   ========================================================== */
:root {
  --primary: #e8382f;
  --primary-dark: #c62a22;
  --primary-soft: #fff1f0;
  --gold: #ff9f1a;
  --gold-soft: #fff7e8;
  --success: #17b26a;
  --info: #2e7cf6;
  --danger: #e8382f;
  --muted: #8a9099;
  --text: #1f2329;
  --text-2: #5c6470;
  --line: #eceef1;
  --bg: #f4f5f7;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(31, 35, 41, .06);
}

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

html, body {
  margin: 0; padding: 0;
  background: #e9ebee;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 24px rgba(0, 0, 0, .08);
}

/* ---------------- 顶部导航 ---------------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  height: 46px;
  display: flex; align-items: center;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.navbar .back { width: 32px; font-size: 22px; color: var(--text); cursor: pointer; user-select: none; }
.navbar .title { flex: 1; text-align: center; font-size: 16px; font-weight: 500; margin-right: 32px; }
.navbar.plain { background: transparent; border: 0; }

/* ---------------- 页面容器 ---------------- */
.page { padding: 12px; padding-bottom: 72px; }
.page.no-pad { padding: 0 0 72px; }

/* ---------------- 通用块 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tight { padding: 10px 12px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.small { font-size: 12px; }
.b { font-weight: 500; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.tc { text-align: center; } .tr { text-align: right; }
.hr { height: 1px; background: var(--line); margin: 12px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: block; width: 100%;
  height: 44px; line-height: 44px;
  border: 0; border-radius: 22px;
  background: var(--primary);
  color: #fff; font-size: 15px;
  text-align: center; cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.gold { background: linear-gradient(90deg, #ffb63d, #ff8b1a); }
.btn.sm { height: 32px; line-height: 32px; font-size: 13px; border-radius: 16px; width: auto; padding: 0 16px; }
.btn.xs { height: 28px; line-height: 28px; font-size: 12px; border-radius: 14px; width: auto; padding: 0 12px; }
.btn[disabled] { opacity: .5; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; padding: 0 12px; font-size: 14px; color: var(--text);
  outline: none;
}
.field textarea { height: 84px; padding: 10px 12px; resize: vertical; }
.field input:focus { border-color: var(--primary); }
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; }
.code-btn { width: 108px; height: 44px; border: 1px solid var(--primary); color: var(--primary); background: #fff; border-radius: 10px; font-size: 13px; }

/* ---------------- 列表 ---------------- */
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: #fff;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-item:last-child { border-bottom: 0; }
.list-item .arrow { color: #c6cad0; font-size: 16px; }
.list-group { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 12px; }
.list-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; flex: none;
}

/* ---------------- Tabs ---------------- */
.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 46px; z-index: 40; }
.tab { flex: 1; text-align: center; padding: 11px 0; font-size: 14px; color: var(--text-2); position: relative; cursor: pointer; }
.tab.active { color: var(--primary); font-weight: 500; }
.tab.active::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 28px; height: 2px; background: var(--primary); border-radius: 2px; }
.sub-tabs { display: flex; background: #fff; padding: 8px 12px; gap: 8px; }
.sub-tab { padding: 6px 14px; border-radius: 16px; background: #f2f3f5; font-size: 13px; color: var(--text-2); cursor: pointer; }
.sub-tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

/* ---------------- 资产卡 ---------------- */
.wallet {
  background: linear-gradient(135deg, #ff5b45, #e8382f);
  border-radius: 14px; color: #fff; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 6px 18px rgba(232, 56, 47, .22);
}
.wallet .lbl { font-size: 12px; opacity: .85; }
.wallet .num { font-size: 26px; font-weight: 600; margin-top: 2px; }
.wallet .wallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.25); }
.wallet .wallet-grid div { text-align: center; }
.wallet .wallet-grid .v { font-size: 15px; font-weight: 500; }

/* ---------------- 抢购 ---------------- */
.buy-hero {
  background: linear-gradient(160deg, #ff6a4d, #d8291f);
  color: #fff; padding: 18px 16px; border-radius: 14px; margin-bottom: 12px;
}
.buy-hero .status { font-size: 20px; font-weight: 600; }
.buy-hero .cd { font-size: 13px; opacity: .92; margin-top: 4px; }
.cd-num { font-variant-numeric: tabular-nums; font-weight: 600; }

.pcard { display: flex; gap: 10px; padding: 12px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer; }
.pcard .thumb { width: 84px; height: 84px; border-radius: 10px; background: #f2f3f5; flex: none; object-fit: cover; }
.pcard .pname { font-size: 14px; font-weight: 500; line-height: 1.4; }
.pcard .pprice { color: var(--primary); font-size: 17px; font-weight: 600; margin-top: 6px; }
.pcard .ptag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); margin-right: 4px; }

/* ---------------- 订单 ---------------- */
.order { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.order .hd { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.order .bd { display: flex; gap: 10px; padding: 12px; }
.order .ft { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ostatus { color: var(--primary); font-weight: 500; }
.ostatus.done { color: var(--success); }
.ostatus.gray { color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.pill.red { background: var(--primary-soft); color: var(--primary); }
.pill.green { background: #e8f8f0; color: var(--success); }
.pill.gray { background: #f2f3f5; color: var(--muted); }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed; bottom: 0; z-index: 60;
  width: 480px; max-width: 100%;
  left: 50%; transform: translateX(-50%);
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding: 5px 0 calc(5px + env(safe-area-inset-bottom));
}
.tabbar .tb { flex: 1; text-align: center; font-size: 11px; color: var(--muted); cursor: pointer; padding: 3px 0; }
.tabbar .tb .ic { display: block; font-size: 19px; line-height: 22px; }
.tabbar .tb.active { color: var(--primary); }

/* ---------------- 弹层 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { width: 300px; background: #fff; border-radius: 14px; overflow: hidden; }
.modal .m-title { padding: 16px; text-align: center; font-size: 15px; font-weight: 500; }
.modal .m-body { padding: 0 16px 8px; font-size: 13px; color: var(--text-2); }
.modal .m-info { padding: 0 16px 12px; font-size: 13px; }
.modal .m-info .it { display: flex; justify-content: space-between; padding: 5px 0; }
.m-split { margin: 0 16px 14px; border: 1px dashed var(--primary); border-radius: 10px; padding: 10px 12px; background: #fff8f5; }
.m-split .ms-t { font-size: 13px; font-weight: 600; color: #c0392b; margin-bottom: 6px; }
.m-split .ms-r { display: flex; justify-content: space-between; font-size: 12.5px; color: #6b7280; padding: 3px 0; }
.m-split .ms-r span:last-child { color: #1f2937; }
.modal .m-ft { display: flex; border-top: 1px solid var(--line); }
.modal .m-ft div { flex: 1; text-align: center; padding: 12px 0; cursor: pointer; }
.modal .m-ft div:last-child { background: var(--primary); color: #fff; }
.modal .m-ft div:first-child:last-child { background: var(--primary); color: #fff; }

.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 200; max-width: 80%; text-align: center;
}

/* ---------------- 空状态 / 加载 ---------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 13px; }
.empty .ic { font-size: 40px; display: block; margin-bottom: 8px; opacity: .5; }
.loading { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }

/* ---------------- 邀请 ---------------- */
.qr-box { width: 190px; height: 190px; margin: 10px auto; background: #fff; padding: 8px; border-radius: 10px; }
.code-pill { display: inline-block; padding: 6px 18px; background: var(--gold-soft); color: #b06d00; border-radius: 18px; font-size: 18px; letter-spacing: 2px; font-weight: 600; }

/* ---------------- 统计条 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stat-grid .v { font-size: 18px; font-weight: 600; }
.stat-grid .k { font-size: 12px; color: var(--muted); }

/* ---------------- 明细 ---------------- */
.detail-item { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-item:last-child { border-bottom: 0; }
.amount-in { color: var(--success); font-weight: 500; }
.amount-out { color: var(--text); font-weight: 500; }

.marquee { background: var(--gold-soft); color: #a35c00; font-size: 12px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
