/* Mobile navigation dropdown: preserve the desktop header, collapse tabs on small screens. */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border, #2c302e);
  border-radius: 9px;
  background: var(--panel, #141718);
  color: var(--text, #e5e8e2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.mobile-menu-toggle:hover {
  background: var(--panel-soft, #1b201c);
  border-color: var(--accent, #7d9874);
}
.mobile-menu-toggle:active { transform: scale(.96); }
.mobile-menu-glyph {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 23px;
  line-height: 1;
  transform: translateY(-1px);
}
.mobile-menu-toggle:focus-visible {
  outline: 2px solid var(--accent, #7d9874);
  outline-offset: 3px;
}

@media (max-width: 800px) {
  .topbar {
    position: relative;
    z-index: 30;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    min-height: 67px;
  }
  .topbar > .brand { min-width: 0; }
  .topbar > .header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 7px;
  }
  .mobile-menu-toggle { display: inline-flex; }
  .topbar > .top-nav {
    display: none !important;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    order: initial;
    width: min(310px, calc(100vw - 30px));
    max-width: calc(100vw - 30px);
    max-height: min(70vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--border, #2c302e);
    border-radius: 13px;
    background: var(--panel, #141718);
    box-shadow: 0 18px 48px rgba(0,0,0,.34);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .topbar.mobile-menu-open > .top-nav {
    display: flex !important;
    animation: mobileNavDrop .18s ease-out both;
  }
  .topbar > .top-nav .nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    width: 100%;
    min-height: 44px;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
  }
  .topbar > .top-nav .nav-link i,
  .topbar > .top-nav .nav-link svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    text-align: center;
  }
  .topbar > .top-nav .nav-link:after { display: none !important; }
  .topbar > .top-nav .nav-link:hover,
  .topbar > .top-nav .nav-link.active {
    background: var(--panel-soft, #1b201c);
    border-color: var(--border, #2c302e);
  }
  .topbar > .top-nav [hidden] { display: none !important; }
}
@media (max-width: 430px) {
  .topbar > .header-right { gap: 5px; }
  .mobile-menu-toggle { flex-basis: 35px; width: 35px; height: 35px; }
  .topbar .login-link { padding-left: 8px; padding-right: 8px; }
}
@keyframes mobileNavDrop {
  from { opacity: 0; transform: translateY(-5px) scale(.985); transform-origin: top right; }
  to { opacity: 1; transform: translateY(0) scale(1); transform-origin: top right; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-menu-toggle { transition: none; }
  .topbar.mobile-menu-open > .top-nav { animation: none; }
}
