:root {
  color-scheme: dark;

  /* Zentrale Layer-Konvention. Komponenteninterne Werte < 100 bleiben lokal
     innerhalb ihres eigenen Stacking-Contexts und werden nicht global verglichen. */
  --app-z-index-local-overlay: 20;
  --app-z-index-sticky: 1000;
  --app-z-index-page-header: 8000;
  --app-z-index-dropdown: 9000;
  --app-z-index-offcanvas-backdrop: 9400;
  --app-z-index-offcanvas: 9500;
  --app-z-index-modal-backdrop: 10000;
  --app-z-index-modal: 10100;
  --app-z-index-modal-overlay: 19000;
  --app-z-index-notification: 20000;

  /* Aeterna Dark UI – zentrale Farbpalette */
  --theme-bg-sidebar: #202226;
  --theme-bg-brand: #191b1f;
  --theme-bg-active: #354658;
  --theme-bg-content: #272a2f;
  --theme-bg-surface: #30343a;
  --theme-bg-surface-raised: #353a41;
  --theme-bg-surface-muted: #2c3036;
  --theme-bg-surface-hover: #3a414a;
  --theme-bg-sidebar-control: #2b3037;
  --theme-bg-sidebar-control-hover: #343b44;
  --theme-bg-sidebar-submenu: rgba(0, 0, 0, 0.14);
  --theme-bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --theme-bg-sidebar-subtle: rgba(255, 255, 255, 0.035);
  --theme-bg-selection: rgba(91, 155, 213, 0.13);
  --theme-bg-drop-target: rgba(91, 155, 213, 0.035);
  --theme-bg-drop-target-active: rgba(91, 155, 213, 0.055);
  --theme-bg-table-striped: rgba(255, 255, 255, 0.025);
  --theme-bg-table-hover: rgba(91, 155, 213, 0.075);

  --theme-text-primary: #e2e5e9;
  --theme-text-secondary: #a0a7b1;
  --theme-text-sidebar: #c5cbd3;
  --theme-text-sidebar-hover: #f4f7fa;
  --theme-text-sidebar-muted: #8995a2;
  --theme-text-sidebar-disabled: #7c8793;
  --theme-text-on-accent: #101820;
  --theme-text-on-calendar-color: #ffffff;

  --theme-accent: #5b9bd5;
  --theme-accent-soft: #78afe2;

  /* Aeterna Blue & Gold: Blau bleibt die funktionale UI-Akzentfarbe;
     Gold ist ausschließlich ein ergänzender Marken- und Zierakzent. */
  --theme-brand-gold: #c69a54;
  --theme-brand-gold-soft: #e5c58d;
  --theme-brand-gold-muted: rgba(198, 154, 84, 0.14);
  --theme-brand-gold-border: rgba(198, 154, 84, 0.34);
  --theme-brand-gold-glow: rgba(198, 154, 84, 0.16);
  --theme-border-sidebar: #343940;
  --theme-border-sidebar-strong: #48515c;
  --theme-card-border: #41464e;
  --theme-focus-ring: rgba(91, 155, 213, 0.32);
  --theme-shadow: rgba(0, 0, 0, 0.22);
  --theme-shadow-soft: rgba(0, 0, 0, 0.12);

  /* Semantische Statusfarben bleiben von der Akzentfarbe getrennt. */
  --theme-success: #78c69b;
  --theme-success-hover: #8bd5aa;
  --theme-warning: #e2bd72;
  --theme-warning-hover: #ecc984;
  --theme-danger: #e28b90;
  --theme-danger-hover: #ed9da2;
  --theme-info: #78b7da;
  --theme-info-hover: #8bc7e4;
  --theme-bg-success-subtle: #20392e;
  --theme-text-success: #a5dfbd;
  --theme-border-success: #315b46;
  --theme-bg-warning-subtle: #3c3424;
  --theme-text-warning: #f0d49a;
  --theme-border-warning: #6b5731;
  --theme-bg-danger-subtle: #402a2d;
  --theme-text-danger: #f0b0b4;
  --theme-border-danger: #714247;
  --theme-bg-info-subtle: #243746;
  --theme-text-info: #a9d7ee;
  --theme-border-info: #3a6078;

  --theme-bg-user-menu: var(--theme-bg-brand);
  --theme-bg-user-avatar: var(--theme-bg-active);

  /* Bootstrap 5.3 – feste Dark-Grunddarstellung der Anwendung. */
  --bs-body-bg: var(--theme-bg-content);
  --bs-body-color: var(--theme-text-primary);
  --bs-emphasis-color: var(--theme-text-primary);
  --bs-secondary-color: var(--theme-text-secondary);
  --bs-tertiary-color: var(--theme-text-sidebar-muted);
  --bs-secondary-bg: var(--theme-bg-surface-muted);
  --bs-tertiary-bg: var(--theme-bg-surface-raised);
  --bs-border-color: var(--theme-card-border);
  --bs-border-color-translucent: rgba(226, 229, 233, 0.12);
  --bs-heading-color: var(--theme-text-primary);
  --bs-link-color: var(--theme-accent-soft);
  --bs-link-hover-color: #a5ccef;
  --bs-primary: var(--theme-accent);
  --bs-primary-rgb: 91, 155, 213;
  --bs-primary-text-emphasis: #a5ccef;
  --bs-primary-bg-subtle: #23384b;
  --bs-primary-border-subtle: #395e7e;
  --bs-secondary: #84909c;
  --bs-secondary-rgb: 132, 144, 156;
  --bs-success: var(--theme-success);
  --bs-success-rgb: 120, 198, 155;
  --bs-warning: var(--theme-warning);
  --bs-warning-rgb: 226, 189, 114;
  --bs-danger: var(--theme-danger);
  --bs-danger-rgb: 226, 139, 144;
  --bs-info: var(--theme-info);
  --bs-info-rgb: 120, 183, 218;
  --bs-card-bg: var(--theme-bg-surface);
  --bs-card-color: var(--theme-text-primary);
  --bs-card-border-color: var(--theme-card-border);
  --bs-dropdown-bg: var(--theme-bg-surface);
  --bs-dropdown-color: var(--theme-text-primary);
  --bs-dropdown-border-color: var(--theme-card-border);
  --bs-modal-bg: var(--theme-bg-surface);
  --bs-modal-color: var(--theme-text-primary);
  --bs-form-valid-color: var(--theme-success);
  --bs-form-invalid-color: var(--theme-danger);
  --bs-form-valid-border-color: var(--theme-success);
  --bs-form-invalid-border-color: var(--theme-danger);

  --sidebar-width: 260px;
}

html {
  color-scheme: dark;
}

body {
  background-color: var(--theme-bg-content);
  color: var(--theme-text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Globale Overlay-Layer; Modal-interne Menüs/Popover liegen über dem Dialoginhalt. */
.dropdown-menu,
.popover,
.tooltip { z-index: var(--app-z-index-dropdown); }
/* Bootstrap setzt Offcanvas standardmäßig unter den Aeterna-Seitenkopf (8.000).
   Der mobile Drawer muss den gesamten Seitenkopf überdecken, bleibt aber unter Modals. */
.offcanvas-backdrop { z-index: var(--app-z-index-offcanvas-backdrop); }
@media (max-width: 767.98px) {
  /* The actual drawer uses Bootstrap's responsive .offcanvas-md class. */
  .offcanvas-md { z-index: var(--app-z-index-offcanvas); }
}
.modal-backdrop { z-index: var(--app-z-index-modal-backdrop); }
.modal { z-index: var(--app-z-index-modal); }
.modal .dropdown-menu,
.modal .popover,
.modal .tooltip { z-index: var(--app-z-index-modal-overlay); }

/* --------------------------------------------------------------------------
   Vierteilige Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width) !important;
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  max-height: 100vh;
  flex: 0 0 var(--sidebar-width);
  overflow: hidden;
  background-color: var(--theme-bg-sidebar) !important;
  color: var(--theme-text-sidebar);
  border-right: 1px solid var(--theme-bg-brand);
}

@media (min-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
  }
}

.sidebar-context {
  padding: 1rem;
  background-color: var(--theme-bg-brand);
  border-bottom: 1px solid var(--theme-bg-brand);
}

.sidebar-brand-row {
  min-height: 2rem;
  margin-bottom: 1rem;
}

.sidebar-brand {
  min-width: 0;
  color: var(--theme-brand-gold);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 0 16px var(--theme-brand-gold-glow);
}

.sidebar-brand:hover,
.sidebar-brand:focus {
  color: var(--theme-brand-gold-soft);
}

.aeterna-brand-logo {
  display: block;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.aeterna-brand-logo--mobile {
  width: 38px;
  height: 38px;
}

.aeterna-brand-logo--auth {
  width: 64px;
  height: 64px;
}

.aeterna-brand-logo--reset {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.4rem;
}

.sidebar-context-label,
.sidebar-section-label {
  padding: 0 0.25rem 0.45rem;
  color: var(--theme-text-sidebar-muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
}

.sidebar-context-label {
  padding-bottom: 0.4rem;
}

.campaign-dropdown .btn {
  min-height: 2.35rem;
  padding: 0.45rem 0.6rem;
  color: var(--theme-text-sidebar);
  font-size: 0.82rem;
  background-color: var(--theme-bg-sidebar-control);
  border: 1px solid var(--theme-border-sidebar);
  text-align: left;
}

.campaign-dropdown .btn:hover,
.campaign-dropdown .btn:focus,
.campaign-dropdown .btn[aria-expanded="true"] {
  color: var(--theme-text-sidebar-hover);
  background-color: var(--theme-bg-sidebar-control-hover);
  border-color: var(--theme-border-sidebar-strong);
  box-shadow: none;
}

.campaign-dropdown .btn:disabled {
  color: var(--theme-text-sidebar-disabled);
  opacity: 1;
}

.campaign-dropdown .dropdown-menu {
  max-height: min(55vh, 25rem);
  overflow-y: auto;
  padding: 0.25rem 0;
  margin-top: 0.3rem;
  background-color: var(--theme-bg-brand);
  border: 1px solid var(--theme-border-sidebar);
  box-shadow: 0 0.5rem 1rem var(--theme-shadow);
}

.campaign-dropdown .dropdown-item {
  padding: 0.5rem 0.75rem;
  color: var(--theme-text-sidebar);
  font-size: 0.82rem;
  white-space: normal;
}

.campaign-dropdown .dropdown-item:hover,
.campaign-dropdown .dropdown-item:focus {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-sidebar-hover);
}

.campaign-dropdown .dropdown-item.active,
.campaign-dropdown .dropdown-item:active {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-active);
  border-left: 3px solid var(--theme-accent);
  padding-left: calc(0.75rem - 3px);
}

/* Bereich 2: eigenständig scrollbare Arbeitsnavigation. */
.sidebar-menu {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.75rem 0 1rem;
  /* Kein dauerhaft reservierter rechter Gutter: Hover- und Untermenüflächen
     sollen bis an die rechte Sidebar-Kante reichen. */
  scrollbar-gutter: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border-sidebar-strong) transparent;
  overscroll-behavior: contain;
}

.sidebar-section-label {
  padding: 0.4rem 1rem 0.45rem;
}

.sidebar-nav-category {
  width: 100%;
  min-width: 0;
}

.sidebar-nav-category + .sidebar-nav-category {
  margin-top: 0.65rem;
}

.sidebar-category {
  margin: 0;
  padding: 0.85rem 1rem 0.35rem;
  color: var(--theme-text-sidebar-muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Dezente, kurze Trennlinie zur visuellen Gliederung der Sidebar-Kategorien. */
.sidebar-category::after {
  content: "";
  display: block;
  width: 80%;
  height: 1px;
  margin-top: 0.55rem;
  background: linear-gradient(
    90deg,
    var(--theme-border-sidebar-strong) 0%,
    color-mix(in srgb, var(--theme-border-sidebar) 76%, var(--theme-brand-gold) 24%) 46%,
    var(--theme-border-sidebar) 72%,
    transparent 100%
  );
}

.sidebar-menu > .sidebar-section-label + .sidebar-nav-category .sidebar-category {
  padding-top: 0.6rem;
}

.sidebar-link,
.sidebar-sublink {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.4rem;
  padding: 0.5rem 1rem;
  color: var(--theme-text-sidebar) !important;
  text-decoration: none;
  text-align: left;
  font-size: 0.91rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible,
.sidebar-sublink:hover,
.sidebar-sublink:focus-visible {
  color: var(--theme-text-sidebar-hover) !important;
  background-color: var(--theme-bg-sidebar-hover);
  outline: none;
}

.sidebar-link.active,
.sidebar-sublink.active {
  color: var(--theme-text-sidebar-hover) !important;
  background-color: var(--theme-bg-active) !important;
  border-left-color: var(--theme-accent);
}

.sidebar-link > i,
.sidebar-sublink > i {
  flex: 0 0 1.15rem;
  width: 1.15rem;
  color: var(--theme-text-sidebar-muted);
  font-size: 1.05rem;
  text-align: center;
}

.sidebar-link.active > i,
.sidebar-sublink.active > i {
  color: var(--theme-accent-soft);
}

.sidebar-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-link-group {
  position: relative;
  display: flex;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  align-items: stretch;
  min-height: 2.4rem;
  color: var(--theme-text-sidebar);
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link-group:hover,
.sidebar-link-group:focus-within {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-sidebar-hover);
}

.sidebar-link-group.active {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-sidebar-subtle);
  border-left-color: var(--theme-accent);
}

.sidebar-link-main {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem 0.5rem 1rem;
  color: var(--theme-text-sidebar) !important;
  text-decoration: none;
  font-size: 0.91rem;
}

.sidebar-link-main:hover,
.sidebar-link-main:focus-visible,
.sidebar-link-main.active {
  color: var(--theme-text-primary) !important;
  outline: none;
}

.sidebar-link-main > i {
  flex: 0 0 1.15rem;
  width: 1.15rem;
  color: var(--theme-text-sidebar-muted);
  font-size: 1.05rem;
  text-align: center;
}

.sidebar-link-group.active .sidebar-link-main > i {
  color: var(--theme-accent-soft);
}

.sidebar-caret {
  display: flex;
  flex: 0 0 2.6rem;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0;
  color: var(--theme-text-sidebar-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.sidebar-caret:hover,
.sidebar-caret:focus-visible {
  color: var(--theme-text-primary);
  outline: 2px solid var(--theme-focus-ring);
  outline-offset: -3px;
}

.sidebar-caret .bi-chevron-down {
  font-size: 0.78rem;
  transition: transform 0.18s ease;
}

.sidebar-caret[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.sidebar-submenu {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding: 0.15rem 0 0.25rem;
  background-color: var(--theme-bg-sidebar-submenu);
}

.sidebar-sublink {
  min-height: 2.1rem;
  padding: 0.42rem 0.75rem 0.42rem 2.85rem;
  gap: 0.6rem;
  font-size: 0.84rem;
  border-left: 3px solid transparent;
}

.sidebar-sublink > i {
  flex-basis: 0.95rem;
  width: 0.95rem;
  font-size: 0.88rem;
}

.sidebar-subitem-marker {
  flex: 0 0 0.35rem;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.3rem;
  border: 1px solid var(--theme-text-sidebar-muted);
  border-radius: 50%;
}

.sidebar-empty-state {
  margin: 0;
  padding: 1rem;
  color: var(--theme-text-sidebar-disabled);
  font-size: 0.82rem;
}

/* Bereich 3: am unteren Rand verankert, bei vielen Einträgen intern scrollbar. */
.sidebar-management {
  flex: 0 1 auto;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 34vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.4rem 0 0.55rem;
  background-color: var(--theme-bg-brand);
  border-top: 1px solid var(--theme-border-sidebar);
  /* Scrollbar nur bei Bedarf; keinen permanenten Leerraum rechts reservieren. */
  scrollbar-gutter: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border-sidebar-strong) transparent;
  overscroll-behavior: contain;
}

.sidebar-management-toggle {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 2.4rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 1rem;
  color: var(--theme-text-sidebar-muted);
  background: transparent;
  border: 0;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-management-toggle:hover,
.sidebar-management-toggle:focus-visible,
.sidebar-management.is-active .sidebar-management-toggle,
.sidebar-management-toggle[aria-expanded="true"] {
  color: var(--theme-text-sidebar-hover);
  background-color: var(--theme-bg-sidebar-hover);
}

.sidebar-management-toggle:focus-visible {
  outline: 2px solid var(--theme-focus-ring);
  outline-offset: -3px;
}

.sidebar-management-toggle .bi-chevron-down {
  flex: 0 0 auto;
  font-size: 0.78rem;
  transition: transform 0.18s ease;
}

.sidebar-management-toggle[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.sidebar-management-content {
  width: 100%;
  min-width: 0;
  padding-top: 0.15rem;
}

.sidebar-menu::-webkit-scrollbar,
.sidebar-management::-webkit-scrollbar {
  width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track,
.sidebar-management::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb,
.sidebar-management::-webkit-scrollbar-thumb {
  background-color: var(--theme-border-sidebar-strong);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover,
.sidebar-management::-webkit-scrollbar-thumb:hover {
  background-color: var(--theme-text-sidebar-muted);
}

/* Bereich 4: Benutzerkontrollzentrum als Bootstrap-Dropup am Sidebar-Fuß. */
.sidebar-user-center {
  flex: 0 0 auto;
  padding: 0.7rem 0;
  background-color: var(--theme-bg-brand);
  border-top: 1px solid var(--theme-border-sidebar);
}

.sidebar-user-dropdown {
  padding: 0 0.75rem;
}

.sidebar-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.35rem;
  color: var(--theme-text-sidebar-hover);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0.45rem;
}

.sidebar-user-trigger:hover,
.sidebar-user-trigger:focus-visible,
.sidebar-user-trigger[aria-expanded="true"] {
  color: var(--theme-text-sidebar-hover);
  background-color: var(--theme-bg-sidebar-hover);
  outline: none;
}

.sidebar-user-trigger:focus-visible {
  box-shadow: inset 0 0 0 2px var(--theme-focus-ring);
}

.sidebar-user-trigger.dropdown-toggle::after {
  display: none;
}

.sidebar-user-avatar {
  display: flex;
  flex: 0 0 2.25rem;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  color: var(--theme-text-sidebar-hover);
  background: var(--theme-bg-user-avatar);
  border: 1px solid var(--theme-border-sidebar);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
}

.sidebar-user-details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  overflow: hidden;
  color: var(--theme-text-sidebar-hover);
  font-size: 0.86rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  margin-top: 0.05rem;
  color: var(--theme-text-sidebar-muted);
  font-size: 0.72rem;
}

.sidebar-user-caret {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--theme-text-sidebar-muted);
  font-size: 0.8rem;
}

.sidebar-user-dropdown .dropdown-menu {
  /* Kompaktes Kontextmenue wie im DeepSeek-Prototyp; nicht ueber die Sidebar aufziehen. */
  width: max-content;
  min-width: 11rem;
  max-width: min(15rem, calc(100vw - 2rem));
  max-height: min(55vh, 24rem);
  overflow-y: auto;
  margin-bottom: 0.45rem;
  --bs-dropdown-color: var(--theme-text-sidebar);
  --bs-dropdown-bg: var(--theme-bg-user-menu);
  --bs-dropdown-border-color: var(--theme-border-sidebar);
  --bs-dropdown-link-color: var(--theme-text-sidebar);
  --bs-dropdown-link-hover-color: var(--theme-text-sidebar-hover);
  --bs-dropdown-link-hover-bg: var(--theme-bg-sidebar-hover);
  --bs-dropdown-link-active-color: var(--theme-text-sidebar-hover);
  --bs-dropdown-link-active-bg: var(--theme-bg-active);
  --bs-dropdown-header-color: var(--theme-text-sidebar-muted);
  --bs-dropdown-divider-bg: var(--theme-border-sidebar);
  background-color: var(--theme-bg-user-menu);
  border: 1px solid var(--theme-border-sidebar);
}

.sidebar-user-dropdown .dropdown-header {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-dropdown .dropdown-item {
  display: flex;
  white-space: normal;
  overflow-wrap: anywhere;
  align-items: center;
  min-height: 2.35rem;
  font-size: 0.86rem;
}

.sidebar-user-dropdown .dropdown-item.active,
.sidebar-user-dropdown .dropdown-item:active {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-active);
}

.sidebar-user-dropdown .dropdown-divider {
  border-top-color: var(--theme-border-sidebar);
}

.sidebar-user-menu-role {
  color: var(--theme-text-sidebar-muted) !important;
}

.sidebar-user-logout {
  color: var(--theme-accent-soft);
}

.sidebar-user-logout:hover,
.sidebar-user-logout:focus-visible {
  color: var(--theme-text-sidebar-hover);
  background-color: var(--theme-bg-sidebar-hover);
}

/* Mobile: Offcanvas bleibt in Bootstrap; das innere Layout scrollt in Zonen. */
.mobile-header {
  flex-shrink: 0;
  min-height: 3.75rem;
  background-color: var(--theme-bg-brand);
}

.mobile-header-spacer {
  display: inline-block;
  width: 2rem;
  flex: 0 0 2rem;
}

@media (max-width: 767.98px) {
  .sidebar {
    width: min(var(--sidebar-width), 88vw) !important;
    min-width: min(var(--sidebar-width), 88vw);
    max-width: min(var(--sidebar-width), 88vw);
    height: 100dvh;
    max-height: 100dvh;
  }

  .sidebar-management {
    max-height: 30dvh;
  }
}

/* --- CARDS --- */
.card {
  background-color: var(--theme-bg-surface);
  color: var(--theme-text-primary);
  border: 1px solid var(--theme-card-border);
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px var(--theme-shadow-soft);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--theme-card-border);
  font-weight: 600;
}

.hover-shadow:hover {
  box-shadow: 0 4px 12px var(--theme-shadow-soft);
  transform: translateY(-2px);
  transition: all 0.2s ease-in-out;
}

/* --- Module-Manager: visueller Navigationseditor --- */
.module-manager-description {
    display: -webkit-box;
    max-width: 34rem;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-height: 1.45;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.module-manager-requires {
    max-width: 24rem;
}

.module-manager-requires .badge {
    font-weight: 500;
}

.nav-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 310px);
  gap: 1.25rem;
  align-items: start;
}

.nav-editor-side-column {
  position: sticky;
  top: 1rem;
}

.nav-editor-area-card .card-header {
  padding: 1rem 1.1rem;
}

.nav-editor-category-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.nav-editor-category-list.is-drop-target {
  outline: 2px dashed var(--bs-primary);
  outline-offset: 0.35rem;
  border-radius: 0.45rem;
  background: var(--theme-bg-drop-target);
}

.nav-editor-category-grip {
  cursor: grab;
}

.nav-editor-category-grip:active {
  cursor: grabbing;
}

.nav-editor-category.is-dragging {
  opacity: 0.45;
}

.nav-editor-category {
  overflow: hidden;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.55rem;
  background: var(--theme-bg-surface);
}

.nav-editor-category-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem;
  background: var(--theme-bg-surface-raised);
  border-bottom: 1px solid var(--theme-card-border);
}

.nav-editor-category-grip {
  flex: 0 0 auto;
  padding: 0.25rem;
}

.nav-editor-area-select {
  width: auto;
  min-width: 145px;
  max-width: 190px;
}

.nav-editor-dropzone {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 3.1rem;
  padding: 0.65rem;
  border: 1px dashed transparent;
  border-radius: 0.45rem;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.nav-editor-category-dropzone {
  min-height: 3.75rem;
}

.nav-editor-dropzone.is-drop-target {
  border-color: var(--bs-primary);
  background: var(--theme-bg-drop-target-active);
}

.nav-editor-drop-hint,
.nav-editor-empty-area {
  padding: 0.65rem;
  color: var(--theme-text-secondary);
  font-size: 0.82rem;
  text-align: center;
}

.nav-editor-empty-area {
  border: 1px dashed var(--theme-card-border);
  border-radius: 0.45rem;
}

.nav-editor-item {
  min-width: 0;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.45rem;
  background: var(--theme-bg-surface);
  box-shadow: 0 1px 2px var(--theme-shadow-soft);
}

.nav-editor-item.is-dragging {
  opacity: 0.45;
}

.nav-editor-item-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3.15rem;
  padding: 0.45rem 0.55rem;
}

.nav-editor-drag-handle {
  flex: 0 0 auto;
  cursor: grab;
  padding-inline: 0.25rem;
}

.nav-editor-drag-handle:active {
  cursor: grabbing;
}

.nav-editor-item-icon {
  display: flex;
  flex: 0 0 1.65rem;
  align-items: center;
  justify-content: center;
  color: var(--theme-text-secondary);
  font-size: 1.05rem;
}

.nav-editor-item-main {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
}

.nav-editor-item-meta {
  overflow-wrap: anywhere;
  font-size: 0.68rem;
}

.nav-editor-item-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.25rem;
}

.nav-editor-properties {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--theme-card-border);
  background: var(--theme-bg-surface);
}

.nav-editor-child-zone {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0.75rem;
  margin: 0 0.55rem 0.55rem 2.85rem;
  padding: 0.45rem;
  border-left: 2px solid var(--theme-card-border);
  border-radius: 0 0.35rem 0.35rem 0;
}

.nav-editor-child-zone > .nav-editor-drop-hint {
  display: none;
  padding: 0.25rem 0.4rem;
  text-align: left;
  font-size: 0.75rem;
}

.nav-editor-child-zone.is-drop-target > .nav-editor-drop-hint {
  display: block;
}

.nav-editor-user-center-card {
  border-style: dashed;
}

.nav-editor-user-avatar {
  display: inline-flex;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 2.35rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--theme-text-primary);
  background: var(--theme-bg-brand);
  font-size: 1.15rem;
}

.nav-editor-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 0.8rem 1rem;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.55rem;
  background: var(--theme-bg-surface-raised);
  box-shadow: 0 -2px 10px var(--theme-shadow-soft);
  backdrop-filter: blur(8px);
}

@media (max-width: 991.98px) {
  .nav-editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav-editor-side-column {
    position: static;
  }
}

@media (max-width: 575.98px) {
  .nav-editor-category-head {
    flex-wrap: wrap;
  }

  .nav-editor-category-head > .flex-grow-1 {
    flex-basis: calc(100% - 2rem);
  }

  .nav-editor-area-select {
    flex: 1 1 145px;
    max-width: none;
  }

  .nav-editor-item-row {
    flex-wrap: wrap;
  }

  .nav-editor-item-main {
    flex-basis: calc(100% - 4.5rem);
  }

  .nav-editor-item-actions {
    margin-left: auto;
  }

  .nav-editor-child-zone {
    margin-left: 1.3rem;
  }
}

/* --------------------------------------------------------------------------
   Breadcrumbs – Aeterna Theme
   -------------------------------------------------------------------------- */
.breadcrumb-chevron {
  --bs-breadcrumb-divider: "›";
  gap: 0.5rem;
}

.breadcrumb-chevron .breadcrumb-item {
  display: flex;
  align-items: center;
  padding-left: 0;
  line-height: 1;
}

.app-breadcrumbs {
  border: 1px solid var(--theme-card-border);
  background-color: var(--theme-bg-surface-muted);
  background-color: color-mix(
    in srgb,
    var(--theme-bg-content) 80%,
    var(--theme-card-border)
  );
}

.app-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
  float: none;
  padding-right: 0.5rem;
  color: var(--theme-accent-soft);
  font-weight: 600;
  line-height: 1;
}

.app-breadcrumbs .breadcrumb-item a,
.app-breadcrumbs .app-breadcrumb-home {
  color: var(--theme-text-primary);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-breadcrumbs .breadcrumb-item a:hover,
.app-breadcrumbs .breadcrumb-item a:focus-visible {
  color: var(--theme-accent-soft);
}

.app-breadcrumbs .breadcrumb-item a:focus-visible {
  border-radius: 0.15rem;
  outline: 2px solid var(--theme-accent);
  outline-offset: 3px;
}

.app-breadcrumbs .app-breadcrumb-category {
  color: var(--theme-text-secondary);
  font-size: 0.92em;
  font-weight: 600;
}

.app-breadcrumbs .breadcrumb-item.active,
.app-breadcrumbs .app-breadcrumb-current {
  color: var(--theme-text-primary);
  font-weight: 600;
}



/* --------------------------------------------------------------------------
   Aeterna UI-Komponenten – zentrale, modulübergreifende Darstellung
   -------------------------------------------------------------------------- */

/* Bootstrap utility classes, die in Modulen als neutrale Flächen verwendet werden. */
.bg-white {
  color: var(--theme-text-primary) !important;
  background-color: var(--theme-bg-surface) !important;
}

.bg-light,
.app-bg-muted {
  color: var(--theme-text-primary) !important;
  background-color: var(--theme-bg-surface-muted) !important;
}

.text-bg-light,
.app-badge-neutral {
  color: var(--theme-text-secondary) !important;
  background-color: var(--theme-bg-surface-raised) !important;
  border: 1px solid var(--theme-card-border);
}

.alert-light,
.app-alert-neutral {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-muted);
  border-color: var(--theme-card-border);
}

.table-light {
  --bs-table-color: var(--theme-text-primary);
  --bs-table-bg: var(--theme-bg-surface-raised);
  --bs-table-border-color: var(--theme-card-border);
  --bs-table-striped-bg: var(--theme-bg-surface-muted);
  --bs-table-striped-color: var(--theme-text-primary);
  --bs-table-hover-bg: var(--theme-bg-surface-hover);
  --bs-table-hover-color: var(--theme-text-primary);
}

.visually-hidden:not(caption) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Grundelemente */
body,
main {
  color: var(--theme-text-primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--theme-text-primary);
}

hr {
  color: var(--theme-card-border);
  opacity: 1;
}

code,
pre {
  color: var(--theme-accent-soft);
}

/* Cards und standardisierte Headerstruktur */
.card {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface);
  border-color: var(--theme-card-border);
}

.card-header {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-raised);
  border-bottom-color: var(--theme-card-border);
}

.card-body {
  color: var(--theme-text-primary);
}

.card-footer {
  color: var(--theme-text-secondary);
  background-color: var(--theme-bg-surface-muted);
  border-top-color: var(--theme-card-border);
}

.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-raised);
  border-bottom: 1px solid var(--theme-card-border);
}

.app-card-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.app-card-icon {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  align-items: center;
  justify-content: center;
  color: var(--theme-accent-soft);
  background-color: var(--theme-bg-active);
  border: 1px solid var(--theme-border-sidebar-strong);
  border-radius: 0.5rem;
  font-size: 1.1rem;
}

.app-card-title {
  margin: 0;
  color: var(--theme-text-primary);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
}

.app-card-description {
  margin: 0.15rem 0 0;
  color: var(--theme-text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.app-card-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.app-log-detail-actions {
  flex-wrap: wrap;
}

.app-card-header--compact {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.app-card-eyebrow {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--theme-text-secondary);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

/* Wiederverwendbare, eingerückte Inhaltsfläche innerhalb einer Card. */
.app-panel {
  min-width: 0;
  padding: 1rem;
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-muted);
  border: 1px solid var(--theme-card-border);
  border-radius: 0.5rem;
}

/* Technische Textausgaben (JSON, Trace, Kontext) ohne View-Inline-Styles. */
.app-code-block {
  display: block;
  max-height: 32rem;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-muted);
  border: 1px solid var(--theme-card-border);
  border-radius: 0.5rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-code-block code {
  color: var(--theme-text-primary);
}

.app-log-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-log-message-column {
  min-width: 18rem;
  max-width: 32rem;
}

.app-badge-emergency {
  color: var(--theme-text-danger);
  background-color: var(--theme-bg-danger-subtle);
  border: 1px solid var(--theme-border-danger);
}

.app-page-summary {
  color: var(--theme-text-secondary);
}

@media (max-width: 575.98px) {
  .app-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-card-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Primäraktionen und Status-Badges nutzen die semantischen Theme-Farben. */
.btn-primary {
  --bs-btn-color: var(--theme-text-on-accent);
  --bs-btn-bg: var(--theme-accent);
  --bs-btn-border-color: var(--theme-accent);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-accent-soft);
  --bs-btn-hover-border-color: var(--theme-accent-soft);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-accent-soft);
  --bs-btn-active-border-color: var(--theme-accent-soft);
  --bs-btn-disabled-color: var(--theme-text-secondary);
  --bs-btn-disabled-bg: var(--theme-bg-surface-raised);
  --bs-btn-disabled-border-color: var(--theme-card-border);
}

.btn-outline-primary {
  --bs-btn-color: var(--theme-accent-soft);
  --bs-btn-border-color: var(--theme-accent);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-accent);
  --bs-btn-hover-border-color: var(--theme-accent);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-accent);
  --bs-btn-active-border-color: var(--theme-accent);
}

.btn-success {
  --bs-btn-color: var(--theme-text-on-accent);
  --bs-btn-bg: var(--theme-success);
  --bs-btn-border-color: var(--theme-success);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-success-hover);
  --bs-btn-hover-border-color: var(--theme-success-hover);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-success-hover);
  --bs-btn-active-border-color: var(--theme-success-hover);
}

.btn-warning {
  --bs-btn-color: var(--theme-text-on-accent);
  --bs-btn-bg: var(--theme-warning);
  --bs-btn-border-color: var(--theme-warning);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-warning-hover);
  --bs-btn-hover-border-color: var(--theme-warning-hover);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-warning-hover);
  --bs-btn-active-border-color: var(--theme-warning-hover);
}

.btn-danger {
  --bs-btn-color: var(--theme-text-on-accent);
  --bs-btn-bg: var(--theme-danger);
  --bs-btn-border-color: var(--theme-danger);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-danger-hover);
  --bs-btn-hover-border-color: var(--theme-danger-hover);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-danger-hover);
  --bs-btn-active-border-color: var(--theme-danger-hover);
}

.btn-info {
  --bs-btn-color: var(--theme-text-on-accent);
  --bs-btn-bg: var(--theme-info);
  --bs-btn-border-color: var(--theme-info);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-info-hover);
  --bs-btn-hover-border-color: var(--theme-info-hover);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-info-hover);
  --bs-btn-active-border-color: var(--theme-info-hover);
}

.btn-outline-secondary,
.btn-outline-dark {
  --bs-btn-color: var(--theme-text-secondary);
  --bs-btn-border-color: var(--theme-border-sidebar-strong);
  --bs-btn-hover-color: var(--theme-text-primary);
  --bs-btn-hover-bg: var(--theme-bg-surface-raised);
  --bs-btn-hover-border-color: var(--theme-border-sidebar-strong);
  --bs-btn-active-color: var(--theme-text-primary);
  --bs-btn-active-bg: var(--theme-bg-surface-raised);
  --bs-btn-active-border-color: var(--theme-border-sidebar-strong);
}

.btn-outline-danger {
  --bs-btn-color: var(--theme-danger);
  --bs-btn-border-color: var(--theme-danger);
  --bs-btn-hover-color: var(--theme-text-on-accent);
  --bs-btn-hover-bg: var(--theme-danger);
  --bs-btn-hover-border-color: var(--theme-danger);
  --bs-btn-active-color: var(--theme-text-on-accent);
  --bs-btn-active-bg: var(--theme-danger);
  --bs-btn-active-border-color: var(--theme-danger);
}

.badge.text-bg-primary,
.badge.bg-primary,
.badge.text-bg-info,
.badge.bg-info,
.badge.text-bg-success,
.badge.bg-success,
.badge.text-bg-warning,
.badge.bg-warning,
.badge.text-bg-danger,
.badge.bg-danger,
.badge.text-bg-secondary,
.badge.bg-secondary {
  color: var(--theme-text-on-accent) !important;
}

/* Formulare */
.form-control,
.form-select,
.input-group-text {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-muted);
  border-color: var(--theme-card-border);
}

.form-control::placeholder {
  color: var(--theme-text-sidebar-muted);
  opacity: 1;
}

.form-control:focus,
.form-select:focus {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-muted);
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 0.2rem var(--theme-focus-ring);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
  color: var(--theme-text-secondary);
  background-color: var(--theme-bg-surface-raised);
}

.form-check-input {
  background-color: var(--theme-bg-surface-muted);
  border-color: var(--theme-border-sidebar-strong);
}

.form-check-input:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 0.2rem var(--theme-focus-ring);
}

.form-check-input:checked {
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
}

.form-text,
.form-label {
  color: var(--theme-text-secondary);
}

/* Tabellen */
.table {
  --bs-table-color: var(--theme-text-primary);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--theme-card-border);
  --bs-table-striped-bg: var(--theme-bg-table-striped);
  --bs-table-striped-color: var(--theme-text-primary);
  --bs-table-hover-bg: var(--theme-bg-table-hover);
  --bs-table-hover-color: var(--theme-text-primary);
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--theme-card-border);
}

.table thead th {
  color: var(--theme-text-secondary);
  background-color: var(--theme-bg-surface-raised);
  border-bottom-color: var(--theme-card-border);
}

/* Pearldiving dice tables: fixed numeric columns and tabular digits. */
.app-dice-table {
  min-width: 100%;
}

.app-dice-table th:nth-child(1),
.app-dice-table td:nth-child(1) {
  width: 5rem;
}

.app-dice-table th:nth-child(2),
.app-dice-table td:nth-child(2) {
  width: 6rem;
}

.app-dice-table .app-dice-range-number,
.app-dice-table [data-range-start],
.app-dice-table .app-dice-range-input,
.app-dice-table .app-dice-outcome-input {
  font-variant-numeric: tabular-nums;
}

.app-dice-table .app-dice-range-number {
  white-space: nowrap;
}

.app-dice-table .app-dice-range-input-cell {
  width: 6rem;
  text-align: right;
}

.app-dice-table .app-dice-range-input,
.app-dice-table .app-dice-outcome-input {
  width: 5.25rem;
  min-width: 5.25rem;
}

.app-dice-table .app-dice-range-input {
  margin-left: auto;
  text-align: right;
}

.app-dice-table .app-dice-outcome-select {
  min-width: 11rem;
  max-width: 100%;
}

.app-table-sort-icon {
  font-size: 0.7em;
}

.app-table-col-w-80 { width: 80px; }
.app-table-col-w-100 { width: 100px; }
.app-table-col-w-120 { width: 120px; }
.app-table-col-w-130 { width: 130px; }
.app-table-col-w-160 { width: 160px; }
.app-table-col-w-180 { width: 180px; }
.app-table-col-w-200 { width: 200px; }
.app-table-col-w-220 { width: 220px; }
.app-table-col-w-330 { width: 330px; }
.app-table-col-w-360 { width: 360px; }

/* Einheitliche Table-Cards: Header, Toolbar, Tabelle und Pagination. */
.app-table-card {
  min-width: 0;
}

.app-table-card-header {
  gap: 1rem;
}

.app-table-card-body {
  min-width: 0;
  padding: 0;
}

.app-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.app-table-search {
  width: 100%;
  max-width: 28rem;
}

.app-table-card-body > .app-table-toolbar {
  margin-bottom: 0;
  padding: 1rem 1rem 0.75rem;
}

.app-table-responsive {
  min-width: 0;
}

.app-table-card-body > .app-table-responsive {
  border: 0;
  border-radius: 0;
}

.app-table-card-body > .app-table-responsive > .app-table {
  margin-bottom: 0;
}

.app-table-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--theme-card-border);
}

.app-table-card-body > .app-table-pagination {
  margin-top: 0;
  padding: 0.8rem 1rem;
  background-color: var(--theme-bg-surface-muted);
  border-top: 1px solid var(--theme-card-border);
}

.app-table-pagination--server {
  margin-top: 0;
  padding: 0.8rem 1rem;
  background-color: var(--theme-bg-surface-muted);
  border-top: 1px solid var(--theme-card-border);
}

.app-table-pagination-controls,
.app-table-page-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.app-table-pagination-controls {
  min-width: 0;
}

.app-table-page-form {
  gap: 0.4rem;
  white-space: nowrap;
}

.app-table-page-form--server {
  margin: 0;
}

.app-table-page-input {
  width: 4rem;
  padding-right: 0.35rem;
  padding-left: 0.35rem;
}

.app-table-pagination .page-link {
  min-width: 2rem;
  text-align: center;
}

.app-table-pagination .page-item.disabled .page-link {
  pointer-events: none;
  opacity: 0.45;
}

.app-table-card-footer {
  line-height: 1.5;
}

/* Navigation, Dropdowns, Pagination und Dialoge */
.dropdown-menu {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface);
  border-color: var(--theme-card-border);
  box-shadow: 0 0.5rem 1.25rem var(--theme-shadow);
}

.dropdown-item {
  color: var(--theme-text-primary);
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-raised);
}

.dropdown-item.active,
.dropdown-item:active {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-active);
}

.dropdown-divider {
  border-top-color: var(--theme-card-border);
}

/* Kompakte Tab-Leiste ohne eigenen Scroll-/Clipping-Kontext.
   Sticky Bereiche im Tab-Inhalt (z. B. Editor-Seitenleiste und Savebar)
   bleiben dadurch an den vorhandenen Main-Scrollcontainer gebunden. */
.app-tab-workspace {
  min-width: 0;
  overflow: visible;
}

.app-tab-workspace-header {
  margin: 0 0 1rem;
  padding: 0;
  background: transparent;
  border: 0;
}

.app-tab-workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0 0.15rem;
  border: 0;
  border-bottom: 1px solid var(--theme-card-border);
}

.app-tab-workspace-nav .nav-item {
  margin: 0;
}

.app-tab-workspace-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 -1px;
  padding: 0.7rem 1rem;
  color: var(--theme-text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0.5rem 0.5rem 0 0;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.app-tab-workspace-nav .nav-link:hover {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-hover);
}

.app-tab-workspace-nav .nav-link:focus-visible {
  position: relative;
  z-index: 2;
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
  box-shadow: none;
}

.app-tab-workspace-nav .nav-link.active,
.app-tab-workspace-nav .nav-link[aria-selected="true"] {
  position: relative;
  z-index: 1;
  color: var(--theme-text-primary);
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--theme-accent);
}

.app-tab-count {
  display: inline-flex;
  min-width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  color: var(--theme-accent-soft);
  background-color: var(--theme-bg-active);
  border: 1px solid var(--theme-border-sidebar-strong);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.app-tab-workspace-body {
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: var(--theme-text-primary);
  background: transparent;
}

.app-tab-workspace-body > .tab-pane {
  min-width: 0;
}

@media (max-width: 575.98px) {
  .app-tab-workspace-nav {
    gap: 0.2rem;
  }

  .app-tab-workspace-nav .nav-link {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }
}

.page-link {
  color: var(--theme-accent-soft);
  background-color: var(--theme-bg-surface-muted);
  border-color: var(--theme-card-border);
}

.page-link:hover {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-raised);
  border-color: var(--theme-card-border);
}

.page-item.active .page-link {
  color: var(--theme-text-on-accent);
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
}

.page-item.disabled .page-link {
  color: var(--theme-text-sidebar-disabled);
  background-color: var(--theme-bg-surface);
  border-color: var(--theme-card-border);
}

.modal-content,
.list-group-item,
.accordion-item {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface);
  border-color: var(--theme-card-border);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-hover);
}

.progress {
  background-color: var(--theme-bg-surface-muted);
}

.progress-bar {
  color: var(--theme-text-on-accent);
  background-color: var(--theme-accent);
}

.accordion-button {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-raised);
}

.accordion-button:not(.collapsed) {
  color: var(--theme-accent-soft);
  background-color: var(--theme-bg-active);
  box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--theme-card-border);
}

/* Statusanzeigen erhalten eigene, lesbare Dark-Flächen. */
.alert-success { --bs-alert-bg: var(--theme-bg-success-subtle); --bs-alert-color: var(--theme-text-success); --bs-alert-border-color: var(--theme-border-success); }
.alert-warning { --bs-alert-bg: var(--theme-bg-warning-subtle); --bs-alert-color: var(--theme-text-warning); --bs-alert-border-color: var(--theme-border-warning); }
.alert-danger  { --bs-alert-bg: var(--theme-bg-danger-subtle); --bs-alert-color: var(--theme-text-danger); --bs-alert-border-color: var(--theme-border-danger); }
.alert-info    { --bs-alert-bg: var(--theme-bg-info-subtle); --bs-alert-color: var(--theme-text-info); --bs-alert-border-color: var(--theme-border-info); }
.alert-secondary { --bs-alert-bg: var(--theme-bg-surface-raised); --bs-alert-color: var(--theme-text-primary); --bs-alert-border-color: var(--theme-card-border); }

/* Einheitliche Fokusdarstellung aller interaktiven Elemente. */
:focus-visible {
  outline-color: var(--theme-accent);
}


/* --------------------------------------------------------------------------
   Öffentliche Authentifizierungsseiten – Marken-Kopfzeile + Ambient-Bereich
   Variante B: eigenständige Kopfzeile wie im internen App-Bereich; das
   auslaufende Motiv beginnt erst darunter und konkurriert nicht mit dem Logo.
   -------------------------------------------------------------------------- */
.app-auth-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 0 2rem;
  color: var(--theme-text-primary);
  background: var(--theme-bg-brand);
  border-bottom: 1px solid var(--theme-brand-gold-border);
  box-shadow: 0 1px 0 var(--theme-brand-gold-muted);
}

.app-auth-topbar::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  content: "";
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--theme-accent) 24%,
    color-mix(in srgb, var(--theme-accent) 34%, var(--theme-brand-gold) 66%) 50%,
    var(--theme-accent) 76%,
    transparent 100%
  );
  opacity: 0.58;
}

.app-auth-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--theme-brand-gold);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.015em;
  text-shadow: 0 0 18px var(--theme-brand-gold-glow);
}

.app-auth-topbar-brand .aeterna-brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: contain;
}

.app-auth-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 0;
  background-color: var(--theme-bg-content);
}

/* Shared ambient background starts below the fixed brand bar. The asset
   remains rectangular; the CSS radial mask fades it into the page surface. */
.app-auth-shell::before,
.password-reset-stage::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(7, 13, 23, 0.16), rgba(7, 13, 23, 0.34)),
    url("/assets/images/branding/aeterna-auth-background.webp");
  background-position: center 42%;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.92;
  -webkit-mask-image: radial-gradient(
    ellipse 70% 78% at 50% 44%,
    #000 0%,
    #000 32%,
    rgba(0, 0, 0, 0.92) 48%,
    rgba(0, 0, 0, 0.58) 70%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse 70% 78% at 50% 44%,
    #000 0%,
    #000 32%,
    rgba(0, 0, 0, 0.92) 48%,
    rgba(0, 0, 0, 0.58) 70%,
    transparent 100%
  );
}

.app-auth-shell-content {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.app-auth-footer {
  color: var(--theme-text-secondary);
}

.app-auth-result-icon {
  color: var(--theme-accent-soft);
}

.app-auth-result-icon--success {
  color: var(--theme-success);
}

.app-card-title--large {
  font-size: 1.15rem;
}

/* Wiederverwendbare Passwortregeln für Setup, Konto und Authentifizierung. */
.app-password-policy {
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-muted);
  border: 1px solid var(--theme-card-border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.app-password-policy-title {
  margin: 0 0 0.5rem;
  color: var(--theme-text-primary);
  font-weight: 650;
}

.app-password-policy-list {
  display: grid;
  gap: 0.3rem;
  margin: 0 0 0.35rem;
  padding: 0;
  list-style: none;
}

.app-password-policy-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--theme-text-secondary);
}

.app-password-policy-item[data-state="valid"] {
  color: var(--theme-success);
}

.app-password-policy-icon {
  width: 1.1em;
  flex: 0 0 1.1em;
  font-weight: 700;
}

.app-password-policy-status {
  margin-left: auto;
  padding-left: 0.5rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.app-password-policy-note {
  display: block;
  margin-top: 0.5rem;
  color: var(--theme-text-secondary);
  font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   Auth-Sonderseite: Passwort zurücksetzen
   Die View bettet app.css serverseitig inline ein, damit keine externen
   Stylesheets/Assets geladen werden und die Token-Seite dieselben Farben nutzt.
   Die Marken-Kopfzeile entspricht layout-auth.php; nur der Ambient-Bereich
   beginnt darunter.
   -------------------------------------------------------------------------- */
.password-reset-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--theme-bg-content);
}

.password-reset-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  flex: 1 0 auto;
  min-height: 0;
  place-items: center;
  padding: 24px;
  background: var(--theme-bg-content);
}

.password-reset-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
}

.password-reset-card {
  width: 100%;
  overflow: hidden;
  color: var(--theme-text-primary);
  background: var(--theme-bg-surface);
  border: 1px solid var(--theme-card-border);
  border-radius: 12px;
  box-shadow: 0 8px 28px var(--theme-shadow);
}

.password-reset-header {
  padding: 22px 30px;
}

.password-reset-body {
  padding: 24px 30px;
}

.password-reset-card .app-card-title {
  color: var(--theme-text-primary);
  line-height: 1.25;
}

.password-reset-card label {
  display: block;
  margin: 18px 0 6px;
  color: var(--theme-text-primary);
  font-weight: 600;
}

.password-reset-field-row {
  display: flex;
  gap: 8px;
}

.password-reset-card input {
  display: block;
  min-width: 0;
  min-height: 44px;
  flex: 1;
  width: 100%;
  padding: 10px 12px;
  color: var(--theme-text-primary);
  background: var(--theme-bg-surface-muted);
  border: 1px solid var(--theme-card-border);
  border-radius: 7px;
  font: inherit;
}

.password-reset-card input:focus {
  border-color: var(--theme-accent);
  outline: 3px solid var(--theme-focus-ring);
}

.password-reset-card input.is-valid { border-color: var(--theme-success); }
.password-reset-card input.is-invalid { border-color: var(--theme-danger); }

.password-reset-toggle {
  min-width: 86px;
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--theme-text-primary);
  background: var(--theme-bg-surface-raised);
  border: 1px solid var(--theme-card-border);
  border-radius: 7px;
  font: inherit;
}

.password-reset-submit,
.password-reset-button {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 12px 16px;
  color: var(--theme-text-on-accent);
  background: var(--theme-accent);
  border: 1px solid var(--theme-accent);
  border-radius: 7px;
  font: inherit;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.password-reset-submit:hover,
.password-reset-button:hover {
  color: var(--theme-text-on-accent);
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent-soft);
}

.password-reset-card button:focus-visible,
.password-reset-card a:focus-visible {
  outline: 3px solid var(--theme-focus-ring);
  outline-offset: 2px;
}

.password-reset-hint { margin: 8px 0 0; color: var(--theme-text-secondary); font-size: 0.9rem; }
.password-reset-policy {
  margin-top: 14px;
  font-size: 0.92rem;
}
.password-reset-status { margin: 0 0 16px; padding: 14px; color: var(--theme-text-info); background: var(--theme-bg-info-subtle); border: 1px solid var(--theme-border-info); border-radius: 8px; }
.password-reset-confirm-status { min-height: 1.4em; margin: 7px 0 0; font-size: 0.88rem; }
.password-reset-confirm-status.is-valid { color: var(--theme-success); }
.password-reset-confirm-status.is-invalid { color: var(--theme-danger); }
.password-reset-note { margin-top: 18px; color: var(--theme-text-secondary); font-size: 0.9rem; }
.password-reset-footer {
  margin: 0;
  padding: 12px 20px;
  color: var(--theme-text-secondary);
  background: var(--theme-bg-surface-muted);
  border-top: 1px solid var(--theme-card-border);
  text-align: center;
  font-size: 0.8rem;
}

@media (max-width: 575.98px) {
  .app-auth-shell::before,
  .password-reset-stage::before {
    background-position: center 40%;
    opacity: 0.72;
    -webkit-mask-image: radial-gradient(
      ellipse 88% 66% at 50% 43%,
      #000 0%,
      rgba(0, 0, 0, 0.94) 42%,
      rgba(0, 0, 0, 0.56) 72%,
      transparent 100%
    );
    mask-image: radial-gradient(
      ellipse 88% 66% at 50% 43%,
      #000 0%,
      rgba(0, 0, 0, 0.94) 42%,
      rgba(0, 0, 0, 0.56) 72%,
      transparent 100%
    );
  }
}

@media (max-width: 480px) {
  .app-auth-topbar { min-height: 62px; padding: 0 1rem; }
  .app-auth-topbar-brand { gap: 0.65rem; font-size: 1.375rem; }
  .app-auth-topbar-brand .aeterna-brand-logo { width: 40px; height: 40px; flex-basis: 40px; }
  .password-reset-stage { padding: 12px; }
  .password-reset-header { padding: 18px 20px; }
  .password-reset-body { padding: 20px; }
}

/* --------------------------------------------------------------------------
   Zentraler Seitenkopf – Aeterna Hero Banner
   -------------------------------------------------------------------------- */
.app-page-header {
  position: relative;
  z-index: var(--app-z-index-page-header);
  isolation: isolate;
  min-height: 11.6rem;
  margin-bottom: 1.25rem;
  padding: 0.55rem 0.55rem 0.35rem;
  overflow: visible;
  background: var(--theme-bg-content);
  border-bottom: 1px solid var(--theme-card-border);
}

.app-page-header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--theme-accent) 0%,
    color-mix(in srgb, var(--theme-accent) 72%, var(--theme-brand-gold) 28%) 38%,
    color-mix(in srgb, var(--theme-brand-gold) 48%, transparent) 52%,
    color-mix(in srgb, var(--theme-accent) 34%, transparent) 72%,
    transparent 100%
  );
  content: "";
  pointer-events: none;
}

.app-page-header-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--theme-bg-content);
  pointer-events: none;
}

.app-page-header-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 0.96;
  filter: saturate(1.08) brightness(0.86);
  -webkit-mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 48%,
    rgba(0, 0, 0, 0.88) 64%,
    rgba(0, 0, 0, 0.52) 82%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 48%,
    rgba(0, 0, 0, 0.88) 64%,
    rgba(0, 0, 0, 0.52) 82%,
    transparent 100%
  );
}

.app-page-header-art::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(20, 27, 36, 0.30) 0%,
      rgba(20, 27, 36, 0.18) 48%,
      rgba(39, 42, 47, 0.56) 78%,
      var(--theme-bg-content) 100%
    ),
    linear-gradient(
      180deg,
      rgba(18, 24, 32, 0.08) 0%,
      rgba(18, 24, 32, 0.02) 58%,
      rgba(39, 42, 47, 0.52) 100%
    );
  content: "";
}

.app-page-header-art--left img {
  object-position: left center;
}

.app-page-header-art--center img {
  object-position: center 42%;
}

.app-page-header-art--right img {
  object-position: right center;
}

.app-page-header-main {
  position: relative;
  z-index: 3;
  display: flex;
  min-width: 0;
  min-height: 7.35rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.35rem;
}

.app-page-header-identity {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.95rem;
}

.app-page-header-icon {
  display: inline-flex;
  width: 3.15rem;
  height: 3.15rem;
  flex: 0 0 3.15rem;
  align-items: center;
  justify-content: center;
  color: var(--theme-accent-soft);
  background: rgba(20, 29, 40, 0.78);
  border: 1px solid color-mix(in srgb, var(--theme-accent) 58%, var(--theme-border-sidebar-strong));
  border-radius: 0.72rem;
  box-shadow: 0 0.45rem 1.2rem rgba(0, 0, 0, 0.24);
  font-size: 1.45rem;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.app-page-header-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.app-page-module-label {
  min-height: 0.9rem;
  margin: 0 0 0.16rem;
  color: var(--theme-info);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 0.9rem;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.72);
}

.app-page-title {
  margin: 0;
  color: var(--theme-text-primary);
  font-size: clamp(1.55rem, 2.1vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72);
}

.app-page-description {
  max-width: 58rem;
  margin: 0.38rem 0 0;
  color: var(--theme-text-primary);
  font-size: 0.82rem;
  line-height: 1.4;
  text-shadow: 0 1px 9px rgba(0, 0, 0, 0.78);
}

.app-page-header-actions {
  display: flex;
  min-width: 12.25rem;
  min-height: 2.25rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.app-page-header-actions.is-empty {
  visibility: hidden;
}

.app-page-header-actions .dropdown-menu {
  z-index: var(--app-z-index-dropdown);
}

.app-page-breadcrumb-row {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  min-height: 2.55rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
}

.app-page-breadcrumb-row.is-empty {
  visibility: hidden;
}

.app-page-header.has-banner .app-page-breadcrumb-row .app-breadcrumbs {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0.48rem 0.75rem !important;
  border-color: rgba(169, 192, 215, 0.20);
  background: rgba(19, 27, 36, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.app-page-breadcrumb-row .breadcrumb {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.app-page-breadcrumb-row .app-breadcrumbs {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0.55rem 0.85rem !important;
}

.app-page-context-meta {
  display: flex;
  min-height: 1.3rem;
  align-items: center;
  color: var(--theme-text-secondary);
  font-size: 0.72rem;
}

/* --------------------------------------------------------------------------
   Gemeinsame Seitenköpfe und Aeterna-Kalenderkomponenten
   -------------------------------------------------------------------------- */

.app-section-heading-icon {
  display: inline-flex;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 2.35rem;
  align-items: center;
  justify-content: center;
  color: var(--theme-accent-soft);
  background-color: var(--theme-bg-active);
  border: 1px solid var(--theme-border-sidebar-strong);
  border-radius: 0.55rem;
  font-size: 1.15rem;
}

.app-section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.app-section-heading-icon {
  width: 2rem;
  height: 2rem;
  flex-basis: 2rem;
  font-size: 0.95rem;
}

/* Semantische Status-Badges für fachliche Oberflächen. */
.app-badge-success,
.app-badge-warning,
.app-badge-danger,
.app-badge-info {
  border: 1px solid transparent;
}

.app-badge-success {
  color: var(--theme-text-success);
  background-color: var(--theme-bg-success-subtle);
  border-color: var(--theme-border-success);
}

.app-badge-warning {
  color: var(--theme-text-warning);
  background-color: var(--theme-bg-warning-subtle);
  border-color: var(--theme-border-warning);
}

.app-badge-danger {
  color: var(--theme-text-danger);
  background-color: var(--theme-bg-danger-subtle);
  border-color: var(--theme-border-danger);
}

.app-badge-info {
  color: var(--theme-text-info);
  background-color: var(--theme-bg-info-subtle);
  border-color: var(--theme-border-info);
}

/* Dashboard: zusammenhängende Übersichten und direkte Modulzugriffe. */
.app-dashboard-summary-table th.app-dashboard-meta-label {
  width: 8.125rem;
  color: var(--theme-text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.app-dashboard-tile {
  color: var(--theme-text-primary);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-dashboard-tile .card-body {
  padding: 1.1rem;
}

.app-dashboard-tile:hover,
.app-dashboard-tile:focus-visible {
  color: var(--theme-text-primary);
  border-color: var(--theme-accent);
  box-shadow: 0 0.45rem 1.1rem var(--theme-shadow-soft);
  transform: translateY(-2px);
}

.app-dashboard-tile:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

.app-dashboard-tile-icon {
  display: inline-flex;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
  color: var(--theme-accent-soft);
  background-color: var(--theme-bg-active);
  border: 1px solid var(--theme-border-sidebar-strong);
  border-radius: 0.55rem;
  font-size: 1.25rem;
}

.app-dashboard-tile-title {
  margin: 0 0 0.35rem;
  color: var(--theme-text-primary);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
}

.app-dashboard-tile-description {
  color: var(--theme-text-secondary);
  font-size: 0.78rem;
  line-height: 1.5;
}

.app-empty-state {
  display: flex;
  min-height: 5rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem;
  color: var(--theme-text-secondary);
  background-color: var(--theme-bg-surface-muted);
  border: 1px dashed var(--theme-card-border);
  border-radius: 0.5rem;
  text-align: center;
}

.app-empty-state > i {
  color: var(--theme-accent-soft);
  font-size: 1.35rem;
}

/* Kalender: Listen, Monatsraster und dynamische fachliche Farbcodes. */
.app-calendar-campaign-list .list-group-item,
.app-calendar-event-list .list-group-item,
.app-calendar-history-list .list-group-item {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface);
  border-color: var(--theme-card-border);
}

.app-calendar-campaign-list .list-group-item-action:hover,
.app-calendar-campaign-list .list-group-item-action:focus-visible {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-hover);
}

.app-calendar-campaign-list .list-group-item-action:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: -2px;
}

.app-calendar-month-grid {
  min-width: 40rem;
  table-layout: fixed;
}

.app-calendar-month-grid thead th {
  padding: 0.75rem 0.35rem;
  text-align: center;
  font-weight: 650;
}

.app-calendar-month-grid .app-calendar-day-cell {
  height: 5.25rem;
  padding: 0.2rem !important;
  vertical-align: top;
  background-color: var(--theme-bg-surface);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.app-calendar-month-grid .app-calendar-day-cell--current {
  background-color: var(--theme-bg-selection) !important;
  box-shadow: inset 0 0 0 1px var(--theme-accent);
}

.app-calendar-month-grid .app-calendar-day-cell--selected {
  box-shadow: inset 0 0 0 2px var(--theme-accent-soft);
}

.app-calendar-month-grid .app-calendar-day-cell--current.app-calendar-day-cell--selected {
  box-shadow: inset 0 0 0 2px var(--theme-accent-soft), inset 0 0 0 4px var(--theme-bg-selection);
}

.app-calendar-day-link {
  min-height: 4.7rem;
  color: var(--theme-text-primary);
  border-radius: 0.3rem;
}

.app-calendar-day-link:hover {
  color: var(--theme-text-primary);
  background-color: var(--theme-bg-surface-hover);
}

.app-calendar-day-link:focus-visible {
  color: var(--theme-text-primary);
  outline: 2px solid var(--theme-accent);
  outline-offset: -2px;
}

.app-calendar-holiday-marker {
  color: var(--app-calendar-color, var(--theme-warning));
}

.app-calendar-color-badge {
  color: var(--theme-text-on-calendar-color);
  background-color: var(--app-calendar-color, var(--theme-text-secondary));
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.app-calendar-time-form {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.app-calendar-category-panel {
  background-color: var(--theme-bg-surface-muted);
}

.app-calendar-event-item + .app-calendar-event-item {
  border-top-color: var(--theme-card-border);
}

.app-calendar-event-item details > summary,
.app-calendar-version-details > summary {
  color: var(--theme-text-secondary);
  cursor: pointer;
}

.app-calendar-event-item details > summary:hover,
.app-calendar-version-details > summary:hover {
  color: var(--theme-accent-soft);
}

.app-calendar-version-form {
  background-color: var(--theme-bg-surface-muted);
}

.app-calendar-template-card .app-table th {
  white-space: nowrap;
}

.app-calendar-history-item {
  background-color: transparent !important;
}

/* Kalenderübersicht 1.8: breite Monatsfläche, kompakte Zeitsteuerung und Tagesdetails. */
.app-calendar-timebar {
  border-color: var(--theme-card-border);
  background: linear-gradient(115deg, var(--theme-bg-surface) 0%, var(--theme-bg-surface-muted) 100%);
}

.app-calendar-current-date {
  color: var(--theme-text-primary);
  font-size: clamp(1.45rem, 2.1vw, 2.15rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.app-calendar-time-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.app-calendar-inline-time-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.app-calendar-inline-time-form input[type="number"] {
  width: 5.25rem;
}

.app-calendar-rewind-control {
  position: relative;
}

.app-calendar-rewind-control > summary,
.app-calendar-event-create > summary {
  list-style: none;
  cursor: pointer;
}

.app-calendar-rewind-control > summary::-webkit-details-marker,
.app-calendar-event-create > summary::-webkit-details-marker {
  display: none;
}

.app-calendar-rewind-form {
  position: absolute;
  z-index: var(--app-z-index-local-overlay);
  top: 100%;
  right: 0;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.9rem;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.5rem;
  box-shadow: var(--theme-card-shadow, 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2));
}

.app-calendar-month-card {
  min-width: 0;
}

.app-calendar-month-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-calendar-detail-stack {
  min-width: 0;
}

.app-calendar-selected-day-card .card-body,
.app-calendar-selected-events-card .card-body {
  overflow-wrap: anywhere;
}

.app-calendar-selected-events-card .app-calendar-event-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-calendar-history-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  cursor: pointer;
}

.app-calendar-history-details > summary::-webkit-details-marker {
  display: none;
}

.app-calendar-history-details > summary:hover {
  background-color: var(--theme-bg-surface-hover);
}

.app-calendar-history-chevron {
  transition: transform 0.18s ease;
}

.app-calendar-history-details[open] .app-calendar-history-chevron {
  transform: rotate(180deg);
}

.app-calendar-history-details:focus-within > summary {
  outline: 2px solid var(--theme-accent);
  outline-offset: -2px;
}

@media (max-width: 991.98px) {
  .app-calendar-time-controls {
    justify-content: flex-start;
  }

  .app-calendar-month-actions {
    margin-top: 0.5rem;
    justify-content: flex-start;
  }
}

@media (max-width: 575.98px) {
  .app-calendar-inline-time-form {
    width: 100%;
  }

  .app-calendar-rewind-control {
    margin-left: auto;
  }

  .app-calendar-history-details > summary {
    align-items: flex-start;
  }
}

@media (max-width: 767.98px) {
  .app-page-header {
    min-height: 12.2rem;
    padding: 0.55rem 0.25rem 0.25rem;
  }

  .app-page-header-art img {
    object-position: 64% center;
    opacity: 0.82;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.92) 48%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.92) 48%, transparent 100%);
  }

  .app-page-header-art::after {
    background:
      linear-gradient(90deg, rgba(20, 27, 36, 0.48) 0%, rgba(20, 27, 36, 0.28) 55%, var(--theme-bg-content) 100%),
      linear-gradient(180deg, rgba(18, 24, 32, 0.12) 0%, rgba(39, 42, 47, 0.56) 100%);
  }

  .app-page-header-main {
    min-height: 8.75rem;
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.55rem;
    padding: 0.35rem 0 0.25rem;
  }

  .app-page-header-identity {
    width: 100%;
    align-items: center;
    gap: 0.75rem;
  }

  .app-page-header-icon {
    width: 2.8rem;
    height: 2.8rem;
    flex-basis: 2.8rem;
    font-size: 1.25rem;
  }

  .app-page-header-actions {
    width: 100%;
    min-width: 0;
    min-height: 2.1rem;
    justify-content: flex-start;
  }

  .app-page-header-actions.is-empty {
    display: flex;
  }

  .app-page-title {
    font-size: 1.42rem;
  }

  .app-page-description {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 0.76rem;
  }

  .app-page-breadcrumb-row {
    min-height: 2.35rem;
  }

  .app-calendar-month-grid {
    min-width: 34rem;
  }
}


@media (max-width: 575.98px) {
  .app-table-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-table-pagination-controls {
    width: 100%;
    justify-content: space-between;
  }

  .app-table-card-body > .app-table-toolbar {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .app-table-card-body > .app-table-pagination {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }
}


/* Calendar — readable event rows, consistent editor cards and shared date picker. */
.app-calendar-month-grid .app-calendar-day-cell {
  height: 7.4rem;
  padding: 0.18rem !important;
}
.app-calendar-day-link {
  min-height: 7rem;
  padding: 0.25rem !important;
  overflow: hidden;
}
.app-calendar-day-number { display: block; margin-bottom: 0.2rem; text-align: left; }
.app-calendar-day-event-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.12rem;
  width: 100%;
  max-height: 4.55rem;
  overflow: hidden;
}
.app-calendar-day-entry {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0.08rem 0.22rem;
  border-left: 3px solid var(--app-calendar-color, var(--theme-accent));
  border-radius: 0.18rem;
  background: color-mix(in srgb, var(--app-calendar-color, var(--theme-accent)) 20%, var(--theme-bg-surface));
  color: var(--theme-text-primary);
  font-size: 0.67rem;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-calendar-day-entry--holiday { border-left-width: 4px; font-weight: 700; }
.app-calendar-day-entry--holiday .bi { margin-right: 0.14rem; font-size: 0.68rem; vertical-align: 0.02em; }
.app-calendar-day-entry-overflow {
  display: block;
  padding: 0.03rem 0.2rem;
  color: var(--theme-text-secondary);
  font-size: 0.65rem;
  line-height: 1.15;
  text-align: left;
}
.app-calendar-extra-day-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 9rem;
  max-width: 16rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.45rem;
  color: var(--theme-text-primary);
  text-decoration: none;
  background: var(--theme-bg-surface);
}
.app-calendar-extra-day-card:hover { background: var(--theme-bg-surface-hover); color: var(--theme-text-primary); }
.app-calendar-extra-day-card.is-selected { border-color: var(--theme-accent); box-shadow: inset 0 0 0 1px var(--theme-accent); }
.app-calendar-extra-day-card .app-calendar-day-entry { max-width: 100%; }
.app-calendar-editor-item {
  display: block;
  padding: 0.9rem;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.55rem;
  background: var(--theme-bg-surface);
}
.app-calendar-editor-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.app-calendar-editor-item-heading strong { min-width: 0; }

.app-calendar-editor-item-heading-main,
.app-calendar-editor-item-order-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.app-calendar-editor-item-heading-main { min-width: 0; }
.app-calendar-editor-item-heading-main strong { overflow-wrap: anywhere; }
.app-calendar-editor-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding-inline: 0.25rem;
  cursor: grab;
  touch-action: none;
  text-decoration: none;
}
.app-calendar-editor-drag-handle:active { cursor: grabbing; }
.app-calendar-editor-order-button { min-width: 2rem; }
.app-calendar-editor-order-button:disabled { opacity: 0.35; cursor: not-allowed; }
.app-calendar-editor-item.is-calendar-row-dragging { opacity: 0.45; }
.app-calendar-editor-item.is-calendar-row-drop-target {
  border-color: var(--theme-accent);
  box-shadow: inset 0 0 0 1px var(--theme-accent);
}
@media (max-width: 575.98px) {
  .app-calendar-editor-item-heading { align-items: flex-start; }
  .app-calendar-editor-item-order-actions { gap: 0.2rem; }
  .app-calendar-editor-order-button { min-width: 1.85rem; padding-inline: 0.35rem; }
}
.app-calendar-date-boundary {
  padding: 0.75rem;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.45rem;
  background: var(--theme-bg-surface-hover);
}
.app-calendar-month-navigation {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 0;
  isolation: isolate;
}
.app-calendar-month-navigation > .btn {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 0 !important;
  padding-block: 0.25rem;
}
.app-calendar-month-navigation > .btn:first-child {
  border-top-left-radius: var(--bs-btn-border-radius, 0.375rem) !important;
  border-bottom-left-radius: var(--bs-btn-border-radius, 0.375rem) !important;
}
.app-calendar-month-navigation > .btn:last-child {
  border-top-right-radius: var(--bs-btn-border-radius, 0.375rem) !important;
  border-bottom-right-radius: var(--bs-btn-border-radius, 0.375rem) !important;
}
.app-calendar-month-navigation > .btn + .btn { margin-left: -1px; }
.app-calendar-month-nav-button {
  display: inline-flex;
  width: 2.45rem;
  min-width: 2.45rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1rem;
}
.app-calendar-month-nav-button .bi { font-size: 0.9rem; }
.app-calendar-month-today-button {
  min-width: 4.1rem;
  height: 2.25rem;
  padding-inline: 0.8rem;
  font-weight: 600;
}
.app-calendar-month-navigation > .btn:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
  box-shadow: none;
}
.app-calendar-date-picker-launcher {
  display: inline-flex;
  flex: 0 0 auto;
  margin: 0;
}
.app-calendar-date-picker-launcher .btn {
  display: inline-flex;
  width: 2.45rem;
  min-width: 2.45rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.app-calendar-picker-popover {
  position: fixed;
  z-index: var(--app-z-index-modal-overlay);
  width: min(var(--app-calendar-picker-width, 25.5rem), calc(100vw - 1.5rem));
  max-height: min(78vh, 43rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.75rem;
  background: var(--theme-bg-elevated, var(--theme-bg-surface));
  color: var(--theme-text-primary);
  box-shadow: 0 0.9rem 2.4rem rgba(0, 0, 0, 0.34), 0 0.2rem 0.65rem rgba(0, 0, 0, 0.2);
  animation: app-calendar-picker-enter 0.12s ease-out;
}
.app-calendar-picker-popover[hidden] { display: none !important; }
.app-calendar-picker-popover::before {
  position: absolute;
  top: -0.42rem;
  left: var(--aeterna-picker-anchor-x, 50%);
  width: 0.78rem;
  height: 0.78rem;
  border-top: 1px solid var(--theme-card-border);
  border-left: 1px solid var(--theme-card-border);
  background: var(--theme-bg-elevated, var(--theme-bg-surface));
  content: "";
  transform: translateX(-50%) rotate(45deg);
}
.app-calendar-picker-popover.is-above::before {
  top: auto;
  bottom: -0.42rem;
  border: 0;
  border-right: 1px solid var(--theme-card-border);
  border-bottom: 1px solid var(--theme-card-border);
}
.app-calendar-picker-shell { padding: 0.68rem; }
.app-calendar-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.28rem;
  margin-bottom: 0.35rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--theme-card-border);
}
.app-calendar-picker-close {
  display: inline-flex;
  flex: 0 0 1.95rem;
  align-items: center;
  justify-content: center;
  width: 1.95rem;
  min-height: 1.95rem;
  padding: 0.2rem;
  border: 1px solid transparent;
  color: var(--theme-text-secondary);
  background: transparent;
}
.app-calendar-picker-close:hover,
.app-calendar-picker-close:focus-visible {
  border-color: var(--theme-card-border);
  color: var(--theme-text-primary);
  background: var(--theme-bg-surface-hover);
}
.app-calendar-picker-nav { display: inline-flex; flex: 0 0 2.1rem; align-items: center; justify-content: center; min-height: 2rem; padding: 0.2rem; }
.app-calendar-picker-headings { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; justify-content: center; gap: 0.2rem; }
.app-calendar-picker-heading {
  min-width: 0;
  padding: 0.28rem 0.38rem;
  border: 0;
  border-radius: 0.35rem;
  color: var(--theme-text-primary);
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
}
.app-calendar-picker-heading:hover,
.app-calendar-picker-heading:focus-visible { color: var(--theme-accent); background: var(--theme-bg-surface-hover); }
.app-calendar-picker-status {
  min-height: 1rem;
  margin: 0.05rem 0 0.5rem;
  color: var(--theme-text-secondary);
  font-size: 0.76rem;
  line-height: 1.35;
}
.app-calendar-picker-body { min-width: 0; }
.app-calendar-picker-weekdays,
.app-calendar-picker-days {
  display: grid;
  grid-template-columns: repeat(var(--picker-columns, 7), minmax(0, 1fr));
  gap: 0.28rem;
}
.app-calendar-picker-weekdays { margin-bottom: 0.28rem; }
.app-calendar-picker-weekday {
  min-width: 0;
  padding: 0.32rem 0.08rem;
  color: var(--theme-text-secondary);
  font-size: 0.7rem;
  font-weight: 650;
  text-align: center;
  overflow-wrap: anywhere;
}
.app-calendar-picker-day,
.app-calendar-picker-blank {
  display: flex;
  min-width: 0;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: 0.45rem;
}
.app-calendar-picker-day {
  border: 1px solid transparent;
  background: transparent;
  color: var(--theme-text-primary);
  font-size: 0.84rem;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.app-calendar-picker-day:hover { border-color: var(--theme-accent); background: var(--theme-bg-surface-hover); }
.app-calendar-picker-day:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 1px; }
.app-calendar-picker-day.is-selected,
.app-calendar-picker-day.is-from,
.app-calendar-picker-day.is-to {
  border-color: var(--theme-accent);
  background: var(--theme-bg-selection);
  box-shadow: inset 0 0 0 1px var(--theme-accent);
  color: var(--theme-text-primary);
  font-weight: 750;
}
.app-calendar-picker-day.is-in-range { border-radius: 0.3rem; background: color-mix(in srgb, var(--theme-accent) 18%, var(--theme-bg-surface)); }
.app-calendar-picker-month-list,
.app-calendar-picker-year-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
}
.app-calendar-picker-month,
.app-calendar-picker-year {
  display: flex;
  min-width: 0;
  min-height: 3.2rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0.35rem;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.5rem;
  color: var(--theme-text-primary);
  background: var(--theme-bg-surface);
  text-align: center;
}
.app-calendar-picker-month span { color: var(--theme-text-secondary); font-size: 0.7rem; }
.app-calendar-picker-month:hover,
.app-calendar-picker-year:hover,
.app-calendar-picker-month.is-selected,
.app-calendar-picker-year.is-selected { border-color: var(--theme-accent); background: var(--theme-bg-surface-hover); }
.app-calendar-picker-extra-days {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--theme-card-border);
}
.app-calendar-picker-extra-group { margin-bottom: 0.55rem; }
.app-calendar-picker-extra-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.app-calendar-picker-extra-group .app-calendar-picker-day {
  min-width: 2.25rem;
  min-height: 2.1rem;
  padding: 0.25rem 0.6rem;
  aspect-ratio: auto;
  border: 1px solid var(--theme-card-border);
}
.app-calendar-picker-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.75rem -0.9rem -0.9rem;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--theme-card-border);
  background: var(--theme-bg-surface-hover);
}
@keyframes app-calendar-picker-enter {
  from { opacity: 0; transform: translateY(-0.25rem) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 767.98px) {
  .app-calendar-day-event-list { max-height: 3.8rem; }
  .app-calendar-month-grid .app-calendar-day-cell { height: 6.5rem; }
  .app-calendar-day-link { min-height: 6.1rem; }
  .app-calendar-month-actions { width: 100%; justify-content: space-between; }
  .app-calendar-month-navigation { flex: 0 0 auto; gap: 0; }
  .app-calendar-month-navigation .btn { flex: 0 0 auto; white-space: nowrap; }
  .app-calendar-month-nav-button { width: 2.4rem; min-width: 2.4rem; }
  .app-calendar-date-picker-launcher { flex: 0 0 auto; }
}
.app-calendar-day-entry--birthday { border-left-width: 4px; font-weight: 650; }
.app-calendar-day-entry--birthday .bi { margin-right: 0.2rem; font-size: 0.62rem; }

/* Shared Entity Chip Picker ------------------------------------------------ */
.app-entity-chip-picker {
  position: relative;
  min-width: 0;
}
.app-entity-chip-picker__heading { margin-bottom: 0.65rem; }
.app-entity-chip-picker__selected {
  display: flex;
  min-height: 2.25rem;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}
.app-entity-chip-picker__empty-selection {
  color: var(--theme-text-secondary);
  font-size: 0.86rem;
  font-style: italic;
}
.app-entity-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 1.9rem;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.35rem 0.12rem 0.7rem;
  border: 1px solid var(--theme-border-info);
  border-radius: 999px;
  background: var(--theme-bg-info-subtle);
  color: var(--theme-text-primary);
  font-size: 0.84rem;
  line-height: 1.35;
}
.app-entity-chip__label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.app-entity-chip__remove {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--theme-text-secondary);
}
.app-entity-chip__remove:hover,
.app-entity-chip__remove:focus-visible {
  background: var(--theme-bg-surface-hover);
  color: var(--theme-text-primary);
}
.app-entity-chip__remove:focus-visible,
.app-entity-chip-picker__result:focus-visible,
.app-entity-chip-picker__results-footer button:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}
.app-entity-chip-picker__search-wrap { position: relative; }
.app-entity-chip-picker__results {
  position: absolute;
  z-index: var(--app-z-index-dropdown);
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  max-height: 19rem;
  overflow: auto;
  border: 1px solid var(--theme-card-border);
  border-radius: 0.55rem;
  background: var(--theme-bg-surface-raised);
  box-shadow: 0 0.65rem 1.6rem var(--theme-shadow);
}
.app-entity-chip-picker__results--portal {
  position: fixed !important;
  z-index: var(--app-z-index-modal-overlay);
  top: auto;
  right: auto;
  bottom: auto;
  left: 0;
  margin: 0;
}
.app-entity-chip-picker__results[hidden],
.app-entity-chip-picker__results-footer[hidden] { display: none !important; }
.app-entity-chip-picker__results-list { padding: 0.3rem; }
.app-entity-chip-picker__result {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--theme-text-primary);
  text-align: left;
}
.app-entity-chip-picker__result:hover,
.app-entity-chip-picker__result[aria-selected="true"] {
  border-color: var(--theme-card-border);
  background: var(--theme-bg-surface-hover);
}
.app-entity-chip-picker__result-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.12rem;
}
.app-entity-chip-picker__result-label {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 600;
}
.app-entity-chip-picker__result-subtitle {
  color: var(--theme-text-secondary);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}
.app-entity-chip-picker__result-icon {
  flex: 0 0 auto;
  color: var(--theme-accent-soft);
}
.app-entity-chip-picker__empty-results,
.app-entity-chip-picker__loading {
  padding: 0.85rem 0.75rem;
  color: var(--theme-text-secondary);
  font-size: 0.85rem;
  text-align: center;
}
.app-entity-chip-picker__results-footer {
  padding: 0.45rem;
  border-top: 1px solid var(--theme-card-border);
  background: var(--theme-bg-surface-muted);
}
.app-entity-chip-picker__status:empty { display: none; }
.app-entity-chip-picker.is-saving { opacity: 0.8; }
.app-entity-chip-picker.is-saving .app-entity-chip-picker__search-wrap { cursor: progress; }
.app-entity-chip-picker.is-readonly .app-entity-chip-picker__selected { margin-bottom: 0; }
@media (max-width: 575.98px) {
  .app-entity-chip-picker__results { max-height: 15rem; }
}
