:root {
  --topnav-bg: #1e2530;
  --topnav-text: #adb5bd;
  --topnav-active-bg: rgba(13, 110, 253, 0.85);
  --topnav-hover-bg: rgba(255, 255, 255, 0.08);
  --topnav-height: 52px;
  --state-healthy: #198754;
  --state-degraded: #e0a800;
  --state-down: #dc3545;
  --state-unknown: #6c757d;
}

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; overflow: hidden; }
main { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }

.card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); border: 1px solid var(--bs-border-color); }
[data-bs-theme="dark"] .card { box-shadow: none; }

/* Top navigation: a hand-rolled dark slate bar that stays dark in both content themes. */
#topnav { background: var(--topnav-bg); min-height: var(--topnav-height); flex: 0 0 auto; position: relative; z-index: 20; }
.topnav-inner { display: flex; align-items: center; gap: 0.25rem; min-height: var(--topnav-height); padding: 0 1rem; }
.topnav-brand { color: #fff; font-weight: 600; text-decoration: none; margin-right: 1rem; white-space: nowrap; }
.topnav-brand i { color: #4dabf7; margin-right: 0.35rem; }
.topnav-links { display: flex; gap: 0.15rem; flex-wrap: nowrap; overflow-x: auto; }
.topnav-links a {
  color: var(--topnav-text); text-decoration: none; padding: 0.4rem 0.65rem; border-radius: 0.4rem; font-size: 0.88rem;
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
}
.topnav-links a:hover { background: var(--topnav-hover-bg); color: #fff; }
.topnav-links a.active { background: var(--topnav-active-bg); color: #fff; }
.topnav-sep { flex: 1 1 auto; }
.topnav-user { color: var(--topnav-text); font-size: 0.85rem; margin-right: 0.5rem; text-decoration: none; }
.topnav-icon-btn { background: none; border: 0; color: var(--topnav-text); padding: 0.4rem 0.6rem; border-radius: 0.4rem; text-decoration: none; }
.topnav-icon-btn:hover { background: var(--topnav-hover-bg); color: #fff; }

@media (max-width: 991px) {
  .topnav-inner { flex-wrap: wrap; padding-top: 0.25rem; padding-bottom: 0.25rem; }
  .topnav-links { display: none; order: 10; flex-direction: column; width: 100%; padding-bottom: 0.5rem; }
  .topnav-links.open { display: flex; }
}

.auth-card { max-width: 26rem; margin: 3rem auto; }

/* State pills and bars */
.state-pill {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 1rem; color: #fff; font-size: 0.75rem; font-weight: 600;
  text-transform: capitalize; white-space: nowrap;
}
.state-healthy { background: var(--state-healthy); }
.state-degraded { background: var(--state-degraded); color: #212529; }
.state-down { background: var(--state-down); }
.state-unknown { background: var(--state-unknown); }

.dot { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 50%; margin-right: 0.35rem; background: var(--state-unknown); }
.dot.state-healthy { background: var(--state-healthy); }
.dot.state-degraded { background: var(--state-degraded); }
.dot.state-down { background: var(--state-down); }

.tile { border-left: 4px solid var(--state-unknown); }
.tile.ok { border-left-color: var(--state-healthy); }
.tile.warn { border-left-color: var(--state-degraded); }
.tile.bad { border-left-color: var(--state-down); }
.tile .tile-value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.tile .tile-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bs-secondary-color); }

.meter { margin-bottom: 0.45rem; }
.meter .meter-head { display: flex; justify-content: space-between; font-size: 0.8rem; }
.meter .progress { height: 0.45rem; }

.agent-card.offline { opacity: 0.85; border-color: var(--state-down); }
.agent-card .card-header a { text-decoration: none; color: inherit; }

.check-chip { display: inline-block; margin: 0.1rem 0.25rem 0.1rem 0; padding: 0.1rem 0.5rem; border-radius: 0.4rem; font-size: 0.75rem; border: 1px solid var(--bs-border-color); }
.check-chip.ok { border-color: var(--state-healthy); color: var(--state-healthy); }
.check-chip.bad { border-color: var(--state-down); color: var(--state-down); }

.chart-box { position: relative; height: 180px; }
.key-box { font-family: var(--bs-font-monospace); word-break: break-all; }
pre.config-sample { max-height: 22rem; overflow: auto; }

table.table td, table.table th { vertical-align: middle; }
.table-actions { white-space: nowrap; text-align: right; }
