:root {
  --bg: #0a0e16;
  --bg2: #0e1420;
  --card: #111927;
  --card2: #0d1522;
  --line: #1e2a3d;
  --line2: #27364d;
  --text: #e6edf7;
  --muted: #8ea0b8;
  --dim: #5d6e85;
  --accent: #5b8dff;
  --accent2: #3d6ff2;
  --ok: #2ecc8f;
  --warn: #f3b64b;
  --fail: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(61, 111, 242, .16), transparent 60%),
    radial-gradient(800px 420px at -10% 25%, rgba(46, 204, 143, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity .25s ease;
}
#boot.hide { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 34px; font-weight: 800; letter-spacing: .5px; }
.boot-logo span, .brand span { color: var(--accent); }
.boot-line {
  width: 160px; height: 3px; border-radius: 3px; overflow: hidden;
  background: #182236; position: relative;
}
.boot-line::after {
  content: ""; position: absolute; inset: 0; width: 45%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: slide 1.1s infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(230%); } }
.boot-text { color: var(--dim); font-size: 13px; }

.brand { font-size: 18px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
.brand.big { font-size: 30px; }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, rgba(20, 30, 49, .92), rgba(13, 21, 34, .96));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 30px 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.login-sub { color: var(--muted); margin: 6px 0 26px; font-size: 13px; }
.field { display: block; }
.field span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.field input, .input {
  width: 100%;
  background: #0a111d;
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus, .input:focus { border-color: var(--accent); }
.login-error { color: var(--fail); font-size: 12.5px; margin: 10px 0 0; min-height: 18px; }
.login-foot { color: var(--dim); font-size: 12px; text-align: center; margin: 18px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: #182338; border: 1px solid var(--line2);
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #1e2c47; border-color: #334768; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.block { width: 100%; margin-top: 18px; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: rgba(10, 14, 22, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-meta { display: flex; gap: 8px; flex: 1; overflow: hidden; }
.pill {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line2); border-radius: 999px;
  padding: 2px 9px; white-space: nowrap;
}
.pill.dim { color: var(--dim); border-color: var(--line); }
.tabs { display: flex; gap: 4px; background: #0c1320; border: 1px solid var(--line); padding: 3px; border-radius: 9px; }
.tabs button {
  background: transparent; border: 0; padding: 6px 14px; border-radius: 7px;
  color: var(--muted); cursor: pointer;
}
.tabs button.on { background: #1a2740; color: var(--text); }

.wrap {
  width: 100%; max-width: 1320px; margin: 0 auto;
  padding: 18px 22px 60px;
  display: flex; flex-direction: column; gap: 14px;
}
.card {
  background: linear-gradient(180deg, rgba(17, 25, 39, .92), rgba(13, 20, 32, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.hint { color: var(--dim); font-size: 12.5px; }
.hint.warn { color: var(--warn); }
.pns { color: var(--muted); font-size: 12.5px; }
.pns.warn { color: var(--warn); }
.sub-row { display: flex; gap: 10px; }
.grow { flex: 1; min-width: 160px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.search { max-width: 260px; }

.node-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px;
  max-height: 330px; overflow: auto; padding-right: 4px;
}
.node {
  display: flex; align-items: center; gap: 10px;
  background: #0c1422; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; cursor: pointer;
  transition: border-color .12s, background .12s;
  min-width: 0;
}
.node:hover { border-color: var(--line2); }
.node.on { border-color: rgba(91, 141, 255, .65); background: rgba(91, 141, 255, .08); }
.node input, .test input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.node-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.node-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-sub { color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag {
  font-size: 11px; color: var(--muted); background: #131d2e;
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; flex: none;
}
.empty { color: var(--dim); font-size: 13px; padding: 14px 4px; grid-column: 1 / -1; }

.test-groups { display: flex; flex-direction: column; gap: 12px; }
.tgroup-title { color: var(--muted); font-size: 12.5px; margin-bottom: 7px; }
.test-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.test {
  display: inline-flex; align-items: center; gap: 7px;
  background: #0c1422; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--muted);
}
.test.on { color: var(--text); border-color: rgba(91, 141, 255, .55); background: rgba(91, 141, 255, .08); }

.runbar {
  position: sticky; bottom: 14px; z-index: 15;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: rgba(13, 21, 34, .94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line2);
  border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}
.runbar.active { border-color: rgba(91, 141, 255, .5); }
.run-summary { color: var(--muted); font-size: 13px; flex: 1; }
.run-summary strong { color: var(--text); }
.progress { flex-basis: 100%; height: 4px; background: #0a111d; border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .4s; }

.results .card-head { margin-bottom: 8px; }
.legend { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--dim); font-size: 12px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.dot.ok, .res.ok, .res-text.ok { color: var(--ok); }
.dot.warn, .res.warn, .res-text.warn { color: var(--warn); }
.dot.fail, .res.fail, .res-text.fail { color: var(--fail); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.fail { background: var(--fail); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; max-height: 62vh; }
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  position: sticky; top: 0; z-index: 5;
  background: #0e1726; color: var(--muted); font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(91, 141, 255, .04); }
.sticky-col { position: sticky; left: 0; z-index: 4; background: var(--card2); min-width: 190px; max-width: 240px; }
th.sticky-col { z-index: 6; background: #0e1726; }
.cell-node { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.cell-node span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-node em { font-style: normal; color: var(--dim); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; flex: none; }
.cell-err { color: var(--fail); font-size: 11.5px; margin-top: 3px; }
.lat { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.lat.ok { color: var(--ok); }
.lat.warn { color: var(--warn); }
.lat.fail { color: var(--fail); }
.exit { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.loc { font-size: 11.5px; color: var(--dim); }
.res {
  background: #0c1422; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; font-size: 12px; cursor: pointer; white-space: nowrap;
  min-width: 52px;
}
.res:hover { border-color: var(--line2); }
.res.ok { border-color: rgba(46, 204, 143, .35); background: rgba(46, 204, 143, .08); }
.res.warn { border-color: rgba(243, 182, 75, .35); background: rgba(243, 182, 75, .08); }
.res.fail { border-color: rgba(255, 107, 107, .3); background: rgba(255, 107, 107, .07); }
.res.wait { color: var(--dim); border-style: dashed; cursor: default; }
.pad { padding: 10px 2px 0; }

.raw {
  background: #080d16; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; max-height: 62vh; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.55; color: #b9c7da; white-space: pre;
}

.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 7, 13, .72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 440px;
  background: var(--card); border: 1px solid var(--line2); border-radius: 12px;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.detail-line { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.detail-line span { color: var(--dim); width: 60px; flex: none; }
.detail-line b { font-weight: 500; word-break: break-all; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #17233a; border: 1px solid var(--line2); color: var(--text);
  padding: 9px 18px; border-radius: 999px; z-index: 80;
  font-size: 13px; box-shadow: 0 12px 34px rgba(0, 0, 0, .4);
  max-width: 90vw; text-align: center;
}

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .top-meta { display: none; }
  .wrap { padding: 14px 12px 70px; }
  .card { padding: 14px; }
  .node-grid { grid-template-columns: 1fr; max-height: 280px; }
  .runbar { bottom: 8px; }
  .legend { display: none; }
}
