:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1f27;
  --muted: #5b6472;
  --border: #e2e5ea;
  --primary: #0067c0;
  --primary-hover: #005299;
  --accent-staging: #b5651d;
  --accent-prod: #1a7f37;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.env-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
}
.env-badge.env-dev,
.env-badge.env-staging { background: var(--accent-staging); }
.env-badge.env-prod,
.env-badge.env-production { background: var(--accent-prod); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user { font-weight: 600; }
.role {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.content {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card.center { text-align: center; }

h1 { margin-top: 0; font-size: 1.4rem; }
h2 { font-size: 1.1rem; }

.meta {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem 1rem;
  margin: 1rem 0 0;
}
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

.feature-list {
  columns: 2;
  color: var(--muted);
}

.hint { color: var(--muted); font-size: 0.88rem; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.footer {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- Dashboard --- */
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-head h1 { margin: 0; }
.count { color: var(--muted); font-size: 0.85rem; }

.banner {
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
}
.banner-error {
  background: #fdecec;
  color: #8a1c1c;
  border: 1px solid #f3c2c2;
}

.table-wrap { overflow-x: auto; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.grid th,
table.grid td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.grid th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
table.grid td.num,
table.grid th.num { text-align: right; }
table.grid td.domain { font-weight: 600; }
table.grid tbody tr:hover { background: var(--bg); }

.pill {
  font-size: 0.74rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}
.pill-on { background: #e4f2e8; color: #1a7f37; }
.pill-off { background: #eceef1; color: #5b6472; }

.lookup {
  display: inline-block;
  min-width: 1.6rem;
  text-align: center;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lookup-ok { background: #e4f2e8; color: #1a7f37; }
.lookup-warning { background: #fbefd6; color: #8a5a00; }
.lookup-critical { background: #fdecec; color: #b3261e; }
.lookup-unknown { background: #eceef1; color: #5b6472; }

.tick { color: #1a7f37; font-weight: 600; }
.cross { color: #b3261e; font-weight: 600; }
.muted { color: var(--muted); }

.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }

.legend {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.legend .lookup { font-weight: 600; }
