:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --sidebar-bg: #ffffff;
  --input-bg: #ffffff;
  --surface-soft: #fbfcfd;
  --surface-muted: #f1f3f5;
  --hover: #f4f6f9;
  --ink: #1b1f26;
  --ink-soft: #374151;
  --muted: #6b7280;
  --placeholder: #98a2b3;
  --nav-ink-soft: #5b6472;
  --icon-muted: #9aa3af;
  --line: #e5e7eb;
  --line-soft: #eef0f3;
  --line-strong: #cfd4dc;
  --brand: #2f6bff;
  --brand-dark: #1f4fd8;
  --link: #2f6bff;
  --on-brand: #ffffff;
  --brand-soft: #eef4ff;
  --brand-line: #bfd7ff;
  --focus-ring: rgba(47, 107, 255, .12);
  --danger: #d92d20;
  --danger-soft-bg: #fef3f2;
  --danger-soft-line: #fbd9d5;
  --danger-soft-ink: #912018;
  --warn: #b45309;
  --warn-bg: #fffaeb;
  --warn-line: #fde9b8;
  --warn-strong-ink: #93370d;
  --ok: #067647;
  --ok-bg: #f4fbf7;
  --ok-line: #d9eadf;
  --ok-strong-bg: #ecfdf3;
  --ok-strong-line: #c6f0d9;
  --ok-strong-ink: #05603a;
  --neutral-chip-bg: #f3f4f6;
  --neutral-chip-ink: #4b5563;
  --notice-bg: #f2f7ff;
  --notice-line: #dbe8ff;
  --notice-ink: #1e3a8a;
  --hint-bg: #f7f9fc;
  --hint-line: #eaeef5;
  --hint-ink: #4b5563;
  --modal-mask: rgba(16, 24, 40, .5);
  --toast-bg: #141922;
  --toast-ink: #ffffff;
  --shadow-card: 0 12px 40px rgba(16, 24, 40, .08);
  --shadow-modal: 0 20px 60px rgba(16, 24, 40, .25);
  --shadow-toast: 0 8px 24px rgba(0, 0, 0, .2);
  --shadow-pill: 0 1px 2px rgba(16, 24, 40, .08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --control-height: 36px;
  --control-height-sm: 30px;
  --control-radius: var(--radius-md);
  --control-pad-x: 11px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 基础控件 ---------- */
.btn {
  height: var(--control-height);
  padding: 0 14px;
  border-radius: var(--control-radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--hover); border-color: transparent; }
.btn.sm { height: var(--control-height-sm); padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select {
  width: 100%;
  height: var(--control-height);
  padding: 0 var(--control-pad-x);
  border: 1px solid var(--control-border, var(--line));
  border-radius: var(--control-radius);
  background: var(--input-bg);
  color: var(--ink);
  outline: none;
}
.field input::placeholder { color: var(--placeholder); }
.field input:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); }
.field .hint { font-size: 12px; color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.neutral { background: var(--neutral-chip-bg); color: var(--neutral-chip-ink); border-color: transparent; }
.pill.ok { background: var(--ok-strong-bg); color: var(--ok-strong-ink); border-color: var(--ok-strong-line); }
.pill.warn { background: var(--warn-bg); color: var(--warn-strong-ink); border-color: var(--warn-line); }
.pill.danger { background: var(--danger-soft-bg); color: var(--danger-soft-ink); border-color: var(--danger-soft-line); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex: 0 0 7px; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 18% 12%, rgba(47, 107, 255, .10), transparent 34%),
    radial-gradient(circle at 88% 88%, rgba(47, 107, 255, .07), transparent 32%),
    linear-gradient(180deg, #f8faff 0%, #f3f5f9 100%);
}
.login-card {
  width: min(430px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 30px 30px 22px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, #3c78ff, #2457e6);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(47, 107, 255, .28);
}
.brand-mark svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
.brand-mark.small svg { width: 17px; height: 17px; }
.login-title { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.login-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.domain-seal {
  display: inline-flex;
  margin-top: 22px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--link);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .3px;
}
.login-card h1 { font-size: 24px; margin: 16px 0 6px; letter-spacing: -.4px; }
.login-desc { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0 0 22px; }
#loginForm { display: grid; gap: 15px; }
.form-error {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--danger-soft-line);
  background: var(--danger-soft-bg);
  color: var(--danger-soft-ink);
  font-size: 12.5px;
}
.login-foot {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px;
}

/* ---------- 骨架 ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 9px 16px; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  min-height: 36px; padding: 7px 10px;
  border-radius: 8px;
  color: var(--nav-ink-soft);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item .ic { color: var(--icon-muted); width: 17px; height: 17px; flex: 0 0 17px; display: grid; place-items: center; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.on { background: var(--brand-soft); color: var(--link); border-color: #e3edff; }
.nav-item.on .ic { color: var(--link); }
.nav-item[disabled] { opacity: .48; cursor: default; }
.nav-item[disabled]:hover { background: transparent; color: var(--nav-ink-soft); }
.nav-section { margin: 14px 10px 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .8px; color: var(--icon-muted); text-transform: uppercase; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 2px; }
.side-env { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--warn-strong-ink); font-weight: 600; }
.side-email { font-size: 11.5px; color: var(--muted); margin-top: 6px; word-break: break-all; }
.side-link {
  margin-top: 10px; border: 0; background: transparent; padding: 0;
  color: var(--muted); font-size: 12px; text-align: left;
}
.side-link:hover { color: var(--danger); }

.main { min-width: 0; }
.topbar {
  min-height: 76px;
  padding: 16px 26px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: -.7px; line-height: 1.2; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.admin-chip { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); }
.admin-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 12px; }
.page { padding: 22px 26px 40px; max-width: 1500px; }

/* ---------- 面板与卡片 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.panel-body { padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 17px 18px;
  min-height: 106px;
}
.stat .k { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.stat .v { font-size: 29px; font-weight: 800; letter-spacing: -1px; margin-top: 10px; line-height: 1.1; }
.stat .s { margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.stat-ic { width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 12px; }

.notice {
  padding: 11px 14px;
  border: 1px solid var(--notice-line);
  border-radius: 10px;
  background: var(--notice-bg);
  color: var(--notice-ink);
  font-size: 12.5px;
  line-height: 1.65;
}
.hint { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--hint-line); background: var(--hint-bg); color: var(--hint-ink); font-size: 12px; line-height: 1.7; }

.kv { display: grid; gap: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row > span { color: var(--muted); }
.kv-row > b { font-weight: 600; text-align: right; }

.bar { height: 7px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4d84ff, var(--brand)); }
.usage { display: grid; gap: 7px; margin: 12px 0; }
.usage-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.usage-top span { color: var(--ink-soft); font-weight: 600; }
.usage-top b { color: var(--muted); font-weight: 500; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; border-radius: inherit; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
  text-align: left;
  padding: 15px 16px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-soft); }
tbody tr.clickable { cursor: pointer; }
.td-main { font-weight: 600; color: var(--ink); }
.td-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.empty { padding: 38px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 7px; }
.pager button { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); font-size: 12px; }
.pager button:hover { background: var(--hover); }
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- 筛选 ---------- */
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .field { min-width: 160px; }
.filters .field.search { flex: 1 1 240px; }
.filters .btn { flex: 0 0 auto; }

/* ---------- 套餐 ---------- */
.plan-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.plan-card .plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.plan-card h3 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.plan-card .code { color: var(--muted); font-size: 11px; margin-top: 3px; font-family: ui-monospace, monospace; }
.plan-price { font-size: 27px; font-weight: 800; letter-spacing: -1px; margin: 3px 0 0; }
.plan-price small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.plan-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.plan-meta div { font-size: 12px; }
.plan-meta span { color: var(--muted); display: block; }
.plan-meta b { font-weight: 650; margin-top: 2px; display: block; }

/* ---------- 抽屉 ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 100; display: flex; justify-content: flex-end; }
.drawer {
  width: min(650px, 92vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
}
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.drawer-head h3 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.drawer-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.drawer-body { padding: 20px; overflow-y: auto; display: grid; gap: 18px; }
.drawer-close { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 18px; color: var(--muted); }
.section-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: -.1px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: var(--modal-mask); z-index: 120; display: grid; place-items: center; padding: 24px; }
.modal { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-modal); }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 20px; letter-spacing: -.5px; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.modal-body { padding: 18px 22px; display: grid; gap: 14px; }
.modal-foot { padding: 0 22px 22px; display: flex; justify-content: flex-end; gap: 10px; }
.modal .form-error { margin-top: 2px; }

/* ---------- Toast ---------- */
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; background: var(--toast-bg); color: var(--toast-ink); padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow-toast); font-size: 12.5px; max-width: 380px; }
.toast.error { background: #7f1d1d; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 206px minmax(0, 1fr); }
  .page { padding: 18px 18px 34px; }
  .topbar { padding: 14px 18px 12px; }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { position: static; }
  .grid.three { grid-template-columns: 1fr; }
  .top-actions .pill { display: none; }
}
@media (max-width: 620px) {
  .login-card { padding: 24px 22px 18px; }
  .grid.cards { grid-template-columns: 1fr; }
  .filters .field { min-width: 100%; }
  .topbar h2 { font-size: 21px; }
  .drawer { width: 100vw; }
}
