:root {
  --bg: #0a0f15;
  --bg2: #0d141c;
  --panel: #111a24;
  --panel2: #16212d;
  --line: #1f2d3b;
  --line2: #2a3b4d;
  --text: #dce7f2;
  --muted: #7d91a5;
  --accent: #34c6ff;
  --accent2: #6a8cff;
  --green: #35d07f;
  --amber: #ffb020;
  --red: #ff5d6c;
  --purple: #a58bff;
  --radius: 10px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font-family: inherit; font-size: 13px; }

.boot {
  display: flex; height: 100vh; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; letter-spacing: .1em;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(52,198,255,.10), transparent 60%),
    radial-gradient(700px 400px at 90% 100%, rgba(106,140,255,.09), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.login-card h1 { font-size: 19px; margin: 0 0 6px; letter-spacing: .04em; }
.login-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 12.5px; line-height: 1.7; }
.login-card label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--text); outline: none; letter-spacing: .3em;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,198,255,.12); }
.login-card button {
  width: 100%; margin-top: 18px; padding: 11px; border: none; border-radius: 9px;
  background: linear-gradient(135deg, #2aa6e0, #5b7cff); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; letter-spacing: .1em;
}
.login-card button:hover { filter: brightness(1.1); }
.login-err { color: var(--red); font-size: 12.5px; margin-top: 12px; min-height: 18px; }
.login-foot { color: #4d6072; font-size: 11px; margin-top: 22px; line-height: 1.7; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 216px; flex: 0 0 216px; background: var(--bg2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 18px 16px; border-bottom: 1px solid var(--line); }
.brand .t { font-size: 15px; font-weight: 700; letter-spacing: .08em; }
.brand .s { font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: .06em; }
.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav .grp { color: #4f6478; font-size: 10.5px; letter-spacing: .14em; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px;
  color: #a9bccd; font-size: 13px; margin-bottom: 2px; text-decoration: none;
}
.nav a:hover { background: #16212d; color: var(--text); text-decoration: none; }
.nav a.on { background: rgba(52,198,255,.10); color: var(--accent); }
.nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.side-foot { padding: 12px 16px 18px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.side-foot button {
  width: 100%; margin-top: 10px; padding: 8px; border-radius: 8px; cursor: pointer;
  background: #17222e; color: #a9bccd; border: 1px solid var(--line2);
}
.side-foot button:hover { color: var(--red); border-color: rgba(255,93,108,.4); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  border-bottom: 1px solid var(--line); background: rgba(10,15,21,.85);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: .02em; }
.topbar .spacer { flex: 1; }
.topbar .meta { color: var(--muted); font-size: 11.5px; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 11.5px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.view { padding: 22px 26px 60px; max-width: 1500px; width: 100%; }

/* ---------- 通用 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
}
.card > h3 {
  margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .06em;
  color: #b9ccdd; display: flex; align-items: center; gap: 10px;
}
.card > h3 .tag { font-size: 10.5px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.grid { display: grid; gap: 14px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  background: linear-gradient(160deg, #14202c, #101a23);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: var(--accent); opacity: .75;
}
.stat.us::after { background: var(--green); }
.stat.au::after { background: var(--purple); }
.stat .k { color: var(--muted); font-size: 11.5px; display: flex; justify-content: space-between; }
.stat .v { font-size: 22px; font-weight: 650; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat .sub { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(53,208,127,.6); }
.dot.off { background: #43535f; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10.5px;
  background: #1a2836; color: #9fb6c9; border: 1px solid #24384a; margin-right: 4px;
}
.pill.jp { color: #4fd0ff; border-color: #1d4356; background: #122a36; }
.pill.us { color: #4ade9a; border-color: #1d4a37; background: #102a20; }
.pill.au { color: #b39bff; border-color: #382f5c; background: #1e1a33; }
.pill.warn { color: var(--amber); border-color: #4a3a15; background: #2a2210; }
.pill.bad { color: var(--red); border-color: #4a2027; background: #2a1418; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.ctl {
  background: var(--bg2); border: 1px solid var(--line2); color: var(--text);
  border-radius: 8px; padding: 7px 10px; outline: none; min-height: 34px;
}
.ctl:focus { border-color: var(--accent); }
.ctl.search { min-width: 220px; }
.btn {
  background: #1a2836; border: 1px solid var(--line2); color: #c6d7e6;
  border-radius: 8px; padding: 7px 13px; cursor: pointer; min-height: 34px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: linear-gradient(135deg,#2aa6e0,#5b7cff); border: none; color: #fff; }
.btn:disabled { opacity: .4; cursor: default; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; padding: 10px 12px; color: #7f96aa; font-weight: 500;
  background: #0f1820; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 11.5px; letter-spacing: .04em;
}
tbody td {
  padding: 9px 12px; border-bottom: 1px solid #16222d;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #14202b; }
td.ip a { font-family: var(--mono); font-size: 12px; }
td.host { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); }
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 12.5px; }

.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.pager .spacer { flex: 1; }

.chart-box { position: relative; width: 100%; height: 200px; }
canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.errbar {
  background: rgba(255,93,108,.10); border: 1px solid rgba(255,93,108,.35);
  color: #ffb3ba; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 12.5px;
}
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.8; }

@media (max-width: 980px) {
  .side { display: none; }
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .view { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
}
@media (max-width: 620px) {
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
}
