.topa-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  padding: 15px 40px;
  background: rgba(10, 10, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.topa-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 32px;
}

.topa-brand {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 40px;
}

.topa-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}

.topa-logo img {
  height: 31px;
  width: auto;
  display: block;
}

.topa-version {
  display: inline-block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.42);
  padding: 2px 5px;
  margin-bottom: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}

.topa-nav-desktop {
  margin-left: auto;
  flex-shrink: 0;
}

.topa-nav-mobile-wrap {
  display: none;
}

.topa-nav-drawer {
  display: none;
}

.topa-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topa-nav-link {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.topa-nav-link:hover {
  color: rgba(255, 255, 255, 0.85);
}

.topa-nav-link.active {
  color: #fff;
  font-weight: 700;
}

.topa-nav-panel {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 14px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(12, 11, 28, 0.88) 0%, rgba(8, 7, 27, 0.62) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 24px rgba(0, 0, 0, 0.18);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.topa-nav-panel-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topa-nav-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
}

.topa-nav-panel-icon svg {
  width: 15px;
  height: 15px;
}

.topa-nav-panel-divider {
  height: 1px;
  margin-top: 8px;
}

.topa-nav-panel:hover {
  transform: translateY(-1px);
}

.topa-nav-panel--kb .topa-nav-panel-inner {
  color: #e9d5ff;
}

.topa-nav-panel--kb .topa-nav-panel-icon {
  background: rgba(168, 85, 247, 0.12);
}

.topa-nav-panel--kb .topa-nav-panel-icon svg {
  fill: #c084fc;
}

.topa-nav-panel--kb .topa-nav-panel-divider {
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.38), rgba(244, 114, 182, 0.28), transparent);
}

.topa-nav-panel--kb:hover {
  border-color: rgba(168, 85, 247, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 28px rgba(168, 85, 247, 0.16);
}

.topa-nav-panel--login .topa-nav-panel-inner {
  color: #d1fae5;
}

.topa-nav-panel--login .topa-nav-panel-icon {
  background: rgba(16, 185, 129, 0.18);
}

.topa-nav-panel--login .topa-nav-panel-icon svg {
  fill: #34d399;
}

.topa-nav-panel--login .topa-nav-panel-divider {
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.45), rgba(52, 211, 153, 0.32), transparent);
}

.topa-nav-panel--login:hover {
  border-color: rgba(16, 185, 129, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 28px rgba(16, 185, 129, 0.18);
}

.topa-nav-panel--trial .topa-nav-panel-inner {
  color: #f3e8ff;
}

.topa-nav-panel--trial .topa-nav-panel-icon {
  background: rgba(99, 38, 162, 0.2);
}

.topa-nav-panel--trial .topa-nav-panel-icon svg {
  fill: #a855f7;
}

.topa-nav-panel--trial .topa-nav-panel-divider {
  background: linear-gradient(90deg, transparent, rgba(99, 38, 162, 0.55), rgba(168, 85, 247, 0.35), transparent);
}

.topa-nav-panel--trial:hover {
  border-color: rgba(99, 38, 162, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 28px rgba(99, 38, 162, 0.2);
}

.topa-nav-panel--book .topa-nav-panel-inner {
  color: #dbeafe;
}

.topa-nav-panel--book .topa-nav-panel-icon {
  background: rgba(0, 102, 255, 0.16);
}

.topa-nav-panel--book .topa-nav-panel-icon svg {
  fill: #60a5fa;
}

.topa-nav-panel--book .topa-nav-panel-divider {
  background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.45), rgba(96, 165, 250, 0.32), transparent);
}

.topa-nav-panel--book:hover {
  border-color: rgba(0, 102, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 28px rgba(0, 102, 255, 0.18);
}

.topa-nav-panel--legal .topa-nav-panel-inner {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 500;
}

.topa-nav-panel--legal .topa-nav-panel-divider {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08), transparent);
}

.topa-nav-panel--legal:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.14);
}

@media (max-width: 900px) {
  .topa-header {
    padding: 16px 24px;
  }

  .topa-header-inner {
    gap: 16px;
    flex-wrap: nowrap;
  }

  .topa-nav-panel-inner {
    font-size: 13px;
  }

  .topa-nav-panel {
    padding: 7px 12px 9px;
  }
}

.topa-kb-menu {
  position: relative;
}

.topa-kb-menu__chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #c084fc;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.topa-kb-menu.is-open .topa-kb-menu__chevron {
  transform: rotate(180deg);
}

.topa-kb-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: auto;
  width: min(620px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: linear-gradient(180deg, rgba(14, 12, 32, 0.97) 0%, rgba(8, 7, 24, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(168, 85, 247, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transform-origin: top left;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
  z-index: 1100;
  pointer-events: none;
}

.topa-kb-menu__panel::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.topa-kb-menu.is-open .topa-kb-menu__panel,
.topa-kb-menu:hover .topa-kb-menu__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.topa-kb-menu__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.topa-kb-menu__panel-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e9d5ff;
}

.topa-kb-menu__panel-count {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.topa-kb-menu__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.35) transparent;
}

.topa-kb-menu__list::-webkit-scrollbar {
  width: 6px;
}

.topa-kb-menu__list::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.35);
  border-radius: 999px;
}

.topa-kb-menu__item {
  display: block;
  padding: 9px 10px 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  border: 1px solid transparent;
  position: relative;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.topa-kb-menu__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a855f7, #f472b6);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.topa-kb-menu__item:hover,
.topa-kb-menu__item:focus-visible {
  color: #fff;
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.22);
  transform: translateX(2px);
  outline: none;
}

.topa-kb-menu__item:hover::before,
.topa-kb-menu__item:focus-visible::before {
  opacity: 1;
}

.topa-kb-menu__item-title {
  display: block;
}

.topa-kb-menu__item-desc {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.48);
}

.topa-kb-menu__item:hover .topa-kb-menu__item-desc,
.topa-kb-menu__item:focus-visible .topa-kb-menu__item-desc {
  color: rgba(255, 255, 255, 0.62);
}

.topa-kb-menu.is-open .topa-kb-menu__item,
.topa-kb-menu:hover .topa-kb-menu__item {
  animation: topa-kb-item-in 0.35s ease both;
}

.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(1),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(1) { animation-delay: 0.02s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(2),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(2) { animation-delay: 0.04s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(3),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(3) { animation-delay: 0.06s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(4),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(4) { animation-delay: 0.08s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(5),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(5) { animation-delay: 0.10s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(6),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(6) { animation-delay: 0.12s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(7),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(7) { animation-delay: 0.14s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(8),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(8) { animation-delay: 0.16s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(9),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(9) { animation-delay: 0.18s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(10),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(10) { animation-delay: 0.20s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(11),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(11) { animation-delay: 0.22s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(12),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(12) { animation-delay: 0.24s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(13),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(13) { animation-delay: 0.26s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(14),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(14) { animation-delay: 0.28s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(15),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(15) { animation-delay: 0.30s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(16),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(16) { animation-delay: 0.32s; }
.topa-kb-menu.is-open .topa-kb-menu__item:nth-child(17),
.topa-kb-menu:hover .topa-kb-menu__item:nth-child(17) { animation-delay: 0.34s; }

@keyframes topa-kb-item-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topa-kb-menu__all {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: rgba(168, 85, 247, 0.1);
  font-size: 13px;
  font-weight: 600;
  color: #e9d5ff;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.topa-kb-menu__all:hover,
.topa-kb-menu__all:focus-visible {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.42);
  color: #fff;
  outline: none;
}

/* Mobile menu toggle — hidden on desktop */
.topa-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(12, 11, 28, 0.92) 0%, rgba(8, 7, 27, 0.72) 100%);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.topa-nav-toggle:hover,
.topa-nav-toggle:focus-visible {
  border-color: rgba(168, 85, 247, 0.45);
  outline: none;
}

.topa-nav-toggle-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 18px;
}

.topa-nav-toggle-icon span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.topa-header.is-menu-open .topa-nav-toggle-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.topa-header.is-menu-open .topa-nav-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.topa-header.is-menu-open .topa-nav-toggle-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 430px) {
  .topa-brand {
    margin-left: 0;
    flex: 1;
    min-width: 0;
  }

  .topa-version {
    font-size: 8px;
    padding: 2px 4px;
    margin-bottom: 2px;
  }
}

@media (hover: none) and (min-width: 901px) {
  .topa-kb-menu:hover .topa-kb-menu__panel {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    pointer-events: none;
  }

  .topa-kb-menu.is-open .topa-kb-menu__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }
}

/* Mobile menu — must come after base .topa-nav-toggle { display: none } */
@media (max-width: 900px) {
  .topa-nav-desktop {
    display: none;
  }

  .topa-nav-mobile-wrap {
    display: block;
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
  }

  .topa-nav-toggle {
    display: inline-flex;
    position: relative;
    z-index: 1201;
  }

  .topa-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(4, 3, 14, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .topa-header.is-menu-open .topa-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .topa-nav-drawer {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    z-index: 1200;
    width: max-content;
    min-width: 240px;
    max-width: min(300px, calc(100vw - 24px));
    background: rgba(10, 10, 26, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
  }

  .topa-header.is-menu-open .topa-nav-drawer {
    display: block;
  }

  .topa-nav-mobile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .topa-nav-mobile .topa-nav-panel {
    width: 100%;
    min-height: 0;
    padding: 10px 14px 8px;
    transform: none;
  }

  .topa-nav-mobile .topa-nav-panel:hover {
    transform: translateY(-1px);
  }

  .topa-nav-mobile .topa-nav-panel-inner {
    width: auto;
    justify-content: flex-start;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
    line-height: 1.3;
  }
}
