.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15, 17, 21, 0.98), rgba(15, 17, 21, 0.9));
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.topnav {
  display: flex;
  gap: 0.9rem;
}

.topnav-link {
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.topnav-link:hover,
.topnav-link:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.topnav-link.is-active {
  color: var(--text);
  background: rgba(0, 168, 225, 0.15);
  border: 1px solid rgba(0, 168, 225, 0.35);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.user-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d9f4ff;
  background: rgba(0, 168, 225, 0.12);
  border: 1px solid rgba(0, 168, 225, 0.35);
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font-size: 0.86rem;
}

.logout-button {
  color: #ffd7d7;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.nav-search-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(420px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  padding: 0.6rem;
  z-index: 30;
}

.nav-search-form {
  margin: 0;
}

.nav-search-input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 0.75rem;
}

.nav-search-input:focus-visible {
  outline: 2px solid rgba(0, 168, 225, 0.7);
  outline-offset: 2px;
}

.nav-search-results {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
  max-height: 320px;
  overflow-y: auto;
}

.nav-search-item {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  color: var(--text);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}

.nav-search-item:hover,
.nav-search-item:focus-visible {
  background: rgba(0, 168, 225, 0.12);
  border-color: rgba(0, 168, 225, 0.35);
}

.nav-search-empty {
  margin: 0;
  color: var(--muted);
  padding: 0.55rem 0.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 760px) {
  .topnav {
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
  }

  .topbar {
    padding: 0.7rem 0.9rem;
    flex-wrap: wrap;
  }
}
