:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --ink: #e6e9ef;
  --muted: #8b93a3;
  --accent: #4c8dff;
  --ok: #34c07a;
  --warn: #e0a13a;
  --bad: #e05c5c;
  --in: #4c8dff;
  --ca: #2f6fbf;
  --out: #34c07a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.top {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--ink); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 6px 12px; border-radius: 7px; color: var(--muted); }
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.on { background: var(--panel-2); color: var(--ink); }
.top form { margin: 0; }

main { padding: 22px; max-width: 1280px; margin: 0 auto; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; margin-bottom: 18px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.t-label { display: block; color: var(--muted); font-size: 13px; }
.t-value { font-size: 26px; font-weight: 700; }
.t-sub { color: var(--muted); font-size: 12px; }

.agents { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.agent { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--panel-2); }
.agent h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.agent .sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }

.meter { margin: 7px 0; }
.meter .m-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter .m-top b { color: var(--ink); font-weight: 600; }
.track { height: 7px; border-radius: 4px; background: #10131a; overflow: hidden; margin-top: 3px; }
.fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.fill.hot { background: var(--warn); }
.fill.max { background: var(--bad); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.kv > div { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.kv span { display: block; color: var(--muted); font-size: 12px; }
.kv b { font-weight: 600; }

.badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); }
.badge.on { color: var(--ok); border-color: #245c40; background: #14261d; }
.badge.off { color: var(--bad); border-color: #5c2424; background: #261414; }
.badge.idle { color: var(--warn); border-color: #5c4a24; background: #262014; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 13px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.dim { opacity: .55; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bad { color: var(--bad); }
.wait { color: var(--warn); }
.selectable { user-select: all; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 10px 0; }
.form-col { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 7px; padding: 8px 10px; font: inherit; min-width: 160px;
}
input:focus, select:focus { outline: 1px solid var(--accent); }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 7px;
  padding: 9px 16px; font: inherit; cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.danger { background: var(--bad); }

.alert { border: 1px solid #5c4a24; background: #262014; color: #e8c98a; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.alert.ok { border-color: #245c40; background: #14261d; color: #9fe0bd; }
.keyline { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.keyline code { background: var(--panel-2); padding: 8px 12px; border-radius: 7px; user-select: all; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; width: 340px; }
.login h1 { margin: 0; font-size: 20px; }
.login p { margin: 2px 0 16px; }
.login label { margin-bottom: 12px; }
.login input { width: 100%; }
.login button { width: 100%; margin-top: 6px; }
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row input { min-width: 90px; }
.captcha-row img { border-radius: 6px; cursor: pointer; border: 1px solid var(--line); }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; }
.sw.in { background: var(--in); } .sw.ca { background: var(--ca); } .sw.out { background: var(--out); }
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.spark { display: block; margin-top: 6px; }
