/* ===== Kimi — SSH Agent · макет интерфейса (тёмная тема) ===== */
:root {
  --bg: #0d1117;
  --bg-panel: #151a23;
  --bg-panel2: #1a212d;
  --bg-hover: #21293a;
  --bg-input: #10151d;
  --border: #262f3f;
  --border-soft: #1f2632;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --text-faint: #6b7686;
  --accent: #2f81f7;
  --accent-hover: #1f6feb;
  --accent-dim: rgba(47, 129, 247, .14);
  --purple: #a371f7;
  --purple-hover: #8957e5;
  --green: #3fb950;
  --orange: #d29922;
  --red: #f85149;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --left-w: 264px;
  --right-w: 300px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; height: 100vh; position: relative; overflow: hidden; }

code, pre { font-family: var(--mono); }

::selection { background: rgba(47, 129, 247, .35); }

/* Скроллбары */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3342; border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4658; background-clip: content-box; border: 2px solid transparent; }

/* Иконки SVG */
.ic {
  width: 16px; height: 16px; flex: 0 0 16px;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-dim { color: var(--text-dim); }

/* Точки статуса */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(63, 185, 80, .6); }
.dot-gray { background: #57606f; }
.dot-blue { background: var(--accent); }

.pulse-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 5px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(47, 129, 247, .5); }
  50% { opacity: .55; box-shadow: 0 0 0 4px rgba(47, 129, 247, 0); }
}

.dim { color: var(--text-dim); }
.flex-spacer { flex: 1; }

/* ==================== КНОПКИ ==================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; color: var(--text);
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 7px 12px;
  cursor: pointer; transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: #33405a; }

.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600; justify-content: center;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-block { width: 100%; }

.btn-icon {
  background: transparent; border: none; color: var(--text-dim);
  border-radius: var(--r-sm); padding: 6px 8px; cursor: pointer;
  font: inherit; display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.mini-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 12px; color: var(--text-dim);
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 4px 9px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.mini-btn:hover { color: var(--text); background: var(--bg-hover); border-color: #33405a; }
.mini-btn .ic { width: 13px; height: 13px; flex-basis: 13px; }
.mini-btn.copied { color: var(--green); border-color: rgba(63, 185, 80, .5); }

.link { color: var(--accent); cursor: pointer; text-decoration: none; font-size: 12px; text-transform: none; letter-spacing: 0; }
.link:hover { text-decoration: underline; }

/* ==================== БОКОВЫЕ ПАНЕЛИ ==================== */
.sidebar { background: var(--bg-panel); overflow: hidden; flex: 0 0 auto; transition: margin .2s ease; }

.sidebar-left {
  width: var(--left-w); border-right: 1px solid var(--border-soft);
}
.sidebar-right {
  width: var(--right-w); border-left: 1px solid var(--border-soft);
}
body.left-collapsed .sidebar-left { margin-left: calc(-1 * var(--left-w)); }
body.right-collapsed .sidebar-right { margin-right: calc(-1 * var(--right-w)); }

.sidebar-inner {
  width: inherit; height: 100%;
  display: flex; flex-direction: column;
  padding: 14px; gap: 16px;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar-left .sidebar-inner { width: var(--left-w); }
.sidebar-right .sidebar-inner { width: var(--right-w); }

/* --- Шапка / бренд --- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(47, 129, 247, .35);
}
.brand-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--text-dim); }

/* --- Секции --- */
.side-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint);
  margin-bottom: 7px; padding: 0 4px;
}

/* --- Подключения --- */
.conn-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.conn {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-md); cursor: pointer;
  transition: background .15s;
}
.conn:hover { background: var(--bg-hover); }
.conn.active { background: var(--accent-dim); box-shadow: inset 2px 0 0 var(--accent); }
.conn-info { flex: 1; min-width: 0; }
.conn-name { font-size: 13px; font-weight: 500; }
.conn.active .conn-name { color: #7aa8f9; }
.conn-status { font-size: 11px; color: var(--text-faint); }
.conn-status.ok { color: var(--green); }
.chevron { color: var(--text-faint); font-size: 14px; }
.conn:hover .chevron { color: var(--text-dim); }

/* --- Навигация --- */
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  background: none; border: none; font: inherit;
  color: var(--text-dim); cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.active .ic { color: var(--accent); }
.nav-label { flex: 1; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 18px;
  text-align: center; border-radius: 9px;
}

/* --- Диалоги --- */
.chat-search input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 7px 10px; color: var(--text);
  font: inherit; font-size: 12px; outline: none; margin-bottom: 8px;
}
.chat-search input::placeholder { color: var(--text-faint); }
.chat-search input:focus { border-color: var(--accent); }
.chat-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  padding: 7px 9px; border-radius: var(--r-md); cursor: pointer;
  transition: background .15s;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--accent-dim); }
.chat-item-name {
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.chat-item-sub.working { color: #7aa8f9; display: flex; align-items: center; }

.side-spacer { flex: 1; }

/* --- Карточка пользователя --- */
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); background: var(--bg-panel2);
  cursor: pointer; transition: border-color .15s;
}
.user-card:hover { border-color: #33405a; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-sub { font-size: 11px; color: var(--text-dim); }

/* Аватары */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.avatar-user { background: #3a4656; }
.avatar-kimi {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  box-shadow: 0 1px 6px rgba(47, 129, 247, .4);
}

/* ==================== ЦЕНТР ==================== */
.center { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

/* --- Верхняя панель --- */
.topbar {
  height: 52px; flex: 0 0 52px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-bottom: 1px solid var(--border-soft);
  background: var(--bg-panel);
}
.topbar-spacer { flex: 1; }

.server-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; color: var(--text);
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 7px 11px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.server-chip:hover { background: var(--bg-hover); border-color: #33405a; }
.chip-dim { color: var(--text-dim); font-family: var(--mono); font-size: 12px; }
.chip-sep { color: var(--text-faint); }
.chip-caret { color: var(--text-dim); font-size: 11px; }

.env-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 8px; border-radius: var(--r-sm);
}
.env-badge.prod {
  color: var(--red);
  background: rgba(248, 81, 73, .12);
  border: 1px solid rgba(248, 81, 73, .45);
}

.win-controls {
  display: flex; align-items: center; gap: 2px;
  margin-left: 8px; padding-left: 10px;
  border-left: 1px solid var(--border-soft);
}
.wc-btn {
  width: 30px; height: 28px; border: none; background: none;
  color: var(--text-dim); font-size: 13px; border-radius: var(--r-sm);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.wc-btn:hover { background: var(--bg-hover); color: var(--text); }
.wc-close:hover { background: var(--red); color: #fff; }

/* --- Виды --- */
.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.active { display: flex; }

.view-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 1px solid var(--border-soft);
}
.view-head h2 { font-size: 16px; font-weight: 600; }

.input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 7px 11px; color: var(--text);
  font: inherit; font-size: 12.5px; outline: none;
  transition: border-color .15s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); }

/* ==================== ЧАТ ==================== */
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-inner { max-width: 860px; margin: 0 auto; padding: 22px 26px 10px; }

.chat-date {
  text-align: center; font-size: 11.5px; color: var(--text-faint);
  margin: 4px 0 20px; position: relative;
}
.chat-date::before, .chat-date::after {
  content: ""; position: absolute; top: 50%; width: 32%;
  border-top: 1px solid var(--border-soft);
}
.chat-date::before { left: 0; }
.chat-date::after { right: 0; }

.msg { display: flex; gap: 11px; margin-bottom: 24px; }
.msg-user { justify-content: flex-end; }
.msg-bubble {
  max-width: 70%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff; padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 2px 10px rgba(31, 111, 235, .25);
}
.msg-user .avatar { align-self: flex-end; }
.msg-body { flex: 1; min-width: 0; max-width: calc(100% - 41px); }
.msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.msg-author { font-weight: 700; font-size: 13px; }
.msg-time { font-size: 11px; color: var(--text-faint); }
.msg-text { font-size: 13.5px; line-height: 1.55; margin: 6px 0; }

/* Карточки */
.card {
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin: 10px 0; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 13px; font-weight: 600;
}
.card-ok { border-color: rgba(63, 185, 80, .35); }
.ok-head { color: var(--green); }

.cmd-line {
  padding: 9px 12px; border-top: 1px solid var(--border-soft);
  font-size: 13px;
}
.cmd-line code { color: #79c0ff; }

.term-out {
  background: #0a0e14; border-top: 1px solid var(--border-soft);
  padding: 12px 14px; font-size: 12px; line-height: 1.55;
  color: #b8c2cf; overflow-x: auto;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  white-space: pre;
}

.metric-list { list-style: none; border-top: 1px solid var(--border-soft); }
.metric-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}
.metric-list li:last-child { border-bottom: none; }
.metric-list span { color: var(--text-dim); }
.metric-list b { font-weight: 600; }
.ok-text { color: var(--green); }

.path { color: #79c0ff; font-size: 12px; }

.file-list { list-style: none; border-top: 1px solid var(--border-soft); }
.file-list li {
  display: grid; grid-template-columns: 24px 1fr 80px 110px;
  align-items: center; gap: 6px;
  padding: 7px 12px; border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px; transition: background .12s;
}
.file-list li:last-child { border-bottom: none; }
.file-list li:hover { background: var(--bg-hover); }
.f-name { font-weight: 500; }
.f-size, .f-date { color: var(--text-faint); font-size: 11.5px; }
.f-ico { font-size: 14px; }

/* Блок кода */
.code-block {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; margin: 10px 0;
}
.code-head {
  display: flex; align-items: center; gap: 8px;
  background: #161c26; padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.code-lang { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.code-block pre {
  background: #0a0e14; padding: 13px 14px;
  font-size: 12.5px; line-height: 1.6; overflow-x: auto; color: #c9d3e0;
}
.tok-c { color: #7d8794; font-style: italic; }
.tok-f { color: #d2a8ff; }
.tok-k { color: #ff7b72; }
.tok-s { color: #a5d6ff; }

/* «Работа агента» */
.agent-work {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 12px; margin: 6px 0;
  font: inherit; color: var(--text-dim); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.agent-work:hover { background: var(--bg-hover); border-color: #33405a; }
.aw-title { font-weight: 600; color: var(--text); font-size: 12.5px; }
.aw-state { font-size: 12px; }
.agent-work .chev { margin-left: auto; font-size: 11px; }
.agent-steps {
  list-style: none; background: var(--bg-panel2);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  margin: -7px 0 6px; padding: 10px 12px 8px;
}
.agent-steps li {
  font-size: 12px; color: var(--text-dim); padding: 3px 0 3px 4px;
}
.agent-steps li::before { content: "✓ "; color: var(--green); font-weight: 700; }
.agent-steps code { color: #79c0ff; font-size: 11.5px; }

/* --- Поле ввода --- */
.composer { padding: 10px 26px 14px; max-width: 912px; margin: 0 auto; width: 100%; }
.composer-box {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px 10px;
  transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 129, 247, .12); }
.composer-box textarea {
  flex: 1; background: none; border: none; outline: none; resize: none;
  color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.5;
  padding: 6px 4px; max-height: 140px;
}
.composer-box textarea::placeholder { color: var(--text-faint); }
.send-btn {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--accent); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(.93); }
.send-btn .ic { stroke-width: 2; }

.composer-chips { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.chip {
  font: inherit; font-size: 12px; color: var(--text-dim);
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); background: var(--accent-dim); }
.hint { font-size: 11.5px; color: var(--text-faint); }

/* --- Выпадающие меню --- */
.dropdown { position: relative; }
.menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 240px; z-index: 100;
  background: #1c2330; border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 5px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}
.menu-up { top: auto; bottom: calc(100% + 6px); }
.menu.open { display: block; }
.menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; font: inherit; font-size: 12.5px;
  color: var(--text); padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item b { display: block; font-size: 12.5px; }
.menu-item span { display: block; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.menu-item.active { box-shadow: inset 2px 0 0 var(--accent); }
.menu-item.danger { color: var(--red); }
.menu-sep { border-top: 1px solid var(--border-soft); margin: 5px 4px; }

/* ==================== ВИД: ФАЙЛЫ ==================== */
.crumbs { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.crumbs a { color: var(--accent); cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs a::after { content: " /"; color: var(--text-faint); }
.crumbs b { color: var(--text); font-weight: 600; }

.files-body { flex: 1; display: flex; min-height: 0; }
.file-tree {
  width: 230px; flex: 0 0 230px;
  border-right: 1px solid var(--border-soft);
  padding: 12px 8px; overflow-y: auto;
}
.tree-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: var(--r-sm);
  font-size: 12.5px; cursor: pointer; color: var(--text-dim);
  transition: background .12s; white-space: nowrap;
}
.tree-item:hover { background: var(--bg-hover); color: var(--text); }
.tree-item.current { background: var(--accent-dim); color: var(--text); }
.tree-caret { font-size: 10px; width: 12px; color: var(--text-faint); }
.tree-item.lvl1 { padding-left: 24px; }
.tree-item.lvl2 { padding-left: 40px; }

.file-table { flex: 1; overflow-y: auto; padding: 8px 0; }
.ft-row {
  display: grid; grid-template-columns: 1fr 110px 170px;
  align-items: center; padding: 8px 22px; gap: 10px;
  font-size: 12.5px; cursor: pointer; transition: background .12s;
}
.ft-row:hover { background: var(--bg-hover); }
.ft-head {
  color: var(--text-faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; cursor: default;
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.ft-head:hover { background: var(--bg); }
.ft-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.ft-size, .ft-date { color: var(--text-faint); font-size: 11.5px; }

/* ==================== ВИД: ТЕРМИНАЛ ==================== */
.term-meta { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.terminal-wrap { flex: 1; min-height: 0; padding: 16px 22px 22px; display: flex; }
.terminal {
  flex: 1; background: #0a0e14; border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); overflow: auto;
}
.terminal pre {
  padding: 16px 18px; font-size: 12.5px; line-height: 1.6; color: #c9d3e0;
  white-space: pre;
}
.t-prompt { color: var(--green); font-weight: 700; }
.t-path { color: #79c0ff; }
.cursor { animation: blink 1.1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ==================== ВИД: ЗАДАЧИ ==================== */
.kanban {
  flex: 1; display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 22px; overflow: auto;
}
.kb-col {
  flex: 1 1 260px; min-width: 260px;
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 10px;
}
.kb-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; padding: 2px 4px 10px;
}
.kb-count {
  margin-left: auto; font-size: 11px; color: var(--text-faint);
  background: var(--bg-panel2); border-radius: 9px; padding: 1px 8px;
}
.task-card {
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 8px;
  transition: border-color .15s; cursor: pointer;
}
.task-card:hover { border-color: #33405a; }
.task-card.done { opacity: .72; }
.task-card.done .task-title { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.task-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.task-tags { display: flex; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 10.5px; color: var(--text-dim);
  background: var(--bg-hover); border-radius: var(--r-sm); padding: 2px 8px;
}
.tag-blue { color: #7aa8f9; background: var(--accent-dim); }
.task-progress {
  display: flex; align-items: center; margin-top: 8px;
  font-size: 11.5px; color: #7aa8f9;
}
.task-meta { font-size: 11px; color: var(--text-faint); margin-top: 8px; }

/* ==================== ВИД: СНИППЕТЫ ==================== */
.snip-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px; padding: 18px 22px; align-content: start;
}
.snip-card {
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  transition: border-color .15s;
}
.snip-card:hover { border-color: #33405a; }
.snip-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
}
.snip-name { font-size: 13px; font-weight: 600; }
.lang-badge {
  font-size: 10.5px; color: #7aa8f9; text-transform: uppercase;
  letter-spacing: .05em; background: var(--accent-dim);
  border-radius: var(--r-sm); padding: 2px 8px;
}
.snip-code {
  background: #0a0e14; border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 12px; font-size: 12px; color: #b8c2cf;
  overflow-x: auto; white-space: pre;
}
.snip-foot { display: flex; gap: 8px; padding: 9px 12px; }

/* ==================== ВИД: НАСТРОЙКИ ==================== */
.settings-scroll { flex: 1; overflow-y: auto; }
.settings-inner { max-width: 680px; padding: 20px 26px 30px; }
.set-card {
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 4px 18px; margin-bottom: 16px;
}
.set-title {
  font-size: 13px; font-weight: 700; padding: 14px 0 6px;
}
.form-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.form-row:last-child { border-bottom: none; }
.form-label { font-size: 13px; font-weight: 500; }
.form-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.form-value { font-size: 13px; font-weight: 600; color: var(--green); }
.select {
  min-width: 190px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 30px;
}
.select-wide { min-width: 380px; }
.select option { background: var(--bg-panel2); color: var(--text); }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-num { width: 100px; text-align: right; }
.input-suffix { color: var(--text-dim); font-size: 13px; }
.settings-actions { display: flex; gap: 10px; margin-top: 6px; }

/* Переключатель */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #2a3342; border-radius: 21px; transition: background .2s;
}
.slider::before {
  content: ""; position: absolute; width: 15px; height: 15px;
  left: 3px; top: 3px; border-radius: 50%;
  background: #8b98a9; transition: all .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(17px); background: #fff; }

/* ==================== ПРАВАЯ ПАНЕЛЬ ==================== */
.rp-section { margin-bottom: 4px; }
.rp-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint);
  margin-bottom: 10px; padding: 0 2px;
}
.srv-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 14px; }
.srv-status b { color: var(--green); }

.meter { margin-bottom: 12px; }
.meter-row {
  display: flex; justify-content: space-between;
  font-size: 12px; margin-bottom: 5px;
}
.meter-row span { color: var(--text-dim); }
.meter-row b { font-weight: 600; }
.bar { height: 6px; background: #21293a; border-radius: 3px; overflow: hidden; }
.bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-hover), var(--accent));
  border-radius: 3px;
}
.bar i.purple { background: linear-gradient(90deg, var(--purple-hover), var(--purple)); }

.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qa {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font: inherit; font-size: 12px; color: var(--text);
  background: var(--bg-panel2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 13px 8px; cursor: pointer;
  transition: all .15s;
}
.qa:hover { border-color: var(--accent); background: var(--accent-dim); }
.qa-ico { font-size: 17px; }

.recent-files { list-style: none; }
.recent-files li {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 6px; border-radius: var(--r-sm); cursor: pointer;
  transition: background .12s;
}
.recent-files li:hover { background: var(--bg-hover); }
.rf-info { flex: 1; min-width: 0; }
.rf-name {
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rf-sub { font-size: 11px; color: var(--text-faint); }
.rf-time { font-size: 11px; color: var(--text-faint); flex: 0 0 auto; }

.task-mini { list-style: none; margin-bottom: 10px; }
.task-mini li { padding: 7px 6px; border-radius: var(--r-sm); transition: background .12s; cursor: pointer; }
.task-mini li:hover { background: var(--bg-hover); }
.tm-name { font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.tm-status { font-size: 11px; margin-top: 3px; }
.tm-status.ok { color: var(--green); }
.tm-status.work { color: #7aa8f9; }
.tm-status.plan { color: var(--text-faint); }

/* ==================== КНОПКИ СВОРАЧИВАНИЯ ==================== */
.edge-toggle {
  position: absolute; top: 50%; z-index: 60;
  width: 22px; height: 46px; margin-top: -23px;
  background: var(--bg-panel2); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 14px; cursor: pointer;
  transition: left .2s ease, right .2s ease, color .15s, background .15s;
}
.edge-toggle:hover { color: var(--text); background: var(--bg-hover); }
.edge-left { left: calc(var(--left-w) - 11px); border-radius: var(--r-sm); }
.edge-right { right: calc(var(--right-w) - 11px); border-radius: var(--r-sm); }
body.left-collapsed .edge-left { left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
body.right-collapsed .edge-right { right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }

/* ==================== ВИД: AI AGENT ==================== */
.agent-console {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 900px;
}
.agent-form {
  background: var(--bg-panel2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-row-agent {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-row-agent.form-col {
  flex-direction: column;
  align-items: stretch;
}
.form-row-agent.form-actions {
  justify-content: space-between;
  margin-top: 4px;
}
.agent-label {
  min-width: 90px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.agent-form .input {
  flex: 1;
}
.agent-form textarea.input {
  resize: vertical;
  min-height: 80px;
}
.agent-runs {
  background: var(--bg-panel2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  flex: 1;
  min-height: 180px;
}
.run-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.run-empty {
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 10px 0;
}
.run-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.run-card:hover { border-color: var(--border); }
.run-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.run-title {
  font-weight: 600;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.run-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.run-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.run-status.configuration_required { color: var(--orange); }
.run-status.running { color: var(--accent); }
.run-status.completed { color: var(--green); }
.run-status.failed { color: var(--red); }
.run-status.cancelled { color: var(--text-faint); }
.run-error {
  font-size: 11.5px;
  color: var(--red);
  background: rgba(248, 81, 73, .08);
  padding: 6px 8px;
  border-radius: var(--r-sm);
}

.run-detail {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.run-detail[hidden] { display: none; }
.rd-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rd-title {
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rd-actions { display: flex; gap: 8px; }
.rd-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.rd-alert {
  background: rgba(248, 81, 73, .10);
  border: 1px solid rgba(248, 81, 73, .35);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--red);
}
.rd-alert b { color: #fff; }
.rd-section { display: flex; flex-direction: column; gap: 6px; }
.rd-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
}
.rd-log, .rd-result {
  background: #0a0e14;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #b8c2cf;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  min-height: 36px;
}
.rd-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.rd-event {
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 6px 8px;
  background: var(--bg-panel2);
  border-radius: var(--r-sm);
}
.rd-event time {
  color: var(--text-faint);
  margin-right: 8px;
}
.run-card.active { border-color: var(--accent); background: var(--accent-dim); }
.run-status.done { color: var(--green); }
.run-status.pending { color: var(--text-faint); }
.run-status.waiting_approval { color: var(--red); }

/* Состояния сообщений чата */
.chat-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 40px 20px;
}
.msg-status {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.msg-status.running { color: var(--accent); }
.msg-status.done { color: var(--green); }
.msg-status.failed { color: var(--red); }
.msg-status.waiting_approval { color: var(--red); }
.msg-status-spin {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 1024px) {
  .sidebar-right { display: none; }
  .edge-right { display: none; }
  .edge-left { left: calc(var(--left-w) - 11px); }
}

@media (max-width: 768px) {
  :root {
    --left-w: 100vw;
    --right-w: 0px;
  }
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar-left {
    position: fixed; top: 0; left: 0; width: 85vw; max-width: 320px; height: 100vh;
    z-index: 100; transform: translateX(-100%); transition: transform .25s ease;
    border-right: 1px solid var(--border-soft);
  }
  body.mobile-menu-open .sidebar-left { transform: translateX(0); }
  .sidebar-left .sidebar-inner { width: 100%; }
  .center { min-height: 100vh; }
  .topbar { height: auto; min-height: 52px; flex-wrap: wrap; gap: 6px; padding: 8px; }
  .win-controls { display: none; }
  .composer { padding: 10px 14px 14px; }
  .chat-inner { padding: 16px 14px 10px; }
  .msg-bubble { max-width: 85%; }
  .kanban { flex-direction: column; align-items: stretch; }
  .kb-col { min-width: 0; }
  .files-body { flex-direction: column; }
  .file-tree { width: 100%; border-right: none; border-bottom: 1px solid var(--border-soft); }
  .agent-console { padding: 14px; }
  .form-row-agent { flex-direction: column; align-items: stretch; gap: 6px; }
  .agent-label { min-width: 0; }
  .agent-form .input { width: 100%; }
  .snip-grid { grid-template-columns: 1fr; }
  .settings-inner { padding: 16px; }
  .form-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .select, .select-wide { min-width: 0; width: 100%; }
  .edge-left { display: none; }

  /* Кнопка-гамбургер для мобильного меню */
  .mobile-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; background: var(--bg-panel2);
    border: 1px solid var(--border); border-radius: var(--r-md);
    color: var(--text); cursor: pointer;
  }
  .mobile-menu-btn:hover { background: var(--bg-hover); }
}

@media (min-width: 769px) {
  .mobile-menu-btn { display: none; }
}
