:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --text: #1d2229;
  --muted: #6b7480;
  --faint: #9aa3ae;
  --green: #1a9e6b;
  --green-bg: #e7f6ef;
  --red: #d64545;
  --red-bg: #fdecec;
  --blue: #3b74d6;
  --amber: #c9861a;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--blue);
  position: relative;
  flex: none;
}
.logo::after {
  content: ""; position: absolute; left: 9px; right: 9px; top: 15px;
  height: 5px; background: #fff; border-radius: 3px;
  box-shadow: 0 9px 0 -1px rgba(255,255,255,.55);
}
.title { font-weight: 600; font-size: 16px; }
.subtitle { font-size: 12px; color: var(--muted); }

.summary { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.stat {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2);
}
.stat .num { font-size: 20px; font-weight: 600; line-height: 1; }
.stat .lbl { font-size: 12px; color: var(--muted); }
.stat.ok .num { color: var(--green); }
.stat.bad .num { color: var(--red); }

.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.pulse.err { background: var(--red); }

main { padding: 24px 28px 40px; max-width: 1500px; margin: 0 auto; }
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 16px; }
.filter-wrap { display: flex; flex-direction: column; gap: 8px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 16px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab.active { background: var(--blue); color: #fff; }
.group-tabs { border-color: transparent; background: transparent; padding: 0; }
.group-tabs .tab { font-size: 12px; padding: 5px 13px; border: 1px solid var(--border); background: var(--surface); }
.group-tabs .tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.tab .cnt { font-size: 11px; padding: 1px 6px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.tab.active .cnt { background: rgba(255,255,255,.22); color: #fff; }
.search-wrap input {
  width: 260px; max-width: 45vw; padding: 9px 14px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  outline: none;
}
.search-wrap input:focus { border-color: var(--blue); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; position: relative; transition: box-shadow .15s, transform .15s;
  cursor: default;
}
.card:hover { box-shadow: 0 6px 20px rgba(20,30,50,.08); transform: translateY(-1px); }
.card.offline { opacity: .72; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.host-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.host-ip { font-size: 12px; color: var(--muted); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.badge.on { color: var(--green); background: var(--green-bg); }
.badge.off { color: var(--red); background: var(--red-bg); }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.metric { min-width: 0; }
.metric-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.metric-label b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.bar.cpu > i { background: var(--blue); }
.bar.mem > i { background: #8b5cf6; }
.bar.disk > i { background: var(--amber); }
.spark { width: 100%; height: 34px; display: block; margin-top: 8px; }

.card-foot {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted);
}
.card-foot span b { color: var(--text); font-weight: 500; }

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; border: 2px dashed var(--border); border-radius: 12px; margin: 0 auto 16px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-desc { font-size: 13px; }

footer {
  display: flex; justify-content: space-between; padding: 16px 28px;
  border-top: 1px solid var(--border); color: var(--faint); font-size: 12px; background: var(--surface);
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 18px; }
  .summary { order: 3; width: 100%; }
  .status { margin-left: auto; }
  main { padding: 18px; }
  .search-wrap input { width: 100%; }
  .metrics { grid-template-columns: 1fr; }
}
