/* RG COMPANY — Full-width Cabinet Footer + Compact Contacts V21.3.1
   The cabinet occupies at least one full viewport. The main-site footer is
   outside the sidebar layout and appears only after scrolling down. */

body.cabinet-body #app {
  width: 100% !important;
  min-width: 0 !important;
  overflow: visible !important;
}

/* Keep the footer below the initial viewport even on short cabinet pages. */
body.cabinet-body #app > .admin-layout {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100dvh !important;
  margin: 0 !important;
}

/* The desktop sidebar remains visible while the cabinet is viewed, but stops
   at the end of the cabinet layout instead of covering the global footer. */
@media (min-width: 921px) {
  body.cabinet-body #app > .admin-layout > .sidebar {
    position: sticky !important;
    top: 0 !important;
    bottom: auto !important;
    align-self: start !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
  }
}

/* Remove any old in-shell footer left by cached V21.0/V21.1 styles. */
body.cabinet-body #app > .admin-layout .main-shell > .site-footer {
  display: none !important;
}

/* Full-width footer begins after the complete cabinet, including the sidebar. */
body.cabinet-body #app > .site-footer.cabinet-global-footer {
  position: relative !important;
  z-index: 30 !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding-left: max(24px, env(safe-area-inset-left)) !important;
  padding-right: max(24px, env(safe-area-inset-right)) !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-radius: 32px 32px 0 0 !important;
  box-sizing: border-box !important;
}

/* Keep the original main-site proportions while letting the background span
   the entire browser width. */
body.cabinet-body #app > .site-footer.cabinet-global-footer > .footer-grid,
body.cabinet-body #app > .site-footer.cabinet-global-footer > .footer-bottom {
  width: min(100%, 1280px) !important;
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* A little breathing room before the footer, so it cannot peek into the first
   screen because of browser rounding or mobile address-bar resizing. */
body.cabinet-body #app > .admin-layout::after {
  content: "" !important;
  display: block !important;
  width: 1px !important;
  height: 28px !important;
  grid-column: 1 / -1 !important;
  pointer-events: none !important;
}

/* The footer is a page section, not a card floating inside the cabinet. */
body.cabinet-body #app > .site-footer.cabinet-global-footer {
  box-shadow:
    0 -16px 48px color-mix(in srgb, #000 5%, transparent),
    inset 0 1px color-mix(in srgb, var(--cab-text) 4%, transparent) !important;
}

/* Mobile side menu remains an overlay only while opened. */
@media (max-width: 920px) {
  body.cabinet-body #app > .admin-layout {
    min-height: 100svh !important;
  }

  body.cabinet-body #app > .site-footer.cabinet-global-footer {
    padding-left: max(18px, env(safe-area-inset-left)) !important;
    padding-right: max(18px, env(safe-area-inset-right)) !important;
    border-radius: 24px 24px 0 0 !important;
  }
}

@media (max-width: 520px) {
  body.cabinet-body #app > .admin-layout::after {
    height: 18px !important;
  }

  body.cabinet-body #app > .site-footer.cabinet-global-footer {
    padding-left: max(14px, env(safe-area-inset-left)) !important;
    padding-right: max(14px, env(safe-area-inset-right)) !important;
    border-radius: 20px 20px 0 0 !important;
  }
}
