:root {
  --bg: #f4f6f8;
  --fg: #1f2933;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #d7dde5;
  --accent: #0b5fa5;
  --ok: #136f3b;
  --error: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar .logo { height: 28px; width: auto; display: block; }

.topbar nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.topbar nav a.active,
.topbar nav a:hover { background: rgba(255, 255, 255, 0.18); }

.container {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.container.wide { max-width: 1800px; }

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

nav.tabs a {
  padding: 0.45rem 0.95rem;
  text-decoration: none;
  color: var(--fg);
  background: #eef1f4;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  font-weight: 500;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

nav.tabs a:hover {
  background: #dfe6ee;
  color: var(--accent);
  box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.1);
}

nav.tabs a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 -2px 6px rgba(11, 95, 165, 0.35);
}

.tabs .tab-label {
  padding: 0.5rem 0.35rem 0.5rem 0.2rem;
  margin-left: 1.5rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  align-self: center;
}

.tabs .tab-label:first-child { margin-left: 0; }

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

form label {
  display: block;
  margin-bottom: 0.85rem;
  font-weight: 600;
}

form input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 400;
}

form input:disabled { background: #eef1f4; color: var(--muted); }

button, .button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .button:hover { filter: brightness(1.08); }

.alert {
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert.error { background: #fdecea; color: var(--error); border-color: #f5c6c2; }
.alert.ok { background: #e8f5ec; color: var(--ok); border-color: #bfe3cb; }

.muted { color: var(--muted); font-size: 0.92rem; }
.muted a, .container a { color: var(--accent); }

/* Keep link-buttons readable (the generic ".container a" colour must not win). */
.container a.button,
.container a.button:hover { color: #fff; }

.pill {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.pill-user { background: #e3ecf5; color: #0b5fa5; }
.pill-promotor { background: #e3f4e8; color: #136f3b; }
.pill-admin { background: #fdecea; color: #b3261e; }
.pill-active { background: #e3f4e8; color: #136f3b; }
.pill-disabled { background: #eef1f4; color: #6b7280; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

.banner {
  background: #fff4d6;
  border: 1px solid #e8c877;
  color: #7a5a00;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

form select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 400;
  background: #fff;
}

form label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

form label.checkbox input { width: auto; margin: 0; }

.button.small, button.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

button.secondary, .button.secondary {
  background: #5b6b7b;
}

form.inline { display: inline-block; margin: 0; }

table.users {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95rem;
}

table.users th, table.users td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.users th { background: #eef1f4; font-size: 0.9rem; }

table.users td.actions { white-space: nowrap; }

table.users td.actions a, table.users td.actions form { margin-right: 0.25rem; }


/* ── Cluster status banner (site-wide, above the top bar) ── */
.cs-banner {
  background: #1e2a38;
  padding: 0.5rem 0.75rem;
}

.cs-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cs-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 11rem;
  min-width: 10rem;
  text-align: left;
  background: #26374a;
  color: #e8edf3;
  border: 1px solid #35485e;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.cs-box:hover { background: #2f4560; border-color: #4a6a90; }
.cs-box:focus-visible { outline: 2px solid #7fb3e8; outline-offset: 2px; }

.cs-head { display: flex; align-items: center; gap: 0.45rem; }
.cs-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #9fb4c8; }

.cs-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cs-dot.cs-ok { background: #a5d6a7; box-shadow: 0 0 6px #a5d6a7; }
.cs-dot.cs-warn { background: #ffe082; box-shadow: 0 0 6px #ffe082; }
.cs-dot.cs-crit { background: #ef9a9a; box-shadow: 0 0 6px #ef9a9a; }
.cs-dot.cs-unknown { background: #6b7a89; }

.cs-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cs-pill { display: inline-flex; align-items: center; padding: 1px 8px;
  border-radius: 10px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.cs-pill.cs-ok { background: #1b5e20; color: #a5d6a7; }
.cs-pill.cs-warn { background: #4a3000; color: #ffe082; }
.cs-pill.cs-crit { background: #5c1a00; color: #ef9a9a; }
.cs-pill.cs-muted { background: #37474f; color: #cfd8dc; }

.cs-overlays { position: relative; }
.cs-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; }
.cs-overlay[hidden] { display: none; }
.cs-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.cs-panel { position: relative; margin: auto; width: calc(100% - 3rem);
  max-width: 640px; max-height: 80vh; overflow: auto; background: var(--card);
  color: var(--fg); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.1rem 1.3rem; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); }
.cs-panel-head { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.6rem; }
.cs-panel-head h2 { margin: 0; font-size: 1.05rem; }
.cs-close { background: transparent; color: var(--muted); border: 0; font-size: 1.5rem;
  line-height: 1; padding: 0 0.3rem; cursor: pointer; font-weight: 400; }
.cs-close:hover { color: var(--fg); filter: none; }
.cs-list { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.cs-list li { margin: 0.2rem 0; }
