@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  /* Basisfarben: dunkles, warmes Anthrazit statt reinem Schwarz */
  --bg: #0a0b10;
  --bg-soft: #0d0e15;
  --bg-elevated: #14161f;
  --bg-card: #171926;
  --bg-card-hover: #1b1e2c;
  --border: #262a3a;
  --border-soft: #1d2030;

  --text: #eef0f6;
  --text-muted: #8b90a8;
  --text-faint: #7d81a0; /* urspr. #5c6079 = 2.83:1 Kontrast auf --bg-card, verfehlte WCAG AA (4.5:1) fuer die Sidebar-Kategorielabels/Formular-Hinweise, die diese Farbe nutzen - auf 4.59:1 angehoben */

  /* Akzent: violett/lila-Verlauf statt reinem Discord-Blurple -> wirkt hochwertiger, individueller */
  --accent: #7c6cff;
  --accent-2: #c084fc;
  --accent-hover: #9285ff;
  --accent-soft: rgba(124, 108, 255, 0.14);
  --accent-gradient: linear-gradient(135deg, #7c6cff 0%, #a78bfa 55%, #c084fc 100%);

  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-pop: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* Light Mode: gleiche Variablennamen, helle Werte - da alle Komponenten ausschliesslich
   ueber diese Variablen gestylt sind (keine hartkodierten Farben), reicht dieser einzige
   Override-Block, um das komplette Dashboard umzufaerben. Aktivierung ueber
   [data-theme="light"] auf <html>, siehe js/core/theme.js. */
html[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f6fa;
  --bg-soft: #eef0f6;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f7f7fc;
  --border: #e2e4ee;
  --border-soft: #ececf3;

  --text: #191b26;
  --text-muted: #5c6079;
  --text-faint: #6b6f87; /* urspr. #9195ab = 2.96:1 Kontrast auf --bg-card, verfehlte WCAG AA - auf 4.94:1 angehoben, siehe Dark-Mode-Kommentar oben */

  --accent: #6b57f5;
  --accent-2: #a855f7;
  --accent-hover: #5a46e8;
  --accent-soft: rgba(107, 87, 245, 0.10);
  --accent-gradient: linear-gradient(135deg, #6b57f5 0%, #9061e0 55%, #a855f7 100%);

  --green: #16a34a;
  --red: #dc2626;
  --yellow: #d97706;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 24px rgba(30, 30, 60, 0.08);
  --shadow-pop: 0 20px 50px rgba(30, 30, 60, 0.16);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(107, 87, 245, 0.06), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(168, 85, 247, 0.05), transparent 55%),
    var(--bg);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d7d9e6; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #c2c5da; }

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(124, 108, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(192, 132, 252, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2e40; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #363b52; background-clip: content-box; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------------- */
/* Lade- / Login-Screens                                                  */
/* ---------------------------------------------------------------------- */

.loading, .login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

.loading::before {
  content: "";
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-screen {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(700px 400px at 50% 0%, rgba(124, 108, 255, 0.16), transparent 60%);
}
/* Zwei langsam wandernde, verschwommene Farbflecken hinter dem Login-Inhalt ("Aurora"-Effekt) -
   rein dekorativ, per pointer-events:none aus der Interaktion ausgeklinkt. */
.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}
.login-screen::before {
  background: var(--accent);
  top: -180px;
  left: -160px;
  animation: aurora-drift-a 16s ease-in-out infinite;
}
.login-screen::after {
  background: var(--accent-2);
  bottom: -200px;
  right: -160px;
  animation: aurora-drift-b 18s ease-in-out infinite;
}
@keyframes aurora-drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.15); }
}
@keyframes aurora-drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -30px) scale(1.1); }
}
.login-screen > * { position: relative; z-index: 1; }
.login-screen > * {
  animation: login-item-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.login-screen > *:nth-child(1) { animation-delay: 0.02s; }
.login-screen > *:nth-child(2) { animation-delay: 0.08s; }
.login-screen > *:nth-child(3) { animation-delay: 0.14s; }
.login-screen > *:nth-child(4) { animation-delay: 0.2s; }
.login-screen > *:nth-child(5) { animation-delay: 0.26s; }
.login-screen > *:nth-child(6) { animation-delay: 0.32s; }
@keyframes login-item-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Rotierendes 3D-Emblem: echter Wuerfel per CSS-3D-Transform (kein Bild, keine Lib) -
   dreht sich endlos um die Y-Achse und "schwebt" leicht auf und ab. Zusaetzlich zur reinen
   Rotation: ein weicher Bodenschatten (staerkt die Tiefenwirkung), ein Glow-Drop-Shadow in
   Akzentfarbe, ein diagonaler Glanz-Schimmer je Flaeche sowie Kanten-Highlights/Schattierung
   pro Flaeche (statt nur flacher brightness()-Abstufung) fuer einen deutlich plastischeren,
   weniger flachen Eindruck. */
.emblem-3d-stage {
  perspective: 900px;
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  position: relative;
}
.emblem-3d-stage::before {
  /* Sanftes Ambient-Glow-Halo hinter dem Wuerfel fuer mehr Praesenz/Tiefe */
  content: "";
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle, rgba(124, 108, 255, 0.35) 0%, rgba(124, 108, 255, 0) 68%);
  filter: blur(2px);
  animation: emblem-halo-pulse 3.4s ease-in-out infinite;
  z-index: -1;
}
@keyframes emblem-halo-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
.emblem-3d-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 62px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.32) 0%, rgba(0, 0, 0, 0) 72%);
  animation: emblem-shadow 3.4s ease-in-out infinite;
}
.emblem-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  filter: drop-shadow(0 16px 22px rgba(124, 108, 255, 0.38));
  animation: emblem-spin 11s linear infinite, emblem-float 3.4s ease-in-out infinite;
}
.emblem-3d-face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 20px 26px -14px rgba(255, 255, 255, 0.45),
    inset 0 -20px 26px -14px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.emblem-3d-face::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 68%, rgba(255, 255, 255, 0.12) 100%);
  pointer-events: none;
}
.emblem-3d-face i { width: 42px; height: 42px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3)); }
.emblem-3d-face.f-front  { transform: translateZ(48px); }
.emblem-3d-face.f-back   { transform: rotateY(180deg) translateZ(48px); }
.emblem-3d-face.f-right  { transform: rotateY(90deg) translateZ(48px); filter: brightness(0.8); }
.emblem-3d-face.f-left   { transform: rotateY(-90deg) translateZ(48px); filter: brightness(0.8); }
.emblem-3d-face.f-top    { transform: rotateX(90deg) translateZ(48px); filter: brightness(1.25); }
.emblem-3d-face.f-bottom { transform: rotateX(-90deg) translateZ(48px); filter: brightness(0.58); }
@keyframes emblem-spin { to { transform: rotateY(360deg); } }
@keyframes emblem-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes emblem-shadow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  50% { transform: translateX(-50%) scale(0.72); opacity: 0.32; }
}
@media (prefers-reduced-motion: reduce) {
  .login-screen::before, .login-screen::after,
  .login-screen > *, .emblem-3d, .emblem-3d-stage::after, .emblem-3d-stage::before { animation: none !important; }
}

.login-screen h1 {
  font-size: 30px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-screen h1 i {
  background: var(--accent-gradient);
  border-radius: 16px;
  padding: 10px;
  color: #fff;
}
.login-screen p { color: var(--text-muted); margin: 0 0 4px; max-width: 380px; line-height: 1.5; }
.login-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #ffb0b0;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  max-width: 380px;
}

/* ---------------------------------------------------------------------- */
/* Leitungs-/Team-Praesenzkarten (Beta-Gate: "Key bei X anfragen")        */
/* Im Discord-Profil-Look: Banner in Akzentfarbe, Avatar ueberlappt den   */
/* Banner-Rand, Rollen-Badge (Leitung / Stellv. Leitung), pro Karte       */
/* gestaffelt eingeblendet.                                               */
/* ---------------------------------------------------------------------- */

.owner-team {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}
.owner-card {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 16px 14px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  animation: owner-card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 0.09s);
}
@keyframes owner-card-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.owner-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 14px 28px -14px rgba(124, 108, 255, 0.4); }
.owner-card[data-role="leitung"]:hover { border-color: #f1c40f; box-shadow: 0 14px 28px -14px rgba(241, 196, 15, 0.4); }
.owner-card-banner {
  position: absolute;
  inset: 0 0 auto 0;
  height: 58px;
  background: var(--accent-gradient);
  opacity: 0.92;
  transition: opacity 0.2s ease;
  /* Weicher Verlauf statt hartem Schnitt am unteren Rand, damit das Banner in die Karte "einfliesst" */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}
.owner-card-banner::before {
  /* Zusaetzliche weiche Glanz-Blobs, wie man sie von Discord-Server-Bannern kennt */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at 88% 60%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 55%);
  mix-blend-mode: overlay;
}
.owner-card[data-role="leitung"] .owner-card-banner { background: linear-gradient(135deg, #f1c40f 0%, #f39c12 45%, #d4870a 100%); }
.owner-card:hover .owner-card-banner { opacity: 1; }
.owner-card-avatar-wrap { position: relative; flex-shrink: 0; z-index: 1; }
.owner-card-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: block;
  background: var(--bg-elevated);
  object-fit: cover;
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 0 2px rgba(124, 108, 255, 0.5), 0 4px 14px -4px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.owner-card[data-role="leitung"] .owner-card-avatar { box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.6), 0 4px 14px -4px rgba(0, 0, 0, 0.45); }
.owner-card:hover .owner-card-avatar { transform: scale(1.06); }
.owner-card-status-dot {
  position: absolute;
  bottom: 0;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--bg-card);
  background: var(--text-faint);
}
.owner-card-status-dot.online { background: var(--green); }
.owner-card-status-dot.idle { background: var(--yellow); }
.owner-card-status-dot.dnd { background: var(--red); }
.owner-card-status-dot.online::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: status-pulse 1.8s ease-out infinite;
}
@keyframes status-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(2.4); opacity: 0; }
}
.owner-card-body { text-align: left; min-width: 0; position: relative; z-index: 1; flex: 1; }
.owner-card-name-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.owner-card-name { font-weight: 700; font-size: 14.5px; }
.owner-card-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px 2px 6px;
  line-height: 1.5;
}
.owner-card-role-badge i { width: 11px; height: 11px; }
.owner-card[data-role="leitung"] .owner-card-role-badge { color: #f1c40f; background: rgba(241, 196, 15, 0.14); }
.owner-card-status-label { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.owner-card-status-label.online { color: var(--green); }
.owner-card-status-label.idle { color: var(--yellow); }
.owner-card-status-label.dnd { color: var(--red); }
.owner-card.skeleton { animation: none; }
.owner-card.skeleton .owner-card-avatar { background: var(--bg-elevated); box-shadow: none; animation: skeleton-pulse 1.3s ease-in-out infinite; }
.owner-card.skeleton .owner-card-banner { background: var(--bg-elevated); opacity: 1; animation: skeleton-pulse 1.3s ease-in-out infinite; }
@keyframes skeleton-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) {
  .owner-card { animation: none; }
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                */
/* ---------------------------------------------------------------------- */

.btn {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: filter 0.15s, transform 0.08s, box-shadow 0.15s;
  box-shadow: 0 6px 18px rgba(124, 108, 255, 0.28);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
/* Bisher hatten nur Formularfelder (input/textarea/select) einen eigenen Fokus-Stil (siehe
   weiter unten) - Buttons und Links verliessen sich auf den Browser-Standard, der auf dem
   dunklen Theme oft kaum sichtbar ist. Wichtig fuer Tastatur-Bedienung (Tab-Navigation). */
.btn:focus-visible,
.theme-toggle:focus-visible,
.sidebar-toggle:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--bg-card-hover); border-color: #33384c; }
.btn.danger { background: var(--red); box-shadow: 0 6px 18px rgba(248, 113, 113, 0.25); }
.btn.danger.secondary { background: transparent; border-color: rgba(248, 113, 113, 0.4); color: #ffb0b0; box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; box-shadow: none; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }

/* ---------------------------------------------------------------------- */
/* Grundlayout: Sidebar + Hauptbereich                                    */
/* ---------------------------------------------------------------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--border-soft);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar .brand {
  font-weight: 800;
  font-size: 18px;
  padding: 6px 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}
.sidebar .brand i {
  background: var(--accent-gradient);
  border-radius: 9px;
  padding: 6px;
  width: 30px;
  height: 30px;
  color: #fff;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: 4px 0 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.sidebar-search i { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-search input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -4px;
  padding: 0 4px 8px;
}

.nav-category-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.nav-category-label i { width: 12px; height: 12px; }

.nav-category-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  cursor: pointer;
  user-select: none;
}
.nav-category-header:hover { color: var(--text-muted); }
.nav-category-header i { width: 13px; height: 13px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.13s ease, color 0.13s ease;
}
.nav-item i { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: #cfc9ff;
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent-gradient);
  animation: nav-indicator-in 0.18s ease;
}
@keyframes nav-indicator-in {
  from { transform: scaleY(0.3); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

.nav-fav-btn {
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--text-faint);
  opacity: 0;
  display: flex;
  border-radius: 5px;
}
.nav-item:hover .nav-fav-btn,
.nav-fav-btn.active { opacity: 1; }
.nav-fav-btn i { width: 14px; height: 14px; }
.nav-fav-btn.active i { fill: currentColor; color: var(--yellow); }
.nav-item.active .nav-fav-btn { color: rgba(207, 201, 255, 0.7); }

.main {
  flex: 1;
  padding: 28px 40px 60px;
  overflow-y: auto;
  min-width: 0;
  position: relative;
}
.main h2 { margin-top: 0; }

/* Duenner Fortschrittsbalken statt vollflaechigem Ladespinner bei jeder Navigation - siehe
   renderPageContent() in main.js. Nur sichtbar waehrend geladen wird, alter Seiteninhalt
   bleibt bis dahin stehen statt auf einen leeren Platzhalter zu wischen. */
.page-progress {
  position: sticky;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 5;
  background: transparent;
  overflow: hidden;
}
.page-progress.loading::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent-gradient);
  animation: page-progress-slide 0.9s ease-in-out infinite;
}
@keyframes page-progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Sanftes Einblenden, sobald eine neue Seite fertig geladen ist (siehe renderPageContent) */
.page-fade-in { animation: page-fade-in 0.22s ease; }
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Karten erscheinen mit einem dezenten Eintritts-Effekt statt abrupt aufzupoppen -
   gestaffelt ueber :nth-child, damit mehrere Karten auf einer Seite nicht alle exakt
   gleichzeitig "aufspringen". Nur fuer direkte Kinder von #pageContent, damit z.B. Karten
   innerhalb eines bereits geoeffneten Panels (Selfroles/Tickets) nicht bei jeder kleinen
   State-Aenderung erneut hochspringen. */
#pageContent > .card {
  animation: card-enter 0.28s ease backwards;
}
#pageContent > .card:nth-child(1) { animation-delay: 0s; }
#pageContent > .card:nth-child(2) { animation-delay: 0.03s; }
#pageContent > .card:nth-child(3) { animation-delay: 0.06s; }
#pageContent > .card:nth-child(4) { animation-delay: 0.09s; }
#pageContent > .card:nth-child(n+5) { animation-delay: 0.12s; }
@keyframes card-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Sanfter Screen-Wechsel (Login <-> Beta-Gate <-> Server-Picker <-> Dashboard <-> Admin) -
   wird zentral per MutationObserver auf #app gesetzt, siehe main.js. Etwas ausgepraegter als
   .page-fade-in, weil hier der komplette Bildschirm getauscht wird statt nur der Seiteninhalt
   innerhalb des Dashboards. */
.app-content-in { animation: app-content-in 0.32s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes app-content-in {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .page-fade-in, .app-content-in, #pageContent > .card, .page-progress.loading::after { animation: none !important; }
}

/* Mobile: Sidebar wird zum Slide-in-Menü */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
  }
  .main { padding: 18px 16px 60px; }
}

/* ---------------------------------------------------------------------- */
/* Karten, Grids, Statistiken, Tabellen                                   */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

/* Emoji-Picker: Trigger-Button neben dem Input + durchsuchbares Popover-Grid */
.emoji-input-wrap { position: relative; display: inline-flex; align-items: center; }
.emoji-input-wrap input { padding-right: 34px !important; }
.emoji-input-trigger {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: 0.75;
}
.emoji-input-trigger:hover { opacity: 1; background: var(--bg-card-hover); }
.emoji-picker-popover {
  position: absolute;
  z-index: 200;
  width: 300px;
  max-height: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 10px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.emoji-picker-popover.show { opacity: 1; transform: translateY(0); }
.emoji-picker-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 8px;
}
.emoji-picker-search:focus { outline: none; border-color: var(--accent); }
.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  max-height: 250px;
  overflow-y: auto;
}
.emoji-picker-item {
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 20px;
  padding: 6px 0;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.1s ease;
}
.emoji-picker-item:hover { background: var(--bg-card-hover); transform: scale(1.15); }
.emoji-picker-empty { grid-column: 1 / -1; color: var(--text-faint); font-size: 12.5px; text-align: center; padding: 16px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* Tabellen: bisher komplett ungestyled (Browser-Default) - betrifft 13 Seiten
   (Moderation, Tickets, Logs, Team, News, Level, Streamplan, Twitch/YouTube, Admin,
   Server, Automod, Engagement). "display: block" auf <table> selbst (statt einem
   zusaetzlichen Wrapper-Div in allen 13 Seiten) reicht aus, damit breite Tabellen auf
   schmalen Viewports horizontal scrollen statt das Layout aufzubrechen - <tr>/<td>
   behalten dabei ihr table-row/table-cell-Rendering, da das nur vom jeweiligen
   Element selbst abhaengt, nicht vom display-Wert des Eltern-<table>. */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table th, table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table tr:last-child td { border-bottom: none; }
table tbody tr, table tr:not(:first-child) { transition: background 0.1s ease; }
table tr:not(:first-child):hover td { background: var(--bg-card-hover); }

/* Karten heben sich beim Hover leicht ab - macht klickbare/interaktive Karten
   (z.B. Panel-Cards zum Auf-/Zuklappen) fuehlbar interaktiv statt statisch. */
.panel-card-head { transition: background 0.12s ease; cursor: pointer; }
.panel-card-head:hover { background: var(--bg-card-hover); }

@media (max-width: 700px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table th, table td { padding: 8px 10px; }
}

.stat {
  text-align: left;
  padding: 4px 2px;
}
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.stat .label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-soft); gap: 16px; }
.toggle-row:last-child { border-bottom: none; }

.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #2c2f42; border-radius: 24px; transition: 0.15s; }
.slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.15s; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
input:checked + .slider { background: var(--accent-gradient); }
input:checked + .slider::before { transform: translateX(18px); }

input[type=text], input[type=number], input[type=datetime-local], input[type=password], select, textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 70px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.form-row .hint { display: block; font-size: 12px; color: var(--text-faint); margin-top: 5px; line-height: 1.5; font-weight: 400; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.access-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); }
.badge.on { background: rgba(52, 211, 153, 0.14); color: var(--green); }
.badge.off { background: rgba(248, 113, 113, 0.14); color: var(--red); }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 14px; margin-left: auto; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { background: var(--bg-card-hover); color: var(--text); border-color: #33384c; }
.theme-toggle svg { width: 17px; height: 17px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  max-width: 420px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-left-color: var(--green); }
.toast-success i { color: var(--green); }
.toast-warning { border-left-color: var(--yellow); }
.toast-warning i { color: var(--yellow); }
.toast-error { border-left-color: var(--red); }
.toast-error i { color: var(--red); }
.toast-info i { color: var(--accent); }

/* ---- Embed-Builder ---- */
.embed-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .embed-layout { grid-template-columns: 1fr; } }
.embed-preview-col { position: sticky; top: 28px; }
.embed-preview-col h3 { margin-top: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.inline-check { font-size: 12px; color: var(--text-muted); white-space: nowrap; display: flex; align-items: center; }

.discord-embed {
  background: var(--bg-elevated);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  max-width: 100%;
}
.de-author { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.de-author img { width: 20px; height: 20px; border-radius: 50%; }
.de-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: #fff; }
.de-desc { color: var(--text); white-space: pre-wrap; margin-bottom: 8px; line-height: 1.4; }
.de-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.de-field { flex: 1 1 100%; }
.de-field.inline { flex: 1 1 calc(33% - 10px); }
.de-field-name { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.de-field-value { color: var(--text-muted); font-size: 13px; white-space: pre-wrap; }
.de-image { max-width: 100%; border-radius: 6px; margin-top: 8px; display: block; }
.de-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; float: right; margin-left: 12px; }
.de-footer { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; margin-top: 8px; }
.de-footer img { width: 18px; height: 18px; border-radius: 50%; }

/* ---- Top-Navbar (Server-Auswahl-Seite) ---- */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 18px 32px; border-bottom: 1px solid var(--border-soft); }
.navbar .logo { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 10px; letter-spacing: -0.02em; }
.navbar .logo i { background: var(--accent-gradient); border-radius: 9px; padding: 6px; color: #fff; }
.navbar .user-profile { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 14px; }
.navbar .user-profile .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.container { max-width: 1100px; margin: 0 auto; padding: 32px; }

.page-header { margin-bottom: 26px; }
.page-header h1 { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font-size: 24px; }
.page-header h1 i { background: var(--accent-soft); color: #cfc9ff; border-radius: 10px; padding: 8px; width: 22px; height: 22px; }
.page-header p { color: var(--text-muted); margin: 0; max-width: 640px; line-height: 1.55; font-size: 14px; }

.picker h3 { margin: 30px 0 12px; color: var(--text-faint); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.picker h3:first-of-type { margin-top: 0; }

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.server-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 12px 30px rgba(124, 108, 255, 0.15); }
.server-card.disabled { cursor: default; opacity: 0.5; }
.server-card.disabled:hover { transform: none; border-color: var(--border); box-shadow: none; }
.server-card.add { border-style: dashed; }
.server-card-name { font-weight: 600; font-size: 14px; }
.guild-icon { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.guild-icon-fallback { display: flex; align-items: center; justify-content: center; background: var(--accent-gradient); color: white; font-weight: 700; font-size: 22px; }

.badge.role-admin { background: rgba(124, 108, 255, 0.18); color: #cfc9ff; }
.badge.role-moderator { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.badge.role-editor { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.badge.role-viewer { background: rgba(139, 144, 168, 0.15); color: var(--text-muted); }

/* ---- Sidebar: aktiver Server + Wechseln ---- */
.active-guild-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; margin-bottom: 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.switch-guild { width: 100%; margin-bottom: 16px; justify-content: center; display: flex; align-items: center; gap: 6px; }

/* ---- Module-Uebersicht ---- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.module-card p { color: var(--text-muted); font-size: 13px; margin: 8px 0 0; line-height: 1.5; }
.module-card-head { display: flex; align-items: center; gap: 10px; }
.module-card-head strong { flex: 1; }

.module-disabled { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 44px 20px; }
.module-disabled h3 { margin: 0; }
.module-disabled p { color: var(--text-muted); margin: 0 0 8px; max-width: 420px; line-height: 1.5; }

/* ---- Selfrole-Panel-Builder ---- */
.panel-card-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.panel-card-body { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
.role-option-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.role-option-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: var(--bg-elevated); border-radius: var(--radius-sm); font-size: 14px; }
.role-add-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: center; }

/* ---- Automod ---- */
.word-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.word-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 20px; padding: 4px 6px 4px 12px; font-size: 13px; }
.word-chip button { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; padding: 2px; }
.word-chip button:hover { color: var(--red); }

.spin { animation: spin 0.8s linear infinite; }

/* ---- Tabs, Modul-Status-Banner, Rollen-Checkboxen ---- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn {
  background: none; border: none; color: var(--text-muted); font-size: 13.5px; font-weight: 600;
  padding: 10px 14px; cursor: pointer; display: flex; align-items: center; gap: 6px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: #cfc9ff; border-bottom-color: var(--accent); }

.module-status-banner {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px; margin-bottom: 18px; border-radius: var(--radius);
}
.module-status-banner p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }
.module-status-banner > i { width: 22px; height: 22px; flex-shrink: 0; }
.module-status-banner > div { flex: 1; }
.module-status-banner.off { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.3); }
.module-status-banner.off > i { color: var(--red); }
.module-status-banner.off strong { color: #ffb0b0; }
.module-status-banner.on { background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.28); }
.module-status-banner.on > i { color: var(--green); }
.module-status-banner.on strong { color: var(--green); }

.role-checkbox-list {
  display: flex; flex-wrap: wrap; gap: 8px; max-height: 160px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--bg-elevated);
}
.role-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.role-checkbox input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.case-type-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.case-type-badge.warn { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.case-type-badge.mute { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.case-type-badge.unmute { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.case-type-badge.kick { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.case-type-badge.ban { background: rgba(248, 113, 113, 0.22); color: #ffb0b0; }
.case-type-badge.unban { background: rgba(52, 211, 153, 0.15); color: var(--green); }

.member-search-result {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; cursor: pointer; border-radius: var(--radius-sm);
}
.member-search-result:hover { background: var(--bg-elevated); }
.member-search-result img { width: 24px; height: 24px; border-radius: 50%; }
.member-search-box { position: relative; }
.member-search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 4px; max-height: 220px; overflow-y: auto; z-index: 20;
  box-shadow: var(--shadow-pop);
}
.selected-member-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px 4px 6px; font-size: 13px;
}
.selected-member-chip img { width: 20px; height: 20px; border-radius: 50%; }

/* ---------------------------------------------------------------------- */
/* Eigenes Dropdown-Design                                                */
/* ---------------------------------------------------------------------- */
.cs { position: relative; width: 100%; }
.cs select.cs-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }

.cs-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; text-align: left;
  font-family: inherit; transition: border-color 0.12s, box-shadow 0.12s;
}
.cs-trigger:hover { border-color: var(--accent); }
.cs-trigger:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs.open .cs-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-trigger:disabled, .cs.disabled .cs-trigger { opacity: 0.5; cursor: not-allowed; }

.cs-trigger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.cs-multi .cs-trigger-label { flex-wrap: wrap; white-space: normal; }
.cs-trigger-label.placeholder { color: var(--text-muted); }
.cs-chevron { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; transition: transform 0.15s; }
.cs.open .cs-chevron { transform: rotate(180deg); }

.cs-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; border: 1px solid rgba(255,255,255,0.15); }

.cs-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 45;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 8px; display: none; flex-direction: column;
  max-height: 300px;
}
.cs.open .cs-panel { display: flex; }

.cs-search {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 6px; flex-shrink: 0;
}
.cs-search:focus { outline: none; border-color: var(--accent); }

.cs-options { overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.cs-option {
  display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: var(--radius-sm); font-size: 13.5px;
  cursor: pointer; color: var(--text);
}
.cs-option:hover { background: var(--bg-elevated); }
.cs-option.selected { color: #cfc9ff; font-weight: 600; }
.cs-option.disabled { opacity: 0.4; cursor: not-allowed; }
.cs-option-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-option-tick { width: 15px; height: 15px; flex-shrink: 0; visibility: hidden; }
.cs-option.selected .cs-option-tick { visibility: visible; }
.cs-check {
  width: 16px; height: 16px; border: 1px solid var(--border); border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: var(--bg-elevated);
}
.cs-check i { width: 12px; height: 12px; visibility: hidden; }
.cs-option.selected .cs-check { background: var(--accent-gradient); border-color: transparent; }
.cs-option.selected .cs-check i { visibility: visible; color: white; }
.cs-empty { padding: 10px; color: var(--text-muted); font-size: 13px; text-align: center; }

.cs-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 3px 6px 3px 10px; font-size: 12px; max-width: 100%; }
.cs-chip button { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; padding: 0; }
.cs-chip button i { width: 12px; height: 12px; }
.cs-chip button:hover { color: var(--red); }

/* ---------------------------------------------------------------------- */
/* "Server verwalten"                                                     */
/* ---------------------------------------------------------------------- */
.server-manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .server-manage-grid { grid-template-columns: 1fr; } }

.color-swatch-row { display: flex; align-items: center; gap: 10px; }
.color-swatch-row input[type=color] {
  width: 40px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); cursor: pointer;
}
.color-swatch-row input[type=text] { flex: 1; }

.entity-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; margin-top: 14px; }
.entity-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--bg-elevated);
}
.entity-row .entity-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-row button { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; padding: 4px; border-radius: var(--radius-sm); }
.entity-row button:hover { color: var(--red); background: rgba(248, 113, 113, 0.12); }
.entity-row .cs-dot { width: 10px; height: 10px; }

/* Modale Dialoge */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 11, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.15s ease;
  box-shadow: var(--shadow-pop);
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #cfc9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.modal-icon.danger { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.modal-box h3 { margin: 0 0 8px; font-size: 17px; }
.modal-box p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* Laufbahn: Baumstruktur */
.rank-tree { display: flex; flex-direction: column; gap: 0; margin-bottom: 16px; }
.rank-node {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-left: 4px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.rank-node.dragging { opacity: 0.4; }
.rank-node-connector {
  position: absolute;
  left: 17px;
  top: 34px;
  bottom: -10px;
  width: 2px;
  background: var(--border);
}
.rank-node-badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  z-index: 1;
}
.rank-node-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  cursor: grab;
}
.rank-node-card:active { cursor: grabbing; }
.rank-node-grip { color: var(--text-muted); flex-shrink: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}

/* Tooltips */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1100;
  box-shadow: var(--shadow-pop);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------------- */
/* NEU: Übersichts-/Dashboard-Startseite (siehe home.js)                  */
/* ---------------------------------------------------------------------- */

.overview-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.14), rgba(192, 132, 252, 0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.overview-hero h1 { margin: 0 0 6px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.overview-hero p { margin: 0; color: var(--text-muted); font-size: 14px; max-width: 520px; line-height: 1.5; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.stat-card .stat-icon {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #cfc9ff; margin-bottom: 12px;
}
.stat-card .stat-icon i { width: 17px; height: 17px; }
.stat-card .value { font-size: 24px; font-weight: 800; }
.stat-card .label { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 16px; }
.section-title p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; font-weight: 400; }

.quicklink-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.quicklink-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quicklink-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 12px 26px rgba(124, 108, 255, 0.14); }
.quicklink-card .quicklink-icon {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #cfc9ff;
}
.quicklink-card .quicklink-icon i { width: 17px; height: 17px; }
.quicklink-card strong { font-size: 14px; }
.quicklink-card p { margin: 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
.quicklink-card .quicklink-status { margin-top: auto; }

.help-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(124, 108, 255, 0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #d8d4ff;
  line-height: 1.55;
}
.help-banner i { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: #cfc9ff; }
.help-banner strong { color: #fff; }

/* ---- Utility-Klassen ----
 * Ersatz fuer die verstreuten style="..."-Attribute im Dashboard (noetig fuer eine CSP ohne
 * style-src: 'unsafe-inline'). Deckt die haeufigsten wiederkehrenden Muster ab: Textfarbe/-groesse,
 * Abstaende, Flex-Layouts. Seiten mit echten Laufzeitwerten (z.B. eine Rollenfarbe aus der DB)
 * nutzen weiterhin eine CSS-Custom-Property statt eines vollen style=""-Attributs, siehe unten.
 */
.text-muted { color: var(--text-muted); }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-24-bold { font-size: 24px; font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-28 { margin-top: 28px; }
.mt-neg4 { margin-top: -4px; }
.mt-neg6 { margin-top: -6px; }
.mt-neg8 { margin-top: -8px; }

.subtext { color: var(--text-muted); margin: 2px 0 0; }
.subtext-sm { color: var(--text-muted); font-size: 12px; margin: 4px 0 0; }
.hint-sm { color: var(--text-muted); font-size: 12px; }
.hint-sm-tight { color: var(--text-muted); font-size: 12px; margin-top: -6px; }
.hint-xs { color: var(--text-muted); font-size: 11px; }

.flex { display: flex; gap: 8px; }
.flex-wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.flex-end { display: flex; gap: 8px; align-items: flex-end; }
.flex-end-wrap { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.flex-center { display: flex; gap: 8px; align-items: center; }
.flex-between-start { display: flex; justify-content: space-between; align-items: flex-start; }
.flex-between-center { display: flex; justify-content: space-between; align-items: center; }
.flex-1 { flex: 1; }

.icon-btn-plain { background: none; border: none; color: var(--text-muted); cursor: pointer; }
.empty-state { height: auto; padding: 40px 0; }

/* Fuer Faerbungen, die zur Laufzeit aus Daten kommen (Rollen-/Embed-/Streamplan-Farbe): das
 * Element traegt eine CSS-Custom-Property (per JS via element.style.setProperty gesetzt - das
 * ist KEIN style=""-Attribut im Markup und faellt daher nicht unter CSP style-src), die Klasse
 * hier verweist nur darauf. */
.dynamic-bg { background: var(--dynamic-color); }
.dynamic-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--dynamic-color); margin-right: 6px;
}
.dynamic-border-left { border-left-color: var(--dynamic-color); }

.w-80 { width: 80px; }
.w-100 { width: 100px; }
.w-120 { width: 120px; }
.w-160 { width: 160px; }
.min-w-110 { min-width: 110px; }
.min-w-120 { min-width: 120px; }
.max-w-180 { max-width: 180px; font-size: 12px; padding: 4px 8px; }
.flush { margin: 0; }
.no-border-cell { padding: 0; border: none; }

.d-flex { display: flex; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.cursor-pointer { cursor: pointer; }
.p-tag-row { padding: 4px 0; }
.m-tight { margin: 2px 0; }
.checkbox-inline { display: flex; align-items: center; gap: 6px; margin: 0; }
.checkbox-auto { width: auto; }
.col-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }

/* ---- Cookie-Consent-Banner & rechtlicher Fusszeilen-Balken ---- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cookie-banner-text p { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; line-height: 1.5; }
.cookie-banner-text a { color: var(--accent-2); }
.cookie-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.cookie-cat-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.cookie-cat-row:last-of-type { border-bottom: none; }

.legal-footer {
  position: fixed;
  bottom: 8px;
  right: 12px;
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 5px 12px;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.legal-footer:hover { opacity: 1; }
.legal-footer a, .legal-footer button {
  color: var(--text-faint);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.legal-footer a:hover, .legal-footer button:hover { color: var(--text); text-decoration: underline; }
