/* Dark only. Dense. 4/8/12 px spacing scale. */
:root {
  color-scheme: dark;
  --bg: #0f1115; --surface: #171a21; --raised: #1f232c; --border: #2b303b;
  --text: #e6e8ee; --muted: #9aa3b2; --accent: #5b8def;
  --danger: #e5484d; --warn: #f5a524; --ok: #3fb950;
  --s1: 4px; --s2: 8px; --s3: 12px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--raised); padding: 0 3px; border-radius: 3px; }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.error { color: var(--danger); }
[hidden] { display: none !important; }

/* header */
.bar { display: flex; align-items: center; gap: var(--s2); height: 40px; padding: 0 var(--s3); border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; color: var(--text); white-space: nowrap; }
.lookup { display: flex; gap: var(--s1); flex: 1 1 auto; min-width: 0; }
.lookup input { flex: 1 1 240px; max-width: 400px; min-width: 0; height: 28px; padding: 0 var(--s2); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-family: var(--mono); font-size: 13px; }
.lookup input:focus { outline: none; border-color: var(--accent); }
button, .button { height: 28px; padding: 0 10px; background: var(--raised); border: 1px solid var(--border); border-radius: 4px; color: var(--text); cursor: pointer; font-size: 13px; line-height: 26px; white-space: nowrap; display: inline-block; }
button:hover:not(:disabled), .button:hover { border-color: var(--accent); text-decoration: none; }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { height: 20px; line-height: 18px; padding: 0 6px; font-size: 11px; }
.quota { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.quota .hot { color: var(--warn); }
.user { display: flex; align-items: center; gap: var(--s1); font-size: 12px; margin-left: auto; white-space: nowrap; }
.user img { width: 22px; height: 22px; border-radius: 50%; }
.user .roles { color: var(--muted); }

/* banners */
.banner { margin: var(--s2) var(--s3) 0; padding: var(--s1) var(--s2); border: 1px solid var(--warn); border-radius: 4px; background: rgba(245, 165, 36, .08); font-size: 12px; }
.banner.error { border-color: var(--danger); background: rgba(229, 72, 77, .1); }
.banner div + div { margin-top: 2px; }
.empty { color: var(--muted); padding: var(--s3); font-size: 13px; }

/* layout */
.layout { display: grid; gap: var(--s3); grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); max-width: 2200px; margin: 0 auto; padding: var(--s3); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: var(--s3); min-width: 0; }
.card h2 { margin: 0 0 var(--s2); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
#graylog.full { grid-column: 1 / -1; scroll-margin-top: 48px; }
.activity .jump { margin-left: var(--s1); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row h2 { margin: 0; }
.row .right { margin-left: auto; font-size: 12px; }
.stream { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: var(--s1); }
select { height: 24px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-size: 12px; padding: 0 var(--s1); }
.note { font-size: 12px; color: var(--muted); margin: var(--s2) 0 var(--s1); }
.scroll { overflow-x: auto; }

/* summary */
.verdict { display: flex; align-items: baseline; gap: var(--s2); padding: var(--s2); border-radius: 4px; border: 1px solid var(--border); margin-bottom: var(--s2); }
.verdict .title { font-weight: 700; font-size: 15px; }
.verdict .detail { font-size: 12px; color: var(--muted); }
.verdict.flagged { border-color: var(--danger); background: rgba(229, 72, 77, .12); }
.verdict.flagged .title { color: var(--danger); }
.verdict.delisted { border-color: var(--warn); background: rgba(245, 165, 36, .1); }
.verdict.delisted .title { color: var(--warn); }
.verdict.clean { border-color: var(--ok); background: rgba(63, 185, 80, .08); }
.verdict.clean .title { color: var(--ok); }
.verdict.unknown { border-color: var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s2); }
.chip { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--border); color: var(--muted); background: var(--raised); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: rgba(63, 185, 80, .4); }
.chip.warn { color: var(--warn); border-color: rgba(245, 165, 36, .5); }
.chip.bad { color: var(--danger); border-color: rgba(229, 72, 77, .5); }
.chip.info { color: var(--accent); border-color: rgba(91, 141, 239, .5); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--s2); margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); white-space: nowrap; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts dd.mono, .mono { font-family: var(--mono); font-size: 12px; }

.activity { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); font-size: 13px; }
.activity b { font-weight: 600; }
.activity .servers { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* world map: bundled Wikimedia BlankMap-World (public domain), MaxMind country filled in the
   accent colour. The map's own layer classes: landxx = land, oceanxx = sea, circlexx/subxx =
   marker rings for micro-states (hidden until that country is highlighted), limitxx/unxx/noxx =
   disputed or dependent regions (hidden unless highlighted, e.g. Kosovo is a limitxx inside rs). */
.map { margin-top: var(--s2); }
#map svg { width: 100%; height: auto; display: block; }
#map svg path { fill: #2b303b; stroke: var(--bg); stroke-width: 1.2; fill-rule: evenodd; }
#map .oceanxx, #map .circlexx, #map .subxx, #map .limitxx, #map .unxx, #map .noxx { display: none; }
/* accent stroke too: a micro-state's fill is otherwise buried under the border stroke */
#map .hit, #map .hit * { display: inline; fill: var(--accent); stroke: var(--accent); }
#map circle.hit-ring { display: inline; fill: none; stroke: var(--accent); stroke-width: 10; }
.map-caption { display: flex; justify-content: space-between; gap: var(--s2); font-size: 12px; color: var(--muted); margin-top: 2px; }
.map-caption .attrib { font-size: 11px; white-space: nowrap; }

/* tables */
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 3px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface); }
table.grid tbody tr:hover { background: rgba(255, 255, 255, .025); }
#cmp th .chip { display: block; margin-top: 2px; width: max-content; }
#cmp td:first-child { color: var(--muted); font-size: 12px; width: 150px; position: sticky; left: 0; background: var(--surface); }
#cmp td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td.yes { color: var(--danger); font-weight: 600; }
td.no { color: var(--ok); }
td.na { color: var(--muted); }
td.warn { color: var(--warn); }
td.info { color: var(--accent); }
.reasons { margin-top: var(--s2); font-size: 12px; }
.reasons div { color: var(--warn); }
.raw details { margin-top: var(--s1); }
.raw summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.raw pre { margin: var(--s1) 0 0; padding: var(--s2); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; font-size: 12px; max-height: 360px; overflow: auto; }

/* joins */
.summary { font-size: 12px; margin-bottom: var(--s1); }
.summary b { font-weight: 600; }
table.joins td { white-space: nowrap; }
table.joins td.wrap { white-space: normal; max-width: 220px; }
table.joins tr.band { background: rgba(91, 141, 239, .06); }
table.joins tr.self td.ip { color: var(--accent); }
table.joins .sub { color: var(--muted); font-size: 11px; margin-left: 4px; }
.lic { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--accent); border-bottom: 1px dotted var(--accent); }
.links a + a::before { content: " · "; color: var(--muted); }
.copy { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 3px; height: auto; line-height: 1; font-size: 11px; }
.copy:hover { color: var(--text); border: none; }

/* popover */
.popover { position: absolute; z-index: 20; background: var(--raised); border: 1px solid var(--border); border-radius: 6px; padding: var(--s2); box-shadow: 0 6px 24px rgba(0, 0, 0, .5); font-size: 12px; min-width: 200px; }
.popover div { padding: 2px 0; }
.popover .mono { word-break: break-all; color: var(--muted); }

/* login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: var(--s3); }
.login { max-width: 380px; width: 100%; text-align: center; }
.login h1 { font-size: 18px; margin: 0 0 var(--s2); }
.login p { margin: 0 0 var(--s3); font-size: 13px; }

/* responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .bar { height: auto; flex-wrap: wrap; padding: var(--s1) var(--s2); row-gap: var(--s1); }
  .lookup { flex-basis: 100%; }
  .lookup input { max-width: none; }
  .quota { display: none; }
  .layout { padding: var(--s2); gap: var(--s2); }
  .card { padding: var(--s2); }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: var(--s1); }
  .banner { margin: var(--s2) var(--s2) 0; }
}
