/*
 * MIXIT AI-аналитик: фирменный стиль MIXIT для LibreChat v0.8.8 (стенд lcstand), по навыку Алексея Орлова
 * (.claude/skills/mixit-presentation): olive #404823, cream #F8EFE1, фон #FCFAF3, карточки #FFFFFF,
 * текст #33391C / #646948, линии #C0C6AC, акценты #517A91 / #C96752 / #947C28, Gotham Pro.
 *
 * Подключается после mixit.css (inject/apply.sh) и только переопределяет цвета и вид: логика слоя в mixit.js.
 * Опора: CSS-переменные темы LibreChat (тройки «r g b»), шкала --gray-*, классы разметки v0.8.8 (список точек
 * привязки: PARITY-BUILD.md, раздел 6г). Тёмная тема выключена (mixit.js, style.part.js): весь стиль светлый,
 * как содержательные слайды MIXIT. В v0.8.9 цвета переносятся в interface.theme (PARITY-BUILD.md, 6г).
 */

/* ---------- 1. Палитра: шкала серого LibreChat становится оливковой, семантические цвета MIXIT ---------- */

html,
html.dark,
html.light {
	color-scheme: light;

	--mx-olive: 64 72 35;
	--mx-olive-dark: 50 57 27;
	--mx-cream: 248 239 225;
	--mx-paper: 252 250 243;
	--mx-blue: 81 122 145;
	--mx-terracotta: 201 103 82;
	--mx-mustard: 148 124 40;
	--mx-ink: 51 57 28;
	--mx-ink-2: 100 105 72;
	--mx-sage: 192 198 172;

	/* Шкала серого (на ней построены text-*, surface-*, border-* LibreChat): тёплые оливковые тона. */
	--gray-20: 246 244 236;
	--gray-50: 248 245 236;
	--gray-100: 242 238 226;
	--gray-200: 228 229 214;
	--gray-300: 192 198 172;
	--gray-400: 151 157 128;
	--gray-500: 100 105 72;
	--gray-600: 84 90 55;
	--gray-650: 74 81 44;
	--gray-700: 64 72 35;
	--gray-800: 51 57 28;
	--gray-850: 42 47 23;
	--gray-875: 36 40 19;
	--gray-900: 30 34 16;

	--text-primary: var(--mx-ink);
	--text-secondary: var(--mx-ink-2);
	--text-secondary-alt: var(--mx-ink-2);
	--text-tertiary: 128 133 104;
	--text-muted: 128 133 104;
	--text-on-status: var(--mx-paper);
	--text-warning: var(--mx-mustard);
	--text-destructive: 176 82 62;

	--presentation: var(--mx-paper);
	--surface-primary: var(--mx-paper);
	--surface-primary-alt: var(--mx-cream);
	--surface-primary-contrast: 242 233 216;
	--surface-secondary: 248 245 236;
	--surface-secondary-alt: 236 232 218;
	--surface-tertiary: 244 240 229;
	--surface-tertiary-alt: 255 255 255;
	--surface-dialog: 255 255 255;
	--surface-chat: 255 255 255;
	--surface-hover: 240 232 214;
	--surface-hover-alt: 228 229 214;
	--surface-active: 238 228 208;
	--surface-active-alt: 242 236 222;
	--surface-composer-hover: 242 236 222;
	--surface-code: 248 245 236;
	--surface-submit: var(--mx-olive);
	--surface-submit-hover: var(--mx-olive-dark);
	--surface-destructive: 176 82 62;
	--surface-destructive-hover: 150 66 48;
	--surface-inverted: var(--mx-olive);
	--surface-inverted-hover: var(--mx-olive-dark);
	--text-inverted: var(--mx-paper);
	--header-primary: var(--mx-paper);
	--header-hover: var(--mx-cream);
	--header-button-hover: var(--mx-cream);

	--border-light: 214 218 198;
	--border-medium: var(--mx-sage);
	--border-medium-alt: var(--mx-sage);
	--border-heavy: 160 167 136;
	--border-xheavy: 128 133 104;
	--border-destructive: var(--mx-terracotta);

	--accent-primary: var(--mx-olive);
	--accent-primary-hover: var(--mx-olive-dark);
	--ring-primary: var(--mx-olive);
	--link: var(--mx-blue);
	--link-hover: 58 92 112;
	--link-visited: 58 92 112;

	--status-success: 86 104 40;
	--status-success-subtle: 236 240 222;
	--status-success-border: 186 198 150;
	--status-success-strong: 86 104 40;
	--status-info: var(--mx-blue);
	--status-info-subtle: 232 239 243;
	--status-info-border: 170 193 206;
	--status-warning: var(--mx-mustard);
	--status-warning-subtle: 247 240 216;
	--status-warning-border: 214 196 132;
	--status-warning-strong: var(--mx-mustard);
	--status-error: 176 82 62;
	--status-error-subtle: 248 231 225;
	--status-error-border: 228 172 158;
	--status-error-strong: var(--mx-terracotta);
	--brand-purple: var(--mx-blue);

	/* Таблицы и метки ответа (переменные mixit.css). 🟢 = оливково-зелёный, 🟡 = охра, 🔴 = терракота. */
	--mx-ok-bg: #eaeedd;
	--mx-ok-line: #66792f;
	--mx-warn-bg: #f7efd6;
	--mx-warn-line: #947c28;
	--mx-bad-bg: #f8e4dd;
	--mx-bad-line: #c96752;
	--mx-head: #404823;
	--mx-zebra: #f4f1e6;
	--mx-row: #ffffff;
	--mx-line: #c0c6ac;
	--mx-row-line: #e4e5d8;
	--mx-muted: #646948;
}

body {
	background: #fcfaf3;
	color: #33391c;
}

/* ---------- 2. Боковая панель: кремовая, тонкая линия справа ---------- */

nav.bg-surface-primary-alt,
nav[class*='bg-surface-primary-alt'] {
	background: #f8efe1 !important;
}

aside:has(> div nav),
aside:has(nav) {
	border-right: 1px solid #c0c6ac;
}

/* Активный чат: белая карточка с оливковой полосой (полосу рисует LibreChat цветом текста). Переменная только внутри
   панели: под неё же окрашена штатная растушёвка конца длинного названия. */
nav {
	--surface-active-alt: 255 255 255;
}
[data-testid='convo-item'][class*='before:bg-text-primary'] {
	box-shadow: 0 0 0 1px rgba(64, 72, 35, 0.12);
}

.mx-admin-shortcut {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 4px 8px;
	border-radius: 8px;
	color: rgb(var(--text-primary));
	font-size: 13px;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
}
.mx-admin-shortcut:hover,
.mx-admin-shortcut:focus-visible {
	background: rgb(var(--surface-active-alt));
	color: rgb(var(--text-primary));
}
.mx-admin-shortcut:focus-visible {
	outline: 2px solid rgb(var(--ring-primary));
	outline-offset: -2px;
}
.mx-admin-shortcut svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}
.mx-admin-shortcut:has(+ [data-testid='nav-user'].w-9) {
	width: 36px;
	min-height: 40px;
	justify-content: center;
	flex-direction: column;
	gap: 2px;
	padding: 3px 0;
	font-size: 9px;
}
.mx-admin-shortcut:has(+ [data-testid='nav-user'].w-9) .mx-admin-brand {
	display: none;
}

/* ---------- 3. Шапка чата: эмблема MIXIT + малое название, как шапка слайдов ---------- */

div.absolute.top-0.z-20[class*='h-[52px]'] {
	border-bottom: 1px solid #c0c6ac !important;
	background: #fcfaf3 !important;
	padding-left: 14px;
	padding-right: 14px;
}

/* Wordmark MIXIT + вертикальная линия + «AI-аналитик» (13-14 pt в навыке, здесь 13 px на 52 px шапки). */
div.absolute.top-0.z-20[class*='h-[52px]']::before {
	content: 'AI-аналитик';
	order: 1;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	height: 22px;
	padding-left: 104px;
	margin-right: 10px;
	background:
		url(./img/mixit-word-olive.png) left center / 88px auto no-repeat,
		linear-gradient(#c0c6ac, #c0c6ac) 95px center / 1px 18px no-repeat;
	color: #646948;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.01em;
	white-space: nowrap;
}

div.absolute.top-0.z-20[class*='h-[52px]'] > div:first-child { order: 0; }
div.absolute.top-0.z-20[class*='h-[52px]'] > div:nth-child(2) { order: 2; }
div.absolute.top-0.z-20[class*='h-[52px]'] > div:nth-child(n + 3) { order: 3; }

/* Переключатель режима: без значка (он теперь в шапке), подпись «Обычный режим» / «Глубокий разбор». */
[data-testid='model-selector-button'] {
	background: #ffffff !important;
	border-color: #d6dac6 !important;
	font-weight: 500;
}
[data-testid='model-selector-button']:hover { background: #f8efe1 !important; }
/* 15.10: режимы по темам (mixit-summary, -stock, -ads, -plan) тем же видом, полоса слева цветом режима. */
[data-testid='model-selector-button']:has(img[alt^='mixit-']) > div:first-child {
	display: none;
}
[data-testid='model-selector-button']:has(img[alt^='mixit-']) > span {
	font-size: 0;
}
[data-testid='model-selector-button']:has(img[alt^='mixit-']) > span::before {
	font-size: 13px;
	color: #33391c;
}
[data-testid='model-selector-button']:has(img[alt='mixit-analyst']) > span::before { content: 'Обычный режим'; }
[data-testid='model-selector-button']:has(img[alt='mixit-deep']) > span::before { content: 'Глубокий разбор'; }
[data-testid='model-selector-button']:has(img[alt='mixit-summary']) > span::before { content: 'Сводка'; }
[data-testid='model-selector-button']:has(img[alt='mixit-stock']) > span::before { content: 'Остатки и поставки'; }
[data-testid='model-selector-button']:has(img[alt='mixit-ads']) > span::before { content: 'Реклама'; }
[data-testid='model-selector-button']:has(img[alt='mixit-plan']) > span::before { content: 'План и финансы'; }
[data-testid='model-selector-button']:has(img[alt='mixit-summary']) { box-shadow: inset 3px 0 0 #404823; }
[data-testid='model-selector-button']:has(img[alt='mixit-stock']) { box-shadow: inset 3px 0 0 #517a91; }
[data-testid='model-selector-button']:has(img[alt='mixit-ads']) { box-shadow: inset 3px 0 0 #c96752; }
[data-testid='model-selector-button']:has(img[alt='mixit-plan']) { box-shadow: inset 3px 0 0 #947c28; }
[data-testid='model-selector-button']:has(img[alt^='mixit-']) > span::after {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	margin: 0 0 3px 8px;
	border-right: 1.5px solid #646948;
	border-bottom: 1.5px solid #646948;
	transform: rotate(45deg);
}
[data-testid='model-selector-button']:has(img[alt='mixit-deep']) {
	border-color: #517a91 !important;
	box-shadow: inset 3px 0 0 #517a91;
}

/* Кнопки шапки: белые, тонкая рамка. */
div.absolute.top-0.z-20[class*='h-[52px]'] :is(button, a)[class*='border-border-light'] {
	background: #ffffff;
	border-color: #d6dac6;
}

@media (max-width: 767px) {
	div.absolute.top-0.z-20[class*='h-[52px]'] {
		padding-left: 8px;
		padding-right: 8px;
	}
	/* Телефон: только wordmark MIXIT, без малого названия (места нет). */
	div.absolute.top-0.z-20[class*='h-[52px]']::before {
		content: '';
		width: 64px;
		padding-left: 0;
		margin: 0 2px;
		background: url(./img/mixit-word-olive.png) left center / 64px auto no-repeat;
	}
}

/* ---------- 4. Поле ввода: белая карточка, тонкая линия, оливковый фокус ---------- */

form div.rounded-3xl.border.bg-surface-chat,
form div[class*='rounded-t-3xl'][class*='bg-surface-chat'] {
	background: #ffffff !important;
	border-color: #c0c6ac !important;
	box-shadow: 0 6px 24px -12px rgba(64, 72, 35, 0.25) !important;
}
form div[class*='bg-surface-chat']:focus-within {
	border-color: #8a9468 !important;
}
#prompt-textarea::placeholder { color: #8a8f6e; }
[data-testid='send-button']:disabled {
	background: #e4e5d8 !important;
	color: #ffffff !important;
	opacity: 1;
}

/* ---------- 5. Ответ: таблицы как «Сравнение» у Орлова: оливковая шапка, светлые чередующиеся строки ---------- */

.message-content .markdown-table-wrapper {
	border: 1px solid #c0c6ac;
	border-radius: 10px;
	background: #ffffff;
}

.message-content .markdown-table-wrapper th {
	background: #404823 !important;
	color: #f8efe1 !important;
	font-weight: 500;
	letter-spacing: 0.01em;
	border-bottom: 0 !important;
}

.message-content .markdown-table-wrapper td {
	border-bottom: 1px solid var(--mx-row-line) !important;
}

/* Сортировка и закреплённая колонка на оливковой шапке. */
.message-content table.mx-enh > thead th.mx-sort::after { opacity: 0.55; }
.message-content table.mx-enh > thead th.mx-sort:hover { background: #4d5630 !important; }
.message-content .markdown-table-wrapper th:first-child { box-shadow: inset -1px 0 0 rgba(248, 239, 225, 0.25); }

/* Строки 🟢🟡🔴: заливка целиком + полоска слева, цвета MIXIT (переменные в разделе 1). Итог жирный, без
   изменений. Поверх зебры, чтобы статус читался в любой строке. */
.message-content .markdown-table-wrapper tbody tr:is(.mx-st-ok, .mx-st-warn, .mx-st-bad) > td {
	border-bottom-color: rgba(64, 72, 35, 0.1) !important;
}

/* Строка поиска и отметок над таблицей. */
.message-content .mx-tbar .mx-tfilter { background: #ffffff; border-color: #c0c6ac; }
.message-content .mx-tbar .mx-chip { border-color: #c0c6ac; background: #ffffff; }

/* ---------- 6. Метки, кнопки, акценты ---------- */

/* «Готово за N с»: оливковая метка; «Нужно уточнение» охрой, «не завершён» терракотой (mixit.css). */
.message-content.markdown p:has(> a[href='#mx-status']) {
	background: #eef0e3;
	border: 1px solid rgba(64, 72, 35, 0.12);
}

/* Кнопки следующих вопросов: белые карточки, голубая стрелка (акцент #517A91). */
.message-content.markdown p:has(> a[href='#mx-followups']) {
	border-top-color: #c0c6ac;
}
.message-content.markdown p:has(> a[href='#mx-followups']) + ul > li {
	background: #ffffff;
	border-color: #c0c6ac;
	color: #33391c;
}
.message-content.markdown p:has(> a[href='#mx-followups']) + ul > li::after {
	color: #517a91;
	font-weight: 600;
}
.message-content.markdown p:has(> a[href='#mx-followups']) + ul > li:hover {
	background: #f8efe1;
	border-color: #404823;
}

/* Сноска «Источник: …» и «Как посчитано». */
.message-content.markdown p > em:only-child:has(> strong:first-child) { border-top-color: #c0c6ac; color: #646948; }
.message-content.markdown .mx-det-body { border-left-color: #c0c6ac; }

/* Заголовки в ответе оливковые, как заголовки слайдов. */
.message-content.markdown :is(h1, h2, h3, h4) { color: #404823; }

/* Карточка файла Excel/PPT/Word: белая, рамка #C0C6AC. */
.message-content.markdown a[href*='/files/'][href*='attachment=true'] {
	background: #ffffff;
	border-color: #c0c6ac;
}

/* Ход работы: оливковый заголовок, вторичный текст. */
.group\/thinking button.tool-status-text span.font-medium { color: #404823; }

/* ---------- 7. Графики: белая карточка, кремовая полоса подписи (цвета серий ставит lcstand-bff) ---------- */

/* Точка привязки v0.8.8: pre > div.rounded-lg.border > (полоса bg-surface-secondary с подписью) + (поле bg-surface-primary-alt). */
.message-content pre > div.rounded-lg.border:has(span.mx-chart-label) {
	background: #ffffff;
	border-color: #c0c6ac !important;
	border-radius: 10px;
}
.message-content pre > div.rounded-lg.border:has(span.mx-chart-label) > div.bg-surface-secondary {
	background: #f8efe1 !important;
	border-bottom-color: #c0c6ac !important;
}
.message-content pre > div.rounded-lg.border:has(span.mx-chart-label) > div.bg-surface-primary-alt {
	background: #ffffff !important;
}
.message-content pre span.mx-chart-label {
	color: #404823;
	font-weight: 600;
	letter-spacing: 0.02em;
}

/* Ошибка разбора Mermaid во время печати ответа: пока блок графика дописывается, Mermaid разбирает неполный текст и
   оставляет в body div#dmermaid-<id> с картинкой «Syntax error in text» (бомба). Она висит под приложением, вытягивает
   страницу и сдвигает шапку вверх. Готовый график рисуется заново и не страдает. Прячем только контейнер с ошибкой
   (.error-icon): в таком же временном div Mermaid меряет текст, без него графики разъедутся. */
body > div[id^='dmermaid']:has(.error-icon) {
	display: none !important;
}

/* ---------- 8. Стартовый экран: карточки вопросов с цветной верхней полосой, как «Колонки» Орлова ---------- */

button[data-mx-card] {
	border: 1px solid #d6dac6 !important;
	border-top: 3px solid #517a91 !important;
	box-shadow: 0 4px 14px -10px rgba(64, 72, 35, 0.35);
}
[data-mx-cards] > button[data-mx-card]:nth-of-type(4n + 2) { border-top-color: #c96752 !important; }
[data-mx-cards] > button[data-mx-card]:nth-of-type(4n + 3) { border-top-color: #947c28 !important; }
[data-mx-cards] > button[data-mx-card]:nth-of-type(4n + 4) { border-top-color: #404823 !important; }
button[data-mx-card]::before { color: #404823; }
button[data-mx-card]:hover { background: #fcfaf3 !important; border-color: #404823 !important; }
[data-mx-cards]::before { color: #646948; letter-spacing: 0.02em; }
/* Режимы по темам (15.10): все карточки режима с полосой его цвета (data-mx-mode ставит extras.part.js). */
[data-mx-cards][data-mx-mode='summary'] > button[data-mx-card] { border-top-color: #404823 !important; }
[data-mx-cards][data-mx-mode='stock'] > button[data-mx-card] { border-top-color: #517a91 !important; }
[data-mx-cards][data-mx-mode='ads'] > button[data-mx-card] { border-top-color: #c96752 !important; }
[data-mx-cards][data-mx-mode='plan'] > button[data-mx-card] { border-top-color: #947c28 !important; }

/* Название на стартовом экране оливковое. */
div.transform-gpu.flex-col.items-center.justify-center :is(h1, h2, div.text-2xl, div[class*='text-3xl']) { color: #404823; }

/* ---------- 9. Меню, окна, всплывающие подсказки ---------- */

[role='menu'],
[role='listbox'],
[role='dialog'] {
	border-color: #d6dac6;
}
[role='menuitem']:hover,
[role='option']:hover,
[role='menuitem'][data-highlighted],
[role='option'][data-highlighted] {
	background: #f8efe1;
}

/* Переключатели и флажки: оливковые. */
button[role='switch'][data-state='checked'],
button[role='switch'][aria-checked='true'] {
	background-color: #404823 !important;
}
input[type='checkbox'],
input[type='radio'] {
	accent-color: #404823;
}

/* Выделение текста светло-голубое. */
::selection { background: rgba(81, 122, 145, 0.22); }

/* Тёмная тема выключена (style.part.js ставит светлую): кнопки темы и контраста на странице входа и строка «Тема»
   в настройках скрыты (точка привязки v0.8.8: #theme-selector-label). */
button[aria-label='Сменить тему'],
button[aria-label='Высокий контраст'],
div.px-4.py-3:has(> div > #theme-selector-label) {
	display: none !important;
}
div.px-4.py-3:has(> div > #theme-selector-label) + div {
	border-top-width: 0;
}

/* ---------- 10. Страница входа как обложка MIXIT: оливковый фон, кремовый текст, крупный логотип ---------- */

div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
	grid-template-rows: auto 1fr auto auto 1fr auto;
	column-gap: 72px;
	padding: 0 54px;
	background: #404823 !important;
	color: #f8efe1;
	font-family: 'Gotham Pro', Inter, sans-serif;
}

/* Шапка: кремовый wordmark + малое название + тонкая линия (сетка навыка: логотип x54/y28, линия y82). */
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div:has(> img[src$='logo.svg']) {
	grid-column: 1 / -1;
	grid-row: 1;
	display: flex;
	align-items: center;
	gap: 20px;
	width: auto;
	height: auto;
	margin: 28px 0 0;
	padding-bottom: 18px;
	border-bottom: 1px solid rgba(248, 239, 225, 0.28);
	background: none;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div > img[src$='logo.svg'] {
	content: url(./img/mixit-word-cream.png);
	width: auto;
	height: 36px;
	object-fit: contain;
	object-position: left center;
	flex: 0 0 auto;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div:has(> img[src$='logo.svg'])::after {
	content: 'AI-аналитик · бета-версия';
	padding-left: 20px;
	border-left: 1px solid rgba(248, 239, 225, 0.35);
	font-size: 14px;
	line-height: 22px;
	color: rgba(248, 239, 225, 0.8);
	letter-spacing: 0.02em;
}

/* Крупный заголовок и подзаголовок обложки. */
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main)::before {
	content: 'AI-аналитик';
	grid-column: 1;
	grid-row: 3;
	align-self: end;
	font-size: 72px;
	line-height: 1.05;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: #f8efe1;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main)::after {
	content: 'Продажи, остатки, реклама и план по Wildberries, Ozon и Яндекс Маркету. Ответ с цифрами, источником и датой данных.';
	grid-column: 1;
	grid-row: 4;
	max-width: 34rem;
	margin-top: 22px;
	font-size: 20px;
	line-height: 1.45;
	color: rgba(248, 239, 225, 0.82);
}

/* Форма входа: белая карточка справа. */
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main {
	grid-column: 2;
	grid-row: 2 / 6;
	align-self: center;
	display: block;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main > div {
	width: 100%;
	max-width: none;
	padding: 36px 32px 32px;
	border-radius: 16px;
	background: #ffffff;
	box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.45);
	color: #33391c;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main h1 {
	margin-bottom: 4px;
	text-align: left;
	font-size: 26px;
	font-weight: 700;
	color: #404823;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main h1::after {
	content: 'Войдите корпоративной почтой';
	display: block;
	margin-top: 6px;
	font-size: 14px;
	font-weight: 400;
	color: #646948;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main :is(input, label) {
	background-color: #ffffff;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main input {
	border-color: #c0c6ac;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main input:focus {
	border-color: #404823;
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main a {
	color: #517a91;
}
/* Крупный логотип обложки: кремовый MIXIT CREATE YOURSELF над заголовком (пустой подвал страницы входа). */
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div[role='contentinfo'] {
	grid-column: 1;
	grid-row: 2;
	align-self: end;
	justify-content: flex-start;
	margin: 0 0 44px;
	color: rgba(248, 239, 225, 0.6);
}
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div[role='contentinfo']::before {
	content: '';
	display: block;
	width: 400px;
	height: 106px;
	background: url(./img/mixit-word-cream.png) left bottom / contain no-repeat;
}
/* Нижний блок с кнопками темы (скрыты): не занимает место. */
div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div.absolute {
	display: none;
}

@media (max-width: 860px) {
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto auto auto auto 1fr;
		padding-bottom: 28px;
		padding: 0 20px;
		column-gap: 0;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div:has(> img[src$='logo.svg']) {
		margin-top: 20px;
		gap: 14px;
		padding-bottom: 14px;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div > img[src$='logo.svg'] { height: 26px; }
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div:has(> img[src$='logo.svg'])::after {
		padding-left: 14px;
		font-size: 12px;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main)::before {
		grid-row: 3;
		margin-top: 22px;
		font-size: 40px;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main)::after {
		grid-row: 4;
		margin-top: 12px;
		font-size: 16px;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main {
		grid-column: 1;
		grid-row: 5;
		align-self: start;
		margin-top: 28px;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > main > div {
		padding: 28px 20px 24px;
	}
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div[role='contentinfo'] { grid-row: 2; margin: 36px 0 0; }
	div.min-h-screen:has(> div > img[src$='logo.svg']):has(> main) > div[role='contentinfo']::before { width: 220px; height: 58px; }
}

/* ---------- Телефон и широкие таблицы (10.10, трек PHONE, docs/pending/librechat-stand-20261008/PHONE.md) ---------- */

/* Широкая таблица: заголовки колонок переносятся по словам (как в Open WebUI), а не тянут колонку в одну строку.
   На компьютере таблица из 6 колонок (план/факт со «Статус») теперь помещается целиком, на телефоне видно 3-4
   колонки вместо 2. Числа и отметки 🟢🟡🔴 по-прежнему не переносятся. */
.message-content .markdown-table-wrapper th {
	white-space: normal !important;
	overflow-wrap: normal;
	hyphens: none;
}
.message-content .markdown-table-wrapper th[style*='right'] { text-align: right; }

/* Справа есть ещё колонки: край таблицы гаснет (data-mx-more ставит phone.part.js по прокрутке). */
.message-content .markdown-table-wrapper[data-mx-more] {
	-webkit-mask-image: linear-gradient(to left, transparent 0, #000 36px);
	mask-image: linear-gradient(to left, transparent 0, #000 36px);
}

/* «Как посчитано»: маркеры списка внутри линии слева, а не за ней. */
.message-content.markdown ul.mx-det-body,
.message-content.markdown .mx-det-body ul { padding-left: 1.5rem; }

@media (max-width: 640px) {
	/* Плотнее, как у Open WebUI: шрифт 13 px, узкие поля, первая колонка уже. */
	.message-content .markdown-table-wrapper > table { font-size: 13px; line-height: 1.35; }
	.message-content .markdown-table-wrapper th {
		font-size: 12px;
		padding: 0.5rem 0.55rem !important;
		min-width: 4.6rem;
	}
	.message-content .markdown-table-wrapper td { padding: 0.45rem 0.55rem !important; }
	.message-content .markdown-table-wrapper td:first-child {
		min-width: 5.5rem;
		max-width: 8.5rem;
	}
	/* Текстовые колонки (название товара) не шире 10 rem: остальное место числам. */
	/* Текстовые колонки (название товара) 7,5-10 rem: обычные слова («противоречат») целиком, очень длинные
	   («1000мл/Conditioner») переносятся. Так у топ-10 товаров видно «Артикул», «Товар» и «Заказы», как в Open WebUI. */
	.message-content .markdown-table-wrapper td:not(:first-child):not([style*='right']):not(.mx-mark) {
		min-width: 7.5rem;
		max-width: 10rem;
		overflow-wrap: anywhere;
	}
	.message-content .mx-tbar { margin-bottom: 0; }
}

/* Узкий телефон (360 px): «Обычный режим» помещается целиком (было «Обычный режи»). */
@media (max-width: 400px) {
	div.absolute.top-0.z-20[class*='h-[52px]'] { gap: 6px; padding-left: 6px; padding-right: 6px; }
	div.absolute.top-0.z-20[class*='h-[52px]']::before {
		width: 54px;
		margin: 0;
		background-size: 54px auto;
	}
	[data-testid='model-selector-button'] { padding-left: 9px !important; padding-right: 9px !important; gap: 4px; }
	[data-testid='model-selector-button']:has(img[alt^='mixit-']) > span::before { font-size: 12.5px; }
	[data-testid='model-selector-button']:has(img[alt^='mixit-']) > span::after { margin-left: 6px; }
	[data-testid='model-selector-button']:has(img[alt='mixit-stock']) > span::before { content: 'Остатки'; }
	[data-testid='model-selector-button']:has(img[alt='mixit-plan']) > span::before { content: 'План'; }
}

/* Телефон: стартовый экран помещается с полем ввода и на 360×780 (было: кнопка «Отправить» уходила за край).
   На невысоком экране (меньше 820 px видимой высоты, это и 390×844 с адресной строкой) карточки в две колонки. */
@media (max-width: 640px) and (max-height: 819px) {
	[data-mx-cards] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; }
	button[data-mx-card] { min-height: 64px; padding: 9px 11px !important; }
	button[data-mx-card]::before { font-size: 14px; }
	button[data-mx-card]::after { font-size: 12px; }
}

/* Телефон с открытой клавиатурой (видимая высота меньше 560 px): плашка «Бета» прячется, чтобы над полем ввода
   осталась лента. После закрытия клавиатуры плашка возвращается. */
@media (max-width: 767px) and (max-height: 560px) {
	#root > div:has(.mx-badge) { display: none !important; }
	/* LibreChat вычитает высоту плашки из высоты окна (style «calc(100dvh - 60px)» у соседнего блока):
	   без этой строки под полем ввода оставалась пустая полоса. */
	#root > div:has(.mx-badge) + div[style*='100dvh'] { height: 100dvh !important; }
}

/* Поле ввода на телефоне ниже на 10 px. */
@media (max-width: 640px) {
	#prompt-textarea { padding-top: 10px !important; padding-bottom: 6px !important; }
}

/* ---------- Страница входа: причина отказа (10.10, трек KEYCLOAK, KEYCLOAK.md раздел 11) ----------
   Строку #mx-auth-error ставит src/login.part.js при /login?error=auth_failed|auth_rate_limited|auth_banned.
   Пока она видна, штатное уведомление LibreChat на 3 с («Аутентификация не удалась…») скрыто: два разных текста путают. */
.mx-auth-error {
	margin: 16px 0 4px;
	padding: 12px 14px;
	border-left: 4px solid #c96752;
	border-radius: 8px;
	background: #f8efe1;
	color: #33391c;
	font-size: 14px;
	line-height: 1.45;
	text-align: left;
}
.mx-auth-error strong {
	color: #8f3f2e;
	font-weight: 700;
}
html.mx-auth-err li.toast-root {
	display: none !important;
}

/* ---------- Стартовый экран на невысоком окне (11.10) ----------
   В v0.8.8 блок приветствия на sm+ имеет max-height:0 и центрируется в родителе (justify-center). Наш текст и
   карточки делают его выше окна при высоте ~650 px и меньше (или при масштабе браузера 125-150%), и верх блока
   (логотип, «MIXIT AI-аналитик») уходил под шапку без прокрутки. Даём блоку обычную высоту, а центрирование
   делаем «безопасным»: если не помещается, блок прижимается к верху и страница прокручивается. */
@media (min-width: 640px) {
  div.transform-gpu.items-center.justify-center[class*="sm:max-h-0"] {
    max-height: none !important;
    height: auto !important;
    padding-bottom: 0 !important;
    margin-bottom: 16px !important;
  }
  div.scrollbar-gutter-spacer.flex-1.items-center {
    justify-content: safe center !important;
  }
}
