/* Stable management menu + natural desktop sidebar flow.
 * Desktop: the sidebar no longer owns a viewport-height scrollbar. It grows
 * with its content, so lower menu items are reached with the page's normal
 * scroll instead of a second, nested sidebar scroll.
 * Mobile/tablet: existing accordion behavior is preserved.
 */
.sidebar__group-panel {
  display: block !important;
}

.sidebar__group-panel-inner {
  display: grid !important;
  gap: 2px !important;
  min-height: 0;
}

@media (min-width:1161px) {
  /*
   * Natural document flow on desktop.
   * Previous versions forced the sidebar to exactly 100vh/100dvh and made the
   * ASIDE itself scrollable. On screens such as 1366x768/1920x1080 this made
   * the bottom of the menu feel "locked" and required a separate scrollbar.
   * Let the sidebar be as tall as its content; the browser/page scroll now
   * reveals the remaining menu items naturally.
   */
  .sidebar {
    display: block !important;
    position: relative !important;
    top: auto !important;
    align-self: stretch !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    scrollbar-gutter: auto;
    box-sizing: border-box !important;
  }

  .sidebar__header {
    position: relative !important;
    top: auto !important;
    flex: none !important;
    min-height: auto !important;
  }

  /* Nav participates in the same page flow and never owns its own scrollbar. */
  .sidebar__nav {
    display: flex !important;
    flex-direction: column !important;
    flex: none !important;
    min-height: max-content !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    padding-bottom: 32px !important;
    box-sizing: border-box !important;
  }

  .sidebar__group--management .sidebar__group-panel,
  .sidebar__group--management.is-open .sidebar__group-panel {
    display: block !important;
    max-height: none !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    padding-top: 4px !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  .sidebar__group--management .sidebar__group-panel-inner {
    display: grid !important;
    grid-template-rows: none !important;
    max-height: none !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
  }

  .sidebar__group--management {
    flex: none !important;
  }

  /* Desktop management is a persistent section, not a collapsing accordion. */
  .sidebar__group-toggle {
    cursor: default !important;
  }

  .sidebar__group-toggle > .fa-chevron-up,
  .sidebar__group-toggle > .fa-chevron-down {
    display: none !important;
  }
}

@media (max-width:1160px) {
  .sidebar__group-panel {
    max-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
    padding-top: 0 !important;
    transition: max-height .22s ease, opacity .16s ease, padding-top .18s ease !important;
  }

  .sidebar__group--management.is-open .sidebar__group-panel {
    max-height: 420px !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding-top: 4px !important;
  }
}
