:root {
  --product-header-height: 62px;
  --app-header-height: var(--product-header-height);
}

.product-header {
  width: 100%;
  position: relative;
  z-index: 20;
  color: var(--product-header-text, var(--text, #11120f));
  background: var(--product-header-bg, transparent);
  border-bottom: 1px solid var(--product-header-line, var(--line, rgba(17, 18, 15, .1)));
}

.product-header--sticky {
  position: sticky;
  top: 0;
}

.product-header--overlay {
  position: absolute;
  inset: 0 0 auto;
}

.product-header-inner {
  width: min(100%, 1280px);
  min-height: var(--product-header-height);
  margin: 0 auto;
  padding-right: max(28px, env(safe-area-inset-right));
  padding-left: max(28px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 0;
}

.botnest-wordmark {
  flex: 0 0 auto;
  color: inherit;
  font-family: "Space Grotesk", sans-serif;
  font-size: var(--botnest-wordmark-size, 15px);
  font-weight: 450;
  line-height: 1;
  letter-spacing: .05em;
  text-decoration: none;
  text-transform: lowercase;
}

.botnest-wordmark:hover { color: inherit; }

.product-header-context {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.product-header--sectioned .product-header-inner { gap: 0; }

.product-header-section-context {
  justify-content: flex-start;
  gap: 12px;
  margin-left: 6px;
}

.product-header-section-link {
  min-width: 0;
  max-width: min(280px, 30vw);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  overflow: hidden;
  color: var(--product-header-muted, var(--muted, #6d6e67));
  font-family: "Space Grotesk", sans-serif;
  font-size: var(--botnest-wordmark-size, 15px);
  font-weight: 450;
  line-height: 1;
  letter-spacing: .05em;
  text-decoration: none;
  text-transform: lowercase;
  white-space: nowrap;
  transition: color .16s ease;
}

.product-header-section-link > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-header-section-separator {
  color: color-mix(in srgb, var(--product-header-muted, var(--muted, #6d6e67)) 58%, transparent);
}

.product-header-section-link:hover,
.product-header-section-link:focus-visible {
  color: var(--product-header-text, var(--text, #11120f));
  background: transparent;
  outline: 0;
}

.product-header-section-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.product-header-logout { margin: 0; }

.product-header-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  color: var(--product-header-text, var(--text, #11120f));
  background: var(--product-header-surface, var(--card, #fff));
  border: 1px solid var(--product-header-line, var(--line, rgba(17, 18, 15, .1)));
  border-radius: 999px;
  font: 510 13px/1 "Space Grotesk", sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .18s ease, color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.product-header-action--primary {
  color: #fff;
  background: var(--product-header-primary, #28a8e9);
  border-color: var(--product-header-primary, #28a8e9);
  box-shadow: 0 8px 20px rgba(40, 168, 233, .22);
}

.product-header-action:hover {
  color: var(--product-header-text, var(--text, #11120f));
  border-color: color-mix(in srgb, var(--product-header-primary, #28a8e9) 35%, transparent);
  transform: translateY(-1px);
}

.product-header-action--primary:hover {
  color: #fff;
  background: var(--product-header-primary-hover, #159bdc);
  border-color: var(--product-header-primary-hover, #159bdc);
  box-shadow: 0 12px 26px rgba(40, 168, 233, .3);
}

.product-header-action:focus-visible,
.botnest-wordmark:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--product-header-primary, #28a8e9) 30%, transparent);
  outline-offset: 2px;
}

.product-header-action:active { transform: translateY(0); }

.product-header-profile {
  position: relative;
}

.product-header-profile-button {
  width: 38px;
  height: 38px;
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  color: #fff;
  background: var(--product-header-primary, #28a8e9);
  border: 2px solid var(--product-header-surface, var(--card, #fff));
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--product-header-line, var(--line, rgba(17, 18, 15, .1))), 0 8px 22px rgba(17, 18, 15, .15);
  font: 750 17px/1 "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.product-header-profile-button:hover,
.product-header-profile-button:focus-visible {
  outline: 0;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 0 1px var(--product-header-line, var(--line, rgba(17, 18, 15, .1))), 0 12px 28px rgba(17, 18, 15, .2);
}

.product-header-profile-button:focus-visible {
  box-shadow:
    0 0 0 3px var(--product-header-bg, #f7f7f3),
    0 0 0 5px color-mix(in srgb, var(--product-header-primary, #28a8e9) 35%, transparent),
    0 12px 28px rgba(17, 18, 15, .2);
}

.product-header-profile-button img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-header-profile-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.product-header-profile-menu {
  width: 238px;
  position: absolute;
  z-index: 40;
  top: 49px;
  right: 0;
  padding: 20px;
  color: var(--product-header-text, var(--text, #11120f));
  text-align: left;
  background: var(--product-header-surface, var(--card, #fff));
  border: 1px solid var(--product-header-line, var(--line, rgba(17, 18, 15, .1)));
  border-radius: 22px;
  box-shadow: 0 26px 70px rgba(15, 16, 13, .18);
  animation: product-header-menu-in .18s ease both;
}

.product-header-profile-menu[hidden] { display: none; }

.product-header-profile-menu strong,
.product-header-profile-menu small {
  max-width: 100%;
  display: block;
  overflow-wrap: anywhere;
}

.product-header-profile-menu strong {
  font-size: 17px;
  font-weight: 610;
}

.product-header-profile-menu small {
  margin-top: 5px;
  color: var(--product-header-muted, var(--muted, #6d6e67));
  font-size: 13px;
}

.product-header-profile-divider {
  height: 1px;
  display: block;
  margin: 18px 0 10px;
  background: var(--product-header-line, var(--line, rgba(17, 18, 15, .1)));
}

.product-header-profile-menu a,
.product-header-profile-menu button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0;
  color: var(--product-header-text, var(--text, #11120f));
  background: transparent;
  border: 0;
  font: 500 14px/1 "Space Grotesk", sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.product-header-profile-menu a:hover,
.product-header-profile-menu a:focus-visible,
.product-header-profile-menu button:hover,
.product-header-profile-menu button:focus-visible {
  color: var(--product-header-primary, #28a8e9);
  outline: 0;
}

@keyframes product-header-menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(.98);
  }
}

.landing-page {
  --product-header-bg: var(--bg);
  --product-header-surface: var(--surface);
  --product-header-text: var(--text);
  --product-header-muted: var(--muted);
  --product-header-line: var(--line);
  --product-header-primary: var(--telegram);
  --product-header-primary-hover: var(--telegram-hover);
}

.product-light {
  --product-header-bg: var(--product-bg);
  --product-header-surface: var(--product-surface);
  --product-header-text: var(--product-text);
  --product-header-muted: var(--product-muted);
  --product-header-line: var(--product-line);
  --product-header-primary: var(--product-primary);
  --product-header-primary-hover: #159bdc;
}

.onboarding-page {
  --product-header-bg: var(--on-bg);
  --product-header-surface: var(--on-surface);
  --product-header-text: var(--on-text);
  --product-header-muted: var(--on-muted);
  --product-header-line: var(--on-line);
  --product-header-primary: var(--on-primary);
  --product-header-primary-hover: var(--on-primary-dark);
}

.creator-page {
  --product-header-bg: var(--creator-bg);
  --product-header-surface: var(--creator-surface);
  --product-header-text: var(--creator-ink);
  --product-header-muted: var(--creator-muted);
  --product-header-line: var(--creator-line);
  --product-header-primary: var(--creator-accent);
  --product-header-primary-hover: #159bdc;
}

.telegram-auth-page {
  --product-header-bg: var(--product-bg);
  --product-header-surface: var(--product-surface);
  --product-header-text: var(--auth-ink);
  --product-header-muted: var(--auth-muted);
  --product-header-line: var(--auth-line);
  --product-header-primary: var(--auth-telegram);
  --product-header-primary-hover: #178ec6;
}

.flow-product {
  --product-header-bg: var(--product-bg);
  --product-header-surface: var(--product-surface);
  --product-header-text: var(--product-text);
  --product-header-muted: var(--product-muted);
  --product-header-line: var(--product-line);
  --product-header-primary: var(--product-primary);
  --product-header-primary-hover: var(--product-primary-hover);
}

.flow-product .product-header {
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}

.product-header-section-link:focus-visible,
.flow-header-tool:focus-visible,
.flow-header-save:focus-visible,
.flow-header-menu-action:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--product-header-primary) 22%, transparent);
}

.flow-header-status {
  min-width: 0;
  max-width: min(280px, 24vw);
  overflow: hidden;
  color: var(--product-header-muted);
  font: 500 11px/1.3 "Space Grotesk", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-product .flow-actions { gap: 7px; }

.flow-product .flow-header-tool,
.flow-product .flow-header-save {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--product-header-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  box-shadow: none;
  font: 520 12px/1 "Space Grotesk", sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.flow-product .flow-header-tool svg,
.flow-product .flow-header-menu-action svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.flow-product .flow-header-tool:hover,
.flow-product .flow-header-tool:focus-visible {
  color: var(--product-header-text);
  background: rgba(255, 255, 255, .8);
  border-color: var(--product-header-line);
  outline: 0;
}

.flow-product .flow-header-save {
  min-width: 0;
  min-height: 32px;
  padding: 0 5px;
  color: var(--product-header-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 500;
  text-transform: lowercase;
}

.flow-product .flow-header-save:hover,
.flow-product .flow-header-save:focus-visible {
  color: var(--product-header-text);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: 0;
  transform: none;
}

.flow-product .flow-header-save[disabled] {
  color: color-mix(in srgb, var(--product-header-muted) 48%, transparent);
  background: transparent;
  text-decoration: none;
  box-shadow: none;
  transform: none;
}

.flow-product .flow-header-save[hidden] { display: none !important; }

.flow-header-more {
  position: relative;
}

.flow-header-more > summary {
  width: 36px;
  padding: 0;
  list-style: none;
}

.flow-header-more > summary::-webkit-details-marker { display: none; }
.flow-header-more > summary::marker { content: ""; }

.flow-header-more[open] > summary {
  color: var(--product-header-primary);
  background: var(--product-header-surface);
  border-color: var(--product-header-line);
}

.flow-header-more-menu {
  width: 220px;
  max-height: min(280px, calc(100dvh - var(--product-header-height) - 18px));
  position: absolute;
  z-index: 50;
  top: 44px;
  right: 0;
  padding: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--product-header-text);
  background: var(--product-header-surface);
  border: 1px solid var(--product-header-line);
  border-radius: 16px;
  box-shadow: 0 22px 58px rgba(17, 18, 15, .16);
  animation: product-header-menu-in .16s ease both;
}

.flow-product .flow-header-menu-action {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: var(--product-header-text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font: 500 13px/1 "Space Grotesk", sans-serif;
  cursor: pointer;
}

.flow-product .flow-header-menu-action:hover,
.flow-product .flow-header-menu-action:focus-visible {
  color: var(--product-header-text);
  background: color-mix(in srgb, var(--product-header-primary) 8%, transparent);
  outline: 0;
}

.flow-header-switch-indicator {
  width: 30px;
  height: 18px;
  position: relative;
  margin-left: auto;
  background: color-mix(in srgb, var(--product-header-text) 12%, transparent);
  border-radius: 999px;
  transition: background-color .16s ease;
}

.flow-header-switch-indicator::after {
  content: "";
  width: 14px;
  height: 14px;
  position: absolute;
  top: 2px;
  left: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(17, 18, 15, .2);
  transition: transform .16s ease;
}

.flow-debug-action.on .flow-header-switch-indicator { background: var(--product-header-primary); }
.flow-debug-action.on .flow-header-switch-indicator::after { transform: translateX(12px); }

.flow-product .product-header-profile-button {
  padding: 0;
  color: #fff;
  background: var(--product-header-primary);
  border: 2px solid var(--product-header-surface);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px var(--product-header-line),
    0 8px 22px rgba(17, 18, 15, .15);
}

.flow-product .product-header-profile-button:hover,
.flow-product .product-header-profile-button:focus-visible {
  background: var(--product-header-primary);
  border-color: var(--product-header-surface);
}

.flow-product .product-header-profile-menu button {
  padding: 0;
  color: var(--product-header-text);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font: 500 14px/1 "Space Grotesk", sans-serif;
}

.flow-product .product-header-profile-menu button:hover,
.flow-product .product-header-profile-menu button:focus-visible {
  color: var(--product-header-primary);
  background: transparent;
  box-shadow: none;
}

@media (max-width: 880px) {
  .flow-header-status { display: none; }
}

@media (max-width: 700px) {
  .flow-product .product-header-inner {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }
  .flow-product .flow-actions { gap: 4px; }
  .product-header-section-context { margin-left: 4px; }
  .product-header-section-link {
    max-width: min(150px, 34vw);
    gap: 4px;
  }
  .flow-product .flow-header-save {
    min-width: 0;
    padding-inline: 4px;
    font-size: 11px;
  }
  .flow-product .product-header-profile-button {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 380px) {
  .flow-product .botnest-wordmark {
    font-size: 13px;
    letter-spacing: .035em;
  }
  .flow-product .flow-header-save {
    min-width: 0;
    padding-inline: 3px;
  }
  .flow-product .product-header-profile-button {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 700px) {
  :root { --product-header-height: 58px; }

  .product-header-inner {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
    gap: 8px;
  }

  .botnest-wordmark { --botnest-wordmark-size: 14px; }
  .product-header-section-context {
    min-width: 0;
    margin-left: 2px;
  }
  .product-header-section-link {
    max-width: min(132px, 38vw);
    min-height: 34px;
    font-size: 13px;
  }
  .product-header-actions { gap: 6px; }
  .product-header-action {
    min-height: 32px;
    padding: 0 11px;
    font-size: 12px;
  }
  .product-header-profile-button {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  .product-header-profile-menu {
    width: min(238px, calc(100vw - max(28px, env(safe-area-inset-left) + env(safe-area-inset-right))));
    top: 45px;
    right: 0;
    padding: 17px;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-header-action,
  .product-header-profile-button,
  .product-header-profile-menu {
    transition: none;
    animation: none;
  }

  .product-header-action:hover,
  .flow-header-save:hover,
  .product-header-profile-button:hover,
  .product-header-profile-button:focus-visible {
    transform: none;
  }
}
