/* AI Hub — компоненты. Все цвета/радиусы/шрифты — из themes.css */
*, *::before, *::after { box-sizing: border-box; }
/* фон всплывающих элементов: плотное «матовое стекло» в любой теме */
:root { --pop-bg: color-mix(in srgb, var(--bg) 62%, var(--surface-3)); }
.menu, .ac, .sel-pop, .cv-selbar, .toast, .modal { background: var(--pop-bg) !important; backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%); }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); background-image: var(--bg-image); background-attachment: fixed;
  color: var(--text); font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased;
  overflow: hidden; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--font-mono); }
.sp { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; }
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.glass { background: var(--surface); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--err); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.stop { background: var(--err); color: #fff; border-color: transparent; font-weight: 700; letter-spacing: .02em; }
.btn.stop.on { background: var(--ok); color: #062014; }
[data-theme="springfield"] .btn, [data-theme="springfield"] .input { border-width: 2px; border-color: #18181B; box-shadow: 2px 2px 0 #18181B; }

.input, .select, textarea.input {
  width: 100%; min-height: 36px; padding: 8px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; line-height: 1.45; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
label.field > span { font-weight: 500; }
.hint { font-size: 12px; color: var(--text-3); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .2s, background .2s; }
.switch input:checked { background: var(--accent); border-color: transparent; }
.switch input:checked::after { transform: translateX(14px); background: var(--accent-ink); }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.err { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); }
.chip.info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w, 248px) 1fr; height: 100dvh; }
.app.sb-collapsed { --sidebar-w: 64px; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border);
  background: var(--surface); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.brand { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--accent)); color: var(--accent-ink); font-weight: 800; font-size: 14px;
}
.brand-name { font: 700 16px/1 var(--font-head); letter-spacing: -.01em; }
.sb-section { padding: 10px 8px 4px; }
.sb-title { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 6px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.chat-list { flex: 1; min-height: 0; padding: 0 8px; }
.chat-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-2); border: 1px solid transparent; position: relative;
}
.chat-item:hover { background: var(--surface-3); color: var(--text); }
.chat-item.active { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.chat-item .ci-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); flex: none; font-size: 13px; }
.chat-item .ci-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .ci-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .ci-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav { padding: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { color: var(--text); background: var(--surface-3); }
.nav .ni { width: 20px; text-align: center; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.sb-collapsed .brand-name, .sb-collapsed .ci-text, .sb-collapsed .ci-badge, .sb-collapsed .nl, .sb-collapsed .me-text, .sb-collapsed .sb-title span { display: none; }
.sb-collapsed .chat-item, .sb-collapsed .nav a { justify-content: center; }
.sb-ic-open { display: none; }
.sb-collapsed .sb-ic-open { display: inline; } .sb-collapsed .sb-ic-close { display: none; }
.sb-collapsed .brand { flex-direction: column; justify-content: center; height: auto; padding: 10px 0; gap: 6px; }
.sb-collapsed .brand .sp { display: none; }
.sb-collapsed .sb-title { justify-content: center; padding: 0 0 6px; }
.sb-collapsed .me { flex-direction: column; gap: 4px; padding: 8px 0; }
.sb-collapsed .chat-list, .sb-collapsed .nav { padding-left: 6px; padding-right: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.tb-title { min-width: 0; display: flex; flex-direction: column; }
.tb-title h1 { margin: 0; font: 700 16px/1.2 var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title .tb-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view { flex: 1; min-height: 0; position: relative; }

/* ---------- полоса команды (главный акцент интерфейса) ---------- */
.team { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.team::-webkit-scrollbar { display: none; }
.ava {
  --c: var(--accent); --p: 0; position: relative; width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 0; padding: 0; background: none;
}
.ava .face {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px;
  background: color-mix(in srgb, var(--c) 22%, var(--surface-2)); color: var(--text); position: relative; z-index: 1;
  box-shadow: 0 0 0 2px var(--surface);
}
.ava::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: color-mix(in srgb, var(--c) 35%, transparent); }
.ava[data-st="busy"]::before { background: conic-gradient(var(--c) 0 25%, transparent 25% 50%, var(--c) 50% 75%, transparent 75%); animation: spin 1.6s linear infinite; }
.ava[data-st="cooldown"]::before { background: conic-gradient(var(--warn) calc(var(--p) * 1%), color-mix(in srgb, var(--warn) 18%, transparent) 0); }
.ava[data-st="error"]::before { background: var(--err); }
.ava[data-st="disabled"] { filter: grayscale(1); opacity: .45; }
.ava .lvl {
  position: absolute; right: -4px; bottom: -3px; z-index: 2; font: 700 9px/1 var(--font-mono); padding: 2px 4px; border-radius: 5px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong);
}
.ava[data-st="cooldown"] .lvl { color: var(--warn); }
.ava.lg { width: 56px; height: 56px; }
.ava.lg .face { width: 48px; height: 48px; font-size: 24px; box-shadow: 0 0 0 3px var(--surface); }
.ava.sm { width: 24px; height: 24px; }
.ava.sm .face { width: 20px; height: 20px; font-size: 11px; box-shadow: 0 0 0 1.5px var(--surface); }
@keyframes spin { to { transform: rotate(360deg); } }
@container (max-width: 520px) { .code-head .bl { display: none; } .code-head .btn { padding: 0 6px; } }
.team-sep { width: 1px; height: 26px; background: var(--border); flex: none; margin: 0 4px; }

/* ---------- чат: две панели ---------- */
.split { display: flex; height: 100%; min-height: 0; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.pane:not(.collapsed) { min-width: 280px; }
.pane-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-body > .feed, .pane-body > .files { flex: 1; min-height: 0; }
.pane-rail { display: none; }
.pane.collapsed > *:not(.pane-rail) { display: none !important; }
.pane.collapsed .pane-rail {
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 40px; height: 100%; padding: 14px 0; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text-2); font-weight: 600; font-size: 12.5px;
}
.pane.collapsed .pane-rail span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.pane.collapsed .pane-rail:hover { color: var(--text); background: var(--surface-2); }
.rail-badge { color: var(--accent); font-size: 10px; }
.pane-thread { border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: var(--glass-blur); }
.th-title { font-weight: 700; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.working { display: flex; gap: 6px; flex-wrap: wrap; font-weight: 400; min-width: 0; overflow: hidden; max-height: 22px; }
.ptabs { display: flex; gap: 2px; flex: none; }
.ptab { white-space: nowrap; }
.pane-head .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-weight: 400; }
.ptab { border: 0; background: none; padding: 5px 10px; border-radius: 7px; cursor: pointer; color: var(--text-3); font-weight: 600; font-size: 12.5px; }
.ptab:hover { color: var(--text); background: var(--surface-3); }
.ptab.on { color: var(--text); background: var(--accent-soft); }
@media (max-width: 1250px) { .only-wide { display: none; } }
.pane-head { height: 40px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.resizer { cursor: col-resize; background: var(--border); position: relative; flex: 0 0 1px; z-index: 5; }
.resizer::after { content: ""; position: absolute; inset: 0 -4px; }
.resizer:hover, .resizer.drag { background: var(--accent); flex-basis: 2px; }
.feed { flex: 1; min-height: 0; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.feed-empty { margin: auto; text-align: center; color: var(--text-3); max-width: 340px; padding: 30px 10px; }
.feed-empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 6px; }
.load-more { align-self: center; margin: 6px 0 10px; }
.day-sep { align-self: center; margin: 14px 0 6px; font-size: 11.5px; color: var(--text-3); padding: 2px 10px; border-radius: 10px; background: var(--surface-2); }

/* ---------- сообщение ---------- */
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 8px 8px; border-radius: var(--radius); position: relative; }
.msg:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.msg.new { animation: msg-in .28s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .m-ava { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--surface-2)); color: var(--text); font-weight: 700; }
.msg.user .m-ava { border-radius: 50%; font-size: 13px; }
.msg .m-body { min-width: 0; }
.m-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 2px; }
.m-author { font-weight: 700; font-size: 13.5px; color: var(--text); }
.m-handle { font-size: 12px; color: var(--text-3); }
.m-time { font-size: 11.5px; color: var(--text-3); }
.m-id { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); cursor: pointer; }
.m-id:hover { color: var(--accent); }
.m-meta { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.msg.system { grid-template-columns: 1fr; padding: 4px 8px; }
.msg.system .m-body { font-size: 12.8px; color: var(--text-2); padding: 7px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border); width: fit-content; max-width: 100%; }
.msg.system .m-time { margin-left: 8px; }
.m-actions {
  position: absolute; top: -12px; right: 10px; display: none; gap: 2px; padding: 3px; border-radius: 9px;
  background: var(--pop-bg); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.msg:hover .m-actions, .msg:focus-within .m-actions { display: flex; }
.m-actions .m-play.on { color: var(--accent); }
.msg:has(.m-play.on) .m-actions { display: flex; }
.m-replies {
  margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.m-replies:hover { border-color: var(--accent); color: var(--text); }
.m-edited { font-size: 11px; color: var(--text-3); }

/* ---------- текст сообщения ---------- */
.md { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.md p { margin: 0 0 .55em; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { font: 700 15px/1.3 var(--font-head); margin: .7em 0 .35em; }
.md h1 { font-size: 17px; } .md h2 { font-size: 16px; }
.md ul, .md ol { margin: .3em 0 .6em; padding-left: 1.4em; }
.md li { margin: .15em 0; }
.md blockquote { margin: .4em 0; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md code.inl { font: 12.5px var(--font-mono); padding: 1px 5px; border-radius: 5px; background: var(--surface-3); color: color-mix(in srgb, var(--accent) 65%, var(--text)); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: .8em 0; }
.md table { border-collapse: collapse; margin: .5em 0; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 9px; text-align: left; }
.md th { background: var(--surface-2); }
.mention { display: inline-flex; align-items: center; padding: 0 5px; border-radius: 5px; font-weight: 600; background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); color: color-mix(in srgb, var(--c, var(--accent)) 75%, var(--text)); cursor: pointer; }
.mention.close { background: var(--surface-3); color: var(--text-3); }
.ref { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 5px; font: 12px var(--font-mono); background: var(--surface-3); color: var(--text); cursor: pointer; border: 1px solid var(--border); }
.ref:hover { border-color: var(--accent); }
.question { padding: 8px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 10%, transparent); border-left: 3px solid var(--warn); margin: .4em 0; }

/* ---------- блок кода (как в ChatGPT / Claude) ---------- */
.code { container-type: inline-size; margin: 8px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--code-bg); box-shadow: var(--shadow); max-width: 100%; }
.code-head {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 12px; background: var(--code-head);
  color: var(--code-head-ink, var(--text-2)); font-size: 12.5px; border-bottom: 1px solid var(--border);
}
.code-head .lang { flex: none; white-space: nowrap; font: 600 11.5px var(--font-mono); text-transform: lowercase; padding: 2px 7px; border-radius: 5px; background: color-mix(in srgb, currentColor 12%, transparent); }
.code-head .fname { flex: 0 1 auto; font: 600 12.5px var(--font-mono); color: var(--code-head-ink, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.code-head .ver { font-size: 11px; opacity: .7; }
.code-head .btn { height: 26px; padding: 0 8px; font-size: 12px; background: transparent; border-color: transparent; color: inherit; opacity: .85; }
.code-head .btn:hover { background: color-mix(in srgb, currentColor 14%, transparent); opacity: 1; }
.code pre { margin: 0; padding: 12px 14px; overflow: auto; font: 13px/1.6 var(--font-mono); color: var(--code-text); tab-size: 4; }
.code.collapsed pre { max-height: 360px; overflow: hidden; position: relative; }
.code-more { display: flex; justify-content: center; padding: 6px; background: var(--code-bg); border-top: 1px solid var(--border); }
.code-more .btn { height: 26px; font-size: 12px; }
.code.lines pre { padding: 8px 0; }
.ln-row { display: grid; grid-template-columns: 52px 1fr; min-height: 21px; position: relative; }
.ln-row .ln { color: var(--code-gutter); text-align: right; padding-right: 14px; user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer; font-size: 12px; line-height: 21px; }
.ln-row .lc { white-space: pre; padding-right: 16px; line-height: 21px; }
.ln-row:hover { background: color-mix(in srgb, var(--code-sel) 60%, transparent); }
.ln-row:hover .ln { color: var(--accent); }
.ln-row.sel { background: var(--code-sel); }
.ln-row.sel .ln { color: var(--accent); }
.ln-row.ann::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ann-c, var(--accent)); }
.ln-row.ann-hl { background: color-mix(in srgb, var(--ann-c, var(--accent)) 16%, transparent); }
.anns { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-3) 45%, var(--code-bg)); }
.ann-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 8px; border-radius: 8px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; }
.ann-chip b { font: 600 11.5px var(--font-mono); color: var(--ann-c, var(--accent)); }
.ann-chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.ann-chip .x { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0 4px; }
.ann-chip.resolved { opacity: .55; text-decoration: line-through; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag { color: var(--tk-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-string { color: var(--tk-string); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--tk-number); }
.hljs-comment, .hljs-quote { color: var(--tk-comment); font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--tk-func); }
.hljs-type, .hljs-title.class_, .hljs-class .hljs-title { color: var(--tk-type); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-id, .hljs-name { color: var(--tk-attr); }
.hljs-meta, .hljs-deletion, .hljs-tag { color: var(--tk-meta); }
.hljs-built_in, .hljs-variable.language_ { color: var(--tk-builtin); }
.hljs-variable, .hljs-template-variable, .hljs-params { color: var(--tk-var); }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }

/* ---------- панель кода: карточка артефакта ---------- */
.art { margin: 6px 0 14px; }
.art-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); margin: 0 2px 4px; flex-wrap: wrap; }
.art-meta b { color: var(--text-2); font-weight: 600; }
.art-text { font-size: 13px; color: var(--text-2); margin: 0 2px 6px; }
.art.old { opacity: .62; }
.art.old:hover { opacity: 1; }
.sel-pop {
  position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 24px)); padding: 12px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.sel-pop .sp-title { font-size: 12.5px; color: var(--text-2); font-weight: 600; }

/* ---------- план оркестратора ---------- */
.plan { margin-top: 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); overflow: hidden; max-width: 760px; }
.plan-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.plan-head .pt { font-weight: 700; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-prog { height: 3px; background: var(--surface-3); }
.plan-prog i { display: block; height: 100%; background: var(--ok); transition: width .5s ease; }
.ptask { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ptask:last-child { border-bottom: 0; }
.ptask:hover { background: var(--surface-2); }
.ptask .pt-title { font-size: 13px; font-weight: 600; }
.ptask .pt-sub { font-size: 12px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.ptask .pt-right { display: flex; align-items: center; gap: 6px; }
.st-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--text-3); position: relative; }
.st-dot[data-s="queued"], .st-dot[data-s="pending"] { border-style: dashed; }
.st-dot[data-s="running"] { border-color: var(--accent); border-right-color: transparent; animation: spin .9s linear infinite; }
.st-dot[data-s="review"] { border-color: var(--info); background: color-mix(in srgb, var(--info) 30%, transparent); }
.st-dot[data-s="waiting"] { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 30%, transparent); }
.st-dot[data-s="done"] { border-color: var(--ok); background: var(--ok); }
.st-dot[data-s="done"]::after { content: ""; position: absolute; left: 2.5px; top: .5px; width: 3px; height: 6px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.st-dot[data-s="failed"] { border-color: var(--err); background: var(--err); }
.st-dot[data-s="cancelled"] { border-color: var(--text-3); background: var(--surface-3); }
.plan-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }

/* ---------- композер ---------- */
.composer { flex: none; padding: 10px 14px 12px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 80%, transparent); position: relative; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; min-height: 24px; max-height: 40vh; padding: 5px 0; line-height: 1.45; }
.spell-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.spell-wrap > textarea { position: relative; z-index: 1; width: 100%; flex: 1; }
.spell-back { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; color: transparent; box-sizing: border-box; }
.spell-back mark.sp-err { color: transparent; background: none; text-decoration: underline wavy var(--err); text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-skip-ink: none; }
.composer .c-hint { font-size: 11.5px; color: var(--text-3); margin: 6px 4px 0; display: flex; gap: 12px; flex-wrap: wrap; }
.composer .c-hint kbd { font: 11px var(--font-mono); padding: 0 4px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); }
.composer .reply-to { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); margin: 0 4px 6px; }
.ac { position: absolute; left: 14px; right: 14px; bottom: calc(100% - 4px); max-height: 260px; z-index: 40; padding: 6px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); backdrop-filter: var(--glass-blur); }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.ac-item.on, .ac-item:hover { background: var(--accent-soft); }
.ac-item .ac-h { font-weight: 600; } .ac-item .ac-d { font-size: 12px; color: var(--text-3); }

/* ---------- тред (боковая панель) ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 30; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  transform: translateX(105%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
[data-theme="vision"] .drawer, [data-theme="liquid"] .drawer, [data-theme="win11"] .drawer, [data-theme="vision"] .pane-thread, [data-theme="liquid"] .pane-thread { background: color-mix(in srgb, var(--surface-2) 85%, var(--bg)); }
.drawer.open { transform: none; }
.drawer-head { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.drawer-head h2 { margin: 0; font: 700 15px var(--font-head); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .feed { padding-top: 14px; }
.thread-root { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.thread-count { font-size: 12px; color: var(--text-3); margin: 2px 8px 6px; }

/* ---------- модалки, тосты, меню ---------- */
.modal-back { position: fixed; inset: 0; z-index: 70; background: var(--overlay); display: grid; place-items: center; padding: 16px; animation: fade .18s ease-out; backdrop-filter: blur(3px); }
.modal {
  width: min(var(--mw, 560px), 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
[data-theme="liquid"] .modal, [data-theme="vision"] .modal { background: color-mix(in srgb, var(--surface-3) 92%, var(--bg)); backdrop-filter: var(--glass-blur); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.modal-head h3 { margin: 0; font: 700 17px var(--font-head); flex: 1; }
.modal-body { padding: 6px 18px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 13px; animation: pop .2s ease-out; border-left: 3px solid var(--accent); }
.toast.err { border-left-color: var(--err); } .toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); }
.menu { position: fixed; z-index: 80; min-width: 200px; padding: 6px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); backdrop-filter: var(--glass-blur); animation: pop .14s ease-out; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); font-size: 13.5px; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.menu .mh { padding: 4px 10px; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.menu .on::after { content: "✓"; margin-left: auto; color: var(--accent); }

/* ---------- страницы (команда, задачи, расходы, файлы, админка) ---------- */
.page { height: 100%; overflow: auto; padding: 22px 24px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font: 800 22px/1.2 var(--font-head); letter-spacing: -.01em; }
.page-head .muted { font-size: 13px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); padding: 16px; box-shadow: var(--shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
.card h3 { margin: 0; font: 700 15px var(--font-head); }
.agent-card { display: flex; flex-direction: column; gap: 12px; }
.agent-card .ac-top { display: flex; gap: 12px; align-items: center; }
.agent-card .ac-name { font-weight: 700; font-size: 15px; }
.agent-card .ac-role { font-size: 12.5px; color: var(--text-2); }
.agent-card .ac-status { font-size: 12.5px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); }
.agent-card .ac-status b { color: var(--text); }
.agent-card.add { align-items: center; justify-content: center; min-height: 200px; border-style: dashed; cursor: pointer; color: var(--text-2); text-align: center; background: transparent; box-shadow: none; }
.agent-card.add:hover { border-color: var(--accent); color: var(--text); }
.agent-card.add .plus { font-size: 30px; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.skills { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--text-2); }
.bar { height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 5px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.stat .sv { font: 700 15px var(--font-head); } .stat .sl { font-size: 11.5px; color: var(--text-3); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.tile .tv { font: 800 24px/1.1 var(--font-head); } .tile .tl { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); padding: 10px; min-height: 120px; }
.kcol h4 { margin: 2px 4px 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.kcard { border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); padding: 10px; margin-bottom: 8px; cursor: pointer; }
.kcard:hover { border-color: var(--accent); }
.kcard .kt { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.days { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 10px 4px 0; }
.days .d { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; justify-content: flex-end; }
.days .d i { width: 100%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: var(--accent); min-height: 2px; }
.days .d span { font-size: 11px; color: var(--text-3); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.section-t { font: 700 13.5px var(--font-head); margin: 8px 0 -2px; color: var(--text); }
.tier-row { display: grid; grid-template-columns: 120px 1.5fr 130px 76px 76px 30px; gap: 6px; align-items: center; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tpl { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; text-align: left; }
.tpl:hover { border-color: var(--border-strong); }
.tpl.on { border-color: var(--accent); background: var(--accent-soft); }
.tpl small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.test-res { font-size: 12.5px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.test-res.ok { border-color: var(--ok); } .test-res.err { border-color: var(--err); color: var(--err); }
.slider-row { display: grid; grid-template-columns: 120px 1fr 30px; gap: 10px; align-items: center; font-size: 12.5px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.banner > span:last-child { flex: 1; min-width: 200px; }
.banner { padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.halt-banner { background: color-mix(in srgb, var(--err) 14%, var(--surface)); border-color: color-mix(in srgb, var(--err) 45%, transparent); margin: 8px 14px 0; }
.empty { text-align: center; padding: 40px 10px; color: var(--text-3); }
.file-row td:first-child { font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- вход ---------- */
.login { height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 28px 26px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font: 800 24px var(--font-head); }

/* ---------- мобильная версия ---------- */
.tabbar { display: none; }
.only-mobile { display: none !important; }
@media (max-width: 860px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-pop); background: var(--surface-2); }
  .app.sb-open .sidebar { transform: none; }
  .app.sb-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 45; }
  .only-mobile { display: inline-flex !important; }
  .only-desktop { display: none !important; }
  .topbar { padding: 0 8px; gap: 8px; height: 54px; }
  .tb-title { flex: 0 1 auto; max-width: 42vw; }
  .team { gap: 2px; }
  .ava { width: 32px; height: 32px; } .ava .face { width: 27px; height: 27px; font-size: 14px; }
  .split { display: block; position: relative; }
  .split .resizer { display: none; }
  .split .pane { position: absolute; inset: 0; }
  .split[data-mtab="dialog"] .pane-code, .split[data-mtab="code"] .pane-dialog { display: none; }
  .pane-dialog > .pane-head { display: none; }
  .pane-code > .pane-head { height: 40px; padding: 0 8px; }
  .feed { padding: 10px 8px 14px; }
  .msg { grid-template-columns: 30px 1fr; gap: 8px; padding: 7px 4px; }
  .msg .m-ava { width: 30px; height: 30px; font-size: 14px; }
  .m-actions { top: -14px; right: 4px; }
  .code pre { font-size: 12.5px; }
  .ln-row { grid-template-columns: 38px 1fr; } .ln-row .ln { padding-right: 8px; }
  .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer .c-hint { display: none; }
  .composer textarea { font-size: 16px; }
  .drawer { width: 100vw; border-left: 0; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); flex: none; border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: var(--glass-blur); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button { border: 0; background: none; padding: 7px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10.5px; color: var(--text-3); cursor: pointer; position: relative; }
  .tabbar button .ti { font-size: 18px; line-height: 1.1; }
  .tabbar button.on { color: var(--accent); }
  .tabbar .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
  .page { padding: 16px 12px 40px; }
  .page-head h2 { font-size: 19px; }
  .grid { grid-template-columns: 1fr; }
  .tier-row { grid-template-columns: 1fr 1fr; }
  .tier-row.hint { display: none; }
  .modal-back { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .sel-pop { left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; }
  .halt-banner { margin: 6px 8px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- подвал сообщения: тред всегда виден ---------- */
.m-foot { margin-top: 4px; min-height: 22px; }
.m-reply { border: 0; background: none; padding: 2px 6px; margin-left: -6px; border-radius: 6px; color: var(--text-3); font-size: 12px; cursor: pointer; opacity: .55; transition: opacity .15s; }
.msg:hover .m-reply, .m-reply:focus-visible { opacity: 1; }
.m-reply:hover { color: var(--accent); background: var(--accent-soft); }

/* ---------- закреплённые ---------- */
.pinbar { display: flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 75%, transparent); }
.pin-marks { display: flex; flex-direction: column; gap: 2px; align-self: stretch; justify-content: center; }
.pin-marks i { width: 2px; flex: 1; max-height: 12px; min-height: 4px; border-radius: 2px; background: var(--border-strong); }
.pin-marks i.on { background: var(--accent); }
.pin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; text-align: left; cursor: pointer; padding: 0 4px; }
.pin-main b { font-size: 12px; color: var(--accent); }
.pin-ex { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- окно кода: выделение, блоки, шторка ---------- */
.cv-body { position: relative; overflow: hidden; }
.cv-scroll { overflow: auto; }
.cv-grid { position: relative; min-width: max-content; font: 13px/21px var(--font-mono); color: var(--code-text); }
.cv .ln-row { min-height: 21px; }
.cv .ln { touch-action: none; }
.ln-row.copied { background: color-mix(in srgb, var(--ok) 22%, transparent) !important; }
.ln-row.copied .ln { color: var(--ok) !important; font-weight: 700; }
/* фокус: подсвеченное остаётся ярким, остальное темнеет и чуть размывается */
.cv-grid .ln-row { transition: opacity .14s ease, filter .14s ease; }
.cv-grid.focus .ln-row:not(.blk):not(.ann-hl):not(.sel):not(.hov):not(.copied) { opacity: .38; filter: blur(.7px); }
.cv-grid .ln-row.hov { background: color-mix(in srgb, var(--code-sel) 70%, transparent); }
.cv-grid .ln-row.hov .ln { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .cv-grid .ln-row { transition: none; } }
/* правка в окне кода */
.cv-edit-box { display: flex; flex-direction: column; background: var(--code-bg); }
.cv-edit-area { display: grid; grid-template-columns: 52px 1fr; }
.cv-edit-gut { overflow: hidden; padding: 8px 14px 8px 0; text-align: right; font: 12px/21px var(--font-mono); color: var(--code-gutter); user-select: none; }
.cv-edit { width: 100%; resize: vertical; border: 0; outline: 0; padding: 8px 16px 8px 0; background: transparent; color: var(--code-text); font: 13px/21px var(--font-mono); white-space: pre; tab-size: 2; caret-color: var(--accent); }
.cv-edit-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cv-edit-note { flex: 1 1 220px; height: 30px; }
.cv-edit-bar .dim { font-size: 11.5px; }
.ln-row.sel { background: var(--code-sel); }
.ln-row.ann-hl { background: color-mix(in srgb, var(--hl-c, var(--ann-c, var(--accent))) 20%, transparent); }
.ln-row.blk .lc { background: color-mix(in srgb, var(--accent) 6%, transparent); box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
.ln-row.blk-top .lc { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 color-mix(in srgb, var(--accent) 30%, transparent); }
.ln-row.blk-bot .lc { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 45%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--accent) 30%, transparent); }
.cv-handle { position: absolute; top: 0; right: 0; bottom: 0; width: 12px; z-index: 4; cursor: pointer; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 14%, transparent)); transition: opacity .2s; }
.cv-handle:hover { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 30%, transparent)); }
.cv-handle i { position: absolute; right: 3px; width: 4px; border-radius: 2px; min-height: 4px; }
.cv-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(52%, 440px); z-index: 3; overflow: hidden;
  background: color-mix(in srgb, var(--surface-2) 62%, transparent); backdrop-filter: blur(12px) saturate(150%); -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-left: 1px solid var(--border-strong); box-shadow: -12px 0 30px rgba(0, 0, 0, .18);
  transform: translateX(102%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.cv-body.dr-open .cv-drawer { transform: none; }
.cv-body.dr-open .cv-handle { opacity: 0; }
.cv-dr-inner { position: relative; }
.cv-bar { position: absolute; width: 3px; border-radius: 3px; background: var(--ann-c); cursor: pointer; }
.cv-bar.open { background: repeating-linear-gradient(180deg, var(--ann-c) 0 4px, transparent 4px 7px); }
.cv-bar:hover { width: 5px; margin-left: -1px; }
.cv-row { position: absolute; right: 38px; height: 21px; display: flex; align-items: center; gap: 4px; overflow: hidden; }
.cv-chip { display: inline-flex; align-items: center; gap: 5px; height: 19px; max-width: 220px; flex: 0 1 auto; min-width: 0; padding: 0 2px 0 7px; border-radius: 6px; font-size: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid color-mix(in srgb, var(--ann-c) 45%, transparent); cursor: default; }
.cv-chip.open { border-style: dashed; }
.cv-chip.resolved { opacity: .5; }
.cv-chip:hover { background: var(--surface-3); }
.cv-chip b { font: 600 11.5px var(--font-mono); color: var(--ann-c); white-space: nowrap; }
.cv-chip .t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cv-chip button { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0 3px; font-size: 10.5px; }
.cv-chip button:hover { color: var(--text); }
.cv-end { font: 600 11px var(--font-mono); color: var(--ann-c); padding: 0 6px; border-radius: 6px; border: 1px dashed color-mix(in srgb, var(--ann-c) 50%, transparent); height: 19px; display: inline-flex; align-items: center; flex: none; }
.cv-ghost { position: absolute; right: 10px; z-index: 5; width: 24px; height: 21px; border: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent); cursor: pointer; font-weight: 700; }
.cv-editor { position: absolute; left: 6px; right: 8px; z-index: 6; }
.cv-input { height: 32px; min-height: 32px; font-size: 12.5px; }
.ac.fixed { position: fixed; right: auto; bottom: auto; z-index: 95; }
.ac.below { top: calc(100% + 4px); bottom: auto; left: 0; right: 0; }
.cv-selbar { position: absolute; left: 56px; z-index: 6; display: flex; gap: 4px; align-items: center; padding: 4px 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-family: var(--font-ui); }
.code-head .btn.on { color: var(--accent); }

/* ---------- файлы проекта ---------- */
.files { display: flex; flex-direction: column; overflow: auto; }
.files-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--surface) 92%, transparent); }
.files-body { padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.files-body > figure { margin: 4px 6px; }
.ft-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); cursor: pointer; text-align: left; font-size: 13px; }
.ft-row:hover { background: var(--surface-3); }
.ft-dir { font-weight: 600; color: var(--text-2); }
.ft-dir.closed .ft-ic { filter: grayscale(.6); }
.ft-name { font-family: var(--font-mono); font-size: 12.5px; }
.ft-ic { width: 18px; text-align: center; }

@media (max-width: 860px) {
  .split .pane { position: absolute; inset: 0; min-width: 0 !important; flex: none !important; }
  .split .pane-thread { display: none !important; }
  .cv-drawer { width: 88%; }
  .cv-handle { width: 18px; }
  .cv-selbar { left: 40px; flex-wrap: wrap; }
}

/* ---------- вложения и перевод ---------- */
.atts { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.att-imgs { display: flex; flex-wrap: wrap; gap: 6px; }
.att-img { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.att-img img { display: block; max-width: min(320px, 70vw); max-height: 240px; object-fit: cover; }
.att-img:hover { border-color: var(--accent); }
.att-file { display: inline-flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none !important; font-size: 13px; }
.att-file:hover { border-color: var(--accent); }
.att-file.risk-warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); }
.att-file.risk-danger { border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, var(--surface-2)); }
.att-risk { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 99px; background: var(--warn); color: #000; }
.risk-danger .att-risk { background: var(--err); color: #fff; }
.risk-box ul { margin: 6px 0 10px; padding-left: 20px; } .risk-box li { margin: 4px 0; }
.att-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.att-pending { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px 6px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 4px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.att-chip img { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; }
.att-chip button { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0 6px; }
.att-chip.up { opacity: .6; }
.composer.drop .composer-box { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); border-style: dashed; }
.tr-toggle { display: inline-block; margin-top: 4px; border: 0; background: none; padding: 0; color: var(--text-3); font-size: 11.5px; cursor: pointer; }
.tr-toggle:hover { color: var(--accent); }

/* ---------- голосовой ввод ---------- */
/* голосовой ввод: микрофон рядом с «Отправить», при записи — красная кнопка-стоп и полоса записи */
.btn.mic { color: var(--text-2); width: 36px; height: 36px; padding: 0; border-radius: 50%; flex: none; display: inline-grid; place-items: center; transition: background .15s, color .15s, transform .12s; }
.btn.mic:hover { color: var(--accent); background: var(--accent-soft); }
.btn.mic:active { transform: scale(.92); }
.btn.mic.rec { color: #fff; background: var(--err); animation: micPulse 1.4s ease-in-out infinite; }
.btn.mic.rec:hover { color: #fff; background: color-mix(in srgb, var(--err) 85%, #000); }
.btn.mic.wait { color: var(--accent); background: var(--accent-soft); opacity: 1; }
.spin-svg { animation: spin .8s linear infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--err) 55%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.composer-box { align-items: flex-end; }
.composer-box.recording { border-color: color-mix(in srgb, var(--err) 60%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 18%, transparent); }
.composer-box.recording > textarea, .composer-box.recording > .btn:not(.mic):not(.primary) { display: none; }
.rec-bar { --wave: var(--err); flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 36px; padding-left: 2px; }
.rec-bar[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--err); flex: none; animation: recBlink 1s ease-in-out infinite; }
@keyframes recBlink { 50% { opacity: .25; } }
.rec-time { font: 600 13px var(--font-mono); color: var(--text); min-width: 36px; font-variant-numeric: tabular-nums; }
.rec-mid { flex: 1; min-width: 0; position: relative; height: 28px; display: flex; align-items: center; }
.rec-wave { width: 100%; height: 28px; display: block; }
.rec-live { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 6px; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; justify-content: flex-end;
  background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 82%, transparent) 100%); pointer-events: none; }
.rec-live:empty { display: none; }
.rec-cancel { flex: none; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.rec-cancel:hover { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }

/* элементы, которые показывают только отдельные темы */
.masthead { display: none; }
.remote-link { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.remote-link .qr { width: 132px; height: 132px; flex: none; background: #fff; border-radius: 8px; padding: 4px; }
.remote-link .qr svg { width: 100%; height: 100%; display: block; }

/* голосовые комнаты */
.voice-btn.on { color: var(--ok); }
.voice-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); font-size: 13px; }
.voice-bar[hidden] { display: none; }
.vc-label { font-weight: 700; color: var(--ok); }
.vc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid var(--border); transition: border-color .12s, box-shadow .12s; }
.vc-chip.speaking { border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.vc-chip.muted { opacity: .65; }
.vc-dot { width: 10px; height: 10px; border-radius: 50%; }
.dim-card { opacity: .78; }

/* итог плана, свёрнутые уведомления */
.notice-sum { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 2px 0; color: var(--text-2); font: inherit; cursor: pointer; }
.notice-sum:hover .nt { color: var(--text); text-decoration: underline; }
.notice-sum .chev { font-size: 11px; transition: transform .15s; }
.notice-sum[aria-expanded="true"] .chev { transform: rotate(180deg); }
.notice-full { margin-top: 4px; }
.plan-rep { cursor: pointer; flex-wrap: wrap; gap: 6px; }
.plan-rep:hover { background: var(--surface-3); }
.stars { display: inline-flex; gap: 0; margin-right: 6px; }
.stars .star { background: none; border: 0; padding: 0 1px; font-size: 14px; line-height: 1; color: var(--text-3); cursor: pointer; }
.stars .star.on { color: #f5b301; }
.stars .star:focus-visible { outline: 2px solid var(--accent); border-radius: 3px; }

/* плавность: пока тянут разделитель — без размытия стекла и анимаций (это самое дорогое при перерисовке) */
body.resizing, body.resizing * { transition: none !important; animation-play-state: paused !important; }
body.resizing * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.resizing .feed, body.resizing .cv { pointer-events: none; }
/* длинный чат: сообщения за пределами экрана не отрисовываются, пока до них не дошли */
.feed > .msg > .m-body { content-visibility: auto; contain-intrinsic-size: auto 72px; }
