/* ============================================================
   绿幕数字人 · 管理后台（移动端优先）
   ------------------------------------------------------------
   结构：登录 → 概览 / 注册用户 / 充值记录 → 用户详情抽屉 + 充值弹窗
   断点：<720 手机、720+ 平板、900+ 桌面（顶栏 tab 取代底部导航）
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f2f6f3;
  --surface: #ffffff;
  --surface-sub: #f8faf8;
  --ink: #0f1c15;
  --ink-2: #33443a;
  --muted: #6b7c71;
  --muted-2: #8b998f;
  --line: #e2ebe4;
  --line-strong: #d2ded5;
  --brand: #0b7a4b;
  --brand-strong: #075f3a;
  --brand-bright: #12a065;
  --brand-soft: #eaf6ef;
  --brand-softer: #f2faf5;
  --gold: #a86a12;
  --gold-soft: #fdf4e4;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #a15c07;
  --warn-soft: #fdf1dd;
  --info: #0e6a8a;
  --info-soft: #e8f5fa;
  --shadow-card: 0 1px 2px rgba(15, 28, 21, .04), 0 18px 40px -34px rgba(15, 28, 21, .4);
  --shadow-pop: 0 2px 6px rgba(15, 28, 21, .06), 0 30px 60px -28px rgba(15, 28, 21, .35);
  --ring: 0 0 0 3px rgba(11, 122, 75, .16);
  --radius: 16px;
  --max: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 460px at 50% -220px, rgba(18, 160, 101, .12), transparent 70%),
    linear-gradient(180deg, #f7faf8 0%, var(--bg) 42%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

[hidden] { display: none !important; }

::selection { background: #c9f0d8; }

svg { display: block; }

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.tabular { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- 通用控件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .12s ease, color .16s ease;
}

.btn svg { width: 16px; height: 16px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand-bright), var(--brand));
  border-color: var(--brand-strong);
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(11, 122, 75, .9);
}
.btn-primary:hover { background: linear-gradient(180deg, #16ad6d, var(--brand-strong)); }

.btn-soft {
  background: var(--brand-soft);
  border-color: #d5ebdd;
  color: var(--brand-strong);
}
.btn-soft:hover { background: #e0f2e7; }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--surface-sub); border-color: #c3d2c8; }

.btn-block { width: 100%; }
.btn-lg { height: 46px; border-radius: 12px; font-size: 15px; }

.btn-label { display: inline-flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-sub); color: var(--ink); }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 600;
}
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { text-decoration: underline; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

.is-spinning svg { animation: spin .9s linear infinite; }

.sk-block {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: #edf2ee;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ---------------- 启动 ---------------- */

.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------------- 登录 ---------------- */

.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}

.login::before,
.login::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(6px);
  pointer-events: none;
}
.login::before {
  width: 520px;
  height: 520px;
  top: -260px;
  right: -160px;
  background: radial-gradient(circle, rgba(18, 160, 101, .22), transparent 68%);
}
.login::after {
  width: 420px;
  height: 420px;
  bottom: -240px;
  left: -140px;
  background: radial-gradient(circle, rgba(11, 122, 75, .14), transparent 70%);
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 960px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 28, 21, .05), 0 40px 90px -60px rgba(15, 28, 21, .55);
  overflow: hidden;
}

.login-brand {
  display: none;
  flex-direction: column;
  padding: 40px 38px 34px;
  color: #eaf6ef;
  background:
    radial-gradient(420px 260px at 100% 0%, rgba(199, 245, 216, .16), transparent 70%),
    linear-gradient(155deg, #0d5f3d 0%, #073d28 62%, #052f1f 100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-text { font-size: 15px; font-weight: 750; letter-spacing: -.2px; white-space: nowrap; }
.brand-chip {
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-sub);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.login-brand .brand { color: #fff; }
.login-brand .brand-chip {
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: #c9f0d8;
}

.login-brand h1 {
  margin: 34px 0 22px;
  font-size: 30px;
  line-height: 1.28;
  letter-spacing: -.6px;
  color: #fff;
}

.login-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 16px;
}
.login-points li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 11px;
  align-items: start;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(234, 246, 239, .78);
}
.login-points svg {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: #7fe0a9;
}
.login-points strong {
  display: block;
  color: #fff;
  font-size: 13.5px;
  margin-bottom: 1px;
}

.login-note {
  margin: 30px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 11.5px;
  color: rgba(234, 246, 239, .55);
}

.login-card {
  padding: 30px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}

.login-mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.login-mobile-brand .brand-text { font-size: 15px; font-weight: 750; }
.login-mobile-brand .brand-chip { font-size: 10px; }

.login-card-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -.4px;
}
.login-card-head p {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.field { display: block; }
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted-2);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 40px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-sub);
  font-size: 15px;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.input-wrap input::placeholder { color: var(--muted-2); }
.input-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: var(--ring);
}
.input-action {
  position: absolute;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}
.input-action svg { width: 19px; height: 19px; }
.input-action:hover { background: var(--brand-soft); color: var(--brand-strong); }

.form-error {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #f5c6c1;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.login-hint {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}
.login-hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-sub);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

/* ---------------- 顶栏 ---------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.appbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: var(--max);
  height: 58px;
  margin: 0 auto;
  padding: 0 14px;
}

.appbar .brand-mark { width: 30px; height: 30px; }
.appbar .brand-text { font-size: 14.5px; }
.appbar .brand-chip { font-size: 10px; padding: 1px 6px; }

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.admin-chip svg { width: 15px; height: 15px; }

.top-tabs {
  display: none;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 14px;
  gap: 2px;
}

.top-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
}
.top-tab svg { width: 17px; height: 17px; }
.top-tab:hover { color: var(--ink); }
.top-tab[aria-selected="true"] { color: var(--brand-strong); }
.top-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2.5px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
}

/* ---------------- 页面骨架 ---------------- */

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 14px calc(84px + env(safe-area-inset-bottom));
}

.view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  animation: viewIn .22s ease both;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}
.page-head h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -.4px;
}
.page-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.page-head .btn { height: 36px; padding: 0 11px; font-size: 12.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 15px 10px;
}
.card-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -.1px;
}

.card-body { padding: 0 0 6px; }

/* ---------------- 概览 ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  position: relative;
  padding: 13px 13px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}
.stat-head svg { width: 15px; height: 15px; flex: none; }

.stat-value {
  margin-top: 2px;
  font-size: 23px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -.7px;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  margin-left: 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}
.stat-sub b { color: var(--ink-2); font-weight: 650; }

.stat.is-accent {
  border-color: #cde8d8;
  background:
    radial-gradient(220px 120px at 100% 0%, rgba(18, 160, 101, .16), transparent 70%),
    linear-gradient(160deg, #f2fbf6, #eaf6ef);
}
.stat.is-accent .stat-head { color: var(--brand-strong); }
.stat.is-accent .stat-value { color: var(--brand-strong); }
.stat.is-accent .stat-sub { color: #4d6c5b; }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.chart-card { padding: 14px 14px 10px; }

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.chart-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.chart-head span {
  font-size: 11px;
  color: var(--muted);
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  padding-top: 6px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
}

.bar-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 92px;
  border-radius: 6px;
  background: linear-gradient(180deg, transparent, rgba(15, 28, 21, .025));
}

.bar {
  width: min(70%, 26px);
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #34c281, var(--brand));
  transition: height .35s cubic-bezier(.22, 1, .36, 1);
}
.chart-card.is-gold .bar { background: linear-gradient(180deg, #e5b25f, #b7791f); }
.bar.is-today { box-shadow: 0 0 0 3px rgba(11, 122, 75, .12); }
.chart-card.is-gold .bar.is-today { box-shadow: 0 0 0 3px rgba(183, 121, 31, .14); }

.bar-value {
  min-height: 13px;
  font-size: 9.5px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-label {
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.recent-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.recent-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  width: 100%;
  background: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
  color: inherit;
}
.recent-row:first-child { border-top: 0; }
.recent-row:hover { background: var(--surface-sub); }

.recent-main { min-width: 0; }
.recent-main strong {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-main span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-side {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.recent-side strong { display: block; font-size: 12.5px; }
.recent-side span { display: block; font-size: 10.5px; color: var(--muted); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  background: hsl(var(--h, 150) 40% 92%);
  color: hsl(var(--h, 150) 46% 28%);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .2px;
  user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------------- 工具条 / 列表 ---------------- */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar-wrap { flex-wrap: wrap; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 0;
}
.search svg {
  position: absolute;
  left: 11px;
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 35px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  font-size: 13.5px;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.select {
  height: 42px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M7 9.5l5 5 5-5' fill='none' stroke='%236b7c71' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
}

.chips {
  display: flex;
  gap: 6px;
  flex: 1 1 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.list-card { overflow: hidden; }

.list-head {
  display: none;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sub);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .2px;
}
.list-head.users-head { grid-template-columns: 46px minmax(0, 1.35fr) minmax(0, 1.5fr) 128px; }
.list-head > span:nth-child(1) { grid-column: 1 / 3; padding-left: 58px; }

.list-body { display: block; }

.list-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-areas:
    "avatar identity actions"
    ". metrics metrics";
  align-items: center;
  gap: 10px 11px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background .14s ease;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-sub); }
.list-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(11, 122, 75, .28); }

.list-row .avatar { grid-area: avatar; align-self: start; margin-top: 1px; }

.identity {
  grid-area: identity;
  min-width: 0;
}
.identity strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.identity .sub {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.identity .sub .sep { margin: 0 4px; color: var(--line-strong); }
.identity .id {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
}

.row-metrics {
  grid-area: metrics;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}
.metric { min-width: 0; }
.metric > span:first-child {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 2px;
  white-space: nowrap;
}
.metric > strong,
.metric > .badge {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric small {
  margin-left: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}
.metric .approx { color: var(--muted); font-size: 10.5px; font-weight: 500; }

.row-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: center;
}
.row-actions .btn {
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12.5px;
}
.row-actions .icon-btn { width: 34px; height: 34px; }
.row-actions .icon-btn svg { width: 17px; height: 17px; }

.orders-head { grid-template-columns: 46px minmax(0, 1.5fr) minmax(0, 1.15fr) 110px; }

.order-row {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-areas:
    "avatar identity status"
    ". metrics metrics";
}
.order-row .order-status { grid-area: status; align-self: start; margin-top: 2px; }
.order-row .order-time {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-row .metric .pos { color: var(--brand-strong); }
.order-row .metric .zero { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.badge.ok { background: var(--brand-soft); color: var(--brand-strong); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: #eff3f0; color: var(--muted); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-sub);
}
.pager-info {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pager-btns { display: flex; align-items: center; gap: 6px; }
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
}
.pager-btn svg { width: 15px; height: 15px; }
.pager-btn[disabled] { opacity: .45; cursor: not-allowed; }
.pager-btn:not([disabled]):hover { border-color: #b9cbbf; background: var(--brand-softer); }

/* ---------------- 空态 / 加载 ---------------- */

.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 34px; height: 34px; color: var(--muted-2); opacity: .7; }
.empty strong { font-size: 13px; color: var(--ink-2); font-weight: 650; }
.empty span { font-size: 11.5px; }
.empty .btn { margin-top: 10px; }

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
}
.skeleton-row:first-child { border-top: 0; }
.skeleton-row .sk-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  background: #edf2ee;
}
.skeleton-row .sk-lines { flex: 1; display: grid; gap: 7px; }
.skeleton-row .sk-line {
  height: 10px;
  border-radius: 5px;
  background: #edf2ee;
}
.skeleton-row .sk-line.w60 { width: 60%; }
.skeleton-row .sk-line.w35 { width: 35%; }
.skeleton-row .sk-line.w20 { width: 20%; }
.sk-avatar, .sk-line { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

/* ---------------- 底部导航 ---------------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
}
.bottom-tab svg { width: 21px; height: 21px; }
.bottom-tab[aria-selected="true"] { color: var(--brand-strong); background: var(--brand-soft); }

/* ---------------- 抽屉 ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 28, 21, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn .18s ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer-overlay { display: flex; justify-content: flex-end; }

.drawer {
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-width: 100vw;
  height: 100%;
  background: var(--bg);
  box-shadow: -20px 0 60px -20px rgba(15, 28, 21, .4);
  overflow: hidden;
  animation: slideIn .24s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes slideIn {
  from { transform: translateX(28px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 16px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .8px;
  color: var(--brand);
  text-transform: uppercase;
}
.drawer-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.3px;
  word-break: break-all;
}
.drawer-body {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: start;
}

.detail-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid #cde8d8;
  border-radius: 15px;
  background:
    radial-gradient(200px 100px at 100% 0%, rgba(18, 160, 101, .14), transparent 70%),
    linear-gradient(160deg, #f4fbf7, #eaf6ef);
}
.detail-identity .avatar { width: 50px; height: 50px; font-size: 17px; }
.detail-identity .who { min-width: 0; flex: 1; }
.detail-identity .who strong {
  display: block;
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-identity .who span {
  display: block;
  font-size: 11.5px;
  color: #4d6c5b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-identity .who .detail-id {
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 10px;
  color: #5d7a69;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.detail-stat {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.detail-stat span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}
.detail-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.detail-stat small { font-size: 10px; color: var(--muted); font-weight: 600; }

.detail-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sub);
}
.detail-section-head h3 { margin: 0; font-size: 12.5px; }
.detail-section-head span { font-size: 10.5px; color: var(--muted); }
.detail-empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 13px;
  border-top: 1px solid var(--line);
}
.mini-row:first-child { border-top: 0; }
.mini-row .mr-main { min-width: 0; }
.mini-row .mr-main strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-row .mr-main span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-row .mr-side {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mini-row .mr-side strong { display: block; font-size: 12.5px; }
.mini-row .mr-side span { display: block; margin-top: 1px; font-size: 10px; color: var(--muted); }
.amount-pos { color: var(--brand-strong); }
.amount-neg { color: var(--danger); }
.amount-zero { color: var(--muted); }

.detail-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 4px;
}

/* ---------------- 弹窗 / 充值 ---------------- */

.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
}

.modal {
  width: 100%;
  max-width: 440px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: popIn .22s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 17px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }

.modal-body {
  padding: 15px 17px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.recharge-target {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-sub);
  margin-bottom: 14px;
}
.recharge-target .who { min-width: 0; flex: 1; }
.recharge-target .who strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recharge-target .who span { display: block; font-size: 11px; color: var(--muted); }
.recharge-target .balance { text-align: right; }
.recharge-target .balance span { display: block; font-size: 10px; color: var(--muted); }
.recharge-target .balance strong { font-size: 14px; font-variant-numeric: tabular-nums; }

.form-block { display: grid; gap: 7px; margin-bottom: 14px; }
.form-block > label,
.form-block .block-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-sub);
  height: 54px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.amount-input:focus-within {
  border-color: var(--brand);
  background: #fff;
  box-shadow: var(--ring);
}
.amount-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.amount-input input:focus { outline: none; }
.amount-input .unit { font-size: 12.5px; font-weight: 650; color: var(--muted); }

.amount-hint {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.amount-hint b { color: var(--brand-strong); font-size: 13px; font-variant-numeric: tabular-nums; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 2px;
}
.quick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.quick:hover { border-color: #b9cbbf; background: var(--brand-softer); }
.quick.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-sub);
  font-size: 13.5px;
}
.text-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: var(--ring);
}

.form-tip {
  display: flex;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--brand-softer);
  border: 1px solid #d9ece1;
  color: #3f5e4d;
  font-size: 11.5px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.form-tip svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--brand); }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions .btn { flex: 1; }

.recharge-success {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 4px 4px;
  text-align: center;
}
.recharge-success .ok-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}
.recharge-success .ok-icon svg { width: 32px; height: 32px; }
.recharge-success h3 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.recharge-success p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.success-amount {
  margin: 12px 0 4px;
  padding: 13px 18px;
  border-radius: 13px;
  border: 1px solid #cde8d8;
  background: linear-gradient(160deg, #f4fbf7, #eaf6ef);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.8px;
  color: var(--brand-strong);
  font-variant-numeric: tabular-nums;
}
.success-amount small { margin-left: 3px; font-size: 12px; font-weight: 650; }
.success-meta {
  margin: 8px 0 2px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
}
.success-meta .mono { font-family: var(--mono); font-size: 10.5px; overflow-wrap: anywhere; }

.success-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 14px; }

/* ---------------- Toast ---------------- */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 28px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 11px;
  background: #12301f;
  color: #eef7f1;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 12px 30px -14px rgba(15, 28, 21, .6);
  animation: toastIn .2s ease both;
}
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: #7fe0a9; }
.toast.is-error { background: #4a1512; }
.toast.is-error svg { color: #ffb4ab; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 无脚本 ---------------- */

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 99;
  padding: 12px 14px;
  border-radius: 12px;
  background: #4a1512;
  color: #fff;
  font-size: 13px;
}

/* ============================================================
   响应式
   ============================================================ */

@media (min-width: 480px) {
  .appbar-inner { padding: 0 18px; }
  .page { padding-left: 18px; padding-right: 18px; }
  .stat-grid { gap: 12px; }
  .stat { padding: 15px 16px; }
  .stat-value { font-size: 25px; }
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .login-card { padding: 34px 32px 28px; }
}

@media (min-width: 720px) {
  .login { padding: 32px 24px; }
  .login-shell { grid-template-columns: 1.02fr .98fr; }
  .login-brand { display: flex; }
  .login-card { padding: 42px 38px 34px; }
  .login-mobile-brand { display: none; }
  .login-shell { border-radius: 28px; }

  .toolbar { flex-wrap: nowrap; }
  .toolbar-wrap { flex-wrap: wrap; }

  .page { padding: 24px 22px calc(48px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: none; }
  .top-tabs { display: flex; }
  .appbar-inner { padding: 0 22px; }

  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .stat { min-height: 108px; padding: 16px; }
  .stat-value { font-size: 27px; }

  .chart-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .recent-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  .list-head { display: grid; align-items: center; gap: 14px; }

  .list-row {
    grid-template-columns: 46px minmax(0, 1.35fr) minmax(0, 1.5fr) 128px;
    grid-template-areas: "avatar identity metrics actions";
    gap: 14px;
    padding: 13px 15px;
  }
  .list-row .avatar { align-self: center; margin-top: 0; width: 42px; height: 42px; font-size: 14px; }
  .identity strong { font-size: 13.5px; }
  .row-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding-top: 0;
    border-top: 0;
  }
  .metric > strong { font-size: 13.5px; }
  .row-actions .btn { height: 36px; padding: 0 13px; }
  .pager { padding: 12px 16px; }
  .drawer-body { padding: 16px 18px 28px; }
  .detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-actions { grid-template-columns: 1fr 1fr; }
  .toast-stack { left: auto; right: 20px; bottom: 20px; transform: none; }

  .order-row {
    grid-template-columns: 46px minmax(0, 1.5fr) minmax(0, 1.15fr) 110px;
    grid-template-areas: "avatar identity metrics status";
  }
}

@media (min-width: 980px) {
  .page { padding-top: 28px; }
  .page-head h1 { font-size: 23px; }
  .stat-grid { gap: 14px; }
  .stat { padding: 17px 18px; min-height: 114px; }
  .stat-value { font-size: 29px; }
  .chart-card { padding: 16px 18px 12px; }
  .bars { gap: 8px; }
  .bar-track { height: 112px; }
  .bar-label { font-size: 10px; }
}

/* 触屏设备去掉 hover 残留 */
@media (hover: none) {
  .list-row:hover, .recent-row:hover { background: transparent; }
}

/* iOS 输入框小于 16px 会自动放大页面，手机上统一放大到 16px */
@media (max-width: 719px) {
  .input-wrap input,
  .search input,
  .text-input,
  .select { font-size: 16px; }

  /* 工具条在手机上分两行：搜索独占一行，筛选/刷新排在下一行。 */
  .toolbar > .search { flex: 1 1 100%; }
  .toolbar-wrap > .search { flex: 1 1 220px; }
  .toolbar .select { flex: 1 1 auto; }
  .toolbar > .btn-ghost { flex: 0 0 42px; width: 42px; padding: 0; }
  .toolbar > .btn-ghost .btn-label { display: none; }
}

/* 320~374px 的小屏（iPhone SE 一代 / 老 Android）：顶栏更紧凑，数字不换行 */
@media (max-width: 374px) {
  .appbar-inner { padding: 0 10px; gap: 6px; }
  .appbar .brand-mark { width: 28px; height: 28px; }
  .appbar .brand-text { font-size: 13.5px; }
  .appbar .brand-chip { display: none; }
  .admin-chip { padding: 0 8px; font-size: 11px; }
  .admin-chip svg { width: 14px; height: 14px; }
  .page { padding-left: 12px; padding-right: 12px; }
  .stat { padding: 12px; min-height: 92px; }
  .stat.is-accent,
  .stat-grid > .stat:nth-child(3) { grid-column: 1 / -1; }
  .stat-value { font-size: 21px; }
  .stat-sub { font-size: 10.5px; }
  .login-card { padding: 26px 18px 22px; }
  .login-card-head h2 { font-size: 20px; }
  .drawer-body { padding-left: 12px; padding-right: 12px; }
  .modal { border-radius: 16px; }
  .modal-body { padding-left: 14px; padding-right: 14px; }
  .row-metrics { gap: 6px; }
  .metric > span:first-child { font-size: 10px; }
  .metric > strong { font-size: 12.5px; }
  .identity strong { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
