:root {
  --charcoal: #1e1c1e;
  --charcoal-raised: #27242a;
  --offwhite: #efeee4;
  --blue: #00519c;
  --red: #b50000;
  --gold: #f9b403;
  --border: rgba(239, 238, 228, 0.10);
  --text-dim: rgba(239, 238, 228, 0.58);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--charcoal);
  color: var(--offwhite);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
}

.mono { font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace; }

a { color: inherit; }

/* ── Login shell ─────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(0,81,156,0.18), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(249,180,3,0.10), transparent 45%),
    var(--charcoal);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--charcoal-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 40px 32px 32px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--blue));
}

.auth-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--offwhite);
  font-size: 14px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(249,180,3,0.15);
}

.btn {
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: var(--charcoal);
  border: none;
  border-radius: 3px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible { outline: 2px solid var(--offwhite); outline-offset: 2px; }

.btn-ghost {
  background: transparent;
  color: var(--offwhite);
  border: 1px solid var(--border);
}

.auth-links {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}
.auth-links a { color: var(--gold); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.alert {
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 18px;
}
.alert-error { background: rgba(181,0,0,0.15); border: 1px solid rgba(181,0,0,0.4); color: #ff9d9d; }
.alert-ok { background: rgba(0,81,156,0.18); border: 1px solid rgba(0,81,156,0.5); color: #a7cdf0; }

/* ── App shell (dashboard/admin) ─────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand span { color: var(--gold); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-dim);
}
.topbar-right a { text-decoration: none; color: var(--offwhite); }
.topbar-right a:hover { color: var(--gold); }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
}
.page-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 32px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.app-tile {
  display: block;
  background: var(--charcoal-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 22px;
  text-decoration: none;
  color: var(--offwhite);
  transition: border-color .15s ease, transform .15s ease;
}
.app-tile:hover { border-color: var(--gold); transform: translateY(-2px); }

.app-tile-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.app-tile-desc { font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.app-tile-go {
  margin-top: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 32px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.data tr:hover td { background: rgba(239,238,228,0.03); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}
.badge-admin { background: rgba(249,180,3,0.15); color: var(--gold); }
.badge-active { background: rgba(0,81,156,0.18); color: #a7cdf0; }
.badge-inactive { background: rgba(181,0,0,0.15); color: #ff9d9d; }

.section {
  margin-bottom: 44px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 16px; margin: 0; }

.card {
  background: var(--charcoal-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
}

.checkbox-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Overrides the generic ".field label" rule (display:block, margin-bottom) that
   otherwise makes these per-checkbox labels behave like stacked block labels. */
.checkbox-row label {
  display: inline-flex !important;
  align-items: center;
  flex: 0 1 auto;
  width: auto;
  margin: 0 !important;
  text-align: left;
  color: var(--offwhite);
}

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 180px; }

@media (max-width: 640px) {
  .page { padding: 28px 16px 60px; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
}
