:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1d222a;
  --border: #272d37;
  --text: #e3e8ef;
  --muted: #8b96a5;
  --accent: #4c9aff;
  --ok: #3ddc97;
  --warn: #ffb020;
  --err: #ff6b6b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

/* ── 导航 ─────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
nav .brand { font-weight: 600; font-size: 15px; margin-right: 8px; }
nav a.tab {
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
nav a.tab:hover { color: var(--text); }
nav a.tab.active { color: var(--text); border-bottom-color: var(--accent); }
nav .spacer { flex: 1; }

main { padding: 24px; max-width: 1500px; margin: 0 auto; }

h2 { font-size: 16px; margin: 0 0 14px; font-weight: 600; }

/* ── 卡片 ─────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ── 表单 ─────────────────────────────────────── */
input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: #5d6673; }

button {
  cursor: pointer;
  background: var(--panel-2);
  transition: background .15s, border-color .15s;
}
button:hover { background: #252b34; border-color: #38404d; }
button.primary { background: var(--accent); border-color: var(--accent); color: #06152b; font-weight: 600; }
button.primary:hover { background: #67aaff; }
button.danger:hover { border-color: var(--err); color: var(--err); }
button.mini { padding: 4px 9px; font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters label { color: var(--muted); font-size: 12px; margin-right: -4px; }
.chips { display: flex; gap: 6px; }
.chip { padding: 5px 11px; font-size: 12px; border-radius: 999px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #06152b; font-weight: 600; }

/* ── 表格 ─────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
td.mono, th.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.trunc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 状态点 ───────────────────────────────────── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot.online { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.stale  { background: var(--warn); }
.dot.silent { background: var(--muted); }
.dot.pending{ background: transparent; border: 2px solid var(--muted); width: 6px; height: 6px; }

.badge { font-size: 11px; padding: 2px 7px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.badge.accepted { color: var(--ok); border-color: rgba(61,220,151,.3); }
.badge.rejected { color: var(--err); border-color: rgba(255,107,107,.3); }

/* ── 一键命令 ─────────────────────────────────── */
.cmd-box {
  background: #0b0e12;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
  color: #b9e6a8;
  margin: 10px 0;
}

.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.warn-box { border-left: 3px solid var(--warn); background: rgba(255,176,32,.07); padding: 10px 14px; border-radius: 0 6px 6px 0; margin-bottom: 16px; font-size: 13px; }
.err-box  { border-left: 3px solid var(--err);  background: rgba(255,107,107,.07); padding: 10px 14px; border-radius: 0 6px 6px 0; margin-bottom: 16px; font-size: 13px; }

/* ── 趋势图 ───────────────────────────────────── */
.trend { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.trend .bar { flex: 1; background: var(--accent); opacity: .55; border-radius: 2px 2px 0 0; min-height: 1px; }
.trend .bar:hover { opacity: 1; }

/* ── 弹层 ─────────────────────────────────────── */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 22px; width: min(560px, 92vw); }
.modal h3 { margin: 0 0 16px; font-size: 15px; }
.field { margin-bottom: 12px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.field input, .field select { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ── 登录页 ───────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: min(360px, 90vw); }
.login-card h1 { font-size: 17px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card button { width: 100%; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ok); color: #04231a; padding: 9px 20px; border-radius: 6px;
  font-size: 13px; font-weight: 600; z-index: 100;
}
