.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px max(16px, calc((100vw - var(--max-width)) / 2));
  background: rgba(246, 251, 247, 0.96);
  border-bottom: 1px solid rgba(220, 233, 225, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand img {
  width: clamp(150px, 17vw, 210px);
  height: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-left: auto;
}

.nav-links a,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 11px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.is-active,
.nav-trigger:hover,
.has-dropdown.is-open .nav-trigger {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

.nav-item {
  position: relative;
}

.nav-trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  display: none;
  width: 230px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.has-dropdown:hover .dropdown-panel,
.has-dropdown.is-open .dropdown-panel {
  display: grid;
  gap: 2px;
}

.dropdown-panel a {
  justify-content: flex-start;
  min-height: 40px;
  padding: 10px 12px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.icon-button {
  display: inline-flex;
  min-width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--primary-dark);
}

.icon-button.is-current {
  background: var(--surface-soft);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.currency-menu .dropdown-panel {
  right: 0;
  width: 250px;
  max-height: min(430px, calc(100svh - 110px));
  overflow-y: auto;
}

.currency-button {
  width: auto;
  padding: 0 10px;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
}

.currency-button span {
  display: inline-flex;
  min-width: 48px;
  justify-content: center;
}

.currency-panel button {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-weight: 800;
  text-align: left;
}

.currency-panel button:hover,
.currency-panel button.is-selected {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

@media (max-width: 920px) {
  .topbar {
    min-height: 68px;
  }

  .nav-links {
    position: fixed;
    inset: 68px 14px auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    margin-left: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a,
  .nav-trigger {
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
    padding: 11px 12px;
  }

  .dropdown-panel {
    position: static;
    width: 100%;
    margin: 2px 0 8px;
    box-shadow: none;
  }

  .has-dropdown:hover .dropdown-panel {
    display: none;
  }

  .has-dropdown.is-open .dropdown-panel {
    display: grid;
  }

  .header-actions {
    justify-content: flex-end;
    margin-left: 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .currency-menu .dropdown-panel {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand img {
    width: 144px;
  }
}
