:root {
  --bg: #070b14;
  --panel: rgba(20, 27, 43, 0.72);
  --panel-2: rgba(28, 37, 57, 0.6);
  --line: rgba(148, 163, 184, 0.16);
  --txt: #e6edf7;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --accent: #60a5fa;
  --radius: 16px;
  --shadow: 0 10px 34px rgba(2, 6, 23, 0.55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 26px clamp(14px, 3vw, 40px) 40px;
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 18% 30%, rgba(96, 165, 250, 0.20), transparent 65%),
    radial-gradient(40% 50% at 78% 12%, rgba(167, 139, 250, 0.18), transparent 65%),
    radial-gradient(35% 45% at 52% 0%, rgba(52, 211, 153, 0.12), transparent 60%);
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

body > *:not(.bg-glow) { position: relative; z-index: 1; }

/* ---------------- topbar ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(145deg, rgba(96,165,250,.28), rgba(167,139,250,.22));
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: var(--shadow);
}
.brand-text h1 { margin: 0; font-size: clamp(19px, 2.4vw, 25px); letter-spacing: .4px; }
.brand-text p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dot-sep { margin: 0 7px; color: var(--muted-2); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.clock {
  font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); padding: 8px 13px; border-radius: 12px;
}

.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--txt);
  padding: 9px 15px; border-radius: 12px; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: .18s;
  font-family: inherit;
}
.btn:hover { border-color: rgba(96,165,250,.55); background: rgba(96,165,250,.12); }
.btn-primary { background: linear-gradient(140deg, rgba(96,165,250,.22), rgba(96,165,250,.08)); }
.spin { display: inline-block; }
.spin.active { animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------------- stats ---------------- */
.stats {
  display: grid; gap: 12px; margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
  backdrop-filter: blur(8px);
}
.stat.wide { grid-column: span 2; }
.stat-num { font-size: 27px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-num.small { font-size: 15px; font-weight: 550; color: var(--muted); }
.stat-label { font-size: 12.5px; color: var(--muted-2); }
.stat.ok .stat-num { color: var(--ok); }
.stat.run .stat-num { color: var(--accent); }
.stat.bad .stat-num { color: var(--bad); }

/* ---------------- controls ---------------- */
.controls {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px;
}
.search {
  position: relative; flex: 1 1 280px; min-width: 220px;
}
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .6; font-size: 14px; }
.search input {
  width: 100%; padding: 11px 14px 11px 38px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--line); color: var(--txt);
  font-size: 14px; outline: none; font-family: inherit; transition: .18s;
}
.search input:focus { border-color: rgba(96,165,250,.6); box-shadow: 0 0 0 3px rgba(96,165,250,.13); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer; transition: .16s;
  font-family: inherit;
}
.chip:hover { color: var(--txt); border-color: rgba(148,163,184,.4); }
.chip.active { color: #0b1220; background: var(--txt); border-color: transparent; font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------------- grid & cards ---------------- */
.grid {
  display: grid; gap: 15px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 17px 14px; cursor: pointer;
  transition: transform .16s, border-color .16s, box-shadow .16s;
  display: flex; flex-direction: column; gap: 12px; overflow: hidden;
  backdrop-filter: blur(8px);
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--g, var(--accent)); opacity: .85;
}
.card:hover { transform: translateY(-3px); border-color: rgba(96,165,250,.42); box-shadow: 0 14px 34px rgba(2,6,23,.55); }
.card.is-down { opacity: .68; }

.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-icon {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  font-size: 22px; background: color-mix(in srgb, var(--g, var(--accent)) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--g, var(--accent)) 40%, transparent);
}
.card-title { min-width: 0; flex: 1; }
.card-title h2 { margin: 0; font-size: 16.5px; font-weight: 640; letter-spacing: .2px; }
.card-sub {
  margin: 4px 0 0; color: var(--muted); font-size: 12.8px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap; flex: none;
}
.status .led { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status.up   { color: var(--ok);   background: rgba(52,211,153,.12);  border-color: rgba(52,211,153,.3); }
.status.warn { color: var(--warn); background: rgba(251,191,36,.12);  border-color: rgba(251,191,36,.3); }
.status.down { color: var(--bad);  background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.3); }

.meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.pill {
  padding: 4px 9px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--muted); font-variant-numeric: tabular-nums;
}
.pill.port { color: #bfdbfe; border-color: rgba(96,165,250,.35); background: rgba(96,165,250,.1); font-weight: 600; }
.pill.tag { color: var(--muted-2); }

.card-foot { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.link-btn {
  flex: 1; text-align: center; text-decoration: none; font-size: 13px; padding: 9px 10px;
  border-radius: 11px; border: 1px solid rgba(96,165,250,.4); color: #dbeafe;
  background: linear-gradient(140deg, rgba(96,165,250,.2), rgba(96,165,250,.06));
  transition: .16s;
}
.link-btn:hover { background: rgba(96,165,250,.3); }
.icon-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  padding: 0 11px; height: 36px; border-radius: 11px; cursor: pointer; font-size: 12.5px; transition: .16s;
  display: grid; place-items: center; font-family: inherit; white-space: nowrap; flex: none;
}
.icon-btn:hover { color: var(--txt); border-color: rgba(148,163,184,.45); }

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted-2); padding: 60px 0; font-size: 14px; }

/* ---------------- footer ---------------- */
.footer { margin-top: 34px; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.footer-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; max-width: 780px;
}
.footer-box h3 { margin: 0 0 9px; font-size: 13.5px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.footer-box ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.8px; line-height: 1.85; }
.footer-box b { color: var(--txt); }
code {
  background: rgba(148,163,184,.14); padding: 1.5px 6px; border-radius: 6px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #cbd5e1;
}
.footer-meta { color: var(--muted-2); font-size: 12.5px; align-self: flex-end; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: #1e293b; color: var(--txt); border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 12px; font-size: 13.5px; opacity: 0;
  transition: .22s; pointer-events: none; box-shadow: var(--shadow); z-index: 9;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  body { padding: 18px 13px 30px; }
  .stat.wide { grid-column: span 1; }
  .clock { display: none; }
}
