:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --line: #e6e8ef;
  --text: #1f2329;
  --muted: #8a919f;
  --primary: #3b6ef6;
  --primary-dark: #2b56c9;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 360px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--primary);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.login-card input {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--primary); }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px;
  background: #12141a;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 0 22px 20px;
  font-size: 18px;
  font-weight: 800;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand span { display: block; font-size: 11px; font-weight: 400; color: #9aa3b2; margin-top: 3px; }
.sidebar nav { flex: 1; padding: 14px 0; }
.sidebar nav a {
  display: block;
  padding: 11px 22px;
  color: #c3c8d4;
  cursor: pointer;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { color: #fff; background: rgba(59,110,246,.18); border-left-color: var(--primary); }
.logout {
  margin: 14px 22px 0;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: transparent;
  color: #c3c8d4;
  border-radius: 8px;
  cursor: pointer;
}
.logout:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* 内容 */
.content { flex: 1; padding: 28px 32px; max-width: 1200px; }
.tab { display: none; }
.tab.active { display: block; }

h2.page-title { margin: 0 0 20px; font-size: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

/* 统计卡片 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat .label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat .value { font-size: 24px; font-weight: 700; }
.stat .value.small { font-size: 18px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.badge.active { background: #e7f6ec; color: var(--green); }
.badge.disabled { background: #fdecec; color: var(--red); }
.badge.recharge { background: #e7f6ec; color: var(--green); }
.badge.charge { background: #fdecec; color: var(--red); }

/* 按钮 */
.btn {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn.danger { background: #fff; border: 1px solid #f3c2c2; color: var(--red); }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal { background: #fff; border-radius: 12px; padding: 26px; width: 420px; max-width: 92vw; }
.modal h3 { margin: 0 0 16px; }
.modal .field { margin-bottom: 12px; }
.modal .field label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 5px; }
.modal .field input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; }
.modal .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
}
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.err { color: var(--red); font-size: 13px; min-height: 18px; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 30px; text-align: center; }

/* 价格编辑内联输入 */
input.price-input { width: 90px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }

/* 模型分配行 */
.model-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.model-row:last-child { border-bottom: none; }
.model-row .model-label { min-width: 160px; font-size: 14px; font-weight: 500; }
.model-row select {
  min-width: 280px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
}

/* 页头：标题 + 右侧按钮 */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head .page-title { margin: 0; }
a.btn { text-decoration: none; display: inline-block; }
