
#sidebar-second-menu-wrapper {
    height: 100%;
    width: 200px;
    position: fixed;
    top: 56px;
    z-index: 999;
    background: #fafafa;
    font-size: 11px;
    border-right: 1px solid #ccc;
}

@media (min-width: 720px) {
    #page-content-wrapper {
        margin-left: 4.5rem;
    }
    #sidebar-second-menu-wrapper {
        margin-left: 4.3rem;
        top: 56px;
    }
}


#sidebar-second-menu-content {
    margin-top: 24px;
}


.sidebar-second-menu-list-group {
    border-radius: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.sidebar-second-menu-list-group > .list-group-item + .list-group-item,
.sidebar-second-menu-list-group > a + a,
.sidebar-second-menu-list-group > a + button,
.sidebar-second-menu-list-group > button + a,
.sidebar-second-menu-list-group > .collapse + a,
.sidebar-second-menu-list-group > .collapse + button,
.sidebar-second-menu-list-group > div + a,
.sidebar-second-menu-list-group > div + button {
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.sidebar-second-menu-list-group-items {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    border: 0;
    color: #424242;
}

.sidebar-second-menu-list-group-items--header {
    border: none;
    padding-left: 0.9rem;
}

.sidebar-second-menu-list-group-items.active-url {
    background-color: #e3f2fd !important;
    color: #424242;
}

.sidebar-second-menu-link:hover {
    background: rgba(227, 242, 253, 1) !important;
    color: inherit !important;
}

.sidebar-second-menu-content-list {
    max-height: 85vh;
    overflow-y: auto;
}

#sidebar-second-menu-wrapper.visible {
    display: block !important;
}

/* CORE.FEATURES.USE_APP2_FRONTEND2 — second sidebar widens to 256px and
   shifts to white background to match frontend2's `w-64 bg-surface-0` aside. */
.use-app2-frontend2 #sidebar-second-menu-wrapper {
  top: 0 !important;
  width: 256px !important;
  height: 100vh !important;
  background: #ffffff !important;
  border-right: 1px solid rgb(226 232 240) !important; /* slate-200 */
  margin-left: 60px !important;
  /* Wrapper owns the scroll in app2 mode (matches frontend2's `h-full
     overflow-y-auto` nav inside the second-sidebar aside). The inner
     `.sidebar-second-menu-content-list` keeps `max-height: none` below
     because its legacy `85vh` cap clipped long menus; without a scroll
     container above it, the wrapper just hid the overflow. */
  overflow-y: auto !important;
  /* Scroll but hide the scrollbar — matches the rail/second-sidebar look
     in the frontend2 and Quasar (`/app/`) shells. */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge / IE */
  /* Smooth width / margin transition when toggled via `.sb-collapse-btn`. */
  transition:
    width 0.22s ease,
    padding 0.22s ease,
    border-color 0.22s ease;
}
.use-app2-frontend2 #sidebar-second-menu-wrapper::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none; /* Chrome / Safari / Edge */
}

/* Smooth margin transition on the main content too, so it animates in
   lockstep with the sidebar collapsing/expanding. */
.use-app2-frontend2 #page-content-wrapper {
  transition: margin-left 0.22s ease;
}

/* Collapsed state — second sidebar shrinks to width 0 and the main
   content reclaims the freed space. State is driven by `body.sb-collapsed`
   set from an inline script that reads `localStorage.gf-sb-collapsed`.
   Same key + class are shared with the frontend2 (`/app2/`) and Quasar
   (`/app/`) shells, so toggling on one stack persists into the others.

   `overflow: visible` is required so the chevron button (absolute,
   `right: -22px`) protrudes past the zero-width wrapper and stays
   clickable. Inner content is hidden via `opacity: 0` below, so allowing
   overflow has no visual cost. */
body.sb-collapsed .use-app2-frontend2 #sidebar-second-menu-wrapper {
  width: 0 !important;
  padding: 0 !important;
  border-right: 0 !important;
  overflow: visible !important;
}
body.sb-collapsed
  .use-app2-frontend2
  #sidebar-second-menu-wrapper
  > *:not(.sb-collapse-btn) {
  opacity: 0;
  pointer-events: none;
}
body.sb-collapsed
  .use-app2-frontend2
  #sidebar-second-menu-wrapper.visible
  ~ #page-content-wrapper {
  margin-left: 60px !important; /* just the rail; second sidebar collapsed */
}

/* Chevron toggle button — same skin as the frontend2 + Quasar shells.
   Appended to `document.body` (not the second-sidebar wrapper) so it
   isn't clipped by the wrapper's overflow-y:auto — per CSS spec, when
   overflow-y is `auto` the browser computes overflow-x as `auto` too,
   which clips horizontally protruding absolute children. Fixed
   positioning sidesteps that entirely. Hidden below md so mobile keeps
   its current behavior unchanged. */
.sb-collapse-btn {
  position: fixed;
  top: 14px;
  left: 304px; /* 60 (rail) + 256 (sidebar) - 12 (overhang) */
  z-index: 1001; /* above wrapper's z-index: 999 */
  /*
   * Visible at every viewport size — the rail + second sidebar are
   * fixed-left at all sizes, so the user always needs the chevron
   * toggle to collapse the second sidebar and reclaim width. (The old
   * `display: none` + `@media (min-width: 768px) { display: inline-flex }`
   * gate hid the button on phones, where the rail used to disappear so
   * collapse made no sense — that's no longer the case.)
   */
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #ffffff;
  color: #3d3550;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.08);
  cursor: pointer;
  transition:
    transform 0.22s ease,
    left 0.22s ease,
    background 0.15s ease;
}
.sb-collapse-btn:hover {
  background: #f3f4f6;
  color: #1b2b5e;
}
.sb-collapse-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.sb-collapsed .sb-collapse-btn {
  transform: rotate(180deg);
  left: 60px; /* just past the rail's right edge */
}
.use-app2-frontend2 #sidebar-second-menu-content {
  margin-top: 0 !important;
}
/* Lift the legacy `max-height: 85vh` constraint so the list spans the full
   viewport height of the rail/sidebar shell, matching frontend2's
   full-height aside. Keep `overflow-y: auto` for long menus. */
.use-app2-frontend2 .sidebar-second-menu-content-list {
  max-height: none !important;
}
/*
 * Page content wrapper consumes the remaining viewport width after the
 * rail (60px) and the second sidebar (256px). Setting `max-width`
 * alongside `margin-left` is what stops the wrapper from blowing past
 * the viewport right edge on small screens — without it, `margin-left`
 * just shifts a full-width block right, producing a horizontal scrollbar
 * on tablets and phones. The wrapper itself owns the horizontal scroll
 * so wide page content (tables, etc.) scrolls internally rather than
 * the whole window.
 */
.use-app2-frontend2 #sidebar-second-menu-wrapper.visible ~ #page-content-wrapper,
.use-app2-frontend2 #page-content-wrapper {
  margin-left: 60px !important;
  max-width: calc(100vw - 60px) !important;
  overflow-x: auto;
}
.use-app2-frontend2 #sidebar-second-menu-wrapper.visible ~ #page-content-wrapper {
  margin-left: 316px !important; /* 60 (rail) + 256 (second sidebar) */
  max-width: calc(100vw - 316px) !important;
}
/*
 * When the user collapses the second sidebar via the chevron toggle,
 * the wrapper reclaims the freed 256px so content can expand. Mirrors
 * the existing `margin-left: 60px` override above (which already targets
 * the collapsed state) — just adds the matching `max-width` so the
 * right edge tracks the new layout.
 */
body.sb-collapsed
  .use-app2-frontend2
  #sidebar-second-menu-wrapper.visible
  ~ #page-content-wrapper {
  max-width: calc(100vw - 60px) !important;
}