/* MXH navigation R6. Load after R5 and the existing Custom overlays.
 * Keep the server-rendered links, permissions, dropdowns and icon assets.
 * User preference: mobile icon actions have no filled rectangular tiles.
 * Native Nova5 uses small active/Add capsules; this is a deliberate adaptation.
 */
@media (max-width:767.98px) {
  /* The old 7/5 Bootstrap split cannot fit three accessible actions at 320px. */
  body.mxh-extend-ui .main-header.mxh-nova-topbar>.container>.row,
  body.mxh-extend-ui .main-header.mxh-nova-topbar>.container-fluid>.row {
    flex-wrap:nowrap;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .mxh-nova-brand-col {
    flex:1 1 0;
    width:auto;
    min-width:0;
    padding-inline-end:0;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .mxh-nova-header-col {
    flex:0 0 auto;
    width:auto;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .mxh-nova-header-col>.row {
    margin-inline:0;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .mxh-nova-search-col {
    display:none;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .mxh-nova-actions-col {
    width:auto;
    padding-inline:0;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul {
    justify-content:flex-end;
    gap:2px;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li {
    flex:0 0 auto;
    margin:0;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li>a,
  body.mxh-extend-ui .main-header.mxh-nova-topbar .menu-icon {
    background:transparent;
    box-shadow:none;
    border:0;
    border-radius:12px;
    min-width:44px;
    height:44px;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li>a {
    margin-top:13px;
    padding-inline:8px;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li>a:hover,
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li>a:active,
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li>a[aria-expanded="true"],
  body.mxh-extend-ui .main-header.mxh-nova-topbar .menu-icon:hover {
    background:transparent;
    color:var(--mxh-ui-accent,var(--mxh-r2-primary));
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper .counter {
    inset-inline-end:-2px;
    top:-5px;
    max-width:44px;
    padding:1px 3px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:9px;
    line-height:11px;
  }
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper .dropdown-menu .dropdown-item {
    white-space:normal;
    overflow-wrap:anywhere;
  }

  /* Retain the floating outer bar, with equal, full-height touch targets. */
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav {
    height:60px;
    padding-block:0;
    left:max(10px,env(safe-area-inset-left,0px));
    right:max(10px,env(safe-area-inset-right,0px));
    bottom:calc(8px + env(safe-area-inset-bottom,0px));
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav>.container,
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links {
    height:100%;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link {
    flex:1 1 0;
    min-width:0;
    height:100%;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link>a {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    min-width:44px;
    min-height:44px;
    height:100%;
    margin:0;
    padding:5px 2px;
    color:var(--mxh-ui-text,var(--mxh-r2-text));
    background:transparent;
    border:0;
    border-radius:12px;
    box-shadow:none;
    line-height:1;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link>a>.svg-container {
    display:flex;
    align-items:center;
    justify-content:center;
    margin:0!important;
    flex:none;
    line-height:0;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link>a>img {
    width:24px;
    height:24px;
    margin:0;
    flex:none;
    object-fit:cover;
    border-radius:50%;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link>a>.title {
    max-width:100%;
    font-size:11px;
    line-height:15px;
    color:inherit;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link.active>a,
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.mxh-nova-mobile-create>a,
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link>a:hover,
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link>a[aria-expanded="true"] {
    background:transparent;
    color:var(--mxh-ui-accent,var(--mxh-r2-primary));
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .footer-bottom-bar-links>.link.active>a>.title {
    font-weight:600;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .dropdown-widget {
    max-height:calc(100vh - 160px - env(safe-area-inset-bottom,0px));
    max-height:calc(100dvh - 160px - env(safe-area-inset-bottom,0px));
    overflow-y:auto;
    overscroll-behavior:contain;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav .dropdown-menu .dropdown-item {
    white-space:normal;
    overflow-wrap:anywhere;
  }
  body.mxh-extend-ui .footer-bottom-bar.mxh-nova-mobile-nav a:focus-visible,
  body.mxh-extend-ui .main-header.mxh-nova-topbar .navbar-wrapper>ul>li>a:focus-visible,
  body.mxh-extend-ui .main-header.mxh-nova-topbar .menu-icon:focus-visible {
    outline:2px solid var(--mxh-ui-accent,var(--mxh-r2-primary));
    outline-offset:-3px;
  }
}
