/* ======================================================================
   Орбита — кабинет владельца. Дизайн-система Giga Cowork → Orbita.
   Порт /home/resgos/gn-prototype-src/v2/case1/css/styles.css (+ case3 для
   status-card / tabs / modal / negotiations). Токены и ключевые компоненты
   скопированы дословно по docs/design-system.md.
   ====================================================================== */

/* ВНИМАНИЕ: SB Sans Text — проприетарный корпоративный шрифт Сбера
   (см. assets/fonts/README.txt). Файлы скопированы из прототипа только для
   внутренней разработки. ДО публичного релиза Орбиты шрифт необходимо
   заменить: положить другие woff2 в assets/fonts/, поправить @font-face
   ниже и стеки --font-text / --font-heading в :root. Остальная вёрстка
   от шрифта не зависит (system-font fallback уже в стеках). */
@font-face { font-family: "SB Sans Text"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/SBSansText-Regular.woff2") format("woff2"); }
@font-face { font-family: "SB Sans Text"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/SBSansText-Medium.woff2") format("woff2"); }
@font-face { font-family: "SB Sans Text"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/SBSansText-Semibold.woff2") format("woff2"); }

/* ---------- Дизайн-токены (дословно, design-system §1.1) ---------- */
:root {
  --bg-body: #fff;
  --bg-neutral-00: #fff;
  --bg-neutral-01: #fafafa;
  --bg-neutral-02: #f0f0f0;
  --bg-neutral-03: #e6e6e6;
  --bg-neutral-04: #ccc;
  --bg-inverted-01: #1f2020;
  --bg-inverted-02: #272828;
  --border-01: #e6e6e6;
  --sidebar-bg: #fafafa;
  --sidebar-border: rgba(23, 23, 23, 0.07);
  --text-03: rgba(0, 0, 0, 0.56); /* a11y: 0.5 давал 3.95:1 на белом (< WCAG AA 4.5:1); 0.56 → 4.95:1 на белом, ≥4.67 на neutral-01/02/03 */
  --text-04: rgba(0, 0, 0, 0.75);
  --text-05: rgba(0, 0, 0, 0.9);
  --sidebar-text: #000;
  --success-00: #f3fcf6;
  --success-02: #8fe6b0;
  --agent-border: #c3f0d4;
  --agent-shadow: rgba(31, 143, 69, 0.1);

  --radius-8: 8px;
  --radius-12: 12px;
  --radius-16: 16px;

  --font-text: "SB Sans Text", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fw-semibold: 600;
  --font-heading: "SB Sans Text", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Базовые сбросы и типографика (design-system §1.2) ---------- */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.3px;
  color: var(--text-05);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}

img { display: block; flex-shrink: 0; }

[aria-disabled="true"] { cursor: default; }
[hidden] { display: none !important; }

/* ---------- Каркас приложения ---------- */
.app {
  display: flex;
  flex: 1 1 auto;
  min-height: 600px;
  position: relative;
  background: var(--bg-body);
}

/* ---------- CH-04: постоянная плашка «Все данные тестовые…» ----------
   В потоке над .app: не перекрывает composer, тосты и модалки, видна на всех
   экранах (вход/онбординг/чат/сделки). Цвета — как у .code-banner (warning). */
.demo-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  color: var(--text-04);
  background: #fff2cc;
  border-bottom: 1px solid #ead9a0;
}

/* ---------- Icon button ---------- */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 8px;
  border-radius: var(--radius-8);
  transition: background-color 0.15s;
}
.icon-btn:hover { background: var(--bg-neutral-03); }
.icon-btn--active { background: var(--bg-inverted-02); }
.icon-btn--active:hover { background: var(--bg-inverted-02); }
.icon-btn--active img { filter: invert(1); }
.icon-btn[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.icon-btn[aria-disabled="true"]:hover { background: transparent; }
.icon-btn--pulse { animation: send-pulse 1.8s ease-out infinite; }
.icon-btn--pulse:hover { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .icon-btn--pulse { animation: none; box-shadow: 0 0 0 3px rgba(31, 143, 69, 0.35); } }

/* ---------- Navigation rail ---------- */
.rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 24px 8px 16px;
  background: var(--bg-neutral-02);
  border-right: 1px solid var(--border-01);
  z-index: 5;
}
.rail__top, .rail__bottom {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rail__bottom { align-items: center; }

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--bg-neutral-04);
  border: 1px solid #fff;
  color: var(--text-04);
  text-align: center;
  transition: background-color 0.15s;
}
.avatar:hover { background: #b8b8b8; }
.avatar[aria-disabled="true"]:hover { background: var(--bg-neutral-04); }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  width: 260px;
  padding: 0 12px;
  overflow: hidden;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 3;
}
.sidebar__logo {
  display: flex;
  align-items: center;
  height: 48px;
  margin-top: 16px;
  padding: 0 2px 0 6px;
  box-sizing: content-box;
  padding-bottom: 4px;
}
.sidebar__logo-mark { display: none; } /* показывается только в свёрнутом сайдбаре (<=760px) */

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 4px;
  border-radius: var(--radius-8);
  color: var(--sidebar-text);
  transition: background-color 0.15s;
}
.menu-item:hover { background: var(--bg-neutral-03); }
.menu-item--active { background: var(--bg-neutral-03); }
.menu-item img { margin: 0 4px; }
.menu-item--plain { padding-left: 4px; }
.menu-item--plain:hover { background: var(--bg-neutral-02); }
.group .menu-item--plain { padding-left: 6px; }
.menu-item__label {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 4px;
  line-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-item--active .menu-item__label,
.menu-item:not(.menu-item--plain) .menu-item__label { line-height: 32px; }

.chapter { display: flex; flex-direction: column; }

.space-menu {
  display: flex;
  gap: 8px;
  padding: 8px 0 0 6px;
  width: 212px;
}
.space-menu__line {
  width: 1px;
  margin: 0 0 0 2px;
  align-self: stretch;
  background: var(--bg-neutral-03);
}
.space-menu__items {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.group { display: flex; flex-direction: column; gap: 2px; }
.group__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 0 10px 0 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-03);
  border-radius: var(--radius-8);
}
.group__title:hover { background: var(--bg-neutral-02); }

/* ---------- Page / screens ---------- */
.page {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}
.screen.is-active { display: flex; }        /* совместимость с прототипом */
.screen.screen--active { display: flex; }   /* класс по контракту interfaces.md */

/* ---------- Chat input (нейтральная карточка; зелёное свечение — только у кнопки отправки, §5.1) ---------- */
.chat-input {
  width: 100%;
  max-width: 840px;
  overflow: hidden;
  background: var(--bg-neutral-01);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-16);
}
.chat-input__box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-16);
}
.chat-input__footer { height: 48px; }
.chat-input__files { display: flex; flex-wrap: wrap; gap: 8px; }

.attachment {
  display: flex;
  align-items: center;
  max-width: 360px;
  padding: 8px;
  background: var(--bg-neutral-02);
  border-radius: var(--radius-12);
}
.attachment__icon {
  display: flex;
  padding: 8px;
  background: var(--bg-neutral-00);
  border-radius: var(--radius-8);
}
.attachment__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 1px 8px;
  white-space: nowrap;
}
.attachment__name {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-05);
}
.attachment__size {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-03);
}
.attachment__remove {
  display: flex;
  padding: 2px;
  margin: 10px 4px 10px 2px;
  border-radius: 4px;
}
.attachment__remove:hover { background: var(--bg-neutral-03); }

.chat-input__text {
  margin: 0;
  padding: 4px 6px 12px;
  font-size: 16px;
  line-height: 24px;
  color: var(--text-05);
}

.chat-input__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-input__start {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agent-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  background: var(--success-00);
  border: 1px solid var(--success-02);
  border-radius: 9999px;
  transition: background-color 0.15s;
}
.agent-chip:hover { background: #e3f8eb; }
.agent-chip[aria-disabled="true"]:hover { background: var(--success-00); }

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 8px;
  background: var(--bg-inverted-01);
  border-radius: var(--radius-8);
  transition: background-color 0.15s;
}
.send-btn:hover { background: #3d3f3f; }
.send-btn[aria-disabled="true"] { opacity: 0.5; }
.send-btn[aria-disabled="true"]:hover { background: var(--bg-inverted-01); }

/* ---------- Зелёная пульсация (design-system §5.1, дословно) ---------- */
.send-btn--pulse, .btn--pulse { animation: send-pulse 1.8s ease-out infinite; }
.send-btn--pulse:hover, .btn--pulse:hover { animation-play-state: paused; }

@keyframes send-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(31, 143, 69, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(31, 143, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 143, 69, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .send-btn--pulse, .btn--pulse { animation: none; box-shadow: 0 0 0 3px rgba(31, 143, 69, 0.35); }
}

/* ---------- Help ---------- */
.help-btn {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 10px;
  background: var(--bg-inverted-01);
  border-radius: 9999px;
  z-index: 2;
  transition: background-color 0.15s;
}
.help-btn:hover { background: #3d3f3f; }
.help-btn[aria-disabled="true"]:hover { background: var(--bg-inverted-01); }

/* ---------- Пошаговое появление rv (design-system §4.1, дословно) ---------- */
.rv:not(.rv--on) { display: none !important; }
.rv--fade { animation: rv-in 0.28s ease-out both; }
@keyframes rv-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .rv--fade { animation: none; } }
/* Высота карточек при появлении анимируется в JS (OG.chat.reveal). */

/* ======================================================================
   Экран чата
   ====================================================================== */
.screen--chat {
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}

.chat { display: flex; flex: 1; min-width: 0; min-height: 0; }
.chat__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  z-index: 2;
}

/* Хлебные крошки */
.chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 24px 40px;
  background: var(--bg-neutral-00);
}
.breadcrumb { display: flex; align-items: center; gap: 4px; min-width: 0; }
.breadcrumb__root { color: var(--text-03); white-space: nowrap; }
.breadcrumb__current {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--text-05);
}
.breadcrumb__current span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Кнопка панели прогресса: видна только на узких экранах (<=1100px) */
.progress-toggle-btn { display: none; }

/* Лента сообщений: скроллится внутри, экран по высоте не растёт */
.chat__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 40px; }
.thread {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  padding-bottom: 16px;
}

/* ---------- Сообщения пользователя (design-system §3.1, дословно) ---------- */
.msg { display: flex; flex-direction: column; align-items: flex-end; padding-left: 56px; gap: 8px; }
.thread > * + * { margin-top: 32px; }
.thread > .msg + .msg { margin-top: 8px; }
.bubble {
  padding: 12px;
  background: var(--bg-neutral-02);
  border-radius: 12px 12px 4px 12px;
  color: var(--text-04);
}
.bubble p { margin: 0; }
.bubble--file { padding: 4px; }
.attachment--sent { background: transparent; }
.attachment--new { animation: rv-in 0.28s ease-out both; }
@media (prefers-reduced-motion: reduce) { .attachment--new { animation: none; } }
.attachment--bubble { border-radius: 12px 12px 0 12px; }
.msg--files { gap: 10px; }
/* Направленная подпись сообщения владельца: «Вы → агент {ник}» (ник, не email). */
.msg__direction { font-size: 12px; line-height: 16px; color: var(--text-03); }

/* ---------- Ответ агента (design-system §3.2, дословно) ---------- */
.agent { display: flex; flex-direction: column; }
.agent > * + * { margin-top: 16px; }
.agent__reason {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding-bottom: 12px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-03);
}
.agent__content { display: flex; flex-direction: column; }
.agent__title { margin: 0 0 14px; font-weight: var(--fw-semibold); color: var(--text-05); }
.agent__text { margin: 0; color: var(--text-05); }
.agent__title:empty, .agent__text:empty { display: none; }
.agent__content:has(.agent__text:empty):has(.agent__title:empty) { display: none; }
.agent > .agent__content { margin-top: 0; }
.agent__reason--done { border-bottom: 1px solid var(--border-01); transition: border-color 0.3s; }
/* Завершённый ответ: стрелка ожидания скрыта, заголовок остаётся приглушённым (--text-03) */
.agent__reason--done img { display: none; }
.agent__reason--done + .agent__content { margin-top: 16px; }
.agent__para { margin: 0; color: var(--text-05); }
.agent__para + .agent__para { margin-top: 14px; }
.agent__para--pre { white-space: pre-line; } /* многострочные абзацы (в прототипе — #agent4/#agent13) */
.agent__bold { font-weight: var(--fw-semibold); }
.agent__heading { font-size: 16px; line-height: 24px; }
.agent__accent { color: #385ee0; }
/* «Задаю вопрос» над информером (case3) */
.agent__ask {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding-bottom: 12px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-03);
}
/* Вложение внутри ответа агента (case3) */
.agent__attachment { display: flex; }
.agent__attachment:has(.attachment__name:empty) { display: none; }
.agent__attachment .attachment, .agent__attachment .attachment__content { min-width: 0; }
.agent__attachment .attachment__icon { flex-shrink: 0; }

/* Строка статуса «Веду переговоры»: индикатор, текст, разделитель снизу */
.agent > .agent__status { margin-top: 32px; }
.agent__status {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding-bottom: 12px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-03);
  border-bottom: 1px solid var(--border-01);
}
.agent__spinner { animation: spin 1s linear infinite; }
.agent__status--done .agent__spinner { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .agent__spinner { animation: none; } }
/* Расширение из case3: заголовок строки статуса и смена pending/done */
.agent__status-heading { display: flex; align-items: flex-start; gap: 4px; }
.agent__status-heading > img { flex-shrink: 0; margin-top: 2px; }
.agent__status-check, .agent__status-done-label { display: none; }
.agent__status--done :is(.agent__spinner, .agent__status-pending-label) { display: none; animation: none; }
.agent__status--done :is(.agent__status-check, .agent__status-done-label) { display: block; }

/* ---------- Виджет-карточка (design-system §3.3, дословно) ---------- */
.widget {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 840px;
  background: var(--bg-neutral-00);
  border-radius: 16px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.1));
}
.widget__header { padding: 16px 16px 8px 24px; }
.widget__title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }
.widget__subtitle { margin: 2px 0 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.widget > * { flex-shrink: 0; }
.widget > * + * { margin-top: 16px; }
.widget__blocks { display: flex; flex-direction: column; padding: 0 24px; }
.widget__blocks > * + * { margin-top: 8px; }
.widget__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 24px 16px 16px;
}
.widget__hint { margin-right: auto; font-size: 12px; line-height: 16px; color: var(--text-03); }
/* Завершённый виджет: кнопок нет, последняя секция получает нижний отступ */
.widget--done .widget__footer { display: none !important; }
.widget--done .wsections > .wsection:last-child .wsection__selection { padding-bottom: 24px; }
.widget--nofooter .wsections > .wsection:last-child .wsection__selection { padding-bottom: 24px; }
.widget--done .widget__blocks, .widget--nofooter .widget__blocks { padding-bottom: 24px; }
/* Шапка с бейджем (case3, settlement) */
.widget__header--badge { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.widget__titles { min-width: 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 12px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 8px;
  transition: background-color 0.15s;
}
.btn--secondary {
  background: var(--bg-neutral-00);
  border: 1px solid var(--bg-neutral-04);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.05);
  color: var(--text-05);
}
.btn--secondary:hover { background: var(--bg-neutral-02); }
.btn--primary { background: var(--bg-inverted-01); color: rgba(255, 255, 255, 0.95); }
.btn--primary:hover { background: #3d3f3f; }
.btn--soft { width: 100%; background: var(--bg-neutral-02); color: var(--text-05); }
.btn--soft:hover { background: var(--bg-neutral-03); }
.btn--soft[aria-disabled="true"]:hover { background: var(--bg-neutral-02); }

/* Заблокированные кнопки (design-system §5.2): не нажимаются, не пульсируют */
.btn[aria-disabled="true"], .mini-btn[aria-disabled="true"] { cursor: default; }
.btn[aria-disabled="true"] { opacity: 0.5; }
.btn--secondary[aria-disabled="true"]:hover { background: var(--bg-neutral-00); }
.btn--primary[aria-disabled="true"]:hover { background: var(--bg-inverted-01); }
.btn--pulse[aria-disabled="true"] { animation: none; box-shadow: none; }
.btn--pulse[data-gate] { animation: none; box-shadow: none; }

/* ---------- Блоки формы закупки (form-block / purchase-table / list-item) ---------- */
.form-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 13.148px 17.531px;
  background: var(--bg-neutral-00);
  border: 1.096px solid var(--border-01);
  border-radius: 8.765px;
  box-shadow: 0 0 2.191px rgba(0, 0, 0, 0.05);
}
.form-block__header { display: flex; align-items: flex-start; gap: 13.148px; }
.form-block__title, .form-group__title {
  flex: 1;
  margin: 0;
  font-size: 15.339px;
  line-height: 21.914px;
  font-weight: 500;
  letter-spacing: -0.3287px;
  color: var(--text-05);
}
.form-block__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26.3px;
  min-height: 26.3px;
  padding: 4.383px;
  border-radius: 4.383px;
}
.form-block__toggle:hover { background: var(--bg-neutral-02); }
.form-block__toggle img { width: 17.531px; height: 17.531px; }
.form-block__toggle[aria-expanded="false"] img { transform: scaleY(-1); }

.form-group { display: flex; flex-direction: column; }
.form-group + .form-group { margin-top: 24px; }
.form-block > * { flex-shrink: 0; }
.form-block > * + * { margin-top: 24px; }
.form-block__body { display: flex; flex-direction: column; }
.form-block:has(.form-block__toggle[aria-expanded="false"]) > .form-block__body { display: none; }

.purchase-table-wrap { min-width: 0; overflow-x: auto; }
.purchase-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 18px;
}
.purchase-table th, .purchase-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-01);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.purchase-table th { font-weight: 500; color: var(--text-03); background: var(--bg-neutral-01); }
.purchase-table th:nth-child(3), .purchase-table td:nth-child(3) { min-width: 160px; white-space: normal; }
.purchase-table th:nth-child(4), .purchase-table td:nth-child(4),
.purchase-table th:nth-child(5), .purchase-table td:nth-child(5) { text-align: right; font-variant-numeric: tabular-nums; }
.purchase-table tbody tr:last-child td { border-bottom: 0; }

.list-item {
  display: flex;
  gap: 32px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-01);
}
.list-item:last-child { border-bottom: 0; }
.list-item__label { flex-shrink: 0; width: 120px; color: var(--text-03); }
.list-item__value { flex: 1; min-width: 0; color: var(--text-05); }

/* ---------- Поле ввода внизу чата ---------- */
/* safe-area: на устройствах с home-индикатором composer не залезает под него
   (env() = 0 там, где inset нет — десктопная геометрия не меняется). */
.chat__input-wrap { flex-shrink: 0; padding: 16px 40px calc(32px + env(safe-area-inset-bottom, 0px)); }
.chat__input-wrap .chat-input { margin: 0 auto; }
.chat-input__field {
  display: block;
  width: 100%;
  max-height: 400px;
  padding: 4px 6px 12px;
  margin: 0;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: inherit;
  color: var(--text-05);
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  overflow-y: auto;
}
.chat-input__field::placeholder { color: var(--text-03); opacity: 1; }
.chat-input__field:disabled { cursor: default; color: var(--text-04); }

/* ---------- Правая панель (details / card / progress) ---------- */
.details {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 12px;
  width: 360px;
  padding: 24px 16px 24px 0;
  overflow-y: auto;
  background: var(--bg-neutral-00);
  z-index: 1;
}
.card {
  flex-shrink: 0;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: 16px;
}
.card--compact { padding-bottom: 8px; }
.card__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 500;
  color: var(--text-04);
}
.card__actions { display: flex; align-items: center; gap: 4px; }
.badge {
  min-width: 20px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  text-align: center;
  background: var(--bg-neutral-03);
  border-radius: 99px;
  color: var(--text-04);
}
.mini-btn { display: flex; padding: 2px; border-radius: 4px; transition: background-color 0.15s; }
.mini-btn:hover { background: var(--bg-neutral-03); }
.mini-btn[aria-disabled="true"]:hover { background: transparent; }

.progress { display: flex; flex-direction: column; }
.progress__step { display: flex; gap: 8px; padding: 8px 16px; }
.progress__step:last-child { padding-bottom: 16px; }
.progress__num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 24px;
  min-height: 24px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-03);
  background: var(--bg-neutral-02);
  border-radius: 50px;
}
.progress__label { flex: 1; padding-top: 2px; color: var(--text-03); }
.progress__step--active .progress__num { background: #ebf1ff; color: #385ee0; }
.progress__step--active .progress__label { color: var(--text-05); }
.progress__num, .progress__label, .badge { transition: background-color 0.3s, color 0.3s; }
.progress__check { display: none; }
.progress__step--done .progress__num { background: #e2f8eb; }
.progress__step--done .progress__digit { display: none; }
.progress__step--done .progress__check { display: block; }
.progress__step--done .progress__label { color: var(--text-05); }

/* ---------- Информер (design-system §3.4) ---------- */
.informer {
  width: 100%;
  max-width: 840px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-12);
}
.informer__body { display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.informer__text { flex: 1; min-width: 0; }
.informer__title { margin: 0; font-size: 16px; line-height: 24px; color: var(--text-05); }
.informer__subtitle { margin: 4px 0 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.informer__buttons { display: flex; gap: 8px; flex-shrink: 0; }
.informer--connect .informer__body { flex-wrap: wrap; }
.informer--connect .informer__text { min-width: min(160px, 100%); }
.informer__content { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; }
.informer__icon { flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
/* Завершённый информер (design-system §3.4, прототип informer3): check-circle слева от текста */
.informer--done .informer__content { display: flex; }
.informer--done .informer__icon { display: block; }

/* ======================================================================
   Секции и поля виджетов (design-system §7.2–7.5)
   ====================================================================== */
.wsections { display: flex; flex-direction: column; }
.wsections > * + * { margin-top: 8px; }
.wsection__selection { --field-column-gap: 8px; padding: 16px 24px; }
.wsection__selection > * + * { margin-top: 24px; }
.wsection__selection--tight > * + * { margin-top: 8px; }
.wsection__row { display: flex; gap: var(--field-column-gap); }
.wsection__row .field { flex: 1; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field--narrow { width: calc((100% - var(--field-column-gap)) / 2); }
[data-key="limitMonth"] { width: calc((100% - var(--field-column-gap)) / 2); }
.field__label { display: flex; gap: 2px; min-height: 20px; font-weight: 500; color: var(--text-05); }
.field__req { color: #dc2626; }
.field__hint { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-03); }

.input {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 36px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-8);
  box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s, opacity 0.15s;
}
.input:hover { border-color: var(--bg-neutral-04); }
.input:focus-within { border-color: var(--bg-neutral-04); }
.input--open { border-color: var(--bg-neutral-04); }

.input__select {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 40px 0 12px;
  font: inherit;
  letter-spacing: inherit;
  color: var(--text-05);
  background: transparent;
  border: 0;
  outline: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.input__chevron { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.input__select:disabled { cursor: default; color: var(--text-05); }

.input__text {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  font: inherit;
  letter-spacing: inherit;
  color: var(--text-05);
  background: transparent;
  border: 0;
  outline: 0;
}
.input__text:disabled { color: var(--text-05); cursor: default; }
.input__suffix { padding-right: 12px; color: var(--text-03); white-space: nowrap; }

.input__btn {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 40px 0 12px;
  text-align: left;
  color: var(--text-05);
}
.input__value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input__value--placeholder { color: var(--text-03); }

/* Заблокированные поля: hover не меняет рамку */
.input:has(:disabled):hover { border-color: var(--border-01); }
.input:has(.input__select:disabled):hover { border-color: var(--border-01); }
.input:has(.input__btn[aria-disabled="true"]):hover { border-color: var(--border-01); }

/* Пульсация поля (следующий шаг пользователя) */
.input--pulse { animation: send-pulse 1.8s ease-out infinite; }
.input--pulse:hover, .input--open.input--pulse { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .input--pulse { animation: none; box-shadow: 0 0 0 3px rgba(31, 143, 69, 0.35); } }

/* Поле, значение которого автоматически исправлено валидацией */
.input--bumped { animation: input-bump 1.1s ease-out; }
@keyframes input-bump {
  0%   { box-shadow: 0 0 0 3px rgba(31, 143, 69, 0.45); border-color: #8fe6b0; }
  100% { box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.05); }
}
@media (prefers-reduced-motion: reduce) { .input--bumped { animation: none; border-color: #8fe6b0; } }

/* Поле, к которому прокрутили по клику на неактивную кнопку */
.input--attention { animation: input-attention 1.3s ease-out; }
@keyframes input-attention {
  0%   { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25); }
  100% { border-color: var(--border-01); box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.05); }
}
@media (prefers-reduced-motion: reduce) { .input--attention { animation: none; border-color: #dc2626; } }

/* ---------- Date picker (выносится в <body>, position: fixed) ---------- */
.datepicker {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-neutral-00);
  border-radius: var(--radius-8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 0 2px rgba(0, 0, 0, 0.1);
}
.datepicker__header { display: flex; align-items: center; justify-content: space-between; }
.datepicker__title { font-weight: 500; color: var(--text-05); white-space: nowrap; }
.datepicker__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 8px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--bg-neutral-04);
  border-radius: var(--radius-8);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.05);
  transition: background-color 0.15s;
}
.datepicker__nav:hover:not(:disabled) { background: var(--bg-neutral-02); }
.datepicker__nav:disabled { opacity: 0.5; cursor: default; }

.datepicker__grid { display: flex; flex-direction: column; gap: 1px; }
.datepicker__weekdays { display: flex; }
.datepicker__weekday {
  flex: 1;
  height: 32px;
  font-size: 12px;
  line-height: 32px;
  text-align: center;
  color: var(--text-03);
}
.datepicker__row { display: flex; gap: 1px; }
.datepicker__day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 8px;
  color: var(--text-05);
  background: var(--bg-neutral-00);
  border-radius: 4px;
  transition: background-color 0.15s;
}
.datepicker__day:hover:not(:disabled) { background: var(--bg-neutral-02); }
.datepicker__day--selected { background: var(--bg-neutral-02); }
.datepicker__day--outside { opacity: 0.5; }
.datepicker__day:disabled { opacity: 0.3; cursor: default; }
.datepicker__day--selected:disabled { background: var(--bg-neutral-00); }

/* ---------- Выпадающее меню (выносится в <body>, position: fixed) ---------- */
.menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 0 2px rgba(0, 0, 0, 0.1);
}
.menu__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 5.5px 8px;
  border-radius: 6px;
  text-align: left;
  transition: background-color 0.15s;
}
.menu__item:hover { background: var(--bg-neutral-02); }
.menu__title { color: var(--text-05); }
.menu__subtitle { color: var(--text-03); }
.menu--viewer { min-width: 220px; }
.menu__item[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.menu__item[aria-disabled="true"]:hover { background: transparent; }

/* ---------- Сообщение-сводка (summary) ---------- */
.bubble--summary { width: 100%; max-width: 420px; padding: 14px 16px; }
.summary { display: flex; flex-direction: column; gap: 16px; }
.summary__title { margin: 0 0 2px; font-weight: var(--fw-semibold); color: var(--text-05); }
.summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.summary__row:last-child { border-bottom: 0; }
.summary__label { color: var(--text-03); }
.summary__value { font-weight: 500; color: var(--text-05); text-align: right; white-space: nowrap; }
.summary__title--icon { display: flex; align-items: center; gap: 8px; }
.summary__check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: #e2f8eb;
  border-radius: 50%;
}

/* ---------- Карточка документа ---------- */
.doc-card {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 840px;
  padding: 12px 16px 12px 18px;
  border: 1px solid var(--border-01);
  border-radius: var(--radius-12);
}
.doc-card__icon { margin-right: 4px; }
.doc-card__text { flex: 1; min-width: 0; }
.doc-card__title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-05); }
.doc-card__meta { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.doc-card__actions { display: flex; gap: 8px; padding-left: 2px; }

/* ---------- Показатели (stats) ---------- */
.stats { display: flex; gap: 12px; width: 100%; }
.stat { flex: 1; min-width: 0; padding: 16px; border: 1px solid var(--border-01); border-radius: var(--radius-12); }
.stat__value {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 18px;
  line-height: 28px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.3px;
  color: var(--text-04);
}
.stat__label { margin: 4px 0 0; color: var(--text-03); }

/* ---------- Карточки предложений (offer) ---------- */
.offer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  padding: 16px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-12);
}
.offer__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.offer__name {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--text-04);
}
.badge-pill {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-04);
  background: #eee8fb;
  border-radius: 9999px;
  white-space: nowrap;
}
.badge-pill--success { background: #e2f8eb; }
.offer__head + .offer__meta { margin-top: -12px; }
.offer__meta { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--text-04); }
.offer__meta .offer__dot { margin: 0 2px; }
.offer__dot { font-size: 12px; line-height: 16px; color: var(--text-03); }
.offer__price { display: flex; align-items: baseline; gap: 12px; margin: 0; }
.offer__sum {
  font-family: var(--font-heading);
  font-size: 24px;
  line-height: 28px;
  font-weight: var(--fw-semibold);
  letter-spacing: -1px;
  color: var(--text-04);
  white-space: nowrap;
}
.offer__discount { font-weight: 500; color: #2db85a; white-space: nowrap; }
.offer__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -8px; }
.offer__fact-label { color: var(--text-03); }
.offer__fact-value { color: var(--text-05); }

/* ---------- Список реквизитов (facts) ---------- */
.facts { display: flex; flex-direction: column; width: 100%; }
.facts__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 7px;
  border-bottom: 1px solid var(--bg-neutral-03);
}
.facts__row:last-child { border-bottom: 0; }
.facts__label { color: var(--text-03); white-space: nowrap; }
.facts__value { color: var(--text-04); text-align: right; }

/* ======================================================================
   Боковая панель просмотра документа (design-system §7.6)
   ====================================================================== */
/* Панель «Прогресс» плавно уступает место панели просмотра (360 → 0, 0 → 552) */
.details { transition: width 0.35s ease, padding 0.35s ease, opacity 0.25s ease; }
.is-viewer .details { width: 0; padding-left: 0; padding-right: 0; opacity: 0; overflow: hidden; }

.viewer {
  flex-shrink: 0;
  width: 0;
  overflow: hidden;
  background: var(--bg-neutral-01);
  border-left: 0 solid var(--border-01);
  transition: width 0.35s ease;
  z-index: 1;
}
.is-viewer .viewer { width: 552px; border-left-width: 1px; }
.viewer__inner { display: flex; flex-direction: column; width: 552px; height: 100%; }
.viewer__header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 56px;
  padding: 8px 12px 8px 32px;
  background: var(--bg-neutral-02);
  border-bottom: 1px solid var(--border-01);
}
.viewer__title { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-05); }
.viewer__actions { display: flex; align-items: center; gap: 8px; }
.viewer__canvas { flex: 1; min-height: 0; padding: 8px 24px 0; overflow-y: auto; }
.viewer__sheet {
  min-height: 100%;
  padding: 24px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.05);
}
.viewer__frame { display: block; width: 100%; height: calc(100vh - 140px); border: 0; }
.viewer__image { display: block; width: 100%; height: auto; }
.viewer__missing { margin: 0; padding: 16px; color: var(--text-03); text-align: center; }

/* Полноэкранный режим: flex-grow чата 1 → 0, панели 0 → 1 */
.chat__main { transition: flex-grow 0.35s ease, opacity 0.25s ease; }
.viewer { width: auto; flex: 0 0 0; transition: flex-basis 0.35s ease, flex-grow 0.35s ease; }
.is-viewer .viewer { width: auto; flex-basis: 552px; }
.is-viewer-full .viewer { flex-grow: 1; }
.is-viewer-full .chat__main { flex-grow: 0; flex-basis: 0; opacity: 0; overflow: hidden; pointer-events: none; }
.viewer__inner { width: 100%; min-width: 552px; }
.is-viewer-full .viewer__sheet { max-width: 960px; margin: 0 auto; }
.is-viewer-full .viewer__canvas { padding-top: 16px; }
.viewer__actions .icon-btn[aria-pressed="true"] { background: var(--bg-neutral-03); }

/* ======================================================================
   Карточка статуса (case3, design-system §3.5)
   ====================================================================== */
.status-card {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  width: 100%;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--bg-neutral-03);
  border-radius: var(--radius-8);
}
.status-card__body { flex: 1; min-width: 0; }
.status-card__head { display: flex; align-items: center; gap: 4px; }
.status-card__title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; color: var(--text-05); }
.status-card__text { margin: 2px 0 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.status-card.is-collapsed .status-card__text { display: none; }
.status-card__toggle { flex-shrink: 0; align-self: center; }
.status-card.is-collapsed .status-card__toggle img { transform: scaleY(-1); }

/* ======================================================================
   Дерево переговоров (case3, design-system §3.5).
   Длительности задаются переменными; значения по умолчанию — здесь,
   JS может переопределить их на узле.
   ====================================================================== */
.agent > .negotiations { margin-top: 32px; }
.negotiations {
  --negotiation-reveal-ms: 750ms;
  --negotiation-badge-shimmer-ms: 1600ms;
  min-width: 0;
  padding-bottom: 12px;
  font-size: 12px;
  line-height: 16px;
  overflow-wrap: anywhere;
}
.negotiations.rv--fade, .negotiations .rv--fade { animation-duration: var(--negotiation-reveal-ms); }
.negotiations__title {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-01);
  color: var(--text-03);
  font: inherit;
  font-weight: 500;
}
.negotiations__groups { display: grid; gap: 12px; }
.negotiations__summary { display: flex; align-items: center; gap: 4px; list-style: none; }
summary.negotiations__summary { cursor: pointer; }
summary.negotiations__summary::-webkit-details-marker { display: none; }
summary.negotiations__summary::after {
  content: '';
  flex: 0 0 12px;
  height: 12px;
  background: url('../assets/icons/chevron-down-12.svg') center no-repeat;
  opacity: 0.5;
}
.negotiations__group > .negotiations__summary { color: var(--text-03); font-weight: 500; }
.negotiations__group > summary::after { margin-left: 2px; }
.negotiations__suppliers { display: grid; gap: 4px; margin: 10px 0 0 39px; padding-bottom: 5px; }
.negotiations__supplier { --branch-offset: 2px; position: relative; border: 1px solid var(--border-01); border-radius: var(--radius-12); }
details.negotiations__supplier { cursor: pointer; }
.negotiations__supplier[open] { --branch-offset: 8px; }
.negotiations__supplier::before, .negotiations__supplier::after {
  content: '';
  position: absolute;
  left: -33px;
  border-left: 1px solid var(--border-01);
  pointer-events: none;
}
.negotiations__supplier::before { top: -5px; bottom: -1px; }
.negotiations__supplier:first-child::before { top: -10px; }
.negotiations__supplier:not(:has(~ .negotiations__supplier.rv--on))::before { bottom: calc(50% + 19px - var(--branch-offset)); }
.negotiations__supplier::after {
  top: calc(50% - 20px + var(--branch-offset));
  width: 33px;
  height: 20px;
  border-bottom: 1px solid var(--border-01);
  border-bottom-left-radius: 20px;
}
.negotiations__supplier > .negotiations__summary { justify-content: space-between; padding: 11px 14px 11px 12px; }
.negotiations__supplier[open] > .negotiations__summary { padding-top: 12px; padding-bottom: 7px; }
.negotiations__supplier-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.negotiations__company { font-size: 14px; line-height: 20px; font-weight: 500; }
.negotiations .status-badge { white-space: normal; }
.negotiations .status-badge:not(.status-badge--info, .status-badge--success, .status-badge--warning) { background: var(--bg-neutral-02); }
.negotiations .status-badge--warning { background: #fff2cc; }
.negotiations .status-badge.agent__status-pending-label { color: var(--text-05); }
.negotiations .status-badge--info.agent__status-pending-label { background-color: #d6e5ff; }
@media (prefers-reduced-motion: no-preference) {
  .negotiations__supplier:not(.agent__status--done) .status-badge.agent__status-pending-label {
    position: relative;
    overflow: hidden;
  }
  .negotiations__supplier:not(.agent__status--done) .status-badge.agent__status-pending-label::after {
    content: '';
    position: absolute;
    z-index: 1;
    inset: 0;
    background: linear-gradient(105deg, transparent 27%, rgb(255 255 255 / 34%) 50%, transparent 73%);
    transform: translateX(-100%);
    animation: negotiation-badge-shimmer var(--negotiation-badge-shimmer-ms) linear infinite;
    pointer-events: none;
  }
}
@keyframes negotiation-badge-shimmer { to { transform: translateX(100%); } }
.negotiations__steps { margin: 0; padding: 0 12px 12px; list-style: none; }
.negotiations__step { display: flex; align-items: flex-start; gap: 4px; line-height: 17px; }
.negotiations__icon {
  position: relative;
  flex: 0 0 12px;
  height: 12px;
  margin: 0 2px;
  color: #2db85a;
}
.negotiations__step > .negotiations__icon { margin-top: 2px; }
.negotiations__icon::before { content: ''; position: absolute; inset: 1px; border: 1px solid currentColor; border-radius: 50%; }
.negotiations__icon--check { background: url('../assets/icons/check-12.svg') center / 7px no-repeat; }
.negotiations__icon--cross, .negotiations__step-status { color: #b42318; }
.negotiations__icon--cross::after {
  content: '';
  position: absolute;
  inset: 3px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
  transform: rotate(45deg);
}
.negotiations__step-status { margin-left: 4px; font-weight: 500; }

/* ======================================================================
   Модальные окна (case3, design-system §7.7). Контейнер — #modal-root.
   Логика открытия/закрытия (Esc, backdrop) — на стороне JS-модулей.
   ====================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.modal[hidden] { display: none; }
.modal.is-open { opacity: 1; }
.modal__map {
  position: relative;
  width: min(1081px, 100%);
  aspect-ratio: 1081 / 613;
  max-height: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #e8efe6;
  transform: translateY(8px) scale(0.99);
  transition: transform 0.28s ease;
}
.modal.is-open .modal__map { transform: none; }
.modal__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.modal__route { position: absolute; left: 18.87%; top: 30.67%; width: 60.59%; height: 38.66%; }
.modal__route img { position: absolute; inset: -0.61% -0.57% -1.66% -0.33%; width: 100.9%; height: 102.27%; max-width: none; }
.modal__route::after {
  content: "";
  position: absolute;
  left: 0;
  top: 96.2%;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 3px solid var(--bg-neutral-00);
  border-radius: 50%;
  background: #385ee0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.modal__truck {
  position: absolute;
  left: 77.34%;
  top: 33.77%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 4px solid var(--bg-neutral-00);
  border-radius: 20px;
  background: #385ee0;
  box-shadow: 0 0 10.2px rgba(0, 21, 157, 0.26);
  pointer-events: none;
}
.modal__truck img { transform: scaleX(-1); }
.modal__cards { position: absolute; left: 11px; top: 11px; width: 299px; display: flex; flex-direction: column; gap: 4px; }
.tcard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 3px 14.2px rgba(0, 21, 157, 0.08);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: -0.3px;
}
.tcard__head { display: flex; flex-direction: column; gap: 4px; }
.tcard__title { margin: 0; font-weight: var(--fw-semibold); color: #101828; }
.tcard__way { margin: 0; display: flex; gap: 4px; color: rgba(0, 0, 0, 0.88); }
.tcard__rows { display: flex; flex-direction: column; }
.tcard__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--bg-neutral-03); }
.tcard__row:last-child { border-bottom: 0; }
.tcard__label { color: var(--text-03); white-space: nowrap; }
.tcard__value { color: var(--text-04); text-align: right; }
.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 3px 14.2px rgba(0, 21, 157, 0.12);
  cursor: pointer;
  transition: background-color 0.15s;
}
.modal__close:hover { background: var(--bg-neutral-02); }
/* Универсальная панель модалки (не карта): новая заготовка Орбиты */
.modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(480px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-neutral-00);
  border-radius: var(--radius-16);
  box-shadow: 0 3px 14.2px rgba(0, 21, 157, 0.08);
  transform: translateY(8px) scale(0.99);
  transition: transform 0.28s ease;
}
.modal.is-open .modal__panel { transform: none; }

/* ---------- Переписка по сделке (V5): транскрипт в модалке ---------- */
.modal__panel--transcript { width: min(640px, 100%); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding-right: 40px; }
.modal__titles { min-width: 0; }
.modal__title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; color: var(--text-05); }
.modal__subtitle { margin: 2px 0 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.transcript { display: flex; flex-direction: column; gap: 12px; }
.transcript__event { display: flex; flex-direction: column; gap: 4px; }
.transcript__meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; line-height: 16px; color: var(--text-03); }
.transcript__actor { font-weight: 500; color: var(--text-04); }
.transcript__empty { margin: 0; color: var(--text-03); }
/* Живой диалог сделки: реплики сторон — пузыри (своя сторона справа, как msg в чате),
   служебные события (банк/guard/system) — приглушённая строка-пометка, не реплика. */
.transcript__event--msg .bubble { max-width: 85%; }
.transcript__event--msg .bubble p + p { margin-top: 6px; }
.transcript__event--msg:not(.transcript__event--mine) .bubble { border-radius: 12px 12px 12px 4px; }
.transcript__event--mine { align-items: flex-end; }
.transcript__event--mine .bubble { background: var(--bg-neutral-03); }
.transcript__event--note { padding: 6px 10px; background: var(--bg-neutral-01); border-radius: 8px; }
.transcript__note-text { color: var(--text-04); }
/* В ленте чата реплики переписки идут плотнее карточек — это диалог, не лента событий. */
.thread > .transcript__event + .transcript__event { margin-top: 12px; }

/* ---------- Tabs (база из case3; вариант filters — из case1) ---------- */
.tabs { display: flex; padding: 2px; background: var(--bg-neutral-02); border-radius: 8px; }
.tabs__tab { flex: 1; min-height: 20px; padding: 1px 6px; border-radius: 6px; text-align: center; font-weight: 500; color: var(--text-05); }
.tabs__tab.is-active { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1); }

/* ======================================================================
   Раздел «Сделки»
   ====================================================================== */
.screen--deals { align-items: stretch; justify-content: flex-start; }
.deals { width: 100%; padding: 24px 32px 24px; }
.deals__title { margin: 0; padding: 2px 8px 2px 0; font-size: 24px; line-height: 28px; font-weight: var(--fw-semibold); letter-spacing: -1px; color: var(--text-05); }
.deals__subtitle { margin: 4px 0 0; font-size: 16px; line-height: 24px; color: var(--text-03); }
.deals__company { font-weight: 500; color: var(--text-05); }
.deals__stats { display: flex; gap: 12px; margin-top: 32px; }
/* Вариант stat для сделок (перекрывает чатовый выше, как в прототипе) */
.stat { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 15px 16px; border: 1px solid var(--bg-neutral-03); border-radius: var(--radius-12); }
.stat__label { margin: 0; font-weight: 500; line-height: 20px; color: var(--text-03); }
.stat__value { margin: 0; font-size: 18px; line-height: 28px; font-weight: var(--fw-semibold); color: var(--text-04); }
.stat__caption { margin: 0; line-height: 20px; color: var(--text-03); }
.deals__filters { display: flex; align-items: center; gap: 8px; margin-top: 44px; }
.tabs--filters { padding: 3px; border-radius: 10px; }
.tabs--filters .tabs__tab { flex: none; min-height: 29px; padding: 4px 8px; font-size: 14px; line-height: 20px; border-radius: 8px; }
.tabs--filters .tabs__tab { border: 0; background: transparent; font: inherit; letter-spacing: inherit; cursor: pointer; transition: background-color 0.15s; }
.tabs--filters .tabs__tab:hover:not(.is-active) { background: rgba(0, 0, 0, 0.05); }
.tabs--filters .tabs__tab.is-active { background: #fff; }
.search { display: flex; align-items: center; gap: 8px; width: 404px; min-height: 36px; padding: 0 12px; background: #fff; border: 1px solid var(--bg-neutral-03); border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.search__input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; letter-spacing: inherit; color: var(--text-05); }
.search__input::placeholder { color: var(--text-03); opacity: 1; }
.table { margin-top: 24px; }
.table__row { display: grid; grid-template-columns: 104px 116px 1fr 1fr 124px 116px 204px 40px; align-items: stretch; }
.table__cell { display: flex; align-items: center; min-width: 0; padding: 8px; line-height: 20px; color: var(--text-05); border-bottom: 1px solid #e5e5e5; }
.table__row--head .table__cell { font-weight: 500; }
.table__cell--right { justify-content: flex-end; text-align: right; }
.table__cell--ellipsis span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table__cell--more { height: 44px; padding: 0 8px; border-bottom-color: var(--bg-neutral-03); }
.table__row--head .table__cell--more { height: 36px; }
.table__more { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; }
.status-badge { padding: 2px 8px; border-radius: 8px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-04); white-space: nowrap; }
.status-badge--success { background: #e2f8eb; }
.status-badge--info { background: #ebf1ff; }
.status-badge--warning { background: #fff2cc; }
.table__row[hidden] { display: none; }
.table__empty { margin: 0; padding: 24px 8px; color: var(--text-03); }

/* ======================================================================
   Новые стили Орбиты (нет в прототипе): вход, тосты, фолбэк загрузки
   ====================================================================== */

/* ---------- Экран входа ---------- */
.login {
  display: flex;
  flex-direction: column;
  width: 420px;
  max-width: 100%;
  margin: auto;
  padding: 24px;
}
.login__head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 24px; }
.login__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 24px;
  line-height: 28px;
  font-weight: var(--fw-semibold);
  letter-spacing: -1px;
  color: var(--text-05);
}
.login__subtitle { margin: 0; font-size: 16px; line-height: 24px; color: var(--text-03); }
.login__form { display: flex; flex-direction: column; gap: 8px; }
.login__form .field__label { height: auto; }
.login__note { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.login__error { margin: 0; font-size: 12px; line-height: 16px; color: #dc2626; }
.login__submit { width: 100%; min-height: 40px; margin-top: 8px; }

/* ---------- Тосты (#toast; события OG.bus «toast») ---------- */
.toast {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast__item {
  pointer-events: auto;
  padding: 12px 16px;
  background: var(--bg-inverted-01);
  color: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  overflow-wrap: anywhere;
  animation: rv-in 0.28s ease-out both;
}
.toast__item--error { background: #b42318; }
@media (prefers-reduced-motion: reduce) { .toast__item { animation: none; } }

/* ---------- Фолбэк загрузки (boot.js / noscript) ---------- */
.boot-fallback {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-body);
}
.boot-fallback__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: min(420px, 100%);
  padding: 24px;
  background: var(--bg-neutral-00);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-16);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.boot-fallback__title { margin: 0; font-size: 16px; line-height: 24px; font-weight: var(--fw-semibold); color: var(--text-05); }
.boot-fallback__text { margin: 0; color: var(--text-04); }

/* ======================================================================
   Адаптив (в прототипе брейкпоинтов нет — добавлено для Орбиты)
   ====================================================================== */

/* <=1100px: панель прогресса прячется за кнопку в шапке чата */
@media (max-width: 1100px) {
  .progress-toggle-btn { display: flex; }
  .chat { position: relative; }
  .screen--chat .details { display: none; }
  .chat.is-panel-open .details {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    padding: 16px;
    background: var(--bg-neutral-00);
    border-left: 1px solid var(--border-01);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
    z-index: 6;
  }
  .chat.is-viewer .details { display: none; }
  .is-viewer .viewer { flex-basis: min(552px, 55%); }
  .viewer__inner { min-width: 0; }

  /* Сделки: фильтры переносятся на новую строку, поиск не шире контейнера */
  .deals__filters { flex-wrap: wrap; }
  .search { width: min(404px, 100%); }
  /* Таблица сделок шире контейнера — скроллится внутри себя, колонки не наезжают */
  .table { overflow-x: auto; }
  .table__row { min-width: 960px; }

  /* Тост у левого края: справа внизу он перекрывал кнопку отправки composer'а
     (GN-аудит «toast позиция»); слева — только декоративные aria-disabled
     контролы (прикрепить/чип агента), send остаётся доступным. */
  .toast { left: 16px; right: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}

/* <=760px: сайдбар сворачивается в иконки, рейка скрыта */
@media (max-width: 760px) {
  /* .app тянется flex-ом на остаток высоты body (минус плашка CH-04) */
  .app { min-height: 0; }
  .rail { display: none; }
  .sidebar { width: 64px; padding: 0 8px; align-items: center; }
  .sidebar__logo { justify-content: center; height: 40px; margin-top: 12px; padding: 0; }
  .sidebar__logo-full { display: none; }
  .sidebar__logo-mark { display: block; }
  .menu-item { justify-content: center; padding: 0; }
  .menu-item img { margin: 0; }
  .menu-item__label { display: none; }
  .menu-item--plain { display: none; }
  .group { display: none; }
  .chapter { align-items: center; }
  .space-menu { width: auto; padding: 8px 0 0; }
  .space-menu__line { display: none; }

  .chat__header { padding: 12px 16px; }
  .chat__scroll { padding: 0 16px; }
  .chat__input-wrap { padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .chat-input__footer { height: 16px; }
  .msg { padding-left: 16px; }
  .thread > * + * { margin-top: 24px; }

  /* Тап-таргеты ≥44px (GN-аудит mobile: «20–32px»): только мобильный брейкпоинт,
     десктопная геометрия GN-кита (32px) не меняется. */
  .icon-btn, .send-btn, .mini-btn { min-width: 44px; min-height: 44px; }
  .menu-item { min-width: 44px; min-height: 44px; }
  .tabs--filters .tabs__tab { min-height: 44px; }
  .attachment__remove { min-width: 44px; min-height: 44px; margin: 0; }
  .form-block__toggle { min-width: 44px; min-height: 44px; }
  .search { min-height: 44px; }

  /* Тост уже композера: правый край не доходит до кнопки отправки
     (send левее vw-60); перекрываются только декоративные aria-disabled
     контролы слева (+ / чип агента). */
  .toast { max-width: min(360px, calc(100vw - 96px)); }

  /* Двухколоночные формы виджетов — в одну колонку, поля во всю ширину */
  .widget__header { padding-left: 16px; }
  .widget__blocks { padding: 0 16px; }
  .widget__footer { padding-right: 16px; }
  .wsection__selection { padding: 16px; }
  .wsection__row { flex-direction: column; }
  .wsection__row .field,
  .field--narrow,
  [data-key="limitMonth"] { width: 100%; }

  .chat.is-panel-open .details { width: min(320px, 85%); }
  .is-viewer .viewer { position: absolute; inset: 0; flex-basis: auto; width: auto; z-index: 7; border-left: 0; }
  .viewer__inner { min-width: 0; }
  .viewer__header { padding-left: 16px; }

  .deals { padding: 16px; }
  .deals__stats { flex-wrap: wrap; margin-top: 24px; }
  .deals__stats .stat { min-width: 140px; }
  .deals__filters { flex-wrap: wrap; margin-top: 24px; }
  .deals__filters .tabs--filters { max-width: 100%; overflow-x: auto; }
  .search { width: 100%; }
}

/* ---------- prefers-reduced-motion: гасим переходы каркаса ---------- */
@media (prefers-reduced-motion: reduce) {
  .details, .viewer, .chat__main, .modal, .modal__map, .modal__panel { transition: none; }
}

/* ---------- Интеграционные добавки (WIDGETS/SCREENS/CHAT) ---------- */
.field__error { margin: 0; font-size: 12px; line-height: 16px; color: #dc2626; }
.widget__error { margin: 8px 0 0; font-size: 13px; line-height: 18px; color: #dc2626; }
.input--error, .input:has(.input__textarea[aria-invalid="true"]) { border-color: #dc2626; }

.input__textarea {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 7px 12px;
  font: inherit;
  letter-spacing: inherit;
  color: var(--text-05);
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
}
.input__textarea::placeholder { color: var(--text-03); opacity: 1; }

.input__date {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  font: inherit;
  letter-spacing: inherit;
  color: var(--text-05);
  background: transparent;
  border: 0;
  outline: none;
}
.input__date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }

.chat__stage-hint { font-size: 12px; line-height: 16px; color: var(--text-03); padding: 0 4px 4px; }

.sidebar__logout { margin-top: auto; }
@media (max-width: 760px) {
  .sidebar__logout .menu-item__label { display: none; }
}
/* Мёртвые пункты убраны; статичные заголовки без курсора кнопки */
.chapter__title { cursor: default; }
span.avatar { cursor: default; }
.viewer-subtitle { margin: 0 0 16px; font-size: 12px; line-height: 16px; color: var(--text-03); }
.md-view > * + * { margin-top: 14px; }
.code-inline {
  padding: 0 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  background: var(--bg-neutral-02);
  border-radius: 4px;
}

/* ---------- Viewer: снимок кода харнеса ---------- */
.code-banner {
  margin: 0 0 16px;
  padding: 12px 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-05);
  background: #fff2cc;
  border: 1px solid #ead9a0;
  border-radius: var(--radius-8);
}
.code-tabs { margin-bottom: 12px; }
.code-path {
  margin: 0 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-03);
}
.code-pre {
  margin: 0;
  padding: 16px;
  background: var(--bg-neutral-01);
  border: 1px solid var(--border-01);
  border-radius: var(--radius-8);
  overflow-x: auto;
}
.code-pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 18px;
  white-space: pre;
  color: var(--text-05);
}
.code-loading { margin: 0; padding: 16px 0; color: var(--text-03); }

/* Панель режимов владельца: те же правила, что в админке */
#mode-viewer .code-tabs .tab { cursor: pointer; }

/* Панель режимов владельца: собственный класс, не задевает doc-viewer */
.is-mode-viewer #mode-viewer { flex: 0 0 552px; width: auto; border-left-width: 1px; }
.is-mode-viewer-full #mode-viewer { flex-grow: 1; flex-basis: auto; }
.is-mode-viewer-full .chat__main { flex-grow: 0; flex-basis: 0; opacity: 0; overflow: hidden; pointer-events: none; }
.is-mode-viewer-full #mode-viewer .viewer__sheet { max-width: 960px; margin: 0 auto; }
.is-mode-viewer-full #mode-viewer .viewer__canvas { padding-top: 16px; }
.is-mode-viewer .details { width: 0; padding-left: 0; padding-right: 0; opacity: 0; overflow: hidden; }

/* История сделок слева: компактные строки с ellipsis */
.history-item { gap: 6px; }
.history-item__mark { flex: none; width: 14px; color: var(--text-03); font-size: 12px; }
.history-item__mark img { display: block; margin: 0 auto; } /* иконка кита вместо глифа; видна и в mobile-рейле */
.history-item__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Сворачивание правой панели прогресса */
#progress-collapse img { transition: transform 0.2s; }
.details.is-collapsed #progress-collapse img { transform: rotate(-90deg); }
.details.is-collapsed #progress,
.details.is-collapsed #mandate-card,
.details.is-collapsed #progress-connected-hint { display: none; }
#progress-connected-hint { margin: 8px 0 0; }

/* Панель без заголовка «Прогресс»: только шаги, крупнее */
.card__header--bare { padding: 4px 8px 0; justify-content: flex-end; }
.progress__step { padding: 6px 0; }
.progress__label { font-size: 16px; line-height: 22px; }
.progress__digit { font-size: 14px; }
.progress__num { width: 24px; height: 24px; }

/* Живые сообщения о ходе работы в ленте: без заголовка, крупнее */
.progress-note { font-size: 16px; line-height: 22px; }

/* ======================================================================
   Per-agent редактируемый скилл (панель «Счёт и правила»)
   ====================================================================== */
#mandate-card .mini-btn img { transition: transform 0.2s; }
#mandate-card .mini-btn.is-open img { transform: rotate(90deg); }
.mandate-skill { padding: 0 16px 12px; }
.mandate-skill .widget__hint { margin: 0 0 10px; font-size: 12px; line-height: 16px; color: var(--text-03); }
.mandate-skill .field { margin: 0; }
.mandate-skill textarea.input__textarea { width: 100%; box-sizing: border-box; min-height: 120px; }
.mandate-skill__counter { margin: 6px 0 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.mandate-skill__counter--over { color: #dc2626; font-weight: var(--fw-semibold); }
.mandate-skill__status { margin: 6px 0 0; font-size: 12px; line-height: 16px; }
.mandate-skill__status--ok { color: #1f8f45; }
.mandate-skill__status--error { color: #dc2626; }
.mandate-skill__save { margin-top: 10px; }

/* ======================================================================
   Основные моменты харнеса (mode-viewer / admin): выделенный список guards
   ====================================================================== */
.harness-highlights { margin: 0 0 16px; padding: 12px 16px; background: var(--bg-neutral-01); border: 1px solid var(--border-01); border-radius: var(--radius-8); }
.harness-highlights__title { margin: 0; font-size: 14px; line-height: 20px; font-weight: var(--fw-semibold); color: var(--text-05); }
.harness-highlights__sub { margin: 2px 0 10px; font-size: 12px; line-height: 16px; color: var(--text-03); }
.harness-highlights__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.harness-highlight { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 6px; border-left: 3px solid transparent; }
.harness-highlight__icon { flex: none; align-self: center; }
.harness-highlight__rule { flex: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 18px; color: var(--text-04); }
.harness-highlight__text { font-size: 12px; line-height: 18px; color: var(--text-04); }
.harness-highlight--primary { background: var(--success-00); border-left-color: var(--success-02); }
.harness-highlight--primary .harness-highlight__rule { font-weight: var(--fw-semibold); color: var(--text-05); }
.harness-highlight--primary .harness-highlight__text { color: var(--text-05); }

/* Per-agent дополнение к скиллу в панели режима skill */
.skill-addition:not(:empty) { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-01); }

/* ======================================================================
   Сработавшее правило харнеса в подписи переписки (акцентный чип)
   ====================================================================== */
.transcript__rule-hit { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; background: #fff2cc; border: 1px solid #ead9a0; border-radius: 6px; font-weight: var(--fw-semibold); color: var(--text-05); }
.transcript__rule-icon { flex: none; }
.transcript__rule-name { font-size: 12px; line-height: 16px; }

/* ======================================================================
   Редактор скилла в панели режима skill (mode-viewer): подсветка кода + editor
   ====================================================================== */
.skill-section-title { margin: 18px 0 8px; font-size: 13px; line-height: 18px; font-weight: var(--fw-semibold); color: var(--text-04); }

/* Код-блок скилла/правил: моноширинный, фон, перенос длинных строк правил */
.skill-code { margin: 0; }
.skill-code code { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }

/* Цвета токенов подсветки (читаемые на neutral-01 #fafafa, контраст ≥ 4.5:1) */
.skill-code .tok-heading { color: #116329; font-weight: var(--fw-semibold); }
.skill-code .tok-heading-marker { color: #6e7781; }
.skill-code .tok-list { color: #cf222e; font-weight: var(--fw-semibold); }
.skill-code .tok-bold { color: var(--text-05); font-weight: var(--fw-semibold); }
.skill-code .tok-code { color: #0550ae; background: #eaeef2; border-radius: 3px; padding: 0 3px; }
.skill-code .tok-fence { color: #6e7781; background: #eaeef2; }
.skill-code .tok-guard { color: #953800; background: #fff1e5; border-radius: 3px; padding: 0 3px; font-weight: var(--fw-semibold); }

/* Редактор per-agent дополнения: большое поле + живой превью с подсветкой */
.skill-editor { margin-top: 8px; }
.skill-editor__hint { margin: 0 0 10px; font-size: 12px; line-height: 16px; color: var(--text-03); }
.skill-editor__textarea {
  display: block; width: 100%; box-sizing: border-box; min-height: 220px; resize: vertical;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px; line-height: 20px; letter-spacing: 0; color: var(--text-05);
  background: var(--bg-neutral-01); border: 1px solid var(--border-01); border-radius: var(--radius-8);
  white-space: pre-wrap; overflow-wrap: break-word; tab-size: 2; outline: none;
}
.skill-editor__textarea:focus { border-color: var(--text-04); }
.skill-editor__textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.skill-editor__counter { margin: 6px 0 0; font-size: 12px; line-height: 16px; color: var(--text-03); }
.skill-editor__counter--over { color: #dc2626; font-weight: var(--fw-semibold); }
.skill-editor__status { margin: 6px 0 0; font-size: 12px; line-height: 16px; }
.skill-editor__status--ok { color: #1f8f45; }
.skill-editor__status--error { color: #dc2626; }
.skill-editor__save { margin-top: 10px; }
.skill-editor__preview-title { margin-top: 16px; }
.skill-editor__preview { max-height: 320px; overflow: auto; }
.skill-editor__preview-empty { color: var(--text-03); font-style: italic; }
