/* R383 — Global Filter / Popover Ownership
   Keeps filter menus and date-range panels as overlay layers across application pages.
   No layout reflow, no toolbar clipping, no nested page-size expansion. */

:root{--cct-popover-z:4600}

/* Filter / toolbar ancestors must never clip their own menus. */
:where(
  .cw-toolbar,.cw-toolbar-r259,.cw-ent-menu,.cw-date-range,
  .lop-filter-panel,.lop-filter-grid,.lop-filter-field,
  .b251-filter-panel,.b251-filter-grid,.ov-filter-grid,.ov-inline-filters,
  .controlbar,.executive-filterbar,.advanced-filters,
  .plan-toolbar,.ops-plan-filters,.filter-grid,.filter-actions
){overflow:visible!important}

/* Raise the active toolbar only while a menu is open; do not alter its height. */
:where(.cw-toolbar,.lop-filter-panel,.b251-filter-panel,.controlbar,.plan-toolbar,.filter-grid){position:relative}
:where(.cw-toolbar,.lop-filter-panel,.b251-filter-panel,.controlbar,.plan-toolbar,.filter-grid):has([aria-expanded="true"]){z-index:4500!important}

/* JS owns exact viewport coordinates. Keeping the panel in its original DOM tree
   preserves existing click/outside-click handlers while position:fixed escapes clipping. */
.cct-popover-fixed{
  position:fixed!important;
  left:var(--cct-popover-left,12px)!important;
  top:var(--cct-popover-top,72px)!important;
  right:auto!important;
  bottom:auto!important;
  z-index:var(--cct-popover-z)!important;
  margin:0!important;
  max-height:var(--cct-popover-max-height,calc(100vh - 24px))!important;
  overscroll-behavior:contain;
}

/* Known enterprise menus keep their intended width but cannot escape the viewport. */
.cw-ent-panel.cct-popover-fixed{width:var(--cct-popover-width,auto)!important;max-width:calc(100vw - 24px)!important}
.cw-date-range-panel.cct-popover-fixed{width:var(--cct-popover-width,360px)!important;max-width:calc(100vw - 24px)!important}

/* Menu scrolling belongs inside a tall menu only; opening it must not resize the page. */
:where(.cw-ent-panel,.cw-date-range-panel,.st-settings-menu,.coi-auth-menu).cct-popover-fixed{
  overflow:auto!important;
  box-shadow:0 14px 34px rgba(15,23,42,.16)!important;
}
.cw-date-range-panel.cct-popover-fixed{overflow:hidden!important}

/* Containers-specific protection against old merged layout owners. */
body[data-app-page="containers"] .cw-toolbar-r259{
  overflow:visible!important;
  min-height:0!important;
  height:auto!important;
}
body[data-app-page="containers"] :is(#statusMenu,#sortMenu,#dateRangeControl){position:relative!important;overflow:visible!important}
body[data-app-page="containers"] :is(#statusMenuPanel,#sortMenuPanel,#dateRangePanel){contain:none!important}

/* Native <select> / <input type=date> remain native browser controls. */
select,input[type="date"]{position:relative}
