/*
 * Стили, которых нет в style.css: чат, список документов, результаты поиска.
 * Отдельный файл, чтобы style.css оставался общим для всех сервисов.
 */

.tabs { grid-template-columns: repeat(4, 1fr); }

/* ── ШИРИНА СТРАНИЦЫ ── */
.wrapper { max-width: 1400px; padding-top: 24px; }
header { margin-bottom: 20px; }
.tabs { max-width: 860px; margin-left: auto; margin-right: auto; margin-bottom: 20px; }
#panel-docs, #panel-search, #panel-about, #panel-admin { max-width: 860px; margin: 0 auto; }

/* ── ЧАТ: раскладка ── */
.chat-layout {
  display: grid; grid-template-columns: 270px 1fr;
  height: calc(100vh - 230px); min-height: 480px;
  background: var(--bg-card); border: 3px solid var(--orange);
  border-radius: 15px; overflow: hidden;
  box-shadow: 0 0 10px var(--orange-dim), 0 0 40px rgba(255,140,0,0.07);
}
.chat-layout.collapsed { grid-template-columns: 0 1fr; }
.chat-layout.collapsed .chat-sidebar { visibility: hidden; }

/* боковая панель */
.chat-sidebar {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 14px; border-right: 1px solid var(--border-dim);
  background: rgba(0,0,0,0.18);
}
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-right: -6px; padding-right: 6px; }
.chat-list-group {
  font-family: 'Oswald', sans-serif; font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: #777; margin: 10px 0 4px 8px;
}
.chat-item {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.chat-item:hover { background: var(--orange-faint); }
.chat-item.active { background: rgba(255,165,0,0.14); border-color: rgba(255,165,0,0.4); }
.chat-item-title {
  flex: 1; min-width: 0; font-size: 13px; color: #e0e0e0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item.active .chat-item-title { color: #fff; }
.chat-item-actions { display: none; gap: 2px; }
.chat-item:hover .chat-item-actions, .chat-item.active .chat-item-actions { display: flex; }
.chat-item input {
  flex: 1; min-width: 0; padding: 3px 6px; font-size: 13px;
  border-radius: 5px; border-width: 1px;
}

.icon-btn {
  background: none; border: 1px solid transparent; color: var(--muted);
  border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1;
  padding: 4px 6px; transition: all 0.15s;
}
.icon-btn:hover { color: var(--orange); border-color: var(--border-dim); }

/* основная колонка */
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border-dim);
}
.chat-title {
  font-family: 'Oswald', sans-serif; font-size: 14px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--orange);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chat-log {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 24px max(24px, calc((100% - 860px) / 2));
  display: flex; flex-direction: column; gap: 22px;
}
.chat-empty {
  margin: auto; text-align: center; color: var(--muted);
  font-family: 'Oswald', sans-serif; font-size: 13px;
  letter-spacing: 2px; text-transform: uppercase; opacity: 0.6; line-height: 2;
}

/* сообщения */
.msg { animation: fadeIn 0.25s ease; min-width: 0; }
.msg-role {
  font-family: 'Oswald', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--orange); margin-bottom: 6px; opacity: 0.8;
}
.msg-body { font-size: 15px; line-height: 1.7; word-break: break-word; }
.msg.user { align-self: flex-end; max-width: 75%; }
.msg.user .msg-role { text-align: right; }
.msg.user .msg-body {
  background: var(--orange-faint); border: 1px solid rgba(255,165,0,0.35);
  border-radius: 14px 14px 4px 14px; padding: 10px 16px; white-space: pre-wrap;
}
/* ответ агента — без пузыря, на всю ширину колонки, как в документе */
.msg.assistant { align-self: stretch; }
.msg.error .msg-body { color: var(--error); }

/* поле ввода */
.composer {
  display: flex; align-items: flex-end; gap: 10px;
  margin: 0 max(24px, calc((100% - 860px) / 2)) 0;
  background: var(--bg-input); border: 2px solid var(--border-dim);
  border-radius: 14px; padding: 8px 8px 8px 14px; transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,165,0,0.15); }
.composer textarea {
  flex: 1; border: none; background: none; box-shadow: none !important;
  padding: 6px 0; min-height: 0; max-height: 220px; resize: none;
  font-size: 15px; line-height: 1.5;
}
.send-btn {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: linear-gradient(to bottom, #ffa500, #dc6d04); color: #fff;
  font-size: 16px; cursor: pointer; transition: transform 0.15s, opacity 0.15s;
}
.send-btn:hover { transform: scale(1.06); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.send-btn.stop { background: #555; font-size: 13px; }

/* markdown внутри ответа */
.msg-body p { margin: 0 0 8px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 4px 0 8px 22px; }
.msg-body h1, .msg-body h2, .msg-body h3 {
  font-family: 'Oswald', sans-serif; color: var(--orange);
  font-size: 15px; letter-spacing: 1px; margin: 10px 0 6px;
}
.msg-body code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(255,165,0,0.1); color: #ffcc66;
  padding: 1px 5px; border-radius: 3px;
}
.msg-body pre {
  background: #111315; border: 1px solid #333; border-radius: 8px;
  padding: 12px; overflow-x: auto; margin: 8px 0;
}
.msg-body pre code { background: none; padding: 0; color: #e0e0e0; }
.msg-body a { color: var(--orange); }
.msg-body table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.msg-body th, .msg-body td { border: 1px solid var(--border-dim); padding: 4px 8px; }

/* рассуждения и вызовы инструментов */
.trace {
  margin-bottom: 8px; border: 1px dashed var(--border-dim);
  border-radius: 8px; background: rgba(0,0,0,0.2);
}
.trace summary {
  cursor: pointer; padding: 7px 12px; list-style: none;
  font-family: 'Oswald', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase; color: var(--muted);
}
.trace summary::-webkit-details-marker { display: none; }
.trace summary::before { content: '▸ '; color: var(--orange); }
.trace[open] summary::before { content: '▾ '; }
.trace-body {
  padding: 0 12px 10px; font-family: var(--mono); font-size: 11px;
  color: #999; white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow-y: auto;
}
.trace.tool { border-color: rgba(255,165,0,0.35); }
.trace.tool summary { color: var(--orange); }

.typing::after {
  content: '▋'; color: var(--orange);
  animation: blink 1s steps(1) infinite; margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

.chat-hint {
  font-size: 10px; color: #666; letter-spacing: 1px; text-align: center;
  font-family: 'Oswald', sans-serif; text-transform: uppercase; padding: 6px 0 10px;
}

/* ── ДОКУМЕНТЫ ── */
.doc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.doc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg); border: 1px solid var(--border-dim);
  border-radius: 8px; padding: 10px 14px; transition: border-color 0.2s;
}
.doc-item:hover { border-color: var(--orange); }
.doc-name { font-family: var(--mono); font-size: 13px; color: #e0e0e0; word-break: break-all; }
.doc-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── ПОИСК ── */
.search-row { display: grid; grid-template-columns: 1fr 130px 90px; gap: 12px; }
.hit {
  background: var(--bg); border: 1px solid var(--border-dim);
  border-radius: 8px; padding: 12px 14px; margin-top: 10px;
}
.hit-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--orange); margin-bottom: 6px;
}
.hit-text { font-size: 13px; line-height: 1.6; color: #d0d0d0; white-space: pre-wrap; }

/* на узких экранах список чатов выезжает поверх */
@media (max-width: 860px) {
  .chat-layout, .chat-layout.collapsed { grid-template-columns: 1fr; position: relative; height: calc(100vh - 200px); }
  .chat-sidebar {
    position: absolute; inset: 0 auto 0 0; width: 270px; z-index: 5;
    background: var(--bg-card); box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .chat-layout.collapsed .chat-sidebar { visibility: hidden; }
  .chat-log { padding: 16px; }
  .composer { margin: 0 12px; }
  .msg.user { max-width: 90%; }
}
@media (max-width: 640px) {
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .search-row { grid-template-columns: 1fr; }
}

.status { white-space: pre-line; }

/* ── ВХОД ── */
[hidden] { display: none !important; }
.auth-screen {
  position: relative; z-index: 1; min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-card form { text-align: left; margin-top: 22px; }
.auth-switch {
  display: grid; grid-template-columns: 1fr 1fr; margin-top: 24px;
  border: 2px solid var(--orange); border-radius: 10px; overflow: hidden;
}
.auth-switch button, .seg button {
  background: var(--bg-card); color: var(--muted); border: none; cursor: pointer;
  font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 1.5px;
  text-transform: uppercase; padding: 10px; transition: all 0.2s;
}
.auth-switch button + button { border-left: 1px solid var(--border-dim); }
.auth-switch button.active, .seg button.active {
  background: linear-gradient(to bottom, #ffa500, #dc6d04); color: #fff;
}

/* ── ПОЛЬЗОВАТЕЛЬ В ШАПКЕ ── */
header { position: relative; }
.user-box {
  position: absolute; top: 0; right: 0; display: flex; align-items: center; gap: 10px;
}
.user-name {
  font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
}
.user-name .pill { margin-left: 6px; }

/* ── ПЕРЕКЛЮЧАТЕЛЬ ОБЛАСТИ ПОИСКА ── */
.seg {
  display: flex; flex-shrink: 0; border: 1px solid var(--border-dim);
  border-radius: 8px; overflow: hidden;
}
.seg button { font-size: 10px; padding: 6px 10px; letter-spacing: 1px; }
.seg button + button { border-left: 1px solid var(--border-dim); }
.seg button:not(.active):hover { color: var(--orange); background: var(--orange-faint); }

/* ── СЧЁТЧИК КОНТЕКСТА ── */
.chat-topbar .chat-title { flex: 1; min-width: 0; }
.ctx-meter { flex-shrink: 0; width: 150px; cursor: help; }
.ctx-label {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  text-align: right; margin-bottom: 4px; white-space: nowrap;
}
.ctx-bar { height: 4px; background: var(--border-dim); border-radius: 2px; overflow: hidden; }
.ctx-fill {
  height: 100%; width: 0; border-radius: 2px; background: var(--success);
  transition: width 0.3s, background 0.3s;
}
.ctx-fill.warn { background: var(--orange); }
.ctx-fill.full { background: var(--error); }
.msg-usage {
  font-family: var(--mono); font-size: 10px; color: #666; margin-top: 8px;
}

/* ── ДОКУМЕНТЫ И АДМИНКА ── */
.pill {
  display: inline-block; font-family: 'Oswald', sans-serif; font-size: 9px;
  letter-spacing: 1px; text-transform: uppercase; padding: 1px 7px; border-radius: 4px;
  border: 1px solid var(--border-dim); color: var(--muted); vertical-align: middle;
}
.pill.public { border-color: rgba(125,255,138,0.4); color: var(--success); }
.pill.admin  { border-color: var(--orange); color: var(--orange); }
.pill.off    { opacity: 0.5; }
/* не больше 4 кнопок в ряд: пятая и далее переносятся вниз */
.doc-actions { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; flex-shrink: 0; justify-content: end; }
.doc-actions a { text-decoration: none; }
.doc-actions .copy-btn, .doc-actions a, .doc-actions select { text-align: center; white-space: nowrap; }
@media (max-width: 640px) { .doc-actions { grid-template-columns: repeat(2, 1fr); } }
.copy-btn.on { border-color: rgba(125,255,138,0.5); color: var(--success); }
.copy-btn.danger:hover { border-color: var(--error); color: var(--error); }
.invite-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 6px; }
.invite-row .field { margin-bottom: 0; width: 140px; }
.invite-row .btn { width: auto; }
.invite-code { font-family: var(--mono); font-size: 15px; letter-spacing: 2px; color: #fff; }
.empty-note { font-size: 12px; color: #666; padding: 4px 2px; }

@media (max-width: 860px) {
  .ctx-meter { width: 90px; }
  .user-box { position: static; justify-content: center; margin-bottom: 12px; }
}
@media (max-width: 640px) {
  .chat-topbar { flex-wrap: wrap; }
  .chat-topbar .chat-title { flex-basis: calc(100% - 50px); }
  .ctx-meter { flex: 1; width: auto; }
}

/* ── АДМИНКА: промпт и инструменты ── */
.code-area {
  font-family: var(--mono) !important; font-size: 12px !important; line-height: 1.55;
  tab-size: 4; white-space: pre; overflow-x: auto;
}
.btn-ghost {
  background: transparent; border: 2px solid var(--orange); color: var(--orange); box-shadow: none;
}
.btn-ghost:hover { background: var(--orange-faint); }
.tool-output {
  margin-top: 12px; background: #111315; border: 1px solid #333; border-radius: 8px;
  padding: 12px; font-family: var(--mono); font-size: 12px; color: #d0d0d0;
  white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow-y: auto;
}
.tool-output.ok { border-color: rgba(125,255,138,0.4); }
.tool-output.err { border-color: rgba(255,107,53,0.5); color: #ffaa80; }
.tool-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.pill.builtin { border-color: #666; color: #aaa; }

/* ── ПАМЯТЬ ── */
.memory-add { display: flex; gap: 8px; margin-top: 10px; }
.memory-add input { flex: 1; }
.memory-fact { font-size: 13px; color: #e0e0e0; line-height: 1.5; }

/* ── ФОРМУЛЫ ── */
.msg-body .katex { font-size: 1.08em; }
.msg-body .katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ── ЧАСОВОЙ ПОЯС ── */
.tz-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tz-current { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 13px; color: #e0e0e0; }
.tz-row input { width: 90px; }

/* ── ВЛОЖЕНИЯ В ЧАТЕ ── */
.msg-attachments { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.msg-attachments:empty { display: none; }
.attach-card {
  display: flex; align-items: center; gap: 12px; max-width: 460px;
  background: var(--bg); border: 1px solid rgba(255,165,0,0.4); border-radius: 10px;
  padding: 10px 12px; transition: border-color 0.2s;
}
.attach-card:hover { border-color: var(--orange); }
.attach-icon { font-size: 22px; }
.attach-name { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-card .copy-btn { text-decoration: none; }
.hit-source { cursor: pointer; text-decoration: underline dotted; }
.hit-source:hover { color: #fff; }

/* ── ОКНО ПРЕДПРОСМОТРА ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal {
  width: min(960px, 100%); height: min(88vh, 1100px); display: flex; flex-direction: column;
  background: var(--bg-card); border: 3px solid var(--orange); border-radius: 15px; overflow: hidden;
  box-shadow: 0 0 40px rgba(255,140,0,0.15);
}
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-dim);
}
.modal-head .copy-btn { text-decoration: none; }
.modal-title {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; color: var(--orange);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-body { flex: 1; overflow: auto; padding: 24px 32px; }
.modal-body.msg-body { font-size: 15px; }
.modal-body pre.plain { white-space: pre-wrap; word-break: break-word; font-family: var(--mono);
  font-size: 13px; line-height: 1.6; color: #e0e0e0; }
.modal-body.pdf { padding: 0; }
.modal-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-note { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
@media (max-width: 640px) {
  .modal-backdrop { padding: 0; }
  .modal { height: 100vh; border-radius: 0; border-width: 0; }
  .modal-body { padding: 16px; }
}

/* ── КАРТИНКИ ── */
.attach-btn { font-size: 18px; padding: 8px; align-self: flex-end; margin-bottom: 2px; }
.composer-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pending-images { display: flex; gap: 8px; flex-wrap: wrap; }
.pending-images:empty { display: none; }
.pending-thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border-dim); }
.pending-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pending-thumb button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.7); color: #fff; font-size: 11px; cursor: pointer; line-height: 1; }
.composer.drag-over { border-color: var(--orange); background: var(--orange-faint); }
.msg-images { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 8px; }
.msg-images img { max-width: 220px; max-height: 180px; border-radius: 10px; border: 1px solid var(--border-dim);
  cursor: zoom-in; display: block; object-fit: cover; }
.msg.user .msg-traces { display: flex; flex-direction: column; align-items: stretch; }
.trace.vision { border-color: rgba(125,255,138,0.35); }
.trace.vision summary { color: var(--success); }
.modal-body.image { display: flex; align-items: center; justify-content: center; background: #111315; }
.modal-body.image img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ── Список чатов: при большом количестве прокручивается только список ──
   Без min-height: 0 элементы flex/grid не могут стать меньше своего содержимого,
   и длинный список выдавливал кнопку «Новый чат» вверх за границу блока. */
.chat-layout { grid-template-rows: minmax(0, 1fr); }
.chat-sidebar { min-height: 0; overflow: hidden; }
.chat-sidebar > .btn { flex-shrink: 0; }
.chat-list { min-height: 0; }
.chat-list-group, .chat-item { flex-shrink: 0; }

/* ── под полем ввода: уровень рассуждений + подсказка ── */
.composer-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 max(24px, calc((100% - 860px) / 2)); padding: 6px 0 10px;
}
.composer-foot .chat-hint { padding: 0; text-align: left; flex: 1; }
.seg-sm button { font-size: 9px; padding: 4px 9px; }
.history-note {
  align-self: center; font-family: 'Oswald', sans-serif; font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: #888; border: 1px dashed var(--border-dim); border-radius: 6px; padding: 4px 10px;
}
@media (max-width: 860px) { .composer-foot { margin: 0 12px; } }

/* ── ДОКУМЕНТЫ: папки, фильтр, страницы ── */
.upload-target { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.upload-target label { margin: 0; white-space: nowrap; }
.upload-target select { max-width: 360px; }
.folder-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.folder-chip {
  background: var(--bg); border: 1px solid var(--border-dim); color: var(--muted); border-radius: 16px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; transition: all 0.15s; font-family: 'Roboto', sans-serif;
}
.folder-chip:hover { border-color: var(--orange); color: #fff; }
.folder-chip.active { background: rgba(255,165,0,0.14); border-color: var(--orange); color: #fff; }
.folder-chip .n { color: #777; margin-left: 4px; font-size: 11px; }
.folder-chip.add { border-style: dashed; }
.folder-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px;
  padding: 8px 10px; border: 1px dashed var(--border-dim); border-radius: 8px;
}
.folder-tools-name { flex: 1; min-width: 120px; font-size: 13px; color: #e0e0e0; }
.doc-filter { margin-bottom: 4px; }
.doc-item select.move { width: auto; padding: 3px 6px; font-size: 11px; border-width: 1px; border-radius: 4px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.pager:empty { display: none; }
.pager .info { font-family: 'Oswald', sans-serif; font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.pill.system { border-color: #8ab4ff; color: #8ab4ff; }
.pill.pinned { border-color: var(--orange); color: var(--orange); }

/* ── Запросы на правку, версии ── */
[hidden] { display: none !important; }
.chat-item.inbox { border-color: rgba(255,165,0,0.25); margin-bottom: 8px; }
.chat-item.inbox .chat-item-title { color: var(--orange); }
.count-badge, .tab-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--orange); color: #111; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tab-badge { margin-left: 6px; vertical-align: middle; }
.inbox-note {
  margin: 0 16px 16px; padding: 12px 16px; font-size: 13px; color: var(--muted);
  border: 1px dashed var(--border-dim); border-radius: 10px;
}
.msg.notice .msg-body {
  border-left: 3px solid var(--orange); padding: 10px 14px; background: var(--orange-faint); border-radius: 0 10px 10px 0;
}
.msg-body blockquote { margin: 6px 0; padding: 4px 12px; border-left: 2px solid var(--border-dim); color: #cfcfcf; }
.req-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.req-status { font-size: 12px; color: var(--muted); margin-right: 4px; }
.req-status.pending { color: var(--orange); }
.req-status.accepted { color: var(--success); }
.req-status.rejected, .req-status.stale { color: var(--error); }
.copy-btn.on { border-color: var(--success); color: var(--success); }
.pill.pending { border-color: var(--orange); color: var(--orange); }

.req-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.req-summary { font-size: 14px; line-height: 1.6; }
.req-tabs { align-self: flex-start; }
.req-actions { display: flex; gap: 8px; margin-top: 16px; }
.diff { font-family: var(--mono); font-size: 12px; line-height: 1.6; border: 1px solid var(--border-dim); border-radius: 8px; overflow: hidden; }
.diff .dl { padding: 0 12px; white-space: pre-wrap; word-break: break-word; }
.diff .dl.add { background: rgba(125,255,138,0.10); color: #b9ffc0; }
.diff .dl.del { background: rgba(255,107,53,0.12); color: #ffb59a; text-decoration: line-through; text-decoration-color: rgba(255,107,53,0.5); }
.diff .dl.hunk { color: var(--muted); background: rgba(255,255,255,0.03); text-align: center; }
.diff-add { color: var(--success); }
.diff-del { color: var(--error); }
.ver-list { display: flex; flex-direction: column; gap: 8px; }
.ver-list .doc-item.current { border-color: rgba(125,255,138,0.4); }
.modal-body .back { margin-bottom: 16px; }

/* ── Полосы прокрутки внутри интерфейса — в тёмной гамме, а не белые системные ── */
body * { scrollbar-width: thin; scrollbar-color: rgba(255,165,0,0.45) transparent; }
body *::-webkit-scrollbar { width: 8px; height: 8px; }
body *::-webkit-scrollbar-track { background: transparent; }
body *::-webkit-scrollbar-thumb { background: rgba(255,165,0,0.35); border-radius: 6px; }
body *::-webkit-scrollbar-thumb:hover { background: rgba(255,165,0,0.6); }
body *::-webkit-scrollbar-corner { background: transparent; }

/* ── Блокировка, склад, ручной редактор ── */
.pill.banned { border-color: var(--error); color: var(--error); }
.doc-item.banned { opacity: 0.75; }
.wh-owner { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 14px 0 4px; }
.wh-owner:first-child { margin-top: 0; }
.wh-reqs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.wh-req { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.wh-req span { flex: 1; min-width: 0; }
.req-view.editor { display: flex; flex-direction: column; gap: 10px; }
.req-view.editor[hidden] { display: none !important; }
.req-view.editor .ed-text { min-height: 52vh; resize: vertical; font-size: 13px; line-height: 1.6; }
.req-view.editor .field { margin: 0; }

/* ── Карантин ── */
.pill.quarantine { border-color: var(--error); color: var(--error); }
.q-findings { margin: 8px 0 0 18px; font-size: 12px; color: #cfcfcf; line-height: 1.5; }
.q-findings li { margin-bottom: 2px; word-break: break-word; }
.doc-item.q-doc { flex-direction: column; align-items: stretch; gap: 10px; }
.doc-item.q-doc > div:first-child { width: 100%; }
.doc-item.q-doc .doc-actions { justify-content: start; }

/* ── Предупреждение: правка после чтения чужого документа ── */
.taint-warn {
  margin: 10px 0 0; padding: 10px 14px; border: 1px solid var(--error); border-radius: 10px;
  background: rgba(255,107,53,0.10); color: #ffcfb8; font-size: 13px; line-height: 1.55;
}
.modal-body .taint-warn { margin: 0 0 16px; }

/* ── Файлы, перетащенные в чат для индексации ── */
.pending-images { align-items: center; }
.pending-file {
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
  padding: 5px 8px 5px 10px; border: 1px solid var(--border-dim); border-radius: 8px;
  background: var(--bg); font-size: 12px; color: #e0e0e0;
}
.pending-file .pf-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-file .pf-size { color: var(--muted); flex-shrink: 0; }
.pending-file button {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.08); color: #ccc; font-size: 11px; line-height: 1;
}
.pending-file button:hover { background: var(--error); color: #fff; }
