/* admin_products — стили для админ-панели товаров.
   Современная светлая эстетика в духе Tailwind UI 2026 (без подключения
   самого Tailwind): нейтральные slate-тона, indigo-акцент для primary,
   мягкие тени и скругления, единые высоты элементов (решает «прыгающие»
   кнопки и инпуты). Все токены локальны — изолированы в scope
   .admin_products, .admin_products_modal, .ap_confirm_modal и .ap_opt_modal, чтобы не
   влиять на остальной сайт. */

.admin_products,
.admin_products_modal,
.ap_confirm_modal,
.ap_opt_modal {
	--ap-bg: #f8fafc;
	--ap-surface: #ffffff;
	--ap-border: #e2e8f0;
	--ap-border-strong: #cbd5e1;
	--ap-text: #0f172a;
	--ap-muted: #64748b;
	--ap-primary: #4f46e5;
	--ap-primary-hover: #4338ca;
	--ap-primary-soft: #eef2ff;
	--ap-danger: #dc2626;
	--ap-danger-soft: #fee2e2;
	--ap-success: #16a34a;
	--ap-success-soft: #dcfce7;
	--ap-warn-soft: #fef3c7;
	--ap-radius: 10px;
	--ap-radius-sm: 8px;
	--ap-radius-lg: 14px;
	--ap-control-h: 40px;
	--ap-control-h-sm: 36px;
	--ap-shadow-sm: none;
	--ap-shadow-md: none;
	--ap-shadow-lg: none;
	--ap-ring: 0 0 0 3px rgba(79, 70, 229, 0.18);
	--ap-scrollbar-track: transparent;
	--ap-scrollbar-thumb: rgb(148 163 184 / 0.45);
	--ap-scrollbar-thumb-hover: rgb(100 116 139 / 0.65);
	color: var(--ap-text);
}

.admin_products .shadow,
.admin_products .shadow-sm,
.admin_products .shadow-md,
.admin_products .shadow-lg,
.admin_products .shadow-xl,
.admin_products_modal .shadow,
.admin_products_modal .shadow-sm,
.admin_products_modal .shadow-md,
.admin_products_modal .shadow-lg,
.admin_products_modal .shadow-xl,
.admin_products_modal .shadow-primary-500\/20 {
	box-shadow: none !important;
}

/* ---------------- Toolbar и таблица в /lk ---------------- */
.admin_products_toolbar {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 16px;
}
.admin_products_toolbar .admin_products_search {
	flex: 1;
	min-width: 220px;
	height: var(--ap-control-h);
	padding: 0 14px 0 38px;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	background: var(--ap-surface)
		url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>")
		no-repeat 12px center;
	background-size: 16px 16px;
	font-size: 14px;
	color: var(--ap-text);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.admin_products_toolbar .admin_products_search:focus {
	outline: none;
	border-color: var(--ap-primary);
	box-shadow: var(--ap-ring);
}

.admin_products_table_wrap {
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	max-width: 100%;
	max-height: min(70vh, 720px);
	padding: 0;
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	box-shadow: var(--ap-shadow-sm);
	scrollbar-width: thin;
	scrollbar-color: var(--ap-scrollbar-thumb) var(--ap-scrollbar-track);
}
.admin_products_table_wrap::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}
.admin_products_table_wrap::-webkit-scrollbar-thumb {
	background: var(--ap-scrollbar-thumb);
	border-radius: 4px;
}
.admin_products_table_wrap::-webkit-scrollbar-thumb:hover {
	background: var(--ap-scrollbar-thumb-hover);
}

.admin_products_list_loading,
.admin_products_list_end {
	padding: 14px 16px;
	text-align: center;
	font-size: 13px;
	color: var(--ap-muted);
	border-top: 1px solid var(--ap-border);
	background: var(--ap-surface);
}
.admin_products_list_loading.hidden,
.admin_products_list_end.hidden {
	display: none;
}
.admin_products_table {
	width: 100%;
	max-width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	font-size: 14px;
}
.admin_products_table th,
.admin_products_table td {
	padding: 12px 14px;
	text-align: left;
	border-bottom: 1px solid var(--ap-border);
	vertical-align: middle;
	min-width: 0;
}
.admin_products_table thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	font-weight: 600;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ap-muted);
	background: var(--ap-bg, #f8fafc);
}
.admin_products_table tbody tr {
	transition: background 0.12s;
}
.admin_products_table tbody tr:hover {
	background: var(--ap-bg);
}
.admin_products_table tbody tr:last-child td {
	border-bottom: none;
}
.admin_products_table th.ap_photo_head,
.admin_products_table td.ap_photo {
	width: 60px;
	min-width: 60px;
	max-width: 60px;
	padding: 8px 10px;
	box-sizing: border-box;
}
.ap_photo_img {
	display: block;
	width: 48px;
	min-width: 48px;
	max-width: 48px;
	height: 48px;
	object-fit: contain;
	object-position: center;
	border-radius: 6px;
	border: 1px solid var(--ap-border);
	background: var(--ap-bg);
	box-sizing: border-box;
}
.ap_actions {
	white-space: nowrap;
	text-align: right;
	width: 1%;
}

.admin_products_table th.ap_actions_head,
.admin_products_table td.ap_actions {
	position: sticky;
	right: 0;
	z-index: 1;
	background: var(--ap-surface);
	box-shadow: -10px 0 14px -12px rgb(15 23 42 / 0.28);
}

.admin_products_table thead th.ap_actions_head {
	z-index: 4;
	background: var(--ap-bg, #f8fafc);
}

.admin_products_table tbody tr:hover td.ap_actions {
	background: var(--ap-bg);
}

.ap_seria {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	color: var(--ap-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.admin_products_table th.ap_seria_head {
	width: 11rem;
}
.admin_products_table td.ap_seria {
	white-space: nowrap;
}
.admin_products_table th.ap_name_head {
	/* остаток ширины таблицы — без width: 100%, иначе таблица раздувается */
	width: auto;
}
.ap_name {
	font-weight: 500;
	color: var(--ap-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.admin_products_table th.ap_status_head {
	width: 7rem;
}
.admin_products_table td.ap_status {
	white-space: nowrap;
	padding-left: 10px;
	padding-right: 8px;
}
/* Колонка "Создан": компактная дата dd.mm.yy, tabular-nums чтобы цифры
   стояли ровно в столбик. */
.admin_products_table th.ap_created_head {
	width: 4.25rem;
}
.ap_created {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	font-size: 12px;
	color: var(--ap-muted);
	padding-left: 8px;
	padding-right: 10px;
}
.admin_products_table th.ap_actions_head {
	width: 9rem;
}
/* Releon: для legacy-товаров (без явного created_at) дата проксируется
   через mtime галереи в S3. «~ДД.ММ.ГГ» уже в тексте, плюс
   итальянец и менее насыщенный цвет — деликатный сигнал «приблизительно». */
.ap_created.ap_created_approx {
	font-style: italic;
	opacity: 0.75;
}
.ap_actions .ap_icon_btn + .ap_icon_btn {
	margin-left: 4px;
}

/* Бейдж количества товара в таблице. */
.ap_badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	height: 24px;
	padding: 0 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.01em;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.ap_badge_success {
	background: var(--ap-success-soft);
	color: #166534;
}
.ap_badge_draft {
	background: #fef3c7;
	color: #92400e;
}
.ap_badge_muted {
	background: rgba(15, 23, 42, 0.05);
	color: var(--ap-muted);
}

/* Баннер магазина поставщика в /dashboard?tab=products */
.admin_products .marketplace-supplier-banner {
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	box-shadow: var(--ap-shadow-sm);
	padding: 1rem 1.25rem;
	color: var(--ap-text);
}

.admin_products .marketplace-supplier-banner--warn {
	border-color: #f59e0b;
	background: var(--ap-warn-soft);
}

.admin_products .marketplace-supplier-banner__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.admin_products .marketplace-supplier-banner__label {
	font-size: 0.8125rem;
	color: var(--ap-muted);
	margin-bottom: 0.25rem;
}

.admin_products .marketplace-supplier-banner__name {
	display: block;
	font-size: 1rem;
	color: var(--ap-text);
}

.admin_products .marketplace-supplier-banner__hint {
	margin: 0.4rem 0 0;
	font-size: 0.8125rem;
	color: var(--ap-muted);
	line-height: 1.4;
}

.admin_products .marketplace-supplier-banner__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: var(--ap-control-h);
	padding: 0 1rem;
	border: 1px solid var(--ap-primary);
	border-radius: var(--ap-radius-sm);
	background: var(--ap-primary);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: var(--ap-shadow-sm);
}

.admin_products .marketplace-supplier-banner__btn:hover {
	background: var(--ap-primary-hover);
	border-color: var(--ap-primary-hover);
	color: #fff;
	text-decoration: none;
}

/* Иконочные action-кнопки в таблице (вид/правка/удаление/восстановление).
   Применяется и к <button>, и к <a>, поэтому сбрасываем дефолты обоих. */
.ap_icon_btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--ap-control-h-sm);
	height: var(--ap-control-h-sm);
	padding: 0;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	background: var(--ap-surface);
	color: var(--ap-muted);
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s, border-color 0.15s, color 0.15s,
		box-shadow 0.15s;
	vertical-align: middle;
}
.ap_icon_btn:hover {
	background: var(--ap-primary-soft);
	border-color: var(--ap-primary);
	color: var(--ap-primary);
}
.ap_icon_btn:focus-visible {
	outline: none;
	box-shadow: var(--ap-ring);
}
.ap_icon_btn svg {
	display: block;
	width: 16px;
	height: 16px;
}
.ap_icon_btn.ap_danger:hover {
	background: var(--ap-danger-soft);
	border-color: var(--ap-danger);
	color: var(--ap-danger);
}

/* ---------------- Предпросмотр PDP ---------------- */
.admin_products_preview_shell {
	width: 100%;
	max-width: min(1440px, calc(100vw - 32px));
}

.admin_products_preview_modal {
	width: 100%;
	max-height: 92vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: var(--ap-bg, #f8fafc);
	border-radius: var(--ap-radius-lg, 12px);
	box-shadow: var(--ap-shadow-lg, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
}

.admin_products_preview_header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--ap-border, rgba(15, 23, 42, 0.08));
	background: inherit;
	position: sticky;
	top: 0;
	z-index: 2;
}

.admin_products_preview_title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
}

.admin_products_preview_subtitle {
	margin: 4px 0 0;
	font-size: 0.85rem;
	opacity: 0.75;
}

.admin_products_preview_header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.ap_editor_title_row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 1rem;
}

.ap_editor_title_row .ap_editor_title {
	flex: 1;
	min-width: 0;
}

.ap_editor_title_actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	padding-top: 2px;
}

.admin_products_modal .ap_editor_title_row .ap_icon_btn,
.admin_products_inline_shell .ap_editor_title_row .ap_icon_btn {
	width: 36px;
	height: 36px;
}

.ap_json_modal {
	width: min(920px, 92vw);
	max-height: min(85vh, 900px);
	display: flex;
	flex-direction: column;
	padding: 16px 18px 18px;
	background: var(--ap-surface, #fff);
	border-radius: 12px;
}

.ap_json_modal_head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.ap_json_title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 600;
}

.ap_json_modal_actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ap_json_copy_btn,
.ap_json_close_btn {
	border: 1px solid var(--ap-border, #d1d5db);
	background: var(--ap-surface-2, #f9fafb);
	color: inherit;
	border-radius: 8px;
	padding: 6px 12px;
	cursor: pointer;
}

.ap_json_close_btn {
	width: 36px;
	height: 36px;
	padding: 0;
	font-size: 1.25rem;
	line-height: 1;
}

.ap_json_status {
	margin: 0 0 10px;
	color: var(--ap-muted, #6b7280);
	font-size: 0.875rem;
}

.ap_json_pre {
	margin: 0;
	flex: 1;
	min-height: 200px;
	max-height: calc(85vh - 120px);
	overflow: auto;
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid var(--ap-border, #e5e7eb);
	background: #0f172a;
	color: #e2e8f0;
	font-size: 12px;
	line-height: 1.45;
	white-space: pre;
	tab-size: 2;
}

.ap_json_pre code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.admin_products_preview_body {
	overflow-y: auto;
	padding: 0 12px 16px;
	-webkit-overflow-scrolling: touch;
}

.admin_products_preview_body .single_product.pdp-shell {
	margin-top: 12px !important;
	margin-bottom: 12px !important;
}

.admin_products_preview_body .pdp-shell--embed .pdp-shell__sticky {
	position: static;
	top: auto;
}

.admin_products_preview_body .pdp-shell--embed .pdp-shell__row {
	align-items: start;
}

html.dark .admin_products_preview_modal,
.admin_products_preview_modal.dark {
	background: #0f172a;
	border-color: rgba(148, 163, 184, 0.15);
}

/* ---------------- Форма ---------------- */
.admin_products_modal,
.admin_products_modal.stage { /* .stage из colors/style.css тоже красит #fff — повышаем specificity */
	/* Ширина формы согласована с основным контейнером сайта
	   (.container max-width: 1440px в public.css).
	   - width: 100% растягивает модалку на ширину overlay-контейнера;
	   - max-width: min(1440px, calc(100vw - 32px)) одновременно ограничивает
	     сверху шириной сайта И гарантирует отступ 16px слева/справа на
	     экранах шире, на узких — сжимается корректно. */
	width: 100%;
	max-width: min(1440px, calc(100vw - 32px));
	max-height: 90vh;
	overflow-y: auto;
	box-sizing: border-box;
	padding: 0;
	/* Модалка не чисто-белая, а slate-50. Это создаёт мягкий контраст
	   фона с белыми карточками-секциями внутри — деликатное цветовое
	   зонирование без крикливых цветных блоков. */
	background: var(--ap-bg);
	border-radius: var(--ap-radius-lg);
	box-shadow: var(--ap-shadow-lg);
}

/* Редактор с AI: шире стандартной модалки */
.admin_products_modal:has(.ap_editor_layout) {
	max-width: min(1680px, calc(100vw - 32px));
}

/* Тонкий скроллбар модалки редактора (Firefox + WebKit) */
.admin_products_modal {
	scrollbar-width: thin;
	scrollbar-color: var(--ap-scrollbar-thumb) var(--ap-scrollbar-track);
}
.admin_products_modal::-webkit-scrollbar {
	width: 5px;
}
.admin_products_modal::-webkit-scrollbar-track {
	background: transparent;
	margin: 10px 0;
}
.admin_products_modal::-webkit-scrollbar-thumb {
	background-color: var(--ap-scrollbar-thumb);
	border-radius: 999px;
	border: 1px solid transparent;
	background-clip: padding-box;
}
.admin_products_modal::-webkit-scrollbar-thumb:hover {
	background-color: var(--ap-scrollbar-thumb-hover);
}
.admin_products_modal::-webkit-scrollbar-corner {
	background: transparent;
}

.admin_products_form_wrap {
	padding: 24px 28px 0;
}
.admin_products_form_wrap h3 {
	margin: 0 0 20px;
	font-size: 20px;
	font-weight: 600;
	color: var(--ap-text);
	letter-spacing: -0.01em;
}

/* ---------------- Секции формы (ap_group) ----------------
   Деликатное цветовое зонирование: на slate-50 фоне модалки каждая
   логическая группа полей — это белая карточка с тонкой рамкой,
   едва заметной тенью и негромким заголовком. Цветовой акцент
   передаётся через маленькую круглую точку в заголовке (ap_group_dot)
   и цвет иконки + лёгкая заливка в header — так мы получаем современную
   «раскладку как в Linear/Vercel», не перегружая глаз. */
.admin_products_form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.ap_group {
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-lg);
	box-shadow: var(--ap-shadow-sm);
	/* ВАЖНО: НЕ ставить overflow: hidden/clip — внутри секции живут
	   combobox-поиск (ap_prop_name) и select-выпадашки, которые
	   абсолютно спозиционированы и должны выходить за границы карточки.
	   Скругление шапки решено border-radius на самом ap_group_header. */
	--ap-accent: #64748b;
	--ap-accent-soft: #f1f5f9;
}
.ap_group_header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px;
	border-bottom: 1px solid var(--ap-border);
	/* Скругляем top-радиус шапки, чтобы градиент не вылезал за рамку
	   секции (bottom — плоский, т.к. ниже идёт тело карточки). */
	border-radius: var(--ap-radius-lg) var(--ap-radius-lg) 0 0;
	background: linear-gradient(180deg, var(--ap-accent-soft), transparent);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ap-muted);
}
.ap_group_dot {
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: var(--ap-accent);
	box-shadow: none;
	flex: 0 0 auto;
}
.ap_group_icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--ap-accent);
	flex: 0 0 auto;
}
.ap_group_title {
	color: var(--ap-accent);
	letter-spacing: 0.06em;
}
.ap_group_body {
	padding: 18px;
}
.ap_group_body > .ap_field:last-child,
.ap_group_body > .ap_field_row:last-child {
	margin-bottom: 0;
}
/* Секция фото: body сжимаем по вертикали — внутренние компоненты
   (photo_order_admin_wrap, ap_drop_area) уже имеют свои отступы. */
.ap_group[data-group="photos"] .ap_group_body {
	padding: 14px 18px 18px;
}
.ap_group[data-group="photos"] .ap_field_photos {
	margin-bottom: 0;
}
.ap_group[data-group="photos"] .ap_field_photos > .ap_label {
	display: none; /* Заголовок теперь в шапке секции. */
}

/* Цветовые акценты секций. Используем HSL-нейтрализованные оттенки
   из Tailwind 2026 палитры — приглушённые и пастельные, чтобы
   разделение пространства оставалось «деликатным», а не цветастым. */
.ap_group_indigo  { --ap-accent: #6366f1; --ap-accent-soft: #eef2ff; }
.ap_group_amber   { --ap-accent: #d97706; --ap-accent-soft: #fffbeb; }
.ap_group_sky     { --ap-accent: #0284c7; --ap-accent-soft: #f0f9ff; }
.ap_group_emerald { --ap-accent: #059669; --ap-accent-soft: #ecfdf5; }
.ap_group_violet  { --ap-accent: #7c3aed; --ap-accent-soft: #f5f3ff; }
.ap_group_rose    { --ap-accent: #e11d48; --ap-accent-soft: #fff1f2; }
.ap_group_neutral { --ap-accent: #64748b; --ap-accent-soft: #f1f5f9; }
.ap_field {
	margin-bottom: 16px;
}
.ap_field_row {
	display: flex;
	gap: 12px;
	margin-bottom: 16px;
	align-items: flex-end;
}
.ap_field_row > .ap_field {
	flex: 1;
	min-width: 0;
	margin-bottom: 0;
}
.ap_label {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 500;
	color: var(--ap-muted);
	letter-spacing: 0.01em;
}
.ap_req {
	color: var(--ap-danger);
	margin-left: 2px;
}
/* Унифицированные инпуты формы. Высота 40px у всех текстовых/числовых
   полей и селектов ставит их на одну линию с combobox'ами и кнопками,
   убирая визуальный разнобой. */
.ap_input,
.ap_field input[type="text"],
.ap_field input[type="number"],
.ap_field input[type="search"],
.ap_field input[type="email"],
.ap_field select,
.ap_field textarea {
	width: 100%;
	box-sizing: border-box;
	height: var(--ap-control-h);
	padding: 8px 12px;
	font-size: 14px;
	color: var(--ap-text);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
	font-family: inherit;
}
.ap_field input::placeholder,
.ap_field textarea::placeholder {
	color: #94a3b8;
}
.ap_field input:hover,
.ap_field select:hover,
.ap_field textarea:hover {
	border-color: var(--ap-border-strong);
}
.ap_field input:focus,
.ap_field select:focus,
.ap_field textarea:focus {
	outline: none;
	border-color: var(--ap-primary);
	box-shadow: var(--ap-ring);
}
.ap_field textarea {
	height: auto;
	min-height: 96px;
	padding: 10px 12px;
	resize: vertical;
	line-height: 1.5;
	overflow: auto;
}

/* Редактор описания: одна рамка на контейнере, без border у textarea */
.add-products-page .ap_desc_editor_box,
.admin_products_modal .ap_desc_editor_box {
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm, 0.5rem);
	overflow: hidden;
	background: var(--ap-surface);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.add-products-page .ap_desc_editor_box:focus-within,
.admin_products_modal .ap_desc_editor_box:focus-within {
	border-color: var(--ap-primary);
	box-shadow: var(--ap-ring);
}

.add-products-page .ap_desc_editor_box .desc-editor-toolbar,
.admin_products_modal .ap_desc_editor_box .desc-editor-toolbar {
	border-bottom: 1px solid var(--ap-border) !important;
	border-radius: 0;
}

.add-products-page .ap_desc_editor_box .ap_desc_editor_input,
.admin_products_modal .ap_desc_editor_box .ap_desc_editor_input,
.admin_products_modal .ap_field_desc_editor .ap_desc_editor_input {
	border: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	background: var(--ap-input-bg, var(--ap-surface)) !important;
}

.add-products-page .ap_desc_editor_box .ap_desc_editor_input:focus,
.admin_products_modal .ap_desc_editor_box .ap_desc_editor_input:focus {
	border: none !important;
	box-shadow: none !important;
	outline: none;
}

.add-products-page .ap_desc_editor_box .ap_desc_editor_input:hover,
.admin_products_modal .ap_desc_editor_box .ap_desc_editor_input:hover {
	border: none !important;
}

/* public.css сбрасывает appearance у textarea — ломает угол resize в модалке */
.admin_products_modal .ap_field textarea {
	-webkit-appearance: auto;
	-moz-appearance: auto;
	appearance: auto;
	background-clip: padding-box;
}

.admin_products_modal .ap_field textarea::-webkit-resizer {
	background-color: var(--ap-input-bg, var(--ap-surface));
	border: none;
}

.admin_products_modal .ap_field textarea::-webkit-scrollbar-corner {
	background-color: var(--ap-input-bg, var(--ap-surface));
}

/* Подсказки под полем (напр. auto-генерация seria). */
.ap_seria_hint,
.font_low.ap_seria_hint {
	font-size: 12px;
	color: var(--ap-muted);
	margin-top: 6px;
}

.ap_seria_hint.ap_seria_hint_error {
	color: var(--ap-danger);
}

/* ── Seria в create-режиме: preview в блоке «Категории» ───────────── */
.ap_seria_preview_wrap {
	margin-top: 4px;
}
.ap_seria_preview_row {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: var(--ap-control-h);
}

/* Нередактируемая плашка с артикулом */
.ap_seria_preview_display {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	height: var(--ap-control-h);
	padding: 0 14px;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	background: var(--ap-bg);
	font-size: 14px;
	font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
	letter-spacing: 0.02em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ap_seria_preview_value {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ap_seria_preview_value.ap_seria_preview_placeholder {
	color: var(--ap-muted);
	font-family: inherit;
	font-size: 13px;
	letter-spacing: 0;
	font-style: italic;
}
.ap_seria_preview_display.is-filled {
	border-color: var(--ap-border-strong);
	background: var(--ap-surface);
	color: var(--ap-text);
}

/* Кнопка «карандаш» — ручной ввод артикула (всегда доступна в create-режиме) */
.ap_seria_edit_btn {
	flex: 0 0 auto;
}

/* Поле ввода (только когда пользователь нажал «карандаш») */
.ap_seria_preview_input {
	flex: 1;
}
.ap_seria_preview_input:focus {
	outline: none;
	border-color: var(--ap-primary);
	box-shadow: var(--ap-ring);
}

/* Combobox: подстраиваем триггер под общий размер инпутов, чтобы на
   одной строке (ap_field_row) ничего не «плавало» по вертикали. */
.admin_products_form .cmb_trigger,
.admin_products_modal .cmb_trigger,
.ap_combobox > .cmb_trigger {
	min-height: var(--ap-control-h);
	padding: 8px 12px;
	border-radius: var(--ap-radius-sm);
	border-color: var(--ap-border);
	font-size: 14px;
}
.admin_products_form .cmb.is-open > .cmb_trigger,
.admin_products_form .cmb_trigger:focus,
.admin_products_form .cmb_trigger:focus-visible,
.admin_products_modal .cmb.is-open > .cmb_trigger,
.admin_products_modal .cmb_trigger:focus,
.admin_products_modal .cmb_trigger:focus-visible {
	border-color: var(--ap-primary);
	box-shadow: var(--ap-ring);
}

.ap_cat2_combobox.ap_cat2_locked > .cmb_trigger {
	opacity: 0.72;
}

/* Свойства */
.ap_props_list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.ap_prop_row {
	display: grid;
	grid-template-columns: 1fr 1fr var(--ap-control-h);
	gap: 8px;
	align-items: stretch;
}
.ap_prop_key_wrap,
.ap_prop_val_wrap {
	min-width: 0;
}
.ap_prop_key_wrap .cmb,
.ap_prop_val_wrap .cmb {
	width: 100%;
	height: 100%;
}
/* Внутри ap_prop_row combobox'ы чуть компактнее, чем в основном ряду,
   но всё равно выровнены по 40px высоте вместе с кнопкой удаления. */
.ap_prop_combobox > .cmb_trigger {
	min-height: var(--ap-control-h);
	padding: 8px 12px;
	font-size: 13px;
	border-radius: var(--ap-radius-sm);
	border-color: var(--ap-border);
}
.ap_prop_remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--ap-control-h);
	height: var(--ap-control-h);
	padding: 0;
	border: 1px solid var(--ap-border);
	background: var(--ap-surface);
	border-radius: var(--ap-radius-sm);
	color: var(--ap-muted);
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ap_prop_remove:hover {
	background: var(--ap-danger-soft);
	border-color: var(--ap-danger);
	color: var(--ap-danger);
}
.ap_prop_add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: var(--ap-control-h);
	padding: 0 14px;
	margin-top: 8px;
	cursor: pointer;
	background: var(--ap-surface);
	border: 1px dashed var(--ap-border-strong);
	border-radius: var(--ap-radius-sm);
	color: var(--ap-muted);
	font-size: 13px;
	font-weight: 500;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ap_prop_add:hover {
	background: var(--ap-primary-soft);
	border-color: var(--ap-primary);
	border-style: solid;
	color: var(--ap-primary);
}

/* Photos: сетка/превью/DnD/rotate/delete живут в product_gallery.
   Здесь — только зона загрузки drop-area. */
.ap_drop_area {
	display: block;
	width: 100%;
	box-sizing: border-box;
	border: 2px dashed var(--ap-border-strong);
	padding: 24px;
	text-align: center;
	cursor: pointer;
	background: var(--ap-bg);
	border-radius: var(--ap-radius);
	color: var(--ap-muted);
	font-size: 13px;
	line-height: 1.5;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.ap_drop_area.is_dragover {
	border-color: var(--ap-primary);
	background: var(--ap-primary-soft);
	color: var(--ap-primary);
}
.ap_drop_area:focus,
.ap_drop_area:focus-visible {
	outline: none;
	border-color: var(--ap-primary);
	background: var(--ap-primary-soft);
	color: var(--ap-primary);
	box-shadow: var(--ap-ring);
}
.ap_drop_area kbd {
	display: inline-block;
	padding: 1px 6px;
	border: 1px solid var(--ap-border-strong);
	border-bottom-width: 2px;
	border-radius: 4px;
	background: var(--ap-surface);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.4;
	color: var(--ap-text);
}
.ap_drop_hint_target {
	display: block;
	margin-top: 6px;
	color: var(--ap-muted);
	font-size: 12px;
}
.ap_drop_area.ap_needs_seria {
	background: rgba(15, 23, 42, 0.03);
	color: #94a3b8;
	cursor: not-allowed;
	border-style: dotted;
}
.ap_drop_area.ap_needs_seria.is_dragover {
	border-color: var(--ap-danger);
	background: var(--ap-danger-soft);
	color: var(--ap-danger);
}
.ap_hint {
	color: var(--ap-muted);
	background: var(--ap-bg);
}

/* ---------------- Прогресс загрузки ---------------- */
.ap_uploads_progress {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.ap_upload_item {
	padding: 10px 12px;
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	box-shadow: var(--ap-shadow-sm);
}
.ap_upload_item.is_done {
	background: var(--ap-success-soft);
	border-color: #86efac;
}
.ap_upload_item.is_error {
	background: var(--ap-danger-soft);
	border-color: #fca5a5;
}
.ap_upload_top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	margin-bottom: 6px;
}
.ap_upload_name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--ap-text);
}
.ap_upload_pct {
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
	color: var(--ap-muted);
	font-size: 12px;
}
.ap_upload_close {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 1px solid transparent;
	background: transparent;
	color: var(--ap-muted);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}
.ap_upload_close:hover {
	background: rgba(15, 23, 42, 0.06);
	color: var(--ap-text);
	border-color: var(--ap-border);
}
.ap_upload_item.is_error .ap_upload_close {
	color: var(--ap-danger);
}
.ap_upload_item.is_error .ap_upload_close:hover {
	background: rgba(220, 38, 38, 0.1);
	border-color: rgba(220, 38, 38, 0.3);
}
.ap_upload_track {
	height: 6px;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.08);
	overflow: hidden;
}
.ap_upload_bar {
	height: 100%;
	width: 0%;
	background: var(--ap-primary);
	transition: width 0.15s ease, background 0.2s ease;
}
.ap_upload_item.is_done .ap_upload_bar {
	background: var(--ap-success);
}
.ap_upload_item.is_error .ap_upload_bar {
	background: var(--ap-danger);
}
.ap_upload_status {
	margin-top: 6px;
	color: var(--ap-muted);
	font-size: 12px;
	white-space: pre-wrap;
	word-break: break-word;
}
.ap_upload_item.is_error .ap_upload_status {
	color: #991b1b;
}

.ap_uploads_header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 6px 4px;
	font-size: 12px;
	flex-wrap: wrap;
	color: var(--ap-muted);
}
.ap_uploads_count {
	color: var(--ap-muted);
}
.ap_uploads_actions {
	display: inline-flex;
	gap: 6px;
}
.ap_uploads_actions button {
	height: 28px;
	padding: 0 10px;
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	color: var(--ap-muted);
	cursor: pointer;
	font-size: 12px;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ap_uploads_actions button:hover {
	background: var(--ap-primary-soft);
	border-color: var(--ap-primary);
	color: var(--ap-primary);
}
.ap_uploads_actions button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ---------------- Actions / footer ---------------- */
/* Sticky footer: при длинной форме кнопки «Сохранить/Отмена» всегда
   в поле зрения. Полупрозрачный blur-фон не даёт форме «наезжать». */
.admin_products_form_actions {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: flex-end;
	position: sticky;
	bottom: 0;
	margin: 20px -28px 0;
	padding: 16px 28px;
	background: color-mix(in srgb, var(--ap-bg) 88%, transparent);
	backdrop-filter: saturate(180%) blur(10px);
	-webkit-backdrop-filter: saturate(180%) blur(10px);
	border-top: 1px solid var(--ap-border);
	border-bottom-left-radius: var(--ap-radius-lg);
	border-bottom-right-radius: var(--ap-radius-lg);
	z-index: 2;
}
.admin_products_form_msg {
	margin-right: auto;
	font-size: 13px;
}
.admin_products_form_msg[data-kind="ok"] { color: var(--ap-success); }
.admin_products_form_msg[data-kind="error"] { color: var(--ap-danger); }
.admin_products_form_msg[data-kind="progress"] { color: var(--ap-muted); }

/* Primary и secondary кнопки админки. Важны одинаковая высота,
   inline-flex и гаp — это и есть то, что «выравнивает» их с инпутами
   и друг с другом в любых комбинациях (toolbar, footer, модалки). */
.admin_products .main_btn.prime,
.admin_products_create_btn,
.admin_products_form .main_btn.prime,
.admin_products_modal .main_btn.prime {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: auto;
	flex-shrink: 0;
	height: var(--ap-control-h);
	padding: 0 18px;
	background-color: var(--ap-primary);
	background-image: none;
	color: #fff;
	border: 1px solid var(--ap-primary);
	border-radius: var(--ap-radius-sm);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	box-shadow: var(--ap-shadow-sm);
	transition: background 0.15s, border-color 0.15s, box-shadow 0.15s,
		transform 0.05s;
}
.admin_products .main_btn.prime:hover,
.admin_products_create_btn:hover,
.admin_products_form .main_btn.prime:hover,
.admin_products_modal .main_btn.prime:hover {
	background-color: var(--ap-primary-hover);
	background-image: none;
	border-color: var(--ap-primary-hover);
}
.admin_products .main_btn.prime:active,
.admin_products_create_btn:active,
.admin_products_form .main_btn.prime:active,
.admin_products_modal .main_btn.prime:active {
	transform: translateY(1px);
}
.admin_products .main_btn.prime:focus-visible,
.admin_products_create_btn:focus-visible,
.admin_products_form .main_btn.prime:focus-visible,
.admin_products_modal .main_btn.prime:focus-visible {
	outline: none;
	box-shadow: var(--ap-ring);
}

.admin_products_cancel_btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: var(--ap-control-h);
	padding: 0 16px;
	background-color: var(--ap-surface);
	background-image: none;
	color: var(--ap-text);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}
.admin_products_cancel_btn:hover {
	background: var(--ap-bg);
	border-color: var(--ap-border-strong);
}

/* ---------------- Optimize buttons ---------------- */
/* «Оптимизировать всё» в тулбаре и «Оптимизировать фото товара» в форме.
   Один визуальный пресет — secondary-кнопка с иконкой-молнией. */
.admin_products_optimize_all_btn,
.admin_products_optimize_product_btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: var(--ap-control-h);
	padding: 0 14px;
	background-color: var(--ap-surface);
	background-image: none;
	cursor: pointer;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	color: var(--ap-muted);
	font-size: 13px;
	font-weight: 500;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.admin_products_optimize_all_btn:hover,
.admin_products_optimize_product_btn:hover {
	background: var(--ap-warn-soft);
	border-color: #f59e0b;
	color: #92400e;
}
.admin_products_optimize_all_btn:disabled,
.admin_products_optimize_product_btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.admin_products_optimize_all_btn svg,
.admin_products_optimize_product_btn svg {
	width: 14px;
	height: 14px;
}

/* ---------------- Optimize progress modal (airModal stack) ---------------- */
.ap_opt_modal {
	background: var(--ap-surface);
	width: 100%;
	max-width: 640px;
	max-height: 90vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 24px;
	border-radius: var(--ap-radius-lg);
	box-shadow: var(--ap-shadow-lg);
}
.ap_opt_title {
	font-size: 18px;
	font-weight: 600;
	margin: 0;
	color: var(--ap-text);
	letter-spacing: -0.01em;
}
.ap_opt_status {
	color: var(--ap-muted);
	min-height: 1.4em;
	font-size: 13px;
}
.ap_opt_progress_track {
	height: 8px;
	background: rgba(15, 23, 42, 0.08);
	border-radius: 999px;
	overflow: hidden;
}
.ap_opt_progress_bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, var(--ap-primary), var(--ap-primary-hover));
	transition: width 0.25s ease;
}
.ap_opt_stats {
	color: var(--ap-muted);
	font-size: 13px;
	min-height: 1.4em;
}
.ap_opt_log {
	background: var(--ap-bg);
	max-height: 240px;
	overflow-y: auto;
	padding: 10px 12px;
	border-radius: var(--ap-radius-sm);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
	color: var(--ap-text);
}
.ap_opt_log_line { color: var(--ap-success); }
.ap_opt_log_line.ap_opt_skip { color: var(--ap-muted); }
.ap_opt_log_line.ap_opt_err  { color: var(--ap-danger); }
.ap_opt_actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}
.ap_opt_close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: var(--ap-control-h);
	padding: 0 18px;
	background: var(--ap-surface);
	color: var(--ap-text);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: background 0.15s, border-color 0.15s;
}
.ap_opt_close:hover {
	background: var(--ap-bg);
	border-color: var(--ap-border-strong);
}
.ap_opt_close:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* PDP edit button — кнопка на странице товара (не в модалке).
   Оставляем не в .admin_products-скоупе, т.к. рендерится вне его. */
.admin_products_pdp_edit {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	height: 40px;
	padding: 0 16px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	color: #0f172a;
	transition: background 0.15s, border-color 0.15s;
}
.admin_products_pdp_edit:hover {
	background: #eef2ff;
	border-color: #4f46e5;
	color: #4f46e5;
}

/* ---------------- Delete confirm modal (airModal stack) ---------------- */
.ap_confirm_modal {
	background: var(--ap-surface);
	width: 100%;
	max-width: 480px;
	padding: 24px;
	border-radius: var(--ap-radius-lg);
	box-shadow: var(--ap-shadow-lg);
}

.ap_confirm_title {
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 600;
	color: var(--ap-text);
}

.ap_confirm_lead {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ap-text);
}

.ap_confirm_lead strong {
	font-weight: 600;
}

.ap_confirm_warnings {
	margin: 0 0 12px;
	padding-left: 18px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ap-muted);
}

.ap_confirm_warnings li + li {
	margin-top: 6px;
}

.ap_confirm_note {
	margin: 0 0 20px;
	font-size: 13px;
	color: var(--ap-danger);
}

.ap_confirm_actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	flex-wrap: wrap;
}

.ap_confirm_cancel_btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: var(--ap-control-h);
	padding: 0 18px;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm);
	background: var(--ap-surface);
	color: var(--ap-text);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.ap_confirm_cancel_btn:hover {
	background: var(--ap-bg);
	border-color: var(--ap-border-strong);
}

.ap_confirm_delete_btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: var(--ap-control-h);
	padding: 0 18px;
	border: 1px solid var(--ap-danger);
	border-radius: var(--ap-radius-sm);
	background: var(--ap-danger);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.ap_confirm_delete_btn:hover:not(:disabled) {
	background: #b91c1c;
	border-color: #b91c1c;
}

.ap_confirm_delete_btn:disabled {
	opacity: 0.7;
	cursor: wait;
}

/* ---- Dark theme (CRM shell) — те же токены, что admin_catalog_order ---- */
html.dark .admin_products,
html.dark .admin_products_modal,
html.dark .ap_confirm_modal,
html.dark .ap_opt_modal,
.dark .admin_products,
.dark .admin_products_modal,
.dark .ap_confirm_modal,
.dark .ap_opt_modal {
	--ap-bg: #111827;
	--ap-surface: #1f2937;
	--ap-border: #374151;
	--ap-border-strong: #4b5563;
	--ap-text: #f1f5f9;
	--ap-muted: #9ca3af;
	--ap-primary: #818cf8;
	--ap-primary-hover: #6366f1;
	--ap-primary-soft: rgb(99 102 241 / 0.18);
	--ap-danger: #f87171;
	--ap-danger-soft: rgb(248 113 113 / 0.15);
	--ap-success: #34d399;
	--ap-success-soft: rgb(52 211 153 / 0.15);
	--ap-warn-soft: rgb(245 158 11 / 0.15);
	--ap-shadow-sm: none;
	--ap-shadow-md: none;
	--ap-shadow-lg: none;
	--ap-scrollbar-track: transparent;
	--ap-scrollbar-thumb: rgb(75 85 99 / 0.55);
	--ap-scrollbar-thumb-hover: rgb(107 114 128 / 0.75);
	--ap-ring: 0 0 0 3px rgb(129 140 248 / 0.25);
	color: var(--ap-text);
}

html.dark .admin_products_table thead th,
.dark .admin_products_table thead th {
	background: var(--ap-bg, #111827);
}

html.dark .admin_products_table thead th.ap_actions_head,
.dark .admin_products_table thead th.ap_actions_head {
	background: var(--ap-bg, #111827);
}

html.dark .admin_products_table td.ap_actions,
.dark .admin_products_table td.ap_actions {
	background: var(--ap-surface);
	box-shadow: -10px 0 14px -12px rgb(0 0 0 / 0.45);
}

html.dark .admin_products_table tbody tr:hover td.ap_actions,
.dark .admin_products_table tbody tr:hover td.ap_actions {
	background: rgb(255 255 255 / 0.03);
}

html.dark .admin_products_table tbody tr:hover,
.dark .admin_products_table tbody tr:hover {
	background: rgb(255 255 255 / 0.03);
}

html.dark .ap_badge_success,
.dark .ap_badge_success {
	color: #6ee7b7;
}

html.dark .ap_badge_draft,
.dark .ap_badge_draft {
	background: rgb(245 158 11 / 0.18);
	color: #fbbf24;
}

html.dark .ap_badge_muted,
.dark .ap_badge_muted {
	background: rgb(255 255 255 / 0.06);
}

html.dark .admin_products_toolbar .admin_products_search::placeholder,
html.dark .admin_products_toolbar .admin_products_search::-webkit-input-placeholder,
.dark .admin_products_toolbar .admin_products_search::placeholder,
.dark .admin_products_toolbar .admin_products_search::-webkit-input-placeholder,
html.dark .ap_field input::placeholder,
html.dark .ap_field textarea::placeholder,
html.dark .ap_field input::-webkit-input-placeholder,
html.dark .ap_field textarea::-webkit-input-placeholder,
.dark .ap_field input::placeholder,
.dark .ap_field textarea::placeholder,
.dark .ap_field input::-webkit-input-placeholder,
.dark .ap_field textarea::-webkit-input-placeholder {
	color: #6b7280;
	opacity: 1;
	background-color: transparent;
}

html.dark .ap_drop_area.ap_needs_seria,
.dark .ap_drop_area.ap_needs_seria {
	background: rgb(255 255 255 / 0.03);
	color: #6b7280;
}

html.dark .ap_upload_close:hover,
.dark .ap_upload_close:hover {
	background: rgb(255 255 255 / 0.06);
}

html.dark .ap_upload_track,
html.dark .ap_opt_progress_track,
.dark .ap_upload_track,
.dark .ap_opt_progress_track {
	background: rgb(255 255 255 / 0.08);
}

html.dark .ap_upload_item.is_error .ap_upload_status,
.dark .ap_upload_item.is_error .ap_upload_status {
	color: #fca5a5;
}

html.dark .admin_products_optimize_all_btn:hover,
html.dark .admin_products_optimize_product_btn:hover,
.dark .admin_products_optimize_all_btn:hover,
.dark .admin_products_optimize_product_btn:hover {
	color: #fbbf24;
}

/* Акценты секций формы — приглушённые для тёмного фона */
html.dark .ap_group_indigo,
.dark .ap_group_indigo { --ap-accent: #818cf8; --ap-accent-soft: rgb(99 102 241 / 0.12); }
html.dark .ap_group_amber,
.dark .ap_group_amber { --ap-accent: #fbbf24; --ap-accent-soft: rgb(245 158 11 / 0.12); }
html.dark .ap_group_sky,
.dark .ap_group_sky { --ap-accent: #38bdf8; --ap-accent-soft: rgb(56 189 248 / 0.12); }
html.dark .ap_group_emerald,
.dark .ap_group_emerald { --ap-accent: #34d399; --ap-accent-soft: rgb(52 211 153 / 0.12); }
html.dark .ap_group_violet,
.dark .ap_group_violet { --ap-accent: #a78bfa; --ap-accent-soft: rgb(167 139 250 / 0.12); }
html.dark .ap_group_rose,
.dark .ap_group_rose { --ap-accent: #fb7185; --ap-accent-soft: rgb(251 113 133 / 0.12); }
html.dark .ap_group_neutral,
.dark .ap_group_neutral { --ap-accent: #9ca3af; --ap-accent-soft: rgb(156 163 175 / 0.1); }

/* Combobox внутри admin_products (dropdown — position:fixed, вне DOM-дерева формы) */
html.dark .admin_products .cmb_trigger,
html.dark .admin_products_modal .cmb_trigger,
.dark .admin_products .cmb_trigger,
.dark .admin_products_modal .cmb_trigger {
	background: var(--ap-surface);
	border-color: var(--ap-border);
	color: var(--ap-text);
}

html.dark .admin_products .cmb_trigger:hover,
html.dark .admin_products_modal .cmb_trigger:hover,
.dark .admin_products .cmb_trigger:hover,
.dark .admin_products_modal .cmb_trigger:hover {
	border-color: var(--ap-border-strong);
}

html.dark .admin_products .cmb_value.is-placeholder,
html.dark .admin_products_modal .cmb_value.is-placeholder,
.dark .admin_products .cmb_value.is-placeholder,
.dark .admin_products_modal .cmb_value.is-placeholder {
	color: #6b7280;
}

html.dark .admin_products .cmb_arrow,
html.dark .admin_products_modal .cmb_arrow,
.dark .admin_products .cmb_arrow,
.dark .admin_products_modal .cmb_arrow {
	color: #9ca3af;
}

html.dark body:has(.admin_products_modal) .cmb_dropdown,
html.dark body:has(.admin_products) .cmb_dropdown,
.dark body:has(.admin_products_modal) .cmb_dropdown,
.dark body:has(.admin_products) .cmb_dropdown {
	background: #1f2937;
	border-color: #374151;
	color: #f1f5f9;
	box-shadow: none;
}

html.dark body:has(.admin_products_modal) .cmb_search_wrap,
html.dark body:has(.admin_products) .cmb_search_wrap,
.dark body:has(.admin_products_modal) .cmb_search_wrap,
.dark body:has(.admin_products) .cmb_search_wrap {
	background: #111827;
	border-bottom-color: #374151;
}

html.dark body:has(.admin_products_modal) .cmb_search,
html.dark body:has(.admin_products) .cmb_search,
.dark body:has(.admin_products_modal) .cmb_search,
.dark body:has(.admin_products) .cmb_search {
	background: #1f2937;
	border-color: #374151;
	color: #f1f5f9;
}

html.dark body:has(.admin_products_modal) .cmb_opt,
html.dark body:has(.admin_products) .cmb_opt,
.dark body:has(.admin_products_modal) .cmb_opt,
.dark body:has(.admin_products) .cmb_opt {
	color: #e5e7eb;
}

html.dark body:has(.admin_products_modal) .cmb_opt.is-active,
html.dark body:has(.admin_products) .cmb_opt.is-active,
.dark body:has(.admin_products_modal) .cmb_opt.is-active,
.dark body:has(.admin_products) .cmb_opt.is-active {
	background: rgb(99 102 241 / 0.18);
}

html.dark body:has(.admin_products_modal) .cmb_opt.is-selected,
html.dark body:has(.admin_products) .cmb_opt.is-selected,
.dark body:has(.admin_products_modal) .cmb_opt.is-selected,
.dark body:has(.admin_products) .cmb_opt.is-selected {
	color: #a5b4fc;
}

html.dark body:has(.admin_products_modal) .cmb_empty,
html.dark body:has(.admin_products) .cmb_empty,
.dark body:has(.admin_products_modal) .cmb_empty,
.dark body:has(.admin_products) .cmb_empty {
	color: #9ca3af;
}

html.dark body:has(.admin_products_modal) .cmb_create,
html.dark body:has(.admin_products) .cmb_create,
.dark body:has(.admin_products_modal) .cmb_create,
.dark body:has(.admin_products) .cmb_create {
	background: rgb(52 211 153 / 0.08);
	border-top-color: #374151;
	color: #6ee7b7;
}

html.dark body:has(.admin_products_modal) .cmb_create:hover,
html.dark body:has(.admin_products) .cmb_create:hover,
.dark body:has(.admin_products_modal) .cmb_create:hover,
.dark body:has(.admin_products) .cmb_create:hover {
	background: rgb(52 211 153 / 0.15);
}

/* Блок фото в форме товара */
html.dark .admin_products_modal .photo_order_content,
.dark .admin_products_modal .photo_order_content {
	background: linear-gradient(145deg, #1f2937, #111827);
	box-shadow: none;
}

html.dark .admin_products_modal .photo_order_content h3,
.dark .admin_products_modal .photo_order_content h3 {
	color: #f3f4f6;
}

html.dark .admin_products_modal .photo_order_content p,
html.dark .admin_products_modal .photo_order_hint,
html.dark .admin_products_modal .photo_order_status,
.dark .admin_products_modal .photo_order_content p,
.dark .admin_products_modal .photo_order_hint,
.dark .admin_products_modal .photo_order_status {
	color: #9ca3af;
}

html.dark .admin_products_modal .photo_order_meta_list,
.dark .admin_products_modal .photo_order_meta_list {
	border-color: #374151;
	background: #111827;
}

html.dark .admin_products_modal .photo_order_meta_row,
.dark .admin_products_modal .photo_order_meta_row {
	border-color: #374151;
}

html.dark .admin_products_modal .photo_order_meta_row__name_input,
.dark .admin_products_modal .photo_order_meta_row__name_input {
	background: #1f2937;
	border-color: #374151;
	color: #f3f4f6;
}

html.dark .admin_products_pdp_edit,
.dark .admin_products_pdp_edit {
	background: #1f2937;
	border-color: #374151;
	color: #f1f5f9;
}

html.dark .admin_products_pdp_edit:hover,
.dark .admin_products_pdp_edit:hover {
	background: rgb(99 102 241 / 0.18);
	border-color: #818cf8;
	color: #a5b4fc;
}

/* ---------------- Modal / editor: AirCRM skin ---------------- */
.admin_products_modal:not(.admin_products_inline_shell):has(.add-products-page) {
	background: var(--ap-bg);
	padding: 0;
	height: 90vh;
	min-height: 90vh;
	max-height: 90vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

html.dark .admin_products_modal:not(.admin_products_inline_shell):has(.add-products-page),
.admin_products_modal.dark:not(.admin_products_inline_shell):has(.add-products-page) {
	background: #111827;
}

.admin_products_inline_shell.admin_products_modal.dark:has(.add-products-page) {
	background: #111827;
}

.admin_products_inline_shell.admin_products_modal:has(.add-products-page) {
	padding: 0;
	max-height: none;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.admin_products_modal:has(.ap_editor_layout) .admin_products_form_wrap,
.admin_products_modal:has(.ap_editor_layout) .add-products-page.admin_products_editor {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.admin_products_modal:has(.ap_editor_layout) .ap_editor_layout {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
}

/* Модалка и inline в ЛK — тёмный skin только при html.dark / .dark на модалке */
html.dark .admin_products_modal .add-products-page,
.admin_products_modal.dark .add-products-page {
	--ap-surface: rgb(31 41 55 / 0.92);
	--ap-surface-muted: rgb(17 24 39 / 0.65);
	--ap-border: rgb(55 65 81 / 0.85);
	--ap-text: #f3f4f6;
	--ap-text-secondary: #d1d5db;
	--ap-text-muted: #9ca3af;
	--ap-input-bg: #111827;
	color: var(--ap-text);
}

/* Витрина: .stage и глобальный .bg-white красят карточки в белый, текст остаётся светлым */
.admin_products_modal.stage,
.admin_products_modal.stage input,
.admin_products_modal .stage input {
	background-color: transparent;
	color: inherit;
}
.admin_products_modal.dark .add-products-page .dashboard-card,
.admin_products_modal.dark .add-products-page .add-products-progress,
.admin_products_modal.dark .add-products-page .add-products-save-panel {
	background-color: var(--ap-surface) !important;
	border-color: var(--ap-border) !important;
	color: var(--ap-text);
}
.admin_products_modal.dark .add-products-page .ap_editor_title,
.admin_products_modal.dark .add-products-page h3 {
	color: #fff !important;
}
.admin_products_modal.dark .add-products-page label,
.admin_products_modal.dark .add-products-page .dashboard-card label {
	color: var(--ap-text-secondary) !important;
}
.admin_products_modal.dark .add-products-page input:not([type="checkbox"]):not([type="radio"]),
.admin_products_modal.dark .add-products-page select,
.admin_products_modal.dark .add-products-page textarea {
	background-color: var(--ap-input-bg) !important;
	border-color: var(--ap-border) !important;
	color: var(--ap-text) !important;
}
.admin_products_modal.dark .add-products-page .ap_desc_editor_input {
	border-radius: 0 !important;
	min-height: 200px;
	height: auto;
	resize: vertical;
	overflow: auto;
	-webkit-appearance: auto;
	-moz-appearance: auto;
	appearance: auto;
}
.admin_products_modal .ap_desc_editor_input {
	display: block;
	width: 100%;
	min-height: 200px;
	height: auto;
	resize: vertical;
	overflow: auto;
	-webkit-appearance: auto;
	-moz-appearance: auto;
	appearance: auto;
}
.admin_products_modal .ap_desc_editor_input::-webkit-resizer,
.admin_products_modal.dark .add-products-page .ap_desc_editor_input::-webkit-resizer {
	background-color: var(--ap-border-strong, #94a3b8);
	border: 1px solid var(--ap-border, #cbd5e1);
	border-top: none;
	border-left: none;
	border-radius: 0 0 0.45rem 0;
}
.admin_products_modal .ap_desc_editor_input::-webkit-scrollbar-corner {
	background-color: var(--ap-input-bg, var(--ap-surface, #fff));
}
.admin_products_modal .ap-tab-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	line-height: 1.25;
	white-space: nowrap;
}
.admin_products_modal .ap-tab-btn .ap_tab_icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	line-height: 0;
}
.admin_products_modal .ap-tab-btn .ap_tab_icon svg,
.admin_products_modal .admin_products_form_actions .ap_tab_icon svg {
	display: block;
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
}
.admin_products_modal .admin_products_form_actions .ap_tab_icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	line-height: 0;
}

.admin_products_modal .add-products-page .ap_tags_field {
	width: 100%;
}

.admin_products_modal .add-products-page .ap_tags_field tags.tagify,
.admin_products_modal .add-products-page .ap_tags_field .tagify {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	width: 100%;
	min-height: 2.625rem;
	padding: 0.375rem 0.625rem;
	box-sizing: border-box;
	border-radius: 0.5rem;
	font-size: 0.875rem;
}

.admin_products_modal .add-products-page .ap_tags_field .tagify__input,
.admin_products_modal .add-products-page .ap_tags_field .tagify__input::before {
	font-size: 0.875rem;
	line-height: 1.4;
	font-weight: 400;
}

.admin_products_modal.dark .add-products-page .ap_tags_field input.ap_tags_input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: 2.625rem;
	padding: 0.375rem 0.625rem;
	border: 1px solid var(--ap-border);
	border-radius: 0.5rem;
	background-color: var(--ap-input-bg);
	color: var(--ap-text);
	font-size: 0.875rem;
}

.admin_products_modal.dark .add-products-page tags.tagify,
.admin_products_modal.dark .add-products-page .ap_tags_field .tagify {
	--tags-border-color: rgb(75 85 99 / 0.9);
	--tag-bg: rgb(139 92 246 / 0.28);
	--tag-hover: rgb(139 92 246 / 0.4);
	--tag-text-color: #ddd6fe;
	--tag-text-color--edit: #ede9fe;
	--tag-remove-btn-color: #c4b5fd;
	--tag-remove-btn-bg--hover: #7c3aed;
	--tagify-dd-bg-color: #1f2937;
	--tagify-dd-text-color: #e5e7eb;
}

.admin_products_modal .admin_products_form_wrap {
	padding: 0;
}

.admin_products_modal .add-products-page .ap_field_row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 1rem;
	margin-bottom: 0;
}

.admin_products_modal .add-products-page .ap_field_row > .ap_field {
	margin-bottom: 1rem;
}

.admin_products_modal .add-products-page [data-group="photos"] .ap_field_photos > .ap_label {
	display: none;
}

.admin_products_modal.dark .add-products-page .cmb_trigger {
	min-height: 2.5rem;
	padding: 0.5rem 1rem;
	border-radius: 0.5rem;
	background-color: var(--ap-input-bg) !important;
	border-color: var(--ap-border) !important;
	color: var(--ap-text) !important;
	font-size: 0.875rem;
}

.admin_products_modal .add-products-page .ap_prop_add,
.admin_products_modal .add-products-page .ap_variation_add {
	padding: 0.5rem 1rem;
	background: rgb(243 244 246);
	color: rgb(139 92 246);
	border-radius: 0.5rem;
	border: none;
	font-size: 0.875rem;
}
.dark .admin_products_modal.dark .add-products-page .ap_prop_add,
.dark .admin_products_modal.dark .add-products-page .ap_variation_add {
	background: rgb(55 65 81);
	color: rgb(196 181 253);
}

.admin_products_modal .add-products-page .ap_variations_table_wrap {
	border-color: var(--ap-border);
	background: var(--ap-surface-muted);
	border-radius: 0.5rem;
}

.admin_products_modal .add-products-page .admin_products_form_actions.add-products-save-panel {
	flex-shrink: 0;
	position: relative;
	z-index: 20;
	box-sizing: border-box;
	width: 100%;
	min-height: var(--ap-editor-footer-h);
	height: var(--ap-editor-footer-h);
	margin: 0;
	padding: var(--ap-editor-footer-pad-y) var(--ap-editor-footer-pad-x);
	background: var(--ap-surface) !important;
	background-color: var(--ap-surface) !important;
	border-top: 1px solid var(--ap-border) !important;
	box-shadow: none !important;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
}

.admin_products_modal .add-products-page .admin_products_form_actions.add-products-save-panel > .max-w-7xl {
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

.admin_products_modal .add-products-page .admin_products_form_msg[data-kind="ok"] {
	color: #16a34a;
}
.admin_products_modal .add-products-page .admin_products_form_msg[data-kind="error"] {
	color: #dc2626;
}

.admin_products_modal .add-products-page .ap_seria_hint,
.admin_products_modal .add-products-page .ap_field_hint {
	color: var(--ap-text-muted);
	font-size: 0.75rem;
	margin-top: 0.25rem;
}

/* ---------------- Progress stepper (навигация по разделам редактора) ---------------- */
.add-products-page .ap_progress_track {
	display: flex;
	align-items: center;
	width: 100%;
	min-width: 0;
	gap: 0;
	justify-content: space-between;
	overflow: hidden;
	padding-inline: 0;
}

.admin_products_modal .add-products-progress {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.add-products-page .ap_progress_step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	flex: 0 1 auto;
	min-width: 0;
	max-width: 100%;
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	font: inherit;
	color: var(--ap-text-muted, #6b7280);
	transition: color 0.15s ease;
}

.add-products-page .ap_progress_step:hover {
	color: var(--ap-primary, #6366f1);
}

.add-products-page .ap_progress_step:focus-visible {
	outline: 2px solid var(--ap-primary, #6366f1);
	outline-offset: 2px;
	border-radius: 0.375rem;
}

.add-products-page .ap_progress_badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 1.625rem;
	height: 1.625rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1;
	background: rgb(229 231 235);
	color: rgb(75 85 99);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.admin_products_modal.dark .add-products-page .ap_progress_badge {
	background: rgb(55 65 81);
	color: rgb(209 213 219);
}

.add-products-page .ap_progress_label {
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.2;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.add-products-page .ap_progress_step.is-active {
	color: var(--ap-text, #111827);
}

.add-products-page .ap_progress_step.is-active .ap_progress_badge {
	background: var(--ap-primary, #6366f1);
	color: #fff;
}

.add-products-page .ap_progress_step.is-active .ap_progress_label {
	font-weight: 600;
	color: var(--ap-text, #111827);
}

.admin_products_modal.dark .add-products-page .ap_progress_step.is-active {
	color: var(--ap-text, #f3f4f6);
}

.admin_products_modal.dark .add-products-page .ap_progress_step.is-active .ap_progress_label {
	color: var(--ap-text, #f3f4f6);
}

.add-products-page .ap_progress_step.is-done {
	color: var(--ap-text-secondary, #4b5563);
}

.add-products-page .ap_progress_step.is-done .ap_progress_badge {
	background: rgb(139 92 246 / 0.22);
	color: var(--ap-primary, #6366f1);
	font-size: 0;
}

.add-products-page .ap_progress_step.is-done .ap_progress_badge::before {
	content: '✓';
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

.add-products-page .ap_progress_connector {
	flex: 1 1 0;
	min-width: 0.375rem;
	width: auto;
	max-width: none;
	height: 1px;
	margin: 0 0.25rem;
	align-self: center;
	background: rgb(229 231 235);
	transition: background-color 0.15s ease;
}

.admin_products_modal.dark .add-products-page .ap_progress_connector {
	background: rgb(75 85 99 / 0.85);
}

.add-products-page .ap_progress_connector.is-filled {
	background: var(--ap-primary, #6366f1);
}

@media (max-width: 639px) {
	.add-products-page .ap_progress_label {
		display: none;
	}

	.add-products-page .ap_progress_connector {
		min-width: 0.25rem;
		margin: 0 0.125rem;
	}
}

/* Узкая колонка формы (split + AI): только номера, подпись — в title */
@container ap-editor-form (max-width: 34rem) {
	.add-products-page .ap_progress_label {
		display: none;
	}

	.add-products-page .ap_progress_step {
		flex: 0 0 auto;
	}

	.add-products-page .ap_progress_connector {
		flex: 1 1 0;
		min-width: 0.25rem;
		margin: 0 0.125rem;
	}
}

/* ---------------- AI editor split layout ---------------- */
.admin_products_modal .ap_editor_layout,
.admin_products_inline_shell .ap_editor_layout {
	--ap-editor-modal-max: 1680px;
	--ap-ai-panel-min: 480px;
	--ap-ai-panel-max: 56vw;
	--ap-form-col-min: 400px;
	--ap-ai-drawer-width: 78%;
	--ap-ai-panel-width-default: clamp(480px, 38%, 640px);
	--ap-ai-panel-width: var(--ap-ai-panel-width-default);
	--ap-editor-footer-pad-y: 1rem;
	--ap-editor-footer-pad-x: 1.5rem;
	--ap-editor-footer-h: calc(var(--ap-control-h) + 2 * var(--ap-editor-footer-pad-y) + 1px);
	--ap-editor-pane-outer: 1.25rem;
	--ap-editor-pane-inner: 1rem;
	position: relative;
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: 0;
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	width: 100%;
	overflow: hidden;
}

@media (min-width: 640px) {
	.admin_products_modal .ap_editor_layout,
	.admin_products_inline_shell .ap_editor_layout {
		--ap-editor-pane-outer: 1.5rem;
		--ap-editor-pane-inner: 1rem;
	}
}

.admin_products_modal .ap_editor_form_col,
.admin_products_inline_shell .ap_editor_form_col {
	flex: 1 1 0%;
	min-width: 0;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	container-type: inline-size;
	container-name: ap-editor-form;
}

.admin_products_modal .ap_editor_form_col.add-products-content {
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding: 1rem 0 0 0 !important;
	box-sizing: border-box;
}

@media (min-width: 640px) {
	.admin_products_modal .ap_editor_form_col.add-products-content {
		padding: 1.25rem 0 0 0 !important;
	}
}

.admin_products_modal .ap_editor_form_col > .ap_editor_title_row,
.admin_products_modal .ap_editor_form_col .admin_products_form > .ap_editor_body,
.admin_products_inline_shell .ap_editor_form_col > .ap_editor_title_row,
.admin_products_inline_shell .ap_editor_form_col .admin_products_form > .ap_editor_body {
	padding-left: var(--ap-editor-pane-outer);
	padding-right: var(--ap-editor-pane-inner);
	box-sizing: border-box;
}

.admin_products_modal .ap_editor_form_col > .ap_editor_title,
.admin_products_modal .ap_editor_form_col .ap_editor_body {
	padding-left: 0;
	padding-right: 0;
}

.admin_products_modal .ap_editor_form_col > .ap_editor_title,
.admin_products_modal .ap_editor_form_col > .add-products-progress {
	flex-shrink: 0;
}

.admin_products_modal .ap_editor_form_col > .add-products-progress,
.admin_products_inline_shell .ap_editor_form_col > .add-products-progress {
	margin-left: var(--ap-editor-pane-outer);
	margin-right: var(--ap-editor-pane-inner);
	margin-bottom: 0.75rem !important;
	padding: 0.5rem 0.75rem !important;
	width: auto;
	max-width: none;
	box-sizing: border-box;
}

.admin_products_inline_shell .ap_editor_form_col > .ap_editor_title {
	flex-shrink: 0;
	min-width: 0;
}

.admin_products_modal .ap_editor_form_col .admin_products_form {
	flex: 1 1 0%;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.admin_products_modal .ap_editor_form_col .admin_products_form_actions.add-products-save-panel,
.admin_products_inline_shell .ap_editor_form_col .admin_products_form_actions.add-products-save-panel {
	flex-shrink: 0;
	margin-bottom: 0;
	width: 100%;
	align-self: stretch;
	box-sizing: border-box;
}

.admin_products_modal .ap_editor_form_col .ap_editor_body {
	flex: 1 1 0%;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
}

.admin_products_modal .ap_ai_panel,
.admin_products_inline_shell .ap_ai_panel {
	flex: 0 0 var(--ap-ai-panel-width);
	width: var(--ap-ai-panel-width);
	max-width: var(--ap-ai-panel-max);
	display: flex;
	flex-direction: column;
	border-left: none;
	background: var(--ap-surface);
	overflow: hidden;
	height: 100%;
	min-height: 0;
	align-self: stretch;
	padding: 0 var(--ap-editor-pane-outer) 0 var(--ap-editor-pane-inner);
	box-sizing: border-box;
}

.admin_products_modal .ap_ai_panel_head {
	padding: 12px 14px 8px;
	border-bottom: 1px solid var(--ap-border);
}

.admin_products_modal .ap_ai_upload_block {
	padding: 10px 14px;
	border-bottom: 1px solid var(--ap-border);
	flex-shrink: 0;
}

.admin_products_modal .ap_ai_upload_btn {
	display: inline-block;
	padding: 6px 12px;
	border-radius: var(--ap-radius-sm);
	border: 1px dashed var(--ap-border-strong);
	background: var(--ap-bg);
	font-size: 12px;
	cursor: pointer;
}

.admin_products_modal .ap_ai_upload_label {
	cursor: pointer;
}

.admin_products_modal .ap_sr_only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.admin_products_modal .ap_ai_chat_mount,
.admin_products_inline_shell .ap_ai_chat_mount {
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	margin-left: calc(-1 * var(--ap-editor-pane-inner));
	margin-right: calc(-1 * var(--ap-editor-pane-outer));
	width: calc(100% + var(--ap-editor-pane-inner) + var(--ap-editor-pane-outer));
	box-sizing: border-box;
}

/* Встроенный чат: drawer-sidebar + flex column, без фиксированных 750px */
.admin_products_modal .ap_ai_panel .modal_ai_chat.ap_ai_chat_embed {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	box-shadow: none;
	border-radius: 0;
	background: transparent;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-modal-surface {
	background: transparent;
	padding: 0;
	height: 100%;
	min-height: 0;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-sizing: border-box;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-root,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-root > .flex.flex-1 {
	flex: 1 1 auto;
	min-height: 0;
	height: 100%;
	width: 100%;
	display: flex;
	flex-direction: column;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-panel {
	--ai-chat-vpad: 0;
	--ai-chat-panel-height: 100%;
	width: 100%;
	height: 100%;
	min-height: 0;
	align-items: stretch;
	justify-content: flex-start;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-panel .ai-chat-layout {
	width: 100%;
	max-width: none;
	max-height: none !important;
	height: 100%;
	flex: 1 1 auto;
	min-height: 0;
	gap: 0;
	position: relative;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-main {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .chat-container {
	width: 100%;
	max-width: none !important;
	height: auto !important;
	max-height: none !important;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	border-radius: 0;
	box-shadow: none;
	border: none;
	background: var(--ap-bg);
}

.admin_products_modal.dark .ap_ai_panel .ap_ai_chat_embed .chat-container {
	background: rgb(17 24 39 / 0.65);
}

.admin_products_modal .ap_ai_draft_slot {
	flex-shrink: 0;
	max-height: min(40vh, 360px);
	overflow-x: auto;
	overflow-y: auto;
	border-top: 1px solid var(--ap-border);
	background: var(--ap-bg);
	-webkit-overflow-scrolling: touch;
	order: 2;
}

.admin_products_modal .ap_ai_draft_slot[hidden] {
	display: none !important;
}

.admin_products_modal .ap_ai_preview--sticky {
	margin: 0;
}

.admin_products_modal .ap_ai_patch_notice .message-content {
	opacity: 0.88;
	font-size: 12px;
	padding: 8px 12px;
}

.admin_products_modal.dark .ap_ai_panel .ap_ai_chat_embed .chat-header {
	padding: 10px var(--ap-editor-pane-outer) 8px var(--ap-editor-pane-inner);
	flex-shrink: 0;
	background: rgb(31 41 55 / 0.95);
	border-bottom: 1px solid var(--ap-border);
	color: var(--ap-text);
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .chat-header h2 {
	font-size: 0.95rem;
	line-height: 1.25;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-catalog-tagline {
	font-size: 0.7rem;
	line-height: 1.3;
	margin: 0;
	opacity: 0.85;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-header-top {
	display: grid;
	grid-template-columns: 36px 1fr auto;
	align-items: center;
	gap: 4px;
	min-height: 40px;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-header-start {
	display: flex;
	grid-column: 1;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-header-titles {
	grid-column: 2;
	align-items: flex-start;
	text-align: left;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-header-actions {
	grid-column: 3;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-header-meta,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed #aiChatToolbarToggle,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed #aiChatNewBtnHeader,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-deepseek-toolbar {
	display: none !important;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .messages-area {
	flex: 1 1 auto;
	min-height: 0;
	max-height: none;
	overflow-y: auto;
	order: 1;
	padding: 1rem var(--ap-editor-pane-outer) 1rem var(--ap-editor-pane-inner);
	box-sizing: border-box;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-message > .message-content,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-message .message-content--rich,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-reasoning,
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-editor-stream-status {
	max-width: 100%;
	width: 100%;
	box-sizing: border-box;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-message {
	width: 100%;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-composer {
	flex-shrink: 0;
	box-sizing: border-box;
	min-height: var(--ap-editor-footer-h);
	height: auto;
	display: flex;
	flex-direction: column;
	background: var(--ap-surface) !important;
	border-top: 1px solid var(--ap-border) !important;
	order: 3;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-composer-surface.input-area {
	flex: 0 0 auto;
	box-sizing: border-box;
	min-height: calc(var(--ap-editor-footer-h) - 1px);
	height: auto;
	padding: var(--ap-editor-footer-pad-y) var(--ap-editor-pane-outer) var(--ap-editor-footer-pad-y) var(--ap-editor-pane-inner);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 8px;
	border-top: none;
	background: transparent;
	overflow: visible;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-composer-surface.input-area:has(.ai-chat-attachment-list:not(:empty)),
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-composer-surface.input-area:has(.ai-chat-composer-flash:not([hidden])) {
	justify-content: flex-start;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-composer-row {
	flex-shrink: 0;
	min-height: var(--ap-control-h);
	align-items: center;
	gap: 8px;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-input-wrap {
	flex: 1 1 auto;
	min-width: 0;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-attachment-list:not(:empty) {
	flex-shrink: 0;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-attachment-list:empty {
	display: none;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed #aiChatInput {
	box-sizing: border-box;
	height: var(--ap-control-h);
	min-height: var(--ap-control-h);
	max-height: var(--ap-control-h);
	padding: 9px 36px 9px 14px !important;
	line-height: 20px;
	font-size: 0.875rem;
	border-radius: var(--ap-radius-sm);
	resize: none;
	overflow: hidden !important;
	width: 100%;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-input-wrap #aiChatAttachBtn.ai-chat-icon-btn--in-input {
	width: 28px;
	height: 28px;
	min-width: 28px;
	min-height: 28px;
	right: 6px;
	border-radius: 6px;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-send-btn {
	width: var(--ap-control-h);
	height: var(--ap-control-h);
	min-width: var(--ap-control-h);
	min-height: var(--ap-control-h);
	border-radius: var(--ap-radius-sm);
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed #aiChatInput::placeholder {
	line-height: 20px;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-composer-flash:not([hidden]) {
	padding: 0 0 4px;
	font-size: 0.75rem;
	line-height: 1.2;
}

/* Sidebar — drawer поверх колонки, не в flex-row */
.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-sidebar-overlay {
	display: block;
	position: fixed;
	inset: 0;
	z-index: 10060;
	background: rgba(15, 23, 42, 0.45);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-panel.ai-chat-sidebar-open .ai-chat-sidebar-overlay,
body.ai-chat-drawer-open .admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-sidebar-overlay {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	z-index: 10070;
	width: min(86vw, 300px);
	max-width: none;
	max-height: none;
	height: 100%;
	height: 100dvh;
	margin: 0;
	border-radius: 0;
	transform: translate3d(-105%, 0, 0);
	transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
	box-shadow: none;
	background: rgb(31 41 55);
	border: none;
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-sidebar.is-open {
	transform: translate3d(0, 0, 0);
}

.admin_products_modal .ap_ai_panel .ap_ai_chat_embed .ai-chat-sidebar-title {
	color: var(--ap-text-muted);
}

.admin_products_modal .ap_ai_patch_message {
	width: 100%;
}

.admin_products_modal .ap_ai_patch_message > .message-content {
	width: 100%;
	max-width: 100%;
	padding: 0;
	background: transparent;
	border: none;
	box-shadow: none;
}

.admin_products_modal .ap_ai_preview--in-chat {
	padding: 10px 12px;
	border: none;
	border-radius: var(--ap-radius-sm);
	background: var(--ap-bg);
	max-height: none;
	overflow: visible;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_preview_head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
	font-size: 12px;
}

.admin_products_modal .ap_ai_preview_delta {
	margin-left: auto;
	padding: 1px 8px;
	border-radius: 999px;
	background: rgba(79, 70, 229, 0.12);
	color: var(--ap-primary);
	font-weight: 500;
	white-space: nowrap;
}

.admin_products_modal .ap_ai_preview_status {
	font-weight: 400;
	font-size: 11px;
	color: var(--ap-text-muted);
}

.admin_products_modal .ap_ai_preview_status--applied {
	color: var(--ap-primary);
}

.admin_products_modal .ap_ai_preview--stale {
	opacity: 0.55;
}

.admin_products_modal .ap_ai_preview--applied,
.admin_products_modal .ap_ai_preview--rejected {
	opacity: 0.85;
}

.admin_products_modal .ap_ai_preview_empty {
	margin: 6px 0 8px;
	padding: 8px 10px;
	border-radius: var(--ap-radius-sm);
	background: var(--ap-warn-soft);
	font-size: 12px;
	line-height: 1.4;
}

.admin_products_modal .ap_ai_preview_table_wrap {
	overflow-x: auto;
	overflow-y: visible;
	margin-top: 4px;
	-webkit-overflow-scrolling: touch;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_preview_table_wrap {
	overflow-x: auto;
	overflow-y: visible;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_preview_table {
	table-layout: auto;
	width: max-content;
	min-width: 100%;
	font-size: 10px;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_preview_table th,
.admin_products_modal .ap_ai_preview--in-chat .ap_ai_preview_table td {
	padding: 3px 6px;
	vertical-align: top;
	white-space: nowrap;
	max-width: 140px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_col_check {
	width: 28px;
	min-width: 28px;
	max-width: 28px;
	padding: 3px 4px;
	text-align: center;
	vertical-align: middle;
	white-space: nowrap;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_col_field {
	min-width: 72px;
	max-width: 96px;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_col_was {
	min-width: 56px;
	max-width: 140px;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_col_next {
	min-width: 64px;
	max-width: 180px;
	font-weight: 500;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_col_conf {
	min-width: 40px;
	max-width: 48px;
	padding: 3px 4px;
	text-align: center;
	color: var(--ap-text-muted);
	white-space: nowrap;
}

.admin_products_modal .ap_ai_preview--in-chat .ap_ai_preview_table thead th {
	font-size: 10px;
	font-weight: 600;
	color: var(--ap-text-muted);
	background: var(--ap-surface);
	white-space: nowrap;
}

.admin_products_modal .ap_ai_preview--create .ap_ai_col_was {
	display: none;
}

.admin_products_modal .ap_ai_preview_table {
	width: 100%;
	border-collapse: collapse;
	font-size: 11px;
}

.admin_products_modal .ap_ai_preview_table th,
.admin_products_modal .ap_ai_preview_table td {
	border: 1px solid var(--ap-border);
	padding: 4px 6px;
	vertical-align: top;
}

.admin_products_modal .ap_ai_preview_actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.admin_products_modal .ap_btn_primary,
.admin_products_modal .ap_btn_secondary,
.admin_products_modal .ap_btn_ghost {
	padding: 5px 10px;
	border-radius: var(--ap-radius-sm);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
	border: 1px solid var(--ap-border);
	background-color: var(--ap-surface);
	background-image: none;
	color: var(--ap-text);
}

.admin_products_modal .ap_btn_primary {
	background-color: var(--ap-primary);
	color: #fff;
	border-color: var(--ap-primary);
}

.admin_products_modal .ap_btn_primary:hover:not(:disabled) {
	background-color: var(--ap-primary-hover);
	border-color: var(--ap-primary-hover);
	color: #fff;
}

.admin_products_modal .ap_btn_secondary:hover:not(:disabled) {
	background-color: var(--ap-primary-soft);
	border-color: var(--ap-primary);
	color: var(--ap-primary);
}

.admin_products_modal .ap_btn_ghost:hover:not(:disabled) {
	background-color: var(--ap-bg);
	border-color: var(--ap-border-strong);
}

.admin_products_modal .ap_btn_primary:disabled,
.admin_products_modal .ap_btn_secondary:disabled,
.admin_products_modal .ap_btn_ghost:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.admin_products_modal .ap_ai_preview_actions .ap_btn_primary,
.admin_products_modal .ap_ai_preview_actions .ap_btn_secondary,
.admin_products_modal .ap_ai_preview_actions .ap_btn_ghost {
	min-height: 32px;
	padding: 6px 12px;
}

.admin_products_modal .ap_ai_chip {
	display: inline-block;
	margin: 2px 4px 2px 0;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--ap-warn-soft);
	font-size: 11px;
}

.admin_products_modal .ap_ai_chip--review {
	background: rgba(245, 158, 11, 0.15);
}

.admin_products_modal .ap_ai_notes {
	margin: 0 0 10px;
	padding: 8px 10px;
	border-radius: 8px;
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid rgba(239, 68, 68, 0.15);
	font-size: 12px;
	line-height: 1.45;
}

.admin_products_modal .ap_ai_note {
	margin: 0 0 6px;
}

.admin_products_modal .ap_ai_note:last-child {
	margin-bottom: 0;
}

.admin_products_modal .ap_ai_preview_table tr.ap_ai_row_review td {
	background: rgba(245, 158, 11, 0.06);
}

.admin_products_modal .ap_ai_preview_table tr.ap_ai_row_unresolved td {
	opacity: 0.72;
}

.admin_products_modal .ap_ai_preview_table tr.ap_ai_row_new td {
	background: rgba(79, 70, 229, 0.08);
}

.admin_products_modal .ap_ai_preview_table tr.ap_ai_row_changed td {
	background: rgba(14, 165, 233, 0.08);
}

.admin_products_modal .ap_ai_row_badge {
	display: inline-block;
	margin-left: 4px;
	padding: 0 5px;
	border-radius: 4px;
	background: rgba(79, 70, 229, 0.15);
	color: var(--ap-primary);
	font-size: 9px;
	font-weight: 600;
	text-transform: lowercase;
	vertical-align: middle;
}

.admin_products_modal .ap_ai_row_badge--changed {
	background: rgba(14, 165, 233, 0.15);
	color: #0284c7;
}

.admin_products_modal .ap_ai_conflicts {
	margin: 8px 0;
	padding: 8px;
	border-radius: var(--ap-radius-sm);
	background: var(--ap-warn-soft);
	font-size: 12px;
}

.admin_products_modal .ap_ai_conflict_opt {
	display: block;
	margin: 4px 0;
}

.admin_products_modal .ap_field.ap_ai_patched {
	outline: 2px solid rgba(79, 70, 229, 0.35);
	outline-offset: 2px;
	border-radius: 6px;
}

.admin_products_modal .ap_field.ap_ai_conflict {
	outline-color: rgba(220, 38, 38, 0.45);
}

.admin_products_modal .ap_ai_mapping_block {
	padding: 10px 14px;
	border-bottom: 1px solid var(--ap-border);
	font-size: 12px;
}

.admin_products_modal .ap_ai_map_row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}

/* --- Layout toolbar --- */
.admin_products_modal .ap_ai_layout_toolbar,
.admin_products_inline_shell .ap_ai_layout_toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	margin-left: calc(-1 * var(--ap-editor-pane-inner));
	margin-right: calc(-1 * var(--ap-editor-pane-outer));
	width: calc(100% + var(--ap-editor-pane-inner) + var(--ap-editor-pane-outer));
	padding: 8px var(--ap-editor-pane-outer) 8px var(--ap-editor-pane-inner);
	border-bottom: 1px solid var(--ap-border);
	background: var(--ap-surface-muted, var(--ap-bg));
	flex-shrink: 0;
	box-sizing: border-box;
}

.admin_products_modal .ap_ai_layout_btn,
.admin_products_inline_shell .ap_ai_layout_btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 5px 8px;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-sm, 6px);
	background: var(--ap-surface);
	color: var(--ap-text-secondary, var(--ap-text));
	font-size: 11px;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.admin_products_modal .ap_ai_layout_btn:hover,
.admin_products_inline_shell .ap_ai_layout_btn:hover {
	background: var(--ap-bg);
	border-color: var(--ap-primary, #8b5cf6);
	color: var(--ap-primary, #8b5cf6);
}

.admin_products_modal .ap_ai_layout_btn[aria-pressed="true"],
.admin_products_inline_shell .ap_ai_layout_btn[aria-pressed="true"] {
	background: rgb(139 92 246 / 0.12);
	border-color: var(--ap-primary, #8b5cf6);
	color: var(--ap-primary, #8b5cf6);
}

.admin_products_modal .ap_ai_layout_btn i,
.admin_products_inline_shell .ap_ai_layout_btn i {
	font-size: 14px;
	line-height: 1;
}

.admin_products_modal .ap_ai_layout_btn_label,
.admin_products_inline_shell .ap_ai_layout_btn_label {
	white-space: nowrap;
}

/* --- Splitter --- */
.admin_products_modal .ap_editor_splitter,
.admin_products_inline_shell .ap_editor_splitter {
	flex: 0 0 6px;
	width: 6px;
	margin: 0 -3px;
	position: relative;
	z-index: 5;
	cursor: col-resize;
	background: transparent;
	touch-action: none;
	user-select: none;
	align-self: stretch;
}

.admin_products_modal .ap_editor_splitter::after,
.admin_products_inline_shell .ap_editor_splitter::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 1px;
	transform: translateX(-50%);
	background: var(--ap-border);
	transition: background 0.15s ease, width 0.15s ease;
}

.admin_products_modal .ap_editor_splitter:hover::after,
.admin_products_modal .ap_editor_splitter.is-dragging::after,
.admin_products_inline_shell .ap_editor_splitter:hover::after,
.admin_products_inline_shell .ap_editor_splitter.is-dragging::after {
	background: var(--ap-primary, #8b5cf6);
	width: 2px;
}

.admin_products_modal .ap_editor_splitter:focus-visible,
.admin_products_inline_shell .ap_editor_splitter:focus-visible {
	outline: 2px solid var(--ap-primary, #8b5cf6);
	outline-offset: -1px;
}

body.ap-editor-split-drag {
	cursor: col-resize !important;
	user-select: none !important;
}

/* --- Drawer backdrop --- */
.admin_products_modal .ap_ai_drawer_backdrop,
.admin_products_inline_shell .ap_ai_drawer_backdrop {
	position: absolute;
	inset: 0;
	z-index: 20;
	background: rgb(15 23 42 / 0.38);
	cursor: pointer;
}

.admin_products_modal .ap_ai_drawer_backdrop[hidden],
.admin_products_inline_shell .ap_ai_drawer_backdrop[hidden] {
	display: none !important;
}

/* --- Focus AI --- */
.admin_products_modal .ap_editor_layout.is-focus-ai .ap_editor_form_col,
.admin_products_inline_shell .ap_editor_layout.is-focus-ai .ap_editor_form_col {
	flex: 0 0 0;
	width: 0;
	min-width: 0;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

.admin_products_modal .ap_editor_layout.is-focus-ai .ap_editor_splitter,
.admin_products_inline_shell .ap_editor_layout.is-focus-ai .ap_editor_splitter {
	display: none;
}

.admin_products_modal .ap_editor_layout.is-focus-ai .ap_ai_panel,
.admin_products_inline_shell .ap_editor_layout.is-focus-ai .ap_ai_panel {
	flex: 1 1 auto;
	width: auto;
	max-width: none;
}

/* --- Drawer overlay --- */
.admin_products_modal .ap_editor_layout.is-ai-drawer .ap_ai_panel,
.admin_products_inline_shell .ap_editor_layout.is-ai-drawer .ap_ai_panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--ap-ai-drawer-width);
	max-width: none;
	flex: none;
	z-index: 30;
	box-shadow: -12px 0 40px rgb(15 23 42 / 0.18);
}

/* --- External / docked out --- */
.admin_products_modal .ap_editor_layout.is-ai-external .ap_ai_chat_mount,
.admin_products_inline_shell .ap_editor_layout.is-ai-external .ap_ai_chat_mount {
	display: none;
}

.admin_products_modal .ap_ai_docked_out,
.admin_products_inline_shell .ap_ai_docked_out {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	padding: 1.5rem;
}

.admin_products_modal .ap_ai_docked_out[hidden],
.admin_products_inline_shell .ap_ai_docked_out[hidden] {
	display: none !important;
}

.admin_products_modal .ap_ai_docked_out_inner,
.admin_products_inline_shell .ap_ai_docked_out_inner {
	text-align: center;
	max-width: 240px;
}

.admin_products_modal .ap_ai_docked_out_text,
.admin_products_inline_shell .ap_ai_docked_out_text {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--ap-text-muted);
}

/* --- External modal --- */
.ap_ai_external_modal {
	width: min(1120px, calc(100vw - 32px));
	max-width: min(1120px, calc(100vw - 32px));
	max-height: min(90vh, 900px);
	height: min(85vh, 820px);
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: var(--ap-bg, #f8fafc);
}

.ap_ai_external_modal.dark {
	background: #111827;
}

.ap_ai_external_header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--ap-border, #e5e7eb);
	flex-shrink: 0;
}

.ap_ai_external_title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--ap-text, #111827);
}

.ap_ai_external_body {
	flex: 1 1 0%;
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.ap_ai_external_body .ap_ai_chat_mount {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.ap_ai_external_body .modal_ai_chat.ap_ai_chat_embed {
	flex: 1 1 0%;
	min-height: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	box-shadow: none;
	border-radius: 0;
	background: transparent;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.ap_ai_external_body .ap_ai_chat_embed .ai-chat-modal-surface,
.ap_ai_external_body .ap_ai_chat_embed .ai-chat-root,
.ap_ai_external_body .ap_ai_chat_embed .ai-chat-panel,
.ap_ai_external_body .ap_ai_chat_embed .chat-container {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	width: 100%;
}

/* --- Mobile tabs --- */
.admin_products_modal .ap_editor_mobile_tabs,
.admin_products_inline_shell .ap_editor_mobile_tabs {
	display: none;
}

.admin_products_modal .ap_ai_layout_btn--desktop-only,
.admin_products_inline_shell .ap_ai_layout_btn--desktop-only {
	display: inline-flex;
}

@media (max-width: 1023px) {
	.admin_products_modal .ap_editor_layout,
	.admin_products_inline_shell .ap_editor_layout {
		flex-direction: column;
	}

	.admin_products_modal .ap_editor_mobile_tabs,
	.admin_products_inline_shell .ap_editor_mobile_tabs {
		display: flex;
		flex-shrink: 0;
		gap: 6px;
		padding: 0 1rem 10px;
		order: -1;
	}

	.admin_products_modal .ap_editor_mobile_tab,
	.admin_products_inline_shell .ap_editor_mobile_tab {
		flex: 1 1 0;
		padding: 8px 12px;
		border: 1px solid var(--ap-border);
		border-radius: var(--ap-radius-sm, 8px);
		background: var(--ap-surface);
		color: var(--ap-text-muted);
		font-size: 13px;
		font-weight: 500;
		cursor: pointer;
		transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	}

	.admin_products_modal .ap_editor_mobile_tab.is-active,
	.admin_products_inline_shell .ap_editor_mobile_tab.is-active {
		background: rgb(139 92 246 / 0.12);
		border-color: var(--ap-primary, #8b5cf6);
		color: var(--ap-primary, #8b5cf6);
	}

	.admin_products_modal .ap_editor_splitter,
	.admin_products_inline_shell .ap_editor_splitter {
		display: none;
	}

	.admin_products_modal .ap_ai_layout_btn--desktop-only,
	.admin_products_inline_shell .ap_ai_layout_btn--desktop-only {
		display: none;
	}

	.admin_products_modal .ap_editor_layout.is-mobile-pane-form .ap_editor_form_col,
	.admin_products_inline_shell .ap_editor_layout.is-mobile-pane-form .ap_editor_form_col,
	.admin_products_modal .ap_editor_layout.is-mobile-pane-ai .ap_ai_panel,
	.admin_products_inline_shell .ap_editor_layout.is-mobile-pane-ai .ap_ai_panel {
		flex: 1 1 0%;
		min-height: 0;
	}

	.admin_products_modal .ap_editor_layout.is-mobile-pane-form .ap_ai_panel,
	.admin_products_inline_shell .ap_editor_layout.is-mobile-pane-form .ap_ai_panel {
		display: none;
	}

	.admin_products_modal .ap_editor_layout.is-mobile-pane-ai .ap_editor_form_col,
	.admin_products_inline_shell .ap_editor_layout.is-mobile-pane-ai .ap_editor_form_col {
		display: none;
	}

	.admin_products_modal .ap_editor_layout.is-mobile-pane-ai .ap_ai_panel,
	.admin_products_inline_shell .ap_editor_layout.is-mobile-pane-ai .ap_ai_panel {
		flex: 1 1 0%;
		width: 100%;
		max-width: none;
		max-height: none;
		border-left: none;
		border-top: none;
		min-height: 0;
	}

	.admin_products_modal .ap_editor_layout.is-ai-drawer .ap_ai_panel,
	.admin_products_inline_shell .ap_editor_layout.is-ai-drawer .ap_ai_panel {
		position: absolute;
		width: 100%;
		max-width: none;
	}

	.ap_ai_external_modal {
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}
}

@media (min-width: 1024px) and (pointer: coarse) {
	.admin_products_modal .ap_editor_splitter,
	.admin_products_inline_shell .ap_editor_splitter {
		display: none;
	}

	.admin_products_modal .ap_ai_panel,
	.admin_products_inline_shell .ap_ai_panel {
		border-left: 1px solid var(--ap-border);
	}
}

/* ---------------- Inline editor (full .crm-shell-content in LK) ---------------- */
.crm-shell-content.ap-product-editor-open {
	display: flex;
	flex-direction: column;
	flex: 1 1 0%;
	min-height: 0;
	overflow: hidden;
}

.crm-shell-content.ap-product-editor-open > .crm-shell-content__inner {
	flex: 1 1 0%;
	min-height: 0;
	max-width: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.crm-shell-content.ap-product-editor-open .tv-lk-modules,
.crm-shell-content.ap-product-editor-open .tv-lk-modules.lk,
.crm-shell-content.ap-product-editor-open .tv-lk-modules .lk-content,
.crm-shell-content.ap-product-editor-open .tv-lk-modules .lk-tab-content,
.crm-shell-content.ap-product-editor-open #v-pills-products {
	flex: 1 1 0%;
	min-height: 0 !important;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.crm-shell-content.ap-product-editor-open #v-pills-products > h5 {
	display: none;
}

.crm-shell-content.ap-product-editor-open #admin_products {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.admin_products_editor_mount {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.admin_products_editor_mount[hidden] {
	display: none !important;
}

.admin_products_inline_shell.admin_products_modal {
	width: 100%;
	max-width: none;
	max-height: none;
	height: 100%;
	flex: 1 1 0%;
	min-height: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.admin_products_inline_shell.admin_products_modal.dark {
	background: #111827;
	color: var(--ap-text);
}

.admin_products_inline_shell .admin_products_form_wrap,
.admin_products_inline_shell .add-products-page.admin_products_editor {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.admin_products_inline_shell .ap_editor_layout,
.admin_products_inline_shell .ap_editor_form_col,
.admin_products_inline_shell .ap_ai_panel {
	max-height: none;
}

.admin_products_inline_shell .ap_editor_layout {
	flex: 1 1 0%;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: row;
	align-items: stretch;
}

.admin_products_inline_shell .ap_editor_form_col {
	flex: 1 1 0%;
	min-width: 0;
	min-height: 0;
	height: 100%;
	max-height: none;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 1rem 0 0 0 !important;
}

@media (min-width: 640px) {
	.admin_products_inline_shell .ap_editor_form_col {
		padding: 1.5rem 0 0 0 !important;
	}
}

.admin_products_inline_shell .ap_editor_form_col.add-products-content {
	max-width: none;
}

.admin_products_inline_shell .ap_editor_form_col > .ap_editor_title,
.admin_products_inline_shell .ap_editor_form_col > .add-products-progress {
	flex-shrink: 0;
	min-width: 0;
}

.admin_products_inline_shell .ap_editor_form_col > .admin_products_form {
	flex: 1 1 0%;
	min-height: 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.admin_products_inline_shell .ap_editor_form_col .admin_products_form > [role="tablist"] {
	flex-shrink: 0;
}

.admin_products_inline_shell .ap_editor_form_col .ap_editor_body {
	flex: 1 1 0%;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* Inline: колонка без нижнего padding — тот же footer, что в модалке */
.admin_products_inline_shell .add-products-page .admin_products_form_actions.add-products-save-panel {
	margin-bottom: 0;
}

@media (min-width: 640px) {
	.admin_products_inline_shell .add-products-page .admin_products_form_actions.add-products-save-panel {
		margin-bottom: 0;
	}
}

.admin_products_inline_shell .ap_ai_panel {
	align-self: stretch;
	height: 100%;
	min-height: 0;
}

/* Category tree picker (в airModal — portal в body, см. script.js) */
.ap_category_tree_controls {
	display: flex;
	align-items: stretch;
	gap: 8px;
}

.ap_category_tree_controls .ap_category_tree_trigger {
	flex: 1 1 auto;
}

.ap_category_suggest_btn {
	flex: 0 0 auto;
	align-self: center;
	border: 1px solid var(--ap-border, #e2e8f0);
	background: var(--ap-surface, #fff);
	border-radius: 8px;
	padding: 0 12px;
	min-height: var(--ap-control-h, 40px);
	cursor: pointer;
	white-space: nowrap;
}

.ap_category_suggest_btn:hover:not(:disabled) {
	border-color: var(--ap-primary, #4f46e5);
	color: var(--ap-primary, #4f46e5);
}

.ap_category_suggest_btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

.ap_category_tree_modal {
	position: fixed;
	inset: 0;
	z-index: 1000050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	overscroll-behavior: contain;
}

.ap_category_tree_modal--portaled {
	z-index: 1000050;
}

.ap_category_tree_modal[hidden] {
	display: none !important;
}

.ap_category_tree_modal_backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
}

.ap_category_tree_modal_panel {
	position: relative;
	z-index: 1;
	width: min(560px, 96vw);
	max-height: min(70vh, 640px);
	display: flex;
	flex-direction: column;
	padding: 16px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.ap_category_tree_modal_head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.ap_category_tree_modal_close {
	border: 0;
	background: transparent;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.ap_category_tree_nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
	min-height: 28px;
}

.ap_category_tree_nav[hidden] {
	display: none !important;
}

.ap_category_tree_back {
	border: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
	color: var(--ap-primary, #4f46e5);
}

.ap_category_tree_crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
}

.ap_category_tree_crumb {
	border: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
	color: var(--ap-muted, #64748b);
}

.ap_category_tree_crumb:last-child {
	color: var(--ap-text, #0f172a);
	font-weight: 500;
}

.ap_category_tree_crumb_sep {
	opacity: 0.5;
}

.ap_category_tree_search {
	width: 100%;
	margin-bottom: 12px;
}

.ap_category_tree_list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow: auto;
	flex: 1 1 auto;
}

.ap_category_tree_option,
.ap_category_tree_drill {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	background: transparent;
	padding: 10px 8px;
	border-radius: 8px;
	cursor: pointer;
}

.ap_category_tree_drill {
	position: relative;
	padding-right: 28px;
}

.ap_category_tree_option:hover,
.ap_category_tree_drill:hover {
	background: color-mix(in srgb, var(--tv-action-primary, #6366f1) 10%, transparent);
}

.ap_category_tree_option_path {
	display: block;
	font-size: 12px;
	opacity: 0.75;
}

.ap_category_tree_drill_chevron {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 18px;
	opacity: 0.55;
}

.ap_category_tree_empty {
	padding: 16px 8px;
	opacity: 0.7;
}

.catalog-breadcrumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 8px;
}

.catalog-breadcrumbs__sep {
	opacity: 0.5;
}

.catalog-breadcrumbs__current {
	font-weight: 600;
}

.admin_catalog_order .aco_tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
}

.admin_catalog_order .aco_tab {
	border: 1px solid var(--tv-border, #e5e7eb);
	background: transparent;
	padding: 8px 14px;
	border-radius: 8px;
	cursor: pointer;
}

.admin_catalog_order .aco_tab.is-active {
	background: var(--tv-action-primary, #6366f1);
	color: #fff;
	border-color: transparent;
}

.admin_catalog_order .aco_panel { display: none; }
.admin_catalog_order .aco_panel.is-active { display: block; }

.admin_catalog_order .aco_row_actions {
	display: inline-flex;
	gap: 4px;
	margin-left: auto;
}

.admin_catalog_order .aco_btn {
	border: 1px solid var(--tv-border, #e5e7eb);
	background: #fff;
	border-radius: 6px;
	padding: 4px 8px;
	cursor: pointer;
	font-size: 12px;
}

.admin_catalog_order .aco_btn_primary {
	background: var(--tv-action-primary, #6366f1);
	color: #fff;
	border-color: transparent;
}

.admin_catalog_order .aco_btn_danger {
	color: #b91c1c;
}

.admin_catalog_order .aco_map_table {
	width: 100%;
	border-collapse: collapse;
}

.admin_catalog_order .aco_map_table th,
.admin_catalog_order .aco_map_table td {
	border-bottom: 1px solid var(--tv-border, #e5e7eb);
	padding: 8px;
	text-align: left;
	vertical-align: middle;
}

.admin_catalog_order .aco_map_select {
	min-width: 260px;
	margin-right: 8px;
}

.admin_catalog_order .aco_item_depth_3 .aco_row {
	padding-left: 24px;
}

.admin_catalog_order .aco_item_depth_2 .aco_row {
	padding-left: 12px;
}
