/* AG CRM V93 — login fullscreen no iPhone sem bloquear o scroll do CRM */
@media (max-width: 900px){
  :root{
    --ag-login-overscan-bottom:max(env(safe-area-inset-bottom,0px), 44px);
  }

  /* IMPORTANTE: não bloquear html/body globalmente. O scroll só é travado enquanto o login está aberto. */
  html{
    margin:0!important;
    width:100%!important;
    min-height:100%!important;
    min-height:100dvh!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
  }

  body.auth-required{
    margin:0!important;
    width:100%!important;
    height:100%!important;
    min-height:100vh!important;
    min-height:100svh!important;
    min-height:100lvh!important;
    min-height:100dvh!important;
    overflow:hidden!important;
    overscroll-behavior:none!important;
    background:
      linear-gradient(180deg,rgba(0,0,0,.36),rgba(0,0,0,.60)),
      url('../assets/login-luxury-bg-mobile.jpg') center center / cover no-repeat!important;
    background-color:#05080d!important;
  }

  /* Fora do login, o documento volta a rolar normalmente. */
  body:not(.auth-required):not(.drawer-open){
    height:auto!important;
    min-height:100dvh!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-y:auto!important;
    touch-action:pan-y!important;
  }

  /* Nunca deixa a navegação inferior do CRM aparecer por baixo do login. */
  body.auth-required > .app,
  body.auth-required > #mobileBottom,
  body.auth-required > .mobile-bottom{
    display:none!important;
  }

  #loginScreen.login-screen{
    position:fixed!important;
    z-index:99999!important;
    top:0!important;
    left:0!important;
    right:0!important;
    bottom:calc(-1 * var(--ag-login-overscan-bottom))!important;
    width:100vw!important;
    height:auto!important;
    min-height:calc(100dvh + var(--ag-login-overscan-bottom))!important;
    padding:0!important;
    overflow:hidden!important;
    background-image:
      linear-gradient(180deg,rgba(0,0,0,.36),rgba(0,0,0,.60)),
      url('../assets/login-luxury-bg-mobile.jpg')!important;
    background-position:center center!important;
    background-size:cover!important;
    background-repeat:no-repeat!important;
    background-color:#05080d!important;
  }

  #loginScreen .login-bg{
    position:absolute!important;
    z-index:0!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-height:100%!important;
    background-image:
      linear-gradient(180deg,rgba(0,0,0,.36),rgba(0,0,0,.60)),
      url('../assets/login-luxury-bg-mobile.jpg')!important;
    background-position:center center!important;
    background-size:cover!important;
    background-repeat:no-repeat!important;
    transform:none!important;
    filter:none!important;
  }

  #loginScreen .login-overlay{
    position:absolute!important;
    z-index:1!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    background:radial-gradient(circle at center,rgba(0,0,0,.08) 0%,rgba(0,0,0,.34) 72%),radial-gradient(circle at top right,rgba(215,184,120,.15),transparent 30%)!important;
  }

  #loginScreen .login-panel{
    position:relative!important;
    z-index:2!important;
    width:100%!important;
    height:100dvh!important;
    min-height:100dvh!important;
    box-sizing:border-box!important;
    padding:calc(14px + env(safe-area-inset-top,0px)) 14px calc(14px + env(safe-area-inset-bottom,0px))!important;
    overflow:auto!important;
    -webkit-overflow-scrolling:touch!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    background:transparent!important;
  }

  body.auth-required::before,
  body.auth-required::after{
    display:none!important;
    content:none!important;
    background:transparent!important;
  }
}

@media (max-width: 900px) and (display-mode: standalone){
  :root{--ag-login-overscan-bottom:max(env(safe-area-inset-bottom,0px), 64px)}
}
