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

/* ── Light theme (default) ──────────────────────────────────────────── */
:root {
  --aside-width: 230px;
  --detail-width: 420px;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #e8e8ed;
  --border: #d1d1d6;
  --text: #1c1c1e;
  --text-dim: #6e6e73;
  --accent: #007aff;
  --accent2: #5856d6;
  --green: #34c759;
  --red: #ff3b30;
  --yellow: #ff9500;
  --teal: #0e8fa6;
  /* Терминал агента (pane_mirror.js): шрифт и палитра ANSI — история рисуется ими же (TASK-159). */
  --term-font: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Menlo, monospace;
  --term-blue: #005faf;
  --term-green: #008700;
  --term-red: #d70000;
  --term-cyan: #007878;
  --term-magenta: #875faf;
  --term-bright-black: #545454;
}

/* ── Dark theme ──────────────────────────────────────────────────────── */
body.dark {
  --bg: #1e1e2e;
  --surface: #2a2a3e;
  --surface2: #313148;
  --border: #44445a;
  --text: #cdd6f4;
  --text-dim: #7f849c;
  --accent: #89b4fa;
  --accent2: #cba6f7;
  --green: #a6e3a1;
  --red: #f38ba8;
  --yellow: #f9e2af;
  --teal: #94e2d5;
  --term-blue: #89b4fa;
  --term-green: #a6e3a1;
  --term-red: #f38ba8;
  --term-cyan: #94e2d5;
  --term-magenta: #cba6f7;
  --term-bright-black: #585b70;
}

body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; height: 100vh; overflow: hidden; transition: background 0.2s, color 0.2s; }

.hidden { display: none !important; }
.hint { font-size: 12px; color: var(--text-dim); display: block; margin-top: 2px; }
.hint-inline { font-size: 12px; color: var(--text-dim); font-weight: 400; }

/* ── Login ───────────────────────────────────────────────────────────── */
#login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 340px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.login-box h2 { text-align: center; color: var(--accent); }
.login-box input { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 10px; font-size: 14px; }
.login-box button { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 10px; cursor: pointer; font-size: 14px; font-weight: 600; }
.login-box button:hover { opacity: 0.9; }
.login-step { display: flex; flex-direction: column; gap: 12px; }
.login-step.hidden { display: none; }
.login-hint { color: var(--muted, #888); font-size: 13px; text-align: center; }
.login-link { color: var(--accent); font-size: 13px; text-align: center; text-decoration: none; cursor: pointer; }
.login-link:hover { text-decoration: underline; }
#login-code { letter-spacing: 4px; text-align: center; font-size: 18px; }
.current-user { color: var(--muted, #888); font-size: 13px; margin-left: auto; }

/* ── Header ──────────────────────────────────────────────────────────── */
header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 16px; height: 48px; display: flex; align-items: center; gap: 10px; }
.logo { font-weight: 700; color: var(--accent); margin-right: auto; }
.project-selector { display: flex; align-items: center; gap: 6px; }
.project-selector select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 5px 8px; border-radius: 6px; }
header button { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
header button:hover { border-color: var(--accent); color: var(--accent); }
#theme-btn { font-size: 16px; padding: 4px 8px; }

/* ── Layout ──────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }
.body { display: flex; flex: 1; overflow: hidden; }

/* ── Pipeline panel ──────────────────────────────────────────────────── */
#pipeline-panel { background: var(--surface); border-bottom: 1px solid var(--border); padding: 6px 16px; overflow-x: auto; white-space: nowrap; }
#pipeline-tasks { display: flex; gap: 20px; align-items: flex-start; }
.pipeline-task { display: inline-flex; flex-direction: column; gap: 3px; }
.pipeline-chain { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.pipeline-step { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.pipeline-step .agent-label { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.pipeline-step .status-icon { font-size: 14px; line-height: 1; position: relative; }
.pipeline-step.active .status-icon::after { content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.pipeline-step.active .agent-label { color: var(--accent); font-weight: 600; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); } 50% { opacity: 0.5; transform: translateX(-50%) scale(1.4); } }
.pipeline-arrow { color: var(--text-dim); font-size: 12px; margin-top: -12px; }
.pipeline-title { font-size: 11px; color: var(--text-dim); text-align: center; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-empty { font-size: 12px; color: var(--text-dim); padding: 4px 0; }

/* ── Aside resize handle ─────────────────────────────────────────── */
.aside-resizer {
    width: 5px;
    flex-shrink: 0;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
}
.aside-resizer:hover,
.aside-resizer.dragging {
    background: var(--accent);
}

/* ── Agents panel ────────────────────────────────────────────────────── */
aside { width: var(--aside-width); min-width: var(--aside-width); max-width: var(--aside-width); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
.panel-header button { background: var(--accent); color: #fff; border: none; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; font-size: 16px; line-height: 1; }
#agents-list { list-style: none; overflow-y: auto; flex: 1; }
#agents-list li { display: flex; align-items: center; gap: 7px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
#agents-list li:hover { background: var(--surface2); }
#agents-list li.active { background: var(--surface2); border-left: 3px solid var(--accent); padding-left: 9px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.status-dot.running { background: var(--green); }
/* Агент запущен, но до приглашения не дошёл: стоит на экране, которого
   платформа не знает. Зелёный здесь был бы неправдой (TASK-36). */
.status-dot.not_ready { background: var(--orange, #e0a030); }
.status-dot.busy { animation: pulse-busy 1.5s ease-in-out infinite; }
/* Сессия в контуре другого участника (TASK-69): жива, но не наша. */
.status-dot.held { box-shadow: 0 0 0 2px var(--orange, #e0a030); }
/* Только просмотр чужой сессии (TASK-150) и строка хозяину сессии. */
.agent-view-badge { font-size: 12px; font-weight: 400; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.agent-view-badge.is-view { color: var(--orange, #e0a030); font-weight: 600; }
.agent-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-menu-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 1; }
.agent-menu-btn:hover { color: var(--text); }

/* ── Context menu ────────────────────────────────────────────────────── */
.ctx-menu { position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; z-index: 1000; min-width: 180px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); overflow: hidden; }
.ctx-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 9px 16px; cursor: pointer; font-size: 13px; }
.ctx-menu button:hover { background: var(--surface2); }
.ctx-menu .danger { color: var(--red); }
.ctx-menu hr { border: none; border-top: 1px solid var(--border); margin: 3px 0; }

/* ── Main panel ──────────────────────────────────────────────────────── */
main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#empty-view { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-dim); }

/* ── Agent view ─────────────────────────────────────────────────────── */
#agent-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.agent-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); font-weight: 600; }
#agent-name-label { flex: 1; }
.btn-danger { background: none; border: 1px solid var(--red); color: var(--red); border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-warning { background: none; border: 1px solid var(--yellow); color: var(--yellow); border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.btn-warning:hover { background: var(--yellow); color: #fff; }
.btn-success { background: none; border: 1px solid var(--green); color: var(--green); border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.btn-success:hover { background: var(--green); color: #fff; }
.effort-quick { font-size: 12px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); cursor: pointer; }


/* ── Modals ──────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: 460px; max-width: 95vw; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 8px 40px rgba(0,0,0,0.15); }
.modal-box h3 { color: var(--accent); font-size: 16px; }
.modal-box label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-dim); }
.modal-box input, .modal-box textarea, .modal-box select { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 8px 10px; font-size: 14px; font-family: inherit; }
.modal-box input:focus, .modal-box textarea:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-actions button { border: none; border-radius: 7px; padding: 8px 18px; cursor: pointer; font-size: 14px; }
.modal-actions button:first-child { background: var(--accent); color: #fff; font-weight: 600; }
.btn-cancel { background: var(--surface2) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; color: var(--text); cursor: pointer; flex-direction: row; }
.checkbox-row input[type="checkbox"] { margin: 0; cursor: pointer; }

/* ── Settings modal with tabs ────────────────────────────────────────── */
/* Размер окна одинаков для всех вкладок (TASK-86): прокручивается тело, а не окно. */
#modal-settings .modal-box { width: 1200px; max-width: 95vw; height: min(85vh, 900px); padding: 0; overflow: hidden; }
.settings-header { padding: 20px 24px 0; border-bottom: 1px solid var(--border); }
.settings-header h3 { color: var(--accent); margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 0; }
.tab-btn { background: none; border: none; color: var(--text-dim); padding: 8px 18px; cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.settings-body { padding: 20px 24px; flex: 1; overflow-y: auto; min-height: 0; }
.tab-panel { display: none; flex-direction: column; gap: 16px; }
.tab-panel.active { display: flex; }

/* General tab */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.setting-path { font-size: 13px; color: var(--text); font-family: monospace; word-break: break-all; max-width: 340px; text-align: right; user-select: all; }
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; cursor: pointer; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* MCP tab */
.mcp-tab-header { display: flex; align-items: center; justify-content: space-between; }
.mcp-tab-header button { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 13px; }
.mcp-section-label { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 6px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.mcp-section-label button { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.mcp-section-hint { font-size: 11px; font-family: monospace; color: var(--accent2); font-weight: 400; text-transform: none; letter-spacing: 0; }
#mcp-table { width: 100%; border-collapse: collapse; }
#mcp-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); color: var(--text-dim); font-weight: 600; font-size: 12px; }
#mcp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
#mcp-table tr:hover td { background: var(--surface2); }
#mcp-table .code { font-family: monospace; font-size: 12px; color: var(--accent2); }
.btn-sm { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.btn-sm:disabled { opacity: .5; cursor: not-allowed; }
/* Выключенный переключатель модели/effort (чужая сессия, TASK-150/151) — видно. */
.effort-quick:disabled { opacity: .5; cursor: not-allowed; }
/* История панели зрителя (TASK-151): вместо живого терминала, на ту же площадь. */
.agent-history { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.agent-history.hidden { display: none; }
.agent-history-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.agent-history-caption { flex: 1; min-width: 0; font-size: 12px; color: var(--text-dim); }
.agent-history-term { flex: 1; min-height: 0; padding: 4px 8px; }
.agent-history-term.hidden { display: none; }
/* История разговора из транскрипта (TASK-152). */
.agent-transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px; font-family: var(--term-font); font-size: 13px; line-height: 1.45; background: var(--surface); color: var(--text); }
.agent-transcript.hidden { display: none; }
.agent-transcript-earlier { display: block; margin: 0 auto 8px; }
.agent-transcript-earlier.hidden { display: none; }
/* Записи — как в терминале Claude Code (TASK-159): ❯ реплика, ⏺ ответ и вызов, ⎿ результат. */
.t-item { margin: 0 0 10px; white-space: pre-wrap; word-break: break-word; }
.t-user { color: var(--term-bright-black); background: var(--surface2); border-radius: 3px; padding: 2px 6px; }
.t-assistant { display: flex; gap: 0; }
.t-assistant .t-bullet { flex: none; }
.t-md { flex: 1; min-width: 0; white-space: normal; }
.t-tool { margin-bottom: 2px; }
.t-tool .t-bullet { color: var(--term-green); }
.t-tool-name { font-weight: 700; }
.t-result, .t-notice { color: var(--term-bright-black); padding-left: 2ch; margin-bottom: 8px; }
.t-result.t-error { color: var(--term-red); }
.t-fold > summary { cursor: pointer; list-style: none; white-space: pre-wrap; }
.t-fold > summary::-webkit-details-marker { display: none; }
.t-fold-body { white-space: pre-wrap; padding-left: 2ch; }
.t-compact .t-divider { color: var(--term-bright-black); border-top: 1px dashed var(--border); padding-top: 4px; margin-top: 6px; }
.t-compact .t-fold { color: var(--term-bright-black); }
.md-p { white-space: pre-wrap; margin: 0 0 6px; }
.md-h { font-weight: 700; margin: 6px 0 4px; }
.md-code { color: var(--term-blue); font-family: var(--term-font); }
.md-pre { font-family: var(--term-font); background: var(--surface2); border-radius: 4px; padding: 6px 8px; margin: 4px 0 6px; overflow-x: auto; white-space: pre; }
.md-list { margin: 0 0 6px; padding-left: 3ch; white-space: normal; }
.md-indent-1 { margin-left: 2ch; }
.md-indent-2 { margin-left: 4ch; }
.md-indent-3 { margin-left: 6ch; }
.md-indent-4 { margin-left: 8ch; }
.md-quote { border-left: 2px solid var(--term-bright-black); padding-left: 1ch; color: var(--term-bright-black); white-space: pre-wrap; margin: 0 0 6px; }
.md-table { border-collapse: collapse; margin: 4px 0 6px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 1px 8px; text-align: left; }
.md-table th { font-weight: 700; }
.md-link { color: var(--term-cyan); }
.md-hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.danger:hover { border-color: var(--red); color: var(--red); }

/* Project MCP cards */
.project-mcp-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.project-mcp-head { display: flex; align-items: center; gap: 8px; }
.project-mcp-name { font-weight: 600; font-size: 14px; }
.project-mcp-cmd { font-family: monospace; font-size: 11px; color: var(--accent2); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; }
.project-mcp-env { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 8px; }
.env-var-row { display: flex; flex-direction: column; gap: 4px; }
.env-var-key { font-size: 11px; font-family: monospace; color: var(--text-dim); }
.env-var-key span.ref { color: var(--accent); }
.env-input-row { display: flex; align-items: center; gap: 6px; }
.env-input-row input[type="password"],
.env-input-row input[type="text"] { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 5px 10px; font-size: 13px; font-family: monospace; }
.env-input-row input:focus { outline: none; border-color: var(--accent); }
.btn-save-env { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.btn-save-env:hover { opacity: 0.85; }
.btn-test-mcp { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.btn-test-mcp:hover { border-color: var(--accent); color: var(--accent); }
.btn-toggle-pw { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 0 4px; font-size: 14px; }
.test-result { font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.test-result.ok { color: #30d158; background: rgba(48,209,88,0.1); }
.test-result.err { color: var(--red); background: rgba(255,59,48,0.1); }
.test-result.loading { color: var(--text-dim); }
#project-mcp-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; min-width: 220px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); animation: slide-in 0.2s ease; }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.error { color: var(--red); font-size: 13px; }
.warn { color: var(--yellow); font-size: 12px; }

/* ── Launch indicator ────────────────────────────────────────────────── */
.launching-indicator { padding: 12px 16px; color: var(--text-dim); font-style: italic; font-size: 13px; }

/* ── Skill file display in agent settings ─────────────────────────── */
.skill-file-path { font-size: 12px; color: var(--text-dim); font-family: monospace; word-break: break-all; padding: 4px 0; }
.skill-content { width: 100%; font-family: monospace; font-size: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 8px 10px; resize: vertical; }
.skill-content:focus { outline: none; border-color: var(--accent); }
.skill-actions { display: flex; align-items: center; gap: 10px; }
.skill-actions.hidden { display: none !important; }
.skill-actions button { background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.skill-actions button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.skill-actions button:disabled { opacity: 0.5; cursor: default; }
.skill-status { font-size: 12px; color: var(--text-dim); }
.skill-status.ok { color: var(--green); }


/* ── Role bar (context progress) in agent list ───────────────────── */
.role-bar { position: relative; display: inline-block; min-width: 64px; max-width: 80px; height: 18px; border-radius: 3px; background: var(--surface2); overflow: hidden; flex-shrink: 0; margin-left: 4px; }
.role-bar-fill { position: absolute; inset: 0; width: 0; background: var(--green); opacity: 0.35; transition: width 0.4s ease; }
.role-bar-fill.warning { background: var(--yellow); opacity: 0.45; }
.role-bar-fill.critical { background: var(--red); opacity: 0.45; }
.role-bar-label { position: relative; z-index: 1; display: block; text-align: center; font-size: 11px; line-height: 18px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }

/* ── Busy animation ─────────────────────────────────────────────── */
@keyframes pulse-busy { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }

/* ── Tracker tasks view ─────────────────────────────────────────────── */
#tasks-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tasks-header { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.tasks-header select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 5px 8px; border-radius: 6px; font-size: 13px; }
#tracker-project-select { font-weight: 600; }
.task-filter { min-width: 110px; }
/* Эпики (F17, TASK-180) */
.tracker-action { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 5px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.tracker-action:hover { border-color: var(--accent); color: var(--accent); }
.epic-badge { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: rgba(88,86,214,0.12); color: var(--accent2); white-space: nowrap; vertical-align: 1px; }
.task-detail-epic:empty { display: none; }
.task-epic-select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 2px 6px; border-radius: 4px; font-size: 12px; max-width: 220px; }
.modal-box.modal-scroll { max-height: 90vh; overflow-y: auto; }
.epics-list { display: flex; flex-direction: column; gap: 6px; }
.epic-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; text-align: left; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.epic-item:hover, .epic-item.selected { border-color: var(--accent); }
.epic-item-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.epic-item-status { color: var(--text-dim); font-size: 12px; }
.epic-item-counts { grid-column: 2 / -1; color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.epic-item-branch, .epic-tasks-branch { grid-column: 2 / -1; min-width: 0; color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.epic-tasks-branch { margin: 4px 0 8px; }
.epic-tasks { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; align-items: flex-start; }
.epic-tasks h4 { font-size: 14px; overflow-wrap: anywhere; }
.epic-tasks-description { font-size: 13px; color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.epic-tasks-description:empty { display: none; }
.epic-tasks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; width: 100%; }
.epic-tasks-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.epic-tasks-list li:hover { background: var(--surface2); }
.epic-tasks-list li.epic-tasks-none { cursor: default; color: var(--text-dim); }
/* «Смержить эпик» и лог эпика (TASK-183) */
.epic-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Маршрут эпика (F19 шаг 6б): фаза, дети по фазам, журнал, кнопки пакета */
.doc-badge { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: rgba(255,149,0,0.15); color: var(--orange, #c76a00); white-space: nowrap; vertical-align: 1px; }
.epic-machine { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.epic-phase-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.epic-methodology { font-family: monospace; font-size: 11px; overflow-wrap: anywhere; }
.epic-route { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.epic-phases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; width: 100%; min-width: 0; }
.epic-phase { border-left: 2px solid var(--border); padding: 2px 0 2px 8px; min-width: 0; }
.epic-phase.passed { border-left-color: var(--green); }
.epic-phase.current { border-left-color: var(--accent); background: var(--surface2); border-radius: 0 6px 6px 0; }
.epic-phase-head { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.epic-phase-mark { width: 1em; color: var(--text-dim); }
.epic-phase.passed .epic-phase-mark { color: var(--green); }
.epic-phase.current .epic-phase-mark, .epic-phase-now { color: var(--accent); }
.epic-phase-label { font-weight: 600; overflow-wrap: anywhere; }
.epic-phase-now { font-size: 11px; }
.epic-children { list-style: none; margin: 4px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.epic-child { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; font-size: 13px; padding: 3px 6px; border-radius: 6px; cursor: pointer; min-width: 0; }
.epic-child:hover { background: var(--surface); }
.epic-doc-link { font-family: monospace; font-size: 12px; color: var(--accent); overflow-wrap: anywhere; min-width: 0; }
.epic-doc-path { font-family: monospace; font-size: 12px; color: var(--text-dim); background: none; padding: 0; overflow-wrap: anywhere; min-width: 0; }
.epic-doc-ref { font-size: 11px; color: var(--text-dim); overflow-wrap: anywhere; }
.epic-journal { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.epic-journal-entry { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; overflow-wrap: anywhere; }
.epic-journal-actor { font-family: monospace; color: var(--text-dim); }
.epic-journal-title, .epic-journal-time { color: var(--text-dim); }
.modal-doc-box { max-width: 900px; }
.doc-view-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px; max-height: 60vh; overflow: auto; }
.waiting-item.waiting-epic { border-left: 3px solid var(--accent2); }
.mf-agents { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.mf-agents-title { font-size: 12px; color: var(--text-dim); }
.mf-agent { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 0; }
.mf-agent input[type="text"] { width: 120px; min-width: 0; flex: 0 1 120px; }
.mf-agent-role { min-width: 0; overflow-wrap: anywhere; flex: 1 1 160px; }
.epic-log-box { width: 100%; font-size: 13px; }
.epic-log-box summary { cursor: pointer; color: var(--text-dim); }
.epic-log .task-log-message { overflow-wrap: anywhere; }
#epic-merge-btn:disabled, #epic-revert-btn:disabled, #epic-restore-btn:disabled { opacity: .5; cursor: not-allowed; }
.epic-task-num { font-family: monospace; color: var(--text-dim); }
.epic-task-name { min-width: 0; flex: 1 1 120px; overflow-wrap: anywhere; }
.tasks-body { flex: 1; display: flex; overflow: hidden; }
.tasks-table-wrap { flex: 1; overflow-y: auto; padding: 0; min-width: 0; }
#tracker-table { width: 100%; border-collapse: collapse; }
#tracker-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--border); color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; position: sticky; top: 0; background: var(--surface); z-index: 1; }
#tracker-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
#tracker-table tbody tr { cursor: pointer; transition: background 0.1s; }
#tracker-table tbody tr:hover { background: var(--surface2); }
#tracker-table tbody tr.selected { background: var(--surface2); border-left: 3px solid var(--accent); }
.tracker-empty { padding: 40px; text-align: center; color: var(--text-dim); font-size: 14px; }
.dispatch-queue { padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dispatch-queue.hidden { display: none !important; }
.dispatch-queue-title { font-size: 12px; color: var(--text-dim); text-transform: uppercase; margin: 0 0 6px; }
.dispatch-queue-entry { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-size: 13px; border-radius: 4px; background: var(--bg); margin-bottom: 4px; flex-wrap: wrap; }
.dispatch-queue-entry .dq-task { color: var(--accent); font-weight: 500; white-space: nowrap; }
.dispatch-queue-entry .dq-role { color: var(--text-dim); font-size: 12px; }
.dispatch-queue-entry .dq-attempts { color: var(--yellow); font-size: 12px; }
.dispatch-queue-entry .dq-error { color: var(--red); font-size: 12px; flex-basis: 100%; }
.dispatch-queue-empty { padding: 8px; text-align: center; color: var(--text-dim); font-size: 13px; }
.task-status-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.task-status-badge.st-создана { background: rgba(0,122,255,0.12); color: var(--accent); }
.task-status-badge.st-в-разработке { background: rgba(255,149,0,0.12); color: var(--yellow); }
.task-status-badge.st-разработана { background: rgba(88,86,214,0.12); color: var(--accent2); }
.task-status-badge.st-протестирована { background: rgba(52,199,89,0.12); color: var(--green); }
.task-status-badge.st-завершена { background: rgba(52,199,89,0.25); color: var(--green); font-weight: 700; }
.task-status-badge.st-передана { background: rgba(255,149,0,0.12); color: var(--yellow); }
.task-status-badge.st-визуальная { background: rgba(48,176,199,0.14); color: var(--teal); }
.task-status-badge.st-визуально-проверена { background: rgba(48,176,199,0.28); color: var(--teal); font-weight: 700; }
/* Откачена (TASK-177): серая приглушённая — не путать с зелёной «завершена» */
.task-status-badge.st-откачена { background: rgba(142,142,147,0.2); color: var(--text-dim); font-weight: 600; }
.task-status-badge.st-отменена { background: rgba(142,142,147,0.2); color: var(--text-dim); text-decoration: line-through; }
#tracker-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Task detail side panel ─────────────────────────────────────────── */
.task-detail-panel { width: var(--detail-width); min-width: 280px; max-width: 60vw; border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.task-detail-panel.hidden { display: none !important; }
.task-detail-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-detail-panel-header h3 { color: var(--accent); font-size: 15px; line-height: 1.3; flex: 1; }
.task-detail-close { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.task-detail-close:hover { border-color: var(--red); color: var(--red); }
.task-detail-meta { font-size: 13px; color: var(--text-dim); display: flex; gap: 12px; flex-wrap: wrap; }
.task-detail-section { margin-top: 12px; }
.task-detail-section h4 { font-size: 13px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 6px; }
.task-detail-statement { font-size: 13px; line-height: 1.6; white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; max-height: 200px; overflow-y: auto; }
.task-detail-table { width: 100%; border-collapse: collapse; }
.task-detail-table th { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 11px; }
.task-detail-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); font-size: 12px; }
.task-detail-log { max-height: 200px; overflow-y: auto; }
.task-log-entry { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.task-log-entry:last-child { border-bottom: none; }
.task-log-source { font-weight: 600; color: var(--accent); }
.task-log-time { color: var(--text-dim); font-size: 11px; margin-left: 8px; }
.task-log-message { margin-top: 2px; white-space: pre-wrap; color: var(--text); line-height: 1.4; }

/* ── Runtime icon in agent list ────────────────────────────────────── */
.runtime-icon { width: 16px; height: 16px; flex-shrink: 0; object-fit: contain; vertical-align: middle; }

/* ── Runtime radio group in settings ───────────────────────────────── */
.form-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.form-row-label { color: var(--text-dim); min-width: 55px; }
.radio-label { display: flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text); font-size: 13px; }
.radio-label input[type="radio"] { accent-color: var(--accent); }

/* ── Hosts tab ────────────────────────────────────────────────────── */
.host-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--bg-dim); color: var(--text-dim); }
.host-status.ok { background: #d4edda; color: #155724; }
.host-status.err { background: #f8d7da; color: #721c24; }
.readiness-ok { color: #155724; }
.readiness-ok::before { content: '\2713 '; }
.readiness-miss { color: #856404; }
.readiness-miss::before { content: '\2717 '; }
.location-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 4px; background: #e2e8f0; color: #475569; }
.location-badge.remote { background: #dbeafe; color: #1e40af; }
.location-badge.storage-ok { background: #d4edda; color: #155724; }
.location-badge.storage-pending { background: #fff3cd; color: #856404; }
.location-badge.storage-error { background: #f8d7da; color: #721c24; }
.host-secrets-section { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.host-secrets-section label { display: block; margin-bottom: 6px; }
.host-secrets-section textarea, .host-secrets-section input, .host-secrets-section select {
  width: 100%; box-sizing: border-box; margin-top: 2px; font-size: 13px;
  padding: 6px 8px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}

/* CodeGraph toggle */
.codegraph-block { margin-bottom: 12px; }
.codegraph-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.codegraph-badge.on { background: var(--accent); color: #fff; }
.codegraph-badge.off { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }
.codegraph-detail { font-size: 12px; color: var(--text-dim); padding: 4px 0; }

/* «Контроль git» (TASK-174): настройка проекта и git-блок карточки задачи */
.git-ctl-block { display: flex; flex-direction: column; gap: 8px; }
.git-ctl-block .codegraph-detail code { font-family: monospace; font-size: 11px; }
.git-ctl-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
.git-ctl-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); font-weight: 500; min-width: 0; }
.git-ctl-form input[type="text"], .git-ctl-form textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 8px; font-family: monospace; font-size: 13px; resize: vertical; min-width: 0; width: 100%; box-sizing: border-box; }
.git-ctl-form input[type="text"]:focus, .git-ctl-form textarea:focus { outline: none; border-color: var(--accent); }
.git-ctl-form .git-ctl-wide { grid-column: 1 / -1; }
.git-ctl-form .git-ctl-check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.git-ctl-hooks { font-size: 12px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.git-ctl-hooks:empty, .git-ctl-warnings:empty { display: none; }
.git-hook-chip { font-family: monospace; font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface2); color: var(--text-dim); }
.git-hook-chip.installed { border-color: var(--green); color: var(--green); }
.git-hook-chip.chained { border-color: var(--accent2); color: var(--accent2); }
.git-hook-chip.foreign { border-color: var(--yellow); color: var(--yellow); }
.git-ctl-warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.git-ctl-warnings li { font-size: 12px; border-left: 3px solid var(--yellow); background: var(--bg); padding: 6px 10px; border-radius: 4px; overflow-wrap: anywhere; }
.git-ctl-warnings li.error { border-left-color: var(--red); }
.git-ctl-actions { display: flex; justify-content: flex-end; }
.task-git-body { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.task-git-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.task-git-row .k { color: var(--text-dim); font-size: 12px; }
.task-git-row code { font-family: monospace; font-size: 12px; overflow-wrap: anywhere; }
.task-git-dirty { color: var(--yellow); font-size: 12px; font-weight: 600; }
.task-git-empty { color: var(--text-dim); font-size: 12px; }
.task-git-base-state { color: var(--text-dim); font-size: 12px; }
.task-git-commits { list-style: none; display: flex; flex-direction: column; gap: 3px; margin: 2px 0 0; padding: 0; }
.task-git-commits li { font-size: 12px; display: flex; gap: 8px; min-width: 0; }
.task-git-commits li span:last-child { min-width: 0; overflow-wrap: anywhere; }
.task-git-commits .sha { font-family: monospace; color: var(--accent2); flex-shrink: 0; }
.task-git-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; align-items: flex-start; }
.task-merge-result { font-size: 12px; border-left: 3px solid var(--border); background: var(--bg); padding: 6px 10px; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; width: 100%; box-sizing: border-box; }
.task-merge-result.merged { border-left-color: var(--green); }
.task-merge-result.reverted { border-left-color: var(--green); }
.task-git-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.task-git-buttons:not(:has(button:not(.hidden))) { display: none; }
.task-git-hint { color: var(--accent); font-size: 12px; }
.revert-hint { font-size: 13px; color: var(--text-dim); line-height: 1.45; }
#revert-force-text { white-space: pre-line; overflow-wrap: anywhere; }
#revert-reason { resize: vertical; min-height: 64px; }
.modal-actions button:first-child:disabled { opacity: .5; cursor: not-allowed; }
.modal-actions button.btn-force { background: var(--red); }
/* Подтверждение удаления проекта открывается поверх окна настроек (TASK-209). */
#modal-delete-project { z-index: 600; }
.task-merge-result.conflict, .task-merge-result.refused, .task-merge-result.error, .task-merge-result.markers { border-left-color: var(--red); }
.task-merge-result code { font-family: monospace; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .git-ctl-form { grid-template-columns: minmax(0, 1fr); }
  .task-git-row { grid-template-columns: 64px minmax(0, 1fr); }
}

/* Пользователи (админская вкладка) */
.users-form { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.users-form input, .users-form select { flex: 1 1 140px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px; font-size: 13px; }
.users-hint { color: var(--muted, #888); font-size: 12px; margin-bottom: 12px; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th, .users-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.users-table th { color: var(--muted, #888); font-weight: 600; }
.users-table td button { margin-right: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 4px 8px; cursor: pointer; font-size: 12px; }
.users-table td button:hover { border-color: var(--accent); }
.users-table-wrap { overflow-x: auto; }
.users-search { width: 100%; max-width: 360px; }
.users-empty { color: var(--text-dim); text-align: center !important; padding: 16px 6px !important; }
.contour-cell { white-space: nowrap; }
.contour-cell select { font-size: 12px; padding: 3px 6px; margin-right: 4px; }
.users-row-inactive { opacity: 0.55; }

/* Доступ к проектам (админская вкладка) */
.access-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 2px 4px 2px 8px; margin: 0 4px 4px 0; font-size: 12px; }
.access-chip button { border: none; background: none; color: var(--muted, #888); cursor: pointer; padding: 0 4px; font-size: 14px; }
.access-chip button:hover { color: var(--accent); }
#projects-admin-table select { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 4px; font-size: 12px; margin-right: 6px; }

/* Служебный почтовый ящик */
.mail-grid { display: grid; grid-template-columns: 160px 1fr; gap: 10px 12px; align-items: center; margin: 12px 0; }
.mail-grid label { color: var(--muted, #888); font-size: 13px; }
.mail-grid input, .mail-grid select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px; font-size: 13px; }
.mail-grid .users-hint { margin: 4px 0 0; }
.mail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mail-actions button { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px 12px; cursor: pointer; font-size: 13px; }
.mail-actions button:hover { border-color: var(--accent); }

/* Режим почты: выключено — предупреждение, а не нейтральная подпись */
.mail-mode-badge { border: 1px solid var(--border); border-left-width: 4px; border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; background: var(--bg); }
.mail-mode-badge.warning { border-left-color: #d98324; background: rgba(217, 131, 36, 0.08); }
.mail-pending { color: #d98324; }
.mail-test-warning { border: 1px solid #d98324; border-radius: 6px; background: rgba(217, 131, 36, 0.08); padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.mail-test-warning.hidden { display: none; }

/* Монтирование каталога своего контура (TASK-28) */
#mount-os-select { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 5px 8px; font-size: 13px; }
.mount-warning { border: 1px solid #d98324; border-left-width: 4px; border-radius: 6px; background: rgba(217, 131, 36, 0.08); padding: 10px 12px; font-size: 13px; margin: 12px 0; }
.mount-empty { border: 1px solid var(--border); border-radius: 6px; background: var(--bg); padding: 12px; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.mount-empty.hidden { display: none; }
.mount-targets { display: flex; flex-direction: column; gap: 14px; }
.mount-target { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface); }
.mount-target-head { display: flex; align-items: baseline; gap: 10px; font-weight: 600; font-size: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.mount-target-where { font-weight: 400; font-size: 12px; color: var(--text-dim); word-break: break-all; }
.mount-step { margin-bottom: 12px; }
.mount-step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.mount-step-title { font-size: 13px; font-weight: 500; }
.mount-command { margin: 0; padding: 9px 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
.mount-where { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--border); white-space: nowrap; }
.mount-where-host { color: var(--warning, #c98a2b); border-color: var(--warning, #c98a2b); }
.mount-notice { color: var(--danger); }
.mount-warning { color: var(--warning, #c98a2b); }
.mount-note { margin-top: 5px; font-size: 12px; color: var(--text-dim); }
.mount-section-title { margin: 18px 0 8px; font-size: 13px; font-weight: 600; }
.mount-troubles { display: flex; flex-direction: column; gap: 10px; }
.mount-trouble { border-left: 3px solid var(--border); padding-left: 10px; }
.mount-trouble-title { font-size: 13px; font-weight: 500; }
.mount-trouble-text { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* Клиент чата с агентом (TASK-30) */
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 78%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg-role { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.chat-msg-text { padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.chat-msg.user .chat-msg-text { background: var(--accent); border-color: var(--accent); color: #fff; font-family: inherit; }
.chat-connection.hidden { display: none; }
/* «Агент остановлен» — не тревога (TASK-131): без оранжевой плашки. */
.chat-connection.is-neutral { background: transparent; color: var(--text-dim); }
.chat-connection { padding: 7px 16px; font-size: 12px; background: rgba(217, 131, 36, 0.12); color: #d98324; border-top: 1px solid var(--border); }

/* Подписка Claude в своём контуре (TASK-33) */
.subscription-block { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.subscription-login { padding: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.subscription-login.hidden { display: none; }
.subscription-hint { font-size: 12px; color: var(--text-dim); }
.subscription-url-row { display: flex; gap: 8px; align-items: flex-start; }
/* Ссылку показываем ЦЕЛИКОМ: обрезанную открыть нельзя, а починить руками
   пользователь не умеет. Поэтому перенос, а не многоточие. */
#subscription-url { flex: 1; padding: 9px 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; word-break: break-all; overflow-wrap: anywhere; white-space: pre-wrap; }
.subscription-code-row { display: flex; gap: 8px; align-items: center; }
#subscription-code { flex: 1; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.subscription-block .btn-sm { white-space: nowrap; }

/* Зеркало панели агента (TASK-35, поправка 2026-09-21) */
/* Рисует эмулятор; от страницы нужен только контейнер и то, чтобы выделение
   мышью работало — это первое, зачем владелец сюда полезет. */
#agent-console { flex: 1; overflow: hidden; min-width: 0; background: var(--surface); }
#agent-console.hidden { display: none; }
/* Поле — на САМОМ полотне, а не на контейнере (TASK-45).
   `addon-fit` считает ширину по контейнеру, а вычитает поля только у
   элемента терминала. При `box-sizing: border-box` ширина контейнера
   приходит вместе с его полями — колонок выходило больше, чем помещается, и
   последняя уползала под край. Поле на `.xterm` вычитается честно. */
#agent-console .xterm {
    width: 100% !important; height: 100% !important; padding: 8px 10px;
}
/* Полоса прокрутки — как в локальной версии: место под неё зарезервировано,
   иначе появление полосы сдвигает текст. */
#agent-console .xterm-viewport {
    overflow-y: scroll !important;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--text-dim) var(--surface2);
}
#agent-console .xterm-viewport::-webkit-scrollbar { width: 10px; }
#agent-console .xterm-viewport::-webkit-scrollbar-track { background: var(--surface2, transparent); }
#agent-console .xterm-viewport::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 4px; border: 2px solid var(--surface2); }
#agent-console .xterm-viewport::-webkit-scrollbar-thumb:hover { background: var(--text); }

/* Свои SSH-ключи контура (TASK-32) */
.mount-keys { display: flex; flex-direction: column; gap: 10px; }
.mount-keys-hint { border: 1px solid var(--border); border-left-width: 4px; border-left-color: #d98324; border-radius: 6px; background: rgba(217, 131, 36, 0.08); padding: 10px 12px; font-size: 13px; }
.mount-keys-hint.hidden { display: none; }
.mount-keygen { display: flex; flex-direction: column; gap: 8px; }
.mount-key-row { display: flex; gap: 8px; align-items: flex-start; }
#mount-key-input { flex: 1; resize: vertical; min-height: 44px; padding: 9px 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; word-break: break-all; }
#mount-key-add-btn:disabled { opacity: .5; cursor: not-allowed; }
.mount-keys-list { display: flex; flex-direction: column; gap: 6px; }

/* Страница инструкции по монтированию (TASK-49). Закладка в модальное окно
   не помещалась: шаги, разбор отказов и работа с ключом уходили за нижний
   край. Здесь страница растёт во всю высоту, а на узком экране читается
   колонкой. */
.mount-page-body { overflow: auto; height: auto; min-height: 100vh; }
.mount-page { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
/* `display: block` ЯВНО: общее правило `header` в этом же файле делает
   шапку флексом, и заголовок, пояснение и выбор ОС вставали в строку —
   на ширине телефона выбор ОС уезжал за правый край (замерено). */
.mount-page-head { display: block; height: auto; background: none; padding: 0 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.mount-page h1 { font-size: 20px; margin-bottom: 6px; }
.mount-page-sub { font-size: 13px; color: var(--text-dim); max-width: 60ch; }
.mount-page-os { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-dim); max-width: 100%; }
.mount-page h2.mount-section-title { font-size: 14px; }
@media (max-width: 560px) {
    .mount-page { padding: 16px 12px 36px; }
    /* Поле ключа и кнопка в строку не помещаются — ставим колонкой, иначе
       кнопка «Добавить» уезжает за край. */
    .mount-key-row { flex-direction: column; align-items: stretch; }
    .mount-step-head { flex-wrap: wrap; }
}
.mount-key-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; background: var(--surface); }
.mount-key-label { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* Контур не ответил: причина вместо пустой вкладки (TASK-50). */
.mcp-unavailable {
  font-size: 12px;
  color: var(--danger, #cc0000);
  padding: 8px 0;
}

/* Задача ждёт агента в контуре автора (TASK-70). */
.task-dispatch-note { flex-basis: 100%; margin-top: 4px; color: var(--orange, #e0a030); font-size: 0.9em; }

/* ── Страница монтирования: сначала цель, подготовка чек-листом (TASK-76) ── */
.mount-goals { display: flex; flex-direction: column; gap: 12px; }
.mount-goal { border: 1px solid var(--accent); border-radius: 8px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.mount-goal .mount-target-head { margin-bottom: 0; }
.mount-page h2.mount-goal-title { font-size: 16px; margin: 2px 0 0; }
.mount-command-row { display: flex; align-items: flex-start; gap: 8px; }
.mount-command-row .mount-command { flex: 1; min-width: 0; }
.mount-line { font-size: 13px; line-height: 1.4; }
.mount-line-dim { color: var(--text-dim); font-size: 12px; }
.mount-key-missing { color: var(--warning, #c98a2b); }
.mount-key-added { color: #2e9d57; }
.mount-conflict { margin: 10px 0 0; font-size: 12px; color: var(--text-dim); }
.mount-prep .mount-targets { gap: 4px; }
.mount-step { border-left: 3px solid var(--border); padding: 2px 0 2px 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.mount-step-done { border-left-color: #2e9d57; }
.mount-step-done .mount-step-title { color: #2e9d57; }
details.mount-why, details.mount-done, details.mount-trouble { font-size: 12px; }
details.mount-why > summary, details.mount-trouble > summary { cursor: pointer; color: var(--text-dim); width: fit-content; }
details.mount-trouble > summary { font-size: 13px; font-weight: 500; color: var(--text); }
details.mount-done { border: 1px dashed var(--border); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
details.mount-done > summary { cursor: pointer; color: #2e9d57; font-weight: 500; font-size: 13px; }
details[open] > summary { margin-bottom: 4px; }
details.mount-trouble { display: flex; flex-direction: column; gap: 4px; }
.mount-key-error { font-size: 12px; margin-top: -4px; }
.mount-key-error.hidden { display: none; }
.mount-step .mount-keys-section { margin-top: 6px; }
.mount-step .mount-keys-section .mount-section-title { margin-top: 4px; }

/* ── Подключить диск одной командой (TASK-125) ── */
.mount-installer { border: 1px solid var(--accent); border-radius: 8px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.mount-installer-howto { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.mount-installer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Исполнитель SAP GUI (TASK-145): имя подключения — своей строкой на всю ширину. */
.vb-runner-conn-label { display: block; margin: 8px 0; }
.vb-runner-conn-label input { display: block; box-sizing: border-box; width: 100%; max-width: 420px; margin-top: 4px; padding: 7px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.mount-installer-btn { font-weight: 600; font-size: 13px; padding: 5px 14px; background: var(--accent); border-color: var(--accent); color: var(--bg); }
/* Специфичность выше общего `.btn-sm:hover { color: var(--accent) }`: иначе
   под курсором надпись красится в цвет фона (BUG-001 QA TASK-125). */
.mount-installer .mount-installer-btn:hover,
.mount-installer .mount-installer-btn:focus-visible { color: var(--bg); border-color: var(--accent); filter: brightness(0.88); }
/* Фон уходит ОТ текста: в светлой теме текст светлый — фон темнеет, в тёмной
   текст тёмный — фон светлеет (контраст 3.7 → 4.6 и 7.8 → 9.5). */
body.dark .mount-installer .mount-installer-btn:hover,
body.dark .mount-installer .mount-installer-btn:focus-visible { filter: brightness(1.12); }
.mount-installer .mount-installer-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mount-installer .mount-installer-btn:disabled { color: var(--bg); opacity: 0.6; cursor: wait; filter: none; }
.mount-installer-result { display: flex; flex-direction: column; gap: 6px; }
.mount-installer-result:empty { display: none; }

/* Доступ к проекту (TASK-78). */
.access-block { padding: 10px 0; border-top: 1px solid var(--border, #ddd); margin-top: 6px; }
/* Методология проекта (F19 шаг 5, TASK-219): мастер и настройки */
.methodology-form { margin: 8px 0; }
.methodology-form .mf-reason { color: var(--red); }
.methodology-form .mf-params { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
/* .modal-box label ставит подпись под поле столбиком — флажку нужна строка */
.methodology-form label.checkbox-row { flex-direction: row; align-items: center; margin: 0; }
.methodology-form [data-mf="summary"] { font-size: 12px; color: var(--text-dim); }
.methodology-form .mf-param input[type="number"] { max-width: 120px; }
.access-members { margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.access-member { display: flex; align-items: center; gap: 8px; }
.access-member .access-email { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.access-grant-row { display: flex; gap: 6px; align-items: center; }
.access-grant-row input { flex: 1; min-width: 0; }
.access-empty { font-size: 12px; color: var(--text-dim); }
.access-note { margin-top: 6px; }

/* ── Доступ изменился — диск переподключить (TASK-79) ── */
.mount-access-changed { border: 1px solid #d98324; border-left-width: 4px; border-radius: 8px; background: rgba(217, 131, 36, 0.08); padding: 10px 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.mount-access-changed.hidden { display: none; }
.mount-access-changed .mount-dismiss { align-self: flex-start; }
/* Ручная часть свёрнута под установщиком (TASK-127). Заголовок свёртки —
   как заголовок секции, со стрелкой; без установщика он скрыт, а блок
   раскрыт: на macOS/Linux ручные шаги — единственный путь. */
.mount-installer:not(.hidden) + .mount-access-changed { margin-top: 12px; }
details.mount-manual > summary.mount-manual-head { cursor: pointer; width: fit-content; max-width: 100%; color: var(--text); }
details.mount-manual > summary.mount-manual-head:hover { color: var(--accent); }
details.mount-manual > summary.mount-manual-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Стенды в контуре (TASK-83) ── */
.mount-stands.hidden { display: none; }

/* ── Лимиты стендов (TASK-85) ── */
.limits-input { width: 72px; }
.machine-limits-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.limits-status { font-size: 12px; white-space: pre-wrap; margin: 0; flex-basis: 100%; }
.limits-status.error { color: var(--danger); }
.contour-limits { font-size: 12px; white-space: normal; }
.contour-limits summary { cursor: pointer; color: var(--text-dim); }

/* Каталог моделей OpenCode из контура (TASK-109) */
.model-search-row { display: flex; gap: 6px; margin: 4px 0; }
.model-search-row input[type="search"] { flex: 1; min-width: 0; }
option.model-no-tools { color: var(--text-dim); }
option.model-missing { font-style: italic; }
option.model-unavailable { color: var(--text-dim); }
.model-providers { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 12px; }
.model-providers code { font-size: 11px; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.model-provider-row { color: var(--text); }

/* Значок агента по провайдеру (TASK-117): currentColor-логотипы — маской */
.icon-mask { display: inline-block; width: 16px; height: 16px; background-color: var(--text);
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.icon-zai { -webkit-mask-image: url(icons/zai.svg); mask-image: url(icons/zai.svg); }

/* Блок «Зрение» в настройках (TASK-119) */
.vision-agents { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; }
.vision-agents li { padding: 2px 0; }
.vision-agents li.vision-off { color: var(--text-dim); }

/* Личные креды MCP (TASK-135) — в диалоге «Креды» сервера (TASK-138). */
#modal-creds .modal-box { width: 560px; max-height: 85vh; overflow-y: auto; }
.creds-body { display: flex; flex-direction: column; gap: 10px; }
.creds-var { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.creds-var .env-var-key, .creds-add-label { overflow-wrap: anywhere; }
.creds-add-label { margin-top: 6px; }
.creds-body .env-input-row { flex-wrap: wrap; }
/* На узком экране кнопки уходят под поле, а не сжимают его. */
.creds-body .env-input-row input { min-width: 0; flex: 1 1 200px; }
.my-conn-hint { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.my-conn-state { font-family: inherit; border-radius: 4px; padding: 0 6px; }
.my-conn-state.on { color: #30d158; background: rgba(48,209,88,0.1); }
.my-conn-state.off { color: var(--text-dim); border: 1px solid var(--border); }
.my-conn-shared { color: var(--orange, #e0a030); }
.my-conn-var-hint { font-size: 12px; color: var(--text-dim); line-height: 1.4; overflow-wrap: anywhere; }
.my-conn-var-hint a { color: var(--accent); }
/* Кнопка «Креды» у сервера: состояние своих значений. */
.btn-creds-mcp.creds-all { border-color: #30d158; color: #30d158; }
.btn-creds-mcp.creds-partial { border-color: var(--orange, #e0a030); color: var(--orange, #e0a030); }
.btn-creds-mcp.creds-none, .btn-creds-mcp.creds-unknown { color: var(--text-dim); }
/* Длинная команда сервера (`@modelcontextprotocol/server-github`) на 390 px
   выталкивала кнопки карточки за край окна (TASK-138): переносится внутри. */
.project-mcp-head { flex-wrap: wrap; }
.project-mcp-cmd { min-width: 0; overflow-wrap: anywhere; }
/* Общее поле переменной проекта: на 390 px кнопка уходит под поле, а не за
   край карточки; подсказка «значение, общее для всех участников…» длиннее
   прежней «Введите токен…» (TASK-138). */
.project-mcp-env .env-input-row { flex-wrap: wrap; }
.project-mcp-env .env-input-row input { min-width: 0; flex: 1 1 200px; }

/* Меню «+ Добавить» MCP: свой сервер или шаблон «SAP» (TASK-155). */
.add-mcp-wrap { position: relative; display: inline-block; }
.add-mcp-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; display: flex; flex-direction: column; min-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 4px; }
.add-mcp-menu.hidden { display: none; }
.add-mcp-menu button { text-align: left; background: none; border: none; padding: 7px 10px; color: var(--text); cursor: pointer; border-radius: 4px; }
.add-mcp-menu button:hover { background: var(--bg); }
#sap-arc1-fields { display: flex; flex-direction: column; gap: 14px; }
#sap-arc1-fields.hidden { display: none; }
#modal-sap .modal-box { max-height: 92vh; overflow-y: auto; }
#sap-arc1-fields label.hidden { display: none; }
/* Шкала контекста у агента без роли (TASK-161): без подписи, высота как у плашки роли. */
.role-bar.no-role .role-bar-label { min-height: 18px; }
/* Provision без sudo (TASK-162): команда для root с «Копировать». */
.host-root-cmds { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.host-root-cmds:empty { display: none; }
.host-root-cmd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; color: var(--yellow); padding: 4px 0; }
.host-root-cmd code { font-family: monospace; background: var(--surface2); color: var(--text); padding: 2px 6px; border-radius: 4px; user-select: all; }

/* ── Закладка «Подписки» (TASK-163) ─────────────────────────────────── */
.subscriptions-intro { margin-bottom: 10px; }
.subscriptions-list { margin-top: 12px; }
.subscription-key-row { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.subscription-key-row .setting-desc a { color: var(--accent); }
.subscription-state-connected { color: var(--green); }
.subscription-state-unknown { color: var(--yellow); }
/* Ключ из окружения контура (TASK-165): работает, но закладкой не управляется. */
.subscription-state-env { color: var(--text-dim); font-style: italic; }
.subscription-key-row .subscription-code-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.subscription-key-row .subscription-code-row input { flex: 1; min-width: 160px; }

/* ── Человек в маршруте (F19 шаг 4, TASK-218) ──────────────────────────────
   Статусы пакетов, которых нет в STATUS_BADGE_MAP, красятся по kind состояния
   (GET …/methodology): tdd-monitor остаётся со своими цветами. */
.task-status-badge.st-kind-work { background: rgba(0,122,255,0.12); color: var(--accent); }
.task-status-badge.st-kind-wait_human { background: rgba(255,59,48,0.14); color: var(--red); font-weight: 600; }
.task-status-badge.st-kind-wait_children { background: rgba(88,86,214,0.12); color: var(--accent2); }
.task-status-badge.st-kind-hold { background: rgba(142,142,147,0.2); color: var(--text-dim); font-weight: 600; }
.task-status-badge.st-kind-final { background: rgba(52,199,89,0.25); color: var(--green); font-weight: 700; }
.waiting-holder { position: relative; display: inline-flex; }
#waiting-btn { border-color: var(--red); }
#waiting-btn.active { background: var(--red); color: #fff; }
#waiting-btn.active .waiting-count { background: #fff; color: var(--red); }
.waiting-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.waiting-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 360px; max-width: calc(100vw - 32px); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 8px; }
.waiting-panel-title { font-size: 12px; color: var(--text-dim); padding: 2px 6px 6px; }
.waiting-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; cursor: pointer; color: var(--text); font-size: 13px; }
.waiting-item:hover { border-color: var(--accent); }
.waiting-item-head { font-size: 11px; color: var(--text-dim); }
.waiting-empty { font-size: 12px; color: var(--text-dim); padding: 6px; }
.task-route-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.task-route-buttons .btn-sm { padding: 4px 10px; }
.task-route-buttons .btn-sm.needs-comment::after { content: ' *'; color: var(--red); }
.task-route-comment { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; resize: vertical; margin-bottom: 6px; }
.task-route-comment.invalid { border-color: var(--red); }

/* ── Узкий экран ≤ 480 px (TASK-176) ─────────────────────────────────────
   Шапка в строку не помещалась (кнопки уходили до ~860 px), карточка задачи
   колонкой в 280 px зажимала таблицу и вылезала за край. Здесь: кнопки —
   иконками (подпись в title/aria-label), пользователь — второй строкой;
   трекер — на всю ширину, карточка — поверх списка. Десктоп не затронут. */
@media (max-width: 480px) {
  header { height: auto; flex-wrap: wrap; padding: 6px 12px; gap: 6px 8px; }
  .logo { display: none; }
  .project-selector { flex: 1 1 0; min-width: 0; }
  .project-selector select { flex: 1 1 0; min-width: 0; }
  header .btn-label { display: none; }
  .current-user { order: 1; flex-basis: 100%; margin-left: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Колонка агентов оставила бы трекеру ~150 px — пока он открыт, её нет. */
  .body:has(#tasks-view:not(.hidden)) #agents-panel,
  .body:has(#tasks-view:not(.hidden)) #aside-resizer { display: none; }
  /* Шесть колонок в 390 px не помещаются: тип и область есть в фильтрах
     и в карточке задачи, в списке их нет. */
  #tracker-table th:nth-child(3), #tracker-table td:nth-child(3),
  #tracker-table th:nth-child(4), #tracker-table td:nth-child(4) { display: none; }
  #tracker-table th, #tracker-table td { padding: 8px 6px; }
  #tracker-table .task-status-badge { white-space: normal; }
  .tasks-header { padding: 8px 12px; }
  /* Фильтры и кнопки эпиков (TASK-180) — сеткой в две колонки, не шире экрана. */
  .tasks-header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tasks-header #tracker-project-select { grid-column: 1 / -1; }
  .tasks-header select, .tasks-header .tracker-action { width: 100%; min-width: 0; }
  .modal-box { padding: 18px 16px; }
  .tasks-body { position: relative; }
  .task-detail-panel { position: absolute; inset: 0; width: auto; min-width: 0; max-width: none; border-left: none; z-index: 5; padding: 12px 14px; }
  #task-detail-resizer { display: none; }
  .task-detail-close { width: 36px; height: 36px; font-size: 16px; }
  /* «Ждут вас» (TASK-218): список — во всю ширину экрана, а не от кнопки вправо. */
  .waiting-panel { position: fixed; top: 52px; left: 12px; right: 12px; width: auto; max-width: none; }
}
