/* Портальная шапка: вертикали + мега */

.ts-portal-mega-wrap[hidden],
.ts-portal-mega[hidden],
.ts-portal-mega__pane[hidden] {
	display: none !important;
}

.ts-portal-hdr-end {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	flex: 0 0 auto;
	position: relative;
	z-index: 100000;
}

.ts-portal-hdr-end .ts-cur__menu {
	z-index: 1;
}

.ts-portal-hdr-end .ts-cur__toggle {
	height: 28px;
	padding: 0 8px;
	border: 1px solid #e3e7f0;
	border-radius: 8px;
	background: #fafbfc;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #4a5162;
}

.ts-portal-hdr-end .ts-cur__toggle:hover,
.ts-portal-hdr-end .ts-cur__toggle:focus-visible {
	border-color: #c8d4f8;
	background: #f3f6ff;
	color: #3755fa;
}

.ts-portal-hdr-end .ts-cur__mark:empty {
	display: none;
}

.ts-portal-hdr-end .ts-cur__current {
	font-size: 11px;
	font-weight: 700;
}

.ts-portal-search {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid #e3e7f0;
	border-radius: 8px;
	background: #fafbfc;
	color: #5a6376;
	cursor: pointer;
}

.ts-portal-search:hover,
.ts-portal-search[aria-expanded='true'] {
	border-color: #c8d4f8;
	color: #3755fa;
	background: #f3f6ff;
}

.ts-portal-search:focus-visible {
	outline: 2px solid #3755fa;
	outline-offset: 2px;
}

.ts-portal-search svg {
	display: block;
}

.ast-search-menu-icon.slide-search {
	position: relative;
	width: 28px;
	height: 28px;
	flex: 0 0 28px;
}

.ast-header-search .ast-search-menu-icon.slide-search:not(.ast-dropdown-active) .search-form {
	display: none !important;
}

.ast-header-search .ast-search-menu-icon.slide-search.ast-dropdown-active .search-form,
.ast-search-menu-icon.slide-search.ast-dropdown-active .search-form {
	display: flex !important;
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	z-index: 20;
	width: min(220px, calc(100vw - 24px));
	margin: 0;
	padding: 0;
	opacity: 1;
	pointer-events: auto;
}

.ast-search-menu-icon.slide-search .search-field {
	width: 100% !important;
	min-height: 36px;
	padding: 0 12px;
	border: 1px solid #e3e7f0;
	border-radius: 8px;
	background: #fff;
}

.ast-search-menu-icon.slide-search .search-submit {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #3755fa;
}

@media (min-width: 922px) {
	#ast-desktop-header [data-ts-portal-shell] .ast-builder-grid-row.ast-grid-center-col-layout {
		grid-template-columns: auto minmax(0, 1fr) auto;
		align-items: center;
		column-gap: 12px;
	}

	#ast-desktop-header .ast-primary-header-bar {
		position: relative;
		z-index: 9999;
		overflow: visible;
	}

	#ast-desktop-header .site-primary-header-wrap,
	#ast-desktop-header .ast-main-header-wrap {
		overflow: visible;
	}

	/* Ряд шапки выше мега: иначе выпадашка валюты (и поиск) рисуется под панелью. */
	#ast-desktop-header .site-primary-header-wrap {
		position: relative;
		z-index: 2;
	}

	.ts-portal-nav {
		width: auto;
		max-width: 100%;
	}

	.ts-portal-nav__list {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: flex-start;
		gap: 0.15rem;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.ts-portal-nav__trigger,
	.ts-portal-nav__link {
		display: inline-flex;
		align-items: center;
		gap: 0.35rem;
		padding: 0.5rem 0.75rem;
		font-size: 0.92rem;
		font-weight: 600;
		line-height: 1.2;
		color: #2b3244;
		background: transparent;
		border: 1px solid transparent;
		border-radius: 8px;
		cursor: pointer;
		text-decoration: none;
		font-family: inherit;
	}

	.ts-portal-nav__trigger:hover,
	.ts-portal-nav__item.is-open .ts-portal-nav__trigger,
	.ts-portal-nav__item.is-current .ts-portal-nav__trigger,
	.ts-portal-nav__link.is-current {
		background: #f3f6ff;
		border-color: #c8d4f8;
		color: #3755fa;
	}

	.ts-portal-nav__trigger:focus-visible {
		outline: 2px solid #3755fa;
		outline-offset: 2px;
	}

	.ts-portal-nav__caret {
		font-size: 0.65rem;
		opacity: 0.75;
	}

	.ts-portal-nav__item--promo .ts-portal-nav__link {
		color: #3755fa;
	}

	.ts-portal-mega-wrap {
		display: none;
		position: absolute;
		top: calc(100% - 8px);
		left: 0;
		right: 0;
		z-index: 1;
		width: 100%;
		margin: 0;
		padding-top: 8px;
		border-bottom: 1px solid #e8ebf2;
		background: #fafbfc;
		box-shadow: 0 16px 32px rgba(43, 50, 68, 0.12);
	}

	.ts-portal-mega-wrap.is-visible {
		display: block;
	}

	/* Мост курсора: панель чуть заходит под бар, сверху невидимая полоса. */
	.ts-portal-mega-wrap.is-visible::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 16px;
		transform: translateY(-100%);
	}

	.ts-portal-mega {
		display: none;
		min-height: 200px;
		padding: 0;
	}

	.ts-portal-mega.is-open {
		display: block;
	}

	.ts-portal-mega__grid {
		display: grid;
		grid-template-columns: minmax(220px, 260px) 1fr;
		align-items: stretch;
		min-height: 200px;
	}

	.ts-portal-mega__nav {
		background: #fff;
		border-right: 1px solid #e8ebf2;
	}

	.ts-portal-mega__nav-list {
		margin: 0;
		padding: 8px 0;
		list-style: none;
	}

	.ts-portal-mega__nav-item a,
	.ts-portal-mega__nav-item button,
	.ts-portal-mega__nav-item > span {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.5rem;
		width: 100%;
		padding: 0.55rem 1rem;
		font-size: 0.86rem;
		font-family: inherit;
		font-weight: inherit;
		line-height: inherit;
		color: #2b3244;
		text-align: left;
		text-decoration: none;
		background: transparent;
		border: 0;
		border-left: 3px solid transparent;
		cursor: pointer;
	}

	.ts-portal-mega__nav-item a:hover,
	.ts-portal-mega__nav-item button:hover {
		background: #f7f9fc;
	}

	.ts-portal-mega__nav-item button:focus-visible {
		outline: 2px solid #3755fa;
		outline-offset: -2px;
	}

	.ts-portal-mega__nav-item.is-active a,
	.ts-portal-mega__nav-item.is-active button {
		background: #f3f6ff;
		border-left-color: #3755fa;
		color: #3755fa;
		font-weight: 600;
	}

	.ts-portal-mega__nav-item.is-muted a,
	.ts-portal-mega__nav-item.is-muted > span {
		color: #8a93a8;
		font-size: 0.82rem;
	}

	.ts-portal-mega__label {
		display: inline-flex;
		align-items: center;
		gap: 0.4rem;
		min-width: 0;
	}

	.ts-portal-mega__mark {
		display: block;
		flex: 0 0 14px;
		width: 14px;
		height: 14px;
		color: #3755fa;
	}

	.ts-portal-mega__nav-item.is-featured {
		margin-bottom: 4px;
		padding-bottom: 4px;
		border-bottom: 1px solid #e8ebf2;
	}

	.ts-portal-mega__nav-item.is-featured a,
	.ts-portal-mega__nav-item.is-featured button {
		font-weight: 700;
		color: #3755fa;
	}

	.ts-portal-mega__arr {
		color: #9aa3b5;
		font-size: 0.75rem;
	}

	.ts-portal-mega__body {
		padding: 1rem 1.25rem 1.15rem;
	}

	.ts-portal-mega__title {
		display: flex;
		align-items: center;
		gap: 0.4rem;
		margin: 0 0 0.25rem;
		font-size: 1.05rem;
		font-weight: 700;
	}

	.ts-portal-mega__sub {
		margin: 0 0 0.75rem;
		font-size: 0.8rem;
		color: #6b7280;
	}

	.ts-portal-mega__links {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.5rem 1.25rem;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.ts-portal-mega__links a {
		display: block;
		font-size: 0.86rem;
		font-weight: 600;
		color: #3755fa;
		text-decoration: none;
		line-height: 1.35;
	}

	.ts-portal-mega__links a:hover {
		text-decoration: underline;
	}

	.ts-portal-mega__meta {
		display: block;
		font-size: 0.72rem;
		font-weight: 400;
		color: #6b7280;
		margin-top: 0.1rem;
	}

	.ts-portal-mega__countries .country-list {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.35rem 1rem;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.ts-portal-mega__countries .country-list li {
		display: flex;
		align-items: center;
		gap: 8px;
		width: auto;
	}

	.ts-portal-mega__countries .country-list img.host-flag {
		width: 18px;
		height: 18px;
		border-radius: 50%;
		object-fit: cover;
		clip-path: circle(50%);
		flex: none;
		box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
	}

	.ts-portal-mega__countries .country-list a {
		font-size: 0.86rem;
		color: #3755fa;
	}
}

@media (max-width: 921px) {
	#ast-mobile-header .ast-builder-grid-row.ast-builder-grid-row-has-sides {
		display: flex;
		align-items: center;
		gap: 8px;
	}

	#ast-mobile-header .site-logo-img {
		padding-right: 0;
	}

	#ast-mobile-header .site-branding .custom-logo-link img,
	#ast-mobile-header .site-branding img.custom-logo,
	#ast-mobile-header .custom-logo {
		width: auto !important;
		max-width: 120px !important;
		max-height: 32px !important;
		height: auto !important;
	}

	.ast-header-break-point #masthead #ast-mobile-header .ast-primary-header-bar,
	.ast-header-break-point #masthead #ast-mobile-header .site-primary-header-wrap,
	#ast-mobile-header .ast-primary-header-bar,
	#ast-mobile-header .site-primary-header-wrap,
	#ast-mobile-header .main-header-bar {
		padding: 8px 10px !important;
		min-height: 56px;
	}

	#ast-mobile-header .site-header-primary-section-left {
		min-width: 0;
		flex: 1 1 auto;
	}

	#ast-mobile-header .site-header-primary-section-right {
		flex: 0 0 auto;
	}

	#ast-mobile-header .ts-portal-hdr-end {
		flex-shrink: 0;
		gap: 6px;
	}

	#ast-mobile-header .ts-cur__toggle {
		padding: 0 6px;
	}

	#ast-mobile-header .ts-cur__arrow {
		display: none;
	}

	#ast-mobile-header .ast-button-wrap .menu-toggle,
	#ast-mobile-header .ast-button-wrap .menu-toggle.main-header-menu-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
		min-height: 0;
		padding: 0;
		border: 1px solid #e3e7f0;
		border-radius: 8px;
		background: #fafbfc;
		color: #2b3244;
		box-shadow: none;
		font-size: 16px;
		line-height: 1;
	}

	#ast-mobile-header .ast-button-wrap .menu-toggle:hover,
	#ast-mobile-header .ast-button-wrap .menu-toggle:focus,
	#ast-mobile-header .ast-button-wrap .menu-toggle:active,
	#ast-mobile-header .ast-button-wrap .menu-toggle.toggled {
		background: #f3f6ff;
		border-color: #c8d4f8;
		color: #3755fa;
	}

	#ast-mobile-header .mobile-menu-toggle-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		color: inherit;
	}

	#ast-mobile-header .mobile-menu-toggle-icon svg {
		display: block;
	}

	#ast-mobile-header .ast-mobile-header-content .ts-cur {
		padding: 10px 4px 16px;
	}

	#ast-mobile-header .ast-mobile-header-content .ts-cur__menu {
		position: static;
		min-width: 0;
		margin-top: 6px;
		box-shadow: none;
	}

	.ts-portal-mobile-nav {
		padding: 0.5rem 0 1rem;
	}

	.ts-portal-mobile-nav__heading {
		margin: 0.75rem 0 0.35rem;
		font-size: 0.72rem;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: #6b7280;
	}

	.ts-portal-mobile-nav__list {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.ts-portal-mobile-nav__list a {
		display: block;
		padding: 0.45rem 0;
		color: #3755fa;
		text-decoration: none;
		font-weight: 600;
	}

	.ts-portal-mobile-nav__list .is-featured a {
		display: inline-flex;
		align-items: center;
		gap: 0.4rem;
		font-weight: 700;
	}

	.ts-portal-mobile-nav__list .is-featured {
		margin-bottom: 6px;
		padding-bottom: 6px;
		border-bottom: 1px solid #e8ebf2;
	}

	.ts-portal-mobile-nav__list--muted span {
		display: block;
		padding: 0.35rem 0;
		color: #8a93a8;
		font-size: 0.9rem;
	}
}
