/* Main menu dropdowns: keep child links anchored below their parent item. */
@media (min-width: 992px) {
  #utpl-header,
  #utpl-header > .container,
  #utpl-header .navbar-collapse,
  #utpl-header .navbar-nav,
  #utpl-header .nav-item.dropdown {
    overflow: visible;
  }

  #utpl-header .navbar-nav .nav-item.dropdown {
    position: relative;
  }

  #utpl-header .navbar-nav .dropdown-menu {
    top: 100% !important;
    bottom: auto !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    z-index: 1300;
    margin-top: 0 !important;
  }

  #utpl-header .navbar-nav .nav-item.dropdown:last-child > .dropdown-menu {
    left: auto !important;
    right: 0 !important;
  }
}

/* Mobile navigation: keep the expanded panel readable on narrow screens. */
@media (max-width: 991.98px) {
  #utplMainNav {
    max-height: calc(100dvh - var(--utpl-header-height-mobile));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.65rem 0.85rem;
  }

  #utplMainNav .navbar-nav {
    align-items: stretch;
    gap: 0.1rem !important;
  }

  #utplMainNav .navbar-nav > li,
  #utplMainNav .navbar-nav > .nav-item {
    display: block;
    width: 100%;
  }

  #utplMainNav .nav-link-utpl {
    min-height: 0;
    justify-content: flex-start;
    padding: 0.62rem 0.75rem !important;
    font-size: 1rem;
    line-height: 1.25;
    text-align: left;
  }

  #utplMainNav .dropdown-menu {
    min-width: 0;
    margin: 0.1rem 0 0.35rem;
    padding: 0 0 0 0.8rem;
  }

  #utplMainNav .dropdown-item {
    padding: 0.42rem 0.75rem;
    border-left-color: rgba(255, 255, 255, 0.38);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.92rem;
    line-height: 1.25;
  }

  #utplMainNav .dropdown-item:hover,
  #utplMainNav .dropdown-item:focus,
  #utplMainNav .dropdown-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
  }
}
