:root {
  --emerald: #22c55e;
  --emerald-d: #16a34a;
  --emerald-l: #4ade80;
  --bg: #0b1411;
  --bg2: #0f1d18;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(34, 197, 94, 0.45);
  --text: #e8f3ee;
  --muted: #8aa79a;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(34, 197, 94, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 197, 94, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  min-height: 100%;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.glass {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 380px; max-width: 100%; border-radius: 20px; padding: 32px 28px; position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.logo {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-d));
  color: #04130b; font-weight: 800; font-size: 22px;
}
.logo.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 16px; }
.brand-name { font-weight: 700; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line);
  color: var(--text); font-size: 14px; outline: none;
  position: relative; z-index: 2; pointer-events: auto;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--line-strong); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-size: 13px; cursor: pointer;
  transition: 0.15s; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:hover { border-color: var(--line-strong); }
.btn-primary { background: linear-gradient(135deg, var(--emerald), var(--emerald-d)); color: #04130b; border: none; font-weight: 700; width: 100%; padding: 11px; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.12); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-success { color: var(--emerald-l); border-color: var(--line-strong); }

/* ---------- 布局 ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { border-radius: 0; border-top: none; border-bottom: none; border-left: none; padding: 18px 14px; display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 6px 18px; }
#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { padding: 10px 12px; border-radius: 10px; color: var(--muted); cursor: pointer; font-size: 14px; transition: 0.15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(34, 197, 94, 0.16); color: var(--emerald-l); }
.side-foot { padding-top: 14px; border-top: 1px solid var(--line); }
.content { padding: 22px 28px 40px; overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar h1 { font-size: 22px; margin: 0; }

/* ---------- 卡片/统计 ---------- */
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .num { font-size: 30px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.green .num { color: var(--emerald-l); }
.stat.warn .num { color: var(--warn); }
.stat.danger .num { color: var(--danger); }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }

/* 套餐分布 + 趋势 */
.two-col { grid-template-columns: 1fr 1fr; margin-top: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-track { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--emerald), var(--emerald-l)); border-radius: 6px; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart .col .bar { width: 60%; background: linear-gradient(180deg, var(--emerald-l), var(--emerald-d)); border-radius: 6px 6px 0 0; min-height: 4px; }
.chart .col .lab { font-size: 11px; color: var(--muted); }
.chart .col .val { font-size: 12px; font-weight: 600; }

/* ---------- 表格 ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 8px 10px; border-radius: 9px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.toolbar .spacer { flex: 1; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table tbody tr:hover { background: var(--surface-2); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); }
.tag.pro { color: var(--emerald-l); border-color: var(--line-strong); background: rgba(34,197,94,0.12); }
.tag.enterprise { color: #c4b5fd; border-color: rgba(196,181,253,0.4); background: rgba(196,181,253,0.12); }
.tag.banned { color: var(--danger); border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.12); }
.tag.active { color: var(--emerald-l); }
.tag.free { color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 弹窗 ---------- */
#modal-root:not(.hidden) { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: 420px; max-width: 100%; border-radius: 16px; padding: 24px; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .field { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- 提示 ---------- */
.alert { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.4); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--emerald-d); color: #04130b; padding: 11px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); }
.login-foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 18px; }
