/* MYDN Step 22C — Critical mobile/iPhone repair layer
   Scope: public homepage + careers page. EN/ES only. No content/demo data. */

html{
  width:100%;
  max-width:100%;
  overflow-x:hidden!important;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
body{
  width:100%;
  max-width:100%;
  overflow-x:hidden!important;
  overscroll-behavior-x:none;
}
*,*::before,*::after{box-sizing:border-box;}
img,svg,video,canvas,iframe{max-width:100%;}

@media (max-width: 820px){
  input,select,textarea,button{font-size:16px!important;}
  .container{width:100%!important;max-width:100%!important;padding-left:14px!important;padding-right:14px!important;}
  section,.section,.hero,.contact-clean,.careers-hero,.careers-section{max-width:100vw!important;overflow-x:clip;}
  .grid-4,.grid-3,.brand-grid,.finder-grid,.dashboard-grid,.process-branches,.footer-grid,.market-gallery{grid-template-columns:1fr!important;}
  .btn-row,.hero .btn-row{width:100%;}
  .btn,.hero .btn-row .btn{max-width:100%;}
}

/* Header and drawer mobile stability */
@media (max-width: 820px){
  .site-header{left:0;right:0;width:100%;max-width:100vw!important;padding-left:0!important;padding-right:0!important;}
  .header-shell{width:100%!important;max-width:100%!important;min-height:62px!important;padding:8px 10px!important;border-radius:22px!important;gap:8px!important;overflow:visible!important;}
  .brand-link{min-width:0!important;max-width:calc(100vw - 126px)!important;}
  .brand-link img{width:auto!important;max-width:min(184px,calc(100vw - 142px))!important;max-height:38px!important;object-fit:contain!important;}
  .header-actions{gap:6px!important;margin-left:auto!important;}
  .icon-btn{width:42px!important;height:42px!important;min-width:42px!important;}
  .menu-btn{width:42px!important;height:42px!important;min-width:42px!important;border-radius:15px!important;}
  .lang-switch{display:none!important;}

  .drawer-overlay.open{
    display:flex!important;
    align-items:stretch!important;
    justify-content:center!important;
    padding:calc(10px + env(safe-area-inset-top,0px)) 10px calc(16px + env(safe-area-inset-bottom,0px))!important;
    overflow:hidden!important;
  }
  .drawer{
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    max-height:calc(100svh - 26px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    border-radius:28px!important;
    padding:16px!important;
  }
  .drawer-head{gap:10px!important;margin-bottom:14px!important;}
  .drawer-head img{width:auto!important;max-width:176px!important;max-height:42px!important;}
  .drawer-links{gap:10px!important;margin-top:12px!important;}
  .drawer-links a{min-height:58px!important;padding:14px 16px!important;border-radius:18px!important;font-size:18px!important;}
  .drawer-card{border-radius:18px!important;padding:14px!important;}
}

/* Login modal: remove demo notes, prevent iPhone clipping and bottom bar overlap */
.login-note{display:none!important;}
.login-message:not(.show-error):not(.error):not(.is-error){display:none!important;}
@media (max-width: 820px){
  .login-modal-overlay.open{
    display:flex!important;
    align-items:stretch!important;
    justify-content:center!important;
    padding:calc(10px + env(safe-area-inset-top,0px)) 10px calc(96px + env(safe-area-inset-bottom,0px))!important;
    overflow:hidden!important;
    z-index:900!important;
  }
  .login-modal{
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    max-height:calc(100svh - 108px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    display:block!important;
    border-radius:28px!important;
    margin:0!important;
  }
  .login-modal-aside{display:none!important;}
  .login-panel{padding:22px 16px calc(20px + env(safe-area-inset-bottom,0px))!important;min-height:0!important;}
  .login-close{position:sticky!important;top:0!important;float:right!important;z-index:3!important;margin:-4px -2px 4px 8px!important;background:#fff!important;}
  .login-panel-head{padding-right:0!important;margin-bottom:18px!important;clear:both!important;}
  .login-panel-head small{font-size:11px!important;}
  .login-panel-head h3{font-size:28px!important;line-height:1.08!important;margin:7px 0!important;letter-spacing:-.035em!important;}
  .login-panel-head p{font-size:14px!important;line-height:1.45!important;}
  .login-form{gap:12px!important;}
  .login-field label{font-size:12px!important;margin-bottom:7px!important;}
  .login-input-wrap{border-radius:17px!important;grid-template-columns:46px minmax(0,1fr)!important;}
  .login-input-icon{height:52px!important;}
  .password-row{grid-template-columns:46px minmax(0,1fr) 46px!important;}
  .login-input-wrap input{height:52px!important;min-width:0!important;}
  .login-options{margin:0!important;}
  .login-check{font-size:13px!important;}
  .login-check input{width:18px!important;height:18px!important;}
  .login-submit{min-height:54px!important;border-radius:999px!important;}
  .login-divider{margin:18px 0 14px!important;font-size:11px!important;}
  .login-action-row,.login-secondary-actions{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;}
  .login-action-card{width:100%!important;min-height:76px!important;border-radius:20px!important;padding:12px!important;}
  .login-action-copy strong{font-size:15px!important;}
  .login-action-copy span{font-size:12px!important;line-height:1.35!important;}
  body.mydn-modal-open .mobile-cta,
  body.mydn-chat-is-open .mobile-cta{display:none!important;}
}

/* Chat: make it a true iPhone sheet with safe-area spacing */
@media (max-width: 820px){
  .mydn-chat-root{
    position:fixed!important;
    right:12px!important;
    bottom:calc(94px + env(safe-area-inset-bottom,0px))!important;
    left:auto!important;
    z-index:850!important;
    width:auto!important;
    max-width:calc(100vw - 24px)!important;
  }
  .mydn-chat-launcher{
    width:58px!important;
    height:58px!important;
    min-width:58px!important;
    padding:0!important;
    border-radius:22px!important;
    display:grid!important;
    place-items:center!important;
  }
  .mydn-chat-launcher span:first-child{width:38px!important;height:38px!important;border-radius:16px!important;}
  .mydn-chat-launcher span:last-child{display:none!important;}
  .mydn-chat-panel{
    position:fixed!important;
    left:10px!important;
    right:10px!important;
    top:calc(72px + env(safe-area-inset-top,0px))!important;
    bottom:calc(92px + env(safe-area-inset-bottom,0px))!important;
    width:auto!important;
    height:auto!important;
    max-width:none!important;
    max-height:none!important;
    border-radius:28px!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    z-index:860!important;
  }
  .mydn-chat-panel.open{display:grid!important;}
  .mydn-chat-head{padding:14px!important;gap:10px!important;align-items:center!important;}
  .mydn-chat-title{grid-template-columns:42px minmax(0,1fr)!important;gap:10px!important;}
  .mydn-chat-icon{width:42px!important;height:42px!important;border-radius:16px!important;}
  .mydn-chat-title small{font-size:10px!important;margin-bottom:2px!important;}
  .mydn-chat-title strong{font-size:17px!important;line-height:1.15!important;}
  .mydn-chat-title span{font-size:12px!important;line-height:1.25!important;}
  .mydn-chat-close{width:38px!important;height:38px!important;min-width:38px!important;border-radius:14px!important;}
  .mydn-chat-body{min-height:0!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch;}
  .mydn-chat-preform{padding:14px!important;}
  .mydn-chat-intro{padding:12px!important;border-radius:18px!important;font-size:13px!important;line-height:1.45!important;margin-bottom:12px!important;}
  .mydn-chat-grid{gap:10px!important;}
  .mydn-chat-field label{font-size:12px!important;margin-bottom:6px!important;}
  .mydn-chat-field input,.mydn-chat-field select,.mydn-chat-field textarea{
    width:100%!important;
    min-height:52px!important;
    border-radius:17px!important;
    padding:12px 14px!important;
  }
  .mydn-chat-field textarea{min-height:82px!important;max-height:118px!important;resize:vertical!important;}
  .mydn-chat-btn{min-height:52px!important;border-radius:999px!important;}
  .mydn-chat-note{display:none!important;}
  .mydn-chat-footer{padding:10px!important;gap:8px!important;}
  .mydn-chat-footer textarea{min-height:48px!important;max-height:86px!important;border-radius:18px!important;}
  .mydn-chat-send{width:48px!important;height:48px!important;min-width:48px!important;border-radius:18px!important;}
}

/* Mobile bottom CTA and Safari toolbar safety */
@media (max-width: 820px){
  body{padding-bottom:calc(94px + env(safe-area-inset-bottom,0px))!important;}
  .mobile-cta{
    z-index:500!important;
    padding:10px 10px calc(10px + env(safe-area-inset-bottom,0px))!important;
    pointer-events:none;
  }
  .mobile-cta-inner{pointer-events:auto;width:100%!important;max-width:100%!important;border-radius:999px!important;padding:7px!important;}
  .mobile-cta a{min-height:46px!important;font-size:14px!important;}
}

/* Visual editor mobile safety */
@media (max-width: 820px){
  [data-cms-editable],.cms-editable{max-width:100%!important;}
  .mydn-visual-toolbar,.cms-edit-toolbar{max-width:calc(100vw - 20px)!important;overflow:auto!important;}
  .mydn-cms-sidepanel,.cms-sidepanel{
    left:10px!important;right:10px!important;bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;top:auto!important;width:auto!important;max-width:none!important;max-height:70svh!important;overflow:auto!important;border-radius:24px!important;
  }
}
