/* --------------------------------------------------------------------------
   8. App-Grundgerüst: Slate-Sidebar + Inhaltsbereich
   -------------------------------------------------------------------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 6px 0 18px rgba(0, 0, 0, 0.35), -1px 0 0 rgba(130, 170, 190, 0.08) inset;
  z-index: 20;
  background: linear-gradient(180deg, var(--wood-950) 0%, var(--wood-900) 100%);
}

/* Sidebar-Kopf: Marke oben, direkt darunter die eigene Identität (Avatar +
   Name + Rang-Stufen-Balken) wie ein Dienstausweis - ersetzt das frühere
   separate Konto-Menü unten in der Sidebar komplett. */
.sidebar__brand {
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(130, 170, 190, 0.16);
  position: relative;
}

.sidebar__brand-row {
  display: flex;
  align-items: center;
  gap: 13px;
}

/* Weißer Kreis mit rotem Puls-Icon - bewusste Anlehnung an das klassische
   Rotkreuz-Symbol (rot auf weiß statt umgekehrt), damit "mehr Weiß" nicht
   nur Text-/Randfarbe bleibt, sondern an einer prominenten Stelle wirklich
   sichtbar wird. */
.sidebar__brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #f4f7f8;
  border: 2px solid var(--brass-bright);
  color: var(--brass-bright);
}

.sidebar__brand-icon svg {
  width: 22px;
  height: 22px;
}

.sidebar__brand-name {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--wood-text);
}

.sidebar__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(130, 170, 190, 0.14);
}

/* Rang-Stufen-Balken: ein Segment pro Rang in BENUTZER_RAENGE, gefüllt bis
   zur eigenen Stufe (siehe aktualisiereSidebarRang in js/main.js) - zeigt
   die Position in der MD-Hierarchie auf einen Blick, ohne Pille/Rahmen um
   den Rangnamen selbst. */
.sidebar__rang-stufen {
  display: flex;
  gap: 3px;
  margin-top: 7px;
}

.sidebar__rang-stufe {
  flex: 1 1 0;
  max-width: 14px;
  height: 3px;
  border-radius: 2px;
  background: rgba(130, 170, 190, 0.16);
}

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  overflow-y: auto;
}

/* Untere Gruppe (Einstellungen, Verwaltung): margin-top:auto schiebt sie im
   flex-Container ganz nach unten, direkt über den "Abmelden"-Bereich. */
.sidebar__nav-unten {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: 12px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #8ba0ad;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  text-align: left;
  position: relative;
  /* Aktiv-Indikator lebt als Rahmen INNERHALB des Buttons (immer reserviert,
     nur die Farbe wechselt) statt als abgesetztes Pseudo-Element außerhalb
     der Sidebar-Kante - vorher landete der Strich exakt auf dem äußersten
     Bildschirmpixel und wirkte dort wie ein losgelöster Fremdkörper statt
     Teil des Buttons. */
  border-left: 3px solid transparent;
}

.sidebar__item svg {
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.sidebar__item:hover {
  color: var(--wood-text);
  background: rgba(130, 170, 190, 0.08);
}

.sidebar__item:hover svg {
  opacity: 1;
}

.sidebar__item--active {
  color: #ffffff;
  background: rgba(217, 68, 82, 0.1);
  border-left-color: var(--brass-bright);
}

.sidebar__item--active svg {
  opacity: 1;
}

.sidebar__badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--status-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.sidebar__divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(130, 170, 190, 0.2) 50%, transparent);
  margin: 10px 6px;
}

/* Nur noch "Abmelden" - die Identität (Avatar/Name/Rang) lebt jetzt oben in
   .sidebar__brand, kein separates Konto-Menü mehr nötig. */
.sidebar__footer {
  border-top: 1px solid rgba(130, 170, 190, 0.16);
  padding: 14px;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--wood-text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar__logout svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__logout:hover {
  background: var(--status-danger-soft);
  color: var(--status-danger-bright);
}

/* Hintergrund kommt jetzt aus der individuellen Rang-Farbe (--rang-farbe,
   wird in aktualisiereSidebarRang in js/main.js gesetzt) statt einer für
   alle gleichen Marken-Farbe - der Avatar zeigt den Rang auf den ersten
   Blick mit, nicht nur das Badge daneben. */
.sidebar__user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--rang-farbe, var(--brass-bright));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--wood-line);
  transition: background 0.15s ease;
}

.sidebar__user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: left;
  min-width: 0;
  flex: 1;
}

.sidebar__user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--wood-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Schlichter farbiger Text statt einer umrandeten Pille - eine Badge mit
   Rahmen/Füllung unter dem Namen wirkte in der schmalen Profilkarte klobig;
   die Farbe allein reicht, um den Rang erkennbar zu machen (analog zu
   Account-Menüs wie bei Linear/Notion). */
.sidebar__user-role {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Leuchtender Akzentring um den Avatar - nur für die beiden Spitzenränge
   (RANG_AKZENTRING in js/core/config.js), zusätzlich zur Farbbadge, die
   jeder Rang bekommt. Weicher Glow statt nur eines harten Rings, damit die
   Auszeichnung wirklich als "besonders" auffällt. */
.sidebar__user-avatar--akzent {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.12), 0 0 12px 1px var(--rang-farbe);
}

/* --------------------------------------------------------------------------
   9. Hauptbereich
   -------------------------------------------------------------------------- */
.main-area {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 16px 40px 0;
}

.online-widget {
  position: relative;
}

.online-widget__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wood-text-muted);
  padding: 9px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--leather-edge);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.online-widget__btn:hover {
  color: var(--wood-text);
  border-color: rgba(130, 170, 190, 0.45);
}

.online-widget__btn #online-count {
  color: var(--brass-bright);
  font-size: 12px;
}

/* Kleine glasige "Ampel"-Kugel statt reiner Flächenfarbe, mit dezentem
   Pulsieren - signalisiert "live" ohne aufdringlich zu wirken. */
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9fe6b8, var(--status-done) 70%);
  animation: online-dot-puls 2.4s ease-in-out infinite alternate;
  flex-shrink: 0;
}

@keyframes online-dot-puls {
  from {
    box-shadow: 0 0 3px rgba(67, 181, 122, 0.55), 0 0 0 2px rgba(67, 181, 122, 0.2);
  }
  to {
    box-shadow: 0 0 7px rgba(67, 181, 122, 0.9), 0 0 0 4px rgba(67, 181, 122, 0.3);
  }
}

.online-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--leather-800);
  border: 1px solid var(--leather-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: 14px;
  z-index: 50;
}

.online-panel--visible {
  display: block;
}

.online-panel__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wood-text-soft);
  margin-bottom: 8px;
}

.online-panel__person {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--wood-text);
  padding: 4px 0;
}

.online-panel__empty {
  font-size: 12px;
  color: var(--wood-text-soft);
  font-style: italic;
}

.content-shell {
  flex: 1;
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 40px 60px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0 30px;
  position: relative;
}

.page-header__text h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

/* Kleiner Teal-Akzentstrich unter jedem Seitentitel - da .page-header__text
   nur einmal im Markup existiert und Titel/Untertitel pro View per JS
   ausgetauscht werden (siehe VIEW_META in config.js), wirkt diese eine Regel
   automatisch auf jede einzelne Seite. */
.page-header__text h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brass-bright) 0%, transparent 100%);
}

.page-header__text p {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--wood-text-muted);
  max-width: 560px;
  line-height: 1.6;
}

.view {
  display: none;
}

.view--active {
  display: block;
  animation: view-einblenden 0.28s ease;
}

@keyframes view-einblenden {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view--active {
    animation: none;
  }
}

/* Tabs (Verwaltung: Benutzer/Aktivitäts-Log) */
.tabs {
  display: flex;
  gap: 28px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--leather-edge-soft);
}

/* Reiter als Textzeile mit Unterstreichung statt Pillen. */
.tabs__tab {
  padding: 10px 0;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 600;
  color: var(--wood-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tabs__tab:hover {
  color: var(--wood-text);
}

.tabs__tab--active {
  color: var(--wood-text);
  border-bottom-color: var(--brass-bright);
}
