/* Denis app — тёмная тема, палитра и шрифт из PaceLogic */
:root {
  --bg: #0d0d0d;
  --side: #111110;
  --panel: #1a1a19;
  --panel2: #212120;
  --field: #131312;
  --line: #2c2c2a;
  --line2: #3b3b38;
  --ink: #fff;
  --ink2: #c3c2b7;
  --muted: #898781;
  --acc: #3987e5;
  --acc2: #4b94ea;
  --ok: #2fbf71;
  --warn: #f0b429;
  --err: #e66767;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

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

html, body { height: 100%; margin: 0; }

body {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink2);
  font: 15px/1.4 -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* тонкие тёмные скроллбары */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #34342f; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #46463f; }
::-webkit-scrollbar-corner { background: transparent; }

::selection { background: rgba(57, 135, 229, .35); }

a { color: var(--acc); }
h1, h2, h3, h4 { color: var(--ink); }
h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.err-text { color: var(--err); }
.ok-text { color: var(--ok); }
.mono { font-family: var(--mono); }

/* ---------- фокус ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- кнопки ---------- */
button {
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s, opacity .12s;
}
button:hover { background: var(--panel2); border-color: var(--line2); }
button:disabled { opacity: .55; cursor: default; pointer-events: none; }
.btn-sm { font-size: 12px; padding: 4px 8px; }
.btn-acc { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn-acc:hover { background: var(--acc2); border-color: var(--acc2); }
button.armed, button.armed:hover { color: var(--err); border-color: var(--err); background: var(--panel); }
button.stop { color: var(--err); border-color: rgba(230, 103, 103, .5); background: var(--panel); }
button.stop:hover { border-color: var(--err); background: var(--panel2); }

/* ---------- поля ввода ---------- */
input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
  max-width: 100%;
}
input::placeholder, textarea::placeholder { color: #66655f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(57, 135, 229, .22); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--acc); flex: none; cursor: pointer; }
input[type="checkbox"]:focus { box-shadow: none; }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  cursor: pointer;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23898781' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ---------- боковая панель ---------- */
#side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 18px 10px 12px;
}
.brand { padding: 4px 10px 18px; }
.brand-name { font-size: 13px; font-weight: 600; letter-spacing: .2em; color: var(--muted); }
.brand-sub { font-size: 12px; color: #6b6a64; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block;
  color: var(--ink2);
  text-decoration: none;
  border-radius: 8px;
  padding: 7px 10px;
}
.nav a:hover { background: var(--panel); color: var(--ink); }
.nav a.active { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.side-label { font-size: 11px; letter-spacing: .14em; color: var(--muted); padding: 22px 10px 6px; }
.side-projects { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side-projects a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  padding: 5px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-projects a:hover { color: var(--ink); background: var(--panel); }
.side-projects a.active { color: var(--ink); background: var(--panel); }
.side-empty { font-size: 13px; color: var(--muted); padding: 6px 10px; }

.side-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 4px; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--err); }

/* ---------- основная область ---------- */
#view {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  padding: 28px 36px 56px;
}
#view.fill { overflow: hidden; padding: 0; }
.page { max-width: 1400px; margin: 0 auto; }
.page.narrow { max-width: 720px; margin: 0; }
.loading { color: var(--muted); padding: 20px 0; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 22px;
}
.page-title { flex: 1 1 260px; min-width: 0; }
.sub { margin-top: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-tools { display: flex; gap: 8px; align-items: center; min-width: 0; }
#proj-search { width: 260px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; overflow-wrap: anywhere; }
.panel-err { border-color: rgba(230, 103, 103, .45); color: var(--ink); }
.panel-err .muted { margin-top: 6px; font-size: 13px; }

/* ---------- карточки проектов ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.grid-small { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .12s, background-color .12s, opacity .12s;
}
.card:hover { border-color: var(--line2); background: #1d1d1c; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.card-name { margin-top: -5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.card-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: auto; }
.card .btn-sm { background: var(--panel2); }
.card .btn-sm:hover { background: #2a2a28; }
.card.moved { opacity: .55; }
.card.moved:hover { opacity: .8; }
.card.small { padding: 10px 12px; gap: 6px; opacity: .72; }
.card.small:hover { opacity: 1; }
.card.small .card-title { font-size: 14px; }
.card.small .card-desc { font-size: 13px; -webkit-line-clamp: 2; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.tag {
  max-width: 100%;
  font-size: 11.5px;
  color: var(--ink2);
  background: #232322;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip { flex: none; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 1px 7px; white-space: nowrap; }
.chip-warn { color: var(--warn); border-color: rgba(240, 180, 41, .35); }
.git {
  font: 11.5px/1.5 var(--mono);
  color: var(--ink2);
  background: #232322;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 6px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.git b { color: var(--warn); font-weight: 600; }

.archive { margin-top: 30px; }
.archive-toggle { background: none; border: 0; padding: 4px 2px; font-size: 14px; color: var(--muted); }
.archive-toggle:hover { background: none; color: var(--ink); }
.caret { display: inline-block; width: 10px; transition: transform .15s; }
.archive.open .caret { transform: rotate(90deg); }

/* ---------- страница проекта ---------- */
.back { display: inline-block; margin-bottom: 12px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.proj-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; }
.proj-info { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.proj-name { font-size: 13px; color: var(--muted); }
.proj-path {
  max-width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 4px;
  font: 12.5px/1.4 var(--mono);
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: copy;
}
.proj-path:hover { background: none; color: var(--ink2); }
.proj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.proj-desc { margin: 4px 0 0; max-width: 760px; color: var(--ink2); overflow-wrap: anywhere; }
.proj-acts { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  overflow-x: auto;
  box-shadow: inset 0 -1px 0 var(--line);
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  flex: none;
  max-width: 240px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab:hover { background: none; color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--acc); }
.tab-body { min-width: 0; }
.tab-body > .doc { max-width: 880px; }
.doc-meta { margin-bottom: 14px; font-size: 12px; color: var(--muted); }

/* файлы */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.crumbs button { max-width: 240px; background: none; border: 0; padding: 3px 6px; font-size: 13px; color: var(--acc); overflow: hidden; text-overflow: ellipsis; }
.crumbs button:hover { background: var(--panel); }
.crumbs .cur { padding: 3px 6px; color: var(--ink); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .sep { color: #5d5c57; }

.flist { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.frow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 150px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  font-size: 13.5px;
  color: var(--ink2);
  text-align: left;
}
.frow:first-child { border-top: 0; }
.frow.head { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
button.frow:hover { background: #20201f; border-color: var(--line); }
button.frow:focus-visible { outline-offset: -2px; }
.frow.sel, button.frow.sel:hover { background: rgba(57, 135, 229, .14); }
.frow.dir .fname { color: var(--ink); }
.frow .r { text-align: right; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slash { color: var(--muted); }
.empty-row { display: block; }
.flist-err { padding: 14px; color: var(--err); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.viewer { margin-top: 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.viewer > .loading { padding: 16px; }
.viewer > .panel { margin: 0; border: 0; border-radius: 0; }
.viewer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  min-width: 0;
}
.viewer-name { min-width: 0; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-head .muted { flex: none; }
.viewer-head .btn-sm { margin-left: auto; }
.viewer-body { padding: 18px 20px; }
.note { padding: 7px 14px; font-size: 12px; color: var(--warn); border-bottom: 1px solid var(--line); }
pre.code { margin: 0; padding: 14px 16px; max-height: 70vh; overflow: auto; font: 12.5px/1.55 var(--mono); color: var(--ink2); white-space: pre; tab-size: 4; }
.noprev { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 44px 16px; color: var(--ink2); }
.noprev .muted { font-size: 13px; }

/* скрипты */
.scripts { display: flex; flex-direction: column; gap: 8px; max-width: 880px; }
.script {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.script-info { min-width: 0; }
.script code { font: 13px/1.4 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.script .muted { margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.script button { flex: none; }

/* ---------- типографика markdown ---------- */
.doc { min-width: 0; font-size: 15px; line-height: 1.6; color: var(--ink2); overflow-wrap: anywhere; }
.doc > :first-child { margin-top: 0; }
.doc > :last-child { margin-bottom: 0; }
.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6 { margin: 1.5em 0 .5em; line-height: 1.25; color: var(--ink); font-weight: 650; }
.doc h1 { font-size: 24px; }
.doc h2 { font-size: 20px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.doc h3 { font-size: 17px; }
.doc h4, .doc h5, .doc h6 { font-size: 15px; }
.doc p, .doc ul, .doc ol, .doc pre, .doc table, .doc blockquote, .doc dl { margin: 0 0 .9em; }
.doc ul, .doc ol { padding-left: 1.5em; }
.doc li + li { margin-top: .2em; }
.doc li > ul, .doc li > ol { margin: .2em 0 0; }
.doc li > p { margin: 0 0 .4em; }
.doc a { color: var(--acc); text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc strong { color: var(--ink); font-weight: 650; }
.doc code { font: .87em/1.5 var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; }
.doc pre { max-width: 100%; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; overflow-wrap: normal; }
.doc pre code { display: block; padding: 0; background: none; border: 0; font-size: 12.5px; line-height: 1.55; white-space: pre; overflow-wrap: normal; }
.doc table { display: block; max-width: 100%; width: max-content; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.doc th, .doc td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: normal; }
.doc th { background: var(--panel); color: var(--ink); font-weight: 600; }
.doc blockquote { margin-left: 0; margin-right: 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--line2); color: var(--muted); }
.doc blockquote > :last-child { margin-bottom: 0; }
.doc img { max-width: 100%; height: auto; border-radius: 8px; }
.doc hr { margin: 1.6em 0; border: 0; border-top: 1px solid var(--line); }
.doc input[type="checkbox"] { margin-right: 6px; vertical-align: -2px; pointer-events: none; }
.doc.plain { white-space: pre-wrap; }

/* ---------- ИИ ---------- */
.ai-page { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100%; min-height: 0; }

.conv-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.conv-head { display: flex; gap: 6px; padding: 14px 12px 12px; border-bottom: 1px solid var(--line); }
.conv-head button { flex: none; }
.conv-head select { flex: 1; min-width: 0; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.conv-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.conv { position: relative; flex: none; min-width: 0; padding: 8px 34px 8px 10px; border-radius: 8px; cursor: pointer; }
.conv:hover { background: var(--panel); }
.conv.active { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.conv:focus-visible { outline-offset: -2px; }
.conv-title { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-sub { margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-del {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border-color: transparent;
  opacity: 0;
}
.conv:hover .conv-del, .conv.active .conv-del, .conv-del:focus-visible, .conv-del.armed { opacity: 1; }
.conv-del:hover { color: var(--ink); background: var(--panel2); border-color: var(--line); }
.conv-del.armed { font-size: 12px; background: var(--bg); }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--acc); vertical-align: 1px; animation: pulse 1.2s ease-in-out infinite; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.chat-id { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; padding-top: 2px; }
.chat-title {
  min-width: 0;
  margin: 0 0 0 -5px;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}
.chat-title:hover { background: var(--panel); }
.title-input { flex: 1; min-width: 0; padding: 3px 8px; font-size: 16px; font-weight: 650; }
.badge {
  flex: none;
  max-width: 200px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--ink2);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.badge:hover { color: var(--ink); border-color: var(--line2); }
.chat-opts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; max-width: 100%; }
.opts-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.opts-row select { max-width: 220px; padding: 4px 26px 4px 8px; font-size: 12.5px; background-position: right 8px center; }
.mode-hint { font-size: 11.5px; color: var(--warn); }

.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 24px 14px;
}
.msg { min-width: 0; flex: none; }
.msg.user {
  align-self: flex-end;
  max-width: min(78%, 720px);
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.ai { align-self: stretch; max-width: 1000px; margin-right: 48px; }
.msg-foot { margin-top: 8px; font-size: 12px; color: var(--muted); }
.blk { margin-bottom: 10px; line-height: 1.55; color: var(--ink2); white-space: pre-wrap; overflow-wrap: anywhere; }
.blk:empty { display: none; }
.live-err { margin: 4px 0 8px; color: var(--err); overflow-wrap: anywhere; }

.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-width: 0; }
.step {
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
  min-width: 0;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.step .lbl { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step b { font-weight: 500; color: var(--ink2); }
.mk { flex: none; margin-left: 6px; }
.mk.ok { color: var(--ok); }
.mk.bad { color: var(--err); }
.mk.wait { color: var(--muted); }
.steps-more { margin-bottom: 10px; }
.steps-more summary {
  display: inline-block;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line2);
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}
.steps-more summary::-webkit-details-marker { display: none; }
.steps-more summary:hover { color: var(--ink); }
.steps-more[open] summary { margin-bottom: 8px; }
.steps-more .when-open, .steps-more[open] .when-closed { display: none; }
.steps-more[open] .when-open { display: inline; }

.pulse { font-size: 14px; color: var(--acc); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.composer textarea { flex: 1; resize: none; padding: 9px 12px; font-size: 15px; line-height: 1.4; overflow-y: hidden; }
.composer button { flex: none; padding: 9px 16px; font-size: 14px; }

.chat-empty {
  margin: auto;
  max-width: 440px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: var(--ink2);
}
.chat-empty h3 { margin: 0 0 4px; font-size: 17px; }
.chat-empty p { margin: 0 0 6px; }
.chat-empty button { margin-top: 10px; }

/* ---------- настройки ---------- */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > legend { font-size: 13px; font-weight: 600; color: var(--ink); }
.field input:not([type="checkbox"]), .field textarea { width: 100%; }
.field select { width: 100%; max-width: 380px; }
.field input.port { width: 140px; }
.field textarea { min-height: 66px; resize: vertical; font: 13px/1.5 var(--mono); }
.field .hint { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
fieldset.group { min-width: 0; margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); gap: 8px; }
fieldset.group > legend { padding: 0 6px; margin-left: -6px; }
.proj-checks { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; margin: 0 -6px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 6px; border-radius: 8px; cursor: pointer; min-width: 0; }
.check:hover { background: var(--panel2); }
.check input { margin-top: 2px; }
.check-text { display: flex; flex-direction: column; min-width: 0; }
.check-name { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.check-desc { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-archive { margin: 4px -6px 0; padding-top: 10px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.mode-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mode-list li.sel { color: var(--ink2); }
.mode-list b { font-weight: 600; color: inherit; }
.form-actions { display: flex; align-items: center; gap: 10px; padding-top: 2px; }
.form-actions button { padding: 8px 18px; font-size: 14px; }
.about { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.about h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.about p { margin: 4px 0; }

/* ---------- тосты ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(640px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  max-width: 100%;
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink);
  background: #232322;
  border: 1px solid var(--line2);
  border-left: 3px solid var(--ok);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55);
  overflow-wrap: anywhere;
  pointer-events: auto;
  cursor: default;
  animation: toast-in .16s ease-out;
  transition: opacity .2s, transform .2s;
}
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- узкие окна ---------- */
@media (max-width: 1100px) {
  #view { padding: 22px 24px 48px; }
  .ai-page { grid-template-columns: 232px minmax(0, 1fr); }
  .msgs { padding: 16px 18px 12px; }
  .msg.ai { margin-right: 12px; }
  .chat-head, .composer { padding-left: 16px; padding-right: 16px; }
  #proj-search { width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
