/* ===== Инкаб ИИ — интерфейс в духе Claude ===== */
:root {
  --bg: #f7f6f4;
  --surface: #ffffff;
  --surface-2: #f0edea;
  --ink: #221f1f;
  --ink-2: #5f5955;
  --ink-3: #8d857f;
  --line: #e4dfda;
  --accent: #e31e24;
  --accent-ink: #c4161c;
  --accent-soft: #fbe9ea;
  --user-bubble: #ece8e3;
  --ok: #2e7d4f;
  --warn: #b36b0b;
  --shadow: 0 8px 30px rgba(34, 31, 31, .10);
  --radius: 16px;
  --sb-w: 280px;
  --dp-w: 46%;
}
[data-theme="dark"] {
  --bg: #1c1a18;
  --surface: #252220;
  --surface-2: #2f2b28;
  --ink: #ece8e4;
  --ink-2: #b5ada6;
  --ink-3: #857d76;
  --line: #3a3532;
  --accent: #f0464b;
  --accent-ink: #ff6b6f;
  --accent-soft: #3d2526;
  --user-bubble: #332f2c;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15.5px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

/* ---------- Вход ---------- */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 36px 32px; text-align: center; box-shadow: var(--shadow);
}
.login-logo { width: 56px; height: 56px; }
.login h1 { margin: 12px 0 6px; font-size: 26px; }
.login-sub { color: var(--ink-2); margin: 0 0 20px; font-size: 14.5px; }
.login input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); margin-bottom: 12px; font-family: ui-monospace, Consolas, monospace;
}
.login-status { min-height: 20px; color: var(--accent-ink); font-size: 14px; margin-top: 10px; }
.login-status.ok { color: var(--ok); }
.login-note { color: var(--ink-3); font-size: 12.5px; margin: 18px 0 0; }
.btn-primary {
  background: var(--accent); color: #fff; border-radius: 12px; padding: 11px 18px; font-weight: 600; width: 100%;
}
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger { color: var(--accent-ink); }

/* ---------- Каркас ---------- */
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- Боковая панель ---------- */
.sidebar {
  width: var(--sb-w); flex: 0 0 var(--sb-w); background: var(--surface-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transition: margin .2s ease; min-height: 0;
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sb-w)); }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 14px 8px; }
.sb-logo { width: 26px; height: 26px; }
.sb-brand { font-weight: 700; flex: 1; }
.sb-new {
  margin: 6px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); text-align: left; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.sb-new:hover { border-color: var(--ink-3); }
.sb-new .plus { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; align-items: center; justify-content: center; font-size: 17px; line-height: 1; }
.sb-search { padding: 4px 12px 8px; }
.sb-search input {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px;
}
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; min-height: 0; }
.chat-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 14px 8px 6px; }
.chat-item {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 14px;
  color: var(--ink-2);
}
.chat-item:hover { background: var(--surface); }
.chat-item.active { background: var(--surface); color: var(--ink); font-weight: 600; }
.chat-item .t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .acts { display: none; gap: 2px; }
.chat-item:hover .acts, .chat-item.active .acts { display: flex; }
.chat-item .acts button { width: 24px; height: 24px; border-radius: 6px; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; }
.chat-item .acts button:hover { background: var(--surface-2); color: var(--ink); }
.chat-item .acts svg { width: 14px; height: 14px; }
.chat-item input.rename { width: 100%; padding: 4px 8px; border: 1px solid var(--accent); border-radius: 8px; background: var(--surface); font-size: 14px; font-weight: 400; outline: 0; }
.chat-empty { color: var(--ink-3); font-size: 13.5px; padding: 16px 10px; }
.sb-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sb-foot-btn { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-size: 14px; flex: 1; }
.sb-foot-btn:hover { background: var(--surface); color: var(--ink); }
.sb-user { width: 100%; color: var(--ink-3); font-size: 12.5px; padding: 2px 10px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Основная область ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 52px; }
.chat-title { flex: 1; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; padding: 4px 8px; border-radius: 8px; }
.chat-title:hover { background: var(--surface-2); }
.chat-title input { width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.main.empty .chat-title { visibility: hidden; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.topbar-link { color: var(--ink-3); text-decoration: none; }
.topbar-link:hover { color: var(--ink); }
.warn { color: var(--warn); }
.spacer { flex: 0 0 0; transition: flex .2s; }
.main.empty .spacer { flex: 1 1 0; }
.main.empty .thread { display: none; }

.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg, .ico svg { width: 18px; height: 18px; }
.ico { display: inline-flex; }

/* ---------- Лента ---------- */
.thread { flex: 1; overflow-y: auto; min-height: 0; }
.messages { max-width: 780px; margin: 0 auto; padding: 8px 20px 24px; }
.msg { margin: 18px 0; display: flex; gap: 12px; }
.msg.user { justify-content: flex-end; }
.msg-avatar { width: 28px; height: 28px; flex: 0 0 28px; margin-top: 4px; }
.msg-col { min-width: 0; max-width: 100%; flex: 1; }
.msg.user .msg-col { max-width: 80%; flex: 0 1 auto; }
.bubble {
  background: var(--user-bubble); border-radius: 18px 18px 4px 18px; padding: 11px 16px; white-space: pre-wrap; word-wrap: break-word;
}
.msg.assistant .msg-body { padding-top: 4px; }
.msg.error .msg-body { color: var(--accent-ink); }
.files { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.files span { font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.edit-box textarea { width: 100%; min-height: 80px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); resize: vertical; }
.edit-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.edit-actions button { padding: 7px 12px; border-radius: 10px; font-size: 13.5px; }
.edit-actions .save { background: var(--accent); color: #fff; }
.edit-actions .cancel { border: 1px solid var(--line); }

.msg-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg.last .msg-actions { opacity: 1; }
.msg.user .msg-actions { justify-content: flex-end; }
.msg-actions button {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 8px; color: var(--ink-3); font-size: 12.5px;
}
.msg-actions button:hover { background: var(--surface-2); color: var(--ink); }
.msg-actions svg { width: 15px; height: 15px; }
.msg-usage { color: var(--ink-3); font-size: 12px; margin-top: 2px; }

.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cursor-blink { display: inline-block; width: 8px; height: 1.1em; background: var(--accent); vertical-align: text-bottom; margin-left: 2px; animation: blink 1s infinite; }

/* размышления рассуждающей модели */
.think { margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); }
.think summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; user-select: none; color: var(--ink-2); }
.think summary::-webkit-details-marker { display: none; }
.think summary svg { width: 15px; height: 15px; flex: 0 0 15px; }
.think summary svg:last-child { margin-left: auto; transition: transform .15s; }
.think[open] summary svg:last-child { transform: rotate(180deg); }
.think-label { font-weight: 600; }
.think-body { padding: 0 12px 10px; white-space: pre-wrap; max-height: 260px; overflow-y: auto; line-height: 1.5; font-size: 13px; }

/* markdown */
.msg-body p { margin: 0 0 10px; }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 { margin: 16px 0 8px; line-height: 1.25; }
.msg-body h1 { font-size: 20px; } .msg-body h2 { font-size: 18px; } .msg-body h3 { font-size: 16px; } .msg-body h4 { font-size: 15px; }
.msg-body ul, .msg-body ol { margin: 0 0 10px; padding-left: 24px; }
.msg-body li { margin: 3px 0; }
.msg-body blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--accent); color: var(--ink-2); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.msg-body code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.msg-body hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.codeblock { position: relative; margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.codeblock-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--surface-2); font-size: 12px; color: var(--ink-3); }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.codeblock code { background: none; padding: 0; font-size: 13px; }
.copy-code { font-size: 12px; color: var(--ink-2); padding: 2px 8px; border-radius: 6px; }
.copy-code:hover { background: var(--surface); color: var(--ink); }
.tbl-wrap { overflow-x: auto; margin: 10px 0; }
.msg-body table { border-collapse: collapse; font-size: 14px; min-width: 50%; }
.msg-body th, .msg-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.msg-body th { background: var(--surface-2); }

/* ---------- Источники ---------- */
.sources { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.sources-h { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sources-h svg { width: 15px; height: 15px; flex: 0 0 15px; }
.sources-h .cnt { background: var(--surface-2); border-radius: 999px; padding: 0 8px; font-size: 11.5px; }
.src-list { display: flex; flex-direction: column; gap: 6px; }
.src-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-areas: "n ico main match acts" "snip snip snip snip snip";
  align-items: center; column-gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface);
}
.src-row:hover { border-color: var(--ink-3); }
.src-n { grid-area: n; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.src-ico { grid-area: ico; width: 32px; height: 38px; border-radius: 6px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .03em; color: var(--ink-2); }
.src-ico.pdf { color: #fff; background: var(--accent); }
.src-ico.docx, .src-ico.doc { color: #fff; background: #2b579a; }
.src-ico.xlsx, .src-ico.xls { color: #fff; background: #217346; }
.src-main { grid-area: main; min-width: 0; }
.src-name { font-weight: 600; font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; cursor: pointer; }
.src-name:hover { color: var(--accent-ink); }
.src-meta { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-match { grid-area: match; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12px; color: var(--ink-3); min-width: 44px; }
.src-match i { display: block; width: 44px; height: 3px; border-radius: 2px; background: var(--surface-2); position: relative; overflow: hidden; }
.src-match i::after { content: ""; position: absolute; inset: 0; width: var(--w, 0); background: var(--accent); }
.src-actions { grid-area: acts; display: flex; gap: 4px; }
.src-actions button { font-size: 12.5px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.src-actions button:hover { background: var(--surface-2); color: var(--ink); }
.src-actions button.on { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.src-actions svg { width: 13px; height: 13px; }
.src-snippet { grid-area: snip; margin-top: 8px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 4px 12px; }
.src-snippet p { margin: 6px 0; padding-left: 10px; border-left: 2px solid var(--line); }
.src-empty { color: var(--ink-3); font-size: 13.5px; }

/* ---------- Панель документа ---------- */
.docpanel { width: var(--dp-w); flex: 0 0 var(--dp-w); min-width: 380px; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.dp-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dp-title { flex: 1; min-width: 0; }
.dp-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-actions { display: flex; gap: 2px; }
.dp-body { flex: 1; min-height: 0; background: var(--surface-2); display: flex; }
.dp-body iframe { flex: 1; border: 0; width: 100%; height: 100%; background: #fff; }
.dp-loading { margin: auto; color: var(--ink-3); font-size: 14px; text-align: center; padding: 20px; }
.dp-text { flex: 1; margin: 0; padding: 16px; overflow: auto; white-space: pre-wrap; font: 13.5px/1.5 ui-monospace, Consolas, monospace; color: var(--ink); background: var(--surface); }
.dp-img { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 12px; }
.dp-img img { max-width: 100%; height: auto; }
.dp-foot { display: none; padding: 8px 12px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line); text-align: center; }

/* ---------- Композер ---------- */
.composer-wrap { padding: 8px 20px 14px; }
.composer-wrap > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.hero { display: none; text-align: center; margin-bottom: 22px; }
.main.empty .hero { display: block; }
.hero-logo { width: 46px; height: 46px; }
.hero h2 { margin: 10px 0 0; font-size: 28px; font-weight: 600; letter-spacing: -.01em; }
.composer-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 12px 12px 8px;
  box-shadow: var(--shadow); transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--ink-3); }
.composer-box.dragover { border-color: var(--accent); }
.composer-box textarea {
  width: 100%; border: 0; outline: 0; background: transparent; resize: none; padding: 4px 6px; max-height: 240px; line-height: 1.5; font-size: 15.5px;
}
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; font-size: 13.5px; color: var(--ink-2); max-width: 220px; }
.pill:hover { background: var(--surface-2); color: var(--ink); }
.pill .pv { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pill svg { width: 14px; height: 14px; flex: 0 0 14px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; font-size: 13px; color: var(--ink-2); border: 1px solid var(--line); }
.chip-btn:hover { background: var(--surface-2); color: var(--ink); }
.chip-btn svg { width: 14px; height: 14px; }
.send-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; }
.send-btn:hover { background: var(--accent-ink); }
.send-btn.stop { background: var(--ink); }
.send-btn svg { width: 18px; height: 18px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.attachments:not(:empty) { margin: 0 0 8px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 5px 10px; }
.att-chip .meta { color: var(--ink-3); font-size: 12px; }
.att-chip.uploading { opacity: .6; }
.att-chip button { color: var(--ink-3); }
.suggestions { display: none; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.main.empty .suggestions { display: flex; }
.suggestion { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13.5px; color: var(--ink-2); background: var(--surface); }
.suggestion:hover { border-color: var(--ink-3); color: var(--ink); }
.composer-note { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.main.empty .composer-note:not(.kb) { display: none; }

.scroll-down { position: absolute; right: 50%; transform: translateX(50%); bottom: calc(var(--composer-h, 140px) + 10px); width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; color: var(--ink-2); z-index: 5; }
.scroll-down svg { width: 18px; height: 18px; }

/* ---------- Меню выбора ---------- */
.menu {
  position: absolute; width: 360px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 20;
}
.picker-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 10px 12px 4px; }
.picker-item { padding: 8px 12px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.picker-item:hover { background: var(--surface-2); }
.picker-item.active { background: var(--surface-2); }
.pi-main { flex: 1; min-width: 0; }
.pi-check { color: var(--accent); display: inline-flex; }
.pi-check svg { width: 16px; height: 16px; }
.pi-name { font-weight: 600; font-size: 14px; }
.pi-desc { font-size: 13px; color: var(--ink-2); }
.pi-hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Модалка ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 18px; padding: 20px 22px; width: 100%; max-width: 460px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h3 { margin: 0; }
.modal label { display: block; font-size: 13px; color: var(--ink-2); margin: 10px 0; }
.modal label input { display: block; width: 100%; margin-top: 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.modal label.check { display: flex; align-items: center; gap: 8px; }
.modal label.check input { display: inline-block; width: auto; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.modal-actions .btn-primary { width: auto; }
.modal-keys { margin-top: 14px; font-size: 12px; color: var(--ink-3); }
.modal-keys b { font-weight: 600; color: var(--ink-2); }
.me-box { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; font-size: 13px; }
.me-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 4px; }
.me-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.me-row span { color: var(--ink-3); }
.me-row b { font-weight: 600; text-align: right; display: inline-flex; align-items: center; gap: 8px; }
.me-bar { display: inline-block; width: 70px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.me-bar i { display: block; height: 100%; background: var(--accent); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 12px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); max-width: 80vw; text-align: center; }

/* ---------- Узкие экраны ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 1400px) {
  .docpanel { min-width: 0; width: 50%; flex-basis: 50%; }
  body.doc-open .sidebar { margin-left: calc(-1 * var(--sb-w)); }
  body.doc-open .src-row { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "n ico main" "acts acts acts" "snip snip snip"; row-gap: 6px; }
  body.doc-open .src-match { display: none; }
}
@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; margin-left: calc(-1 * var(--sb-w)); box-shadow: var(--shadow); }
  .sidebar.open { margin-left: 0; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .messages { padding: 8px 12px 16px; }
  .msg.user .msg-col { max-width: 92%; }
  .composer-wrap { padding: 6px 10px 10px; }
  .pill { max-width: 140px; }
  .hero h2 { font-size: 22px; }
  .src-row { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "n ico main" "acts acts acts" "snip snip snip"; row-gap: 6px; }
  .src-match { display: none; }
  .src-name, .src-meta { white-space: normal; }
  .docpanel { position: fixed; inset: 0; width: auto; flex-basis: auto; z-index: 45; border: 0; }
  .dp-foot { display: block; }
}
