:root {
  --bg: #0f1420;
  --panel: #161d2c;
  --panel-2: #1d2638;
  --line: #28324a;
  --text: #e6ecf7;
  --muted: #8b9ab5;
  --brand: #3b82f6;
  --brand-2: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

a { color: var(--brand-2); text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #1c2b4a 0%, var(--bg) 60%);
}
.login-card {
  width: 360px;
  padding: 32px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.login-card label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 12px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.login-card input:focus { border-color: var(--brand); }
.login-card button { width: 100%; margin-top: 22px; padding: 11px; }

/* ---------- 布局 ---------- */
.layout { display: grid; grid-template-columns: 208px 1fr; height: 100vh; }
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px 18px; font-weight: 700; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 12px var(--brand-2); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(59,130,246,.22), transparent); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(22, 29, 44, .75);
  backdrop-filter: blur(6px);
}
.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.topbar .who { color: var(--muted); font-size: 12px; }
.content { padding: 18px 20px 40px; overflow: auto; flex: 1; }

/* ---------- 组件 ---------- */
button {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  transition: .15s;
}
button:hover { border-color: var(--brand); }
button.primary { background: linear-gradient(135deg, var(--brand), #2563eb); border-color: transparent; color: #fff; }
button.danger { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .4); color: #fecaca; }
button.warn { background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .4); color: #fde68a; }
button.ghost { background: transparent; }
button.sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { width: 100%; min-height: 96px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.card .v small { font-size: 12px; color: var(--muted); font-weight: 400; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(59, 130, 246, .06); }
td.actions { display: flex; gap: 6px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; }
.tag.ok { background: rgba(34, 197, 94, .14); color: #86efac; border-color: rgba(34, 197, 94, .35); }
.tag.warn { background: rgba(245, 158, 11, .14); color: #fcd34d; border-color: rgba(245, 158, 11, .35); }
.tag.bad { background: rgba(239, 68, 68, .14); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.tag.info { background: rgba(59, 130, 246, .14); color: #93c5fd; border-color: rgba(59, 130, 246, .35); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 12px; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, .66);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; flex: 1; font-size: 15px; }
.modal .body { padding: 16px 18px; overflow: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.field { margin-bottom: 12px; }
.field > label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field .desc { color: var(--muted); font-size: 11px; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 提示 ---------- */
#toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  min-width: 220px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  animation: slide .2s ease-out;
}
.toast.ok { border-color: rgba(34, 197, 94, .5); }
.toast.err { border-color: rgba(239, 68, 68, .55); }
@keyframes slide { from { transform: translateY(-6px); opacity: 0; } }

/* ---------- 图表 ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 140px; padding: 8px 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar .fill { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar .lbl { font-size: 11px; color: var(--muted); }
.bar .val { font-size: 11px; color: #bfdbfe; }

.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.hidden { display: none !important; }

