/* Oct 29 2026 (Mark): the module tabs and the page title stay pinned while a page scrolls.
   Why it never stuck before: html/body had overflow-x:hidden, which turns <body> into a
   scroll container that never scrolls, so every position:sticky on the page did nothing.
   overflow-x:clip hides sideways overflow the same way without creating a scroll container.
   Desktop only; phones keep their current behavior. Loaded last. */
@media (min-width: 851px) {
  html, body { overflow-x: clip !important; }

  :root { --at-pin: 108px; } /* 44px module tabs + 64px page title */

  body:not(.full-case-mode):not(.service-desk-active) #enterpriseModuleBar {
    position: sticky !important; top: 0 !important; z-index: 41 !important;
  }
  body:not(.full-case-mode):not(.service-desk-active) .main-content > .topbar {
    position: sticky !important; top: 44px !important; z-index: 40 !important;
  }

  /* Service Desk ticket list: the title row is folded into the tab bar there (the page
     title bar is 0px tall and carries the availability + account buttons), so pin both. */
  body.service-desk-active:not(.full-case-mode) #enterpriseModuleBar {
    position: sticky !important; top: 0 !important; z-index: 41 !important;
  }
  body.service-desk-active:not(.full-case-mode) .main-content > .topbar {
    position: sticky !important; top: 44px !important; z-index: 42 !important;
  }

  /* Page-level sticky bars were written for a pinned header; keep them just below it. */
  body:not(.full-case-mode):not(.service-desk-active) .settings-nav,
  body:not(.full-case-mode):not(.service-desk-active) .documentation-toc { top: calc(var(--at-pin) + 18px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) .booking-workspace-scopebar { top: calc(var(--at-pin) + 16px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) .campaign-live-summary { top: var(--at-pin) !important; }
  body:not(.full-case-mode):not(.service-desk-active) .campaign-step-action-sticky { top: calc(var(--at-pin) + 8px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) .campaign-template-library { top: calc(var(--at-pin) + 10px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) .campaign-email-live-pane,
  body:not(.full-case-mode):not(.service-desk-active) .campaign-sms-live-pane,
  body:not(.full-case-mode):not(.service-desk-active) .service-email-live-pane { top: calc(var(--at-pin) + 12px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) #graphicsView .gc-list { top: calc(var(--at-pin) + 12px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) #graphicsView .gc-tplprev { top: calc(var(--at-pin) + 16px) !important; }
  body:not(.full-case-mode):not(.service-desk-active) .workflow-record-focus-header { top: var(--at-pin) !important; }
}