/* ══════════════════════════════════════════════════════════════════════
   portal.klaus.at — Design "2b" (dezent / flach / weiße Kacheln)
   Umbau 2026-07: neutrale Ink-Palette, dünne 1px-Ränder, Bricolage-Headings,
   keine Glas-/Blur-/Verlauf-/Glow-Effekte. Struktur & Klassennamen unverändert,
   damit alle Module ohne Template-Änderung mitziehen.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --portal-primary: #1a4480;
  --portal-primary-600: #163866;
  --portal-primary-400: #3a6cb8;
  --portal-primary-50: #eef2f9;
  --portal-primary-light: #eef2f9;
  --portal-primary-soft: #eef2f9;
  --portal-accent: #b8860b;
  --portal-accent-soft: #fdf3d6;
  --portal-violet: #1a4480;
  --portal-cyan: #1a4480;

  --portal-bg: #f7f8fa;
  --portal-surface: #ffffff;
  --portal-surface-glass: #ffffff;
  --portal-text: #161a22;
  --portal-muted: #8890a3;
  --portal-border: #e7e9f0;
  --portal-border-strong: #dfe2ea;

  --portal-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --portal-shadow-md: 0 10px 26px -12px rgba(15, 23, 42, .22);
  --portal-shadow-glow: 0 10px 26px -14px rgba(15, 23, 42, .20);

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

  /* ── Status-Farben ── */
  --c-success: #198754;
  --c-danger: #dc3545;
  --c-warn: #b8860b;
  --c-danger-bg: #fdecee;
  --c-warn-bg: #fdf6e3;
  --c-success-bg: #e6f4ec;

  /* ── Kompakte Typo-Skala ── */
  --fs-xs: .6875rem;
  --fs-sm: .75rem;
  --fs-md: .8125rem;
  --fs-num: 1.25rem;

  --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;
  overflow-x: clip;
}

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

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

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

/* ---- Mesh-Hintergrund: im 2b-Look komplett deaktiviert ---- */
.portal-bg-mesh { display: none !important; }

/* ---- Navbar (öffentlich) ---- */
.portal-navbar {
  background: #fff;
  border-bottom: 1px solid var(--portal-border);
  box-shadow: none;
  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: #f1f3f7;
}
.portal-navbar .dropdown-menu {
  border: 1px solid var(--portal-border);
  border-radius: 1rem;
  box-shadow: var(--portal-shadow-md);
  padding: .5rem;
  background: #fff;
}
.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;
}
.landing-wappen {
  height: 110px;
  width: auto;
}

/* ---- Hero-Banner „2b": Navy-Fläche mit Wappen-Wasserzeichen ---- */
.portal-hero {
  position: relative;
  border: none;
  border-radius: var(--portal-radius);
  padding: 1.9rem 2rem;
  margin-top: 1.5rem;
  color: #fff;
  text-align: left;
  background: #16305a;
  overflow: hidden;
  box-shadow: none;
}
.portal-hero::before { content: none; }
.portal-hero > * { position: relative; z-index: 1; }
.portal-hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .28rem .75rem; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.9);
  margin-bottom: .85rem;
}
.portal-hero .eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #b8f080; box-shadow: 0 0 0 4px rgba(184,240,128,.2);
}
.portal-hero h1 {
  font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.05;
  margin: 0 0 .25rem;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.portal-hero .lead {
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  max-width: 640px;
  margin: 0;
  line-height: 1.55;
}

/* ---- Karten (flach, weiß, 1px Rand) ---- */
.card,
.module-card {
  position: relative;
  border-radius: var(--portal-radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--portal-border);
  box-shadow: none;
}
.card:has(.dropdown-menu.show) {
  z-index: 5;
  overflow: visible;
}

.module-card {
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.module-card::before,
.module-card::after { content: none; }
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--portal-shadow-md);
  border-color: var(--portal-border-strong);
}
.module-card .card-body { padding: 1.75rem 1.5rem; }

.module-icon-wrap {
  width: 56px; height: 56px;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 14px;
  font-size: 1.6rem;
  margin-bottom: 1.1rem;
  background: #f1f3f7;
  color: var(--portal-primary);
  box-shadow: none;
  transition: none;
}
.module-card:hover .module-icon-wrap { transform: none; }
.module-icon-wrap.accent {
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
  box-shadow: none;
}
.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: .625rem;
  font-weight: 600;
  padding: .45rem .9rem;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .28rem .6rem !important; font-size: .8rem !important; border-radius: .45rem !important; font-weight: 600 !important; }
.btn-check:checked + .btn small,
.btn-check:checked + .btn .text-muted { color: rgba(255,255,255,.8) !important; }

.btn-primary {
  background: var(--portal-primary);
  border: 1px solid var(--portal-primary);
  box-shadow: none;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--portal-primary-600);
  border-color: var(--portal-primary-600);
  box-shadow: none;
}

.btn-light {
  background: #fff;
  border: 1px solid var(--portal-border);
  color: var(--portal-text);
  box-shadow: none;
}
.btn-light:hover { background: #f1f3f7; color: var(--portal-primary); }

.btn-outline-secondary {
  border-color: var(--portal-border-strong);
  color: var(--portal-text);
}
.btn-outline-secondary:hover {
  background: #f1f3f7;
  border-color: var(--portal-border-strong);
  color: var(--portal-text);
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
  background: rgba(255, 255, 255, .06);
}
.btn-outline-light:hover {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border-color: rgba(255, 255, 255, .7);
}

.btn-lg { padding: .8rem 1.6rem; font-size: 1.02rem; }

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

/* ---- KPIs ---- */
.kpi-card .kpi-value {
  font-family: 'Bricolage Grotesque', 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 (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; }
.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 ---- */
.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; }
.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 ---- */
.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 ---- */
.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; }
.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: .75rem;
  border: 1px solid var(--portal-border);
}

/* ---- Kalender ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--portal-border);
  border: 1px solid var(--portal-border);
  border-radius: .75rem;
  overflow: hidden;
  box-shadow: none;
}
.calendar-cell {
  background: #fff;
  min-height: 100px;
  padding: .4rem;
  font-size: .85rem;
}
.calendar-cell.empty { background: #f8f9fc; }
.calendar-cell.today { background: #fbfaf3; }
.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 var(--portal-border);
  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 .6s cubic-bezier(.2, .8, .2, 1) both; }
.fade-up.delay-1 { animation-delay: .08s; }
.fade-up.delay-2 { animation-delay: .16s; }
.fade-up.delay-3 { animation-delay: .24s; }

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

@media print {
  .no-print, nav, footer, .portal-bg-mesh { display: none !important; }
  .portal-hero { background: #16305a !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: 'Bricolage Grotesque', '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 1px 3px rgba(15, 23, 42, .12);
}

.avatar-initials {
  --avatar-hue: 220;
  background:
    linear-gradient(135deg,
      hsl(var(--avatar-hue), 55%, 52%) 0%,
      hsl(calc(var(--avatar-hue) + 30), 55%, 44%) 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  box-shadow: none;
}

/* Avatar-Editor */
.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 2px 8px -2px rgba(26, 68, 128, .4);
  transition: transform .15s ease, background .2s ease;
}
.avatar-edit-btn:hover {
  background: var(--portal-primary-600);
  transform: scale(1.05);
}

.portal-navbar .nav-link .avatar { margin-right: .4rem; }


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

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

.portal-body.has-sidebar {
  display: block;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
}

/* ---- 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: #fff;
  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: #fff;
  border-right: 1px solid var(--portal-border);
}
@media (min-width: 992px) {
  .portal-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .portal-sidebar.offcanvas-lg {
    position: sticky;
    transform: none !important;
    visibility: visible !important;
  }
}

/* ---- Brand im Sidebar ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  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: 28px; width: auto; flex-shrink: 0; }
.sidebar-brand-text { line-height: 1.1; min-width: 0; overflow: hidden; }
.sidebar-brand-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand-sub {
  font-size: .55rem;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Nav-Links ---- */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  flex-grow: 1;
  min-height: 0;
  overflow: hidden;
}
/* Rubrik „Inaktive Module“ (zugeklappt, 27.09.2026) */
.sidebar-inaktiv > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .35rem; }
.sidebar-inaktiv > summary::-webkit-details-marker { display: none; }
.sidebar-inaktiv-pfeil { font-size: .7rem; transition: transform .15s; }
.sidebar-inaktiv[open] .sidebar-inaktiv-pfeil { transform: rotate(180deg); }
.sidebar-inaktiv .sidebar-link { opacity: .8; }

.sidebar-section {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--portal-muted);
  padding: .6rem .6rem .25rem;
}
.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: #f1f3f7;
}
.sidebar-mod-done-btn {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.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: #eef2f9;
  border-radius: .6rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .5rem;
  border-radius: .55rem;
  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: #f1f3f7;
  color: var(--portal-primary);
}
.sidebar-link.active {
  background: #f1f3f7;
  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-label { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }

/* Lange Modul-Liste (16 Module) scrollt, statt abgeschnitten zu werden */
#sidebar-modules {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-right: -.25rem;
  padding-right: .1rem;
  scrollbar-width: thin;
  scrollbar-color: #d7dbe4 transparent;
}
#sidebar-modules::-webkit-scrollbar { width: 6px; }
#sidebar-modules::-webkit-scrollbar-thumb { background: #d7dbe4; border-radius: 3px; }
#sidebar-modules::-webkit-scrollbar-track { background: transparent; }

/* ---- User-Bereich ---- */
.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: .6rem;
  width: 100%;
  padding: .5rem .6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .6rem;
  color: var(--portal-text);
  text-align: left;
}
.sidebar-user-btn:hover {
  background: #f1f3f7;
  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: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .62rem;
  color: var(--portal-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.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;
  padding: 1.25rem 1rem 3rem;
}
@media (min-width: 992px) {
  .portal-main { padding: 2rem 2rem 4rem; }
}
.portal-main-inner {
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 991.98px) {
  .portal-sidebar { width: min(85vw, 320px); }
}

/* ═══════════════════════════════════════════════════════════════
   Dashboard-Hero, Tabs, Week-Schedule
   ═══════════════════════════════════════════════════════════════ */

.sidebar-icon { color: var(--portal-text) !important; }
.sidebar-link.active .sidebar-icon { color: var(--portal-primary) !important; }

/* ── Dashboard/Module-Header: linksbündig + Wappen-Wasserzeichen ── */
.portal-main-inner .portal-hero { text-align: left; }
.portal-hero h1 {
  font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
  font-size: clamp(1.9rem, 3.5vw, 2.4rem); font-weight: 800; letter-spacing: -.03em;
  line-height: 1.05;
  margin: 0 0 .25rem;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.portal-hero .lead { color: rgba(255,255,255,.75); font-size: .85rem; margin: 0; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .28rem .75rem; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  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,.2);
}
.hero-status-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px; padding: .28rem .75rem;
  font-size: .78rem; color: rgba(255,255,255,.9);
}
.hero-status-pill.pill-warn {
  background: rgba(212,160,23,.32); border-color: rgba(255,255,255,.2); color: #fff;
}

/* Wappen als dezentes Wasserzeichen rechts im Hero */
.portal-hero::after {
  content: "";
  position: absolute;
  right: 1.5rem; top: 50%;
  width: 240px; height: 300px;
  transform: translateY(-50%);
  background: url(../img/wappen-klaus.png) center / contain no-repeat;
  filter: saturate(.8) brightness(1.1);
  opacity: .12;
  pointer-events: none;
  z-index: 0;
}
@media (max-width: 767.98px) {
  .portal-hero::after { display: none; }
}

/* ── Tab-Bar ── */
.rv-tab-bar {
  border-bottom: 1px 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: -1px;
  height: 2px; background: var(--portal-primary);
}
.rv-tab-pane { display: none; }
.rv-tab-pane.active { display: block; }

/* ── Wochenprogramm ── */
.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: #f7f8fa; 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 ── */
.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 6px -.55rem -.75rem; }
.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-Balken ── */
.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: #f7f8fa; border: 1px solid var(--portal-border); border-radius: .7rem;
  padding: .5rem .6rem; text-align: center;
}
.kt-stat.kt-pos { background: var(--portal-primary-light); border-color: transparent; }
.kt-val { font-family: 'Bricolage Grotesque', 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 ── */
.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: #f1f3f7;
  color: var(--portal-primary);
}
.nav-pills .nav-link.active {
  background: var(--portal-primary);
  color: #fff;
  box-shadow: none;
}
.nav-pills .nav-link .badge { font-size: .68rem !important; vertical-align: middle; }

/* ── Raumverwaltung Monatszeile ── */
.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 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; }

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;
}

.kt-stat.kt-click { transition: filter .12s, transform .12s, box-shadow .12s; }
.kt-stat.kt-click:hover { filter: brightness(.98); transform: translateY(-1px); box-shadow: var(--portal-shadow-sm); }

/* ════════════════════════════════════════════════════════════════════
   Portal-Tabellen-Standard
   ════════════════════════════════════════════════════════════════════ */

.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 var(--portal-border); background: #f7f8fa;
}
.pt-table > tbody td {
  padding: .6rem .75rem; vertical-align: middle;
  border-bottom: 1px solid #f0f2f6;
}
.pt-table > tbody tr:last-child td { border-bottom: 0; }
.pt-table > tbody tr:hover td { background: #f7f8fa; }
.pt-table tr.pt-click { cursor: pointer; transition: background .1s; }
.pt-chevron { color: #aab3c5; font-size: .9rem; }

.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 var(--portal-border); border-radius: 7px;
  color: #8a96b0; font-size: .85rem;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.pt-icon-btn:hover { background: #f7f8fa; border-color: var(--portal-border-strong); 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; }

.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: #eef2f9; color: #1a4480; }
.pt-chip-teal   { background: #e2f4f0; color: #0c6b58; }
.pt-chip-gray   { background: #f0f2f6; color: #5d6675; }
.pt-empty { color: #aab3c5; font-size: .8rem; }

.pt-rowcard {
  display: flex; align-items: center; gap: .9rem;
  background: #fff; border: 1px solid var(--portal-border); 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: var(--portal-border-strong); box-shadow: var(--portal-shadow-sm); 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: 'Bricolage Grotesque', sans-serif; }
.pt-date .m { font-size: .68rem; }
.pt-date-violet { background: #eef2f9; color: #1a4480; }
.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
   ════════════════════════════════════════════════════════════════════ */

.card.dash-urgent { border-left: 1px solid var(--portal-border); }
.card.dash-urgent .dash-card-head { background: #fff; }

.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); }
.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; }

.dash-bar { display: none; }
.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; }
}

/* ── Card-Header dezent ── */
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--portal-border);
  font-weight: 600;
}
