:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --gray: #6e7681;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Nav ── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-brand { font-weight: 600; font-size: 15px; color: var(--text); white-space: nowrap; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active { background: var(--surface2); color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Cards / Sections ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 16px; }

/* ── Stats bar ── */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-healthy .stat-value { color: var(--green); }
.stat-issue .stat-value { color: var(--yellow); }
.stat-offline .stat-value { color: var(--gray); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface2); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.status-healthy { background: rgba(63,185,80,.15); color: var(--green); }
.status-issue   { background: rgba(210,153,34,.15); color: var(--yellow); }
.status-offline { background: rgba(110,118,129,.15); color: var(--gray); }
.badge-critical { background: rgba(248,81,73,.15);  color: var(--red); }
.badge-warning  { background: rgba(210,153,34,.15); color: var(--yellow); }
.badge-info     { background: rgba(88,166,255,.15); color: var(--accent); }
.badge-ack      { background: rgba(110,118,129,.12); color: var(--text-muted); }

/* ── Metrics grid ── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.metric-value { font-size: 22px; font-weight: 600; }
.metric-unit  { font-size: 13px; color: var(--text-muted); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #0d1117; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ── Login page ── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 40px; width: 360px; }
.login-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

/* ── Misc ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 600; }
.back-link { color: var(--accent); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.back-link:hover { text-decoration: underline; }
.text-muted { color: var(--text-muted); }
.error-msg { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
.filter-bar select { width: auto; }
.token-row { display: flex; align-items: center; gap: 10px; }
.token-box { font-family: monospace; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; flex: 1; color: var(--text); font-size: 13px; }
.section-gap { margin-top: 32px; }
