/* Sreda — режим «Агенты». Чёткая, контрастная тема (индиго-акцент), светлая+тёмная через light-dark().
   Имена классов совпадают с agents-ui.js. Токены на :root — переключение темы через color-scheme. */
:root {
  --ag-bg:       light-dark(#e7ebf2, #0d1016);
  --ag-surface:  light-dark(#ffffff, #161b24);
  --ag-surface2: light-dark(#f3f5fa, #1d2430);
  --ag-txt:      light-dark(#0f1622, #eef2f8);
  --ag-muted:    light-dark(#4d5566, #98a1b4);
  --ag-faint:    light-dark(#9aa3b6, #5e6678);
  --ag-line:     light-dark(#d9dfe9, #2a323f);
  --ag-line2:    light-dark(#c8d0dd, #353f4e);
  --ag-acc:      light-dark(#4f49e0, #8b8cff);
  --ag-acc-soft: light-dark(rgba(79,73,224,.10), rgba(139,140,255,.16));
  --ag-on-acc:   #ffffff;
  --ag-ok:       light-dark(#1a955f, #44d496);
  --ag-ok-soft:  light-dark(rgba(26,149,95,.12), rgba(68,212,150,.15));
  --ag-warn:     light-dark(#b5781a, #ecb45a);
  --ag-warn-soft:light-dark(rgba(181,120,26,.12), rgba(236,180,90,.15));
  --ag-bad:      light-dark(#d6394c, #fb6a78);
  --ag-bad-soft: light-dark(rgba(214,57,76,.12), rgba(251,106,120,.15));
  --ag-shadow:   light-dark(0 2px 6px rgba(20,30,60,.08), 0 2px 8px rgba(0,0,0,.35));
  --ag-shadow-lg:light-dark(0 16px 40px rgba(20,30,60,.18), 0 18px 50px rgba(0,0,0,.6));
  --ag-mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

#sidebar-pane, #terminal-body, #macros-pane { position: relative; }

.ag-overlay { display: none; position: absolute; inset: 0; z-index: 30; background: var(--ag-bg); color: var(--ag-txt); overflow: auto; flex-direction: column; }
body.mode-agents .ag-overlay { display: flex; }
.ag-overlay::-webkit-scrollbar, .ag-feed::-webkit-scrollbar, .ag-col-body::-webkit-scrollbar { width: 9px; height: 9px; }
.ag-overlay::-webkit-scrollbar-thumb, .ag-feed::-webkit-scrollbar-thumb, .ag-col-body::-webkit-scrollbar-thumb { background: var(--ag-line2); border-radius: 8px; }

.mode-seg { display: inline-flex; gap: 3px; background: var(--ag-surface2); border: 1px solid var(--ag-line); border-radius: 8px; padding: 3px; flex-shrink: 0; }
.mode-seg button { border: none; background: transparent; color: var(--ag-muted); font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: 6px; cursor: pointer; transition: .12s; }
.mode-seg button:hover { color: var(--ag-txt); }
.mode-seg button.on { background: var(--ag-acc); color: var(--ag-on-acc); box-shadow: var(--ag-shadow); }

.ag-head { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-bottom: 1px solid var(--ag-line); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ag-muted); flex-shrink: 0; background: var(--ag-surface); }
.ag-head .sp { flex: 1; }
.ag-body { padding: 16px; overflow: auto; flex: 1; min-height: 0; }

.ag-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: none; border-radius: 8px; padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--ag-acc); color: var(--ag-on-acc); box-shadow: var(--ag-shadow); transition: .12s; }
.ag-btn:hover { filter: brightness(1.08); transform: translateY(-1px); } .ag-btn:disabled { opacity: .5; transform: none; }
.ag-ghost { background: var(--ag-surface); border: 1px solid var(--ag-line2); color: var(--ag-txt); border-radius: 8px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .12s; }
.ag-ghost:hover { border-color: var(--ag-acc); color: var(--ag-acc); }
.ag-ghost.on { background: var(--ag-acc); color: var(--ag-on-acc); border-color: var(--ag-acc); }
.ag-ghost.danger:hover { border-color: var(--ag-bad); color: var(--ag-bad); }
.ag-muted { color: var(--ag-muted); font-size: 13px; }
.ag-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ag-empty { padding: 30px 16px; text-align: center; color: var(--ag-faint); font-size: 13px; }

.ag-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px var(--ag-acc-soft); }
.ag-dot.s-running { background: var(--ag-acc); } .ag-dot.s-done, .ag-dot.s-accepted { background: var(--ag-ok); }
.ag-dot.s-failed, .ag-dot.s-rejected { background: var(--ag-bad); } .ag-dot.s-review, .ag-dot.s-gate { background: var(--ag-warn); }
.ag-dot.s-queued, .ag-dot.s-pending, .ag-dot.s-deferred { background: var(--ag-faint); box-shadow: none; }

.ag-tree-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--ag-txt); }
.ag-tree-item:hover { background: var(--ag-surface2); }
.ag-tree-item.proj { font-weight: 600; }
.ag-tree-item.task { padding-left: 28px; color: var(--ag-muted); }
.ag-tree-item.task:hover { color: var(--ag-txt); }
.ag-tree-item.sel { background: var(--ag-acc-soft); color: var(--ag-txt); }
/* дерево файлов проекта (#4) — как вкладка «Редактор»: подпапки, иконки, размеры */
.ag-tree-item.file { gap: 5px; padding-top: 5px; padding-bottom: 5px; color: var(--ag-muted); font-size: 13px; }
.ag-tree-item.file:hover { color: var(--ag-txt); }
.ag-tree-item.file .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ag-tree-item.file .ag-caret { width: 12px; flex-shrink: 0; font-size: 9px; color: var(--ag-faint); }
.ag-file-ic { display: inline-flex; align-items: center; flex-shrink: 0; }
.ag-file-size { margin-left: auto; padding-left: 8px; color: var(--ag-faint); font-size: 10.5px; flex-shrink: 0; }
/* 3-кнопочный переключатель Задачи/Баги/Файлы в узком левом сайдбаре — растянуть на ширину */
#ag-left .mode-seg { display: flex; }
#ag-left .mode-seg button { flex: 1; padding: 5px 6px; }
.ag-caret { width: 12px; text-align: center; color: var(--ag-faint); font-size: 10px; }

.ag-li { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; cursor: pointer; }
.ag-li:hover { background: var(--ag-surface2); }
.ag-li .t { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-li .m { font-size: 11px; color: var(--ag-muted); }

.ag-filterbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.ag-board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.ag-col { flex: 0 0 180px; background: var(--ag-surface2); border: 1px solid var(--ag-line); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%; }
.ag-col-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-bottom: 1px solid var(--ag-line); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ag-txt); }
.ag-col-cnt { font-size: 11px; font-weight: 700; color: var(--ag-muted); background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 100px; padding: 1px 8px; }
.ag-col-body { padding: 9px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 160px; }
.ag-col-body.drop { background: var(--ag-acc-soft); outline: 2px dashed var(--ag-acc); outline-offset: -3px; border-radius: 10px; }
/* во время drag — недоступные колонки серые и без visual drop-зоны */
.ag-col.dnd-disabled { opacity: .35; pointer-events: none; }
.ag-col.dnd-disabled .ag-col-body { background: var(--ag-surface2) !important; outline: none !important; }
.ag-col-empty { color: var(--ag-faint); text-align: center; font-size: 12px; padding: 14px 0; }
.ag-kcard { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 10px; cursor: pointer; transition: .12s; box-shadow: var(--ag-shadow); user-select: none; }
.ag-kcard:hover { border-color: var(--ag-acc); transform: translateY(-1px); }
.ag-kcard.sel { border-color: var(--ag-acc); box-shadow: 0 0 0 2px var(--ag-acc-soft), var(--ag-shadow); }
.ag-kcard.dragging { opacity: .45; }
.ag-kcard .ag-dot { margin-top: 4px; }
.ag-kcard .kt { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.ag-kcard .kr { font-size: 11px; color: var(--ag-muted); margin-top: 3px; }
.ag-due { font-size: 10.5px; font-family: var(--ag-mono); color: var(--ag-muted); background: var(--ag-surface2); border: 1px solid var(--ag-line); border-radius: 6px; padding: 2px 6px; align-self: flex-start; white-space: nowrap; }
.ag-due.over { color: var(--ag-bad); border-color: var(--ag-bad); background: var(--ag-bad-soft); }
.ag-bugmark { font-size: 8.5px; font-weight: 800; color: var(--ag-bad); background: var(--ag-bad-soft); border-radius: 4px; padding: 1px 5px; margin-right: 6px; vertical-align: middle; letter-spacing: .05em; }

.ag-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--ag-txt); letter-spacing: -.01em; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.ag-chip { display: inline-flex; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 100px; background: var(--ag-surface); border: 1px solid var(--ag-line); color: var(--ag-muted); }
.ag-chip b { color: var(--ag-txt); font-weight: 700; }
.ag-fld { display: block; font-size: 11px; font-weight: 700; color: var(--ag-muted); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 7px; }
.ag-input, .ag-select, .ag-ta { width: 100%; background: var(--ag-surface); border: 1px solid var(--ag-line2); border-radius: 8px; color: var(--ag-txt); padding: 9px 11px; font-size: 13px; }
.ag-input:focus, .ag-select:focus, .ag-ta:focus { outline: none; border-color: var(--ag-acc); box-shadow: 0 0 0 3px var(--ag-acc-soft); }
.ag-ta { min-height: 90px; resize: vertical; line-height: 1.5; font-family: var(--ag-mono); font-size: 12px; }
.ag-kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ag-line); font-size: 13px; }
.ag-kv:last-child { border: none; } .ag-kv .k { color: var(--ag-muted); } .ag-kv .v { font-weight: 600; color: var(--ag-txt); text-align: right; }

/* ───── markdown-рендер (#5): аккуратная типографика, таблицы, код ───── */
.ag-md { font-size: 13.5px; line-height: 1.7; color: var(--ag-txt); background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 10px; padding: 18px 22px; box-shadow: var(--ag-shadow); overflow-wrap: anywhere; }
.ag-md:empty::before { content: 'нет описания'; color: var(--ag-faint); }
.ag-md > :first-child { margin-top: 0; } .ag-md > :last-child { margin-bottom: 0; }
.ag-md h1, .ag-md h2, .ag-md h3, .ag-md h4 { margin: 1.3em 0 .5em; line-height: 1.3; color: var(--ag-txt); font-weight: 700; }
.ag-md h1 { font-size: 20px; border-bottom: 1px solid var(--ag-line); padding-bottom: .3em; }
.ag-md h2 { font-size: 17px; border-bottom: 1px solid var(--ag-line); padding-bottom: .25em; }
.ag-md h3 { font-size: 15px; } .ag-md h4 { font-size: 13.5px; color: var(--ag-muted); }
.ag-md p { margin: .65em 0; }
.ag-md ul, .ag-md ol { margin: .6em 0; padding-left: 24px; } .ag-md li { margin: 4px 0; } .ag-md li > ul, .ag-md li > ol { margin: 2px 0; }
.ag-md a { color: var(--ag-acc); text-decoration: none; } .ag-md a:hover { text-decoration: underline; }
.ag-md hr { border: none; border-top: 1px solid var(--ag-line); margin: 1.2em 0; }
.ag-md strong { font-weight: 700; } .ag-md em { font-style: italic; }
.ag-md blockquote { border-left: 3px solid var(--ag-acc); margin: .8em 0; padding: .2em 0 .2em 14px; color: var(--ag-muted); background: var(--ag-surface2); border-radius: 0 6px 6px 0; }
.ag-md code { font-family: var(--ag-mono); font-size: .88em; background: var(--ag-surface2); padding: 1.5px 5px; border-radius: 4px; border: 1px solid var(--ag-line); }
.ag-md pre { background: var(--ag-surface2); border: 1px solid var(--ag-line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: .8em 0; }
.ag-md pre code { background: none; padding: 0; border: none; font-size: 12.5px; line-height: 1.5; }
/* таблицы — главный фикс «как попало»: рамки, заголовок, зебра, скролл */
.ag-md table { border-collapse: collapse; width: auto; max-width: 100%; margin: .9em 0; font-size: 12.5px; display: block; overflow-x: auto; }
.ag-md thead th { background: var(--ag-surface2); font-weight: 700; text-align: left; }
.ag-md th, .ag-md td { border: 1px solid var(--ag-line); padding: 7px 11px; vertical-align: top; }
.ag-md tbody tr:nth-child(even) { background: var(--ag-surface2); }
.ag-md img { max-width: 100%; border-radius: 6px; }

.ag-crit { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ag-line); }
.ag-crit input { accent-color: var(--ag-acc); width: 17px; height: 17px; flex-shrink: 0; }
.ag-crit .ct { flex: 1; font-size: 13px; line-height: 1.45; color: var(--ag-txt); }
.ag-crit.done .ct { text-decoration: line-through; color: var(--ag-faint); }
.ag-critdel { background: none; border: none; color: var(--ag-faint); cursor: pointer; opacity: .5; font-size: 13px; }
.ag-critdel:hover { color: var(--ag-bad); opacity: 1; }

.ag-diff { font-family: var(--ag-mono); font-size: 12px; line-height: 1.5; white-space: pre; overflow: auto; background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 10px; padding: 13px 16px; max-height: 40vh; }
.ag-diff .ad { color: var(--ag-ok); } .ag-diff .dl { color: var(--ag-bad); } .ag-diff .hd { color: var(--ag-acc); font-weight: 600; }

#ag-bottom { display: none; }
body.mode-agents #ag-bottom { display: flex; flex-direction: column; }
#ag-bottom .ag-feed { flex: 1; overflow-y: auto; min-height: 0; padding: 7px 14px; }
.ag-chatbar { display: flex; gap: 9px; padding: 11px 14px; border-top: 1px solid var(--ag-line); background: var(--ag-surface); flex-shrink: 0; align-items: flex-end; }
/* строка ввода авто-растёт под текст (#2); высота вровень с кнопкой при одной строке (#1) */
.ag-chatinput { flex: 1; box-sizing: border-box; min-height: 40px; height: 40px; background: var(--ag-surface2); border: 1px solid var(--ag-line2); border-radius: 10px; color: var(--ag-txt); padding: 9px 13px; font-size: 13px; font-family: inherit; resize: none; max-height: 168px; overflow-y: auto; line-height: 1.45; }
.ag-chatinput:focus { outline: none; border-color: var(--ag-acc); box-shadow: 0 0 0 3px var(--ag-acc-soft); }
/* кнопка «Отправить» одной высоты со строкой и НЕ растягивается при многострочном вводе (#1,#2) */
.ag-chatbar .ag-btn { align-self: flex-end; height: 40px; flex-shrink: 0; padding: 0 16px; }
/* приложение файлов/скриншотов агенту (#7) */
.ag-attach { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 14px 0; flex-shrink: 0; }
.ag-attach-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--ag-surface2); border: 1px solid var(--ag-line2); border-radius: 8px; padding: 4px 6px 4px 8px; font-size: 12px; color: var(--ag-txt); max-width: 100%; }
.ag-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ag-attach-kind { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 5px; border-radius: 5px; background: var(--ag-acc-soft); color: var(--ag-acc); }
.ag-attach-ins { border: none; background: var(--ag-acc); color: var(--ag-on-acc); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 600; cursor: pointer; }
.ag-attach-ins:hover { filter: brightness(1.1); }
#ag-bottom.ag-drop-hot { outline: 2px dashed var(--ag-acc); outline-offset: -6px; box-shadow: inset 0 0 0 9999px var(--ag-acc-soft); }
#ag-bottom.ag-drop-hot::after { content: 'Отпустите файл — он уйдёт в проект'; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: var(--ag-acc); color: var(--ag-on-acc); padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; z-index: 9; pointer-events: none; box-shadow: var(--ag-shadow-lg); }
.ag-line { font-size: 12px; padding: 1px 0; color: var(--ag-faint); display: flex; gap: 7px; align-items: baseline; }
.ag-line.tool { font-family: var(--ag-mono); color: var(--ag-muted); }
.ag-tool-ic { opacity: .6; }
/* терминальный стиль: плотно, без больших отступов и пустых строк (#1) */
.ag-msg { padding: 3px 0; }
.ag-msg-who { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ag-ok); margin-bottom: 1px; opacity: .85; }
.ag-msg.result .ag-msg-who { color: var(--ag-warn); } .ag-msg.error .ag-msg-who { color: var(--ag-bad); }
.ag-msg-tx { font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; color: var(--ag-txt); }
.ag-msg-tx.md { white-space: normal; }  /* markdown сам делает абзацы — без pre-wrap, иначе двойные пустые строки */
.ag-msg-tx > :first-child { margin-top: 0; } .ag-msg-tx > :last-child { margin-bottom: 0; }
.ag-msg.user { background: var(--ag-acc-soft); border-left: 2px solid var(--ag-acc); padding: 4px 10px; border-radius: 0 8px 8px 0; margin: 2px 0; }
.ag-msg.user .ag-msg-who { color: var(--ag-acc); }

.ag-modal-bg { display: none; position: fixed; inset: 0; z-index: 200; background: rgba(8,12,20,.55); backdrop-filter: blur(3px); align-items: center; justify-content: center; }
.ag-modal-bg.show { display: flex; }
.ag-modal { width: min(960px, 96vw); background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 16px; box-shadow: var(--ag-shadow-lg); max-height: 90vh; display: flex; flex-direction: column; color: var(--ag-txt); }
.ag-modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--ag-line); }
.ag-modal-hd h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ag-modal-bd { padding: 18px 20px; overflow: auto; }
.ag-err { color: var(--ag-bad); font-size: 12px; min-height: 15px; margin-top: 6px; }

.ag-plug { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--ag-line); border-radius: 8px; cursor: pointer; margin-bottom: 4px; }
.ag-plug:hover { background: var(--ag-surface2); }
.ag-plug input { width: 16px; height: 16px; accent-color: var(--ag-acc); }
.ag-plug .pn { flex: 1; font-size: 12.5px; } .ag-rec { font-size: 9px; padding: 1px 6px; border-radius: 5px; background: var(--ag-ok-soft); color: var(--ag-ok); text-transform: uppercase; font-weight: 700; }
.ag-toggle { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--ag-line); }
.ag-toggle input { width: 17px; height: 17px; accent-color: var(--ag-acc); }

.ag-phasepick { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-phasechk { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--ag-line2); border-radius: 100px; font-size: 12px; cursor: pointer; color: var(--ag-txt); }
.ag-phasechk input { accent-color: var(--ag-acc); }
.ag-soon { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--ag-warn-soft); color: var(--ag-warn); text-transform: uppercase; }

.ag-theme-btn { display: inline-flex; align-items: center; justify-content: center; background: var(--ag-surface2); border: 1px solid var(--ag-line); color: var(--ag-muted); border-radius: 7px; width: 30px; height: 28px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.ag-theme-btn:hover { color: var(--ag-acc); border-color: var(--ag-acc); }
.ag-theme-btn svg { display: block; }
/* #8 индикатор тревоги на кнопке (например, MCP отвалились) */
.ag-theme-btn { position: relative; }
.ag-theme-btn.has-alert::after { content: ''; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--ag-bad); box-shadow: 0 0 0 2px var(--ag-surface2); }
/* вертикальные табы (модалка промптов, #3) */
/* фиксированная высота контейнера: окно не должно прыгать при переключении табов — содержимое скроллится внутри панели */
.ag-vtabs { display: flex; gap: 14px; height: 62vh; min-height: 380px; }
.ag-vtabs-nav { display: flex; flex-direction: column; gap: 3px; width: 190px; flex-shrink: 0; }
.ag-vtab { text-align: left; border: none; background: transparent; color: var(--ag-muted); font-size: 12.5px; font-weight: 600; padding: 8px 11px; border-radius: 8px; cursor: pointer; border-left: 2px solid transparent; }
.ag-vtab:hover { color: var(--ag-txt); background: var(--ag-surface2); }
.ag-vtab.on { color: var(--ag-acc); background: var(--ag-acc-soft); border-left-color: var(--ag-acc); }
.ag-vtabs-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
/* git-модалка (#5) */
.ag-git-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; font-family: var(--ag-mono); border-bottom: 1px solid var(--ag-line); }
.ag-git-st { width: 26px; font-weight: 700; flex-shrink: 0; }
.ag-git-st.m { color: var(--ag-warn); } .ag-git-st.a { color: var(--ag-ok); } .ag-git-st.d { color: var(--ag-bad); } .ag-git-st.u { color: var(--ag-muted); }
/* единый вид кнопок ИИ-генерации в табах (#1): контурно-акцентная — видна и в светлой, и в тёмной */
.ag-ai { color: var(--ag-acc); background: var(--ag-acc-soft); border: 1px solid var(--ag-acc); }
.ag-ai:hover { background: var(--ag-acc); color: var(--ag-on-acc); border-color: var(--ag-acc); }
.ag-theme-btn:hover { color: var(--ag-acc); border-color: var(--ag-acc); }

/* ── СВЕТЛАЯ ТЕМА ── ТОЛЬКО в режиме «Задачи» (mode-agents). В Редакторе web_shell остаётся
   своим тёмным дизайном (его IDE хардкодит цвета, светлить целиком — глючно и не нужно). */
body.theme-light.mode-agents {
  --bg-color: #e7ebf2;
  --sidebar-bg: #ffffff;
  --text-color: #0f1622;
  --accent-color: #4f49e0;
  --hover-bg: #e2e7f1;
  --border-color: #d9dfe9;
}
body.theme-light.mode-agents .main-header,
body.theme-light.mode-agents .pane-header,
body.theme-light.mode-agents .status-bar { background: #ffffff; border-color: #d9dfe9; color: #0f1622; }
body.theme-light.mode-agents .app-container,
body.theme-light.mode-agents .workspace-area,
body.theme-light.mode-agents .main-content,
body.theme-light.mode-agents .sidebar,
body.theme-light.mode-agents .pane-container { background: #e7ebf2; }
body.theme-light.mode-agents .main-header h1 { color: #0f1622; }
body.theme-light.mode-agents .pane-header span,
body.theme-light.mode-agents .pane-title { color: #4d5566; }
body.theme-light.mode-agents .tabs-container .tab-btn { background: #eef1f7; color: #4d5566; border-color: #d9dfe9; }
body.theme-light.mode-agents .tabs-container .tab-btn.active { background: #ffffff; color: #0f1622; }
body.theme-light.mode-agents .icon-btn { color: #515a6e; }
body.theme-light.mode-agents .icon-btn:hover { background: #e2e7f1; color: #0f1622; }
body.theme-light.mode-agents .status-bar, body.theme-light.mode-agents .status-bar span { color: #4d5566; }
body.theme-light.mode-agents .stat-badge, body.theme-light.mode-agents #stat-cpu,
body.theme-light.mode-agents #stat-ram, body.theme-light.mode-agents #stat-disk { color: #4d5566; }
body.theme-light.mode-agents .main-header { box-shadow: 0 1px 0 #d9dfe9; }

/* в режиме «Задачи» прячем «уши» таба терминала (заголовок TERMINALS) — их не видно/не нужно;
   в Редакторе они остаются */
body.mode-agents #terminal-pane > .pane-header { display: none; }

/* ── табы в детали задачи (просторно) ── */
/* строка табов: табы слева, кнопки действий активного таба справа (#1) */
.ag-tabs { display: flex; align-items: flex-end; gap: 10px; border-bottom: 2px solid var(--ag-line); margin: 6px 0 16px; }
.ag-tabs-list { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 0; }
.ag-tabs-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: flex-end; padding-bottom: 6px; }
.ag-tabs-actions .ag-btn, .ag-tabs-actions .ag-ghost { padding: 6px 11px; font-size: 12px; box-shadow: none; }
.ag-tabs-actions .ag-muted { font-size: 12px; }
.ag-tab { border: none; background: transparent; color: var(--ag-muted); font-size: 13.5px; font-weight: 600; padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: .12s; white-space: nowrap; }
.ag-tab:hover { color: var(--ag-txt); }
.ag-tab.on { color: var(--ag-acc); border-bottom-color: var(--ag-acc); }
/* все табы одного размера: контейнер flex-колонка фикс. высоты, действия прижаты вниз (#2) */
.ag-tabpane { min-height: 300px; }
/* единый контейнер контента таба (как .ag-md/.ag-ta) — чтобы все табы выглядели одинаково (#4) */
.ag-box { background: var(--ag-surface); border: 1px solid var(--ag-line2); border-radius: 10px; padding: 6px 14px; min-height: 240px; }
.ag-box .ag-crit:last-of-type { border-bottom: none; }
.ag-hint { font-size: 12px; color: var(--ag-muted); margin: 0 0 10px; line-height: 1.45; }
/* ── деталь задачи: окна табов одного размера, заполняют место до диалога (#2) ── */
#ag-center .ag-body.detail { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ag-body.detail .ag-tabpane { flex: 1 1 0; min-height: 200px; display: flex; flex-direction: column; }  /* все табы = одна высота (остаток до диалога) */
.ag-body.detail .ag-tabpane > .ag-ta, .ag-body.detail .ag-tabpane > .ag-md, .ag-body.detail .ag-tabpane > .ag-box { flex: 1 1 0; min-height: 0; overflow: auto; }
.ag-body.detail .ag-diff { max-height: none; height: 100%; border: none; border-radius: 0; }   /* дифф заполняет свой бокс и скроллится внутри (#4) */
.ag-body.detail .ag-board { flex-shrink: 0; }
.ag-body.detail .ag-board .ag-col { max-height: none; }
.ag-body.detail .ag-board .ag-col-body { overflow: visible; }
.ag-ta-lg { min-height: 280px; font-size: 13.5px; line-height: 1.6; }
.ag-tabpane .ag-md { min-height: 240px; }
.ag-tabpane .ag-ta { min-height: 180px; }

/* #1 светлая: бейджи CPU/RAM/Disk + контейнер статистики; крошки редактора прятать в Задачах */
body.theme-light.mode-agents .stats-container,
body.theme-light.mode-agents .stat-badge { background: #eef1f7; border-color: #d9dfe9; color: #4d5566; }
body.theme-light.mode-agents .stat-badge svg { stroke: #4d5566; }
body.mode-agents #editor-breadcrumbs { display: none !important; }

/* #6 контекст-бар (токены) */
.ag-ctxbar { height: 6px; border-radius: 6px; background: var(--ag-surface2); overflow: hidden; margin: 2px 0 8px; }
.ag-ctxbar i { display: block; height: 100%; background: var(--ag-acc); transition: width .3s; }
.ag-ctxbar.w i { background: var(--ag-warn); } .ag-ctxbar.b i { background: var(--ag-bad); }

/* #5 развёрнутый диалог: координаты центральной колонки задаёт JS (toggleChatMax) */
body.ag-chat-max.mode-agents #ag-bottom { box-shadow: var(--ag-shadow-lg); }

/* #3 настройки диалога: шрифт/размер/тема + подсветка вывода */
#ag-bottom .ag-msg-tx { font-family: var(--chat-font, inherit); font-size: var(--chat-size, 13.5px); }
#ag-bottom .ag-line { font-size: calc(var(--chat-size, 13.5px) - 1.5px); }
#ag-bottom.chat-dark { --ag-bg:#0d1016; --ag-surface:#161b24; --ag-surface2:#1d2430; --ag-txt:#eef2f8; --ag-muted:#98a1b4; --ag-faint:#5e6678; --ag-line:#2a323f; }
#ag-bottom.chat-light { --ag-bg:#ffffff; --ag-surface:#ffffff; --ag-surface2:#f3f5fa; --ag-txt:#0f1622; --ag-muted:#4d5566; --ag-faint:#9aa3b6; --ag-line:#e2e6ef; }
/* панель настроек диалога */
.ag-chatset { position: absolute; top: 46px; right: 12px; z-index: 8; background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 10px; box-shadow: var(--ag-shadow-lg); padding: 10px 12px; width: 250px; display: flex; flex-direction: column; gap: 9px; }
.ag-chatset-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ag-txt); }
.ag-chatset-row select { width: auto; padding: 5px 8px; }
.ag-chatset-row input[type=checkbox] { width: 16px; height: 16px; }
/* markdown + подсветка кода в сообщениях агента */
.ag-msg-tx pre { background: #0d1016; border-radius: 8px; padding: 10px 12px; overflow: auto; margin: .5em 0; }
.ag-msg-tx pre code { background: none; padding: 0; font-size: .92em; }
.ag-msg-tx :not(pre) > code { font-family: var(--ag-mono); background: var(--ag-surface2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.ag-msg-tx h1, .ag-msg-tx h2, .ag-msg-tx h3 { margin: .4em 0 .2em; line-height: 1.2; }
.ag-msg-tx h1 { font-size: 1.2em; } .ag-msg-tx h2 { font-size: 1.12em; } .ag-msg-tx h3 { font-size: 1.04em; }
.ag-msg-tx ul, .ag-msg-tx ol { padding-left: 18px; margin: .2em 0; } .ag-msg-tx li { margin: 1px 0; } .ag-msg-tx p { margin: .2em 0; }
.ag-msg-tx pre { margin: .35em 0; } .ag-msg-tx a { color: var(--ag-acc); }
/* #4 параллельные стадии: значок ∥ у параллельной фазы в шапке колонки */
.ag-par { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: 11px; line-height: 16px; background: rgba(99,140,255,.15); color: var(--ag-acc); font-weight: 700; cursor: help; }
/* #11 маркет ролей: расширенная строка плагина (чекбокс + ключ + описание) */
.ag-plug-rich { display: flex; align-items: flex-start; gap: 8px; padding: 6px 6px; border-bottom: 1px solid var(--ag-line); cursor: pointer; }
.ag-plug-rich:last-child { border-bottom: 0; }
.ag-plug-rich input[type=checkbox] { margin-top: 3px; flex: 0 0 auto; }
.ag-plug-right { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ag-plug-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-plug-title .pn { font-family: var(--ag-mono); font-size: 12.5px; color: var(--ag-txt); }
.ag-plug-desc { font-size: 12px; color: var(--ag-muted); line-height: 1.35; }
.ag-cat { font-size: 10.5px; padding: 1px 6px; border-radius: 3px; background: var(--ag-surface2); color: var(--ag-muted); }
/* MCP-серверы в маркете ролей */
.ag-mcp-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--ag-line); }
.ag-mcp-row:last-child { border-bottom: 0; }
.ag-mcp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.ag-mcp-dot.ok { background: var(--ag-good, #4ec27e); }
.ag-mcp-dot.down { background: var(--ag-bad, #e0584c); }
.ag-mcp-name { font-family: var(--ag-mono); font-size: 12.5px; color: var(--ag-txt); }
.ag-mcp-desc { font-size: 11.5px; color: var(--ag-muted); line-height: 1.3; margin-top: 1px; }
/* история промптов в чате (popup над input'ом) */
.ag-hist-panel { background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 10px; box-shadow: var(--ag-shadow-lg, 0 10px 30px rgba(0,0,0,.25)); padding: 8px 10px; margin: 0 8px 8px; max-height: 38vh; display: flex; flex-direction: column; }
.ag-hist-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ag-muted); margin-bottom: 4px; }
.ag-hist-x { font-size: 18px; line-height: 16px; color: var(--ag-muted); padding: 0 4px; }
.ag-hist-list { overflow: auto; flex: 1; min-height: 60px; }
.ag-hist-row { padding: 6px 8px; border-bottom: 1px solid var(--ag-line); font-size: 12.5px; color: var(--ag-txt); cursor: pointer; white-space: pre-wrap; word-break: break-word; }
.ag-hist-row:last-child { border-bottom: 0; }
.ag-hist-row:hover { background: var(--ag-surface2); }
/* #12 интеграции: статус-строка, форма ключа, список моделей */
.ag-int-stat { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-size: 13px; }
.ag-int-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.ag-int-dot.ok { background: var(--ag-good, #4ec27e); }
.ag-int-dot.warn { background: var(--ag-warn, #e0a14c); }
.ag-int-dot.off { background: var(--ag-faint, #888); }
.ag-int-keyrow { display: flex; gap: 6px; align-items: stretch; }
.ag-int-keyrow .ag-input { flex: 1; font-family: var(--ag-mono); }
.ag-int-actions { display: flex; gap: 8px; margin-top: 8px; }
.ag-int-models { max-height: 38vh; overflow: auto; border: 1px solid var(--ag-line); border-radius: 6px; padding: 4px; }
.ag-int-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px; border-bottom: 1px solid var(--ag-line); cursor: pointer; }
.ag-int-row:last-child { border-bottom: 0; }
.ag-int-row input[type=checkbox] { margin-top: 3px; flex: 0 0 auto; }
.ag-int-right { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ag-int-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-int-title .pn { font-family: var(--ag-mono); font-size: 12.5px; color: var(--ag-txt); }
.ag-ok { color: var(--ag-good, #4ec27e); font-size: 12.5px; margin-top: 6px; }
.ag-err { color: var(--ag-bad, #e0584c); font-size: 12.5px; margin-top: 6px; }
/* #13 Настройки сервиса: карточка одного параметра */
.ag-set-card { border: 1px solid var(--ag-line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--ag-surface); }
.ag-set-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.ag-set-title .pn { font-family: var(--ag-mono); font-size: 13px; color: var(--ag-txt); font-weight: 600; }
.ag-set-desc { font-size: 12px; color: var(--ag-muted); margin-bottom: 8px; line-height: 1.35; }
.ag-set-row { display: flex; gap: 6px; align-items: stretch; }
.ag-set-row .ag-input { flex: 1; font-family: var(--ag-mono); }
.ag-set-actions { display: flex; gap: 6px; margin-top: 8px; }
/* #15 SaaS этап 2E: org+user чип в правом верхнем углу */
.ag-orgchip { position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 16px; background: var(--ag-surface2); cursor: pointer; font-size: 12px; color: var(--ag-txt); margin-left: 4px; user-select: none; }
.ag-orgchip:hover { background: var(--ag-line); }
.ag-orgchip-org { font-weight: 600; }
.ag-orgchip-sep { color: var(--ag-faint); }
.ag-orgchip-user { color: var(--ag-muted); }
.ag-orgchip-caret { color: var(--ag-faint); font-size: 10px; }
.ag-orgmenu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 240px; background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 10px; box-shadow: var(--ag-shadow-lg, 0 10px 30px rgba(0,0,0,.25)); padding: 6px; z-index: 99999; }
.ag-orgmenu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ag-faint); padding: 6px 8px 4px; }
.ag-orgmenu-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ag-txt); font-size: 13px; cursor: pointer; }
.ag-orgmenu-item:hover { background: var(--ag-surface2); }
.ag-orgmenu-item.on { background: var(--ag-surface2); font-weight: 600; }
.ag-orgmenu-item:disabled { opacity: .5; cursor: not-allowed; }
.ag-orgmenu-item .ag-muted { font-size: 11px; }
.ag-orgmenu-sep { height: 1px; background: var(--ag-line); margin: 4px 6px; }
.ag-orgmenu-danger { color: var(--ag-bad, #e0584c); }
/* #17 Команда: строки участников/приглашений */
.ag-team-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--ag-line); }
.ag-team-row:last-child { border-bottom: 0; }
.ag-team-name { font-weight: 600; font-size: 13px; color: var(--ag-txt); }
.ag-team-invite { margin-bottom: 14px; }
.ag-ghost.danger { color: var(--ag-bad, #e0584c); }
/* #21 onboarding tour */
.ag-tour-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.ag-tour-box { background: var(--ag-surface, #1a1b26); border: 1px solid var(--ag-line); border-radius: 12px; padding: 22px 24px; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.45); color: var(--ag-txt); }
.ag-tour-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.ag-tour-text { font-size: 14px; line-height: 1.5; color: var(--ag-muted); margin-bottom: 14px; }
.ag-tour-ctr { font-size: 11.5px; color: var(--ag-faint); margin-bottom: 10px; }
.ag-tour-nav { display: flex; gap: 8px; justify-content: flex-end; }
/* #15 палитра Cmd+K: видимый scrollbar, особенно в Safari который по умолчанию его прячет */
.ag-palette .ag-palette-list { scrollbar-width: thin; scrollbar-color: var(--ag-faint) transparent; }
.ag-palette .ag-palette-list::-webkit-scrollbar { width: 8px; }
.ag-palette .ag-palette-list::-webkit-scrollbar-track { background: transparent; }
.ag-palette .ag-palette-list::-webkit-scrollbar-thumb { background: var(--ag-faint, #565f89); border-radius: 4px; }
.ag-palette .ag-palette-list::-webkit-scrollbar-thumb:hover { background: var(--ag-muted, #7a829a); }
/* #24 биллинг-бэдж в шапке: $X.XX / $Y.YY с подсветкой при >70%/>90%/>100% */
.ag-billing-chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 12px; background: var(--ag-surface2); cursor: pointer; font-size: 11.5px; margin-left: 6px; color: var(--ag-muted); border: 1px solid transparent; transition: all .15s; }
.ag-billing-chip:hover { color: var(--ag-txt); border-color: var(--ag-line); }
.ag-billing-chip.notice { color: var(--ag-warn, #e0a14c); }
.ag-billing-chip.warn { color: #fff; background: var(--ag-warn, #e0a14c); }
.ag-billing-chip.over { color: #fff; background: var(--ag-bad, #e0584c); animation: ag-pulse 1.6s ease-in-out infinite; }
@keyframes ag-pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
/* #26 trial-бэдж */
.ag-trial-chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 12px; background: linear-gradient(135deg, #4f49e0 0%, #8b8cff 100%); color: #fff; cursor: pointer; font-size: 11.5px; font-weight: 600; margin-left: 6px; border: 1px solid transparent; }
.ag-trial-chip:hover { transform: translateY(-1px); }
.ag-trial-chip.soon { background: linear-gradient(135deg, #e0a14c 0%, #e0584c 100%); animation: ag-pulse 2s ease-in-out infinite; }
