.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  color: #253041;
  background: linear-gradient(180deg, #f8f9fb 0%, #f2f4f7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 24px rgba(25, 37, 58, 0.08);
  border-bottom: 1px solid rgba(197, 205, 216, 0.95);
  backdrop-filter: blur(10px) saturate(120%);
}

.topbar.scrolled {
  background: linear-gradient(180deg, rgba(248, 249, 251, 0.82) 0%, rgba(242, 244, 247, 0.76) 100%);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 12px 30px rgba(25, 37, 58, 0.1);
  border-bottom-color: rgba(197, 205, 216, 0.8);
}

.nav-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: #1f2f4a;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(177, 185, 196, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.main-nav {
  display: flex;
  gap: 0.2rem;
  color: #324055;
  font-weight: 600;
}

.main-nav a {
  opacity: 0.92;
  padding: 0.58rem 0.92rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.main-nav a:hover {
  color: #1f2a3d;
  border-bottom-color: #8d96a3;
  background: linear-gradient(180deg, rgba(233, 237, 243, 0.55), rgba(214, 220, 229, 0.35));
}

.main-nav a.active {
  color: #1f2a3d;
  border-bottom-color: #6d7684;
  background: linear-gradient(180deg, rgba(230, 235, 242, 0.65), rgba(212, 219, 228, 0.45));
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
  border: 1px solid rgba(178, 186, 197, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 236, 241, 0.98) 52%, rgba(214, 220, 229, 0.98));
  color: #2e3d57;
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(24, 35, 54, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.menu-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(24, 35, 54, 0.12);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #314056, #7a8492);
  transition: transform 0.22s ease, opacity 0.22s ease, width 0.22s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  width: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 980px) {
  .main-nav {
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    top: 76px;
    display: none;
    flex-direction: column;
    gap: 0;
    background: linear-gradient(180deg, #f8f9fb 0%, #f2f4f7 100%);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(196, 204, 215, 0.95);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.94),
      0 18px 40px rgba(25, 37, 58, 0.12);
    backdrop-filter: blur(16px);
  }

  .main-nav a {
    padding: 1rem 1.05rem;
    border-radius: 0;
    border-bottom: 1px solid #edf1f7;
  }

  .main-nav a:last-child {
    border-bottom: 0;
  }

  .main-nav.open {
    display: flex;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-main {
    gap: 0.75rem;
  }

  .topbar .btn {
    display: none;
  }
}
