/* Global navigation shared by every public and authenticated AI Lab surface. */
.platform-header {
  --platform-header-bg: #07110f;
  --platform-header-surface: #101c18;
  --platform-header-text: #f1f7f3;
  --platform-header-muted: #9badA3;
  --platform-header-line: rgba(255, 255, 255, .13);
  --platform-header-accent: #b7ff63;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(7, 17, 15, .96);
  color: var(--platform-header-text);
  border-bottom: 1px solid rgba(183, 255, 99, .24);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.platform-header,
.platform-header * { box-sizing: border-box; }

.platform-header a { color: inherit; text-decoration: none; }

.platform-header__inner {
  width: min(1320px, calc(100% - 48px));
  min-height: 70px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(18px, 3vw, 44px);
}

.platform-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  min-width: 0;
}

.platform-header__mark {
  width: 32px;
  height: 32px;
  position: relative;
  flex: 0 0 auto;
  transform: rotate(45deg);
}

.platform-header__mark::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--platform-header-accent);
}

.platform-header__mark i {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--platform-header-accent);
  box-shadow: 0 0 10px var(--platform-header-accent);
}

.platform-header__mark i:nth-child(1) { top: 0; left: 0; }
.platform-header__mark i:nth-child(2) { right: 0; bottom: 0; }
.platform-header__mark i:nth-child(3) { top: 50%; left: 50%; transform: translate(-50%, -50%); }

.platform-header__brand-copy {
  display: grid;
  gap: 2px;
  letter-spacing: .16em;
  white-space: nowrap;
}

.platform-header__brand-copy strong { font-size: 12px; line-height: 1; }
.platform-header__brand-copy small {
  color: var(--platform-header-accent);
  font: 750 8px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .28em;
}

.platform-header__services {
  min-width: 0;
  position: relative;
  display: grid;
  justify-content: center;
}

.platform-header__services > a {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  color: #c0ccc5;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.platform-header__services > a:hover,
.platform-header__services > a:focus-visible {
  color: #fff;
  border-color: var(--platform-header-line);
  background: rgba(255, 255, 255, .06);
}

.platform-header__services > a[aria-current="page"] {
  color: #08100c;
  border-color: var(--platform-header-accent);
  background: var(--platform-header-accent);
}

.platform-services-menu {
  width: 220px;
  position: relative;
}

.platform-services-menu summary {
  list-style: none;
}

.platform-services-menu summary::-webkit-details-marker { display: none; }

.platform-services-menu__summary {
  min-height: 40px;
  padding: 0 12px 0 14px;
  display: grid;
  grid-template-columns: 1fr auto 12px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--platform-header-line);
  background: rgba(255, 255, 255, .035);
  color: var(--platform-header-text);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}

.platform-services-menu__summary:hover,
.platform-services-menu__summary:focus-visible,
.platform-services-menu[open] .platform-services-menu__summary {
  border-color: var(--platform-header-accent);
  background: rgba(183, 255, 99, .08);
  outline: none;
}

.platform-services-menu__summary span {
  font-size: 12px;
  font-weight: 800;
}

.platform-services-menu__summary small {
  max-width: 92px;
  overflow: hidden;
  color: var(--platform-header-accent);
  font: 700 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-services-menu__summary i {
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .18s ease;
}

.platform-services-menu[open] .platform-services-menu__summary i {
  transform: translateY(2px) rotate(225deg);
}

.platform-services-menu__panel {
  width: 360px;
  padding: 8px;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 20;
  display: grid;
  gap: 4px;
  transform: translateX(-50%);
  border: 1px solid rgba(183, 255, 99, .32);
  background: #0b1713;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .42);
}

.platform-services-menu__link {
  min-height: 62px;
  padding: 11px 13px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid transparent;
  color: var(--platform-header-text) !important;
  transition: border-color .18s ease, background .18s ease;
}

.platform-services-menu__link span {
  font-size: 12px;
  font-weight: 800;
}

.platform-services-menu__link small {
  color: #8fa198;
  font-size: 10px;
  line-height: 1.35;
}

.platform-services-menu__link:hover,
.platform-services-menu__link:focus-visible {
  border-color: var(--platform-header-line);
  background: rgba(255, 255, 255, .06);
  outline: none;
}

.platform-services-menu__link[aria-current="page"] {
  border-color: var(--platform-header-accent);
  background: rgba(183, 255, 99, .1);
}

.platform-services-menu__link[aria-current="page"] span { color: var(--platform-header-accent); }

.platform-header__end,
.platform-header__account {
  display: flex;
  align-items: center;
  gap: 7px;
}

.platform-header__end { justify-self: end; min-width: 0; }

.platform-header__agency {
  margin-right: 5px;
  color: #a8b8af !important;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.platform-header__agency:hover { color: var(--platform-header-accent) !important; }

.platform-header__account[aria-busy="true"] { opacity: .72; }

.platform-header__account a,
.platform-header__account button,
.platform-header .theme-toggle {
  min-height: 36px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--platform-header-line);
  border-radius: 0;
  background: transparent;
  color: var(--platform-header-text);
  font: 750 10px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.platform-header__account a:hover,
.platform-header__account button:hover,
.platform-header .theme-toggle:hover {
  color: var(--platform-header-accent);
  border-color: var(--platform-header-accent);
}

.platform-header__account .platform-header__register {
  border-color: var(--platform-header-accent);
  background: var(--platform-header-accent);
  color: #08100c;
}

.platform-header__account .platform-header__register:hover {
  background: #cbff90;
  color: #08100c;
}

.platform-header__account .platform-header__user {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--platform-header-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.platform-header__account form { margin: 0; display: flex; }
.platform-header__account button:disabled { opacity: .5; cursor: wait; }
.platform-header .theme-toggle { padding-inline: 10px; }

@media (max-width: 1120px) {
  .platform-header__inner { gap: 18px; }
  .platform-header__services > a { padding-inline: 9px; font-size: 11px; }
  .platform-header__agency { display: none; }
}

@media (max-width: 820px) {
  .platform-header__inner {
    width: min(100% - 28px, 1320px);
    min-height: 108px;
    padding: 11px 0 9px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
  }

  .platform-header__services {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-content: stretch;
  }

  .platform-header__services > a { min-height: 34px; }
  .platform-services-menu { width: 100%; }
  .platform-services-menu__summary { min-height: 34px; }
  .platform-services-menu__panel {
    width: 100%;
    left: 0;
    transform: none;
  }
  .platform-header__end { grid-column: 2; grid-row: 1; }
}

@media (max-width: 540px) {
  .platform-header__inner { width: calc(100% - 20px); }
  .platform-header__brand { gap: 9px; }
  .platform-header__mark { width: 28px; height: 28px; }
  .platform-header__brand-copy strong { font-size: 10px; }
  .platform-header__brand-copy small { font-size: 7px; }
  .platform-header__account { gap: 4px; }
  .platform-header__account a,
  .platform-header__account button,
  .platform-header .theme-toggle { min-height: 32px; padding-inline: 8px; font-size: 9px; }
  .platform-header__account .platform-header__user { max-width: 82px; }
  .platform-header__account .platform-header__account-link { display: none; }
  .platform-header .theme-toggle [data-theme-label] { font-size: 0; }
  .platform-header .theme-toggle [data-theme-label]::after { content: "Тема"; font-size: 9px; }
}

@media (max-width: 390px) {
  .platform-header__brand-copy strong { display: none; }
  .platform-header__brand-copy small { letter-spacing: .16em; }
  .platform-header__account .platform-header__register { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .platform-header * { scroll-behavior: auto !important; transition: none !important; }
}
