/* Единая шапка публичных страниц в оформлении главной страницы. */
.tm-header {
  --ink: #172033;
  --line: #dce3f1;
  --accent: #665ff4;
  --accent-2: #8e65f2;
  --success: #0fba83;
  --page-gutter: clamp(14px, 2.5vw, 64px);
  position: sticky;
  z-index: 100;
  top: 0;
  height: 76px;
  border-bottom: 1px solid rgba(220, 227, 241, .85);
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.58;
}
.tm-header, .tm-header * { box-sizing: border-box; }
.tm-header a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tm-header button { font: inherit; -webkit-tap-highlight-color: transparent; }
.tm-header svg { display: block; max-width: 100%; }
.tm-header .tm-container { width: 100%; margin-inline: auto; padding-inline: var(--page-gutter); }
.tm-header__inner { display: flex; align-items: center; height: 100%; gap: 28px; }
.tm-logo { display: inline-flex; align-items: center; gap: 10px; min-width: max-content; font-size: 22px; font-weight: 900; letter-spacing: -.04em; }
.tm-logo__mark { position: relative; width: 28px; height: 28px; border-radius: 9px 9px 13px 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); transform: rotate(-7deg); box-shadow: 0 8px 18px rgba(102, 95, 244, .28); }
.tm-logo__mark::after { position: absolute; inset: 7px; content: ""; border: 2px solid rgba(255, 255, 255, .9); border-radius: 5px; }
.tm-nav { display: flex; align-items: center; justify-content: center; gap: 25px; margin-inline: auto; }
.tm-nav__list { display: flex; align-items: center; gap: 25px; margin: 0; padding: 0; list-style: none; }
.tm-nav__item { position: relative; }
.tm-nav__row { display: flex; align-items: center; }
.tm-nav > a, .tm-nav__link { position: relative; color: #34405a; font-size: 15px; font-weight: 650; white-space: nowrap; }
.tm-nav > a::after, .tm-nav__link::after { position: absolute; right: 0; bottom: -8px; left: 0; height: 2px; content: ""; background: var(--accent); transform: scaleX(0); transition: transform .2s ease; }
.tm-nav > a:hover::after, .tm-nav > a[aria-current="page"]::after, .tm-nav__link:hover::after, .tm-nav__link[aria-current="page"]::after { transform: scaleX(1); }
.tm-nav__submenu-toggle { display: inline-grid; width: 24px; height: 24px; margin-left: 2px; padding: 0; place-items: center; border: 0; border-radius: 7px; color: #65708a; background: transparent; cursor: pointer; }
.tm-nav__submenu-toggle:hover, .tm-nav__submenu-toggle:focus-visible { color: var(--accent); background: #f0efff; }
.tm-nav__submenu-toggle svg { transition: transform .2s ease; }
.tm-nav__submenu { position: absolute; top: calc(100% + 18px); left: -16px; min-width: 220px; margin: 0; padding: 8px; visibility: hidden; list-style: none; border: 1px solid var(--line); border-radius: 14px; opacity: 0; background: #fff; box-shadow: 0 18px 45px rgba(26, 32, 58, .14); transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility .18s ease; }
.tm-nav__submenu::before { position: absolute; right: 0; bottom: 100%; left: 0; height: 19px; content: ""; }
.tm-nav__submenu a { display: block; padding: 11px 12px; border-radius: 9px; color: #34405a; font-size: 14px; font-weight: 650; white-space: nowrap; }
.tm-nav__submenu a:hover, .tm-nav__submenu a:focus-visible { color: var(--accent); background: #f4f3ff; }
.tm-nav__item--has-children:hover > .tm-nav__submenu, .tm-nav__item--has-children:focus-within > .tm-nav__submenu, .tm-nav__item--has-children.is-open > .tm-nav__submenu { visibility: visible; opacity: 1; transform: translateY(0); }
.tm-nav__item--has-children:hover .tm-nav__submenu-toggle svg, .tm-nav__item--has-children:focus-within .tm-nav__submenu-toggle svg, .tm-nav__item--has-children.is-open .tm-nav__submenu-toggle svg { transform: rotate(180deg); }
.tm-header__actions { display: flex; align-items: center; gap: 14px; min-width: max-content; }
.tm-telegram-links { display: flex; align-items: center; gap: 8px; }
.tm-telegram-link { display: inline-grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border: 1px solid #cfe2ec; border-radius: 12px; color: #229ed9; background: #f4fbfe; transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.tm-telegram-link:hover { border-color: #9dd2e9; color: #168ac2; background: #eaf8fd; box-shadow: 0 10px 24px rgba(34, 158, 217, .18); transform: translateY(-2px); }
.tm-telegram-link:focus-visible { outline: 3px solid rgba(34, 158, 217, .24); outline-offset: 3px; }
.tm-telegram-link svg { width: 22px; height: 22px; }
.tm-login { color: #37425b; font-size: 15px; font-weight: 700; }
.tm-account-link { position: relative; display: inline-flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 24px 0 14px; border: 1px solid #c9c6ff; border-radius: 12px; color: #5046d8; background: #f3f2ff; font-size: 15px; font-weight: 800; transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.tm-account-link:hover { border-color: #aaa5ff; color: #4438ca; background: #ebe9ff; box-shadow: 0 10px 24px rgba(102, 95, 244, .16); transform: translateY(-2px); }
.tm-account-link:focus-visible { outline: 3px solid rgba(102, 95, 244, .24); outline-offset: 3px; }
.public-account-link__icon { flex: 0 0 auto; }
.public-account-link__status { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: var(--success); box-sizing: content-box; }
.tm-header .tm-btn { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; padding: 0 22px; border: 1px solid transparent; border-radius: 13px; cursor: pointer; font-size: 16px; font-weight: 800; line-height: 1.2; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.tm-header .tm-btn:hover { transform: translateY(-2px); }
.tm-header .tm-btn--primary { color: #fff; background: linear-gradient(135deg, var(--accent), #7759ef); box-shadow: 0 13px 28px rgba(102, 95, 244, .25); }
.tm-header .tm-btn--primary:hover { box-shadow: 0 17px 34px rgba(102, 95, 244, .34); }
.tm-menu-button { display: none; width: 46px; height: 46px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.tm-menu-button span { display: block; width: 20px; height: 2px; margin: 4px auto; background: var(--ink); transition: transform .2s ease, opacity .2s ease; }
.tm-menu-button[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.tm-menu-button[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.tm-menu-button[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
body.menu-open { overflow: hidden; }

@media (max-width: 1120px) {
  .tm-nav, .tm-nav__list { gap: 15px; }
  .tm-nav > a, .tm-nav__link { font-size: 13px; }
}

@media (max-width: 920px) {
  .tm-header__inner { gap: 12px; }
  .tm-menu-button { display: block; margin-left: auto; }
  .tm-nav { position: absolute; top: 100%; right: 0; display: none; width: min(390px, 100%); height: calc(100vh - 76px); padding: 28px; overflow-y: auto; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; background: #fff; box-shadow: -20px 30px 60px rgba(26, 32, 58, .16); overscroll-behavior: contain; }
  .tm-nav.is-open { display: flex; }
  .tm-nav__list { display: flex; width: 100%; flex-direction: column; align-items: stretch; gap: 0; }
  .tm-nav__item { border-bottom: 1px solid #edf0f6; }
  .tm-nav__row { width: 100%; }
  .tm-nav > a, .tm-nav__link { padding: 15px 6px; border-bottom: 1px solid #edf0f6; font-size: 17px; }
  .tm-nav__link { flex: 1; border-bottom: 0; }
  .tm-nav > a::after, .tm-nav__link::after { display: none; }
  .tm-nav__submenu-toggle { width: 48px; height: 48px; margin-left: 8px; flex: 0 0 auto; }
  .tm-nav__submenu { position: static; display: none; min-width: 0; padding: 0 0 10px 14px; visibility: visible; border: 0; border-radius: 0; opacity: 1; background: transparent; box-shadow: none; transform: none; transition: none; }
  .tm-nav__submenu::before { display: none; }
  .tm-nav__submenu a { padding: 11px 12px; border-left: 2px solid #dedcff; border-radius: 0; white-space: normal; }
  .tm-nav__item--has-children.is-open > .tm-nav__submenu { display: block; }
  .tm-header__actions .tm-btn { display: none; }
}

@media (max-width: 680px) {
  .tm-header { height: 68px; }
  .tm-nav { height: calc(100vh - 68px); }
  .tm-login { display: none; }
  .tm-header__actions--authenticated .tm-telegram-links { display: none; }
  .tm-account-link { width: 42px; min-height: 42px; justify-content: center; padding: 0; }
  .tm-account-link .public-account-link__text { display: none; }
}
