/* MADHOUSE Mobile + Social 2.0 — scoped, last-loaded responsive overrides */
@media (max-width: 767px) {
  html,body { max-width:100%; overflow-x:clip; }
  body.mad-header-order>header#madMemberHeader {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1.15fr) 44px 44px!important;
    grid-template-rows:auto auto auto!important;
    align-items:center!important;
    gap:8px!important;
    padding:12px 12px 14px!important;
    margin:0!important;
    width:100%!important; max-width:100%!important;
    box-sizing:border-box!important;
  }
  body.mad-header-order>header#madMemberHeader>.logo {
    grid-column:1/-1!important;grid-row:1!important;
    width:auto!important;max-width:100%!important;min-width:0!important;
    margin:0!important;padding:0!important;justify-self:start!important;
    flex:initial!important;
  }
  body.mad-header-order>header#madMemberHeader>.logo .brand-name {
    font-size:clamp(25px,7vw,38px)!important;line-height:1!important;
  }
  body.mad-header-order>header#madMemberHeader>.logo .brand-by {
    font-size:clamp(11px,3.2vw,15px)!important;
  }
  body.mad-header-order>header#madMemberHeader #madhouse-website-link {
    grid-column:1/-1!important;grid-row:3!important;
    width:100%!important;min-width:0!important;
    margin:0!important;padding:0!important;flex:initial!important;
  }
  body.mad-header-order>header#madMemberHeader #madhouse-website-link>a {
    width:100%!important;max-width:100%!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    min-height:36px!important;padding:7px 12px!important;
    font-size:12px!important;line-height:1.2!important;
    box-sizing:border-box!important;white-space:normal!important;
    border-radius:9px!important;
  }
  body.mad-header-order>header#madMemberHeader #communityHeaderButton {
    grid-column:1!important;grid-row:2!important;
    background:#242429!important;color:#fff!important;border:1px solid #62626c!important;
    font-size:clamp(11px,3vw,14px)!important;font-weight:750!important;
  }
  body.mad-header-order>header#madMemberHeader #crew-header-invite {
    grid-column:2!important;grid-row:2!important;
    background:#e90035!important;color:#fff!important;border:2px solid #ff456b!important;
    font-size:clamp(11px,3vw,14px)!important;font-weight:850!important;
  }
  body.mad-header-order>header#madMemberHeader #notificationBell {
    grid-column:3!important;grid-row:2!important;
    font-size:0!important;
  }
  body.mad-header-order>header#madMemberHeader>.passport-menu {
    grid-column:4!important;grid-row:2!important;
    position:relative!important;flex:initial!important;
  }
  body.mad-header-order>header#madMemberHeader #communityHeaderButton,
  body.mad-header-order>header#madMemberHeader #crew-header-invite,
  body.mad-header-order>header#madMemberHeader #notificationBell,
  body.mad-header-order>header#madMemberHeader>.passport-menu>summary {
    display:flex!important;align-items:center!important;justify-content:center!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:48px!important;min-height:48px!important;
    padding:6px!important;margin:0!important;
    line-height:1.15!important;white-space:normal!important;
    text-align:center!important;border-radius:11px!important;
    box-sizing:border-box!important;gap:4px!important;
    overflow:visible!important;
  }
  body.mad-header-order>header#madMemberHeader #communityHeaderButton svg {
    width:18px!important;height:18px!important;flex-shrink:0!important;
  }
  body.mad-header-order>header#madMemberHeader #communityHeaderButton>span {
    font-size:inherit!important;white-space:normal!important;min-width:0!important;
  }
  body.mad-header-order>header#madMemberHeader #notificationBell .notification-label,
  body.mad-header-order>header#madMemberHeader>.passport-menu>summary>span {display:none!important;}
  body.mad-header-order>header#madMemberHeader #notificationBell svg,
  body.mad-header-order>header#madMemberHeader>.passport-menu>summary svg {
    width:23px!important;height:23px!important;flex-shrink:0!important;
  }
  body.mad-header-order>header#madMemberHeader #notificationBadge {
    position:absolute!important;top:1px!important;right:1px!important;
    font-size:10px!important;
  }
  body.mad-header-order>header#madMemberHeader>.passport-menu>aside {
    position:fixed!important;top:auto!important;left:12px!important;right:12px!important;
    width:auto!important;max-width:none!important;max-height:min(75dvh,650px)!important;
    overflow-y:auto!important;z-index:9999!important;
    margin-top:8px!important;
  }
  body.mad-header-order>header#madMemberHeader>#accessLabel {display:none!important;}
  .passport-layout {margin-top:12px!important;gap:12px!important;min-width:0!important;}
  .member-pass {padding:16px!important;min-width:0!important;max-width:100%!important;}
  .member-pass .pass-top {gap:6px!important;min-width:0!important;}
  .member-pass .pass-top>span:first-child {
    font-size:clamp(16px,4.6vw,23px)!important;
    letter-spacing:clamp(1px,.5vw,3px)!important;
    overflow-wrap:anywhere!important;
  }
  .passport-summary,.pass-identity,.passport-bank,.pass-actions {min-width:0!important;max-width:100%!important;}
  .pass-actions>* {min-width:0!important;overflow-wrap:anywhere!important;}
  .community-page,.community-new,.community-layout,.community-feed,.community-rail,
  .community-people,.friend-grid,.messages-layout,.messages-inbox,.messages-thread {
    min-width:0!important;max-width:100%!important;
    box-sizing:border-box!important;
  }
  .community-heading,.community-new-heading {gap:12px!important;flex-wrap:wrap!important;}
  .community-heading h1,.community-new-heading h1 {font-size:clamp(25px,7vw,38px)!important;overflow-wrap:anywhere!important;}
  .community-feed-filters,.friend-tabs,.social-actions,.messages-toolbar {
    display:flex!important;flex-wrap:wrap!important;gap:8px!important;
  }
  .community-feed-filters>button,.friend-tabs>button {flex:1 1 auto!important;min-height:40px!important;}
  .messages-layout {display:grid!important;grid-template-columns:minmax(0,1fr)!important;}
  .messages-history {overflow-wrap:anywhere!important;}
  .messages-history img,.community-page img,.community-new img {max-width:100%!important;height:auto;}
  .community-profile-grid {grid-template-columns:minmax(0,1fr)!important;}
  .community-page textarea,.community-new textarea,.community-page input,.community-new input {
    max-width:100%!important;box-sizing:border-box!important;
  }
  .notification-dialog {max-width:calc(100vw - 20px)!important;max-height:85dvh!important;overflow:auto!important;}
}
@media (max-width:359px) {
 body.mad-header-order>header#madMemberHeader {
   grid-template-columns:minmax(0,1fr) minmax(0,1.1fr) 40px 40px!important;
   gap:5px!important;padding-inline:8px!important;
 }
 body.mad-header-order>header#madMemberHeader #communityHeaderButton svg {display:none!important;}
}
@media (prefers-reduced-motion:reduce) {
 .community-page *, .community-new * {scroll-behavior:auto!important;}
}
