:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e5e8ee;
  --text: #1b2230;
  --muted: #6b7480;
  --primary: #2563eb;
  --primary-soft: #eef3ff;
  --green: #12805c;
  --green-soft: #e7f7f0;
  --amber: #9a5b00;
  --amber-soft: #fff4e2;
  --red: #b42318;
  --red-soft: #fdeceb;
  --gray-soft: #f1f3f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #e8efff 0%, var(--bg) 60%);
  padding: 24px;
}

.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

.login-card h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.2px; }
.login-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.login-card .field { margin-bottom: 14px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: #101827;
  color: #cfd6e3;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #4f8cff, #2f5fe0);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.brand b { color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand small { display: block; color: #7d8798; font-size: 11px; font-weight: 400; margin-top: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  font-size: 13.5px; color: #b9c2d1; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(79, 140, 255, .16); color: #fff; font-weight: 600; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #4f8cff; opacity: 0; }
.nav-item.active .dot { opacity: 1; }

.sidebar-foot { margin-top: auto; padding: 12px 10px; font-size: 11.5px; color: #6f7a8b; line-height: 1.6; border-top: 1px solid rgba(255,255,255,.07); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.content { padding: 22px 26px 60px; max-width: 1400px; width: 100%; }

/* ---------- 卡片与统计 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 16px 14px; box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 26px; font-weight: 650; letter-spacing: -.5px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.card .hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.card.accent .value { color: var(--primary); }
.card.money .value { color: #b45309; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 表单控件 ---------- */
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input, .select, textarea.input {
  width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.input.search { width: 240px; }

.btn {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #f7f8fa; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4fd8; }
.btn.danger { color: var(--red); border-color: #f3c7c3; background: var(--red-soft); }
.btn.danger:hover { background: #fbdcd9; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { background: #fafbfc; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .02em; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 20px; font-size: 12px; font-weight: 500;
}
.pill.member { background: var(--green-soft); color: var(--green); }
.pill.trial { background: var(--primary-soft); color: var(--primary); }
.pill.expired { background: var(--amber-soft); color: var(--amber); }
.pill.free { background: var(--gray-soft); color: var(--muted); }
.pill.banned { background: var(--red-soft); color: var(--red); }
.pill.paid { background: var(--green-soft); color: var(--green); }
.pill.pending { background: var(--amber-soft); color: var(--amber); }
.pill.closed, .pill.refunded { background: var(--gray-soft); color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: var(--muted); font-size: 12.5px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- 抽屉 ---------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 560px; max-width: 96vw;
  background: var(--panel); z-index: 50; transform: translateX(100%); transition: transform .22s ease;
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(16, 24, 40, .12);
}
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-head h3 { margin: 0 0 4px; font-size: 16px; }
.drawer-body { padding: 18px 22px 40px; overflow-y: auto; flex: 1; }
.drawer-section { margin-bottom: 22px; }
.drawer-section h4 { font-size: 12.5px; color: var(--muted); font-weight: 500; margin: 0 0 10px; letter-spacing: .02em; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; }
.mini-item .top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mini-item .sub { color: var(--muted); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-16px);
  background: #101827; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: #b42318; }

/* ---------- 设置页 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding: 18px; }
.hint-text { color: var(--muted); font-size: 12px; line-height: 1.7; }
.section-pad { padding: 18px; }

@media (max-width: 860px) {
  .sidebar { width: 68px; flex: 0 0 68px; padding: 16px 10px; }
  .brand b, .brand small, .nav-item span, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .content { padding: 16px; }
  .input.search { width: 150px; }
}

/* ---------- 收款渠道状态 ---------- */
.pay-status { padding: 4px 20px 18px; }
.pay-mode {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 0 14px; border-bottom: 1px dashed var(--border); margin-bottom: 6px;
}
.pay-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.pay-row:last-of-type { border-bottom: none; }
.pay-name { font-weight: 600; font-size: 13.5px; min-width: 160px; }
.pay-state { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.pay-state.on { background: var(--green-soft); color: var(--green); }
.pay-state.off { background: var(--red-soft); color: var(--red); }
.pay-hint { font-size: 12px; color: var(--muted); }
.pay-tip {
  margin-top: 14px; padding: 11px 13px; border-radius: 10px;
  background: var(--gray-soft); color: var(--muted); font-size: 12px; line-height: 1.75;
}
.pay-tip code {
  background: #fff; border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-size: 11.5px; color: var(--text);
}
