:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f0f6fb;
  --text: #111827;
  --muted: #5d6675;
  --border: #dce5ee;
  --navy: #001d4e;
  --blue: #0051c2;
  --teal: #00e0b8;
  --green: #19a070;
  --shadow: 0 18px 45px rgba(0, 29, 78, 0.12);
  --radius: 8px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 94px;
  padding: 18px clamp(18px, 5vw, 64px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-spacer,
.header-end {
  display: flex;
  align-items: center;
  min-width: 52px;
}

.header-end {
  justify-content: flex-end;
}

.brand img {
  display: block;
  width: min(360px, 78vw);
  height: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 12px clamp(18px, 5vw, 64px);
  background: var(--navy);
}

.site-nav a {
  border-radius: var(--radius);
  color: #ffffff;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
  background: var(--teal);
  color: var(--navy);
  outline: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 24px clamp(18px, 5vw, 64px);
  text-align: center;
}

.site-footer p {
  margin: 10px 0 0;
  font-size: 0.85rem;
}

.card-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.card-logos img {
  height: 24px;
  width: auto;
}

.login-shell,
.users-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 38px clamp(18px, 5vw, 64px) 56px;
}

.login-panel,
.users-panel {
  border: 1px solid var(--border);
  border-top: 5px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-panel h1,
.users-panel h1 {
  color: var(--navy);
  font-size: 1.65rem;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-grid input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
  padding: 9px 14px;
  text-decoration: none;
}

.button:hover,
.button:focus-visible {
  background: var(--navy);
  outline: 0;
}

.error-message {
  border: 1px solid #f0b3a3;
  border-radius: var(--radius);
  background: #fff2ee;
  color: #7d2e19;
  margin-bottom: 16px;
  padding: 10px 12px;
}

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

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
}

.users-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.84rem;
}

/* ── Sitewide dark mode ─────────────────────────────────────── */
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3 {
  color: var(--teal) !important;
}

/* Page-hero banners are already on a dark gradient — keep those white */
:root[data-theme="dark"] .page-header h1 {
  color: #ffffff !important;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071329;
  --surface: #0d1d3d;
  --surface-soft: #132a55;
  --text: #f5f9ff;
  --muted: #afbdd0;
  --border: #253d68;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .form-grid input,
:root[data-theme="dark"] .form-select {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
}

/* ── Theme toggle button (in .site-header) ─────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  transition: background 160ms ease, border-color 160ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
  outline: 0;
}

/* ── Success flash message (shared) ────────────────────────── */
.success-message {
  border: 1px solid #a7d7b8;
  border-radius: var(--radius);
  background: #edfaf3;
  color: #145c36;
  margin-bottom: 20px;
  padding: 10px 12px;
}

/* ── New / Updated badges ───────────────────────────────────── */
.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  line-height: 1.5;
}

.badge-new {
  background: var(--teal);
  color: var(--navy);
}

.badge-updated {
  background: var(--blue);
  color: #ffffff;
}
