.topbar {
  --header-top: 18px;
  --header-left: 28px;
  --header-right: 24px;
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  align-self: stretch;
  gap: 10px 12px;
  padding: 0;
  margin: var(--header-top) var(--header-right) 0 var(--header-left);
}

body:has(.login-card) {
  padding-top: 0;
}

body:has(.login-card) .topbar {
  margin-right: calc(var(--header-right) - 20px);
  margin-bottom: 20px;
  margin-left: calc(var(--header-left) - 20px);
}

body:has(.login-card) .login-card {
  margin-block: auto;
}

body:has(.login-card) .footer {
  position: static;
  transform: none;
  margin-top: 24px;
}

.hamburger {
  padding: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid #1f2a3a;
  background: #121826;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: 0.2s ease;
}

.hamburger:focus-visible,
.menu-link:focus-visible {
  outline: 2px solid #9ab6ff;
  outline-offset: -3px;
}

.hamburger:hover {
  border-color: #4f7cff;
}

.hamburger span {
  width: 18px;
  height: 2px;
  background: #ffffff;
  border-radius: 999px;
  transition: 0.2s ease;
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 999;
  width: min(220px, 100%);
  max-height: calc(100dvh - var(--header-top) - 58px);
  background: #121826;
  border: 1px solid #1f2a3a;
  border-radius: 18px;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}

.menu-dropdown.open {
  display: block;
}

.menu-link {
  display: block;
  padding: 16px 18px;
  color: #e6e6e6;
  text-decoration: none;
  font-size: 15px;
  border-bottom: 1px solid #1f2a3a;
  transition: 0.2s ease;
}

.menu-link:last-child {
  border-bottom: none;
}

.menu-link[aria-current="page"] {
  color: #fff;
  font-weight: 600;
}

.menu-link:hover {
  background: #0e1420;
  color: #7fa2ff;
}

@media (max-width: 768px) {
  .topbar {
    --header-top: 14px;
    --header-left: 20px;
    --header-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hamburger, .menu-dropdown, .menu-link { transition: none; }
}
