:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e6e8ec;
  --text: #16181d;
  --text-2: #5b6472;
  --text-3: #8b95a5;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --ok: #15a05a;
  --ok-soft: #e9f7ef;
  --warn: #d97706;
  --warn-soft: #fef4e6;
  --danger: #d93a3a;
  --danger-soft: #fdeeee;
  --side: #12161f;
  --side-2: #1b2230;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ============ 登录页 ============ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}
.auth-brand {
  background: linear-gradient(145deg, #12161f 0%, #1e2a45 60%, #24365c 100%);
  color: #fff;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.08);
  right: -180px; bottom: -180px;
}
.brand-logo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.brand-copy h1 { font-size: 34px; line-height: 1.35; font-weight: 600; letter-spacing: -0.5px; }
.brand-copy p { color: #9aa8c0; margin-top: 14px; font-size: 14px; max-width: 420px; }
.brand-points { display: flex; gap: 28px; margin-top: 40px; }
.brand-points div { font-size: 13px; color: #c3cddd; }
.brand-points strong { display: block; font-size: 20px; color: #fff; font-weight: 600; margin-bottom: 2px; }

.auth-panel {
  background: var(--card);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 56px;
}
.auth-panel h2 { font-size: 22px; font-weight: 600; }
.auth-panel .sub { color: var(--text-2); margin: 6px 0 28px; font-size: 13px; }

.tabs { display: flex; gap: 4px; background: #f2f4f7; padding: 4px; border-radius: 8px; margin-bottom: 24px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 6px;
  font-size: 13px; color: var(--text-2); font-weight: 500; transition: all .15s;
}
.tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; transition: all .15s; background: #fff;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.btn {
  border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px;
  font-weight: 500; transition: all .15s; display: inline-flex; align-items: center;
  gap: 6px; justify-content: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #a8bdf0; cursor: not-allowed; }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: #f8f9fb; border-color: #d6dae1; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbdcdc; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-ok { background: var(--ok-soft); color: var(--ok); }

/* ============ 主布局 ============ */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--side); color: #cbd5e1;
  display: flex; flex-direction: column; padding: 20px 12px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; color: #fff; font-weight: 600; font-size: 15px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 7px; color: #9aa8c0; text-decoration: none; font-size: 13.5px; transition: all .15s;
}
.side-nav a:hover { background: var(--side-2); color: #e2e8f0; }
.side-nav a.active { background: #2563eb; color: #fff; font-weight: 500; }
.side-nav .ico { width: 16px; text-align: center; opacity: .9; }
.side-foot { border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; font-size: 13px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; }
.side-user .who { color: #e2e8f0; font-size: 13px; }
.side-user .who small { display: block; color: #7b8798; font-size: 11.5px; }
.side-foot a { color: #7b8798; font-size: 12.5px; padding: 8px 10px; display: block; cursor: pointer; }
.side-foot a:hover { color: #e2e8f0; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 16.5px; font-weight: 600; }
.topbar .meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }

.content { padding: 24px 28px 48px; max-width: 1180px; width: 100%; }

/* ============ 组件 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-mute { background: #f1f3f6; color: var(--text-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow);
}
.card .k { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.card .v { font-size: 27px; font-weight: 600; letter-spacing: -0.5px; margin-top: 6px; line-height: 1.2; }
.card .v small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.card .extra { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.panel-head {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.panel-head h2 { font-size: 14.5px; font-weight: 600; }
.panel-head .desc { font-size: 12.5px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3);
  padding: 10px 18px; border-bottom: 1px solid var(--border); background: #fafbfc;
  white-space: nowrap;
}
td { padding: 13px 18px; border-bottom: 1px solid #f1f3f6; font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; color: var(--text-2); }
.empty { padding: 40px 18px; text-align: center; color: var(--text-3); font-size: 13px; }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }
.plan {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: all .15s; position: relative; background: #fff;
}
.plan:hover { border-color: #c3cfe6; }
.plan.sel { border-color: var(--accent); background: var(--accent-soft); }
.plan .pname { font-size: 14px; font-weight: 600; }
.plan .price { font-size: 26px; font-weight: 600; margin: 8px 0 2px; letter-spacing: -0.5px; }
.plan .price small { font-size: 13px; font-weight: 400; color: var(--text-3); }
.plan .pdesc { font-size: 12.5px; color: var(--text-2); }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row .field { margin-bottom: 0; min-width: 160px; }
.total { font-size: 13px; color: var(--text-2); }
.total strong { font-size: 19px; color: var(--text); font-weight: 600; margin-left: 4px; }

.alert {
  background: var(--warn-soft); border: 1px solid #f7dfb6; color: #8a5a08;
  padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-top: 14px;
}
.alert.info { background: var(--accent-soft); border-color: #d5e2fb; color: #1e40af; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,22,32,.42);
  display: grid; place-items: center; z-index: 100; padding: 20px;
  animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22); overflow: hidden;
}
.modal-head { padding: 18px 20px 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 16px 20px 4px; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #16181d; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: drop .18s ease;
}
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px) } to { opacity: 1; transform: translate(-50%, 0) } }
.toast.err { background: #b91c1c; }
