/* Serpworks V2.9.58 - proposal viewport and Quick View layering hotfix.
 * Mobile: fixed overlay in the visual viewport, independently scrolling body,
 * and always visible form actions. Both mobile and desktop: proposal must be
 * above the FreeAgent Quick View overlay (z-index:10900).
 * Scope: existing .submit-proposal popup only. No form/validation changes. */

/* The parent theme's Quick View is z-index 10900; Magnific uses ~1040.
   The proposal wrapper is tagged in JS, so do not change ordinary overlays. */
html body .mfp-bg.sw58-proposal-backdrop{z-index:11040!important;}
html body .mfp-wrap.sw58-proposal-overlay{z-index:11050!important;}
html body.sw58-proposal-open .mfp-wrap:has(.submit-proposal){z-index:11050!important;}
html body.sw58-proposal-open .mfp-bg{z-index:11040!important;}
/* Magnific may use absolute positioning at the current page scroll offset.
   This must be reset on BOTH desktop and mobile so Quick View never leaves the
   newly opened form below the visible viewport. */
html body .mfp-wrap.sw58-proposal-overlay{
  position:fixed!important;inset:0!important;top:0!important;left:0!important;
  right:0!important;bottom:0!important;width:100vw!important;
  height:var(--sw58-viewport-height,100dvh)!important;
  max-height:var(--sw58-viewport-height,100dvh)!important;
  overflow:hidden!important;margin:0!important;transform:none!important;
}
html body .mfp-wrap.sw58-proposal-overlay .mfp-container{
  height:100%!important;min-height:0!important;max-height:100%!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
  overflow:hidden!important;padding:16px!important;box-sizing:border-box!important;
}
html body .mfp-wrap.sw58-proposal-overlay .mfp-content{
  max-height:100%!important;min-height:0!important;overflow:hidden!important;
}
html body .mfp-wrap.sw58-proposal-overlay .submit-proposal{
  max-height:calc(var(--sw58-viewport-height,100dvh) - 32px)!important;
  overscroll-behavior:contain!important;
}

@media(max-width:767px){
  html:has(body.sw58-proposal-open),
  html body.sw58-proposal-open{overscroll-behavior: none!important;overflow:hidden!important;}
  html body .mfp-wrap.sw58-proposal-overlay,
  html body .mfp-wrap:has(.submit-proposal){
    position:fixed!important;
    inset:0!important;
    top:0!important;left:0!important;right:0!important;bottom:0!important;
    width:100vw!important;
    height:var(--sw58-viewport-height,100dvh)!important;
    max-height:var(--sw58-viewport-height,100dvh)!important;
    overflow:hidden!important;
    transform:none!important;
    margin:0!important;padding:0!important;
    overscroll-behavior:contain!important;
    box-sizing:border-box!important;
  }
  html body .mfp-wrap.sw58-proposal-overlay .mfp-container,
  html body .mfp-wrap:has(.submit-proposal) .mfp-container{
    position:relative!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:100%!important;height:100%!important;
    max-height:100%!important;
    padding:8px!important;
    margin:0!important;overflow:hidden!important;
    box-sizing:border-box!important;
  }
  html body .mfp-wrap.sw58-proposal-overlay .mfp-content,
  html body .mfp-wrap .mfp-content:has(>.submit-proposal){
    display:flex!important;
    flex:0 1 auto!important;
    align-items:stretch!important;
    width:min(100%,560px)!important;
    max-width:560px!important;
    min-width:0!important;
    height:calc(100% - 0px)!important;
    max-height:100%!important;
    margin:0 auto!important;
    overflow:hidden!important;
    padding:0!important;
    box-sizing:border-box!important;
  }
  html body .mfp-wrap .mfp-content > .submit-proposal,
  html body .mfp-wrap .submit-proposal{
    position:relative!important;
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    flex:1 1 auto!important;
    width:100%!important;
    min-width:0!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
    margin:0!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
    border-radius:14px!important;
  }
  html body .mfp-wrap .submit-proposal > .form-heading{
    grid-row:1!important;
    position:relative!important;
    flex:none!important;
    min-height:0!important;
    margin:0!important;
    z-index:2!important;
  }
  html body .mfp-wrap .submit-proposal > .form-content{
    grid-row:2!important;
    position:relative!important;
    flex:none!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    max-height:100%!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    overscroll-behavior-y:contain!important;
    scroll-padding-bottom:18px!important;
    padding-bottom:18px!important;
    box-sizing:border-box!important;
  }
  html body .mfp-wrap .submit-proposal > .form-button{
    grid-row:3!important;
    position:relative!important;
    display:flex!important;
    align-items:center!important;
    justify-content:stretch!important;
    flex:none!important;
    width:100%!important;
    min-width:0!important;
    min-height:62px!important;
    max-height:none!important;
    margin:0!important;
    padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px))!important;
    inset:auto!important;
    transform:none!important;
    z-index:4!important;
    background:#fff!important;
    border-top:1px solid #eadff8!important;
    box-shadow:0 -6px 15px rgba(41,19,67,.08)!important;
    visibility:visible!important;
    opacity:1!important;
    box-sizing:border-box!important;
  }
  html body .mfp-wrap .submit-proposal > .form-button > button{
    display:inline-flex!important;
    flex:1 1 0!important;
    min-width:0!important;
    min-height:44px!important;
    max-width:none!important;
    margin:0!important;
    visibility:visible!important;
    opacity:1!important;
    box-sizing:border-box!important;
  }
  /* Desktop parent theme styles sometimes put a custom CSS bottom offset on
     the popup wrapper; these resets apply to the proposal only. */
  html body .mfp-wrap .submit-proposal .form-content textarea{min-height:115px!important;}
}
@media(max-width:767px) and (max-height:580px){
  html body .mfp-wrap .submit-proposal > .form-heading{padding-top:10px!important;padding-bottom:10px!important;}
  html body .mfp-wrap .submit-proposal > .form-heading h5{font-size:18px!important;}
}
