*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }

:root {
  --c-secondary: #555;
  --c-muted: #888;
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 1rem; }
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.mb-15 { margin-bottom: 1.5rem; }
.d-none { display: none; }
.d-inline { display: inline; }
.d-contents { display: contents; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.fw-400 { font-weight: 400; }
.fw-600 { font-weight: 600; }
.fs-xs { font-size: 0.75rem; }
.fs-sm { font-size: 0.85rem; }
.text-secondary { color: var(--c-secondary); }
.text-muted { color: var(--c-muted); }
.text-meta { color: #666; font-size: 0.82rem; }
.text-faint { color: #ccc; }
.cursor-pointer { cursor: pointer; }
.no-select { user-select: none; }
.chk-gold { width: 1rem; height: 1rem; accent-color: #ffd700; flex-shrink: 0; }
.form-check {
  display: flex; align-items: center; gap: 0.75rem; margin-top: 0;
  cursor: pointer; font-weight: normal; font-size: 0.9rem;
}
.badge-toggle {
  cursor: pointer; border: none; font-family: inherit;
  text-decoration: underline dotted; background: inherit;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f4f6f9;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── Top-Nav ── */
nav.topbar {
  width: 100%;
  background: #000;
  color: #ffd700;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
nav.topbar .brand { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
nav.topbar .nav-links { display: flex; gap: 0.2rem; height: 100%; }
nav.topbar .nav-links a {
  display: flex; align-items: center; padding: 0 1rem;
  color: #fff; text-decoration: none; font-size: 0.88rem; font-weight: 600;
  border-bottom: 3px solid transparent; transition: color 0.15s, border-color 0.15s;
}
nav.topbar .nav-links a:hover  { color: #ffd700; }
nav.topbar .nav-links a.active { color: #ffd700; border-bottom-color: #ffd700; }
nav.topbar .user { font-size: 0.82rem; color: #ccc; display: flex; align-items: center; gap: 0.8rem; }
nav.topbar form { display: inline; }
nav.topbar button {
  background: none; border: 1px solid #444; color: #aaa;
  padding: 0.3rem 0.75rem; border-radius: 5px; cursor: pointer; font-size: 0.8rem;
}
nav.topbar button:hover { border-color: #ffd700; color: #ffd700; }
.nav-user-row { display: none; }
.gear-link {
  color: #aaa; text-decoration: none; font-size: 1.15rem; line-height: 1;
  display: flex; align-items: center; transition: color 0.15s;
}
.gear-link:hover { color: #fff; }
.gear-link.active { color: #ffd700; }

/* Nav-Umschaltung: nicht an eine feste Bildschirmbreite gebunden, sondern per
   JS (siehe _topbar.ejs) auf .nav-collapsed gesetzt, sobald Marke+Links+User
   nicht mehr in die Leiste passen. */
nav.topbar.nav-collapsed { padding: 0 1rem; position: relative; }
nav.topbar.nav-collapsed .brand { font-size: 0.88rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.topbar.nav-collapsed .nav-links {
  display: none; flex-direction: column; height: auto;
  position: absolute; top: 52px; left: 0; right: 0;
  background: #0a0a0a; z-index: 200; padding-bottom: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
nav.topbar.nav-collapsed .nav-links.open { display: flex; }
nav.topbar.nav-collapsed .nav-links a {
  padding: 0.75rem 1.2rem; height: auto;
  border-bottom: 1px solid #1e1e1e; font-size: 0.92rem;
  color: #fff;
}
nav.topbar.nav-collapsed .nav-links a:hover { color: #ffd700; }
nav.topbar.nav-collapsed .nav-links a:last-child { border-bottom: none; }
nav.topbar.nav-collapsed .nav-links a.active { background: #111; border-bottom-color: transparent; color: #ffd700; }
nav.topbar.nav-collapsed .user { display: none; }
nav.topbar.nav-collapsed .nav-toggle { display: flex !important; align-items: center; margin-left: 0.5rem; }
nav.topbar.nav-collapsed .nav-user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.2rem; border-bottom: 2px solid #2a2a2a;
  background: #111; color: #ccc; font-size: 0.82rem;
}
nav.topbar.nav-collapsed .nav-user-info { display: flex; align-items: center; gap: 0.5rem; }
nav.topbar.nav-collapsed .nav-user-actions { display: flex; align-items: center; gap: 0.8rem; }

main { padding: 2rem; max-width: 1600px; margin: 0 auto; }

h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.05rem; margin-bottom: 1rem; color: #333; font-weight: 700; }

.card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  padding: 1.5rem; margin-bottom: 1.5rem;
}
.card-flush { padding: 0; overflow: hidden; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.6rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  text-align: left; padding: 0.6rem 0.8rem;
  background: #f8f8f8; border-bottom: 2px solid #eee;
  font-size: 0.75rem; text-transform: uppercase; color: #666; white-space: nowrap;
}
td { padding: 0.6rem 0.8rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-link:hover td { background: #fafafa; }
tr:hover td { background: #fafafa; }

.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.badge-genehmigt { background: #e8f5e9; color: #2e7d32; }
.badge-abgelehnt { background: #fdecea; color: #b71c1c; }

.alert {
  background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb;
  border-radius: 7px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.92rem;
}
.success {
  background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9;
  border-radius: 7px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.92rem;
}

label { display: block; font-size: 0.85rem; font-weight: 600; color: #444; margin-bottom: 0.3rem; margin-top: 1rem; }
input[type="email"], input[type="password"], input[type="number"], input[type="text"], select {
  width: 100%; padding: 0.72rem 0.9rem;
  border: 1.5px solid #d1d5db; border-radius: 7px; font-size: 1rem;
  background: #fafafa; transition: border-color 0.2s; font-family: inherit;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.85rem center;
  padding-right: 2.5rem; cursor: pointer;
}
input:focus { outline: none; border-color: #ffd700; background: #fff; }
select:focus { outline: none; border-color: #ffd700; background-color: #fff; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1.4rem; background: #ffd700; color: #000;
  font-weight: 700; font-size: 0.9rem; border: none; border-radius: 7px;
  cursor: pointer; text-decoration: none; transition: background 0.15s;
}
.btn:hover { background: #f0c800; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; font-weight: 600; border-radius: 5px; }
.btn-ghost {
  background: none; border: 1px solid #d1d5db; color: #444;
  padding: 0.3rem 0.8rem; font-size: 0.8rem; font-weight: 600; border-radius: 5px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem;
}
.btn-ghost:hover { border-color: #000; color: #000; }
.btn-ghost-danger { border-color: #fca5a5; color: #dc2626; }
.btn-ghost-danger:hover { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.btn-danger { background: #d32f2f; color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-green { background: #25d366; color: #fff; }
.btn-green:hover { background: #1ebe5d; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.85rem; }
.btn-dashed {
  width: 100%; background: none; border: 1.5px dashed #d1d5db; color: #555;
  padding: 0.6rem 1rem; border-radius: 7px; cursor: pointer; font-family: inherit;
  font-size: 0.9rem; transition: border-color 0.15s, color 0.15s;
}
.btn-dashed:hover { border-color: #999; color: #333; }
.btn-block { width: 100%; justify-content: center; margin-top: 1.5rem; }

@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-spinner {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.25); border-top-color: currentColor;
  border-radius: 50%; animation: btn-spin .7s linear infinite;
}

/* ── Detail-Liste ── */
dl.details { display: grid; grid-template-columns: 160px 1fr; gap: 0.5rem 1rem; font-size: 0.88rem; }

/* ── Responsive 2-col grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.member-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 1.2rem; }
dl.details dt { color: #888; font-weight: 600; padding-top: 0.15rem; }
dl.details dd { color: #1a1a2e; }

/* ── Modal ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 2rem;
  max-width: 400px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 1.1rem 1.4rem; border-bottom: 1px solid #f0f0f0;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-footer {
  padding: 1rem 1.4rem; border-top: 1px solid #f0f0f0;
  display: flex; justify-content: flex-end; gap: 0.75rem;
}
.modal-close {
  position: absolute; top: 1rem; right: 1.2rem;
  background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #888;
}
.modal-close:hover { color: #000; }
.modal-wrapper { position: relative; }

/* ── Auth-Shell (Login/Passwort vergessen/Zurücksetzen) ────────────────── */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #f4f6f9; padding: 1rem;
}
.auth-card {
  background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 2.5rem; width: 100%; max-width: 380px;
}

/* ── Seiten-spezifisch: Einstellungen / 2FA (gemeinsam genutzt) ───────────── */
.setup-banner {
  background: #fffbea; border: 1.5px solid #ffd700; border-radius: 10px;
  padding: 1.4rem; margin-bottom: 1.5rem;
}
.code-input-mono {
  letter-spacing: 0.25em; font-family: monospace; font-size: 1.3rem;
  font-weight: 700; text-align: center;
}
.totp-qr-img {
  display: block; border-radius: 8px; margin-bottom: 1rem; max-width: 200px;
  border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none; border: none; color: #ffd700;
  font-size: 1.5rem; cursor: pointer; padding: 0.2rem 0.5rem; line-height: 1;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  main { padding: 1rem; }
  h1 { font-size: 1.2rem; margin-bottom: 1rem; }
  .card { padding: 1rem; }
  .card table, .card-flush table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  dl.details { grid-template-columns: 110px 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .member-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .nav-toggle { margin-left: auto; }
  dl.details { grid-template-columns: 1fr; }
  dl.details dt { margin-top: 0.5rem; }
}
