: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;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tabs a {
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

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

.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; }

