/**
 * Dual-dashboard topology — viewport-stable operational cockpits.
 * Prevents hidden footer actions and clipped chart panels across breakpoints.
 */

html[data-rmc-shell-root="portal"],
html[data-rmc-shell-root="backend"],
html[data-rmc-premium-shell="portal"] {
  height: 100%;
}

/* Document scroll: let html grow with body (sticky chrome + sidebar need this). */
html[data-rmc-shell-root="control-plane-skeleton"]:has(
    body.control-plane-shell[data-rmc-cp-scroll="document"]
  ),
html[data-rmc-shell-root="control-plane-skeleton"]:has(
    body.admin-manager-shell[data-rmc-cp-scroll="document"]
  ) {
  height: auto;
  min-height: 100%;
}

body.control-plane-shell:not([data-rmc-cp-scroll="document"]),
body.portal-shell-body,
body.backend-shell-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.control-plane-shell[data-rmc-cp-scroll="document"],
body.portal-body-with-layout[data-rmc-cp-scroll="document"],
body.backend-shell[data-rmc-cp-scroll="document"] {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  overflow-y: auto;
  height: auto;
  max-height: none;
}

/* Manager /admin/: main-column scroll inside .admin-cp-unified-page (see admin-cp-parity.css). */
body.control-plane-shell[data-rmc-cp-scroll="main"] {
  overflow: hidden !important;
  height: 100vh;
  max-height: 100vh;
}

body.control-plane-shell:not([data-rmc-cp-scroll="document"]) .cp-shell-content,
body:not([data-rmc-cp-scroll="document"]) [data-rmc-shell-main-scroll],
body:not([data-rmc-cp-scroll="document"]) #dashboard-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.rmc-dashboard-widget-boundary {
  min-height: 8rem;
  display: flex;
  flex-direction: column;
}

.rmc-dashboard-widget-boundary__error {
  padding: 1rem;
  border-radius: var(--radius-md, 0.5rem);
  border: 1px solid var(--hairline, rgba(0, 0, 0, 0.12));
  background: var(--surface-elevated, #fff);
}

.rmc-viz-error-fallback__actions {
  margin-top: 0.75rem;
}

/* Viewport-safe chrome: profile / theme / logout stay in scrollport */
[data-rmc-shell-viewport-safe="1"] {
  max-width: 100%;
}

@media (max-width: 320px), (min-width: 768px), (min-width: 1440px) {
  .user-dropdown-wrapper[data-rmc-shell-viewport-safe="1"] .dropdown-menu {
    max-height: min(70vh, 28rem);
    overflow-y: auto;
  }
}
