:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.18);
  --text: #1a1a18;
  --muted: #6b6b66;
  --hint: #9a9a94;
  --accent: #2563eb;
  --accent-bg: #e6f1fb;
  --accent-text: #0c447c;
  --ok: #1d9e75;
  --ok-bg: #e1f5ee;
  --err: #d84a4a;
  --err-bg: #fcebeb;
  --radius: 8px;
  --radius-lg: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a18; --surface: #232320; --border: rgba(255,255,255,0.12);
    --border-strong: rgba(255,255,255,0.22); --text: #ececea; --muted: #a0a09a;
    --hint: #74746e; --accent: #5b9bf5; --accent-bg: #16304d; --accent-text: #b5d4f4;
    --ok: #5dcaa5; --ok-bg: #103d31; --err: #f09595; --err-bg: #3a1818;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 14px; line-height: 1.6;
}
a { cursor: pointer; text-decoration: none; color: inherit; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; background: var(--surface);
  border-bottom: 0.5px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.logo { color: var(--accent); }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { font-size: 13px; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav a:hover { color: var(--text); }
.peer-badge {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 4px 10px; border-radius: 999px; background: var(--ok-bg); color: var(--ok);
}
.peer-badge.down { background: var(--err-bg); color: var(--err); }
.bdot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

main { max-width: 880px; margin: 0 auto; padding: 24px 20px 60px; }

h1 { font-size: 22px; font-weight: 500; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 13px; }

.search {
  position: relative; margin-bottom: 24px;
}
.search input {
  width: 100%; height: 40px; padding: 0 14px 0 38px; font-size: 14px;
  border: 0.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.search input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-bg); border-color: var(--accent); }
.search::before {
  content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--hint); font-size: 18px;
}

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 28px; }
.metric { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.metric .label { font-size: 13px; color: var(--muted); }
.metric .value { font-size: 24px; font-weight: 500; margin-top: 2px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.section-head h2 { font-size: 16px; font-weight: 500; margin: 0; }

.btn {
  font-size: 13px; padding: 7px 14px; border-radius: var(--radius);
  border: 0.5px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: var(--err); border-color: var(--border); }

.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px;
}
.card .icon {
  width: 38px; height: 38px; flex: none; border-radius: var(--radius); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent-text);
}
.card .icon.gray { background: var(--bg); color: var(--muted); }
.card .body { flex: 1; min-width: 0; }
.card .title { font-size: 14px; font-weight: 500; }
.card .meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  font-size: 11px; font-family: var(--mono); padding: 3px 9px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent-text); flex: none;
}
.status-ok { color: var(--ok); font-size: 12px; flex: none; }
.status-err { color: var(--err); font-size: 12px; flex: none; }
.status-muted { color: var(--hint); font-size: 12px; flex: none; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 0.5px solid var(--border); font-size: 12px; }
td { padding: 8px 10px; border-bottom: 0.5px solid var(--border); }
tr:hover td { background: var(--surface); }
td.cidr { font-family: var(--mono); }
.toggle { cursor: pointer; }

.modal-backdrop {
  position: relative; min-height: 0;
}
.modal-backdrop:not([hidden]) {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: var(--surface); border-radius: var(--radius-lg); padding: 22px; width: 420px; max-width: 92vw; border: 0.5px solid var(--border); }
.modal h3 { margin: 0 0 16px; font-size: 16px; font-weight: 500; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; font-size: 14px; font-family: inherit;
  border: 0.5px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text);
}
.field textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.empty { text-align: center; color: var(--hint); padding: 40px 0; font-size: 14px; }
.err-banner { background: var(--err-bg); color: var(--err); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
