/* CoachPro navbar fit v2 — content-aware desktop layout.
   Loaded after the historical navbar styles so browser zoom/HiDPI cannot make
   primary tabs overlap plan badges, theme controls or the account menu. */

@media (min-width:0px){
  /* Stage 1: keep the classic desktop row, but reclaim expendable width. */
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight{
    padding-left:.55rem !important;
    padding-right:.55rem !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-brand{
    margin-right:.28rem !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-nav.nav-primary{
    gap:0 !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-nav.nav-primary .nav-link,
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-nav.nav-primary .btn{
    padding-left:.28rem !important;
    padding-right:.28rem !important;
    font-size:.79rem !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-right{
    gap:.28rem !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-right > .badge{
    padding:.34rem .46rem !important;
    font-size:.68rem !important;
    white-space:nowrap !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .nav-user-email{
    display:none !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-actions--desktop{
    gap:.28rem !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-tight .navbar-actions--desktop .nav-icon-btn{
    width:34px !important;
    height:34px !important;
    min-width:34px !important;
    min-height:34px !important;
    flex-basis:34px !important;
  }

  /* Stage 2: when the measured row still does not fit, use Bootstrap's collapse
     rather than letting tabs render under the right-hand controls. These rules
     intentionally beat the old cp-desktop-nav safety net. */
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact{
    flex-wrap:wrap !important;
    align-content:flex-start !important;
    overflow:visible !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact > .navbar-actions--mobile{
    display:flex !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact > .navbar-toggler{
    display:block !important;
    flex:0 0 auto !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-right{
    display:none !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-collapse.collapse{
    display:none !important;
    flex:0 0 100% !important;
    flex-basis:100% !important;
    width:100% !important;
    min-width:0 !important;
    max-height:min(72vh,720px) !important;
    margin-top:.35rem !important;
    padding:.75rem .75rem 1rem !important;
    position:static !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    border-top:1px solid var(--border) !important;
    border-radius:0 0 18px 18px !important;
    background:var(--nav-bg) !important;
    box-shadow:none !important;
    -webkit-overflow-scrolling:touch;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-collapse.collapse.show,
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-collapse.collapsing{
    display:block !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary{
    display:flex !important;
    flex-direction:column !important;
    flex-wrap:nowrap !important;
    align-items:stretch !important;
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    margin:0 !important;
    padding:.25rem !important;
    gap:0 !important;
    white-space:normal !important;
    text-align:center !important;
    overflow:visible !important;
    border:1px solid var(--border) !important;
    border-radius:18px !important;
    background:rgba(20,20,24,.78) !important;
    box-shadow:0 18px 45px rgba(0,0,0,.30) !important;
  }

  html[data-theme="light"]:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary{
    background:rgba(255,255,255,.92) !important;
    box-shadow:0 18px 45px rgba(0,0,0,.10) !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary > .nav-item{
    display:block !important;
    flex:0 0 auto !important;
    width:100% !important;
    min-width:0 !important;
    border-top:0 !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary > .nav-item + .nav-item{
    border-top:1px solid rgba(255,255,255,.07) !important;
  }

  html[data-theme="light"]:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary > .nav-item + .nav-item{
    border-top-color:rgba(0,0,0,.06) !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary .nav-link,
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav.nav-primary .btn{
    width:100% !important;
    max-width:100% !important;
    min-height:48px !important;
    padding:.8rem .9rem !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    text-align:center !important;
    white-space:normal !important;
    border-radius:14px !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav .d-lg-none,
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .cp-mobile-account-item{
    display:block !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-nav .social-nav.d-lg-none{
    display:flex !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .badge-wrap{
    display:inline-flex !important;
    justify-content:center !important;
    width:100% !important;
    white-space:normal !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .cp-tools-nav{
    position:static !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .cp-tools-menu,
  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .navbar-collapse .cp-tools-menu{
    position:static !important;
    inset:auto !important;
    transform:none !important;
    float:none !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    margin:.1rem 0 .42rem !important;
    padding:.36rem !important;
    border-radius:15px !important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.035) !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .cp-mobile-account-toggle{
    width:100% !important;
    min-height:54px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:.65rem !important;
  }

  html:not(.cp-native-shell) body:not(.inapp-shell)
  .navbar.nav-brand.cp-nav-fit-v2-compact .cp-mobile-account-collapse{
    width:100% !important;
  }
}
