:root {
  --brand: #1a56db;
  --brand-dark: #123a94;
  --brand-soft: #e8efff;
  --gold: #f59e0b;
  --gold-soft: #fef3c7;
  --green: #0f9d58;
  --red: #e5484d;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

button { font-family: inherit; }

/* ---------- 顶部导航 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #4f7ef7);
  color: #fff; display: grid; place-items: center; font-size: 18px;
}
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  padding: 7px 14px; border-radius: 9px; text-decoration: none;
  color: var(--ink-2); font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--brand); color: #fff; }

.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-hd {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-hd h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-hd .sub { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.card-bd { padding: 18px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 主内容区：排行榜表格列较多，需要足够宽度 */
.g-2-1 { grid-template-columns: minmax(0, 1fr) 340px; }

@media (max-width: 1080px) {
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 14px 12px 50px; }
}

/* ---------- 指标块 ---------- */
.stat { padding: 16px 18px; }
.stat .label { color: var(--ink-3); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.stat .hint { font-size: 12px; color: var(--ink-3); }
.stat.b .value { color: var(--brand); }
.stat.g .value { color: var(--green); }
.stat.o .value { color: var(--gold); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { filter: brightness(.95); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field label .req { color: var(--red); }
.field .tip { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
input[type=text], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26, 86, 219, .1); }
textarea { resize: vertical; min-height: 64px; }
.inline { display: flex; gap: 10px; }
.inline > * { flex: 1; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; font-size: 13px; background: #fff; user-select: none;
}
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }

/* ---------- 表格 ---------- */
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.tb th { background: var(--bg); color: var(--ink-2); font-weight: 600; white-space: nowrap; font-size: 12.5px; }
/* 单元格内文字不因窄列被逐字换行 */
table.tb td { white-space: nowrap; }
table.tb td.wrap { white-space: normal; }
table.tb tbody tr:hover { background: #fafcff; }
table.tb td.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.tb-wrap { overflow-x: auto; }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag.blue { background: var(--brand-soft); color: var(--brand-dark); }
.tag.green { background: #e7f6ee; color: #0b7a45; }
.tag.gold { background: var(--gold-soft); color: #a16207; }
.tag.red { background: #fdecec; color: #b42318; }
.tag.gray { background: #f1f5f9; color: var(--ink-2); }

/* ---------- 二维码 ---------- */
.qr-box {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; display: inline-grid; place-items: center;
}
.qr-box img, .qr-box table { display: block; }
.qr-name { text-align: center; font-weight: 700; margin-top: 8px; }
.qr-code { text-align: center; color: var(--ink-3); font-size: 12px; }

/* ---------- 流程条 ---------- */
.flow { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 150px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; position: relative;
}
.step .n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand);
  color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-bottom: 6px;
}
.step .t { font-weight: 700; font-size: 13.5px; }
.step .d { color: var(--ink-3); font-size: 12px; }
.step.done .n { background: var(--green); }

/* ---------- 提示条 ---------- */
.notice {
  background: var(--brand-soft); border: 1px solid #c9dbff; color: var(--brand-dark);
  padding: 10px 14px; border-radius: 10px; font-size: 13px;
}
.notice.warn { background: var(--gold-soft); border-color: #fde68a; color: #92400e; }

/* ---------- 手机外框（客户页预览） ---------- */
.phone-frame {
  width: 390px; max-width: 100%; margin: 0 auto;
  border: 10px solid #1e293b; border-radius: 34px; overflow: hidden;
  background: #fff; box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
}
.phone-bar {
  background: #1e293b; color: #fff; font-size: 11px; text-align: center; padding: 4px 0 6px;
}
.phone-body { max-height: 640px; overflow-y: auto; }

/* ---------- 抽奖 ---------- */
.lottery-hero {
  background: linear-gradient(160deg, #1a56db, #4f7ef7 55%, #7c5cf0);
  color: #fff; padding: 22px; text-align: center; border-radius: 16px;
}
.lottery-hero h2 { margin: 0 0 4px; font-size: 19px; }
.lottery-hero p { margin: 0; opacity: .9; font-size: 13px; }

.wheel-wrap { position: relative; width: 300px; height: 300px; margin: 20px auto 8px; }
#wheel { width: 300px; height: 300px; display: block; border-radius: 50%; box-shadow: 0 6px 24px rgba(15,23,42,.18); }
.wheel-pin {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-top: 20px solid #ef4444; z-index: 2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
.wheel-btn { text-align: center; }
.wheel-btn .btn { font-size: 16px; padding: 12px 40px; border-radius: 999px; }

.prize-card {
  text-align: center; padding: 22px; border-radius: 16px;
  background: linear-gradient(160deg, #fff8e6, #fef3c7); border: 1px solid #fde68a;
}
.prize-card .emo { font-size: 46px; }
.prize-card .t { font-size: 20px; font-weight: 800; color: #92400e; margin: 6px 0 2px; }
.prize-card .c { font-size: 13px; color: #a16207; }
.voucher {
  margin: 16px auto 0; max-width: 300px; background: #fff; border: 2px dashed #f0b429;
  border-radius: 12px; padding: 12px;
}
.voucher .no { font-size: 24px; font-weight: 800; letter-spacing: 2px; color: #92400e; font-variant-numeric: tabular-nums; }
.voucher .tip { font-size: 12px; color: #a16207; }

/* ---------- 时间线 ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li {
  display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.tl li:last-child { border-bottom: 0; }
.tl .tm { color: var(--ink-3); font-size: 12px; width: 72px; flex-shrink: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl .ct { flex: 1; }
.tl .ct b { font-weight: 600; }
.tl .ct .sm { color: var(--ink-3); font-size: 12.5px; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 24px; max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal p { margin: 0 0 16px; color: var(--ink-2); font-size: 13.5px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; font-size: 13px; }
.empty .ico { font-size: 30px; display: block; margin-bottom: 6px; opacity: .5; }

/* ---------- 角色切换 ---------- */
.role-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.role-switch button {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.role-switch button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.pill-total { font-size: 12px; color: var(--ink-3); }