:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1e263a;
  --border: #2a3350;
  --text: #e6ebf5;
  --muted: #93a0bd;
  --accent: #4f8cff;
  --accent-2: #2dd4a7;
  --danger: #ff6b6b;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --panel-2: #f0f3fa;
    --border: #dce2ee;
    --text: #1a2233;
    --muted: #5a6784;
    --shadow: 0 10px 30px rgba(20, 30, 60, 0.12);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 28px;
  color: var(--accent);
  background: var(--panel-2);
  border: 1px solid var(--border);
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
}
.topbar h1 { font-size: 18px; margin: 0; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.host-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--accent-2);
}

main { max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; }

.search-panel {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

select, input[type="search"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
input[type="search"] { flex: 1; min-width: 220px; }
select:focus, input:focus { border-color: var(--accent); }

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: filter .15s ease, opacity .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 10px;
  gap: 12px;
}
.result-info { color: var(--muted); font-size: 14px; }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.pill {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  margin: 1px 3px 1px 0;
  font-size: 12px;
}

.empty { padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* Detail drawer */
.overlay {
  position: fixed; inset: 0;
  background: rgba(5, 8, 16, 0.55);
  display: flex; justify-content: flex-end;
  z-index: 20;
}
.drawer {
  width: min(640px, 100%);
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: slide .18s ease;
}
@keyframes slide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { padding: 20px; overflow-y: auto; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; margin-bottom: 20px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 13px; word-break: break-word; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin: 18px 0 8px; }
pre.json {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  font-size: 12px;
  max-height: 340px;
}
