/* Keep the admin chrome inside the visible viewport, including unfolded touch devices. */
html.admin-viewport-locked,
body.admin-viewport-locked {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
}

html.admin-viewport-locked #app {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overflow: clip;
}

html.admin-viewport-locked .admin-shell {
  position: fixed;
  inset: auto;
  top: var(--admin-viewport-top, 0px);
  left: var(--admin-viewport-left, 0px);
  width: var(--admin-viewport-width, 100%);
  height: var(--admin-viewport-height, 100dvh);
  min-height: 0;
  max-height: var(--admin-viewport-height, 100dvh);
  overflow: hidden;
  overflow: clip;
}

html.admin-viewport-locked .admin-shell > .el-container {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  overflow: clip;
}

html.admin-viewport-locked .admin-aside {
  height: 100%;
  min-height: 0;
}

html.admin-viewport-locked .admin-main {
  height: 0 !important;
  min-height: 0;
  flex: 1 1 0 !important;
  overflow-y: auto !important;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}

html.admin-viewport-locked body.el-popup-parent--hidden .admin-main {
  overflow: hidden !important;
}

/* Fallback before the runtime starts on narrow layouts. Wide desktops stay unchanged. */
@media (max-width: 1100px) {
  html .admin-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    overflow: hidden;
    overflow: clip;
  }

  html .admin-shell > .el-container {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    overflow: clip;
  }
}
