/* ==========================================================================
   MaoriMe standard mobile layout  (Layer 1 - responsive CSS safety net)
   --------------------------------------------------------------------------
   One shared, client-agnostic mobile presentation for the v3 login /
   registration / password-recovery / logged-in shell pages:
   LogonWeb2.aspx, Default_Login.aspx and the unbranded root Default.aspx.

   This is the SAFETY NET half of the "hybrid layered on CSS" approach.
   Layer 2 (a viewport cookie read in Page_PreInit) stops the client skin
   from being EMITTED on mobile, but this stylesheet guarantees the mobile
   layout is visually correct even when the skin IS present in the DOM -
   first visit before the cookie exists, cookies disabled, or the instant a
   viewport crosses the breakpoint before the one-time reload happens.

   Strategy (viewport-driven, NOT server-side device detection):
   loaded LAST in <head> (after the client head-CSS literal), the resets use
   !important + high specificity so they beat the theme stylesheets AND the
   inline background written onto the <body> tag by lit_BodyTag (inline styles
   otherwise win on source order alone).

   Only the VISUAL skin is standardised - client data/config (registration
   questions, hapu/iwi options, consent, routing) is untouched.

   Breakpoint: 767.98px. Bootstrap 3.4.1 xs/sm boundary is 768px; 767.98px
   cleanly claims the mobile side of the seam the client skins' own
   @media (max-width:768px) rules sit on.
   ========================================================================== */

/* Desktop / larger screens: the standard mobile chrome is hidden so the
   existing client skin shows exactly as before. These are the always-on
   defaults for the .mobile/.desktop convention (previously supplied by the
   client-gated st_Mobile <style> block, which is no longer rendered). */
.mm-mobile-header { display: none; }
.mobile { display: none; }
/* .desktop stays at its natural display on large screens (only hidden < 768). */

@media (max-width: 767.98px) {

    /* --- Neutralise any client skin still present in the DOM ------------ */
    /* Reset margins/padding only. Colours/background are left to the client's
       chosen theme (App_Theme) so the mobile app reflects it; the client's
       custom skin CSS/background is still suppressed server-side on mobile. */
    html, body,
    html body {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Reuse the existing .desktop / .mobile convention, but always-on now
       (previously gated inside the client-only st_Mobile block). All client
       desktop skin containers already carry class="desktop"
       (desktop0/4/5 and the code-injected desktop1/2/3). */
    .desktop { display: none !important; }
    .mobile  { display: block !important; }

    /* Standard content width. */
    .bodyMobile {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 12px !important;
        box-sizing: border-box;
    }

    /* Never let injected client chrome cause a horizontal scroll. */
    body { overflow-x: hidden !important; }

    /* --- Standard mobile header (MaoriMe brand + optional client logo) ---
       Transparent so it takes the theme's background/text; a translucent border
       keeps a subtle divider that works on light or dark themes. */
    .mm-mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 56px;
        padding: 8px 12px;
        border-bottom: 1px solid rgba(128, 128, 128, 0.25);
        box-sizing: border-box;
    }

    /* Left slot: client identity - the client logo image if set, otherwise the
       client name as text. Constrain an inner <img> so the logo keeps its aspect
       ratio; let the name text wrap rather than overflow. */
    .mm-mobile-client {
        flex: 1 1 auto;
        min-width: 0;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 16px;
        font-weight: 600;
        color: inherit;   /* take the theme's text colour */
        line-height: 1.2;
        white-space: normal;
        word-break: break-word;
    }
    .mm-mobile-client img {
        max-width: 100%;
        max-height: 40px;
        width: auto !important;
        height: auto !important;
        object-fit: contain;
        display: inline-block;
        vertical-align: middle;
    }

    /* Right slot: the MaoriMe logo (app-owned). On hover/focus the "MaoriMe"
       text slides open to the LEFT of the logo (into the header's free space);
       the logo stays anchored at the right edge. The label is clipped when
       collapsed so it never causes a horizontal scrollbar. */
    .mm-mobile-maorime {
        flex: 0 0 auto;
        max-width: 60%;
        text-align: right;
        line-height: 0;
        padding-left: 8px;
    }
    .mm-maorime {
        display: inline-flex;
        align-items: center;
        max-width: 100%;
        overflow: hidden;   /* clip the collapsed label - no horizontal scroll */
        vertical-align: middle;
    }
    .mm-maorime-label {
        display: inline-block;
        max-width: 0;
        margin-right: 0;
        opacity: 0;
        overflow: hidden;
        text-align: center;
        transform: translateX(10px);
        transition: max-width .35s ease, opacity .3s ease,
                    transform .35s ease, margin-right .35s ease;
        font-family: Arial, Helvetica, sans-serif;
    }
    .mm-maorime-name {
        display: block;
        white-space: nowrap;
        font-weight: 600;
        font-size: 16px;
        line-height: 1.1;
        color: inherit;   /* take the theme's text colour */
    }
    /* Byline sits directly under MaoriMe and is never wider than it: width:0
       + min-width:100% means it takes the MaoriMe line's width but does not
       contribute to (widen) it; anything longer is clipped. Opens Tiki Systems
       in a new tab. */
    .mm-maorime-by {
        display: block;
        width: 0;
        min-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 2px 0;
        font-size: 9px;
        line-height: 1.15;
        color: inherit;      /* theme text colour */
        opacity: 0.75;       /* slightly muted as a byline */
        text-decoration: none;
    }
    .mm-maorime-by:hover,
    .mm-maorime-by:focus {
        text-decoration: underline;
        opacity: 1;
    }
    /* Reveal on hover, on keyboard focus, and permanently if the logo image
       is missing (so the app is still identified). */
    .mm-maorime:hover .mm-maorime-label,
    .mm-maorime:focus .mm-maorime-label,
    .mm-maorime:focus-within .mm-maorime-label,
    .mm-maorime.mm-maorime-noimg .mm-maorime-label {
        max-width: 140px;   /* cap >= MaoriMe width; label shrink-fits to content */
        margin-right: 8px;
        opacity: 1;
        transform: translateX(0);
    }
    .mm-maorime-logo {
        /* Explicit height: an SVG with only a viewBox (no width/height attrs)
           has no intrinsic size, so height:auto renders it at 0 in Safari. */
        height: 36px !important;
        width: auto !important;
        max-width: 120px;
        flex: 0 0 auto;
        object-fit: contain;
        display: inline-block;
    }
    @media (prefers-reduced-motion: reduce) {
        .mm-maorime-label { transition: none; }
    }

    /* --- Unbranded root (Default.aspx) ---------------------------------- */
    /* Drop the fixed red-bordered grey box for a clean full-width layout. */
    .mm-rootbox {
        border: 0 !important;
        max-width: 100% !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 8px !important;
        box-sizing: border-box;
    }

    /* --- Standard mobile logged-in nav (#NavMobile) --------------------- */
    /* Colours come from the client's chosen App_Theme (.navbar-default styling).
       The rules here are STRUCTURAL only - layout, spacing, touch sizing, item
       stacking and no-nested-scroll - so the theme's palette shows through. The
       toggle's data-target is fixed in the markup to #bs-mobile-navbar-collapse-1. */
    #NavMobile.navbar-default {
        margin: 0 !important;
        min-height: 52px;
        border-radius: 0 !important;
    }
    #NavMobile .container-fluid { padding: 0 8px; }

    /* Member-status brand text (colour comes from the theme). */
    #NavMobile .navbar-brand,
    #NavMobile #div_MemberIdeMobile {
        height: auto;
        white-space: normal;
        padding: 14px 12px;
        font-size: 15px;
    }

    /* Hamburger: always visible, >=44px touch target. Border/background come
       from the theme; the SVG bars follow the toggle's (theme) text colour. */
    #NavMobile .navbar-toggle {
        display: block !important;
        border-radius: 4px !important;
        padding: 11px 12px !important;
    }
    #NavMobile .navbar-toggle svg rect { fill: currentColor; }

    /* Expanded panel grows to fit its content; the whole page scrolls instead
       of a nested scroller. Overrides Bootstrap's default 340px navbar-collapse
       cap (and the landscape 200px cap) so no inner scrollbar appears. */
    #NavMobile .navbar-collapse {
        max-height: none !important;
        overflow: visible !important;
        border-top: 1px solid rgba(128, 128, 128, 0.2) !important;
    }
    #NavMobile .navbar-nav { margin: 0 !important; float: none !important; }
    #NavMobile .navbar-nav > li { float: none !important; }

    /* Touch-friendly, readable items and inline dropdowns. */
    /* Every menu item - incl. the JS-injected Iwi list - stacks one per line. */
    #NavMobile .navbar-nav > li,
    #NavMobile .dropdown-menu > li {
        display: block !important;
        float: none !important;
        width: auto !important;
    }
    #NavMobile .navbar-nav > li > a,
    #NavMobile .dropdown-menu > li > a,
    #NavMobile a.IwiList {
        display: block !important;
        float: none !important;
        padding: 13px 16px !important;
        font-size: 16px;
        line-height: 1.3;
        white-space: normal !important;
    }
    /* Subtle neutral hover fallback (works on light or dark themes); the theme's
       own hover styling takes precedence where it defines one. */
    #NavMobile .navbar-nav > li > a:hover,
    #NavMobile .navbar-nav > li > a:focus,
    #NavMobile .dropdown-menu > li > a:hover,
    #NavMobile .dropdown-menu > li > a:focus {
        background-color: rgba(128, 128, 128, 0.15);
    }
    #NavMobile .dropdown-menu {
        position: static !important;
        float: none !important;
        width: auto !important;
        box-shadow: none !important;
        padding-left: 10px;
    }
    /* No nested scroller for the Iwi list - it expands in place (overriding the
       page's .Scroll{height:70vh;overflow:scroll}) so the panel grows and the
       page scrolls instead. */
    #NavMobile .Scroll,
    #NavMobile .navbar-scroll {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Hard catch-all: force EVERY link in the open mobile menu panel to the same
       size, spacing and stacking (high specificity: two ids), regardless of the
       anchor's class. This covers the dynamically-injected Iwi items whatever
       template the client uses - a standard <a class="IwiList"> or a bare
       <a class="w-dropdown-link"> (Webflow). Colour comes from the theme, because
       each item is wrapped in an <li> on injection so it matches
       `.dropdown-menu > li > a`. */
    #NavMobile #bs-mobile-navbar-collapse-1 a {
        display: block !important;
        float: none !important;
        width: auto !important;
        white-space: normal !important;
        font-size: 16px !important;
        line-height: 1.3 !important;
        padding: 13px 16px !important;
    }
}

/* ==========================================================================
   Desktop fallbacks when a client has no head skin  (LogonWeb2.aspx only)
   --------------------------------------------------------------------------
   Two related fallbacks share the standard MaoriMe header (client logo/name
   left, MaoriMe logo right). Both are activated by a body class instead of the
   viewport, so they apply on desktop where the max-width:767.98px block above
   does not. Server logic lives in LogonWeb2.aspx.vb Page_PreInit.

   1. body.mm-force-mobile  - PRE-LOGIN, Org_DefaultHead empty. Full mobile
      layout on desktop: hide the desktop chrome, show the standard mobile
      chrome (header + #NavMobile hamburger) and the login iframe.

   2. body.mm-desktop-fallback - LOGGED IN, Org_LoggedInHead empty. Show the
      SAME header on desktop, but KEEP the built-in desktop nav (#Nav): it does
      NOT hide .desktop or show the hamburger. On a phone width the media query
      above still takes over (header + hamburger), so this only shapes desktop.

   Header sizing: the shared rules use the same values as the phone media query;
   a min-width:768px block below enlarges the header ~50% on desktop only, so
   real phones keep the smaller phone sizing.
   ========================================================================== */

/* mm-force-mobile only: reuse the .desktop / .mobile convention to swap desktop
   chrome for the mobile chrome. mm-desktop-fallback deliberately does NOT do
   this - it keeps the desktop nav. */
body.mm-force-mobile {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}
body.mm-force-mobile .desktop { display: none !important; }
body.mm-force-mobile .mobile  { display: block !important; }
body.mm-force-mobile .bodyMobile {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12px !important;
    box-sizing: border-box;
}

/* mm-desktop-fallback: sit the header flush at the top of the page (no client
   skin, so the body has its default margin otherwise). */
body.mm-desktop-fallback {
    margin-top: 0 !important;
}

/* Member ID / status on the right of the desktop nav bar (mirrors the mobile
   brand status). Hidden by default so skinned desktop clients keep using the
   absolute #div_IDStatus; shown only in the desktop fallback, where that white
   absolute status would be invisible on the skin-less background. The server
   only renders p_NavIdStatus when there is a value, so this never shows an
   empty pill. #desktop0 (the absolute status) is hidden here to avoid a
   redundant, invisible duplicate. */
#Nav .mm-nav-idstatus { display: none; }
body.mm-desktop-fallback #Nav .mm-nav-idstatus { display: block; }
body.mm-desktop-fallback #desktop0 { display: none !important; }

/* --- Shared standard header (both fallbacks) --------------------------------
   The header carries class "mobile mm-mobile-header"; .mobile is display:none on
   desktop by default, so force it visible here. Same declarations as the phone
   media query; the min-width:768px block enlarges it on desktop. */
body.mm-force-mobile .mm-mobile-header,
body.mm-desktop-fallback .mm-mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.25);
    box-sizing: border-box;
}

/* Left slot: client identity - logo image if set, otherwise the client name. */
body.mm-force-mobile .mm-mobile-client,
body.mm-desktop-fallback .mm-mobile-client {
    flex: 1 1 auto;
    min-width: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: inherit;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
}
body.mm-force-mobile .mm-mobile-client img,
body.mm-desktop-fallback .mm-mobile-client img {
    max-width: 100%;
    max-height: 40px;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

/* Right slot: the MaoriMe logo (app-owned); label reveals on hover/focus. */
body.mm-force-mobile .mm-mobile-maorime,
body.mm-desktop-fallback .mm-mobile-maorime {
    flex: 0 0 auto;
    max-width: 60%;
    text-align: right;
    line-height: 0;
    padding-left: 8px;
}
body.mm-force-mobile .mm-maorime,
body.mm-desktop-fallback .mm-maorime {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    vertical-align: middle;
}
body.mm-force-mobile .mm-maorime-label,
body.mm-desktop-fallback .mm-maorime-label {
    display: inline-block;
    max-width: 0;
    margin-right: 0;
    opacity: 0;
    overflow: hidden;
    text-align: center;
    transform: translateX(10px);
    transition: max-width .35s ease, opacity .3s ease,
                transform .35s ease, margin-right .35s ease;
    font-family: Arial, Helvetica, sans-serif;
}
body.mm-force-mobile .mm-maorime-name,
body.mm-desktop-fallback .mm-maorime-name {
    display: block;
    white-space: nowrap;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.1;
    color: inherit;
}
body.mm-force-mobile .mm-maorime-by,
body.mm-desktop-fallback .mm-maorime-by {
    display: block;
    width: 0;
    min-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 0;
    font-size: 9px;
    line-height: 1.15;
    color: inherit;
    opacity: 0.75;
    text-decoration: none;
}
body.mm-force-mobile .mm-maorime-by:hover,
body.mm-force-mobile .mm-maorime-by:focus,
body.mm-desktop-fallback .mm-maorime-by:hover,
body.mm-desktop-fallback .mm-maorime-by:focus {
    text-decoration: underline;
    opacity: 1;
}
body.mm-force-mobile .mm-maorime:hover .mm-maorime-label,
body.mm-force-mobile .mm-maorime:focus .mm-maorime-label,
body.mm-force-mobile .mm-maorime:focus-within .mm-maorime-label,
body.mm-force-mobile .mm-maorime.mm-maorime-noimg .mm-maorime-label,
body.mm-desktop-fallback .mm-maorime:hover .mm-maorime-label,
body.mm-desktop-fallback .mm-maorime:focus .mm-maorime-label,
body.mm-desktop-fallback .mm-maorime:focus-within .mm-maorime-label,
body.mm-desktop-fallback .mm-maorime.mm-maorime-noimg .mm-maorime-label {
    max-width: 140px;
    margin-right: 8px;
    opacity: 1;
    transform: translateX(0);
}
body.mm-force-mobile .mm-maorime-logo,
body.mm-desktop-fallback .mm-maorime-logo {
    height: 36px !important;
    width: auto !important;
    max-width: 120px;
    flex: 0 0 auto;
    object-fit: contain;
    display: inline-block;
}
@media (prefers-reduced-motion: reduce) {
    body.mm-force-mobile .mm-maorime-label,
    body.mm-desktop-fallback .mm-maorime-label { transition: none; }
}

/* --- Desktop enlargement (both fallbacks) -----------------------------------
   Desktop has more room than a phone, so run the header ~50% taller here:
   logo 36->54px, client logo cap 40->60px, text 16->24px, header 56->84px,
   revealed MaoriMe label cap 140->200px. Scoped to min-width:768px so a real
   phone (handled by the media query above) keeps the smaller phone sizing. */
@media (min-width: 768px) {
    body.mm-force-mobile .mm-mobile-header,
    body.mm-desktop-fallback .mm-mobile-header {
        min-height: 84px;
        padding: 12px 12px;
    }
    body.mm-force-mobile .mm-mobile-client,
    body.mm-desktop-fallback .mm-mobile-client {
        font-size: 24px;
    }
    body.mm-force-mobile .mm-mobile-client img,
    body.mm-desktop-fallback .mm-mobile-client img {
        max-height: 60px;
    }
    body.mm-force-mobile .mm-maorime-name,
    body.mm-desktop-fallback .mm-maorime-name {
        font-size: 24px;
    }
    body.mm-force-mobile .mm-maorime:hover .mm-maorime-label,
    body.mm-force-mobile .mm-maorime:focus .mm-maorime-label,
    body.mm-force-mobile .mm-maorime:focus-within .mm-maorime-label,
    body.mm-force-mobile .mm-maorime.mm-maorime-noimg .mm-maorime-label,
    body.mm-desktop-fallback .mm-maorime:hover .mm-maorime-label,
    body.mm-desktop-fallback .mm-maorime:focus .mm-maorime-label,
    body.mm-desktop-fallback .mm-maorime:focus-within .mm-maorime-label,
    body.mm-desktop-fallback .mm-maorime.mm-maorime-noimg .mm-maorime-label {
        max-width: 200px;
    }
    body.mm-force-mobile .mm-maorime-logo,
    body.mm-desktop-fallback .mm-maorime-logo {
        height: 54px !important;
        max-width: 180px;
    }
}

/* --- Standard mobile logged-in nav (#NavMobile) - mm-force-mobile only --- */
body.mm-force-mobile #NavMobile.navbar-default {
    margin: 0 !important;
    min-height: 52px;
    border-radius: 0 !important;
}
body.mm-force-mobile #NavMobile .container-fluid { padding: 0 8px; }

body.mm-force-mobile #NavMobile .navbar-brand,
body.mm-force-mobile #NavMobile #div_MemberIdeMobile {
    height: auto;
    white-space: normal;
    padding: 14px 12px;
    font-size: 15px;
}

body.mm-force-mobile #NavMobile .navbar-toggle {
    display: block !important;
    border-radius: 4px !important;
    padding: 11px 12px !important;
}
body.mm-force-mobile #NavMobile .navbar-toggle svg rect { fill: currentColor; }

body.mm-force-mobile #NavMobile .navbar-collapse {
    max-height: none !important;
    overflow: visible !important;
    border-top: 1px solid rgba(128, 128, 128, 0.2) !important;
}
body.mm-force-mobile #NavMobile .navbar-nav { margin: 0 !important; float: none !important; }
body.mm-force-mobile #NavMobile .navbar-nav > li { float: none !important; }

body.mm-force-mobile #NavMobile .navbar-nav > li,
body.mm-force-mobile #NavMobile .dropdown-menu > li {
    display: block !important;
    float: none !important;
    width: auto !important;
}
body.mm-force-mobile #NavMobile .navbar-nav > li > a,
body.mm-force-mobile #NavMobile .dropdown-menu > li > a,
body.mm-force-mobile #NavMobile a.IwiList {
    display: block !important;
    float: none !important;
    padding: 13px 16px !important;
    font-size: 16px;
    line-height: 1.3;
    white-space: normal !important;
}
body.mm-force-mobile #NavMobile .navbar-nav > li > a:hover,
body.mm-force-mobile #NavMobile .navbar-nav > li > a:focus,
body.mm-force-mobile #NavMobile .dropdown-menu > li > a:hover,
body.mm-force-mobile #NavMobile .dropdown-menu > li > a:focus {
    background-color: rgba(128, 128, 128, 0.15);
}
body.mm-force-mobile #NavMobile .dropdown-menu {
    position: static !important;
    float: none !important;
    width: auto !important;
    box-shadow: none !important;
    padding-left: 10px;
}
body.mm-force-mobile #NavMobile .Scroll,
body.mm-force-mobile #NavMobile .navbar-scroll {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}
body.mm-force-mobile #NavMobile #bs-mobile-navbar-collapse-1 a {
    display: block !important;
    float: none !important;
    width: auto !important;
    white-space: normal !important;
    font-size: 16px !important;
    line-height: 1.3 !important;
    padding: 13px 16px !important;
}

/* ==========================================================================
   Hamburger placement - ALWAYS the right of the mobile nav row
   --------------------------------------------------------------------------
   Client-agnostic by design: the mobile nav bars used to place the toggle with
   an inline `position:absolute; right:1vw`, which only lands on the right when
   the button's containing block is the full-width nav row. Client skins vary -
   a Bootstrap-4 based theme makes .navbar/.container-fluid flex containers
   (shrinking the Bootstrap-3 .navbar-header to fit its content), and others
   position or float .navbar-header themselves. Either way the absolute button
   resolves against a narrow box and lands on the LEFT, overlapping the
   member-status brand text - the Tiki-OS skin vs the Ngati Mutunga one.

   The inline styles are gone from the markup; layout is done here instead, with
   the navbar-header as a flex row: brand/status first, toggle last and pushed
   right by `margin-left:auto` (which works even when the toggle is the only
   child, as in the pre-login menu). Every property a skin might fight over is
   !important, and this file loads LAST in <head>, so it beats the client skin,
   the App_Theme and any remaining inline style.

   Not inside a media query on purpose: both nav bars live inside the .mobile
   container (hidden on desktop), so these rules only take effect where the
   mobile chrome is shown - the phone breakpoint AND body.mm-force-mobile.
   ========================================================================== */
/* Bootstrap-4 based client themes make .navbar and its .container-fluid flex
   containers. That turns the (Bootstrap-3 markup) .navbar-header into a
   shrink-to-fit flex item, so "push right" has no free space to push into and
   the hamburger collapses to the LEFT. Force the nav back to block flow, which
   is what the rest of this stylesheet assumes: header row, then the collapsed
   panel underneath. */
.mm-mobile-nav,
#NavMobile.navbar {
    display: block !important;
}
.mm-mobile-nav > .container-fluid,
.mm-mobile-nav > .container,
#NavMobile > .container-fluid,
#NavMobile > .container {
    display: block !important;
    width: 100% !important;
    float: none !important;
}

.mm-mobile-nav .navbar-header,
#NavMobile .navbar-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    direction: ltr !important;   /* toggle stays right even under an rtl skin */
    position: relative !important;
    float: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}
/* Bootstrap's clearfix pseudo-elements become stray flex items - drop them. */
.mm-mobile-nav .navbar-header:before,
.mm-mobile-nav .navbar-header:after,
#NavMobile .navbar-header:before,
#NavMobile .navbar-header:after {
    display: none !important;
}
/* Brand / member-status: first, takes the free space, wraps rather than pushes
   the toggle off the row. */
.mm-mobile-nav .navbar-header > .navbar-brand,
#NavMobile .navbar-header > .navbar-brand {
    order: 1 !important;
    float: none !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    height: auto !important;
}
/* Toggle: last, in flow (no absolute positioning), hard against the right. */
.mm-mobile-nav .navbar-header > .navbar-toggle,
#NavMobile .navbar-header > .navbar-toggle {
    order: 2 !important;
    display: block !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    float: none !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    margin: 0 0 0 auto !important;   /* margin-left:auto = pushed right */
}
