/* Общая раскладка рассылки. Рабочее состояние всегда видно.
   Цвета берутся из токенов style.css — оба файла переключаются между
   тёмной и светлой темой вместе. */
.outreach-tabs { display: flex; flex: none; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; padding: 0; overflow: visible; }
.outreach-tabs a, .agent-tabs a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.outreach-tabs > a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px 11px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; transition: color .15s, background-color .15s, border-color .15s; }
.outreach-tabs > a:hover { background: var(--tint); }
.outreach-tabs > a[aria-current] { border-bottom-color: var(--accent); }
.outreach-tabs > a .icon { opacity: .8; }
.outreach-more > div a { display: flex; align-items: center; gap: 8px; }
.outreach-tabs a[aria-current], .agent-tabs a[aria-current], .outreach-more .selected { color: var(--accent); font-weight: 600; }
.outreach-tabs a:hover, .agent-tabs a:hover { color: var(--text); }
.outreach-more { position: relative; margin-left: auto; }
.outreach-more { align-self: center; }
.outreach-more summary { display: inline-flex; align-items: center; gap: 4px; list-style: none; cursor: pointer; padding: 6px 8px; color: var(--muted); }
.outreach-more summary::-webkit-details-marker { display: none; }
.outreach-more > div { position: absolute; right: 0; top: 100%; z-index: 20; display: grid; min-width: 150px; padding: 8px; border: 1px solid var(--line-ctl); border-radius: 10px; background: hsl(var(--t-popover)); box-shadow: var(--shadow); }
.outreach-more a { padding: 10px; }
.agent-tabs { display: flex; gap: 22px; margin: -8px 0 24px; font-size: var(--s1); }
.agent-form { max-width: 760px; gap: 18px; }
.context-form { margin-bottom: var(--sp-6); }
.context-form .actions { margin-top: calc(-1 * var(--sp-1)); }
.context-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.context-inputs input[type="file"] { width: 100%; min-height: var(--h-ctl); padding: 7px 10px; border: 1px solid var(--line-ctl); border-radius: var(--r-ctl); background: hsl(var(--t-input) / .35); color: var(--muted); font-size: var(--s1); }
/* Системная кнопка «Choose File» выпадает из панели — одеваем её в наш стиль. */
.context-inputs input[type="file"]::file-selector-button {
  margin-right: 10px; height: 22px; padding: 0 10px; border: 1px solid var(--line-ctl);
  border-radius: var(--r-ctl); background: var(--tint); color: var(--text); font: inherit; cursor: pointer;
}
.context-inputs input[type="file"]::file-selector-button:hover { background: var(--card); }
.analysis-questions { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--tint); }
.analysis-questions h2, .analysis-result h2, .ai-preview h2 { margin: 0; font-size: var(--s3); }
.analysis-questions ol { margin: 12px 0 18px; padding-left: 22px; }
.analysis-questions li + li { margin-top: 8px; }
.analysis-result, .ai-preview { max-width: 760px; padding: 22px 0; border-top: 1px solid var(--line); }
.analysis-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--accent); font-size: var(--s0); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.knowledge-count { flex: none; color: var(--muted); font-size: var(--s1); }
.ai-preview blockquote { max-width: 65ch; margin: 16px 0 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--tint); line-height: 1.6; }
.ai-preview .hint { color: var(--muted); font-size: var(--s1); }
/* «Проверить и поправить» — такая же кнопка-раскрывашка, как на «Знаниях». */
.settings-details.agent-form { border-top: 0; padding-top: 0; }
.settings-details.agent-form > summary {
  display: inline-flex; align-items: center; gap: 6px; height: var(--h-sm); padding: 0 var(--sp-3);
  border: 1px solid var(--line-ctl); border-radius: var(--r-ctl); font-size: var(--s1); font-weight: 400;
}
.settings-details.agent-form > summary:hover { background: var(--tint); }
.settings-details { border-top: 1px solid var(--line); padding-top: 18px; }
.settings-details > summary { cursor: pointer; font-weight: 500; }
.settings-details > .form-grid { margin-top: var(--sp-4); gap: 18px; }
.outreach-workspace .cols { margin-bottom: var(--sp-4); }

/* Плотность экранов рассылки: рабочий инструмент, а не лендинг. Заголовок
   в одну строку со статусом, строки таблиц ниже, пояснения — только там,
   где без них ошибаются. Диалоги ниже живут по своим правилам. */
.outreach-workspace .page-head { align-items: baseline; justify-content: flex-start; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); }
.outreach-workspace .page-head h1 { font-size: var(--s4); letter-spacing: -0.01em; }
.outreach-workspace .page-head h1 .count { font-size: var(--s3); }
/* Подпись живёт рядом с заголовком, отделённая чертой, а не отдельной строкой. */
.outreach-workspace .page-head .muted { display: flex; align-items: baseline; gap: var(--sp-4); font-size: var(--s1); max-width: 62ch; }
.outreach-workspace .page-head .muted::before { content: ""; align-self: center; width: 1px; height: 16px; background: var(--line); }
.outreach-workspace .status-row { margin-bottom: var(--sp-4); font-size: var(--s1); }
.outreach-workspace .section-head { margin: var(--sp-6) 0 var(--sp-2); }
.outreach-workspace table th { padding-bottom: 6px; }
.outreach-workspace table td { padding-top: 9px; padding-bottom: 9px; }
.outreach-workspace td.empty { padding: var(--sp-6) var(--sp-4); color: var(--muted); }
/* Пустой раздел: одна строка в рамке вместо таблицы с шапкой и дырой внутри. */
.empty-box {
  padding: var(--sp-4); border: 1px dashed var(--line-ctl); border-radius: var(--r-card);
  color: var(--muted); font-size: var(--s1); background: var(--tint);
}
.outreach-workspace .card { padding: var(--sp-4) var(--sp-4) var(--sp-4); }
.outreach-workspace .card + .card, .outreach-workspace table + .card, .outreach-workspace .card + table { margin-top: var(--sp-4); }
.outreach-workspace .card h2 { margin-bottom: var(--sp-3); }

/* Сводка: заголовок, состояние и кнопка паузы в одной шапке. */
.outreach-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.outreach-head h1 { font-size: var(--s4); font-weight: 600; letter-spacing: -0.01em; }
.outreach-head .head-state { display: flex; align-items: center; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; font-size: var(--s1); color: var(--muted); }
.outreach-head .head-state b { color: var(--text); font-weight: 600; }
.outreach-head .head-tools { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }
.outreach-head .state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.funnel-card { padding: var(--sp-4) var(--sp-4) var(--sp-3) !important; }
.outreach-workspace .funnel-row { min-height: 26px; }
.outreach-workspace .funnel-row .l { font-size: var(--s1); }
.outreach-workspace .stat-line { font-size: var(--s1); }

/* Диалоги: три независимые рабочие области, а не длинная страница. */
.dialogs-page { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.dialogs-page .page-head { margin-bottom: 12px; }
.dialogs-page .summary { flex: none; margin-bottom: 16px; }
/* Колонка списка: сверху с кем переписка (люди / блогеры) и фильтры, под
   ними список. Переписка справа начинается сразу под вкладками — вся высота
   экрана её. */
.dialog-col { display: flex; min-width: 0; min-height: 0; flex-direction: column; gap: 10px; }
.dialogs-bar { display: flex; flex: none; flex-direction: column; gap: 8px; }
.dialogs-bar .summary { gap: 5px; margin-bottom: 0; }
.dialogs-bar .summary a { height: 26px; padding: 0 10px; font-size: 12px; }
.dialog-col .dialog-list { flex: 1; }
.dlg-kinds { display: grid; flex: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: 12px; background: var(--tint); border: 1px solid hsl(var(--t-border) / .5); }
.dlg-kinds a {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 9px;
  color: var(--muted); font-size: var(--s1); font-weight: 550; text-decoration: none;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.dlg-kinds a:hover { color: var(--text); text-decoration: none; }
.dlg-kinds a[aria-current="page"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px hsl(var(--t-scrim) / .22); }
.dlg-kinds a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dlg-kinds .icon { width: 14px; height: 14px; }
.dlg-kinds-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad-bright);
  color: #fff; font-size: 11px; font-weight: 650; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
/* Сбои аккаунтов и прокси у «Ещё» и «Журнала»: жёлтым — не чат, ждущий ответа. */
.outreach-tabs .nav-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn-tint); color: var(--warn-ink);
  font-size: 11px; font-weight: 650; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.outreach-more > div a .nav-n { margin-left: auto; }
/* Реплика, внесённая оператором руками: кто вставил, без галочки отправки. */
.msg-pasted { display: inline-flex; align-items: center; gap: 3px; }
.msg-pasted .icon { width: 10px; height: 10px; }
/* Чат без нашего аккаунта: поле по-русски и три кнопки — «его ответ»,
   «перевести», «я отправил». Над полем — перевод, который надо отправить. */
.dlg-paste-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.dlg-paste-actions button, .dlg-paste-actions .button { display: inline-flex; align-items: center; gap: 5px; }
.dlg-send {
  display: flex; flex-direction: column; gap: 4px; padding: 9px 12px 10px; border: 1px solid hsl(var(--t-primary) / .35);
  border-radius: 12px; background: var(--accent-tint); transition: opacity .15s ease;
}
.dlg-send.warn { border-color: hsl(var(--v-warn) / .5); background: var(--warn-tint); }
.dlg-send-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: var(--s0); }
.dlg-send-h > b { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.dlg-send-copy { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.dlg-send-copy.copied { border-color: hsl(var(--t-success) / .6); color: hsl(var(--t-success)); }
.dlg-send-text { margin: 0; max-height: 26vh; overflow-y: auto; font-size: var(--s1); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.dlg-send-why { margin: 0; color: var(--muted); font-size: var(--s0); line-height: 1.4; }
.dlg-send-stale { display: none; margin: 0; color: var(--warn-ink); font-size: var(--s0); font-weight: 550; }
.dlg-paste.is-changed .dlg-send-text, .dlg-paste.is-changed .dlg-send-why { opacity: .5; }
.dlg-paste.is-changed .dlg-send-stale { display: block; }
.dlg-paste:not(:has(.dlg-translate)) .dlg-send-stale { display: none; }
/* Перевод сам, пока оператор пишет: кнопки «Перевести» нет, карточка
   показывает, что идёт, и подсказывает следующий шаг. */
.dlg-paste.js-auto .dlg-translate { display: none; }
.dlg-send[hidden] { display: none; }
.dlg-send:not([hidden]) { animation: dlg-in .2s cubic-bezier(.2, .8, .2, 1); }
.dlg-send-hint { margin: 0; color: var(--muted); font-size: var(--s0); line-height: 1.4; }
.dlg-send-err { display: none; margin: 0; color: var(--bad); font-size: var(--s0); font-weight: 550; }
.dlg-paste.is-error .dlg-send-err { display: block; }
.dlg-paste:is(.is-changed, .is-busy, .is-error) .dlg-send-hint,
.dlg-paste:is(.is-changed, .is-busy, .is-error) .dlg-send-copy { visibility: hidden; }
.dlg-paste:is(.is-changed, .is-busy, .is-error) .dlg-send-hint { display: none; }
.dlg-paste.is-busy .dlg-send-stale { display: block; color: var(--muted); }
.dlg-paste.is-busy .dlg-send-text {
  min-height: 1.45em; border-radius: 6px; opacity: .55;
  background: linear-gradient(90deg, transparent 0, hsl(var(--t-primary) / .16) 50%, transparent 100%) 0 0 / 200% 100% no-repeat;
  animation: dlg-shimmer 1.1s linear infinite;
}
.dlg-paste.is-copied .dlg-send-hint { color: var(--text); font-weight: 550; }
.dlg-paste.is-copied .dlg-sent { animation: dlg-nudge .9s cubic-bezier(.2, .8, .2, 1) 2; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes dlg-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes dlg-nudge { 0%, 100% { box-shadow: 0 0 0 0 hsl(var(--t-primary) / 0); } 40% { box-shadow: 0 0 0 5px hsl(var(--t-primary) / .28); } }
@media (prefers-reduced-motion: reduce) { .dlg-send, .dlg-paste .dlg-send-text, .dlg-paste .dlg-sent { animation: none !important; } }
/* Перенос переписки: ИИ читает в фоне, страница ждёт сама. */
.dlg-imp-wait {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid hsl(var(--t-primary) / .35); background: var(--accent-tint); font-size: var(--s1);
  animation: dlg-in .2s cubic-bezier(.2, .8, .2, 1);
}
.dlg-imp-wait > span:last-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dlg-imp-wait .muted { font-size: var(--s0); }
.dlg-imp-spin, .imp-spin {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid hsl(var(--t-primary) / .22); border-top-color: var(--accent); animation: imp-spin .8s linear infinite;
}
@keyframes imp-spin { to { transform: rotate(360deg); } }
.imp-dlg {
  width: min(560px, calc(100vw - 32px)); max-height: min(88vh, 760px); padding: 0; border: 1px solid var(--line);
  border-radius: 18px; background: var(--card); color: var(--text); box-shadow: 0 24px 64px hsl(var(--t-scrim) / .45);
}
.imp-dlg[open] { display: flex; animation: imp-in .22s cubic-bezier(.2, .8, .2, 1); }
.imp-dlg::backdrop { background: hsl(var(--t-scrim) / .5); backdrop-filter: blur(3px); }
.imp-dlg[open]::backdrop { animation: imp-fade .2s ease-out; }
.imp-form { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 16px 20px 18px; overflow-y: auto; }
.imp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.imp-head h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; font-weight: 650; }
.imp-head h2 .icon { color: var(--accent); }
.imp-x { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.imp-x:hover { background: var(--tint); color: var(--text); }
.imp-sub { margin: -4px 0 0; color: var(--muted); font-size: var(--s1); line-height: 1.45; }
.imp-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 20px 16px;
  border: 1.5px dashed hsl(var(--t-border)); border-radius: 14px; background: var(--tint); text-align: center; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.imp-drop:hover, .imp-dlg.is-over .imp-drop { border-color: var(--accent); background: var(--accent-tint); }
.imp-dlg.is-over .imp-drop { transform: scale(1.012); }
.imp-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.imp-drop b { font-size: var(--s2, 14px); font-weight: 600; }
.imp-drop .muted { font-size: var(--s0); }
.imp-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.imp-drop-ico {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 2px; border-radius: 12px;
  background: var(--card); color: var(--accent); box-shadow: 0 1px 3px hsl(var(--t-scrim) / .18);
}
.imp-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.imp-file {
  position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 5px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: 11.5px; animation: imp-pop .18s cubic-bezier(.2, .8, .2, 1);
}
.imp-file-thumb {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; background: var(--tint) top center / cover no-repeat;
  color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase;
}
.imp-file-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.imp-file-size { color: var(--muted); font-size: 10.5px; }
.imp-file-x {
  position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: hsl(var(--t-scrim) / .62); color: #fff;
}
.imp-file-x .icon { width: 11px; height: 11px; }
.imp-text { min-height: 60px; resize: vertical; }
.imp-err { margin: 0; color: var(--bad); font-size: var(--s1); }
/* Кнопки внизу окна всегда видны: список файлов прокручивается над ними. */
.imp-foot {
  position: sticky; bottom: -18px; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin: 0 -20px -18px; padding: 10px 20px 18px; background: var(--card); border-top: 1px solid var(--line);
}
.imp-foot button { display: inline-flex; align-items: center; gap: 6px; }
.imp-formats { font-size: 11.5px; }
.imp-touch { display: none; }
@media (hover: none) { .imp-desk { display: none; } .imp-touch { display: inline; } }
@keyframes imp-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes imp-up { from { transform: translateY(100%); } }
@keyframes imp-fade { from { opacity: 0; } }
@keyframes imp-pop { from { opacity: 0; transform: scale(.94); } }
@media (max-width: 640px) {
  .imp-dlg { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .imp-dlg[open] { animation: imp-up .28s cubic-bezier(.2, .8, .2, 1); }
  .imp-form { padding: 14px 16px 0; }
  .imp-foot { bottom: 0; margin: 0 -16px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .imp-dlg, .imp-dlg::backdrop, .imp-file, .dlg-imp-wait { animation: none !important; } }
/* Подсказка ИИ над полем ввода: перевод и почему так. Текст — уже в поле. */
.dlg-ai-card {
  flex: none; margin: 0; padding: 7px 12px; border-top: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--card); font-size: 12.5px;
}
.dlg-ai-card b { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.dlg-ai-card p { margin: 3px 0 0; }
.dlg-ai-card.warn { border-left-color: var(--warn, #d08a00); }
.composer-hint .linkish {
  display: inline-flex; align-items: center; gap: 4px; height: auto; min-height: 0; padding: 0;
  border: 0; background: none; box-shadow: none; color: var(--muted); font: inherit; cursor: pointer;
}
.composer-hint .linkish:hover { color: var(--text); text-decoration: underline; }
.composer-hint .linkish .icon { width: 12px; height: 12px; }
/* Карточка блогера справа: охват, просмотры, оценка; продукт, поиск, условия. */
.dlg-kol-nums { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.dlg-kol-nums > span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.dlg-kol-nums b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dlg-kol-facts { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.dlg-kol-facts > div { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 8px; }
.dlg-kol-facts dt { display: flex; padding-top: 3px; color: var(--muted); }
.dlg-kol-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: var(--s1); }
.outreach-workspace .dialogs {
  flex: 1; min-height: 0; grid-template-columns: 300px minmax(380px, 1fr) 290px;
  gap: 14px; align-items: stretch;
}
/* Пока диалог не выбран, пустая рамка карточки справа не нужна. */
.outreach-workspace .dialogs:not(.has-current) { grid-template-columns: 300px minmax(380px, 1fr); }
.outreach-workspace .dialogs:not(.has-current) .dialog-card { display: none; }
.outreach-workspace .dialog-list {
  max-height: none; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  border-color: var(--line); border-radius: var(--r-card); background: var(--card);
}
.outreach-workspace .dialog-item {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center;
  gap: 12px; min-height: 66px; padding: 11px 12px;
  /* Разделитель обязателен: без него строки сливаются в одно полотно текста и
     глазу не за что зацепиться. Задавать один `border-color` мало — при
     `border-style: none` браузер линию не рисует вовсе. */
  border-bottom: 1px solid hsl(var(--t-border) / .5); color: var(--text); text-decoration: none;
}
.outreach-workspace .dialog-item:last-child { border-bottom: 0; }
.outreach-workspace .dialog-item:hover { color: var(--text); text-decoration: none; }
.outreach-workspace .dialog-item.active {
  background: hsl(var(--t-primary) / .1);
  box-shadow: inset 2px 0 0 hsl(var(--t-primary) / .72);
}
.outreach-workspace .dialog-item:focus-visible {
  position: relative; z-index: 1; outline-offset: -2px;
}
@media (hover: hover) and (pointer: fine) {
  .outreach-workspace .dialog-item:not(.active):hover {
    background: hsl(var(--t-primary) / .055);
    box-shadow: inset 2px 0 0 hsl(var(--t-primary) / .3);
  }
  .outreach-workspace .dialog-item.active:hover { background: hsl(var(--t-primary) / .13); }
}
.dialog-avatar { width: 40px; height: 40px; font-size: 13px; }
/* Значок площадки — на аватаре, как в мессенджерах: канал виден сразу, а строку
   он больше не занимает. Кольцо цвета подложки отделяет значок от аватара. */
.dialog-avatar-wrap { position: relative; display: block; width: 40px; height: 40px; }
.dialog-avatar-wrap .chan-badge {
  position: absolute; right: -4px; bottom: -4px; display: inline-flex;
  align-items: center; justify-content: center; width: 19px; height: 19px;
  border-radius: 50%; background: var(--surface); color: var(--text);
  box-shadow: 0 0 0 2px var(--card);
}
.dialog-item.active .chan-badge { box-shadow: 0 0 0 2px hsl(var(--t-primary) / .1); }
.dialog-avatar-wrap .chan-badge .icon { width: 12px; height: 12px; }
.dialog-item-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.dialog-item-top { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; }
.dialog-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-item-top time { flex: none; color: var(--muted); font-size: 11px; }
.dialog-item.active .dialog-item-top time { color: var(--muted); }
/* Вторая строка — последняя реплика: по ней видно диалог, а не служебный статус. */
.dialog-item-preview {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: var(--s0); line-height: 1.45;
}
.dialog-item-preview .who { color: var(--faint); }
.dialog-item.active .dialog-item-preview { color: var(--text); }
/* Реплика и метка в одной строке: карточка всегда ровно две строки, высота у
   всех одинаковая. Метка не сжимается, текст реплики забирает остаток. */
.dialog-item-line { display: flex; min-width: 0; min-height: 20px; align-items: center; gap: 8px; }
.dialog-item-line .dialog-item-preview { flex: 1 1 auto; }
.dialog-mark { flex: none; }
/* Метка сети: значок и название, одинаково в списке, шапке и карточке. */
.pill-channel { gap: 4px; font-weight: 550; }
.pill-channel .icon { width: 12px; height: 12px; }
.thread-channel { flex: none; margin-left: auto; }
/* «ИИ | Я» в шапке чата: кто отвечает. Нажатая половина — текущий режим. */
.ai-switch-slot { flex: none; margin-left: auto; }
.ai-switch-slot + .thread-channel { margin-left: 0; }
.ai-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--tint); border: 1px solid hsl(var(--t-border) / .5); }
.ai-switch form { display: contents; }
.ai-switch button {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; min-height: 0; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; box-shadow: none; color: var(--muted);
  font: inherit; font-size: var(--s0); font-weight: 550; cursor: pointer;
}
.ai-switch button:hover:not([disabled]) { color: var(--text); }
.ai-switch button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px hsl(var(--t-scrim) / .22); cursor: default; opacity: 1; }
.ai-switch button[aria-pressed="true"] .icon { color: var(--accent); }
.ai-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ai-switch .icon { width: 13px; height: 13px; }
.card-channel { display: inline-flex; align-items: center; gap: 5px; font-size: var(--s1); }
.dialog-item.active .pill-flat { background: hsl(var(--t-primary) / .1); }

.outreach-workspace .dialog-thread {
  min-width: 0; min-height: 0; overflow: hidden; gap: 0;
  border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--tint);
}
.dialog-thread-head {
  display: flex; flex: none; align-items: center; gap: 10px; min-height: 52px;
  padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--card);
}
.thread-who { display: flex; min-width: 0; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.thread-who:hover { color: inherit; text-decoration: none; }
.thread-who .avatar { flex: none; }
.thread-avatar { width: 36px; height: 36px; font-size: var(--s1); }
.thread-person { display: flex; min-width: 0; flex-direction: column; line-height: 1.35; }
.thread-person b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.thread-person span { overflow: hidden; color: var(--muted); font-size: var(--s0); text-overflow: ellipsis; white-space: nowrap; }
.message-stream {
  display: flex; flex: 1; min-width: 0; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; flex-direction: column; align-items: flex-start;
  gap: 5px; padding: 20px clamp(12px, 3vw, 32px) 18px;
}
.message-stream .msg { display: flex; width: 100%; max-width: none; min-width: 0; padding: 0; margin: 0; background: none; }
.message-stream .msg-in { justify-content: flex-start; }
.message-stream .msg-out { justify-content: flex-end; }
.msg-bubble {
  position: relative; max-width: min(76%, 620px); min-width: 82px; padding: 8px 10px 6px;
  overflow-wrap: anywhere; border-radius: 13px 13px 13px 4px;
  background: var(--surface); box-shadow: 0 1px 1px hsl(var(--t-scrim) / .3);
}
.msg-out .msg-bubble {
  border-radius: 13px 13px 4px 13px;
  background: hsl(var(--t-info) / .12); border: 1px solid hsl(var(--t-info) / .24);
  box-shadow: 0 1px 1px hsl(var(--t-scrim) / .3), inset 0 1px 0 hsl(var(--t-info) / .06);
}
.message-stream .msg-text { max-width: 70ch; white-space: pre-wrap; line-height: 1.45; }
.msg-media { display: block; margin-bottom: 3px; color: var(--muted); font-size: var(--s0); font-weight: 600; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 15px; margin: 3px 0 -1px; color: var(--muted); font-size: 10px; line-height: 1; }
.msg-meta-r { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding-left: 10px; }
/* «оригинал» и «почему» — тихие ссылки в строке времени, не отдельные строки. */
.msg-tg {
  height: auto; min-height: 0; padding: 2px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--muted); font: inherit; font-size: 10.5px; opacity: .8; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 2px;
}
.msg-tg:hover, .msg-tg[aria-expanded="true"] { color: var(--text); opacity: 1; }
.msg-tg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.msg-more { margin-top: 7px; padding-top: 6px; border-top: 1px dashed hsl(var(--t-border) / .8); animation: msg-more-in .16s ease-out; }
.msg-more > span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.msg-more p { margin: 0; color: var(--muted); font-size: var(--s1); line-height: 1.45; white-space: pre-wrap; }
@keyframes msg-more-in { from { opacity: 0; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .msg-more { animation: none; } }
.msg-wait { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--muted); font-size: 11px; font-style: italic; }
.msg-wait .icon { width: 10px; height: 10px; animation: msg-spin 1.6s linear infinite; }
@keyframes msg-spin { to { transform: rotate(360deg); } }
.msg-out .msg-meta { color: hsl(var(--t-info) / .88); }
/* Одна галочка, а не две: подтверждения доставки и прочтения у нас нет
   ни на одном канале, а «✓✓» читается как «дошло и прочитано». */
.msg-checks { color: hsl(var(--t-info) / .88); padding-right: 3px; cursor: help; }
.msg-checks.is-read { color: hsl(var(--t-success)); font-weight: 600; }
.msg-checks.is-failed { color: hsl(var(--t-destructive)); }
.message-stream details { margin-top: 3px; }
.message-stream details summary { color: var(--muted); cursor: pointer; font-size: 11px; }
.message-stream .msg-why { float: left; margin: 3px 8px 0 0; }
.message-stream .msg-why[open] { float: none; margin: 6px 0 2px; }
.message-stream .msg-why summary { display: inline-flex; align-items: center; gap: 3px; list-style: none; font-size: 10px; opacity: .75; }
.message-stream .msg-why summary::-webkit-details-marker { display: none; }
.message-stream .msg-why summary:hover { opacity: 1; }
.message-stream details p { margin-top: 4px; color: var(--muted); font-size: var(--s0); line-height: 1.4; }
.message-stream .msg-day {
  align-self: center; margin: 10px 0 6px;
  padding: 4px 9px; border-radius: 999px; background: hsl(var(--t-secondary));
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.message-stream .ru { margin-top: 6px; padding-top: 6px; border-top: 1px dashed hsl(var(--t-border) / .7); color: var(--muted); font-size: var(--s1); line-height: 1.4; }
.pending-message { display: inline-flex; align-items: center; gap: 5px; align-self: flex-end; max-width: 75%; margin: 6px 0; padding: 5px 10px; border-radius: 999px; background: hsl(var(--t-secondary)); color: var(--muted); font-size: 11px; }
.pending-message .icon { flex: none; width: 11px; height: 11px; }

.outreach-workspace .dialog-reply { flex: none; gap: 6px; margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--card); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.dialog-reply textarea {
  flex: 1; min-width: 0; min-height: 40px; max-height: 32vh; padding: 9px 14px; resize: none;
  border-color: var(--line-ctl); border-radius: 20px; line-height: 20px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.dialog-reply textarea::placeholder { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dialog-reply .composer-send { display: inline-flex; flex: none; width: 40px; height: 40px; min-height: 40px; padding: 0; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: var(--glow-soft); transition: transform .12s ease, background-color .15s ease; }
.dialog-reply .composer-send:active { transform: scale(.94); }
/* Круглые кнопки у поля: «+» (ещё) и ✨ (ИИ). Подписи — во всплывающей подсказке. */
.composer-icon {
  display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; min-height: 40px;
  padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--muted); cursor: pointer;
  list-style: none; transition: background-color .15s ease, color .15s ease, transform .12s ease;
}
.composer-icon::-webkit-details-marker { display: none; }
.composer-icon:hover { background: var(--tint); color: var(--text); }
.composer-icon:active { transform: scale(.94); }
.composer-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.composer-ai { color: var(--accent); }
.composer-more { position: relative; flex: none; }
.composer-more[open] > .composer-icon { background: var(--tint); color: var(--text); }
.composer-more[open] > .composer-icon .icon { transform: rotate(45deg); }
.composer-more > .composer-icon .icon { transition: transform .15s ease; }
.composer-menu {
  position: absolute; z-index: 25; left: 0; bottom: calc(100% + 8px); display: flex; width: min(360px, calc(100vw - 32px));
  flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--line-ctl); border-radius: 14px;
  background: hsl(var(--t-popover)); box-shadow: 0 18px 48px -16px hsl(var(--t-scrim) / .7);
  transform-origin: bottom left; animation: composer-menu-in .14s ease-out;
}
@keyframes composer-menu-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .composer-menu, .composer-more > .composer-icon .icon { animation: none; transition: none; } }
.composer-menu-i {
  display: flex; width: 100%; height: auto; min-height: 38px; align-items: center; gap: 10px; padding: 8px 10px;
  border: 0; border-radius: 9px; background: none; box-shadow: none; color: var(--text); font: inherit; font-size: var(--s1);
  justify-content: flex-start; text-align: left; cursor: pointer;
}
.composer-menu-i:hover { background: var(--tint); }
.composer-menu-i .icon { flex: none; color: var(--muted); }
.dialog-reply .composer-send:hover { background: var(--accent-hover); color: var(--accent-ink); box-shadow: var(--glow); }
.composer-hint, .composer-note { color: var(--muted); font-size: 11px; }
.composer-hint { padding-left: 14px; }
.composer-note { flex: none; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--card); }
.composer-note:empty { display: none; }
/* Плашка о проблеме доставки внутри композера: цвет по смыслу. */
.composer-note.warn { color: var(--b); }
.composer-note.error { color: var(--bad-bright); }

.outreach-workspace .dialog-card {
  position: static; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  gap: 14px; padding: 18px; border-color: var(--line); border-radius: var(--r-card); background: var(--card);
}
.outreach-workspace .dialog-card [data-poll-region="card"] { display: flex; flex-direction: column; gap: 14px; }
.dialog-card-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dialog-card-person > div { min-width: 0; }
.dialog-card-person h2, .dialog-card-person p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-avatar { width: 48px; height: 48px; font-size: 15px; }
/* Правая колонка: канал и ссылка на карточку одной строкой, заметки — блоками. */
.dialog-card .card-channel { display: flex; align-items: center; gap: 6px; font-size: var(--s1); min-width: 0; }
.dialog-card .card-channel > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-person-link { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex: none; color: var(--muted); font-size: var(--s0); }
.card-person-link:hover { color: var(--text); }
.dlg-card-note { display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; border-radius: 10px; background: var(--tint); font-size: var(--s1); line-height: 1.45; }
.dlg-card-note b { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--s0); font-weight: 600; }
.dlg-card-note.warn { background: var(--warn-tint); }
.dlg-card-note.warn b { color: var(--warn-ink); }
/* Воронка: четыре шага полосками, как прогресс. Нажать — отметить шаг. */
.stage-steps { display: flex; flex-direction: column; gap: 8px; }
.stage-steps-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: var(--s0); font-weight: 600; }
.stage-steps-h b { padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--text); font-weight: 500; }
.stage-steps ol { display: grid; grid-template-columns: 1fr 1fr 1fr 1.3fr; gap: 4px; margin: 0; padding: 0; list-style: none; }
.stage-steps button {
  display: flex; width: 100%; height: auto; min-height: 0; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 4px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--muted); font: inherit; font-size: 11px; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-steps button i { display: block; height: 4px; border-radius: 2px; background: hsl(var(--t-border)); transition: background-color .15s ease; }
.stage-steps button:hover:not([disabled]) { color: var(--text); }
.stage-steps button:hover:not([disabled]) i { background: hsl(var(--t-primary) / .35); }
.stage-steps .done button i { background: hsl(var(--t-primary) / .5); }
.stage-steps .on button { color: var(--text); font-weight: 600; cursor: default; opacity: 1; }
.stage-steps .on button i { background: var(--accent); box-shadow: var(--glow-soft); }
.stage-steps button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.dlg-card-actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 -8px; }
.dlg-card-actions form { margin: 0; }
.dlg-card-actions button { display: inline-flex; align-items: center; gap: 5px; }
.dlg-card-actions button.danger { border-color: transparent; background: transparent; color: var(--bad-bright); }
.dlg-card-actions button.danger:hover { background: hsl(var(--t-destructive) / .12); }
.knowledge-add { margin-bottom: var(--sp-4); }
.knowledge-add > summary {
  display: inline-flex; align-items: center; gap: 6px; height: var(--h-sm); padding: 0 var(--sp-3);
  border: 1px solid var(--line-ctl); border-radius: var(--r-ctl); cursor: pointer; font-size: var(--s1);
}
.knowledge-add > summary:hover { background: var(--tint); }
.knowledge-add .cols { margin-top: var(--sp-3); }
.nav-theme { display: none; }
@media (min-width: 961px) {
  /* Экран диалогов — рабочее место: шапка с названием повторяла вкладку
     «Диалоги» и съедала высоту переписки. Тема переехала в строку вкладок. */
  body.dialogs-screen { height: 100vh; overflow: hidden; }
  body.dialogs-screen .frame > .top { display: none; }
  body.dialogs-screen main.outreach-workspace {
    display: flex; height: 100vh; height: 100dvh; max-width: 1480px; flex-direction: column;
    padding-top: 6px; padding-bottom: 12px;
  }
  body.dialogs-screen .outreach-tabs { margin-bottom: 10px; }
  body.dialogs-screen .outreach-tabs > a { padding: 6px 10px 8px; }
  body.dialogs-screen .nav-theme { display: inline-flex; flex: none; align-self: center; width: 32px; height: 32px; margin: 0 0 2px auto; }
  /* Имя в шапке чата ведёт к карточке только на телефоне. */
  .thread-who { pointer-events: none; }
  body.dialogs-screen .outreach-more + .nav-theme { margin-left: 10px; }
}
@media (max-width: 1180px) and (min-width: 961px) {
  .outreach-workspace .dialogs { grid-template-columns: 250px minmax(350px, 1fr) 250px; gap: 12px; }
  .outreach-workspace .dialogs:not(.has-current) { grid-template-columns: 250px minmax(350px, 1fr); }
}
@media (max-width: 960px) {
  .outreach-tabs { gap: 0; font-size: 13px; margin-bottom: 24px; }
  .outreach-tabs > a { padding: 8px 10px 10px; }
  .outreach-workspace .page-head .muted::before { display: none; }
  .outreach-head .head-tools { margin-left: 0; }
  .outreach-more summary { padding: 6px 0; }
  .dialogs-page { display: block; }
  /* На телефоне колонки не помещаются: открытый диалог занимает экран целиком,
     карточка человека уезжает под ленту, список прячется. */
  .outreach-workspace .dialogs, .outreach-workspace .dialogs:not(.has-current) { grid-template-columns: minmax(0, 1fr); }
  .outreach-workspace .dialogs.has-current .dialog-col { display: none; }
  /* Диалог не выбран — на телефоне виден только список, без пустой панели. */
  .outreach-workspace .dialogs:not(.has-current) .dialog-thread { display: none; }
  .dialogs-bar { gap: 10px; }
  /* Фильтры в одну строку с прокруткой: страница не уезжает вбок. */
  .dialogs-bar .summary { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .dialogs-bar .summary::-webkit-scrollbar { display: none; }
  .dialogs-bar .summary a { flex: none; }
  .dlg-kinds { width: 100%; }
  .dialogs-bar .summary a { height: var(--h-sm); padding: 0 12px; font-size: var(--s1); }
  .outreach-workspace .dialogs.has-current .dialog-card { display: flex; max-height: none; overflow: visible; }
  .msg-bubble { max-width: 86%; }
  .message-stream { padding: 12px 10px 10px; }
  .dialog-thread-head { min-height: 52px; padding: 6px 8px 6px 4px; gap: 6px; }
  .dialog-back { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: var(--text); }
  .dialog-back:hover { background: var(--tint); }
  /* На телефоне площадка видна по значку, место — переключателю. */
  .thread-channel-l { display: none; }
  .thread-channel { padding: 0 7px; }
  .dialog-reply { padding: 7px 8px; }
  /* Открытый диалог на телефоне — как в мессенджере: чат на весь экран,
     шапка, вкладки и фильтры уходят, назад — стрелкой. Карточка человека —
     ниже чата, к ней ведёт имя в шапке. */
  body.dialogs-current .frame > .top, body.dialogs-current .outreach-tabs { display: none; }
  body.dialogs-current main.outreach-workspace { padding: 0; }
  body.dialogs-current .outreach-workspace .dialogs { gap: 0; }
  body.dialogs-current .outreach-workspace .dialog-thread {
    height: 100vh; height: 100dvh; min-height: 0; max-height: none; border: 0; border-radius: 0;
  }
  body.dialogs-current .outreach-workspace .dialog-card { margin: 12px; scroll-margin-top: 12px; }
  body.dialogs-current .flash { top: 60px; }
  .outreach-workspace .dialog-card { padding: 16px; }
  .context-inputs { grid-template-columns: 1fr; }
  .analysis-result-head { display: block; }
  .knowledge-count { display: block; margin-top: 8px; }
}

.dlg-card-meta { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: var(--s0); }
.dlg-card-meta .ico { color: var(--success, currentColor); }

/* --- «ИИ» одной страницей: числа сверху, загрузка, что читает. --- */
.ai-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--sp-4); }
.ai-stat {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
a.ai-stat:hover { border-color: hsl(var(--t-primary) / .45); }
.ai-stat > b { display: inline-flex; align-items: center; font-size: var(--s4); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.ai-stat > span { display: inline-flex; align-items: center; gap: 5px; font-size: var(--s0); color: var(--muted); }
.ai-stat.is-ok > b { color: var(--ok); }
.ai-stat.is-warn > b { color: hsl(var(--v-warn)); }
.ai-stat.is-bad > b { color: var(--bad-bright); }
.ai-load textarea { width: 100%; }
.ai-file input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ai-file { position: relative; }
.ai-file-name { font-size: var(--s1); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file.has-file { border-style: solid; border-color: hsl(var(--t-primary) / .6); }
.ai-file.has-file .ai-file-name { color: var(--accent); }
.ai-file:focus-within { box-shadow: var(--ring); }
.ai-load .pg-add-foot .pg-hint .icon { color: hsl(var(--v-warn)); }
.ai-kb { margin-top: var(--sp-4); }
.ai-kb-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; }
.ai-kb-list > li { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ai-kb-list > li + li { border-top: 1px solid var(--line); }
.ai-kb-list > li.is-off { opacity: .55; }
.ai-kb-list form { margin: 0; }
.ai-kb-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--tint); color: var(--muted); }
.ai-kb-ic.v-ok { background: var(--accent-tint); color: var(--accent); }
.ai-kb-ic.v-bad { background: hsl(var(--v-bad) / .12); color: var(--bad-bright); }
.ai-kb-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-kb-id b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-kb-id small { font-size: var(--s0); color: var(--muted); }
.ai-bad { color: var(--bad-bright); }
.ai-kb-list button.is-on { color: var(--ok); }
.ai-kb-docs > summary { list-style: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.ai-kb-docs > summary::-webkit-details-marker { display: none; }
.ai-kb-docs > summary:hover, .ai-kb-docs[open] > summary { background: var(--tint); color: var(--text); }
.ai-kb-read { position: absolute; z-index: 15; top: calc(100% - 4px); left: 12px; right: 12px; max-height: 360px; overflow: auto;
  padding: 8px; border-radius: 10px; background: hsl(var(--t-popover)); border: 1px solid var(--line-ctl); box-shadow: var(--shadow); }
.ai-kb-more { margin-top: var(--sp-3); }
.ai-kb-more > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--s1); color: var(--muted); }
.ai-kb-more > summary::-webkit-details-marker { display: none; }
.ai-kb-more > summary:hover { color: var(--text); }
.ai-kb-more .pg-kadd { margin-top: var(--sp-3); border: 1px solid var(--line); border-radius: 12px; }
.ai-kb-more .pg-add-form input, .ai-kb-more .pg-add-form textarea { width: 100%; }
.ai-link { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: var(--s1); overflow: hidden; }
.ai-link a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .ai-kb-more .pg-kadd { grid-template-columns: 1fr; } .ai-kb-more .pg-kadd > form + form { border-left: 0; border-top: 1px solid var(--line); } }
.context-form.ai-load { margin-bottom: 0; }

/* «Отправка»: свой список — кнопкой справа от состояния, а не блоком внизу. */
.snd-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: var(--sp-4); }
.snd-top > .pg-ohead { flex: 1; min-width: 0; margin-bottom: 0; }
.snd-import { position: relative; flex: none; }
.snd-import > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.snd-import > summary::-webkit-details-marker { display: none; }
.snd-import-pop {
  position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: 360px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px;
  background: hsl(var(--t-popover)); border: 1px solid var(--line-ctl); box-shadow: 0 18px 48px -16px hsl(var(--t-scrim) / .7);
}
.snd-import-pop .pg-hint { display: block; margin: 0; line-height: 1.5; }
.snd-import-pop > button { align-self: flex-start; }
.snd-import-pop textarea { width: 100%; min-height: 84px; resize: vertical; font-size: var(--s1); }
.snd-import-pop .pg-hint .icon { vertical-align: -2px; color: var(--accent); }
.snd-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px;
  border: 1px dashed var(--line-ctl); border-radius: 10px; cursor: pointer; text-align: center; color: var(--accent);
}
.snd-drop b { color: var(--text); font-weight: 600; font-size: var(--s1); overflow-wrap: anywhere; }
.snd-drop:hover, .snd-drop:focus-within { border-color: var(--accent); background: var(--accent-tint); }
.snd-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.snd-x { width: 32px; height: 32px; padding: 0; justify-content: center; }
.snd-x:hover { color: var(--bad-bright); }
@media (max-width: 700px) { .snd-top { flex-direction: column; } }
@media (max-width: 700px) { .outreach-tabs > a .icon { display: none; } .outreach-tabs > a { padding: 8px 8px 10px; } }

/* Переписка из другого места: ввод и проверка разбора. */
/* «Перенести переписку» — в строке кнопок слева; раскрытая уходит на всю ширину под кнопки. */
.dlg-paste-actions > .dlg-import { align-self: center; margin-right: auto; }
.dlg-paste-actions > .dlg-ai:has(+ .dlg-import:not([open])) { margin-right: 0; }
/* Узкая лента (меню развёрнуто): от ссылки остаётся скрепка с подсказкой, кнопки в одну строку. */
.outreach-workspace .dialog-thread { container-type: inline-size; }
@container (max-width: 560px) { .dlg-import:not([open]) .dlg-import-l { display: none; } }
.dlg-paste-actions > .dlg-import[open] { order: 10; flex-basis: 100%; margin: 4px 0 0; max-height: 45vh; overflow: auto; }
.dlg-import > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: var(--s0); color: var(--muted); }
.dlg-import > summary::-webkit-details-marker { display: none; }
.dlg-import > summary:hover { color: var(--text); }
.dlg-import-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dlg-import-form textarea { width: 100%; resize: vertical; font-size: var(--s1); }
.dlg-imp { margin: 8px 0; padding: 12px 14px; border: 1px solid hsl(var(--t-primary) / .35); border-radius: var(--r-card); background: var(--accent-tint); display: flex; flex-direction: column; gap: 10px; }
.dlg-imp-h { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--s1); }
.dlg-imp-h .muted { font-size: var(--s0); }
.dlg-imp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.dlg-imp-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 10px; border-radius: var(--r-ctl); background: var(--card); border: 1px solid var(--line); }
.dlg-imp-list li.is-us { border-left: 3px solid var(--accent); }
.dlg-imp-list li.is-blogger { border-left: 3px solid var(--info); }
.dlg-imp-list li.is-dup { opacity: .55; }
.dlg-imp-who { display: inline-flex; border: 1px solid var(--line-ctl); border-radius: 999px; overflow: hidden; font-size: 11.5px; }
.dlg-imp-who label { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; cursor: pointer; color: var(--muted); }
.dlg-imp-who label + label { border-left: 1px solid var(--line-ctl); }
.dlg-imp-who input { position: absolute; opacity: 0; pointer-events: none; }
.dlg-imp-who label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.dlg-imp-who label:has(input[value=skip]:checked) { background: var(--tint); color: var(--text); }
.dlg-imp-who label:focus-within { box-shadow: var(--ring); }
.dlg-imp-text { font-size: var(--s1); line-height: 1.45; white-space: pre-wrap; display: flex; flex-direction: column; gap: 3px; }
.dlg-imp-text small { color: var(--muted); font-size: 12px; }
.dlg-imp-dup { color: var(--warn-ink) !important; }
.dlg-imp-foot { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 640px) { .dlg-imp-list li { grid-template-columns: minmax(0, 1fr); } }
.msg-photo { display: block; margin: 0 0 6px; border-radius: 10px; overflow: hidden; max-width: 260px; border: 1px solid var(--line); }
.msg-photo img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; }
.msg-audio { display: block; width: 260px; max-width: 100%; height: 36px; margin: 4px 0 6px; }

.pg-fate { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: var(--sp-3, 12px) 0 0; font-size: 13px; color: hsl(var(--t-muted-foreground)); }
.pg-fate b { color: hsl(var(--t-foreground)); }

/* Варианты от ИИ: нажал на вариант — он в поле ввода. */
.dlg-variants { flex: none; max-height: 36vh; overflow-y: auto; margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--card); }
.dlg-variants-meaning { display: flex; gap: 6px; align-items: flex-start; margin: 0 2px 6px; color: var(--muted); font-size: var(--s0); line-height: 1.4; }
.dlg-variants-meaning .icon { flex: none; margin-top: 1px; color: var(--accent); }
.dlg-variants ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dlg-variant {
  display: flex; width: 100%; height: auto; min-height: 0; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--tint); box-shadow: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.dlg-variant:hover { border-color: hsl(var(--t-primary) / .5); background: hsl(var(--t-primary) / .07); }
.dlg-variant-how { color: var(--muted); font-size: 10.5px; font-weight: 600; }
.dlg-variant-text { font-size: var(--s1); line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }

/* «Чем закончить разговор» в настройках ИИ */
.ai-goal { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; }
.ai-goal legend { margin-bottom: 4px; }
.ai-goal label { display: flex; align-items: center; gap: 8px; font-size: var(--s1); }
.ai-goal input[name=goal_text], .ai-goal textarea { width: 100%; }
