/* NetMon dashboard — minimal, neutral, dark-mode aware. */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e3e6eb;
  --text: #18181b;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --down: #b91c1c;
  --down-bg: #fee2e2;
  --error: #4b5563;
  --error-bg: #e5e7eb;
  --stale: #c2410c;
  --stale-bg: #ffedd5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b22;
    --border: #2a2f3a;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --ok-bg: #052e16;
    --warn-bg: #422006;
    --down-bg: #450a0a;
    --error-bg: #1f2937;
    --stale-bg: #431407;
  }
}

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

header {
  border-bottom: 1px solid var(--border);
  background: var(--card);
  padding: 16px 24px;
}
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.subtitle {
  color: var(--text-muted);
  font-weight: 400;
}
.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.auto-indicator {
  color: var(--ok);
  font-size: 12px;
}
button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}
button:hover { background: var(--bg); }

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
h2 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.probes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.probe-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.probe-card .dot { font-size: 18px; }
.probe-card .meta { flex: 1; }
.probe-card .name { font-weight: 600; font-size: 14px; }
.probe-card .last-seen { color: var(--text-muted); font-size: 12px; }

/* Site sections use a single CSS grid so all probe-type groups
   (ICMP / HTTPS / BGP) share identical column positions. */
.site-section .grid {
  display: grid;
  grid-template-columns:
    72px                            /* col 1: STATUS pill */
    minmax(180px, max-content)      /* col 2: identifier (prefix / endpoint) */
    minmax(140px, 1fr)              /* col 3: detail (URL / origin AS) */
    110px                           /* col 4: metric 1 (right-aligned) */
    110px;                          /* col 5: metric 2 (right-aligned) */
  align-items: center;
  font-size: 13px;
}
.site-section .grid > div {
  padding: 7px 16px 7px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.site-section .grid > .group-header {
  grid-column: 1 / -1;
  padding: 18px 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: none;
}
.site-section .grid > .group-header:first-child { padding-top: 0; }
.site-section .grid > .hdr {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.site-section .grid > .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.site-section .grid > .muted {
  color: var(--text-muted);
  font-size: 12px;
}
.site-section .grid > .mismatch { color: var(--down); font-weight: 600; }

/* Legacy table styles (no longer used inside .site-section but kept
   for any future plain-table use elsewhere). */
table {
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 6px 16px 6px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th:last-child, td:last-child { padding-right: 0; }
th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
td.num, th.num { text-align: right; }
td.num         { font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pill-ok    { color: var(--ok);    background: var(--ok-bg); }
.pill-warn  { color: var(--warn);  background: var(--warn-bg); }
.pill-down  { color: var(--down);  background: var(--down-bg); }
.pill-error { color: var(--error); background: var(--error-bg); }
.pill-stale { color: var(--stale); background: var(--stale-bg); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
}
.badge-grey { color: var(--text-muted); background: var(--error-bg); }
.badge-red  { color: var(--down);       background: var(--down-bg); }

.issues-list { list-style: none; padding: 0; margin: 0; }
.issues-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.issues-list li:last-child { border-bottom: none; }
.issue-target { font-weight: 600; flex: 1; }
.issue-detail { color: var(--text-muted); font-size: 12px; }

.site-section { margin-bottom: 16px; }
.site-section h2 .site-meta {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
}

.empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 8px;
  text-align: center;
}

footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}
footer a { color: var(--accent); }
