/* NewlineWork shell/header geometry repair — 2026-10-07
   Desktop: reserve the fixed sidebar width, keep all content inside the
   remaining viewport, and restore the centered company brand/version. */

@media (min-width:981px){
  :root{
    --nw-sidebar-width:252px;
    --sidebar:252px;
    --nw-pc-header-height:76px;
  }

  html,body{
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
  }

  .app-shell,
  .clean-shell,
  .reference-dashboard-shell{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
  }

  .app-shell>.sidebar,
  .clean-shell>.sidebar,
  .reference-dashboard-shell>.sidebar,
  .sidebar{
    left:0!important;
    top:0!important;
    bottom:0!important;
    width:var(--nw-sidebar-width)!important;
    max-width:var(--nw-sidebar-width)!important;
    box-sizing:border-box!important;
    transform:none!important;
    z-index:120!important;
  }

  .app-shell>main,
  .clean-shell>main,
  .reference-dashboard-shell>main{
    display:block!important;
    box-sizing:border-box!important;
    width:calc(100vw - var(--nw-sidebar-width))!important;
    max-width:calc(100vw - var(--nw-sidebar-width))!important;
    min-width:0!important;
    margin-left:var(--nw-sidebar-width)!important;
    margin-right:0!important;
    overflow-x:hidden!important;
  }

  .app-shell>main>header,
  .clean-shell>main>header,
  .reference-dashboard-shell>main>header,
  .company-header.reference-header,
  .mobile-reference-header.reference-header{
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:minmax(140px,1fr) auto minmax(140px,1fr)!important;
    align-items:center!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:var(--nw-pc-header-height)!important;
    min-height:var(--nw-pc-header-height)!important;
    margin:0!important;
    padding:8px 22px!important;
    position:sticky!important;
    top:0!important;
    left:0!important;
    right:auto!important;
    z-index:110!important;
    overflow:visible!important;
    background:rgba(255,255,255,.99)!important;
    border-bottom:1px solid #e6edf5!important;
    box-shadow:0 4px 16px rgba(23,39,70,.045)!important;
  }

  .reference-header .header-start,
  .mobile-reference-header.reference-header .header-start{
    grid-column:1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    min-width:0!important;
    visibility:visible!important;
    opacity:1!important;
  }

  /* Sidebar is permanently visible on PC, so the menu button is unnecessary. */
  .reference-header .header-start .reference-menu-btn,
  .mobile-reference-header.reference-header .header-start .reference-menu-btn,
  .reference-header .header-start #hamb{
    display:none!important;
  }

  .reference-header .centered-brand,
  .mobile-reference-header.reference-header .centered-brand,
  .company-header .centered-brand{
    grid-column:2!important;
    position:static!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;
    transform:none!important;
    justify-self:center!important;
    align-self:center!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:11px!important;
    width:auto!important;
    height:auto!important;
    max-width:min(420px,44vw)!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    visibility:visible!important;
    opacity:1!important;
    z-index:2!important;
  }

  .reference-header .centered-brand .company-logo-img.header-logo,
  .mobile-reference-header.reference-header .company-logo-img.header-logo,
  .company-header .company-logo-img.header-logo{
    display:block!important;
    width:52px!important;
    height:52px!important;
    min-width:52px!important;
    max-width:52px!important;
    margin:0!important;
    border-radius:14px!important;
    object-fit:cover!important;
    opacity:1!important;
    visibility:visible!important;
    box-shadow:0 6px 16px rgba(19,71,136,.15)!important;
  }

  .reference-header .centered-brand .brand-copy,
  .mobile-reference-header.reference-header .centered-brand .brand-copy,
  .company-header .centered-brand .brand-copy{
    display:block!important;
    min-width:0!important;
    max-width:290px!important;
    visibility:visible!important;
    opacity:1!important;
    text-align:left!important;
  }

  .reference-header .centered-brand .brand-copy b,
  .mobile-reference-header.reference-header .centered-brand .brand-copy b,
  .company-header .centered-brand .brand-copy b{
    display:block!important;
    max-width:290px!important;
    margin:0!important;
    color:#10233f!important;
    font-size:19px!important;
    line-height:1.1!important;
    font-weight:950!important;
    letter-spacing:-.045em!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .reference-header .centered-brand .brand-copy small,
  .mobile-reference-header.reference-header .centered-brand .brand-copy small,
  .company-header .centered-brand .brand-copy small{
    display:block!important;
    max-width:290px!important;
    margin-top:4px!important;
    color:#7a8799!important;
    font-size:9.5px!important;
    line-height:1.2!important;
    font-weight:750!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .reference-header .centered-brand .brand-copy small em,
  .mobile-reference-header.reference-header .centered-brand .brand-copy small em,
  .company-header .centered-brand .brand-copy small em{
    display:inline!important;
    color:#2563eb!important;
    font-size:9.5px!important;
    font-style:normal!important;
    font-weight:950!important;
  }

  /* Version is already shown beside the company name in brand-copy. */
  .reference-header .pc-version-badge,
  .mobile-reference-header.reference-header .pc-version-badge{
    display:none!important;
  }

  .reference-header .header-end,
  .mobile-reference-header.reference-header .header-end,
  .company-header .header-end{
    grid-column:3!important;
    position:static!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;
    transform:none!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    justify-self:stretch!important;
    width:auto!important;
    min-width:0!important;
    height:auto!important;
    margin:0!important;
    visibility:visible!important;
    opacity:1!important;
    z-index:2!important;
  }

  .reference-header .reference-role-card{
    position:static!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:auto!important;
    min-width:116px!important;
    max-width:180px!important;
    min-height:48px!important;
    height:48px!important;
    margin:0!important;
    padding:7px 10px!important;
  }

  .reference-actions,
  .top-primary-menu,
  .grouped-top-menu,
  .top-group-nav{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin-left:0!important;
    margin-right:0!important;
  }

  .reference-actions{
    padding-left:22px!important;
    padding-right:22px!important;
  }

  .top-primary-menu,
  .grouped-top-menu,
  .top-group-nav{
    overflow-x:auto!important;
    overflow-y:visible!important;
  }

  #content,
  .reference-dashboard-shell #content{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:1540px!important;
    min-width:0!important;
    margin-left:auto!important;
    margin-right:auto!important;
    padding-left:22px!important;
    padding-right:22px!important;
    overflow-x:hidden!important;
  }

  #content>*,
  #content .card,
  #content .grid,
  #content .toolbar,
  #content .table-wrap{
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  /* Wide tables scroll inside their own frame instead of pushing the page under the sidebar. */
  #content .table-wrap:not(.external-no-scroll){
    overflow-x:auto!important;
    overscroll-behavior-x:contain!important;
  }

  /* The sidebar itself stays fully visible and its brand is never cropped. */
  .sidebar .side-brand{
    display:flex!important;
    align-items:center!important;
    min-height:62px!important;
    overflow:visible!important;
    visibility:visible!important;
    opacity:1!important;
  }
  .sidebar .company-logo-img.side-logo{
    display:block!important;
    opacity:1!important;
    visibility:visible!important;
  }
}

/* Keep tablet/mobile overlay navigation behavior intact. */
@media (max-width:980px){
  .app-shell>main,
  .clean-shell>main,
  .reference-dashboard-shell>main{
    width:100%!important;
    max-width:100%!important;
    margin-left:0!important;
  }
}

/* Desktop header/top-menu containment repair — 2026-10-07 build 464 */
@media (min-width:981px){
  .app-shell>.sidebar,
  .clean-shell>.sidebar,
  .reference-dashboard-shell>.sidebar,
  #sidebar.sidebar{
    position:fixed!important;
    left:0!important;
    top:0!important;
    bottom:0!important;
    width:var(--nw-sidebar-width,252px)!important;
    z-index:300!important;
  }

  .app-shell>main,
  .clean-shell>main,
  .reference-dashboard-shell>main{
    position:relative!important;
    z-index:1!important;
    isolation:isolate!important;
    margin-left:var(--nw-sidebar-width,252px)!important;
    width:calc(100vw - var(--nw-sidebar-width,252px))!important;
    max-width:calc(100vw - var(--nw-sidebar-width,252px))!important;
  }

  .app-shell>main>header,
  .clean-shell>main>header,
  .reference-dashboard-shell>main>header{
    position:sticky!important;
    top:0!important;
    z-index:120!important;
  }

  #topPrimaryMenu.top-primary-menu.grouped-top-menu,
  #topGroupNav.top-group-nav{
    position:sticky!important;
    top:var(--nw-pc-header-height,76px)!important;
    left:auto!important;
    right:auto!important;
    width:100%!important;
    max-width:100%!important;
    margin-left:0!important;
    margin-right:0!important;
    z-index:110!important;
  }
}

