/* BayesPeaQ layout-stability layer.
   Loaded last to prevent legacy enhancers from reintroducing floating controls,
   theme collisions, horizontal overflow, or overlapping transient UI. */

html,body{max-width:100%;overflow-x:clip}
.qos-app,.qos-main,.qos-content,.qos-content>*{min-width:0}
.qos-topbar{isolation:isolate;z-index:80!important}
.qos-sidebar{z-index:90!important}
.qos-top-left{min-width:0;flex:1 1 auto}
.qos-title-stack{min-width:0}
.qos-top-actions{min-width:0;flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;gap:8px;white-space:nowrap}
.qos-top-actions>*{flex:0 0 auto}

/* The account and release controls belong to the application chrome.
   They must never float over governed content. */
#bp-auth-widget[data-bpq-docked="true"],
.bpq-prod-gate{position:relative!important;top:auto!important;right:auto!important;bottom:auto!important;left:auto!important}
#bp-auth-widget[data-bpq-docked="true"]{z-index:92!important}
.bpq-prod-gate{z-index:91!important}

/* Keep top-bar popovers above page content without creating a page-wide overlay. */
#bp-auth-widget[data-bpq-docked="true"] .bp-auth-menu,
.bpq-prod-gate .bpq-prod-body{z-index:120!important}

/* V4 is the authority for light/dark shell surfaces. */
.bpq-notifications-panel{background:var(--bpq4-surface,#fff)!important;color:var(--bpq4-text,#14221c)!important;border-color:var(--bpq4-line-strong,#c6d6ce)!important}
.bpq-notifications-panel .qos-dialog-shell{background:var(--bpq4-surface,#fff)!important;color:var(--bpq4-text,#14221c)!important}
.bpq-notification-summary{color:var(--bpq4-text-2,#34483f)!important}
.bpq-notification-tools [data-bpq-notification-filter]{
  border-color:var(--bpq4-line,#dbe5e0)!important;background:var(--bpq4-surface-2,#f8faf9)!important;color:var(--bpq4-text-2,#34483f)!important
}
.bpq-notification-tools [aria-pressed=true]{
  background:var(--bpq4-accent-soft,#e7f4ef)!important;color:var(--bpq4-accent,#157b61)!important;
  border-color:color-mix(in srgb,var(--bpq4-accent,#157b61) 30%,var(--bpq4-line,#dbe5e0))!important
}
.bpq-notification-row{border-color:var(--bpq4-line,#dbe5e0)!important;background:var(--bpq4-surface-2,#f8faf9)!important;color:var(--bpq4-text,#14221c)!important}
.bpq-notification-row p{color:var(--bpq4-text-2,#34483f)!important}
.bpq-notification-meta{color:var(--bpq4-muted,#566b61)!important}
.bpq-notification-empty{color:var(--bpq4-muted,#566b61)!important;border-color:var(--bpq4-line-strong,#c6d6ce)!important}

/* Transient messages use one non-overlapping presentation lane. */
.qos-toast{
  left:50%!important;right:auto!important;bottom:24px!important;
  width:min(520px,calc(100vw - 32px));max-width:520px!important;
  transform:translate(-50%,8px)!important;
  background:var(--bpq4-surface,#fff)!important;color:var(--bpq4-text,#14221c)!important;
  border-color:var(--bpq4-line-strong,#c6d6ce)!important;
  box-shadow:var(--bpq4-shadow-lg,0 28px 90px rgba(20,42,33,.16))!important
}
.qos-toast.show{transform:translate(-50%,0)!important}

/* Avoid desktop Copilot collisions with narrow workspaces. */
@media(max-width:1360px){
  .qos-top-actions .qos-command-button kbd{display:none}
  .qos-top-actions .qos-command-button{padding-inline:10px!important}
}
@media(max-width:1180px){
  .qos-top-actions{gap:6px}
  .qos-top-actions .qos-status span:not(.pulse){display:none}
  .qos-top-actions .qos-status{min-width:44px;justify-content:center;margin-right:0!important}
  .qos-top-actions .qos-command-button span{display:none}
  .qos-top-actions .qos-command-button{width:44px;padding:0!important;justify-content:center}
}
@media(max-width:900px){
  .qos-topbar{gap:10px!important}
  .qos-breadcrumb{max-width:42vw}
}
@media(max-width:760px){
  .qos-top-actions{margin-left:auto}
  .qos-top-actions>.qos-status{display:none!important}
  #bp-auth-widget[data-bpq-docked="true"] .bp-auth-menu,
  .bpq-prod-gate .bpq-prod-body{z-index:140!important}
  .qos-toast{bottom:calc(82px + env(safe-area-inset-bottom))!important;width:calc(100vw - 24px)}
}
@media(max-width:430px){
  .qos-topbar h1{max-width:46vw!important}
  .qos-top-actions{gap:4px}
}

/* Accessible focus survives the final override layer. */
#bp-auth-widget .bp-auth-pill:focus-visible,
.bpq-prod-gate summary:focus-visible,
.bpq-notification-tools button:focus-visible{
  outline:3px solid color-mix(in srgb,var(--bpq4-accent,#157b61) 42%,transparent)!important;
  outline-offset:2px!important
}
@media(prefers-reduced-motion:reduce){
  .qos-toast,#bp-auth-widget,.bpq-prod-gate{transition:none!important}
}
