/*
 * НейроОфис: оформление клиента LibreChat v0.8.8. Подключается из index.html при сборке образа (docker/brand.mjs).
 * Разделы: карточка уточняющих вопросов; каталог агентов; пустой экран чата с агентом.
 *
 * Карточка уточняющих вопросов (ask_user_question).
 * Все правила привязаны к структуре компонента AskUserQuestions:
 *   корень   — div, у которого прямой потомок-контейнер содержит fieldset[tabindex="-1"][aria-labelledby]
 *              (такой fieldset в клиенте один — шаг пакета вопросов);
 *   панель   — .popover над полем ввода, внутри которой этот корень;
 *   итог     — свёрнутая карточка заданных вопросов в чате ([data-testid="ask-user-question-call"]).
 * Темы высокой контрастности (html.high-contrast) не затрагиваются.
 */

/* ------------------------------------------------------------------ токены */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]),
html:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]),
html:not(.high-contrast) .popover.\[view-transition-name\:ask-question\] {
  --nq-accent: #2f55ff;
  --nq-accent-hover: #2446e6;
  --nq-accent-ink: #2f55ff;
  --nq-accent-tint: rgba(47, 85, 255, 0.06);
  --nq-accent-tint-hover: rgba(47, 85, 255, 0.1);
  --nq-accent-line: rgba(47, 85, 255, 0.55);
  --nq-ring: rgba(47, 85, 255, 0.3);
  --nq-on-accent: #ffffff;
  --nq-surface: #ffffff;
  --nq-fg: #15171c;
  --nq-muted: #676c76;
  --nq-subtle: #8b909a;
  --nq-line: rgba(17, 24, 39, 0.1);
  --nq-line-strong: rgba(17, 24, 39, 0.2);
  --nq-hover: rgba(17, 24, 39, 0.035);
  --nq-disabled: rgba(17, 24, 39, 0.07);
  --nq-step: rgba(17, 24, 39, 0.14);
  --nq-step-done: rgba(47, 85, 255, 0.4);
  --nq-shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 12px 32px -12px rgba(17, 24, 39, 0.18);
}
html.dark:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]),
html.dark:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]),
html.dark:not(.high-contrast) .popover.\[view-transition-name\:ask-question\] {
  --nq-accent: #2f55ff;
  --nq-accent-hover: #4466ff;
  --nq-accent-ink: #8099ff;
  --nq-accent-tint: rgba(47, 85, 255, 0.11);
  --nq-accent-tint-hover: rgba(47, 85, 255, 0.16);
  --nq-accent-line: rgba(110, 137, 255, 0.75);
  --nq-ring: rgba(96, 126, 255, 0.38);
  --nq-surface: #1c1c1e;
  --nq-fg: #ececf1;
  --nq-muted: #a1a3ab;
  --nq-subtle: #7d8089;
  --nq-line: rgba(255, 255, 255, 0.09);
  --nq-line-strong: rgba(255, 255, 255, 0.18);
  --nq-hover: rgba(255, 255, 255, 0.05);
  --nq-disabled: rgba(255, 255, 255, 0.08);
  --nq-step: rgba(255, 255, 255, 0.16);
  --nq-step-done: rgba(128, 153, 255, 0.5);
  --nq-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
}

/* ------------------------------------------------------------------ поверхность */
/* Панель над полем ввода: заголовок «Уточняющие вопросы» + шаги пакета. */
html:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]) {
  background: var(--nq-surface);
  border: 1px solid var(--nq-line);
  border-radius: 16px;
  box-shadow: var(--nq-shadow);
  color: var(--nq-fg);
  overflow: hidden;
}
html:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]) > div:first-child {
  border-bottom: 0;
  padding: 14px 12px 0 20px;
  gap: 12px;
}
html:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]) > div:first-child > p {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--nq-fg);
}
html:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]) > div:first-child button,
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.justify-end > button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  color: var(--nq-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html:not(.high-contrast) .popover:has(> div > div > fieldset[tabindex="-1"][aria-labelledby]) > div:first-child button:hover,
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.justify-end > button:hover {
  background: var(--nq-hover);
  color: var(--nq-fg);
}

/* Карточка в чате (тот же компонент без панели). */
html:not(.high-contrast) div.rounded-lg:has(> div > fieldset[tabindex="-1"][aria-labelledby]) {
  background: var(--nq-surface);
  border: 1px solid var(--nq-line);
  border-radius: 16px;
  color: var(--nq-fg);
  overflow: hidden;
}
/* Строка «развернуть / закрыть» над карточкой в чате: кнопки в правом верхнем углу, без отдельной полосы. */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) {
  position: relative;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.justify-end:first-child {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border-bottom: 0;
  padding: 0;
  gap: 2px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.justify-end:first-child + div:has(> [role="group"]) {
  padding-top: 14px;
  padding-right: 48px;
}
/* без шагов (один вопрос) — освобождаем место под кнопки справа от заголовка */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.justify-end:first-child + div.overflow-y-auto > fieldset > :is(legend, p[id]) {
  padding-right: 40px;
}

/* ------------------------------------------------------------------ шаги */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div:has(> [role="group"]) {
  border-bottom: 1px solid var(--nq-line);
  padding: 4px 14px 12px 20px;
  min-height: 0;
}
html:not(.high-contrast) div.rounded-lg:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div:first-child:has(> [role="group"]) {
  padding-top: 14px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div:has(> [role="group"]) > p {
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--nq-muted);
  font-variant-numeric: tabular-nums;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] {
  gap: 2px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button {
  height: 20px;
  padding: 0 3px;
  border-radius: 6px;
  outline: none;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button:focus-visible {
  box-shadow: 0 0 0 2px var(--nq-ring);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button > span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--nq-step);
  transition: width 160ms ease, background-color 160ms ease;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button > span.bg-surface-submit {
  background: var(--nq-step-done);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button[aria-current="step"] > span {
  width: 18px;
  background: var(--nq-accent);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button:not([aria-current="step"]):not(:disabled):hover > span {
  background: var(--nq-line-strong);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > [role="group"] > button:not([aria-current="step"]):not(:disabled):hover > span.bg-surface-submit {
  background: var(--nq-accent-line);
}

/* ------------------------------------------------------------------ вопрос */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.overflow-y-auto {
  padding: 0 20px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset[tabindex="-1"] {
  padding: 18px 0 20px;
  min-height: 0;
}
/* legend по умолчанию ложится на верхнюю рамку fieldset и игнорирует его отступ — делаем обычным блоком */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  color: var(--nq-muted);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > legend + * {
  clear: both;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > p[id] {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--nq-fg);
  text-wrap: pretty;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > p:not([id]) {
  margin-top: 4px;
  font-size: 14px;
  line-height: 21px;
  color: var(--nq-muted);
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ варианты */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 16px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  max-width: none;
  min-height: 46px;
  height: auto;
  margin: 0;
  padding: 12px 16px 12px 14px;
  border: 1px solid var(--nq-line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--nq-fg);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  text-align: left;
  white-space: normal;
  opacity: 1;
  box-shadow: none;
  outline: none;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
/* индикатор выбора: круг (один ответ) или квадрат (несколько) */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button::before {
  content: "";
  flex: none;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1.5px solid var(--nq-line-strong);
  border-radius: 999px;
  background: transparent;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button[role="checkbox"]::before {
  border-radius: 5px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button > svg {
  display: none;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:hover:not(:disabled) {
  background: var(--nq-hover);
  border-color: var(--nq-subtle);
  color: var(--nq-fg);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:hover:not(:disabled)::before {
  border-color: var(--nq-subtle);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:focus-visible {
  border-color: var(--nq-accent);
  box-shadow: 0 0 0 3px var(--nq-ring);
}
/* выбранный вариант */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:is([aria-pressed="true"], [aria-checked="true"]),
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:is([aria-pressed="true"], [aria-checked="true"]):hover:not(:disabled) {
  background: var(--nq-accent-tint);
  border-color: var(--nq-accent-line);
  color: var(--nq-fg);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:is([aria-pressed="true"], [aria-checked="true"]):hover:not(:disabled) {
  background: var(--nq-accent-tint-hover);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button[aria-pressed="true"]::before {
  border: 5px solid var(--nq-accent);
  background: var(--nq-on-accent, #fff);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button[aria-checked="true"]::before {
  border-color: var(--nq-accent);
  background: var(--nq-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] > button:disabled {
  opacity: 0.55;
}

/* ------------------------------------------------------------------ свой ответ */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid var(--nq-line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--nq-fg);
  font-size: 14px;
  line-height: 20px;
  box-shadow: none;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] + textarea {
  border-style: dashed;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > textarea::placeholder {
  color: var(--nq-subtle);
  opacity: 1;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--nq-subtle);
  background: var(--nq-hover);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] + textarea:focus,
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > div[role="group"] + textarea:not(:placeholder-shown) {
  border-style: solid;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div > fieldset > textarea:focus {
  border-color: var(--nq-accent);
  box-shadow: 0 0 0 3px var(--nq-ring);
}

/* ------------------------------------------------------------------ сообщения */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.text-text-warning {
  padding: 0 20px 12px;
  font-size: 13px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > button {
  align-self: flex-start;
  margin: 0 20px 12px;
  padding: 0;
  font-size: 13px;
  color: var(--nq-accent-ink);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > button:hover {
  color: var(--nq-accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ кнопки */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child {
  border-top: 1px solid var(--nq-line);
  padding: 12px 16px 12px 8px;
  gap: 8px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child button {
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
  outline: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child button:focus-visible {
  box-shadow: 0 0 0 3px var(--nq-ring);
}
/* «Пропустить» — тихая текстовая кнопка */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > button {
  border: 0;
  background: transparent;
  color: var(--nq-muted);
  padding: 0 12px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > button:hover {
  background: var(--nq-hover);
  color: var(--nq-fg);
}
/* «Назад» — вторичная */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > div > button:not(:last-child) {
  border: 1px solid var(--nq-line-strong);
  background: transparent;
  color: var(--nq-fg);
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > div > button:not(:last-child):hover {
  background: var(--nq-hover);
  border-color: var(--nq-subtle);
}
/* на первом шаге «Назад» недоступна — не показываем */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > div > button:not(:last-child):disabled {
  display: none;
}
/* «Далее» / «Отправить» — основная */
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > div > button:last-child {
  border: 1px solid transparent;
  background: var(--nq-accent);
  color: #ffffff;
  min-width: 96px;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > div > button:last-child:hover {
  background: var(--nq-accent-hover);
  color: #ffffff;
}
html:not(.high-contrast) div:has(> div > fieldset[tabindex="-1"][aria-labelledby]) > div.border-t:last-child > div > button:last-child:disabled {
  background: var(--nq-disabled);
  color: var(--nq-subtle);
  opacity: 1;
}

/* ------------------------------------------------------------------ один вопрос над полем ввода */
/* Тот же язык: акцент для отмеченных вариантов и «Отправить», без зелёного. */
html:not(.high-contrast) .popover.\[view-transition-name\:ask-question\] button[role="checkbox"][aria-checked="true"] > span:first-child {
  background: var(--nq-accent);
  color: #ffffff;
}
html:not(.high-contrast) .popover.\[view-transition-name\:ask-question\] > div:last-child button.bg-surface-submit {
  background: var(--nq-accent);
  color: #ffffff;
}
html:not(.high-contrast) .popover.\[view-transition-name\:ask-question\] > div:last-child button.bg-surface-submit:hover {
  background: var(--nq-accent-hover);
}

/* ------------------------------------------------------------------ итог в чате */
/* «Ваш ответ» — спокойная плашка вместо полосы слева. */
html:not(.high-contrast) [data-testid="ask-user-question-call"] ~ div > .overflow-hidden > div :is(.min-w-0 > div.border-l-2) {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 0;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.04);
}
html.dark:not(.high-contrast) [data-testid="ask-user-question-call"] ~ div > .overflow-hidden > div :is(.min-w-0 > div.border-l-2) {
  background: rgba(255, 255, 255, 0.05);
}
/* подписи «Тип приказа» и «Ваш ответ:» — спокойным текстом, без мелкого полужирного */
html:not(.high-contrast) [data-testid="ask-user-question-call"] ~ div > .overflow-hidden > div > div > p.mb-1.text-xs,
html:not(.high-contrast) [data-testid="ask-user-question-call"] ~ div > .overflow-hidden > div :is(.min-w-0 > div.border-l-2) > p:first-child {
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
}

/* ================================================================== каталог агентов
 * Страница /agents (компонент AgentMarketplace). Область — main, внутри которого есть вкладки категорий
 * (button[role="tab"] с id category-tab-<value>); карточка агента — [role="gridcell"] > [role="button"]
 * (AgentCard: значок категории span, плитка иконки div, текст div). Раздел категории определяется по
 * панели [role="tabpanel"] с id category-panel-<value>; во вкладке «Все» — category-panel-all.
 */
html:not(.high-contrast) {
  --nc-accent: #2f55ff;
  --nc-accent-ink: #2f55ff;
  --nc-tint: #eef2ff;
  --nc-tint-hover: #e4eaff;
  --nc-accent-line: rgba(47, 85, 255, 0.55);
  --nc-ring: rgba(47, 85, 255, 0.3);
  --nc-surface: #ffffff;
  --nc-fg: #15171c;
  --nc-muted: #5f6470;
  --nc-subtle: #6b7079; /* 5,0:1 на белом */
  --nc-line: #e5e7eb;
  --nc-line-strong: #d1d5db;
  --nc-chip: rgba(17, 24, 39, 0.05);
  --nc-shadow-hover: 0 1px 2px rgba(17, 24, 39, 0.04), 0 12px 28px -14px rgba(17, 24, 39, 0.22);
}
html.dark:not(.high-contrast) {
  --nc-accent-ink: #8ea4ff;
  --nc-tint: rgba(47, 85, 255, 0.16);
  --nc-tint-hover: rgba(47, 85, 255, 0.22);
  --nc-accent-line: rgba(110, 137, 255, 0.75);
  --nc-ring: rgba(96, 126, 255, 0.4);
  --nc-surface: #262628;
  --nc-fg: #ececf1;
  --nc-muted: #a1a3ab;
  --nc-subtle: #9a9da6; /* 5,9:1 на #212121, 5,6:1 на карточке */
  --nc-line: rgba(255, 255, 255, 0.1);
  --nc-line-strong: rgba(255, 255, 255, 0.18);
  --nc-chip: rgba(255, 255, 255, 0.07);
  --nc-shadow-hover: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 32px -16px rgba(0, 0, 0, 0.7);
}

/* ------------------------------------------------------------------ шапка */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) div.text-center > h1 {
  margin-bottom: 10px;
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--nc-fg);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) div.text-center > h1 + p {
  max-width: 42rem;
  font-size: 16px;
  line-height: 24px;
  color: var(--nc-muted);
  text-wrap: balance;
}

/* ------------------------------------------------------------------ поиск */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) #agent-search {
  height: 48px;
  border: 1px solid var(--nc-line);
  border-radius: 12px;
  background: var(--nc-surface);
  color: var(--nc-fg);
  font-size: 16px;
  box-shadow: none;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) #agent-search:placeholder-shown {
  padding-right: 16px;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) #agent-search::placeholder {
  color: var(--nc-subtle);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) #agent-search:hover:not(:focus) {
  border-color: var(--nc-line-strong);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) #agent-search:focus {
  border-color: var(--nc-accent);
  box-shadow: 0 0 0 3px var(--nc-ring);
}

/* ------------------------------------------------------------------ вкладки категорий */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] {
  gap: 8px;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] > button[role="tab"] {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--nc-line);
  border-radius: 999px;
  background: var(--nc-surface);
  color: var(--nc-muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  transform: none;
  outline: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] > button[role="tab"]:hover {
  border-color: var(--nc-line-strong);
  background: var(--nc-surface);
  color: var(--nc-fg);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] > button[role="tab"][aria-selected="true"] {
  border-color: var(--nc-accent-line);
  background: var(--nc-tint);
  color: var(--nc-accent-ink);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] > button[role="tab"]:focus-visible {
  border-color: var(--nc-accent);
  box-shadow: 0 0 0 3px var(--nc-ring);
}
/* подчёркивание активной вкладки — выбор уже виден по заливке */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] > button[role="tab"] > div[aria-hidden="true"] {
  display: none;
}

/* ------------------------------------------------------------------ заголовок раздела */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) div.text-left > h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--nc-fg);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) div.text-left > h2 + p {
  margin-top: 6px;
  font-size: 15px;
  line-height: 22px;
  color: var(--nc-muted);
}

/* ------------------------------------------------------------------ сетка и карточки */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="grid"] {
  margin-left: 0;
  margin-right: 0;
  gap: 16px;
}
/* Плитка иконки слева на две строки; справа — название и описание, под ними значок категории. */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 0 16px;
  align-items: start;
  height: 100%;
  min-height: 112px;
  padding: 20px;
  border: 1px solid var(--nc-line);
  border-radius: 16px;
  background: var(--nc-surface);
  color: var(--nc-fg);
  box-shadow: none;
  outline: none;
  transition: border-color 120ms ease, box-shadow 160ms ease;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] {
  height: 100%;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"]:hover {
  border-color: var(--nc-accent-line);
  background: var(--nc-surface);
  box-shadow: var(--nc-shadow-hover);
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"]:focus-visible {
  border-color: var(--nc-accent);
  box-shadow: 0 0 0 3px var(--nc-ring);
}
/* плитка иконки: светлая подложка, синий глиф; своя иконка агента (avatar) занимает всю плитку */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:first-of-type {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:first-of-type > div {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--nc-tint);
  color: var(--nc-accent-ink);
  box-shadow: none;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:first-of-type > div > div {
  width: 48px;
  height: 48px;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:first-of-type svg {
  width: 24px;
  height: 24px;
  color: var(--nc-accent-ink);
  stroke-width: 1.75;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:first-of-type img {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: none;
}
/* заглушка загрузки (Skeleton после img, пока изображение не загрузилось) — тем же скруглением, что и плитка */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:first-of-type img + [aria-hidden="true"] {
  border-radius: 12px;
}
/* текст */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:last-child {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-start;
  min-height: 48px;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:last-child > label {
  padding-top: 1px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: var(--nc-fg);
  word-break: normal;
  overflow-wrap: anywhere;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:last-child > p {
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--nc-muted);
  -webkit-line-clamp: 3;
  line-clamp: 3;
  text-wrap: pretty;
}
/* «Контакты: …» — служебная подпись, сотруднику не нужна */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:last-child > div:has(> span.shrink-0 + span.truncate) {
  display: none;
}
/* значок категории: под описанием, в потоке — не перекрывает название; во вкладках «Все» и «Рекомендуемые»
   (там агенты разных категорий) и в поиске по ним; в разделе категории скрыт — дублирует заголовок */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > span:first-child {
  position: static;
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  margin-top: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--nc-chip);
  color: var(--nc-muted);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
}
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tabpanel"]:not(#category-panel-all):not(#category-panel-promoted) [role="gridcell"] > [role="button"] > span:first-child {
  display: none;
}
/* «Показаны все агенты» */
html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tabpanel"] > div.mt-8.text-center > p {
  color: var(--nc-subtle);
}

/* ------------------------------------------------------------------ телефон */
@media (max-width: 768px) {
  html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="tablist"] {
    padding-left: 0;
    padding-right: 0;
  }
  html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] {
    min-height: 0;
    padding: 16px;
    gap: 0 14px;
  }
  html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) [role="gridcell"] > [role="button"] > div:last-child > p {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  html:not(.high-contrast) main:has([role="tablist"] > [id^="category-tab-"]) div.text-left > h2 {
    font-size: 20px;
    line-height: 26px;
  }
}

/* ------------------------------------------------------------------ окно агента (AgentDetailContent) */
/* Окно: [role="dialog"], у которого плитка иконки div.mt-6 и затем блок названия div.mt-3 > h2. */
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) > div.mt-6:first-child > div {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--nc-tint);
  color: var(--nc-accent-ink);
  overflow: hidden;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) > div.mt-6:first-child img {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) > div.mt-6:first-child svg {
  width: 32px;
  height: 32px;
  color: var(--nc-accent-ink);
  stroke-width: 1.75;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) > div.mt-3 > h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) > div.mt-4.text-center {
  margin-top: 8px;
  font-size: 15px;
  line-height: 22px;
  color: var(--nc-muted);
  text-wrap: pretty;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) button.bg-surface-submit {
  border-radius: 10px;
  background: var(--nc-accent);
  color: #ffffff;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) button.bg-surface-submit:hover {
  background: #2446e6;
}
html:not(.high-contrast) [role="dialog"]:has(> div.mt-6.justify-center + div.mt-3.text-center > h2) button.bg-surface-submit:focus-visible {
  box-shadow: 0 0 0 3px var(--nc-ring);
  --tw-ring-shadow: 0 0 #0000;
}
/* «Контакты: …» в окне агента — так же, как на карточке */
html:not(.high-contrast) [role="dialog"] div.mt-3.text-center + div.justify-center:has(> span.shrink-0 + span.truncate) {
  display: none;
}

/* ================================================================== пустой экран чата с агентом
 * Компонент Landing: контейнер с иконкой div.relative.size-10, под ним название (SplitText) и описание;
 * примеры запросов (ConversationStarters) — первый блок внутри формы чата ([view-transition-name:chat-form]).
 * Оформление иконки и заголовка применяется, только если в контейнере иконки — svg.lucide-feather
 * (агент без аватара, ConvoIcon → AgentAvatar) или img.bg-token-surface-secondary (аватар агента; тот же класс
 * у аватара ассистента — ассистенты на стенде не используются). Общий помощник «НейроОфис» (modelSpec) и модели
 * показывают иконку провайдера или iconURL — их пустой экран не меняется. Примеры запросов — для всех.
 */
html:not(.high-contrast) div.transform-gpu:has(> div > div > div.relative.size-10 > div > :is(svg.lucide-feather, img.bg-token-surface-secondary)) > div > div:first-child {
  flex-direction: column;
  gap: 14px;
}
html:not(.high-contrast) div.relative.size-10:has(> div > :is(svg.lucide-feather, img.bg-token-surface-secondary)) {
  width: 56px;
  height: 56px;
  margin-bottom: 0;
}
html:not(.high-contrast) div.relative.size-10 > div.rounded-full:has(> :is(svg.lucide-feather, img.bg-token-surface-secondary)) {
  border-radius: 14px;
  background: var(--nc-tint);
  color: var(--nc-accent-ink);
  box-shadow: none;
  overflow: hidden;
}
html:not(.high-contrast) div.relative.size-10 > div.rounded-full:has(> :is(svg.lucide-feather, img.bg-token-surface-secondary))::after {
  display: none;
}
html:not(.high-contrast) div.relative.size-10 > div.rounded-full > svg.lucide-feather {
  width: 28px;
  height: 28px;
  color: var(--nc-accent-ink);
  stroke-width: 1.75;
}
html:not(.high-contrast) div.relative.size-10 > div.rounded-full > img.bg-token-surface-secondary {
  border-radius: 14px;
  background: transparent;
}
/* название и описание */
html:not(.high-contrast) div.transform-gpu:has(> div > div > div.relative.size-10 > div > :is(svg.lucide-feather, img.bg-token-surface-secondary)) > div > div:first-child > div:not(.relative) {
  padding: 0;
}
html:not(.high-contrast) div.transform-gpu:has(> div > div > div.relative.size-10 > div > :is(svg.lucide-feather, img.bg-token-surface-secondary)) p.split-parent {
  font-size: 28px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--nc-fg);
}
html:not(.high-contrast) div.transform-gpu:has(> div > div > div.relative.size-10 > div > :is(svg.lucide-feather, img.bg-token-surface-secondary)) > div > div.animate-fadeIn {
  max-width: 34rem;
  margin-top: 8px;
  font-size: 15px;
  line-height: 22px;
  color: var(--nc-muted);
  text-wrap: pretty;
}
/* «Контакты: …» под описанием */
html:not(.high-contrast) div.transform-gpu > div > div.animate-fadeIn:has(> span.shrink-0 + span.truncate) {
  display: none;
}

/* ------------------------------------------------------------------ примеры запросов */
html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child:has(> button) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 672px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
}
html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child > button {
  justify-content: flex-start;
  max-width: none;
  min-height: 56px;
  padding: 10px 16px;
  border: 1px solid var(--nc-line);
  border-radius: 12px;
  background: var(--nc-surface);
  color: var(--nc-fg);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  box-shadow: none;
  outline: none;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child > button > span {
  text-wrap: pretty;
}
html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child > button:hover {
  border-color: var(--nc-accent-line);
  background: var(--nc-tint);
  color: var(--nc-fg);
}
html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child > button:focus-visible {
  border-color: var(--nc-accent);
  box-shadow: 0 0 0 3px var(--nc-ring);
}
@media (max-width: 640px) {
  html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child:has(> button) {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 16px;
  }
  html:not(.high-contrast) .\[view-transition-name\:chat-form\] > div.flex-wrap.justify-center:first-child > button {
    min-height: 44px;
  }
}
