:root {
  --portal-primary: #1a4480;
  --portal-primary-600: #163866;
  --portal-primary-400: #3a6cb8;
  --portal-primary-50: #eef2f9;
  --portal-accent: #d4a017;
  --portal-accent-soft: #fbe9b8;
  --portal-violet: #6b4ee6;
  --portal-cyan: #2bbfd0;

  --portal-bg: #f4f6fb;
  --portal-surface: #ffffff;
  --portal-surface-glass: rgba(255, 255, 255, .65);
  --portal-text: #0f172a;
  --portal-muted: #64748b;
  --portal-border: #e6eaf2;
  --portal-border-strong: #d6dbe6;

  --portal-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .05);
  --portal-shadow-md: 0 8px 24px rgba(15, 23, 42, .08), 0 24px 56px rgba(15, 23, 42, .08);
  --portal-shadow-glow: 0 10px 40px -10px rgba(26, 68, 128, .35);

  --portal-radius: 1.25rem;
  --portal-radius-lg: 1.75rem;

  /* ── Status-Farben (statt hartcodierter Hex im Markup) ── */
  --c-success: #198754;
  --c-danger: #dc3545;
  --c-warn: #b8860b;
  --c-danger-bg: #fdecee;
  --c-warn-bg: #fdf6e3;
  --c-success-bg: #e6f4ec;

  /* ── Kompakte Typo-Skala: 4 Stufen, Boden 11px ── */
  --fs-xs: .6875rem;  /* 11px – Meta/Hinweise */
  --fs-sm: .75rem;    /* 12px – sekundär */
  --fs-md: .8125rem;  /* 13px – Titel/Fließtext */
  --fs-num: 1.25rem;  /* 20px – Kennzahlen */

  /* Touch: unsichtbar große Trefferfläche auf dichten Zeilen */
  --tap: 44px;
}

/* ---- Base ---- */
html, body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--portal-text);
  background: var(--portal-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.portal-body {
  position: relative;
  overflow-x: hidden; /* Fallback für sehr alte Browser */
  overflow-x: clip;   /* clip schneidet horizontal ab, erzeugt aber KEINEN vertikalen
                         Scroll-Kontext -> Dropdowns/Popovers werden nicht abgeschnitten */
}

h1, h2, h3, h4, h5, .navbar-brand, .display-portal {
  font-family: 'Inter Tight', 'Inter', system-ui, sans-serif;
  letter-spacing: -.02em;
  font-weight: 700;
}
h1, .display-portal {
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
}

a { color: var(--portal-primary); text-underline-offset: 3px; }
a:hover { color: var(--portal-primary-600); }

.text-muted { color: var(--portal-muted) !important; }

/* ---- Animierter Mesh-Hintergrund ---- */
.portal-bg-mesh {
  position: fixed;
  inset: -10vmax;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  filter: blur(80px) saturate(115%);
  opacity: .55;
}
.portal-bg-mesh .blob {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: blob-drift 26s ease-in-out infinite;
}
.portal-bg-mesh .blob-1 {
  top: -10%; left: -15%;
  background: radial-gradient(circle at 30% 30%, #6b4ee6 0%, transparent 60%);
}
.portal-bg-mesh .blob-2 {
  top: 30%; right: -20%;
  background: radial-gradient(circle at 70% 50%, #2bbfd0 0%, transparent 60%);
  animation-delay: -8s;
}
.portal-bg-mesh .blob-3 {
  bottom: -25%; left: 20%;
  background: radial-gradient(circle at 50% 50%, #1a4480 0%, transparent 60%);
  animation-delay: -16s;
}
@keyframes blob-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(8vmax, -4vmax) scale(1.08); }
  66%      { transform: translate(-6vmax, 6vmax) scale(.95); }
}
@media (prefers-reduced-motion: reduce) {
  .portal-bg-mesh .blob { animation: none; }
}

/* ---- Navbar ---- */
.portal-navbar {
  background: rgba(255, 255, 255, .55);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
  padding-top: .7rem;
  padding-bottom: .7rem;
}
.portal-navbar .navbar-brand {
  color: var(--portal-text);
  font-weight: 800;
  font-size: 1.1rem;
}
.portal-navbar .nav-link {
  color: var(--portal-text);
  font-weight: 500;
  border-radius: .6rem;
  padding-left: .85rem; padding-right: .85rem;
}
.portal-navbar .nav-link:hover {
  color: var(--portal-primary);
  background: rgba(26, 68, 128, .06);
}
.portal-navbar .dropdown-menu {
  border: 1px solid var(--portal-border);
  border-radius: 1rem;
  box-shadow: var(--portal-shadow-md);
  padding: .5rem;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.portal-navbar .dropdown-item {
  border-radius: .6rem;
  padding: .5rem .7rem;
  font-weight: 500;
}
.portal-navbar .dropdown-item:hover { background: var(--portal-primary-50); }

.navbar-wappen {
  height: 34px;
  width: auto;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .18));
}
.landing-wappen {
  height: 110px;
  width: auto;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .35));
}

/* ---- Hero (groß, mit Glow + Glas-Akzenten) ---- */
.portal-hero {
  position: relative;
  border-radius: var(--portal-radius-lg);
  padding: clamp(3rem, 7vw, 6rem) 1.5rem clamp(3.5rem, 8vw, 6.5rem);
  margin-top: 1.5rem;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(80% 60% at 80% 0%, rgba(212, 160, 23, .35), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(107, 78, 230, .55), transparent 60%),
    linear-gradient(135deg, #0f2347 0%, #1a4480 45%, #2d6cb8 100%);
  overflow: hidden;
  box-shadow:
    0 30px 80px -20px rgba(15, 23, 42, .35),
    inset 0 1px 0 rgba(255, 255, 255, .15);
}
.portal-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at center, #000 35%, transparent 80%);
  pointer-events: none;
}
.portal-hero::after {
  content: "";
  position: absolute;
  width: 60%; height: 70%;
  top: -20%; left: 20%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .18), transparent);
  pointer-events: none;
}
.portal-hero > * { position: relative; z-index: 1; }
.portal-hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  margin-bottom: 1.25rem;
}
.portal-hero .eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #57e389;
  box-shadow: 0 0 0 4px rgba(87, 227, 137, .25);
}
.portal-hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  margin-bottom: 1rem;
  background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, .75) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.portal-hero .lead {
  color: rgba(255, 255, 255, .8);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.55;
}

/* ---- Glas-Cards ---- */
.card,
.module-card {
  position: relative;
  border-radius: var(--portal-radius);
  overflow: hidden;
  background: var(--portal-surface-glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .8) inset,
    var(--portal-shadow-sm);
}

/* Jede .card ist wegen backdrop-filter ein eigener Stacking-Kontext. Ein offenes
   Dropdown-Menü bleibt dadurch in seiner Karte "gefangen" und verschwindet hinter
   der nächsten Karte. Die Karte mit offenem Menü heben wir deshalb nach vorne —
   und schalten overflow wieder auf visible damit das Menü sichtbar bleibt. */
.card:has(.dropdown-menu.show) {
  z-index: 5;
  overflow: visible;
}

.module-card {
  cursor: pointer;
  overflow: hidden;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1),
              box-shadow .35s ease,
              border-color .25s ease;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--portal-violet), var(--portal-primary), var(--portal-accent));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .4s ease;
}
.module-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 70%; height: 140%;
  background: radial-gradient(closest-side, rgba(107, 78, 230, .14), transparent);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.module-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--portal-shadow-md), var(--portal-shadow-glow);
  border-color: rgba(255, 255, 255, 1);
}
.module-card:hover::before { transform: scaleX(1); }
.module-card:hover::after  { opacity: 1; }

.module-card .card-body { padding: 2rem 1.5rem; }

.module-icon-wrap {
  width: 72px; height: 72px;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 22px;
  font-size: 2rem;
  margin-bottom: 1.1rem;
  background: linear-gradient(135deg, rgba(26, 68, 128, .12), rgba(107, 78, 230, .12));
  color: var(--portal-primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    inset 0 0 0 1px rgba(26, 68, 128, .08),
    0 8px 20px -10px rgba(26, 68, 128, .4);
  transition: transform .35s ease;
}
.module-card:hover .module-icon-wrap { transform: scale(1.06) rotate(-3deg); }

.module-icon-wrap.accent {
  background: linear-gradient(135deg, rgba(212, 160, 23, .2), rgba(107, 78, 230, .12));
  color: #8a6a0c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    inset 0 0 0 1px rgba(212, 160, 23, .25),
    0 8px 20px -10px rgba(212, 160, 23, .45);
}

.module-icon {
  font-size: 2.5rem;
  width: 4rem; height: 4rem;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 1rem;
  margin-bottom: .75rem;
}

/* ---- Buttons ---- */
.btn {
  border-radius: .375rem;
  font-weight: 600;
  padding: .375rem .75rem;
  transition: transform .15s ease, box-shadow .25s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .2rem .45rem !important; font-size: .8rem !important; border-radius: .25rem !important; font-weight: 500 !important; }
.btn-check:checked + .btn small,
.btn-check:checked + .btn .text-muted { color: rgba(255,255,255,.8) !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-400) 100%);
  border: none;
  box-shadow: 0 8px 20px -8px rgba(26, 68, 128, .55);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, var(--portal-primary-600) 0%, var(--portal-primary) 100%);
  box-shadow: 0 12px 28px -8px rgba(26, 68, 128, .7);
}

.btn-light {
  background: #fff;
  border-color: #fff;
  color: var(--portal-primary);
  box-shadow: 0 8px 20px -8px rgba(15, 23, 42, .35);
}
.btn-light:hover { background: #f1f4fb; color: var(--portal-primary-600); }

.btn-outline-light {
  border-color: rgba(255, 255, 255, .55);
  color: #fff;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
}
.btn-outline-light:hover {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border-color: rgba(255, 255, 255, .8);
}

.btn-lg { padding: .85rem 1.7rem; font-size: 1.02rem; }

/* ---- Forms ---- */
.form-control, .form-select {
  border-radius: .375rem;
  border-color: var(--portal-border-strong);
  background: rgba(255, 255, 255, .8);
}
.form-control:focus, .form-select:focus {
  border-color: var(--portal-primary-400);
  box-shadow: 0 0 0 .25rem rgba(58, 108, 184, .2);
  background: #fff;
}
.form-label { font-weight: 500; color: var(--portal-text); }

/* ---- KPIs ---- */
.kpi-card .kpi-value {
  font-family: 'Inter Tight', sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
}
.kpi-card .kpi-label { color: var(--portal-muted); font-size: .9rem; }

.table-actions { white-space: nowrap; }

/* ---- Kompakter Modul-Look (z.B. Schlüsselverwaltung) ----------------- */
.mod-schluesselverwaltung { font-size: .9rem; }
.mod-schluesselverwaltung .table { font-size: .8rem; }
.mod-schluesselverwaltung .table > thead th {
  font-size: .68rem; letter-spacing: .04em; text-transform: uppercase;
  color: #8a93a6; font-weight: 700;
}
.mod-schluesselverwaltung .table > tbody td,
.mod-schluesselverwaltung .table > thead th { padding: .45rem .6rem; }
.mod-schluesselverwaltung .kpi-card .kpi-value { font-size: 1.9rem; }
.mod-schluesselverwaltung .kpi-card .kpi-label { font-size: .76rem; }
.mod-schluesselverwaltung .list-group-item { font-size: .85rem; }
.mod-schluesselverwaltung .card-header { font-size: .9rem; }
/* Kompakte Bedien-Elemente + flachere Zeilen */
.mod-schluesselverwaltung .table > tbody td { padding: 4px 10px; }
.mod-schluesselverwaltung .table .btn {
  font-size: .72rem; padding: .28rem .7rem; border-radius: .5rem;
}
.mod-schluesselverwaltung .table .form-control,
.mod-schluesselverwaltung .table .form-select {
  font-size: .8rem; padding: .25rem .5rem; border-radius: .5rem;
}

/* ---- Restmüllsäcke: Schriftgröße wie Raumverwaltung ------------------ */
.mod-restmuellsaecke .table { font-size: .78rem; }
.mod-restmuellsaecke .table > thead th {
  font-size: .66rem; letter-spacing: .04em; text-transform: uppercase;
  color: #8a93a6; font-weight: 700; padding: 7px 12px;
}
.mod-restmuellsaecke .table > tbody td { padding: 4px 12px; vertical-align: middle; }
.mod-restmuellsaecke .table .badge { font-size: .72rem; }
/* Kompakte Bedien-Elemente in der Abholung-Spalte → flachere Zeilen */
.mod-restmuellsaecke .table .btn {
  font-size: .72rem; padding: .28rem .7rem; border-radius: .5rem;
}
.mod-restmuellsaecke .table .form-control,
.mod-restmuellsaecke .table .form-select {
  font-size: .75rem; padding: .25rem .5rem; border-radius: .5rem;
}
.mod-restmuellsaecke .table .small,
.mod-restmuellsaecke .table .text-muted.small { font-size: .72rem; }
.mod-restmuellsaecke .kpi-card .kpi-value { font-size: 1.9rem; }
.mod-restmuellsaecke .kpi-card .kpi-label { font-size: .76rem; }
.mod-restmuellsaecke .card-header { font-size: .9rem; }

/* ---- Müllsäcke: kompakte Tabelle -------------------------------------- */
.mod-muellsaecke .table { font-size: .78rem; }
.mod-muellsaecke .table > thead th {
  font-size: .66rem; letter-spacing: .04em; text-transform: uppercase;
  color: #8a93a6; font-weight: 700; padding: 7px 12px;
}
.mod-muellsaecke .table > tbody td { padding: 4px 10px; vertical-align: middle; }
.mod-muellsaecke .table .btn {
  font-size: .72rem; padding: .2rem .6rem; border-radius: .5rem;
}
.mod-muellsaecke .table .form-control,
.mod-muellsaecke .table .form-select {
  font-size: .75rem; padding: .2rem .45rem; border-radius: .5rem;
}
.mod-muellsaecke .table .form-control { max-width: 64px; }
.mod-muellsaecke .table .small,
.mod-muellsaecke .table .text-muted.small { font-size: .72rem; }
.mod-muellsaecke .kpi-card .kpi-value { font-size: 1.9rem; }
.mod-muellsaecke .kpi-card .kpi-label { font-size: .76rem; }
.mod-muellsaecke .card-header { font-size: .9rem; }

/* ---- Klaustaler: kompaktes Register wie Restmüllsäcke ---------------- */
.mod-klaustaler { font-size: .9rem; }
.mod-klaustaler .table { font-size: .78rem; }
.mod-klaustaler .table > thead th {
  font-size: .66rem; letter-spacing: .04em; text-transform: uppercase;
  color: #8a93a6; font-weight: 700; padding: 7px 12px;
}
.mod-klaustaler .table > tbody td { padding: 4px 12px; vertical-align: middle; }
.mod-klaustaler .table .badge { font-size: .72rem; }
/* Kompakte Bedien-Elemente in der Rücknahme-Spalte → flachere Zeilen */
.mod-klaustaler .table .btn {
  font-size: .72rem; padding: .28rem .7rem; border-radius: .5rem;
}
.mod-klaustaler .table .form-control {
  font-size: .75rem; padding: .25rem .5rem; border-radius: .5rem;
}
.mod-klaustaler .table .small,
.mod-klaustaler .table .text-muted.small { font-size: .72rem; }
.mod-klaustaler .kpi-card .kpi-value { font-size: 1.9rem; }
.mod-klaustaler .kpi-card .kpi-label { font-size: .76rem; }
.mod-klaustaler .kpi-card .card-body { padding: .65rem .5rem; }
.mod-klaustaler .card-header { font-size: .9rem; }

/* ---- Alerts ---- */
.alert {
  border-radius: 1rem;
  border: 1px solid var(--portal-border);
  backdrop-filter: blur(8px);
}

/* ---- Calendar ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--portal-border);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--portal-shadow-sm);
}
.calendar-cell {
  background: #fff;
  min-height: 100px;
  padding: .4rem;
  font-size: .85rem;
}
.calendar-cell.empty { background: #f8f9fc; }
.calendar-cell.today { background: linear-gradient(180deg, #fff8de, #fff); }
.calendar-cell .day-num { font-weight: 700; }
.calendar-cell .booking {
  display: block;
  padding: 2px 6px;
  margin-top: 2px;
  border-radius: 6px;
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.booking.status-offen { background: #fff3cd; color: #856404; }
.booking.status-genehmigt { background: #d1e7dd; color: #0f5132; }
.booking.status-abgelehnt { background: #f8d7da; color: #842029; }

/* ---- Footer ---- */
footer.bg-light {
  background: transparent !important;
  border-top: 1px solid rgba(15, 23, 42, .06);
  color: var(--portal-muted);
}

/* ---- Animationen ---- */
@keyframes portal-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: portal-fade-up .7s cubic-bezier(.2, .8, .2, 1) both; }
.fade-up.delay-1 { animation-delay: .1s; }
.fade-up.delay-2 { animation-delay: .2s; }
.fade-up.delay-3 { animation-delay: .3s; }

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

@media print {
  .no-print, nav, footer, .portal-bg-mesh { display: none !important; }
  .portal-hero { background: #1a4480 !important; -webkit-print-color-adjust: exact; }
}

/* ---- Avatare ---- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  user-select: none;
  background: #eef2f9;
  color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar-md { width: 40px; height: 40px; font-size: .9rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.4rem; }

img.avatar {
  border: 2px solid #fff;
  box-shadow: 0 4px 14px -4px rgba(15, 23, 42, .25);
}

.avatar-initials {
  --avatar-hue: 220;
  background:
    linear-gradient(135deg,
      hsl(var(--avatar-hue), 70%, 55%) 0%,
      hsl(calc(var(--avatar-hue) + 40), 70%, 45%) 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .25),
    0 4px 14px -4px rgba(15, 23, 42, .25);
}

/* Avatar-Editor (im Formular) */
.avatar-edit {
  position: relative;
  width: 120px;
  height: 120px;
}
.avatar-edit .avatar { width: 100%; height: 100%; font-size: 2.4rem; }
.avatar-edit-btn {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--portal-primary);
  color: #fff;
  display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px -4px rgba(26, 68, 128, .55);
  transition: transform .15s ease, background .2s ease;
}
.avatar-edit-btn:hover {
  background: var(--portal-primary-600);
  transform: scale(1.05);
}

/* Avatar in Navbar-Dropdown */
.portal-navbar .nav-link .avatar { margin-right: .4rem; }


/* ---------------------------------------------------------------------- */
/* ---- Sidebar-Layout (eingeloggte Nutzer) ----------------------------- */
/* ---------------------------------------------------------------------- */

:root {
  --sidebar-width: 188px;
  --topbar-height: 56px;
}

/* Body mit Sidebar: kein flex-column nötig, Layout via Grid */
.portal-body.has-sidebar {
  display: block;
  min-height: 100vh;
  overflow-x: hidden; /* Fallback für sehr alte Browser */
  overflow-x: clip;   /* kein vertikaler Scroll-Kontext -> Dropdowns nicht abgeschnitten */
}

/* ---- Mobile Topbar ---- */
.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: .5rem;
  height: var(--topbar-height);
  padding: 0 1rem;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--portal-border);
}
.topbar-toggle, .topbar-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: .6rem;
  background: transparent;
  border: 1px solid var(--portal-border);
  color: var(--portal-text);
  font-size: 1.3rem;
  text-decoration: none;
}
.topbar-toggle:hover, .topbar-action:hover {
  background: var(--portal-primary-50);
  color: var(--portal-primary);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 auto;
  font-weight: 700;
  color: var(--portal-text);
  text-decoration: none;
}
.topbar-wappen { height: 24px; }

/* ---- Layout Shell ---- */
.portal-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}
@media (min-width: 992px) {
  .portal-shell { min-height: 100vh; }
}

/* ---- Sidebar (Desktop) ---- */
.portal-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}
.portal-sidebar .offcanvas-body,
.portal-sidebar.sidebar-inner,
.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem .6rem;
  background: rgba(255, 255, 255, .65);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-right: 1px solid rgba(255, 255, 255, .6);
}
@media (min-width: 992px) {
  .portal-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    /* Bootstrap-Offcanvas-Styles auf Desktop überschreiben */
  }
  .portal-sidebar.offcanvas-lg {
    position: sticky;
    transform: none !important;
    visibility: visible !important;
  }
}

/* ---- Brand im Sidebar ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: var(--portal-text);
  padding: .25rem .5rem .75rem .5rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid var(--portal-border);
}
.sidebar-wappen { height: 30px; width: auto; flex-shrink: 0; }
.sidebar-brand-text { line-height: 1.1; }
.sidebar-brand-name {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 800;
  font-size: .88rem;
  letter-spacing: -.02em;
}
.sidebar-brand-sub {
  font-size: .64rem;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ---- Nav-Links ---- */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  flex-grow: 1;
  min-height: 0;
  overflow: hidden;
}
.sidebar-section {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--portal-muted);
  padding: .5rem .6rem .2rem;
}
.sidebar-mod-edit-btn,
.sidebar-mod-done-btn {
  background: none;
  border: none;
  padding: .1rem .3rem;
  border-radius: .4rem;
  font-size: .7rem;
  color: var(--portal-muted);
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: .2rem;
  transition: color .15s, background .15s;
}
.sidebar-mod-edit-btn:hover,
.sidebar-mod-done-btn:hover {
  color: var(--portal-primary);
  background: rgba(26,68,128,.08);
}
.sidebar-mod-done-btn {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
/* Drag-Handle: standardmäßig unsichtbar, im Edit-Modus sichtbar */
.sidebar-drag-handle {
  display: none;
  color: var(--portal-muted);
  cursor: grab;
  flex-shrink: 0;
  font-size: .85rem;
}
.sidebar-modules-editing .sidebar-drag-handle {
  display: inline-flex;
}
.sidebar-modules-editing .sidebar-link {
  cursor: default;
}
.sidebar-modules-editing .sidebar-link:hover {
  background: none;
}
.sidebar-drag-ghost {
  opacity: .45;
  background: var(--portal-primary-soft, #e8eef7);
  border-radius: .6rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .28rem .5rem;
  border-radius: .6rem;
  color: var(--portal-text);
  text-decoration: none;
  font-weight: 500;
  font-size: .72rem;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-link:hover {
  background: rgba(26, 68, 128, .08);
  color: var(--portal-primary);
}
.sidebar-link.active {
  background: linear-gradient(135deg,
                rgba(26, 68, 128, .12),
                rgba(107, 78, 230, .08));
  color: var(--portal-primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--portal-primary);
}
.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  font-size: .88rem;
  flex-shrink: 0;
}
.sidebar-link.active .sidebar-icon { color: var(--portal-primary); }
/* Lange Labels (z.B. „Schlüsselverwaltung") dürfen umbrechen, statt über
   das Hover-Feld hinauszuragen. */
.sidebar-label { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }

/* ---- User-Bereich am Sidebar-Fuß ---- */
.sidebar-user {
  flex-shrink: 0;
  margin-top: .5rem;
  padding-top: .6rem;
  border-top: 1px solid var(--portal-border);
}
.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .55rem .65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .7rem;
  color: var(--portal-text);
  text-align: left;
}
.sidebar-user-btn:hover {
  background: rgba(26, 68, 128, .06);
  border-color: var(--portal-border);
}
.sidebar-user-btn::after { margin-left: auto; }
.sidebar-user-text { line-height: 1.15; min-width: 0; flex-grow: 1; }
.sidebar-user-name {
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .62rem;         /* klein genug, dass „Bürgermeister" einzeilig passt */
  color: var(--portal-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Dropdown im Benutzer-Menü auf Navi-Schriftgröße bringen (Bootstrap-Default
   ist 1rem und wirkt neben den .72rem-Navi-Links viel zu groß). */
.sidebar-user .dropdown-menu { --bs-dropdown-font-size: .72rem; }
.sidebar-user .dropdown-item {
  font-size: .72rem;
  padding: .4rem .7rem;
}
.sidebar-user .dropdown-item i { font-size: .85rem; }

/* ---- Hauptbereich ---- */
.portal-main {
  flex-grow: 1;
  min-width: 0; /* damit Inhalte korrekt umbrechen */
  padding: 1.25rem 1rem 3rem;
}
@media (min-width: 992px) {
  .portal-main { padding: 2rem 2rem 4rem; }
}
.portal-main-inner {
  max-width: 1400px;
  margin: 0 auto;
}

/* Bootstrap-Offcanvas Drawer-Look auf Mobile beibehalten */
@media (max-width: 991.98px) {
  .portal-sidebar {
    width: min(85vw, 320px);
  }
}

/* ═══════════════════════════════════════════════════════════════
   REDESIGN 2026-06 — Dashboard Hero, Tabs, Week-Schedule
   ═══════════════════════════════════════════════════════════════ */

/* ── Sidebar: Module-Icons immer neutral (kein Bootstrap-Text-Color) ── */
.sidebar-icon { color: var(--portal-text) !important; }
.sidebar-link.active .sidebar-icon { color: var(--portal-text) !important; }

/* ── Hero-Banner ── */
.portal-hero {
  border-radius: var(--portal-radius);
  padding: 2.25rem 2rem;
  margin-bottom: 1.5rem;
  color: #fff;
  background:
    radial-gradient(80% 60% at 80% 0%, rgba(255,200,80,.15), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(26,68,128,.7), transparent 60%),
    linear-gradient(135deg, #0a2247 0%, #1a4480 50%, #3a6cb8 100%);
  position: relative; overflow: hidden;
  box-shadow: 0 20px 60px -15px rgba(26,68,128,.4),
              inset 0 1px 0 rgba(255,255,255,.15);
}
.portal-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}
.portal-hero > * { position: relative; z-index: 1; }
.portal-hero h1 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em;
  margin-bottom: .25rem;
  background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,.82) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.portal-hero .lead { color: rgba(255,255,255,.75); font-size: .85rem; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .28rem .75rem; border-radius: 999px;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.25);
  font-size: .72rem; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: .85rem; color: rgba(255,255,255,.9);
}
.hero-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #b8f080; box-shadow: 0 0 0 4px rgba(184,240,128,.22);
}
.hero-status-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: .28rem .75rem;
  font-size: .78rem; color: rgba(255,255,255,.9);
}
.hero-status-pill.pill-warn {
  background: rgba(220,53,69,.3); border-color: rgba(255,255,255,.18);
}

/* ── Raumverwaltung Tab-Bar ── */
.rv-tab-bar {
  border-bottom: 2px solid var(--portal-border);
  margin-bottom: 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0;
}
.rv-tab-btn {
  text-decoration: none;
  padding: .5rem 1rem; font-weight: 600; font-size: .82rem;
  cursor: pointer; border: none; background: none;
  color: var(--portal-muted);
  position: relative;
  transition: color .15s;
  display: flex; align-items: center; gap: .35rem;
}
.rv-tab-btn:hover { color: var(--portal-primary); }
.rv-tab-btn.active {
  color: var(--portal-primary);
  font-weight: 700;
}
.rv-tab-btn.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--portal-primary);
}
.rv-tab-pane { display: none; }
.rv-tab-pane.active { display: block; }

/* ── Wochenprogramm (Dashboard: Diese Woche) ── */
.woche-day-header {
  padding: .4rem .75rem .3rem;
  font-size: .66rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.woche-day-header.heute { background: var(--portal-primary-light); color: var(--portal-primary); }
.woche-day-header.normal { background: #f8fafc; color: var(--portal-muted); }
.woche-booking-row {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--portal-border);
  font-size: .8rem;
}
.woche-booking-row:last-of-type { border-bottom: none; }
.woche-booking-time { min-width: 42px; font-size: .72rem; color: var(--portal-muted); padding-top: 2px; flex-shrink: 0; }
.woche-empty-row {
  padding: .4rem .75rem; font-size: .72rem;
  color: var(--portal-muted); opacity: .5; font-style: italic;
  border-bottom: 1px solid var(--portal-border);
}
.raum-chip {
  color: #fff; font-size: .68rem; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  white-space: nowrap; display: inline-block;
  line-height: 1.6;
}

/* ── Handlungsbedarf-Items ── */
.hb-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--portal-border);
  font-size: var(--fs-md);
}
.hb-item:last-child { border-bottom: none; }
.hb-item .dash-bar { margin: -.55rem 0; }   /* Statusstreifen spannt über volle Zeilenhöhe */
.hb-item-text { flex-grow: 1; min-width: 0; }
.hb-item-title { font-weight: 600; margin-bottom: 1px; }
.hb-item-sub { font-size: var(--fs-sm); color: var(--portal-muted); }

/* ── Budget-Fortschrittsbalken ── */
.budget-bar-track { height: 5px; background: #e9ecef; border-radius: 3px; margin: 3px 0 2px; }
.budget-bar-fill { height: 100%; border-radius: 3px; }

/* ── Klaustaler Mini-Grid ── */
.kt-stat {
  background: #f8fafc; border-radius: .75rem;
  padding: .5rem .6rem; text-align: center;
}
.kt-stat.kt-pos { background: var(--portal-primary-light); }
.kt-val { font-family: 'Inter Tight', sans-serif; font-size: 1.1rem; font-weight: 800; line-height: 1; }

/* ── Schlüssel-Status-Pills ── */
.schluessel-ok { background: #d1e7dd; color: #0f5132; font-size: .67rem; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.schluessel-warn { background: #fff3cd; color: #856404; font-size: .67rem; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.schluessel-danger { background: #f8d7da; color: #842029; font-size: .67rem; padding: 1px 7px; border-radius: 999px; font-weight: 600; }

/* ── Nav-Pills: Portal-Navy override (Raumverwaltung + global) ─────── */
.nav-pills .nav-link {
  border-radius: 999px;
  font-weight: 500;
  color: var(--portal-text);
  padding: .38rem .9rem;
  font-size: .82rem;
  transition: background .15s, color .15s;
}
.nav-pills .nav-link:hover {
  background: var(--portal-primary-50);
  color: var(--portal-primary);
}
.nav-pills .nav-link.active {
  background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-400));
  color: #fff;
  box-shadow: 0 3px 10px -3px rgba(26,68,128,.45);
}
.nav-pills .nav-link .badge { font-size: .68rem !important; vertical-align: middle; }

/* ── Raumverwaltung: bk-month navy (override lokale inline-styles) ─── */
.bk-month td {
  background: var(--portal-primary-50) !important;
  color: var(--portal-primary) !important;
  font-weight: 800;
  font-size: .7rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* ── Status-Badges für Buchungstabelle ─────────────────────────────── */
.sp-best { background:#d1e7dd; color:#0f5132; font-size:.7rem; padding:2px 9px; border-radius:999px; font-weight:600; display:inline-block; }
.sp-warn { background:#fff3cd; color:#856404; font-size:.7rem; padding:2px 9px; border-radius:999px; font-weight:600; display:inline-block; }
.sp-res  { background:#cfe2ff; color:#084298; font-size:.7rem; padding:2px 9px; border-radius:999px; font-weight:600; display:inline-block; }
.sp-ab   { background:#f8d7da; color:#842029; font-size:.7rem; padding:2px 9px; border-radius:999px; font-weight:600; display:inline-block; }
.sp-erl  { background:#e9ecef; color:#495057; font-size:.7rem; padding:2px 9px; border-radius:999px; font-weight:600; display:inline-block; }

/* sp-* als Button (dropdown-toggle) */
button.sp-best, button.sp-warn, button.sp-res, button.sp-ab, button.sp-erl {
  cursor: pointer;
  border: none;
  line-height: 1.4;
}
button.sp-best:focus-visible, button.sp-warn:focus-visible,
button.sp-res:focus-visible, button.sp-ab:focus-visible, button.sp-erl:focus-visible {
  outline: 2px solid var(--portal-primary-400);
  outline-offset: 2px;
}

/* Klickbare KPI-Kacheln (Mein Budget) */
.kt-stat.kt-click { transition: filter .12s, transform .12s, box-shadow .12s; }
.kt-stat.kt-click:hover { filter: brightness(.97); transform: translateY(-1px); box-shadow: 0 4px 12px -6px rgba(26,68,128,.30); }
/* ════════════════════════════════════════════════════════════════════
   Portal-Tabellen-Standard (2026-06) — zwei Muster:
   .pt-table   = kompakte Daten-Tabelle (Register, Listen)   [Variante 1]
   .pt-rowcard = Termin-Karten mit Datumsblock (Sitzungen …) [Variante 2]
   ════════════════════════════════════════════════════════════════════ */

.pt-table { font-size: .84rem; margin-bottom: 0; width: 100%; border-collapse: collapse; }
.pt-table > thead th {
  font-size: .68rem; font-weight: 700; color: #8a96b0;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .55rem .75rem; border-bottom: 1px solid #e8ecf5; background: #f7f9fc;
}
.pt-table > tbody td {
  padding: .6rem .75rem; vertical-align: middle;
  border-bottom: 1px solid #f0f3f9;
}
.pt-table > tbody tr:last-child td { border-bottom: 0; }
.pt-table > tbody tr:hover td { background: #f5f8fe; }
.pt-table tr.pt-click { cursor: pointer; transition: background .1s; }
.pt-chevron { color: #aab3c5; font-size: .9rem; }

/* Aktions-Buttons in Tabellen */
.pt-btn-action {
  display: inline-flex; align-items: center; gap: .3rem;
  background: transparent; border: 1px solid #a8d9be; border-radius: 7px;
  color: #1a6b40; font-size: .72rem; font-weight: 600;
  padding: .25rem .6rem; line-height: 1.4; white-space: nowrap;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.pt-btn-action:hover { background: #e4f5ec; border-color: #1a6b40; }
.pt-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 29px; height: 29px;
  background: transparent; border: 1px solid #dde3ee; border-radius: 7px;
  color: #8a96b0; font-size: .85rem;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.pt-icon-btn:hover { background: #f5f8fe; border-color: #b0bcd4; color: #4a5568; }
.pt-icon-btn.pt-icon-danger { border-color: #f5c5c5; color: #c0392b; }
.pt-icon-btn.pt-icon-danger:hover { background: #fdebeb; border-color: #c0392b; }

/* Status-/Kategorie-Chips */
.pt-chip {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .18rem .6rem; border-radius: 999px; line-height: 1.45; white-space: nowrap;
}
.pt-chip-blue   { background: #e6effc; color: #1a4480; }
.pt-chip-green  { background: #e7f5ec; color: #1d6f42; }
.pt-chip-amber  { background: #fff4e0; color: #8a5a00; }
.pt-chip-red    { background: #fdebeb; color: #a32d2d; }
.pt-chip-violet { background: #f0edfc; color: #4c3a9c; }
.pt-chip-teal   { background: #e2f4f0; color: #0c6b58; }
.pt-chip-gray   { background: #f0f2f6; color: #5d6675; }
.pt-empty { color: #aab3c5; font-size: .8rem; }

/* Termin-Karten */
.pt-rowcard {
  display: flex; align-items: center; gap: .9rem;
  background: #fff; border: 1px solid #e3e8f0; border-radius: .8rem;
  padding: .65rem .9rem; margin-bottom: .5rem;
  color: inherit; text-decoration: none;
  transition: border-color .12s, box-shadow .12s;
}
a.pt-rowcard:hover, .pt-rowcard.pt-click:hover {
  border-color: #b9c6dd; box-shadow: 0 2px 8px rgba(26,68,128,.07); color: inherit;
}
.pt-date {
  width: 54px; flex-shrink: 0; text-align: center;
  border-radius: .6rem; padding: .35rem 0;
  background: #e6effc; color: #1a4480;
}
.pt-date .d { font-size: 1.15rem; font-weight: 700; line-height: 1.1; font-family: 'Inter Tight', sans-serif; }
.pt-date .m { font-size: .68rem; }
.pt-date-violet { background: #f0edfc; color: #4c3a9c; }
.pt-date-green  { background: #e7f5ec; color: #1d6f42; }
.pt-date-teal   { background: #e2f4f0; color: #0c6b58; }
.pt-date-gray   { background: #f0f2f6; color: #5d6675; }
.pt-rowcard .pt-title { font-weight: 600; font-size: .92rem; }
.pt-rowcard .pt-title .pt-nr { color: #97a0b1; font-weight: 400; font-size: .8rem; }
.pt-rowcard .pt-sub { font-size: .78rem; color: #76808f; }
.pt-group-label { font-size: .78rem; font-weight: 600; color: #76808f; margin: 1rem 0 .4rem; }

/* ════════════════════════════════════════════════════════════════════
   Dashboard-Feinschliff (kompakt + System) — eingeführt 2026-06
   Dichte bleibt erhalten; Hierarchie über Farbe, Touch über Trefferfläche.
   ════════════════════════════════════════════════════════════════════ */

/* Dringende Karte hebt sich ohne Mehrhöhe ab: Akzentkante + getönter Kopf */
.card.dash-urgent { border-left: 3px solid var(--c-danger); }
.card.dash-urgent .dash-card-head { background: var(--c-danger-bg); }

/* Dichte, tappbare Listenzeile: optisch schlank, Trefferfläche ≥44px via Padding */
.dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-bottom: 1px solid var(--portal-border);
  font-size: var(--fs-md); position: relative; transition: background .1s;
}
.dash-row:last-child { border-bottom: none; }
.dash-row.tap { cursor: pointer; }
.dash-row.tap:hover { background: var(--portal-primary-50); }
/* unsichtbarer 44px-Tap-Layer für die ganze Zeile (Button/Link darüber bleibt klickbar) */
.dash-row .row-link { position: absolute; inset: 0; z-index: 0; }
.dash-row .row-link:focus-visible { outline: 2px solid var(--portal-primary); outline-offset: -2px; }
.dash-row > *:not(.row-link) { position: relative; z-index: 1; }
.dash-row .row-actor { min-height: var(--tap); display: flex; flex-direction: column; justify-content: center; }

/* 3px-Statusstreifen statt platzraubender Icon-Kachel */
.dash-bar { width: 3px; align-self: stretch; border-radius: 2px; flex: 0 0 auto; margin: -7px 0; }
.dash-bar.dang { background: var(--c-danger); }
.dash-bar.warn { background: var(--c-warn); }
.dash-bar.ok   { background: var(--c-success); }

@media (prefers-reduced-motion: reduce) {
  .dash-row, #handlungsbedarf.hb-highlight { transition: none !important; animation: none !important; }
}
