/* Custom two-row header replacing the client-rendered Finam header */
.tw-header {
  position: relative;
  z-index: 100;
  background: #1c1d21;
  color: #fff;
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.tw-header * { box-sizing: border-box; }
.tw-header a { color: inherit; text-decoration: none; }
.tw-header ul { list-style: none; margin: 0; padding: 0; }

.tw-header__row {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
}

/* ---- row 1 ---- */
.tw-header__row--top {
  height: 44px;
  gap: 28px;
  font-size: 15px;
  line-height: 44px;
}
.tw-topnav {
  display: flex;
  gap: 28px;
  height: 100%;
}
.tw-topnav__link {
  display: block;
  height: 100%;
  color: #b9bac0;
  white-space: nowrap;
  transition: color .15s ease;
}
.tw-topnav__link:hover { color: #fff; }
.tw-topnav__link.is-active {
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 -2px 0 #fff;
}
.tw-header__spacer { flex: 1; }
.tw-topright {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
}
.tw-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b9bac0;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.tw-iconbtn:hover { color: #fff; background: rgba(255,255,255,.08); }
.tw-contacts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: #b9bac0;
  font-size: 15px;
  cursor: pointer;
}
.tw-contacts:hover { color: #fff; }
.tw-contacts svg { transition: transform .15s ease; }
.tw-contacts[aria-expanded="true"] svg { transform: rotate(180deg); }
.tw-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.16);
}
.tw-theme {
  position: relative;
  overflow: hidden;
}
.tw-theme::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: linear-gradient(90deg, #b9bac0 50%, transparent 50%);
  border: 1px solid rgba(255,255,255,.4);
}
.tw-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.tw-login:hover { background: rgba(255,255,255,.1); }

/* ---- dropdown panels (row 1 + row 2) ---- */
.tw-hasdrop { position: relative; }
.tw-drop {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 10px;
  background: #26272c;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 120;
}
.tw-drop--right { left: auto; right: 0; }
.tw-hasdrop:hover .tw-drop,
.tw-hasdrop:focus-within .tw-drop,
.tw-hasdrop.is-open .tw-drop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tw-drop a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: #d6d7db;
  white-space: nowrap;
}
.tw-drop a:hover { background: rgba(255,255,255,.08); color: #fff; }
.tw-drop__title {
  padding: 6px 12px 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #83848b;
}
.tw-drop__phone {
  display: block;
  padding: 8px 12px;
  font-size: 17px;
  font-weight: 600;
  color: #fff !important;
}
.tw-drop__note {
  padding: 0 12px 8px;
  font-size: 12px;
  color: #83848b;
}

/* ---- row 2 ---- */
.tw-header__row--main {
  height: 72px;
  gap: 40px;
}
.tw-logo { flex: 0 0 auto; line-height: 0; }
.tw-logo img { width: 112px; height: auto; display: block; }
.tw-mainnav {
  display: flex;
  align-items: center;
  gap: 34px;
  height: 100%;
}
.tw-mainnav__item > a,
.tw-mainnav__item > button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  border: 0;
  background: none;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.tw-mainnav__item > a:hover,
.tw-mainnav__item > button:hover { color: #cfd0d5; }
.tw-mainnav__item svg { transition: transform .15s ease; }
.tw-mainnav__item:hover svg,
.tw-mainnav__item:focus-within svg { transform: rotate(180deg); }

/* hide broken original header if it is still in DOM */
header.ui_blocks_hhgma7d { display: none !important; }

@media (max-width: 1200px) {
  .tw-topnav { gap: 18px; }
  .tw-header__row { padding: 0 20px; }
  .tw-mainnav { gap: 22px; }
  .tw-mainnav__item > a, .tw-mainnav__item > button { font-size: 16px; }
}
