/* Seitenleiste, Kopf, untere Leiste, Raster */

.baender { position: sticky; top: 0; z-index: calc(var(--z-nav) + 5); }
.band {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--gutter); font-weight: var(--fw-semi); font-size: var(--fs-sm);
  border-bottom: 1px solid var(--line);
}
.band svg { flex: none; width: 22px; height: 22px; }
.band--offline { background: var(--orange-tint); color: #5c3600; }
.band--update  { background: var(--blue-50); color: var(--blue-hover); }
.band .knopf { min-height: 40px; }

.shell { min-height: 100vh; min-height: 100dvh; }

/* ---------- Seitenleiste (ab 768 px) ---------- */
.seitenleiste {
  display: none;
  position: fixed; inset: 0 auto 0 0; z-index: var(--z-nav);
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line);
  flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
}
.seitenleiste__logo {
  display: flex; align-items: center; height: var(--topbar-h); padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line); flex: none;
}
.seitenleiste__logo img { height: 34px; width: auto; }
.seitenleiste__logo .logo-mini { display: none; }
.seitenleiste nav { padding: var(--sp-3) 0; flex: 1; }
.nav-liste { list-style: none; margin: 0; padding: 0; }
.nav-trenner {
  margin: var(--sp-4) var(--sp-5) var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line);
}
.nav-punkt {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: 48px; padding: var(--sp-2) var(--sp-5); margin: 2px 0;
  color: var(--text); text-decoration: none; font-weight: var(--fw-semi); font-size: 16px;
  background: none; border: 0; width: 100%; text-align: left;
}
.nav-punkt svg { width: var(--icon); height: var(--icon); flex: none; color: var(--text-muted); }
.nav-punkt:hover { background: var(--bg-2); color: var(--text); }
.nav-punkt[aria-current="page"] { background: var(--blue-50); color: var(--blue); font-weight: var(--fw-bold); }
.nav-punkt[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px; background: var(--blue); border-radius: 0 2px 2px 0;
}
.nav-punkt[aria-current="page"] svg { color: var(--blue); }
.nav-punkt__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-punkt .zaehler { margin-left: auto; }

.seitenleiste__fuss { border-top: 1px solid var(--line); padding: var(--sp-3) 0 var(--sp-4); flex: none; }
.profil-kurz { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-5); text-decoration: none; color: var(--text); min-height: 56px; }
.profil-kurz:hover { background: var(--bg-2); color: var(--text); }
.profil-kurz__name { font-weight: var(--fw-bold); font-size: 16px; line-height: 1.2; }
.profil-kurz__rolle { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.3; }
.einklappen { color: var(--text-2); }

.initialen {
  flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: var(--fw-bold); font-size: 15px; letter-spacing: .02em;
}
.initialen--gross { width: 72px; height: 72px; font-size: 26px; }

/* ---------- Hauptbereich ---------- */
.haupt { min-width: 0; padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom) + var(--sp-6)); }

.kopfleiste {
  position: sticky; top: 0; z-index: calc(var(--z-nav) - 1);
  display: flex; align-items: center; gap: var(--sp-3);
  height: 56px; padding: 0 var(--sp-2); background: var(--surface); border-bottom: 1px solid var(--line);
}
.kopfleiste__links, .kopfleiste__rechts { display: flex; align-items: center; gap: var(--sp-1); flex: 1 1 0; min-width: 0; }
.kopfleiste__rechts { justify-content: flex-end; }
.kopfleiste__mitte { flex: 0 1 auto; min-width: 0; text-align: center; }
.kopfleiste__titel { font-weight: var(--fw-bold); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopfleiste__logo img { height: 28px; width: auto; }
.kopfleiste .suchfeld-knopf { display: none; }
.kopfleiste .glocke { display: none; }

.inhalt {
  max-width: var(--content-max); margin: 0 auto; padding: var(--sp-5) var(--gutter) var(--sp-10);
}
.inhalt:focus { outline: none; }
.inhalt--voll { max-width: none; padding: 0; }

/* ---------- Untere Leiste (Handy) ---------- */
.untere-leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.untere-leiste ul { display: grid; grid-template-columns: repeat(5, 1fr); list-style: none; margin: 0; padding: 0; }
.untere-leiste a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--bottombar-h); color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: var(--fw-semi);
}
.untere-leiste a svg { width: var(--icon-nav); height: var(--icon-nav); }
.untere-leiste a[aria-current="page"] { color: var(--blue); font-weight: var(--fw-bold); }
.untere-leiste a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 18%; right: 18%; height: 3px; background: var(--blue); }
.untere-leiste .zaehler { position: absolute; top: 6px; left: calc(50% + 6px); }

/* ohne Navigation (Login, Passwort-neu) */
.shell--nackt .seitenleiste, .shell--nackt .untere-leiste, .shell--nackt .kopfleiste { display: none !important; }
.shell--nackt .haupt { margin-left: 0 !important; padding-bottom: 0; }
.shell--nackt .inhalt { max-width: none; padding: 0; }

/* ---------- Tablet 768–1023 ---------- */
@media (min-width: 768px) {
  .untere-leiste { display: none; }
  .seitenleiste { display: flex; width: var(--sidebar-w-mini); }
  .haupt { margin-left: var(--sidebar-w-mini); padding-bottom: var(--sp-8); }
  .seitenleiste__logo { padding: 0; justify-content: center; }
  .seitenleiste__logo .logo-voll { display: none; }
  .seitenleiste__logo .logo-mini { display: block; height: 36px; }
  .nav-punkt { flex-direction: column; gap: 2px; padding: var(--sp-2) 4px; font-size: 12px; text-align: center; min-height: 60px; justify-content: center; }
  .nav-punkt__text { white-space: normal; line-height: 1.15; flex: none; max-width: 100%; }
  .nav-punkt .zaehler { position: absolute; top: 4px; right: 10px; margin: 0; }
  .nav-trenner { margin: var(--sp-2) var(--sp-2); font-size: 0; padding-top: 0; height: 1px; }
  .nav-trenner * { display: none; }
  .profil-kurz { justify-content: center; padding: var(--sp-2) 0; }
  .profil-kurz__text { display: none; }
  .einklappen { display: none !important; }
  .nav-favoriten { display: none; }

  .kopfleiste { height: var(--topbar-h); padding: 0 var(--gutter); }
  .kopfleiste__links { flex: 1 1 0; }
  .kopfleiste__mitte { flex: 2 1 0; max-width: 560px; }
  .kopfleiste__logo { display: none; }
  .kopfleiste .suchfeld-knopf { display: flex; }
  .kopfleiste .glocke { display: inline-flex; }
  .kopfleiste .zurueck-knopf .zurueck-text { display: inline; }
}

/* ---------- Desktop ab 1024 ---------- */
@media (min-width: 1024px) {
  .seitenleiste { width: var(--sidebar-w); }
  .haupt { margin-left: var(--sidebar-w); }
  .seitenleiste__logo { padding: 0 var(--sp-5); justify-content: flex-start; }
  .seitenleiste__logo .logo-voll { display: block; }
  .seitenleiste__logo .logo-mini { display: none; }
  .nav-punkt { flex-direction: row; gap: var(--sp-3); padding: var(--sp-2) var(--sp-5); font-size: 16px; text-align: left; min-height: 48px; justify-content: flex-start; }
  .nav-punkt__text { white-space: nowrap; flex: 1; }
  .nav-punkt .zaehler { position: static; margin-left: auto; }
  .nav-trenner { margin: var(--sp-4) var(--sp-5) var(--sp-2); font-size: var(--fs-xs); padding-top: var(--sp-3); height: auto; }
  .nav-trenner * { display: inline; }
  .profil-kurz { justify-content: flex-start; padding: var(--sp-2) var(--sp-5); }
  .profil-kurz__text { display: block; }
  .einklappen { display: flex !important; }
  .nav-favoriten { display: block; }

  /* eingeklappt */
  .shell--mini .seitenleiste { width: var(--sidebar-w-mini); }
  .shell--mini .haupt { margin-left: var(--sidebar-w-mini); }
  .shell--mini .seitenleiste__logo { padding: 0; justify-content: center; }
  .shell--mini .seitenleiste__logo .logo-voll { display: none; }
  .shell--mini .seitenleiste__logo .logo-mini { display: block; height: 36px; }
  .shell--mini .nav-punkt { justify-content: center; padding: var(--sp-2) 0; }
  .shell--mini .nav-punkt__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .shell--mini .nav-punkt .zaehler { position: absolute; top: 4px; right: 12px; }
  .shell--mini .nav-trenner { margin: var(--sp-2) var(--sp-3); font-size: 0; padding-top: 0; height: 1px; }
  .shell--mini .nav-trenner * { display: none; }
  .shell--mini .profil-kurz { justify-content: center; padding: var(--sp-2) 0; }
  .shell--mini .profil-kurz__text { display: none; }
  .shell--mini .nav-favoriten { display: none; }
}

/* ---------- Kachelraster ---------- */
.raster { display: grid; grid-template-columns: 1fr; gap: var(--gap-tiles); }
.raster > .kachel--s.kachel--kpi-paar { grid-column: auto; }
@media (min-width: 768px) {
  .raster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .raster > .kachel--l { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .raster { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .raster > .kachel--s { grid-column: span 4; }
  .raster > .kachel--m { grid-column: span 6; }
  .raster > .kachel--l { grid-column: 1 / -1; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .raster > .kachel--s, .raster > .kachel--m { grid-column: span 6; }
}

.seite-kopf { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-6); }
.seite-kopf__text { flex: 1 1 320px; min-width: 0; }
.seite-kopf__text > p { margin-top: var(--sp-2); color: var(--text-2); max-width: 70ch; }
.seite-kopf__aktionen { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.abschnitt { margin-top: var(--sp-8); }
.abschnitt > h2 { margin-bottom: var(--sp-4); }
.abschnitt-kopf { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.stapel > * + * { margin-top: var(--sp-4); }
.reihe { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.schmal { max-width: 720px; }

/* Kopfleiste: Titel-Varianten */
.kopf-titel--breit { display: none; }
.kopfleiste__mitte .kopfleiste__logo { display: inline-flex; }
.kopfleiste__mitte .kopfleiste__logo[hidden] { display: none; }
.kopfleiste .zurueck-knopf { padding: 0 var(--sp-2) 0 0; gap: 2px; }
.kopfleiste .zurueck-knopf svg { width: 24px; height: 24px; }
@media (min-width: 768px) {
  .kopf-titel--breit { display: block; }
  .kopf-titel--mobil { display: none; }
  .kopfleiste__mitte .kopfleiste__logo { display: none !important; }
  .kopfleiste .zurueck-knopf { display: none !important; }
}
@media (max-width: 767px) {
  .zurueck-link { display: none; }
}
.zeile__titel, .zeile__unter { display: block; }
/* Sehr schmale Handys (320 px): „Zurück“ nur als Pfeil, Text bleibt für Screenreader */
@media (max-width: 399px) {
  .kopfleiste .zurueck-knopf .zurueck-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; }
}
