/* RXOPD 13-Oct-2026 authenticated floating-header recovery.
   Strictly shared header elements. Do not override module authorization, body pages,
   sidebar state, patient dashboards, OPD forms, Billing, Lab or Pharmacy internals. */
body.rx-authenticated:is(.rx-role-shell,.staff-desk-shell,.clean-admin-shell)
:is(.rx-role-topbar,.staff-topbar,.clean-admin-topbar).rx-auth-unified-topbar{
  position:fixed!important;inset-inline:10px!important;left:10px!important;right:10px!important;
  top:8px!important;width:auto!important;max-width:none!important;min-width:0!important;
  box-sizing:border-box!important;display:flex!important;align-items:center!important;
  justify-content:space-between!important;flex-wrap:nowrap!important;gap:10px!important;
  padding:6px 12px!important;min-height:58px!important;height:58px!important;
  margin:0!important;border:1px solid #d5e5ef!important;border-radius:21px!important;
  background:rgba(255,255,255,.97)!important;box-shadow:0 9px 28px rgba(14,46,77,.11)!important;
  overflow:visible!important;isolation:isolate!important;z-index:3500!important;
}
body.rx-authenticated .rx-auth-unified-left{display:flex!important;align-items:center!important;flex:1 1 auto!important;min-width:0!important;gap:8px!important;overflow:visible!important}
body.rx-authenticated .rx-auth-unified-brand{display:flex!important;align-items:center!important;flex:0 0 auto!important;min-width:81px!important;max-width:122px!important;width:119px!important;height:40px!important;opacity:1!important;visibility:visible!important}
body.rx-authenticated .rx-auth-unified-brand img{display:block!important;width:auto!important;height:auto!important;max-height:40px!important;max-width:119px!important;object-fit:contain!important;visibility:visible!important;opacity:1!important}
body.rx-authenticated .rx-auth-unified-title{min-width:0!important;flex:1 1 auto!important;overflow:hidden!important}
body.rx-authenticated .rx-auth-unified-actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;flex:0 0 auto!important;min-width:92px!important;gap:10px!important;margin-left:auto!important;overflow:visible!important;flex-wrap:nowrap!important}
body.rx-authenticated .rx-auth-bell{order:1!important;position:relative!important;display:grid!important;place-items:center!important;flex:0 0 40px!important;width:40px!important;min-width:40px!important;max-width:40px!important;height:40px!important;min-height:40px!important;margin:0!important;padding:0!important;border:1px solid #d6e5ee!important;border-radius:50%!important;background:#f5faff!important;color:#11527c!important;text-decoration:none!important;visibility:visible!important;opacity:1!important}
body.rx-authenticated .rx-auth-bell .rx-menu-svg{display:block!important;width:20px!important;height:20px!important;max-width:20px!important;max-height:20px!important}
body.rx-authenticated .rx-auth-account-menu{order:2!important;position:relative!important;display:block!important;flex:0 0 40px!important;margin:0!important;padding:0!important;max-width:40px!important;min-width:40px!important;overflow:visible!important;visibility:visible!important;opacity:1!important}
body.rx-authenticated .rx-auth-account-menu>summary{list-style:none!important;display:grid!important;place-items:center!important;flex:none!important;width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;max-width:40px!important;max-height:40px!important;margin:0!important;padding:3px!important;box-sizing:border-box!important;border-radius:50%!important;border:2px solid #d1e6f2!important;background:#eaf6ff!important;color:#13567e!important;box-shadow:0 2px 9px rgba(14,69,104,.1)!important;cursor:pointer!important}
body.rx-authenticated .rx-auth-account-menu>summary::-webkit-details-marker{display:none!important}
body.rx-authenticated .rx-auth-account-menu>summary:focus-visible,body.rx-authenticated .rx-auth-bell:focus-visible{outline:3px solid #147bb6!important;outline-offset:3px!important}
body.rx-authenticated .rx-auth-account-avatar{position:relative!important;display:grid!important;place-items:center!important;width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;max-width:34px!important;max-height:34px!important;overflow:hidden!important;border:0!important;border-radius:50%!important;background:linear-gradient(135deg,#147abc,#0c9a88)!important;color:#fff!important;font-size:13px!important;font-weight:800!important;line-height:1!important;letter-spacing:.025em!important;text-align:center!important;opacity:1!important;visibility:visible!important}
body.rx-authenticated .rx-auth-account-avatar img{position:absolute!important;inset:0!important;display:block!important;width:100%!important;height:100%!important;object-fit:cover!important;z-index:1!important;border-radius:50%!important}
body.rx-authenticated .rx-auth-account-avatar img[hidden],body.rx-authenticated .rx-auth-account-avatar .rx-auth-avatar-fallback[hidden]{display:none!important}
body.rx-authenticated .rx-auth-account-avatar .rx-auth-avatar-fallback{display:grid!important;place-items:center!important;color:#fff!important;width:100%!important;height:100%!important;font-size:13px!important;font-weight:800!important}
body.rx-authenticated .rx-auth-account-menu:not([open])>.rx-auth-account-popover{display:none!important}
body.rx-authenticated .rx-auth-account-menu[open]>.rx-auth-account-popover{display:block!important}
body.rx-authenticated .rx-auth-account-popover{position:absolute!important;top:calc(100% + 12px)!important;right:0!important;left:auto!important;transform:none!important;box-sizing:border-box!important;width:min(310px,calc(100vw - 28px))!important;max-width:calc(100vw - 28px)!important;margin:0!important;padding:10px!important;border:1px solid #d5e4ee!important;border-radius:18px!important;background:#fff!important;color:#173d58!important;box-shadow:0 16px 44px rgba(14,45,74,.20)!important;z-index:7600!important;text-align:left!important}
body.rx-authenticated .rx-auth-account-identity{display:flex!important;align-items:center!important;gap:11px!important;margin:0 0 8px!important;padding:9px 10px 12px!important;border-bottom:1px solid #e2edf3!important;min-width:0!important}
body.rx-authenticated .rx-auth-account-identity-icon{display:grid!important;place-items:center!important;flex:0 0 36px!important;width:36px!important;height:36px!important;border-radius:50%!important;background:#e5f4ff!important;color:#115580!important;font-weight:800!important;font-size:12px!important}
body.rx-authenticated .rx-auth-account-identity-copy{display:flex!important;flex-direction:column!important;min-width:0!important;gap:3px!important}
body.rx-authenticated .rx-auth-account-identity-copy strong{display:block!important;font-size:13px!important;line-height:1.2!important;color:#183955!important;overflow-wrap:anywhere!important}
body.rx-authenticated .rx-auth-account-identity-copy small{display:block!important;font-size:11px!important;line-height:1.2!important;color:#698195!important}
body.rx-authenticated .rx-auth-account-popover :is(a,button){display:grid!important;grid-template-columns:22px minmax(0,1fr)!important;gap:10px!important;align-items:center!important;box-sizing:border-box!important;width:100%!important;min-height:44px!important;margin:0!important;padding:10px 11px!important;border:0!important;border-radius:11px!important;background:transparent!important;color:#224967!important;font-size:13px!important;line-height:1.35!important;font-weight:600!important;text-decoration:none!important;text-align:left!important;white-space:normal!important;overflow-wrap:anywhere!important;cursor:pointer!important}
body.rx-authenticated .rx-auth-account-popover :is(a,button):hover,body.rx-authenticated .rx-auth-account-popover :is(a,button):focus-visible{background:#edf7ff!important;outline:none!important}
body.rx-authenticated .rx-auth-account-popover .rx-menu-svg{display:block!important;width:19px!important;height:19px!important;max-width:19px!important;max-height:19px!important}
body.rx-authenticated .rx-auth-account-popover form{display:block!important;margin:7px 0 0!important;padding:6px 0 0!important;border-top:1px solid #e2edf3!important}
body.rx-authenticated .rx-auth-account-popover .rx-auth-account-logout button{color:#9d2942!important}
body.rx-authenticated .rx-auth-workspace-switch{margin:9px 0!important;padding:10px 0!important;border-top:1px solid #e2edf3!important;border-bottom:1px solid #e2edf3!important}
body.rx-authenticated .rx-auth-workspace-switch>div{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
body.rx-authenticated .rx-auth-workspace-switch>div :is(a,span){display:flex!important;justify-content:center!important;align-items:center!important;min-width:0!important;min-height:38px!important;padding:8px 5px!important;border:1px solid #d5e4ee!important;border-radius:10px!important;background:#f4faff!important;color:#234c68!important;font-size:11px!important;text-decoration:none!important;box-sizing:border-box!important}
body.rx-authenticated .rx-auth-workspace-switch>div span[aria-disabled="true"]{opacity:.46!important}
body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rxopd-module-switch[data-module-count]{position:static!important;display:flex!important;align-items:center!important;justify-content:flex-start!important;order:2!important;min-width:0!important;flex:0 1 auto!important;width:auto!important;max-width:min(43vw,450px)!important;height:40px!important;overflow-x:auto!important;overflow-y:hidden!important;white-space:nowrap!important;scrollbar-width:none!important;gap:3px!important;margin:0!important;padding:3px!important;border:1px solid #d5e4ee!important;border-radius:12px!important;background:#f7fbff!important}
body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rxopd-module-switch[data-module-count] a{position:relative!important;display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 auto!important;width:auto!important;max-width:none!important;min-width:55px!important;height:32px!important;min-height:32px!important;padding:5px 9px!important;margin:0!important;border-radius:9px!important;font-size:11px!important;line-height:1.1!important;text-align:center!important;white-space:nowrap!important;text-decoration:none!important;visibility:visible!important;opacity:1!important}
body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rx-role-header-left{order:1!important;flex:1 1 auto!important;min-width:0!important}
body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rx-auth-unified-actions{order:3!important;flex:0 0 auto!important}
@media(max-width:1100px){
 body.rx-authenticated:is(.rx-role-shell,.staff-desk-shell,.clean-admin-shell) :is(.rx-role-topbar,.staff-topbar,.clean-admin-topbar).rx-auth-unified-topbar{left:7px!important;right:7px!important;inset-inline:7px!important}
 body.rx-authenticated .rx-auth-unified-title{display:none!important}
 body.rx-authenticated .rx-auth-unified-left{flex:1 1 auto!important}
 body.rx-authenticated .rx-auth-unified-actions{flex:0 0 auto!important}
}
@media(max-width:720px){
 body.rx-authenticated .rx-auth-unified-brand{width:102px!important;min-width:78px!important;max-width:102px!important}
 body.rx-authenticated .rx-auth-unified-brand img{max-width:102px!important;max-height:38px!important}
 body.rx-authenticated:is(.rx-role-shell,.staff-desk-shell,.clean-admin-shell) :is(.rx-role-topbar,.staff-topbar,.clean-admin-topbar).rx-auth-unified-topbar{padding:6px 9px!important;gap:5px!important;height:56px!important;min-height:56px!important;border-radius:19px!important}
 body.rx-authenticated .rx-auth-unified-actions{gap:6px!important;min-width:86px!important}
 body.rx-authenticated .rx-auth-bell,body.rx-authenticated .rx-auth-account-menu,body.rx-authenticated .rx-auth-account-menu>summary{flex-basis:39px!important;width:39px!important;min-width:39px!important;max-width:39px!important;height:39px!important;min-height:39px!important;max-height:39px!important}
 body.rx-authenticated .rx-auth-account-avatar{width:31px!important;height:31px!important;min-width:31px!important;min-height:31px!important;max-width:31px!important;max-height:31px!important}
 body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;grid-template-rows:42px 36px!important;gap:4px 7px!important;height:96px!important;min-height:96px!important;align-items:center!important}
 body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rx-role-header-left{grid-column:1!important;grid-row:1!important;display:flex!important;align-items:center!important;min-width:0!important}
 body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rx-auth-unified-actions{grid-column:2!important;grid-row:1!important;justify-self:end!important}
 body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rxopd-module-switch[data-module-count]{grid-column:1 / -1!important;grid-row:2!important;justify-self:stretch!important;align-self:center!important;width:100%!important;max-width:100%!important;min-width:0!important;min-height:35px!important;height:35px!important;box-sizing:border-box!important}
 body.rx-authenticated.rx-role-shell .rx-role-topbar.rx-role-topbar-has-modules>.rxopd-module-switch[data-module-count] a{flex:1 1 0!important;width:auto!important;min-width:63px!important;height:30px!important;min-height:30px!important;font-size:10px!important;padding:5px 9px!important}
 body.rx-authenticated.rx-role-shell:has(.rx-role-topbar-has-modules) .rx-role-main{padding-top:120px!important;}
}
@media(max-width:370px){
 body.rx-authenticated .rx-auth-unified-brand{width:78px!important;min-width:72px!important;max-width:78px!important}
 body.rx-authenticated .rx-auth-unified-brand img{max-width:78px!important}
 body.rx-authenticated .rx-auth-unified-actions{gap:4px!important}
}
@media(prefers-reduced-motion:reduce){body.rx-authenticated .rx-auth-unified-topbar,body.rx-authenticated .rx-auth-account-popover{transition:none!important;animation:none!important}}

/* Stage 2: floating header integrity and desktop drawer state.
   No changes to permitted routes, JS session logic or workspace role checks. */
body.rx-authenticated:is(.rx-role-shell,.staff-desk-shell,.clean-admin-shell)
:is(.rx-role-topbar,.staff-topbar,.clean-admin-topbar).rx-auth-unified-topbar{
  right:max(10px,env(safe-area-inset-right,0px))!important;
  left:max(10px,env(safe-area-inset-left,0px))!important;
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  border-radius:21px!important;
}
body.rx-authenticated .rx-auth-unified-actions{
  position:relative!important;
  right:auto!important;
  padding-right:0!important;
  isolation:isolate!important;
}
body.rx-authenticated .rx-auth-account-menu{z-index:3!important}
body.rx-authenticated .rx-auth-account-menu[open]{z-index:8001!important}
body.rx-authenticated .rx-auth-account-popover{max-height:min(70vh,570px)!important;overflow-y:auto!important;overscroll-behavior:contain!important}
body.rx-authenticated .rx-auth-unified-brand img{max-width:100%!important}
@media (min-width:1101px){
  body.rx-role-shell.rx-role-sidebar-expanded .rx-role-topbar.rx-auth-unified-topbar,
  body.staff-desk-shell.staff-sidebar-expanded .staff-topbar.rx-auth-unified-topbar,
  body.clean-admin-shell.rx-admin-mobile-open .clean-admin-topbar.rx-auth-unified-topbar{
    left:calc(var(--rxas-drawer,292px) + 18px)!important;
  }
}
@media(max-width:1100px){
  body.rx-authenticated:is(.rx-role-shell,.staff-desk-shell,.clean-admin-shell)
  :is(.rx-role-topbar,.staff-topbar,.clean-admin-topbar).rx-auth-unified-topbar{
    left:max(8px,env(safe-area-inset-left,0px))!important;
    right:max(8px,env(safe-area-inset-right,0px))!important;
  }
}
@media(max-width:720px){
  body.rx-authenticated:is(.rx-role-shell,.staff-desk-shell,.clean-admin-shell)
  :is(.rx-role-topbar,.staff-topbar,.clean-admin-topbar).rx-auth-unified-topbar{border-radius:20px!important}
}
/* Public pre-login floating bar: preserve the existing Login > Menu ordering.
   Specificity explicitly exceeds older guest rules including their !important. */
body.rx-standard-shell:not(.rx-authenticated) header.rx-topbar.rx-hanging-header.rx-public-guest-header{
  box-sizing:border-box!important;
  min-width:0!important;
  width:calc(100% - 20px)!important;
  max-width:none!important;
  min-height:86px!important;
  height:86px!important;
  top:8px!important;
  left:10px!important;
  right:10px!important;
  margin:0!important;
  padding:10px 17px!important;
  border-radius:23px!important;
  transform:none!important;
  overflow:visible!important;
}
body.rx-standard-shell:not(.rx-authenticated) .rx-public-guest-header .rx-brand.rx-logo-brand.compact{
  display:flex!important;align-items:center!important;min-width:0!important;
  max-width:180px!important;
}
body.rx-standard-shell:not(.rx-authenticated) .rx-public-guest-header .rx-brand.rx-logo-brand.compact img{
  display:block!important;max-width:172px!important;max-height:59px!important;
  width:auto!important;height:auto!important;object-fit:contain!important;
}
@media(max-width:720px){
  body.rx-standard-shell:not(.rx-authenticated) header.rx-topbar.rx-hanging-header.rx-public-guest-header{
    height:76px!important;min-height:76px!important;
    top:8px!important;left:8px!important;right:8px!important;
    width:calc(100% - 16px)!important;padding:8px 10px!important;border-radius:20px!important;
  }
  body.rx-standard-shell:not(.rx-authenticated) .rx-public-guest-header .rx-brand.rx-logo-brand.compact img{
    max-width:min(135px,37vw)!important;max-height:48px!important;
  }
}
@media(max-width:370px){
  body.rx-standard-shell:not(.rx-authenticated) .rx-public-guest-header .rx-brand.rx-logo-brand.compact img{max-width:104px!important}
}
