/* MOEX Header Menu — без горизонтальных скроллов. ПК: hover dropdown. Мобайл: drawer справа. */

.moex-hm{ position:relative; z-index:9999; }
.moex-hm__bar{ background:#fff; border-bottom:1px solid rgba(0,0,0,.06); }
.moex-hm__bar-inner{
  max-width:1200px;
  margin:0 auto;
  padding:10px 12px;
  display:flex;
  align-items:center;
  gap:12px;
  justify-content:space-between;
}

.moex-hm__nav{ width:100%; }
.moex-hm__nav--desktop{ display:none; }
.moex-hm__nav--mobile{ display:block; }

.moex-hm__right{display:flex;gap:10px;flex:0 0 auto;flex-direction: row-reverse;align-items: center;}

/* Username pill */
.moex-hm__user{
  display:inline-flex;
  align-items:center;
  max-width:52vw;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.10);
  background:rgba(15,23,42,.03);
  color:#0f172a;
  text-decoration:none;
  font-weight:600;
  font-size:14px;
  line-height:1.2;
}
.moex-hm__user-text{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.moex-hm__menu{ list-style:none; margin:0; padding:0; }
.moex-hm__item{ position:relative; }
.moex-hm__label{ display:inline-flex; align-items:center; gap:8px; }
.moex-hm__icon{ font-size:18px; width:18px; height:18px; line-height:18px; }
.moex-hm__link{
  display:inline-flex;
  align-items:center;
  padding:10px 12px;
  border-radius:999px;
  text-decoration:none;
  color:#0f172a;
  line-height:1.2;
  font-weight:600;
}
.moex-hm__link:hover{ background:rgba(15,23,42,.06); max-width: -webkit-fill-available; }
.moex-hm__link--nolink{ cursor:default; }

.moex-hm__submenu{
  list-style:none;
  margin:0;
  padding:8px;
  border:1px solid rgba(0,0,0,.08);
  background:#fff;
  border-radius:14px;
}

.moex-hm__burger{
  width:44px; height:44px;
  border:1px solid rgba(0,0,0,.10);
  background:#fff;
  border-radius:12px;
  padding:10px;
  display:inline-flex;
  flex-direction:column;
  justify-content:center;
  gap:5px;
}
.moex-hm__burger span{ height:2px; width:100%; background:#0f172a; border-radius:2px; display:block; }

/* Desktop */
@media (min-width:920px){
  .moex-hm__nav--desktop{ display:block; }
  .moex-hm__nav--mobile{ display:none; }
  .moex-hm__burger{ display:none; }

  .moex-hm__menu{
    display:flex;
    flex-wrap:wrap; /* без горизонтального скролла */
    gap:6px;
    justify-content:flex-start;
  }

  .moex-hm__submenu{
    position:absolute;
    /*top:calc(100% + 8px);*/
    left:30px;
    min-width:240px;
    display:none;
    box-shadow:0 12px 30px rgba(0,0,0,.10);
    z-index:10000;
  }
  .moex-hm__submenu .moex-hm__link{
    width:100%;
    border-radius:12px;
    padding:10px 12px;
  }
  .moex-hm__item--has-children:hover > .moex-hm__submenu{ display:block; }
  .moex-hm__subtoggle{ display:none; }
}

/* Drawer */
.moex-hm__overlay{
  position:fixed; inset:0;
  background:rgba(15,23,42,.40);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
}
.moex-hm__drawer{
  position:fixed;
  top:0; right:0;
  height:100%;
  width:min(360px, 92vw);
  background:#fff;
  transform:translateX(102%);
  transition:transform .18s ease;
  box-shadow:-18px 0 48px rgba(0,0,0,.18);
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.moex-hm__drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid rgba(0,0,0,.06);
}
.moex-hm__drawer-user .moex-hm__user{ max-width:64vw; }
.moex-hm__close{
  width:44px; height:44px;
  border:1px solid rgba(0,0,0,.10);
  border-radius:12px;
  background:#fff;
  font-size:22px;
  line-height:1;
}

body.moex-hm--open{ overflow:hidden; }
body.moex-hm--open .moex-hm__overlay{ opacity:1; pointer-events:auto; }
body.moex-hm--open .moex-hm__drawer{ transform:translateX(0); }

/* Mobile layout */
@media (max-width:919px){
  .moex-hm__nav--desktop{ display:none; }
  .moex-hm__nav--mobile .moex-hm__menu{
    padding:10px;
    display:flex;
    flex-direction:column;
    gap:6px;
  }

  .moex-hm__nav--mobile .moex-hm__link{
    width:100%;
    justify-content:space-between;
    border-radius:14px;
    padding:12px 12px;
    border:1px solid rgba(0,0,0,.08);
    background:#fff;
  }

  .moex-hm__nav--mobile .moex-hm__submenu{
    display:none;
    margin:6px 0 0 0;
    border:none;
    padding:0 0 0 10px;
    background:transparent;
  }
  .moex-hm__item.is-open > .moex-hm__submenu{ display:block; }

  .moex-hm__nav--mobile .moex-hm__submenu .moex-hm__link{
    border-radius:12px;
    border:1px solid rgba(0,0,0,.06);
  }

  .moex-hm__subtoggle{
    border:none;
    background:transparent;
    width:38px; height:38px;
    border-radius:10px;
    position:absolute;
    right:12px;
    top:9px;
  }
  .moex-hm__subtoggle::before{
    content:'';
    display:block;
    width:10px; height:10px;
    border-right:2px solid #0f172a;
    border-bottom:2px solid #0f172a;
    transform:rotate(45deg);
    margin:0 auto;
    transition:transform .15s ease;
  }
  .moex-hm__item.is-open > .moex-hm__subtoggle::before{ transform:rotate(-135deg); }
}
