/* Fix the actual mobile header source: premium-ui.js mounts #premiumContext
   based on CSS viewport width. Android desktop-site mode can report a wide CSS
   viewport on a physically narrow touch screen, leaving its chips stacked.
   Touch-device override is based on input capability and also covers that mode. */
@media (hover:none) and (pointer:coarse) and (max-width:1100px) {
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #premiumContext {
    display:none!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions {
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    justify-content:flex-start!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    gap:8px!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #roleSession.session-chip {
    display:inline-flex!important;
    flex:1 1 205px!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:space-between!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    min-height:46px!important;
    padding:7px 10px!important;
    gap:9px!important;
    border-radius:14px!important;
    white-space:normal!important;
    overflow:visible!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #roleSession.session-chip > strong {
    display:block!important;
    flex:1 1 auto!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    font-size:13px!important;
    line-height:1.25!important;
    white-space:normal!important;
    overflow-wrap:normal!important;
    word-break:normal!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #roleSession.session-chip > button {
    flex:0 0 auto!important;
    align-self:center!important;
    min-width:76px!important;
    min-height:36px!important;
    width:auto!important;
    max-width:none!important;
    white-space:nowrap!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #accountSecurityButton.account-security-btn {
    flex:0 1 116px!important;
    width:auto!important;
    min-width:96px!important;
    max-width:116px!important;
    min-height:44px!important;
    margin:0!important;
    white-space:normal!important;
  }
}

/* Browser-QA correction: keep role label and Logout in distinct grid cells.
   Earlier dashboard CSS declared a full-width label and column layout, which
   caused the label to collide with Logout even after decorative chips were hidden. */
@media (hover:none) and (pointer:coarse) and (max-width:1100px) {
  html body.app-page.page-app #appMain > .topbar > .topbar-actions {
    display:flex!important;
    flex-flow:row wrap!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:8px!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #roleSession.session-chip {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:minmax(36px,auto)!important;
    flex:1 1 170px!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    min-height:44px!important;
    height:auto!important;
    padding:6px 9px!important;
    gap:8px!important;
    align-items:center!important;
    justify-content:stretch!important;
    overflow:visible!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #roleSession.session-chip > strong {
    display:block!important;
    grid-column:1!important;
    grid-row:1!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    height:auto!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    align-self:center!important;
    font-size:12px!important;
    line-height:1.25!important;
    white-space:normal!important;
    overflow:visible!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #roleSession.session-chip > button {
    display:inline-flex!important;
    grid-column:2!important;
    grid-row:1!important;
    align-self:center!important;
    justify-self:end!important;
    flex:none!important;
    width:auto!important;
    min-width:68px!important;
    max-width:78px!important;
    min-height:34px!important;
    height:auto!important;
    margin:0!important;
    padding:6px 8px!important;
    white-space:nowrap!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > #accountSecurityButton.account-security-btn {
    display:inline-flex!important;
    flex:0 0 88px!important;
    width:88px!important;
    min-width:88px!important;
    max-width:88px!important;
    min-height:42px!important;
    height:auto!important;
    margin:0!important;
    padding:6px 7px!important;
    font-size:11px!important;
    line-height:1.15!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
}
