/*
 * rmc-platform-workspace-edge-fit.css
 * Platform + tenant workspace edge-fit contract.
 *
 * Purpose: make authenticated work surfaces use the full width between the
 * fixed left navigation rail and the right tools/copilot rail, matching the
 * manager globe deck preview without changing the chrome rails themselves.
 */

:root {
  /* Comfortable, responsive workspace gutter. This was a 2px "full-bleed seal"
     that left cards / KPIs / headings kissing the navigation rail and the viewport
     edge — content visibly bled out of the surface on tenant Admin Home and across
     the authenticated shells. A scaled gutter (12px on phones → 24px on wide
     desktops) reads as intentional, professional spacing at every width without
     reintroducing a narrow reading column, so surfaces still fill the space between
     the rails but no longer bleed to the very edge. */
  --rmc-workspace-edge-gap: clamp(12px, 1.5vw, 24px);
  --rmc-workspace-mobile-gap: 12px;
}

/* Manager / control-plane shells. */
body.control-plane-shell .rmc-app-shell__canvas-body,
body.control-plane-shell .rmc-shell-canvas-container,
body.control-plane-shell .cp-layout,
body.control-plane-shell #cp-main-content,
body.control-plane-shell .cp-page-body,
body.control-plane-shell [data-rmc-cp-page-body="1"],
.rmc-app-shell.admin-manager-shell.control-plane-shell .rmc-app-shell__canvas-body,
.rmc-app-shell.admin-manager-shell.control-plane-shell #cp-main-content,
.rmc-app-shell.admin-manager-shell.control-plane-shell .cp-page-body,
.rmc-app-shell.admin-manager-shell.control-plane-shell [data-rmc-cp-page-body="1"] {
  width: 100%;
  max-width: none !important;
  min-width: 0;
}

body.control-plane-shell .rmc-app-shell__canvas-body,
.rmc-app-shell.admin-manager-shell.control-plane-shell .rmc-app-shell__canvas-body {
  padding-inline: var(--rmc-workspace-edge-gap) !important;
}

body.control-plane-shell .cp-layout.rmc-shell-canvas-container,
body.control-plane-shell .cp-layout.container-fluid {
  padding-inline: 0 !important;
  margin-inline: 0 !important;
}

body.control-plane-shell #cp-main-content {
  padding-inline: 0 !important;
  margin-inline: 0 !important;
}

body.control-plane-shell .cp-page-body {
  padding-inline: 0 !important;
  margin-inline: 0 !important;
}

.rmc-app-shell.admin-manager-shell.control-plane-shell #cp-main-content,
.rmc-app-shell.admin-manager-shell.control-plane-shell .cp-page-body,
.rmc-app-shell.admin-manager-shell.control-plane-shell [data-rmc-cp-page-body="1"] {
  padding-inline: 0 !important;
  margin-inline: 0 !important;
}

body.control-plane-shell .cp-page-body > .container,
body.control-plane-shell .cp-page-body > .container-fluid,
body.control-plane-shell #cp-main-content > .container,
body.control-plane-shell #cp-main-content > .container-fluid,
.rmc-app-shell.admin-manager-shell.control-plane-shell .cp-page-body > .container,
.rmc-app-shell.admin-manager-shell.control-plane-shell .cp-page-body > .container-fluid,
.rmc-app-shell.admin-manager-shell.control-plane-shell #cp-main-content > .container,
.rmc-app-shell.admin-manager-shell.control-plane-shell #cp-main-content > .container-fluid {
  width: 100% !important;
  max-width: none !important;
  padding-inline: var(--rmc-workspace-mobile-gap);
  margin-inline: 0 !important;
}

@media (min-width: 992px) {
  body.control-plane-shell .cp-page-body > .container,
  body.control-plane-shell .cp-page-body > .container-fluid,
  body.control-plane-shell #cp-main-content > .container,
  body.control-plane-shell #cp-main-content > .container-fluid,
  .rmc-app-shell.admin-manager-shell.control-plane-shell .cp-page-body > .container,
  .rmc-app-shell.admin-manager-shell.control-plane-shell .cp-page-body > .container-fluid,
  .rmc-app-shell.admin-manager-shell.control-plane-shell #cp-main-content > .container,
  .rmc-app-shell.admin-manager-shell.control-plane-shell #cp-main-content > .container-fluid {
    padding-inline: var(--rmc-workspace-edge-gap);
  }
}

/* Tenant authenticated portal shells. */
body.portal-body-with-layout:not(.control-plane-shell) .portal-layout-wrap,
body.portal-body-with-layout:not(.control-plane-shell) .portal-layout-row,
body.portal-body-with-layout:not(.control-plane-shell) #main-content,
body.portal-body-with-layout:not(.control-plane-shell) .portal-main-col,
body.portal-body-with-layout:not(.control-plane-shell) .page-wrap,
body.portal-body-with-layout:not(.control-plane-shell) .rmc-shell-canvas-container {
  width: 100%;
  max-width: none !important;
  min-width: 0;
}

body.portal-body-with-layout:not(.control-plane-shell) .portal-layout-wrap {
  padding-inline: var(--rmc-workspace-mobile-gap) !important;
}

body.portal-body-with-layout:not(.control-plane-shell) .portal-main-col,
body.portal-body-with-layout:not(.control-plane-shell) #main-content {
  padding-inline: 0 !important;
}

body.portal-body-with-layout:not(.control-plane-shell) .page-wrap.rmc-shell-canvas-container {
  padding-inline: 0 !important;
  margin-inline: 0 !important;
}

body.portal-body-with-layout:not(.control-plane-shell) .page-wrap > .container,
body.portal-body-with-layout:not(.control-plane-shell) .page-wrap > .container-fluid,
body.portal-body-with-layout:not(.control-plane-shell) #main-content > .container,
body.portal-body-with-layout:not(.control-plane-shell) #main-content > .container-fluid {
  width: 100% !important;
  max-width: none !important;
  padding-inline: var(--rmc-workspace-mobile-gap);
  margin-inline: 0 !important;
}

@media (min-width: 992px) {
  body.portal-body-with-layout:not(.control-plane-shell) .portal-layout-wrap {
    padding-inline: var(--rmc-workspace-edge-gap) !important;
  }

  /* Tenant copilot rail (position:fixed, right edge): the wrap's trailing edge IS the
     rail, so it reserves exactly the rail width and the #main-content scrollbar lands
     flush against it. --rmc-tenant-rail-reserve: rmc-platform-vertical-compact.css. */
  body.portal-body-with-layout:not(.control-plane-shell)[data-rmc-tenant-copilot-rail="1"] .portal-layout-wrap {
    padding-inline-end: var(--rmc-tenant-rail-reserve, 56px) !important;
    transition: padding-inline-end var(--motion-slow, 420ms cubic-bezier(0.22, 0.61, 0.36, 1));
  }

  body.portal-body-with-layout:not(.control-plane-shell) .page-wrap > .container,
  body.portal-body-with-layout:not(.control-plane-shell) .page-wrap > .container-fluid,
  body.portal-body-with-layout:not(.control-plane-shell) #main-content > .container,
  body.portal-body-with-layout:not(.control-plane-shell) #main-content > .container-fluid {
    padding-inline: var(--rmc-workspace-edge-gap);
  }
}

/* Common dashboard/layout wrappers that previously reintroduced centered caps. */
body.control-plane-shell [class*="content-max-"],
body.control-plane-shell [data-rmc-shell-content-grid="1"],
.rmc-app-shell.admin-manager-shell.control-plane-shell [class*="content-max-"],
.rmc-app-shell.admin-manager-shell.control-plane-shell [data-rmc-shell-content-grid="1"],
body.portal-body-with-layout:not(.control-plane-shell) [class*="content-max-"],
body.portal-body-with-layout:not(.control-plane-shell) [data-rmc-shell-content-grid="1"] {
  max-inline-size: none !important;
}

/* ── 2026-07-22 full-bleed seal (tenant + platform) ───────────────────────
   Kill residual reading-width caps / centered margins on authenticated
   work canvases so content sits flush to the nav + tools rails. */
html[data-rmc-tp-v3-shell="1"] .tp-canvas-body,
html[data-rmc-tp-v3-shell="1"] .tp-workflow-portal,
html[data-rmc-tp-v3-shell="1"] .portal-page-body,
html[data-rmc-tp-v3-shell="1"] body:not(.control-plane-shell) .portal-main-col > .page-wrap,
body.control-plane-shell .cp-page-body,
body.control-plane-shell #cp-main-content,
body.admin-manager-shell #cp-main-content,
body.admin-manager-shell .cp-page-body {
  max-width: none !important;
  max-inline-size: none !important;
  width: 100% !important;
  margin-inline: 0 !important;
}

/* Footer band uses the full shell width (structure unchanged — CSS only). */
body.portal-body-with-layout .rmc-civic-footer__inner,
body.control-plane-shell .rmc-civic-footer__inner,
body.admin-manager-shell .rmc-civic-footer__inner,
body.backend-shell .rmc-civic-footer__inner {
  max-width: none !important;
  width: 100%;
  margin-inline: 0;
}

/* Authenticated shells: never inherit root-base-shell's 1320px reading cap. */
body.portal-body-with-layout,
body.control-plane-shell,
body.admin-manager-shell,
body.backend-shell,
html[data-rmc-tp-v3-shell="1"] {
  --rmc-shell-max-width: none;
}

body.portal-body-with-layout .rmc-shell-content-grid,
body.control-plane-shell .rmc-shell-content-grid,
body.admin-manager-shell .rmc-shell-content-grid,
body.backend-shell .rmc-shell-content-grid,
html[data-rmc-tp-v3-shell="1"] .tp-mission-surface,
html[data-rmc-tp-v3-shell="1"] .backend-admin-role-home {
  max-width: none !important;
  max-inline-size: none !important;
  margin-inline: 0 !important;
  width: 100%;
}

/* Operator header: pack utility actions flush to the right edge. */
body.control-plane-shell .cp-header__row--utility .rmc-platform-header__inner,
body.admin-manager-shell .cp-header__row--utility .rmc-platform-header__inner {
  width: 100% !important;
  max-width: none !important;
}

body.control-plane-shell .cp-header__row--utility .rmc-platform-header__command,
body.admin-manager-shell .cp-header__row--utility .rmc-platform-header__command {
  justify-self: start !important;
}

/* Operator / admin primary nav — never re-center (beats cockpit-skin / v7). */
body.control-plane-shell .cp-header .cp-primary-nav,
body.control-plane-shell .rmc-app-shell__header .cp-primary-nav,
body.admin-manager-shell .cp-header .cp-primary-nav,
body.admin-manager-shell .rmc-app-shell__header .cp-primary-nav,
html[data-cockpit-skin] body.control-plane-shell .cp-header--consolidated .cp-header__nav-slot .cp-primary-nav,
html[data-cockpit-skin] body.admin-manager-shell .cp-header--consolidated .cp-header__nav-slot .cp-primary-nav,
html[data-cockpit-skin] body.control-plane-shell .cp-header--consolidated .cp-header__row--inline-chrome,
html[data-cockpit-skin] body.admin-manager-shell .cp-header--consolidated .cp-header__row--inline-chrome {
  justify-content: flex-start !important;
}

body.control-plane-shell .cp-header__row--utility .user-dropdown-trigger,
body.admin-manager-shell .cp-header__row--utility .user-dropdown-trigger {
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 8px 0 4px !important;
  border-radius: var(--radius-md, 10px) !important;
  background: var(--surface-elevated) !important;
  border: 1px solid var(--hairline) !important;
  align-items: center !important;
  gap: 4px !important;
}

/* Footer legal strip — full band width (structure unchanged). */
body.portal-body-with-layout .rmc-civic-footer__legal,
body.control-plane-shell .rmc-civic-footer__legal,
body.admin-manager-shell .rmc-civic-footer__legal,
body.backend-shell .rmc-civic-footer__legal {
  max-width: none !important;
  width: 100%;
}

/* Teacher dashboard inside tenant shell — kill oversized vertical void. */
body.portal-body-with-layout .tdm-bg {
  padding: 12px 0 16px !important;
  min-height: 0 !important;
}
