/**
 * Backoffice scroll affordance contract.
 * Loaded late on manager /super/ and /admin/ (operator + tenant) so the actual
 * scroll root is visible, stable, and protected from older shell overlays.
 */

body.control-plane-shell[data-rmc-cp-scroll="canvas"] .rmc-app-shell,
body.admin-manager-shell[data-rmc-cp-scroll="canvas"] .rmc-app-shell,
body.admin-premium-shell[data-rmc-cp-scroll="canvas"] .rmc-app-shell {
  min-height: 0 !important;
  max-height: var(--rmc-iso-viewport-h, 100dvh) !important;
}

/* Floor EVERY backoffice /admin/ canvas shell at the viewport — tenant
   (admin-premium-shell) AND operator (admin-manager-shell / control-plane-shell).
   The `min-height:0` above lets the 1fr canvas shrink so #cp-main-content owns the
   scroll. The manager + control-plane shells also receive a `height:100% !important`
   companion rule (rmc-shell-scroll-contract.css / admin-cp-parity.css) and the tenant
   premium shell never did — but a headless-browser audit proved that companion is
   INEFFECTIVE anyway: neither `height:100%` nor the shell's own `height:100dvh` can
   stretch a CSS grid whose <body> height is indefinite, so on a SHORT change/list page
   ALL THREE shells collapsed to content height and stranded the pinned grid-row-3
   footer with a dark void beneath it (measured: 872px shell in a 1080px viewport →
   208px void, on both the tenant AND operator /admin/). A viewport-unit `min-height`
   fills the shell where `height`/`height:100%` cannot. NO-OP on long pages — the
   `max-height` above pins them, so min == max == the viewport and #cp-main-content
   keeps its internal scroll. Specificity (0,5,2) beats the `min-height:0` /
   `height:100%` rules regardless of sheet order. */
html[data-rmc-admin-html="unfold"] body.admin-premium-shell[data-rmc-cp-scroll="canvas"] [data-rmc-shell-root="django-admin"].rmc-app-shell,
html[data-rmc-admin-html="unfold"] body.admin-manager-shell[data-rmc-cp-scroll="canvas"] [data-rmc-shell-root="django-admin"].rmc-app-shell,
html[data-rmc-admin-html="unfold"] body.control-plane-shell[data-rmc-cp-scroll="canvas"] [data-rmc-shell-root="django-admin"].rmc-app-shell {
  min-height: var(--rmc-iso-viewport-h-fallback, 100vh) !important;
  min-height: var(--rmc-iso-viewport-h, 100dvh) !important;
}

/* /super/: the canvas owns chrome; the canvas body is the page scroller. */
body.control-plane-shell[data-rmc-cp-scroll="canvas"] .rmc-app-shell__canvas {
  overflow: hidden !important;
  min-height: 0 !important;
}

body.control-plane-shell[data-rmc-cp-scroll="canvas"] .rmc-app-shell__canvas-body {
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ...and ONLY the canvas body. Its flow children are content-height
   (rmc-canvas-chrome-compact.css) but carried flex-shrink:1, so the flex column
   squeezed #cp-main-content to the viewport and it scrolled on its own: two nested
   scrollers, two scrollbar gutters stacked beside the copilot rail. Not on /admin/,
   where #cp-main-content IS the scroller (next rule). */
body.control-plane-shell[data-rmc-cp-scroll="canvas"]:not(.admin-manager-shell) .rmc-app-shell__canvas-body > .cp-layout,
body.control-plane-shell[data-rmc-cp-scroll="canvas"]:not(.admin-manager-shell) .rmc-app-shell__canvas-body #cp-main-content {
  flex-shrink: 0 !important;
}

/* /admin/ (manager + tenant): canvas owns chrome; #cp-main-content is the page scroller. */
body.admin-manager-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page .rmc-app-shell__canvas,
body.admin-premium-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page .rmc-app-shell__canvas {
  min-height: 0 !important;
  overflow: hidden !important;
}

body.admin-manager-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page #cp-main-content.cp-admin-canvas-main,
body.admin-premium-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page #cp-main-content.cp-admin-canvas-main {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.admin-manager-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page .cp-admin-page-body,
body.admin-premium-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page .rmc-tenant-admin-page-body,
body.control-plane-shell[data-rmc-cp-scroll="canvas"] .cp-page-body {
  width: 100%;
  max-width: none;
  min-width: 0;
}

body.admin-manager-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page #content,
body.admin-premium-shell[data-rmc-cp-scroll="canvas"] .admin-cp-unified-page #content,
body.control-plane-shell[data-rmc-cp-scroll="canvas"] #cp-main-content {
  min-width: 0;
  max-width: none;
}

/* Scrollbar PAINT removed 2026-09-18 (the whole block, the four
   --rmc-backoffice-scrollbar-* custom properties and the coarse-pointer size
   override with it). audit §9 row 9 said keep this file unchanged, on the
   reading that it was already the best paint in the survey -- and its 62%
   --text-tertiary mix IS the figure rmc-scrollbar.css arrived at
   independently. The browser census overruled that on two counts:

     1. declaring the STANDARD properties here disabled the shared
        ::-webkit-scrollbar pill on these elements in Chromium >=121 (audit
        §7.1), so the operator page scroller rendered a 15px classic bar
        instead of the 11px pill; and
     2. measured from the pixels, the light-theme thumb was 2.64:1 against its
        own track -- under the 3:1 a non-text UI component needs. The shared
        owner reads --admin-content-text-muted, which resolves DARKER than
        --text-tertiary in light, and measures above 3:1.

   Everything else in this file -- the scroll-ownership contract, the
   scrollbar-gutter reservations, and the documented viewport-unit min-height
   fix for the grid + indefinite body height bug -- is unchanged. */
  
