/* ==========================================================================
   Каталог: широкая панель под шапкой, слева разделы, справа 3 колонки
   ========================================================================== */

.tsm-catalog { position: relative; z-index: 75; }

.tsm-catalog__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 54px;
	padding: 0 18px;
	background: #1b9fc6;
	border: 0;
	border-radius: 10px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	color: #fff;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .16s ease;
}
.tsm-catalog__btn .tsm-icon { width: 20px; height: 20px; }
.tsm-catalog__btn:hover { background: #178aa9; }
.tsm-catalog__btn:focus-visible { outline: 2px solid #2b2f34; outline-offset: 2px; }
.tsm-catalog__btn[aria-expanded="true"] { background: #147f9b; }

/* ---------- Панель -------------------------------------------------------- */

.tsm-catalog__panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 80;
	display: none;
	background: #fff;
	border-top: 1px solid #e4e7ea;
	box-shadow: 0 24px 44px rgba(20, 26, 33, .16);
	max-height: calc(100vh - 100px);
}
.tsm-header.tsm-catalog-open .tsm-catalog__panel { display: block; }

.tsm-catalog__inner {
	position: relative;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
}

.tsm-catalog__desktop {
	display: flex;
	height: clamp(440px, 62vh, 620px);
	min-height: 0;
}

/* Левая колонка */
.tsm-catalog__left {
	width: 340px;
	flex-shrink: 0;
	padding: 12px 0 16px;
	border-right: 1px solid #eef0f2;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #9aa3ab #f1f3f5;
}
.tsm-catalog__left::-webkit-scrollbar,
.tsm-catalog__cols::-webkit-scrollbar,
.tsm-catalog__mbody::-webkit-scrollbar { width: 10px; }
.tsm-catalog__left::-webkit-scrollbar-track,
.tsm-catalog__cols::-webkit-scrollbar-track,
.tsm-catalog__mbody::-webkit-scrollbar-track { background: #f1f3f5; }
.tsm-catalog__left::-webkit-scrollbar-thumb,
.tsm-catalog__cols::-webkit-scrollbar-thumb,
.tsm-catalog__mbody::-webkit-scrollbar-thumb {
	background: #9aa3ab;
	border: 2px solid #f1f3f5;
	border-radius: 8px;
}

.tsm-catalog__all {
	display: block;
	margin-bottom: 6px;
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: #2b2f34;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.tsm-catalog__all:hover { color: #1b9fc6; }

.tsm-catalog__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.tsm-catalog__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}
.tsm-catalog__item::before,
.tsm-catalog__item::after { content: none !important; display: none !important; }

.tsm-catalog__row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 0 8px;
	padding: 8px 10px 8px 12px;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color .12s ease;
}
.tsm-catalog__row:hover,
.tsm-catalog__row:focus-within { background: #f5f9fa; }
.tsm-catalog__row.is-active { background: #eef8fb; }

.tsm-catalog__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin-top: 1px;
	flex: 0 0 24px;
	color: #1b9fc6;
}
.tsm-cat-icon { display: block; width: 24px; height: 24px; }

.tsm-catalog__link {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0;
	font-size: 14.5px;
	line-height: 1.35;
	color: #2b2f34;
	text-decoration: none;
	overflow-wrap: break-word;
}
.tsm-catalog__row.is-active .tsm-catalog__link { color: #147f9b; font-weight: 600; }
.tsm-catalog__link:hover,
.tsm-catalog__link:focus-visible { color: #147f9b; }

.tsm-catalog__chev {
	margin-left: auto;
	padding-top: 1px;
	font-size: 18px;
	line-height: 1;
	color: #9aa3ab;
}

/* Правая часть */
.tsm-catalog__right {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding: 18px 8px 16px 28px;
}

.tsm-catalog__right-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 16px;
	flex-shrink: 0;
	padding: 0 48px 12px 0;
	margin-bottom: 12px;
	border-bottom: 1px solid #f0f1f3;
}
.tsm-catalog__right-title {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	color: #2b2f34;
	text-decoration: none;
}
.tsm-catalog__right-title:hover { color: #1b9fc6; }
.tsm-catalog__view-all {
	font-size: 13px;
	line-height: 1.4;
	color: #147f9b;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.tsm-catalog__view-all:hover { color: #0f6c84; }

.tsm-catalog__cols {
	flex: 1 1 auto;
	min-height: 0;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 4px 24px;
	align-content: start;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #9aa3ab #f1f3f5;
}
.tsm-catalog__col {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.tsm-catalog__col a {
	display: block;
	padding: 6px 0;
	font-size: 14px;
	line-height: 1.35;
	color: #565d66;
	text-decoration: none;
	overflow-wrap: break-word;
}
.tsm-catalog__col a:hover,
.tsm-catalog__col a:focus-visible { color: #147f9b; }

.tsm-catalog__empty {
	padding: 10px 0;
	font-size: 14px;
	color: #838a93;
}

.tsm-catalog__close {
	position: absolute;
	top: 10px;
	right: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	background: #fff;
	border: 1px solid #e4e7ea;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	color: #565d66;
	cursor: pointer;
	z-index: 5;
}
.tsm-catalog__close:hover { border-color: #b9c0c7; color: #2b2f34; }

/* Мобильная часть по умолчанию скрыта */
.tsm-catalog__mobile { display: none; }

/* ---------- Телефон и планшет --------------------------------------------- */

@media (max-width: 1024px) {
	.tsm-catalog__btn { height: 54px; padding: 0 16px; }

	.tsm-header.tsm-catalog-open .tsm-catalog__panel {
		position: fixed;
		z-index: 200;
		max-height: none;
		overflow: hidden;
		border-radius: 12px;
		box-shadow: 0 18px 40px rgba(20, 26, 33, .18);
	}
	.tsm-catalog__inner { height: 100%; padding: 0; }
	.tsm-catalog__desktop { display: none; }
	.tsm-catalog__mobile {
		display: flex;
		flex-direction: column;
		height: 100%;
		min-height: 0;
	}

	.tsm-catalog__mhead {
		position: relative;
		display: flex;
		align-items: center;
		gap: 10px;
		flex-shrink: 0;
		min-height: 60px;
		padding: 8px 56px 8px 12px;
		border-bottom: 1px solid #eef0f2;
	}
	.tsm-catalog__back {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
		padding: 0 8px;
		background: none;
		border: 0;
		border-radius: 8px;
		font: inherit;
		font-size: 15px;
		font-weight: 600;
		color: #2b2f34;
		cursor: pointer;
	}
	.tsm-catalog__back[hidden] { display: none; }
	.tsm-catalog__back:hover { background: #f2f7f9; color: #147f9b; }
	.tsm-catalog__mhead .tsm-catalog__all { margin: 0; padding: 0 8px; }
	.tsm-catalog__mhead .tsm-catalog__all[hidden] { display: none; }
	.tsm-catalog__title {
		flex: 1 1 auto;
		min-width: 0;
		font-size: 16px;
		font-weight: 700;
		color: #2b2f34;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.tsm-catalog__title[hidden] { display: none; }

	.tsm-catalog__mbody {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		touch-action: pan-y;
		-webkit-overflow-scrolling: touch;
	}
	.tsm-catalog__mbody .tsm-catalog__list { padding: 6px 0; }
	.tsm-catalog__mbody .tsm-catalog__row {
		min-height: 52px;
		align-items: flex-start;
		padding: 12px 10px 12px 16px;
		margin: 0;
		border-radius: 0;
		border-bottom: 1px solid #f0f1f3;
		cursor: default;
	}
	.tsm-catalog__mbody .tsm-catalog__row:hover,
	.tsm-catalog__mbody .tsm-catalog__row.is-active { background: none; }
	.tsm-catalog__mbody .tsm-catalog__icon { margin-top: 2px; }
	.tsm-catalog__mbody .tsm-catalog__link { font-size: 15px; }

	.tsm-catalog__toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		margin: -6px 0 -6px auto;
		padding: 0;
		background: none;
		border: 0;
		border-radius: 8px;
		color: #838a93;
		cursor: pointer;
		flex-shrink: 0;
	}
	.tsm-catalog__toggle .tsm-icon { width: 18px; height: 18px; }

	.tsm-catalog__list--sub { padding: 4px 0 16px; }
	.tsm-catalog__list--sub .tsm-catalog__row { padding-left: 52px; }
	.tsm-catalog__list--sub .tsm-catalog__link { font-size: 14px; color: #565d66; }
	.tsm-catalog__mbody .tsm-catalog__view-all { margin: 12px 16px 4px; }

	.tsm-catalog__close { top: 10px; right: 10px; width: 40px; height: 40px; }
}

@media (max-width: 767px) {
	.tsm-catalog__btn { height: 52px; padding: 0 14px; font-size: 14px; }
	.tsm-catalog__btn .tsm-icon { width: 18px; height: 18px; }
	.tsm-catalog__title { font-size: 15px; }

	/* Каталог на телефоне — нижняя панель, не перекрывается нижней навигацией */
	.tsm-header.tsm-catalog-open .tsm-catalog__panel {
		top: 124px;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: auto;
		max-height: none;
		border-radius: 18px 18px 0 0;
		z-index: 300;
	}
	.tsm-catalog__mhead {
		min-height: 64px;
		padding-top: 10px;
		border-radius: 18px 18px 0 0;
	}
	.tsm-catalog__mbody {
		padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}
	.tsm-catalog__close { width: 44px; height: 44px; }
	body.tsm-cat-lock .tsm-bottom-nav {
		transform: translateY(110%);
		visibility: hidden;
	}
}

body.tsm-cat-lock { overflow: hidden; }
