/* 个人量化时代 · 课程商城  移动优先样式 */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e8edf5;
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --primary-soft: #eef4ff;
  --ok: #16a34a;
  --ok-soft: #e9f9ef;
  --warn: #d97706;
  --warn-soft: #fff7e6;
  --danger: #e11d48;
  --danger-soft: #ffeef1;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 8px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
  --nav-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }

/* ---------- 布局 ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 0 14px calc(var(--nav-h) + 28px); }
.page--wide { max-width: 1100px; }
.page--nopad { padding: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(244, 246, 251, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(232, 237, 245, .8);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.topbar .spacer { flex: 1; }
.topbar .back {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; color: var(--ink-2); cursor: pointer;
}

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px; border: 1px solid rgba(232, 237, 245, .7);
}
.card--flat { box-shadow: none; }
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
.card h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 4px 10px; font-size: 13px; color: var(--ink-3); font-weight: 600;
  letter-spacing: .4px;
}

.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.col { flex: 1; min-width: 0; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.center { text-align: center; }
.muted { color: var(--ink-3); font-size: 12.5px; }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px; }
.strong { font-weight: 650; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform .12s ease, opacity .12s ease;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--soft { background: var(--primary-soft); color: var(--primary); }
.btn--ok { background: var(--ok); }
.btn--danger { background: var(--danger); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; width: auto; }
.btn--block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 550; }
.field label .req { color: var(--danger); margin-left: 2px; }
.input, select.input, textarea.input {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line);
  background: #fbfcfe; padding: 0 14px; font-size: 15px; color: var(--ink); outline: none;
  transition: border-color .15s, background .15s;
}
textarea.input { height: auto; padding: 12px 14px; min-height: 90px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.input[disabled] { background: #f1f4f9; color: var(--ink-3); }
.input-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.input-group { display: flex; gap: 8px; }
.input-group .btn { width: auto; flex: 0 0 auto; padding: 0 14px; height: 46px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  display: flex;
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--ink-3); cursor: pointer; border: 0; background: none;
  padding: 0; transition: color .15s;
}
.tabbar__item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tabbar__item.is-active { color: var(--primary); font-weight: 600; }
.tabbar__item.is-active svg { stroke-width: 2.2; }

/* ---------- 徽标 / 标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--primary-soft); color: var(--primary);
  white-space: nowrap;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--gray { background: #f1f5f9; color: var(--ink-2); }
.badge--test { background: #fff4e6; color: #c2410c; border: 1px dashed #fdba74; }

/* ---------- 头像 ---------- */
.avatar {
  width: 46px; height: 46px; border-radius: 14px; flex: 0 0 auto;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 17px;
}
.avatar--sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }

/* ---------- 金额 ---------- */
.money { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.3px; }
.money--lg { font-size: 28px; }
.money--ok { color: var(--ok); }
.money--danger { color: var(--danger); }
.money--primary { color: var(--primary); }
.money .unit { font-size: .62em; font-weight: 600; margin-right: 2px; }

/* ---------- 账户三宫格 ---------- */
.wallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wallet-cell {
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center;
}
.wallet-cell .label { font-size: 11.5px; color: var(--ink-3); margin-bottom: 4px; }
.wallet-cell .value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wallet-cell.is-main { background: linear-gradient(135deg, #eff6ff, #eef2ff); border-color: #dbeafe; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list__item {
  display: flex; align-items: center; gap: 12px; padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.list__item:last-child { border-bottom: 0; }
.list__item--tap { cursor: pointer; }
.list__item--tap:active { background: #f8fafc; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-size: 14.5px; font-weight: 550; }
.list__sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.list__right { text-align: right; flex: 0 0 auto; }

/* ---------- 课程卡 ---------- */
.course-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  margin-bottom: 14px; border: 1px solid rgba(232, 237, 245, .7);
}
.course-cover {
  height: 104px; padding: 16px 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
}
.course-cover.c2 { background: linear-gradient(135deg, #0e7490, #2563eb); }
.course-cover.c3 { background: linear-gradient(135deg, #7c3aed, #db2777); }
.course-cover.c0 { background: linear-gradient(135deg, #475569, #64748b); }
.course-cover::after {
  content: ''; position: absolute; right: -30px; top: -40px; width: 140px; height: 140px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.course-cover .k { font-size: 11px; opacity: .85; letter-spacing: 1px; }
.course-cover .t { font-size: 18px; font-weight: 700; margin-top: 2px; }
.course-cover .s { font-size: 12px; opacity: .9; margin-top: 4px; }
.course-body { padding: 14px 18px 16px; }
.price-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-now { font-size: 22px; font-weight: 750; color: var(--danger); font-variant-numeric: tabular-nums; }
.price-orig { font-size: 13px; color: var(--ink-3); text-decoration: line-through; }
.price-hint { font-size: 12px; color: var(--warn); background: var(--warn-soft); padding: 2px 8px; border-radius: 6px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); font-size: 13.5px; }
.empty .ico { font-size: 30px; margin-bottom: 8px; opacity: .5; }

/* ---------- 支付弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sheet-mask.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(20px); transition: transform .22s ease;
  max-height: 92vh; overflow: auto;
}
.sheet-mask.is-open .sheet { transform: translateY(0); }
.sheet__handle { width: 38px; height: 4px; border-radius: 4px; background: #e2e8f0; margin: 0 auto 14px; }
.qr-box { display: grid; place-items: center; padding: 8px; }
.qr-box img { width: 216px; height: 216px; border-radius: 12px; border: 1px solid var(--line); }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; left: 0; right: 0; top: 18px; z-index: 999; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(15, 23, 42, .92); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13.5px; max-width: 86vw; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  animation: toast-in .2s ease;
}
.toast--ok { background: rgba(22, 163, 74, .95); }
.toast--err { background: rgba(225, 29, 72, .95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 表格（后台） ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap .table { min-width: 820px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table th { font-weight: 600; color: var(--ink-2); background: #f8fafc; font-size: 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table tr:hover td { background: #fbfcfe; }
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { height: 38px; width: auto; min-width: 140px; }
.toolbar select.input { min-width: 110px; }
.pill-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.pill {
  padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.pill.is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------- 骨架 / 加载 ---------- */
.loading { display: grid; place-items: center; padding: 40px; color: var(--ink-3); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 工具 ---------- */
.hide { display: none !important; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.code-chip {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; background: #f1f5f9;
  font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; letter-spacing: .8px; margin: 0 4px 6px 0;
  cursor: pointer;
}
.code-chip:hover { background: #e2e8f0; }
.copy-all { font-size: 12px; color: var(--primary); cursor: pointer; }
.rank-badge {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; background: #f1f5f9; color: var(--ink-2);
}
.rank-badge.r1 { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }
.rank-badge.r2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; }
.rank-badge.r3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }

@media (min-width: 700px) {
  .page { padding-top: 8px; }
  body { font-size: 15px; }
}

/* 两行截断 */
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
