:root {
  --bg: #0a0f14;
  --bg-soft: #0e151d;
  --panel: #111a23;
  --panel-2: #16212c;
  --line: #1e2b38;
  --line-soft: #17222d;
  --text: #e6edf3;
  --muted: #8b9bab;
  --dim: #5d6f80;
  --accent: #2ee6a8;
  --accent-2: #22d3ee;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 12% -10%, #12222c 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #10253000 0%, transparent 60%),
              var(--bg);
  color: var(--text);
  font: 14px/1.55 "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

code { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; color: var(--accent-2); }

/* ───────────── 登录 ───────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
}
.login-glow {
  position: absolute; inset: auto -20% -40% -20%; height: 60%;
  background: radial-gradient(closest-side, rgba(46, 230, 168, .13), transparent);
  pointer-events: none;
}
.login-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, #101b24, #0c141b);
  border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); z-index: 1;
  animation: fadein .45s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(46, 230, 168, .18), rgba(34, 211, 238, .12));
  border: 1px solid rgba(46, 230, 168, .3); color: var(--accent);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-mark.sm { width: 34px; height: 34px; border-radius: 10px; }
.brand-mark.sm svg { width: 18px; height: 18px; }
.brand h1 { margin: 0; font-size: 19px; letter-spacing: .3px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
input, select, textarea {
  width: 100%; background: #0b141b; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; transition: .16s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(46, 230, 168, .55); box-shadow: 0 0 0 3px rgba(46, 230, 168, .1); }
input::placeholder { color: var(--dim); }
/* 深色主题下原生下拉的弹出列表默认白底，选项文字必须用深色底+浅字，否则白底白字看不清 */
select option, select optgroup { background: #101922; color: #e6edf3; }
select.mini-input option { background: #101922; color: #e6edf3; }
.hint { color: var(--dim); font-size: 12px; margin: 14px 0 0; text-align: center; }

/* ───────────── 按钮 ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 15px; font: inherit; font-weight: 550;
  cursor: pointer; transition: .16s; white-space: nowrap; color: var(--text); background: var(--panel-2);
}
.btn .ico { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #1ec9a0); color: #04140f; }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(46, 230, 168, .28); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: #2a3b4b; background: #0f1820; }
.btn-danger-ghost { background: rgba(255, 107, 107, .08); border-color: rgba(255, 107, 107, .3); color: #ff8f8f; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

.icon-btn {
  background: transparent; border: none; color: var(--dim); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ───────────── 布局 ───────────── */
.app { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line-soft); background: linear-gradient(180deg, #0c141b, #0a1116);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; font-weight: 650; letter-spacing: .4px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: var(--muted); text-decoration: none; cursor: pointer; font-size: 13.5px; transition: .14s;
}
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { background: #101a23; color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(46, 230, 168, .14), transparent); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-foot { border-top: 1px solid var(--line-soft); padding-top: 14px; display: grid; gap: 10px; }
.admin-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, rgba(46, 230, 168, .22), rgba(34, 211, 238, .16)); color: var(--accent);
  border: 1px solid rgba(46, 230, 168, .25);
}
.admin-meta { display: grid; line-height: 1.25; overflow: hidden; }
.admin-meta strong { font-size: 13px; }
.admin-meta span { font-size: 11.5px; color: var(--dim); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 28px; border-bottom: 1px solid var(--line-soft); background: rgba(10, 15, 20, .7);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 17px; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.topbar-actions { display: flex; gap: 9px; }
.content { padding: 22px 28px 56px; }

/* ───────────── 卡片 / 统计 ───────────── */
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-bottom: 16px; }
.split .card + .card { margin-top: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat {
  background: linear-gradient(180deg, #121c26, #0f1720); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--accent); opacity: .55; }
.stat.warn::after { background: var(--warn); }
.stat.danger::after { background: var(--danger); }
.stat.info::after { background: var(--accent-2); }
.stat .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 27px; font-weight: 680; letter-spacing: -.5px; margin-top: 6px; }
.stat .sub { color: var(--dim); font-size: 12px; margin-top: 3px; }

.chart { height: 170px; display: flex; align-items: flex-end; gap: 6px; padding-top: 8px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; min-height: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(46, 230, 168, .25)); transition: height .3s ease;
}
.bar.zero { background: #1a2733; }
.bar-day { font-size: 10px; color: var(--dim); }

.list { display: grid; gap: 2px; max-height: 210px; overflow: auto; }
.list-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.list-item:last-child { border-bottom: none; }
.list.compact .list-item { font-size: 12.5px; padding: 7px 2px; }
.list-item .k { color: var(--text); }
.list-item .v { color: var(--muted); text-align: right; white-space: nowrap; }
.empty { color: var(--dim); text-align: center; padding: 22px; font-size: 12.5px; }

/* ───────────── 工具栏 / 表格 ───────────── */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .muted { margin-right: auto; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--dim); }
.search input { padding-left: 34px; }
.select { width: auto; min-width: 120px; }
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 12px 14px; color: var(--muted); font-weight: 550; font-size: 12px;
  border-bottom: 1px solid var(--line); background: #0f1820; white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: #101a23; }
.table tbody tr:last-child td { border-bottom: none; }
.mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; letter-spacing: .4px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 550; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.active { color: #45e0a8; background: rgba(46, 230, 168, .1); }
.badge.unused { color: #7fb2ff; background: rgba(120, 170, 255, .1); }
.badge.expired { color: var(--warn); background: rgba(255, 180, 84, .1); }
.badge.disabled, .badge.banned { color: var(--danger); background: rgba(255, 107, 107, .1); }
.badge.perm { color: var(--accent-2); background: rgba(34, 211, 238, .1); }
/* 消息级别：通知 / 更新 / 重要 */
.badge.info { color: #9db4c8; background: rgba(139, 155, 171, .14); }
.badge.update { color: #6db3ff; background: rgba(109, 179, 255, .12); }
.badge.important { color: #ff8484; background: rgba(255, 107, 107, .14); }
.pin-flag { color: var(--accent-2); font-size: 11.5px; font-weight: 600; }

.row-actions { display: flex; gap: 6px; }
.mini-btn {
  background: #101a23; border: 1px solid var(--line); color: var(--muted); border-radius: 7px;
  padding: 4px 9px; font-size: 12px; cursor: pointer; transition: .14s; font-family: inherit; white-space: nowrap;
}
.mini-btn:hover { color: var(--text); border-color: #2c3f50; }
.mini-btn.danger:hover { color: #ff8f8f; border-color: rgba(255, 107, 107, .45); }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12.5px; }
.pager .pages { display: flex; gap: 6px; }
.pager button { background: #101a23; border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 4px 10px; cursor: pointer; font-family: inherit; font-size: 12px; }
.pager button.on { border-color: rgba(46, 230, 168, .5); color: var(--accent); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ───────────── 产品卡片 ───────────── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }.product-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.product-card h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.product-card .code { color: var(--accent-2); font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; }
.key-row { display: flex; gap: 8px; align-items: center; background: #0b141b; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.key-row code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
/* 点击「显示」后的完整密钥：换行铺开，不再被省略号截断 */
.key-row code.revealed { white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; text-overflow: clip; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 38px; height: 21px; border-radius: 999px; background: #1b2836; border: 1px solid var(--line); cursor: pointer; transition: .18s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #5d6f80; transition: .18s; }
.switch.on { background: rgba(46, 230, 168, .18); border-color: rgba(46, 230, 168, .5); }
.switch.on::after { left: 19px; background: var(--accent); }

/* ───────────── 表单 ───────────── */
.form { display: grid; gap: 14px; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13px; }
.kv dt, .kv .k { color: var(--muted); }
.kv .v { color: var(--text); word-break: break-all; }

.code {
  background: #08111a; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.65; color: #b9c9d6; overflow: auto;
}
.muted { color: var(--muted); font-size: 13px; }
.dim { color: var(--dim); font-size: 12px; }

/* ───────────── 弹窗 ───────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 8, 12, .72); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100; padding: 24px;
}
.modal {
  width: 100%; max-width: 560px; max-height: 86vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #111b25, #0d151d); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); animation: rise .22s ease both;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.modal-foot:empty { display: none; }

.codes-box { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.code-line { display: flex; justify-content: space-between; align-items: center; background: #0b141b; border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; }
.code-line span { font-family: "JetBrains Mono", Consolas, monospace; letter-spacing: .8px; font-size: 13px; }

/* ───────────── 提示 ───────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 9px; z-index: 200; }
.toast {
  min-width: 240px; background: #12202b; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 11px 14px; font-size: 13px; box-shadow: var(--shadow); animation: slidein .22s ease both;
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #1e2b38; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #2a3b4b; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar-brand { padding: 0 12px 0 0; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; }
  .sidebar-foot { border: none; padding: 0; display: flex; align-items: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}

/* ───────────── 订单 / 套餐 ───────────── */
.nav-item { position: relative; }
.nav-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--warn);
  margin-left: auto; box-shadow: 0 0 0 3px rgba(255, 180, 84, .16);
}
.badge.pending { color: var(--warn); background: rgba(255, 180, 84, .1); }
.badge.paid { color: #45e0a8; background: rgba(46, 230, 168, .1); }
.badge.cancelled, .badge.refunded { color: var(--dim); background: rgba(139, 155, 171, .12); }
.badge.frozen { color: #9db4c8; background: rgba(139, 155, 171, .14); }
.badge.available { color: #45e0a8; background: rgba(46, 230, 168, .1); }
.badge.withdrawing { color: #7fb2ff; background: rgba(120, 170, 255, .1); }
.badge.withdrawn { color: var(--accent-2); background: rgba(34, 211, 238, .1); }
.badge.rejected { color: var(--danger); background: rgba(255, 107, 107, .1); }
.badge.risk { color: var(--warn); background: rgba(255, 180, 84, .12); }
.mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; letter-spacing: .3px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.plan-card {
  background: linear-gradient(180deg, #121c26, #0f1720); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px; display: grid; gap: 12px;
}
.plan-card.off { opacity: .6; }
.plan-card h4 { margin: 0; font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-card .price { font-size: 26px; font-weight: 680; letter-spacing: -.5px; }
.plan-card .price small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.plan-card .seat-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 3px 0; border-bottom: 1px dashed var(--line-soft); }
.plan-card .seat-line:last-of-type { border-bottom: none; }
.plan-card .row { display: flex; align-items: center; gap: 8px; }
.plan-card input[type="number"] {
  width: 100%; background: #0b141b; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: 13px;
}
.plan-card .hint { color: var(--dim); font-size: 11.5px; }

/* 问题反馈 */
.fb-content {
  white-space: pre-wrap;
  line-height: 1.65;
  max-width: 640px;
  word-break: break-word;
}
.mini-input {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
/* 待确认收款的行：左侧橙色条 + 淡底，扫一眼就能分辨 */
.table tbody tr.row-pending td { background: rgba(255, 176, 84, .06); }
.table tbody tr.row-pending td:first-child { box-shadow: inset 3px 0 0 #ffb054; }

/* 会员分析 */
#msMonth { width: 150px; }
.ms-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.95; }
.ms-notes strong { color: var(--text); font-weight: 600; }
.ms-notes li::marker { color: var(--dim); }
