/* Portal layout: align navy sidebar brand with white header navigation.
   Position by viewport, never by a negative margin. Public pages unaffected. */
@media(min-width:681px){
 body:has(.tp-portal-return-header){
   --tpc-rail-width:247px;
   --tpc-wp-toolbar-height:0px;
 }
 body.admin-bar:has(.tp-portal-return-header){
   --tpc-wp-toolbar-height:32px;
 }
 body:has(.tp-portal-return-header) .tp-portal-return-header{
   position:relative;
   z-index:1;
   height:68px;
   min-height:68px;
 }
 body:has(.tp-portal-return-header) .tp-portal-return-inner{
   width:100%;
   max-width:none;
   min-height:68px;
   height:68px;
   margin:0;
   padding:0 clamp(18px,3vw,56px) 0 calc(var(--tpc-rail-width) + 20px);
   display:flex;
   align-items:center;
   justify-content:flex-end;
 }
 body:has(.tp-portal-return-header) .tp-portal-return-inner>.tp-brand{display:none}
 body:has(.tp-portal-return-header) .tp-portal-return-links{
   display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;
   gap:clamp(12px,2vw,29px);
 }
 body:has(.tp-portal-return-header) #tpc-app,
 body:has(.tp-portal-return-header) #tpc-app .tpc-shell{
   overflow:visible;
 }
 body:has(.tp-portal-return-header) #tpc-app{
   position:relative;
   z-index:2;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar{
   /* Fixed rail starts precisely at the same top edge as the public links. */
   position:fixed!important;
   top:var(--tpc-wp-toolbar-height)!important;
   left:0!important;
   bottom:auto!important;
   margin:0!important;
   transform:none!important;
   width:var(--tpc-rail-width)!important;
   flex:none!important;
   height:calc(100vh - var(--tpc-wp-toolbar-height))!important;
   height:calc(100dvh - var(--tpc-wp-toolbar-height))!important;
   max-height:calc(100vh - var(--tpc-wp-toolbar-height))!important;
   max-height:calc(100dvh - var(--tpc-wp-toolbar-height))!important;
   min-height:0!important;
   padding:16px 13px 20px!important;
   overflow-y:auto!important;
   overscroll-behavior:contain;
   z-index:40;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar-brand{
   display:flex!important;
   align-items:center!important;
   min-height:36px;
   margin:0 0 19px!important;
   padding:0 6px!important;
   gap:10px;
   white-space:normal;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar-brand .tpc-brand-square{
   flex:none;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar-brand strong{
   line-height:1.1;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-main{
   margin-left:var(--tpc-rail-width)!important;
   width:calc(100% - var(--tpc-rail-width));
   min-width:0;
   flex:1 1 auto;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-shell{
   display:flex;
   align-items:stretch;
 }
}
@media(min-width:681px) and (max-width:980px){
 body:has(.tp-portal-return-header){--tpc-rail-width:192px}
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar{
   padding:15px 9px 19px!important;
 }
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar-brand{
   padding:0 3px!important;
   gap:7px;
 }
 body:has(.tp-portal-return-header) .tp-portal-return-inner{
   padding:0 17px 0 calc(var(--tpc-rail-width) + 12px);
 }
}
@media(min-width:681px) and (max-width:782px){
 body.admin-bar:has(.tp-portal-return-header){
   --tpc-wp-toolbar-height:46px;
 }
}
@media(max-width:680px){
 /* Existing touch drawer and mobile header remain unchanged. */
 body:has(.tp-portal-return-header) #tpc-app .tpc-sidebar{
   margin-top:0;
 }
}