/**
 * Mebelgroup checkout v2 — новая визуальная система (.mg-checkout).
 * Шрифт: Manrope (как body / шапка). Фон страницы #fafafa как у каталога; текст #171717; акцент #d4af37 (фокус).
 * Сетка: основная колонка + липкий итог; карточки, ритм 8px, без лишних «ячеек».
 */

/* ------------------------------------------------------------------ */
/* Токены                                                             */
/* ------------------------------------------------------------------ */
.mg-checkout :is(a, button, input, select, textarea, .quantity__button):focus-visible {
	outline: 2px solid var(--mg-accent);
	outline-offset: 2px;
}

/* Как .cartpage__content / instock и др. в template_styles — #fafafa */
html:has(.mg-checkout) {
	--mg-surface: #fafafa;
}

.mg-checkout {
	--mg-space-1: 8px;
	--mg-space-2: 16px;
	--mg-space-3: 24px;
	--mg-space-4: 32px;
	--mg-space-5: 48px;
	/*
	 * Совпадает с отступом контента под .header__content (fixed) — см. .page { padding-top } в template_styles.
	 * На ≥992px: 121px + небольшой зазор, иначе карточка «Итого» уезжает под шапку (z-index шапки выше).
	 */
	--mg-sticky-top: calc(150px + var(--mg-space-1) + env(safe-area-inset-top, 0px));
	--mg-radius: 12px;
	--mg-radius-lg: 16px;
	--mg-surface: #fafafa;
	--mg-elevated: #ffffff;
	--mg-line: #e7e5e4;
	--mg-line-strong: #d6d3d1;
	--mg-text: #171717;
	--mg-muted: #57534e;
	--mg-muted-2: #78716c;
	--mg-accent: #d4af37;
	--mg-danger-bg: #fef2f2;
	--mg-danger-border: #fecaca;
	--mg-danger-text: #991b1b;
	--mg-font: "Manrope", system-ui, -apple-system, sans-serif;
	--mg-shadow: 0 1px 2px rgba(28, 25, 23, 0.05);
	--mg-shadow-md: 0 8px 28px rgba(28, 25, 23, 0.08);
	--mg-max: 1180px;
	font-family: var(--mg-font);
	color: var(--mg-text);
	background: var(--mg-surface);
	-webkit-font-smoothing: antialiased;
}

.page_mg-checkout {
	background: var(--mg-surface);
}

body:has(.mg-checkout) .wrapper,
.wrapper.mg-checkout-scroll-root {
	overflow: visible !important;
	background-color: var(--mg-surface);
}

/* Подтянуть серый блок корзины вверх под шапку (закрывает визуальный зазор) */
.page__cartpage.cartpage_checkout-onepage.mg-checkout {
	--mg-cart-block-pull: clamp(14px, 3vw, 28px);
	margin-top: calc(-1 * var(--mg-cart-block-pull));
	position: relative;
	background-color: var(--mg-surface);
}

/* ------------------------------------------------------------------ */
/* Сброс конфликтов с template_styles (корзина)                      */
/* ------------------------------------------------------------------ */
.mg-checkout .cartpage__content.mg-checkout__canvas {
	background: transparent;
	padding: var(--mg-space-3) var(--mg-space-2) var(--mg-space-5);
	border-radius: 0;
}

@media (min-width: 768px) {
	.mg-checkout .cartpage__content.mg-checkout__canvas {
		padding-left: clamp(var(--mg-space-2), 4vw, var(--mg-space-5));
		padding-right: clamp(var(--mg-space-2), 4vw, var(--mg-space-5));
	}
}

.mg-checkout .cartpage__row.mg-checkout__grid {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) min(360px, 34vw);
	gap: var(--mg-space-4) var(--mg-space-3);
	align-items: start;
	min-height: 0;
	max-width: var(--mg-max);
	margin-inline: auto;
}

.mg-checkout .cartpage__col.mg-checkout__main,
.mg-checkout .cartpage__col.mg-checkout__aside-col {
	flex: unset !important;
	max-width: none !important;
	width: auto !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* Ряд сетки по высоте = основная колонка: aside тянется на всю высоту, иначе sticky «заканчивается» раньше */
.mg-checkout .cartpage__col.mg-checkout__aside-col {
	align-self: stretch;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.mg-checkout .cartpage__right.right-cartpage.mg-checkout__aside {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	width: 100%;
}

.mg-checkout .right-cartpage__place.mg-checkout__aside-place {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.mg-checkout .right-cartpage__content.mg-checkout__aside-card {
	position: relative !important;
	top: auto !important;
	left: auto !important;
	width: 100% !important;
	max-width: 100%;
	border-radius: var(--mg-radius-lg);
	border: 1px solid var(--mg-line);
	background: var(--mg-elevated);
	box-shadow: var(--mg-shadow-md);
	overflow-x: hidden;
	overflow-y: visible;
}

/* Десктоп: «Итого» липнет к вьюпорту в пределах сетки (без JS position:fixed) */
@media (min-width: 992px) {
	.mg-checkout .right-cartpage__content.mg-checkout__aside-card {
		position: sticky !important;
		top: var(--mg-sticky-top) !important;
		left: auto !important;
		align-self: flex-start;
		flex: 0 0 auto;
		width: 100% !important;
		max-height: calc(100vh - var(--mg-sticky-top) - var(--mg-space-2));
		max-height: calc(100dvh - var(--mg-sticky-top) - var(--mg-space-2));
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* ------------------------------------------------------------------ */
/* Шапка страницы (внутри canvas — выравнивание с сеткой карточек)     */
/* ------------------------------------------------------------------ */
.mg-checkout__hero {
	margin: 0 0 var(--mg-space-3);
	padding: 0 0 var(--mg-space-2);
	border-bottom: 1px solid var(--mg-line);
}

.mg-checkout__hero-shell {
	max-width: var(--mg-max);
	margin-inline: auto;
	width: 100%;
}

/* Та же сетка, что у .mg-checkout__grid: заголовок над формой, кнопки — над колонкой «Итого» */
.mg-checkout__hero-inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) min(360px, 34vw);
	gap: var(--mg-space-4) var(--mg-space-3);
	align-items: start;
	width: 100%;
}

.mg-checkout__hero-main {
	grid-column: 1;
	min-width: 0;
}

.mg-checkout__h1 {
	display: block;
	margin: 0;
	font-size: clamp(26px, 4vw, 36px);
	font-weight: 800;
	letter-spacing: -0.035em;
	line-height: 1.22;
	color: var(--mg-text);
}

.mg-checkout__hero-actions {
	grid-column: 2;
	justify-self: stretch;
	align-self: start;
	margin: 0;
	padding: 0;
	width: 100%;
	max-width: 100%;
}

/* Трио «флаг Италии»: одна горизонтальная полоса на всех ширинах (мобильные и десктоп) */
.mg-checkout__hero-tricolor {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: stretch;
	width: 100%;
	max-width: 100%;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid rgba(28, 25, 23, 0.1);
	box-shadow: 0 1px 2px rgba(28, 25, 23, 0.06), 0 6px 18px rgba(28, 25, 23, 0.05);
	font-family: var(--mg-font);
	font-size: 12px;
	line-height: 1.25;
	font-weight: 600;
}

.mg-checkout__hero-tricolor:focus-within {
	outline: 2px solid var(--mg-accent);
	outline-offset: 2px;
}

.mg-checkout__tricolor {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 1 1 0;
	min-width: 0;
	min-height: 38px;
	padding: 0 8px;
	box-sizing: border-box;
	font-size: inherit;
	font-weight: inherit;
	letter-spacing: 0.01em;
	border: none;
	border-radius: 0;
	margin: 0 !important;
	height: auto !important;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
	font-family: inherit;
	transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.mg-checkout__tricolor:not(:first-child) {
	box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.28);
}

.mg-checkout__tricolor--white:not(:first-child) {
	box-shadow: inset 1px 0 0 rgba(28, 25, 23, 0.1);
}

.mg-checkout__tricolor:hover {
	filter: none;
	opacity: 1;
}

.mg-checkout__tricolor--green {
	background: #009246;
	color: #fff;
}

.mg-checkout__tricolor--green:hover {
	background: #007a3a;
}

.mg-checkout__tricolor--white {
	background: #fff;
	color: #1c1917;
}

.mg-checkout__tricolor--white:hover {
	background: #f0f0f0;
}

.mg-checkout__tricolor--red {
	background: #ce2b37;
	color: #fff;
}

.mg-checkout__tricolor--red:not(:first-child) {
	box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.12);
}

.mg-checkout__tricolor--red:hover {
	background: #b32530;
}

.mg-checkout .mg-checkout__tricolor.cart-clear-all__btn {
	border: none !important;
	border-radius: 0 !important;
	margin: 0 !important;
	padding-left: 8px !important;
	padding-right: 8px !important;
	height: auto !important;
	font-size: inherit !important;
	line-height: inherit !important;
	font-weight: inherit !important;
}

.mg-checkout__tricolor-ico {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 18px;
	height: 18px;
}

.mg-checkout__ico-svg {
	display: block;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.mg-checkout__tricolor-text {
	white-space: nowrap;
	flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Панель «Состав заказа»                                             */
/* ------------------------------------------------------------------ */
.mg-checkout-items {
	background: var(--mg-elevated);
	border: 1px solid var(--mg-line);
	border-radius: var(--mg-radius-lg);
	box-shadow: var(--mg-shadow);
	padding: var(--mg-space-3) var(--mg-space-3) var(--mg-space-2);
	margin-bottom: var(--mg-space-3);
}

@media (min-width: 768px) {
	.mg-checkout-items {
		padding: var(--mg-space-4);
	}
}

.mg-checkout-items__head {
	margin-bottom: var(--mg-space-3);
	padding-bottom: var(--mg-space-2);
	border-bottom: 1px solid var(--mg-line);
}

.mg-checkout-items__title {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--mg-text);
	line-height: 1.35;
}

.mg-checkout-items__hint {
	margin: 0;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	color: var(--mg-muted);
}

.mg-checkout .body-cartpage__top {
	margin: 0 !important;
}

.mg-checkout .body-cartpage__blocks {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.mg-checkout .body-cartpage__block {
	margin: 0 !important;
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	border-bottom: 1px solid var(--mg-line) !important;
}

.mg-checkout .body-cartpage__block:last-child {
	border-bottom: none !important;
}

.mg-checkout .body-cartpage__row {
	display: grid !important;
	grid-template-columns: 96px minmax(0, 1fr) minmax(min(100%, 220px), auto);
	gap: var(--mg-space-2) var(--mg-space-3);
	align-items: start;
	padding: var(--mg-space-3) 0 !important;
}

.mg-checkout .body-cartpage__row > [class*="body-cartpage__col"] {
	flex: none !important;
	max-width: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

.mg-checkout .body-cartpage__col_info {
	min-width: 0;
}

.mg-checkout .body-cartpage__col_actions {
	min-width: 0;
	align-self: center;
}

.mg-checkout .body-cartpage__img {
	width: 96px;
	border-radius: var(--mg-radius);
	overflow: hidden;
	background: var(--mg-surface);
}

.mg-checkout .body-cartpage__thumb-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.mg-checkout .body-cartpage__thumb-link:focus-visible {
	outline: 2px solid var(--mg-text);
	outline-offset: 2px;
}

.mg-checkout .body-cartpage__name,
.mg-checkout .body-cartpage__link {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.45;
	color: var(--mg-text);
	display: inline-block;
	max-width: 100%;
}

.mg-checkout .body-cartpage__link:hover {
	opacity: 1;
	color: var(--mg-muted);
}

.mg-checkout .body-cartpage__meta {
	margin-top: 8px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.45;
	color: var(--mg-muted);
}

.mg-checkout .body-cartpage__meta-link {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.mg-checkout .body-cartpage__meta-link:hover {
	color: var(--mg-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mg-checkout .body-cartpage__meta-link:focus-visible {
	outline: 2px solid var(--mg-text);
	outline-offset: 2px;
}

.mg-checkout .body-cartpage__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 12px 18px;
	row-gap: 12px;
}

.mg-checkout .body-cartpage__quantity .quantity {
	display: flex;
	align-items: center;
	border: 1px solid var(--mg-line);
	border-radius: var(--mg-radius);
	background: var(--mg-elevated);
	overflow: hidden;
}

.mg-checkout .body-cartpage__quantity .quantity__button {
	min-width: 44px;
	min-height: 44px;
	border-radius: 0;
	cursor: pointer;
	transition: background 0.2s ease;
}

.mg-checkout .body-cartpage__quantity .quantity__button:hover {
	background: #fafaf9;
}

.mg-checkout .body-cartpage__quantity .quantity__input input {
	min-height: 44px;
	border: none !important;
	border-radius: 0;
	text-align: center;
	font-weight: 600;
	font-size: 14px;
	font-family: var(--mg-font);
}

.mg-checkout .body-cartpage__price {
	display: flex !important;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	gap: 4px !important;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--mg-text);
	text-align: right;
	min-width: 0;
	margin: 0 !important;
	white-space: normal !important;
}

.mg-checkout .body-cartpage__price > span {
	padding: 0 !important;
	max-width: 100%;
	text-align: right;
	line-height: 1.25;
}

.mg-checkout .body-cartpage__newprice {
	color: #b45309;
}

.mg-checkout .body-cartpage__del {
	position: static !important;
	opacity: 0.55;
	visibility: visible !important;
	height: auto !important;
	padding: 6px 0 !important;
	margin: 0 !important;
	background: none !important;
	font-size: 13px;
	font-weight: 600;
	color: var(--mg-muted);
	cursor: pointer;
	transition: opacity 0.2s ease, color 0.2s ease;
}

.mg-checkout .body-cartpage__del:hover {
	opacity: 1;
	color: var(--mg-text);
}

.mg-checkout .body-cartpage__accessories {
	margin-top: var(--mg-space-3) !important;
	padding-top: var(--mg-space-3);
	border-top: 1px solid var(--mg-line);
	background: transparent !important;
	border-left: none !important;
	border-right: none !important;
	border-bottom: none !important;
	box-shadow: none !important;
}

.mg-checkout .accessories-cartpage__title .main-title__title {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--mg-text);
}

.mg-checkout .body-cartpage__promo.promo-cartpage {
	border-top: 1px solid var(--mg-line);
	margin-top: var(--mg-space-2);
	padding-top: var(--mg-space-3);
}

/* ------------------------------------------------------------------ */
/* Итог справа                                                        */
/* ------------------------------------------------------------------ */
.mg-checkout .top-rightcartpage {
	font-family: var(--mg-font);
	padding: var(--mg-space-3) var(--mg-space-3) var(--mg-space-2);
	margin: 0;
	border-bottom: 1px solid var(--mg-line);
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px 16px;
	row-gap: 8px;
}

.mg-checkout .top-rightcartpage__text {
	font-size: clamp(16px, 1.35vw, 20px);
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--mg-text);
	padding: 0;
	line-height: 1.3;
	max-width: 100%;
}

.mg-checkout .top-rightcartpage__price {
	font-size: clamp(22px, 3vw, 28px);
	font-weight: 800;
	letter-spacing: -0.03em;
	color: var(--mg-text);
	padding: 0;
	font-variant-numeric: tabular-nums;
	line-height: 1.15;
}

.mg-checkout .middle-rightcartpage {
	padding: var(--mg-space-2) var(--mg-space-3) var(--mg-space-3);
	margin: 0;
}

.mg-checkout .middle-rightcartpage__row {
	display: flex !important;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 6px 14px;
	opacity: 1;
	font-size: 14px;
	font-weight: 500;
	color: var(--mg-muted);
	margin: 0 0 10px !important;
	line-height: 1.45;
}

.mg-checkout .middle-rightcartpage__row .middle-rightcartpage__text {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0 !important;
}

.mg-checkout .middle-rightcartpage__row .middle-rightcartpage__price {
	flex: 0 0 auto;
	padding: 0 !important;
	text-align: right;
	white-space: nowrap;
}

.mg-checkout .middle-rightcartpage__price {
	color: var(--mg-text);
	font-weight: 600;
	opacity: 1;
}

.mg-checkout .right-cartpage__body {
	border-top: none;
}

/* ------------------------------------------------------------------ */
/* Ошибка                                                             */
/* ------------------------------------------------------------------ */
.mg-checkout__alert {
	margin: 0 0 var(--mg-space-3);
	padding: 14px 18px;
	border-radius: var(--mg-radius);
	background: var(--mg-danger-bg);
	border: 1px solid var(--mg-danger-border);
	color: var(--mg-danger-text);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Форма оформления (.mg-checkout-flow)                               */
/* ------------------------------------------------------------------ */
.mg-checkout-flow {
	margin-top: var(--mg-space-3);
	display: flex;
	flex-direction: column;
	gap: var(--mg-space-4);
}

.mg-checkout .checkout-onepage__section {
	background: var(--mg-elevated);
	border: 1px solid var(--mg-line);
	border-radius: var(--mg-radius-lg);
	box-shadow: var(--mg-shadow);
	padding: var(--mg-space-3);
}

@media (min-width: 768px) {
	.mg-checkout .checkout-onepage__section {
		padding: var(--mg-space-4) var(--mg-space-4);
	}
}

.mg-checkout .checkout-onepage__section + .checkout-onepage__section {
	margin-top: 0;
}

.mg-checkout .checkout-onepage__title {
	font-family: var(--mg-font);
	font-size: clamp(16px, 1.35vw, 18px);
	font-weight: 700;
	letter-spacing: -0.02em;
	margin: 0 0 10px;
	color: var(--mg-text);
	line-height: 1.35;
}

.mg-checkout .checkout-onepage__lead {
	font-size: clamp(14px, 1.2vw, 16px);
	font-weight: 500;
	color: var(--mg-muted);
	margin: 0 0 20px;
	line-height: 1.55;
	max-width: 42em;
}

.mg-checkout .checkout-onepage__section_contacts .checkout-onepage__title {
	margin-bottom: 12px;
}

.mg-checkout .checkout-onepage__section_contacts .checkout-onepage__lead {
	margin-bottom: 22px;
}

.mg-checkout .checkout-onepage__section_delivery .checkout-onepage__title {
	margin-bottom: var(--mg-space-3);
}

.mg-checkout .checkout-onepage__section_payment .checkout-onepage__title {
	margin-bottom: 14px;
}

.mg-checkout .checkout-onepage__section .cartpage__body.body-cartpage {
	margin: 0;
	padding: 0;
}

.mg-checkout .checkout-onepage__section .body-cartpage__delivery,
.mg-checkout .checkout-onepage__section .body-cartpage__contacts {
	margin-top: 0;
}

/* template_styles: у .body-cartpage__contacts большой vw-padding — убираем внутри карточек */
.mg-checkout .checkout-onepage__section .body-cartpage__contacts.contacts-cartpage {
	margin: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
}

.mg-checkout .checkout-onepage__section .body-cartpage__delivery.delivery-cartpage {
	padding: 0 !important;
	background: transparent !important;
}

/* Доставка: две колонки в template_styles с justify-content: space-between — при узкой ширине текст наезжал на чекбокс */
/* Одна полоса отступа после разделителя: раньше margin-top + padding-top по 32px опускали подпись относительно первой строки */
.mg-checkout .checkout-onepage__section_delivery .body-cartpage__delivery.delivery-cartpage ~ .body-cartpage__delivery.delivery-cartpage {
	margin-top: 0 !important;
	padding-top: var(--mg-space-2) !important;
	border-top: 1px solid var(--mg-line);
}

.mg-checkout .checkout-onepage__section_delivery .cartpage__body.body-cartpage > .body-cartpage__delivery.delivery-cartpage:first-child {
	margin-bottom: var(--mg-space-3);
}

/* Одна сетка для всех строк: слева чекбокс + подпись, справа подсказка / цена (ровная колонка) */
.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__row,
.mg-checkout .checkout-onepage__assembly .mg-checkout-delivery-grid-row {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) minmax(148px, 38%);
	align-items: start;
	column-gap: clamp(16px, 3vw, 28px);
	row-gap: 8px;
}

.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__col {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	min-width: 0;
	width: auto !important;
	max-width: none !important;
	flex: unset !important;
}

.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__col:nth-child(2) {
	justify-self: stretch;
	display: flex;
	justify-content: flex-end;
}

.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__col:nth-child(2) .delivery-cartpage__text {
	text-align: right;
	padding: 4px 0 0 8px;
	box-sizing: border-box;
	width: 100%;
	max-width: 44ch;
}

.mg-checkout .checkout-onepage__assembly .promo-cartpage__col_mkad-meta {
	justify-self: stretch;
	display: flex;
	justify-content: flex-end;
}

.mg-checkout .checkout-onepage__assembly .promo-cartpage__col_mkad-meta .delivery-cartpage__text {
	text-align: right;
	padding: 4px 0 0 8px;
	width: 100%;
	max-width: 44ch;
	box-sizing: border-box;
}

@media (max-width: 560px) {
	.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__row,
	.mg-checkout .checkout-onepage__assembly .mg-checkout-delivery-grid-row {
		grid-template-columns: 1fr;
	}

	.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__col:nth-child(2) .delivery-cartpage__text,
	.mg-checkout .checkout-onepage__assembly .promo-cartpage__col_mkad-meta .delivery-cartpage__text {
		justify-self: start;
		text-align: left;
		padding-left: 40px;
		margin-left: 0;
		max-width: none;
	}
}

.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__row br {
	display: none;
}

.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__text {
	margin: 0 !important;
	padding: 0 !important;
	font-size: clamp(14px, 1.15vw, 16px) !important;
	line-height: 1.6 !important;
	opacity: 1 !important;
	color: var(--mg-muted) !important;
	max-width: 72ch;
}

/* template_styles: :before с align-self:flex-start + margin — текст визуально выше квадрата */
.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__chk .checkbox__text,
.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__chk2 .checkbox__text {
	display: inline-flex !important;
	align-items: center !important;
	line-height: 1.45 !important;
	font-size: clamp(15px, 1.2vw, 17px) !important;
	font-weight: 700 !important;
	color: var(--mg-text) !important;
}

.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__chk .checkbox__text:before,
.mg-checkout .checkout-onepage__section_delivery .delivery-cartpage__chk2 .checkbox__text:before {
	align-self: center !important;
	margin-top: 0 !important;
	margin-right: 14px !important;
	flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Самовывоз: список салонов (news.list cart-cities)                   */
/* ------------------------------------------------------------------ */
/* Меньше зазор под «Самовывоз» до списка пунктов выдачи (раньше margin+padding давали слишком много) */
.mg-checkout .contacts-cartpage_take_out {
	margin-top: var(--mg-space-2);
	padding: var(--mg-space-1) 0 var(--mg-space-1);
	padding-left: var(--mg-space-2);
	box-sizing: border-box;
}

.mg-checkout .contacts-cartpage_take_out .contacts-cartpage__row.mg-checkout-pickup__row,
.mg-checkout .contacts-cartpage_take_out > .contacts-cartpage__row {
	display: block !important;
	margin: 0 !important;
}

.mg-checkout .mg-checkout-pickup__col {
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.mg-checkout .mg-checkout-pickup__list.options {
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
	align-items: stretch;
}

.mg-checkout .mg-checkout-pickup__item.options__item {
	position: relative;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
	cursor: pointer;
	border-bottom: 1px solid var(--mg-line);
	background: transparent;
}

.mg-checkout .mg-checkout-pickup__item.options__item:last-child {
	border-bottom: none;
}

/* Сетка: круг слева по центру блока «название + адрес»; подписи во 2-й колонке */
.mg-checkout .mg-checkout-pickup__text.options__text {
	display: grid !important;
	grid-template-columns: 25px minmax(0, 1fr);
	grid-template-rows: auto auto;
	column-gap: 18px;
	row-gap: 4px;
	align-items: start;
	width: 100%;
	box-sizing: border-box;
	padding: 20px 12px 20px 16px !important;
	font-size: 15px !important;
	font-weight: 500 !important;
	line-height: 1.4 !important;
	color: var(--mg-text) !important;
}

.mg-checkout .mg-checkout-pickup__text.options__text::before {
	grid-column: 1;
	grid-row: 1 / -1;
	align-self: center;
	justify-self: center;
	margin: 0 !important;
	flex: none !important;
}

.mg-checkout .mg-checkout-pickup__text.options__text::after {
	display: none !important;
}

.mg-checkout .mg-checkout-pickup__item .options__input:checked + .mg-checkout-pickup__text::before {
	background: radial-gradient(circle, #fff 4px, #000 4.5px) !important;
}

.mg-checkout .mg-checkout-pickup__name {
	grid-column: 2;
	grid-row: 1;
	display: block;
	margin: 0;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--mg-muted-2);
	line-height: 1.45;
}

.mg-checkout .mg-checkout-pickup__addr {
	grid-column: 2;
	grid-row: 2;
	display: block;
	margin: 0;
	padding-top: 0;
	font-size: clamp(14px, 1.1vw, 16px);
	font-weight: 600;
	color: var(--mg-text);
	line-height: 1.55;
}

/* Лейблы: не плавающие */
.mg-checkout .checkout-onepage__section .contacts-cartpage__label {
	position: static !important;
	top: auto !important;
	left: auto !important;
	z-index: auto !important;
	display: block !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--mg-muted) !important;
	margin: 0 0 10px !important;
	padding: 0 !important;
	opacity: 1 !important;
	cursor: pointer;
	line-height: 1.4 !important;
}

.mg-checkout .checkout-onepage__section .contacts-cartpage__input {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	min-width: 0;
	gap: 0;
}

.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage > .contacts-cartpage__row,
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px 22px;
	margin: 0 !important;
}

.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage__col,
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery .contacts-cartpage__col {
	flex: none !important;
	max-width: none !important;
	width: auto !important;
	padding: 0 !important;
	margin: 0 !important;
}

.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage__col_full,
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery .contacts-cartpage__col_full {
	grid-column: 1 / -1;
}

/* «Дополнительная информация» — отступ снизу до линии (перебивает margin:0 !important у .contacts-cartpage__col) */
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col_full {
	margin-bottom: var(--mg-space-4) !important;
}

.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage__doubleinput,
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery .contacts-cartpage__doubleinput {
	display: grid !important;
	grid-template-columns: 1fr 1fr;
	gap: var(--mg-space-2);
}

.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage__doubleinput .contacts-cartpage__input,
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery .contacts-cartpage__doubleinput .contacts-cartpage__input {
	max-width: none !important;
	flex: none !important;
}

.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage__doubleinput .contacts-cartpage__input:first-child:before,
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery .contacts-cartpage__doubleinput .contacts-cartpage__input:first-child:before {
	display: none !important;
}

/* Корпус/строение — полная ширина; подъезд+этаж и квартира — одна строка (2+1 колонки сетки) */
.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col:nth-child(4) {
	grid-column: 1 / -1;
}

.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col:nth-child(5) {
	grid-column: span 2;
	min-width: 0;
}

.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col:nth-child(6) {
	grid-column: span 1;
	min-width: 0;
}

.mg-checkout .checkout-onepage__section .contacts-cartpage__input .input,
.mg-checkout .checkout-onepage__input.input {
	width: 100%;
	box-sizing: border-box;
	min-height: 54px;
	padding: 15px 18px !important;
	font-size: 16px !important;
	font-weight: 500 !important;
	line-height: 1.5 !important;
	font-family: var(--mg-font) !important;
	color: var(--mg-text);
	background: #fafaf9 !important;
	border: 1px solid var(--mg-line) !important;
	border-radius: 16px !important;
	box-shadow: inset 0 1px 2px rgba(28, 25, 23, 0.04);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mg-checkout .checkout-onepage__section .contacts-cartpage__input .input:hover,
.mg-checkout .checkout-onepage__input.input:hover {
	border-color: var(--mg-line-strong) !important;
	background: #fff !important;
}

.mg-checkout .checkout-onepage__section .contacts-cartpage__input .input:focus,
.mg-checkout .checkout-onepage__input.input:focus {
	outline: none;
	border-color: var(--mg-accent) !important;
	box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.28);
	background: #fff !important;
}

.mg-checkout .checkout-onepage__assembly {
	border: none;
	padding: 0;
	margin-top: var(--mg-space-2);
}

/* Линия сверху у .body-cartpage__promo — отступ перед блоком «Нужна сборка» */
.mg-checkout .checkout-onepage__section_delivery .checkout-onepage__assembly.body-cartpage__promo.promo-cartpage {
	margin-top: var(--mg-space-2);
	padding-top: var(--mg-space-2);
}

.mg-checkout .checkout-onepage__assembly .promo-cartpage__col_mkad {
	max-width: 100% !important;
	padding: 0;
	min-width: 0;
}

.mg-checkout .checkout-onepage__assembly .promo-cartpage__col_mkad-meta {
	min-width: 0;
}

/* Сборка без цены: одна колонка, без пустой второй сетки (доступность + визуальный баланс) */
.mg-checkout .checkout-onepage__assembly .mg-checkout-delivery-grid-row--single {
	grid-template-columns: minmax(0, 1fr) !important;
	column-gap: 0;
}

.mg-checkout .checkout-onepage__assembly .promo-cartpage__chkmkad .checkbox__text {
	display: inline-flex !important;
	align-items: center !important;
	line-height: 1.45 !important;
}

.mg-checkout .checkout-onepage__assembly .promo-cartpage__chkmkad .checkbox__text:before {
	align-self: center !important;
	margin-top: 0 !important;
	margin-right: 14px !important;
}

.mg-checkout .checkout-onepage__pay-options.options {
	gap: 12px;
	width: 100%;
}

.mg-checkout .checkout-onepage__pay-item.options__item {
	border-radius: var(--mg-radius);
	border: 1px solid var(--mg-line);
	margin: 0 !important;
	padding: 0;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mg-checkout .checkout-onepage__pay-item.options__item:hover {
	border-color: var(--mg-line-strong);
}

.mg-checkout .checkout-onepage__pay-item.options__item:has(.options__input:checked) {
	border-color: var(--mg-text);
	box-shadow: 0 0 0 2px var(--mg-text);
	background: #fafaf9;
}

/* Радио + текст: центрируем по вертикали; :after из шаблона привязан к top и ломает выравнивание — точка выбора через :before */
.mg-checkout .checkout-onepage__pay-item .options__text {
	display: flex !important;
	align-items: center !important;
	width: 100%;
	box-sizing: border-box;
	padding: 16px 20px !important;
	font-size: clamp(15px, 1.15vw, 17px) !important;
	font-weight: 600 !important;
	line-height: 1.45 !important;
	color: var(--mg-text) !important;
	gap: 0;
}

.mg-checkout .checkout-onepage__pay-item .options__text:before {
	align-self: center !important;
	margin: 0 16px 0 0 !important;
	flex: 0 0 25px;
	width: 25px;
	height: 25px;
}

.mg-checkout .checkout-onepage__pay-item .options__text:after {
	display: none !important;
}

.mg-checkout .checkout-onepage__pay-item .options__input:checked + .options__text:before {
	background: radial-gradient(circle, #fff 4px, #000 4.5px) !important;
}

.mg-checkout .checkout-onepage__pay-item .options__text > span {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
}

.mg-checkout .checkout-onepage__payment .payment-cartpage__body {
	margin: 0 !important;
}

.mg-checkout .checkout-onepage__checkout-foot {
	margin-top: var(--mg-space-4);
	padding-top: var(--mg-space-3);
	border-top: 1px solid var(--mg-line);
	display: flex;
	flex-direction: column;
	gap: var(--mg-space-3);
}

.mg-checkout .checkout-onepage__checkout-actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--mg-space-3);
	width: 100%;
	box-sizing: border-box;
}

.mg-checkout .checkout-onepage__foot-consent {
	width: 100%;
	max-width: 100%;
}

.mg-checkout .checkout-onepage__foot-consent .checkout-onepage__consent-label.checkbox {
	display: block;
	width: 100%;
	cursor: pointer;
}

.mg-checkout .checkout-onepage__foot-consent .checkbox__text {
	display: flex !important;
	align-items: center !important;
	width: 100%;
	max-width: none;
	box-sizing: border-box;
	gap: 14px;
	line-height: 1.5 !important;
	font-size: clamp(13px, 1.05vw, 15px) !important;
	color: var(--mg-muted) !important;
}

.mg-checkout .checkout-onepage__foot-consent .checkbox__text:before {
	align-self: center !important;
	margin-top: 0;
	flex-shrink: 0;
}

.mg-checkout .checkout-onepage__foot-consent .checkbox__text > span {
	flex: 1 1 auto;
	min-width: 0;
	display: block;
	max-width: none;
}

@media (min-width: 992px) {
	.mg-checkout .checkout-onepage__checkout-actions {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: clamp(20px, 3.5vw, 40px);
	}

	.mg-checkout .checkout-onepage__foot-consent {
		flex: 1 1 auto;
		min-width: 0;
		max-width: min(22rem, calc(100% - 200px));
	}

	.mg-checkout .checkout-onepage__foot-submit-row {
		flex: 0 0 auto;
		width: auto;
		align-self: center;
		justify-content: flex-end;
	}
}

.mg-checkout .checkout-onepage__foot-submit-row {
	display: flex;
	justify-content: flex-end;
}

.mg-checkout .checkout-onepage__submit.promo-cartpage__next {
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: none;
	min-height: 54px;
	padding: 14px 44px 14px 24px;
	border-radius: 16px;
	font-family: var(--mg-font);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.35;
	background: var(--mg-text);
	color: #fff;
	border: none;
	cursor: pointer;
	transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	box-sizing: border-box;
}

.mg-checkout .checkout-onepage__submit.promo-cartpage__next span {
	width: auto;
	font-size: inherit;
	line-height: inherit;
	white-space: nowrap;
	padding-right: 26px;
}

.mg-checkout .checkout-onepage__submit.promo-cartpage__next span:before {
	left: calc(100% - 4px);
	width: 22px;
	min-width: 22px;
	max-width: 22px;
	height: 9px;
	margin-top: -4px;
}

.mg-checkout .checkout-onepage__submit.promo-cartpage__next:hover {
	background: #292524;
	box-shadow: var(--mg-shadow-md);
	opacity: 1;
}

.mg-checkout .checkout-onepage__submit.promo-cartpage__next:focus-visible {
	outline: 2px solid var(--mg-accent, #0d9488);
	outline-offset: 2px;
}

.mg-checkout .checkout-onepage__submit.promo-cartpage__next:disabled {
	opacity: 0.55;
	cursor: wait;
}

/* ------------------------------------------------------------------ */
/* Адаптив                                                            */
/* ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
	.mg-checkout .cartpage__row.mg-checkout__grid {
		grid-template-columns: 1fr;
	}

	.mg-checkout__hero-inner {
		grid-template-columns: 1fr;
		text-align: center;
	}

	.mg-checkout__hero-main {
		grid-column: 1;
	}

	.mg-checkout__hero-actions {
		grid-column: 1;
		justify-self: stretch;
		width: 100%;
	}

	.mg-checkout .right-cartpage__content.mg-checkout__aside-card {
		position: relative !important;
		top: auto !important;
		max-height: none;
		overflow-y: visible;
	}

	.mg-checkout .right-cartpage__content._fixed {
		position: relative !important;
		top: auto !important;
	}

	.mg-checkout .body-cartpage__row {
		grid-template-columns: 80px minmax(0, 1fr);
	}

	.mg-checkout .body-cartpage__col_actions {
		grid-column: 1 / -1;
	}

	.mg-checkout .body-cartpage__actions {
		justify-content: space-between;
		width: 100%;
	}

	.mg-checkout .body-cartpage__img {
		width: 80px;
	}

	.mg-checkout .checkout-onepage__foot-submit-row {
		width: 100%;
		justify-content: stretch;
	}

	.mg-checkout .checkout-onepage__foot-submit-row .checkout-onepage__submit.promo-cartpage__next {
		width: 100%;
		justify-content: center;
	}
}

@media (max-width: 767.98px) {
	.mg-checkout .checkout-onepage__section_contacts .contacts-cartpage > .contacts-cartpage__row,
	.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row {
		grid-template-columns: 1fr;
	}

	.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col:nth-child(4),
	.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col:nth-child(5),
	.mg-checkout .checkout-onepage__section_delivery .contacts-cartpage_delivery > .contacts-cartpage__row > .contacts-cartpage__col:nth-child(6) {
		grid-column: auto;
	}
}

/* ------------------------------------------------------------------ */
/* Сообщения валидации: заметно, не «мигает», не скрывается с layout   */
/* ------------------------------------------------------------------ */
.mg-checkout #checkout-order .form__error {
	display: block;
	margin-top: var(--mg-space-1);
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--mg-danger-text);
	background: var(--mg-danger-bg);
	border: 1px solid var(--mg-danger-border);
	border-radius: 8px;
	padding: 8px 10px;
	max-width: 100%;
	box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
	.mg-checkout .mg-checkout__tricolor,
	.mg-checkout .checkout-onepage__submit.promo-cartpage__next,
	.mg-checkout .checkout-onepage__pay-item.options__item,
	.mg-checkout .body-cartpage__del {
		transition: none;
	}
}
