:root {
  --bg: #0a0e15;
  --panel: #111823;
  --panel-2: #16202e;
  --line: #1f2b3a;
  --text: #e6edf6;
  --muted: #8b9bb0;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 12px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.boot, .loading { padding: 60px; text-align: center; color: var(--muted); }

/* ── 布局 ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 210px;
  flex: 0 0 210px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 18px;
  font-weight: 700;
  letter-spacing: .3px;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
}

.nav-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(59,130,246,.16); color: #cfe3ff; }

.sidebar .spacer { flex: 1; }
.sidebar .foot { font-size: 12px; color: var(--muted); padding: 0 12px; }

main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

/* ── 通用组件 ─────────────────────────────────────────── */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; margin: 0; font-weight: 650; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 14px; margin: 0 0 14px; font-weight: 600;
  color: #cddcef; display: flex; align-items: center; gap: 8px;
}
.card h2 .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.card.error { border-color: rgba(239,68,68,.5); color: #ffb4b4; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
td.right, th.right { text-align: right; }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: #6ee7a8; border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.1); }
.badge.warn { color: #fbd38d; border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.1); }
.badge.err { color: #fca5a5; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.1); }
.badge.plain::before { display: none; }

.btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 500;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #2f4157; background: #1b2838; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2f6fdb; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffb4b4; border-color: rgba(239,68,68,.4); background: transparent; }
.btn.danger:hover { background: rgba(239,68,68,.12); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #0d141e; color: var(--text);
  font: inherit; font-size: 13px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
label.check input { width: auto; }

pre.code {
  margin: 0; padding: 12px 14px; border-radius: 10px;
  background: #070b11; border: 1px solid var(--line);
  overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55; color: #cfe3ff; white-space: pre-wrap; word-break: break-all;
}
.cmd-row { display: flex; gap: 8px; align-items: flex-start; }
.cmd-row pre { flex: 1; }

.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mt { margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; width: 100%; flex: 0 0 auto; }
  .shell { flex-direction: column; }
  main { padding: 16px; }
}

/* ── 登录页 ───────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login {
  width: 100%; max-width: 360px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 26px;
}
.login h1 { font-size: 18px; margin: 0 0 4px; }
.login p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login .btn { width: 100%; margin-top: 14px; }

/* ── toast ────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1b2838; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 99; max-width: 90vw;
}
.toast.ok { border-color: rgba(34,197,94,.45); }
.toast.err { border-color: rgba(239,68,68,.45); color: #ffc9c9; }
