:root {
  --bg: #0d0f14; --panel: #141821; --panel2: #1a1f2b; --line: #262c3a; --line2: #323a4c;
  --text: #e6e9f0; --muted: #8b93a7; --dim: #5d6579;
  --accent: #7c6cff; --accent2: #a497ff; --accent-bg: rgba(124,108,255,.12);
  --green: #3ecf8e; --green-bg: rgba(62,207,142,.12); --red: #ff6b6b; --red-bg: rgba(255,107,107,.12);
  --amber: #f5b14c; --amber-bg: rgba(245,177,76,.12); --blue: #5fb4ff; --blue-bg: rgba(95,180,255,.12);
  --radius: 10px; --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overflow: clip; background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; width: 100%; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
a { color: var(--accent2); }

.app { display: grid; grid-template-columns: 270px 1fr; height: 100vh; overflow: clip; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; font-weight: 700; font-size: 16px; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #ff6bb5); display: grid; place-items: center; font-size: 15px; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.side-actions { padding: 0 12px 10px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.side-group { margin-top: 10px; }
.side-group h4 { margin: 0; padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); display: flex; justify-content: space-between; }
.s-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 8px; color: var(--text); }
.s-item:hover { background: var(--panel2); }
.s-item.active { background: var(--accent-bg); }
.s-item .t { display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-item .m { font-size: 11.5px; color: var(--muted); padding-left: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.dot.running { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); animation: pulse 1.4s infinite; }
.dot.waiting { background: var(--amber); }
.dot.done { background: var(--green); }
.dot.error { background: var(--red); }
.dot.stopped { background: var(--dim); }
@keyframes pulse { 50% { opacity: .45; } }
.side-foot { border-top: 1px solid var(--line); padding: 8px; display: flex; gap: 4px; }
.side-foot button { flex: 1; background: none; border: 0; padding: 8px 2px; border-radius: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.side-foot button:hover, .side-foot button.active { background: var(--panel2); color: var(--text); }

.main { min-width: 0; overflow: hidden; overflow: clip; display: flex; flex-direction: column; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 17px; flex: 1; min-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 22px; }
.wrap { max-width: 1080px; margin: 0 auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #8d7fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #06281a; }
.btn.danger { color: var(--red); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.accent { color: var(--accent2); background: var(--accent-bg); border-color: transparent; }
.chip.green { color: var(--green); background: var(--green-bg); border-color: transparent; }
.chip.red { color: var(--red); background: var(--red-bg); border-color: transparent; }
.chip.amber { color: var(--amber); background: var(--amber-bg); border-color: transparent; }
.chip.blue { color: var(--blue); background: var(--blue-bg); border-color: transparent; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 4px; }

/* stepper */
.stepper { display: flex; gap: 0; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.step { flex: 1; min-width: 88px; position: relative; text-align: center; font-size: 12px; color: var(--dim); padding-top: 22px; }
.step::before { content: ''; position: absolute; top: 8px; left: 0; right: 0; height: 2px; background: var(--line2); }
.step:first-child::before { left: 50%; } .step:last-child::before { right: 50%; }
.step i { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line2); z-index: 1; }
.step.done { color: var(--muted); } .step.done i { background: var(--green); border-color: var(--green); } .step.done::before { background: var(--green); }
.step.now { color: var(--text); font-weight: 600; } .step.now i { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.step.skip { opacity: .35; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--text); border-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--accent); color: #fff; border-radius: 99px; padding: 0 6px; margin-left: 4px; }

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.ev { border-radius: 9px; padding: 10px 13px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.ev .who { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 8px; align-items: center; }
.ev.user { background: var(--accent-bg); border-color: transparent; margin-left: 15%; }
.ev.stage { background: none; border: 0; padding: 10px 0 0; font-weight: 600; color: var(--accent2); white-space: normal; }
.ev.system { background: none; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.ev.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber); }
.ev.error { background: var(--red-bg); border-color: transparent; color: var(--red); }
.ev.test { font-family: var(--mono); font-size: 12px; max-height: 260px; overflow: auto; }
.ev.test.ok { border-left: 3px solid var(--green); } .ev.test.bad { border-left: 3px solid var(--red); }
.ev.agent_start { background: none; border: 0; padding: 2px 0; font-size: 12px; color: var(--dim); }
.ev.tool { background: none; border: 0; padding: 0 0 0 12px; font-family: var(--mono); font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.tool::before { content: '› '; color: var(--accent); }
.ev .md { white-space: normal; }
.unit-tag { font-size: 10.5px; padding: 0 6px; border-radius: 4px; background: var(--panel2); color: var(--muted); }

.md h1, .md h2, .md h3 { font-size: 15px; margin: 12px 0 6px; } .md h1 { font-size: 17px; }
.md p { margin: 6px 0; } .md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }

.action { border: 1px solid var(--accent); background: linear-gradient(180deg, var(--accent-bg), transparent 60%); }
.q { margin-bottom: 12px; } .q label { color: var(--text); font-size: 14px; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps-list li { counter-increment: s; position: relative; padding: 10px 12px 10px 40px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--panel2); }
.steps-list li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-bg); color: var(--accent2); font-size: 12px; display: grid; place-items: center; }
.spec-box { max-height: 340px; overflow: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 12px; }

/* board */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.unit { display: flex; flex-direction: column; gap: 8px; }
.unit .head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.unit .head b { font-size: 14px; }
.pipe { display: flex; gap: 4px; align-items: center; font-size: 11.5px; color: var(--dim); flex-wrap: wrap; }
.pipe span.on { color: var(--accent2); font-weight: 600; } .pipe span.ok { color: var(--green); }
.warnbox { font-size: 12.5px; color: var(--amber); background: var(--amber-bg); border-radius: 6px; padding: 6px 9px; }

/* diff */
.diff-layout { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
.files { position: sticky; top: 0; }
.file-btn { display: flex; gap: 6px; width: 100%; background: none; border: 0; border-radius: 6px; padding: 6px 8px; text-align: left; font-family: var(--mono); font-size: 12px; align-items: center; }
.file-btn:hover { background: var(--panel2); }
.file-btn .st { width: 16px; font-weight: 700; } .st.A { color: var(--green); } .st.M { color: var(--amber); } .st.D { color: var(--red); }
.file-btn .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.add { color: var(--green); } .del { color: var(--red); }
.dfile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; background: var(--panel); }
.dfile .dh { padding: 8px 12px; background: var(--panel2); font-family: var(--mono); font-size: 12.5px; display: flex; gap: 10px; border-bottom: 1px solid var(--line); }
table.dl { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; }
table.dl td { padding: 0 8px; white-space: pre-wrap; word-break: break-all; vertical-align: top; }
table.dl td.n { width: 1%; min-width: 42px; color: var(--dim); text-align: right; user-select: none; cursor: pointer; }
table.dl tr.a td.c { background: rgba(62,207,142,.10); } table.dl tr.a td.n { background: rgba(62,207,142,.06); }
table.dl tr.d td.c { background: rgba(255,107,107,.10); } table.dl tr.d td.n { background: rgba(255,107,107,.06); }
table.dl tr.h td { background: var(--blue-bg); color: var(--blue); padding: 3px 8px; }
table.dl tr:hover td.n { color: var(--accent2); }
table.dl tr.cm td { background: var(--accent-bg); padding: 8px 12px; font-family: inherit; white-space: normal; }
.cm-box { display: flex; gap: 8px; } .cm-box input { flex: 1; }
.decision { position: sticky; bottom: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 12px; margin-top: 12px; box-shadow: 0 -8px 24px rgba(0,0,0,.35); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; }
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.mode { border: 1px solid var(--line2); border-radius: 10px; padding: 10px; background: var(--bg); text-align: left; }
.mode b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.mode span { font-size: 11.5px; color: var(--muted); line-height: 1.35; display: block; }
.mode.active { border-color: var(--accent); background: var(--accent-bg); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 14px; }
.toggles label { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.toggles input { width: auto; accent-color: var(--accent); }
.panel-list label { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 13px; }
.panel-list input[type=checkbox] { width: auto; accent-color: var(--accent); }

.empty { text-align: center; padding: 60px 20px; }
.empty h1 { font-size: 26px; margin: 0 0 8px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 26px 0; text-align: left; }
.flow .card { padding: 12px; } .flow b { display: block; margin-bottom: 4px; color: var(--accent2); }
.flow p { margin: 0; font-size: 12.5px; color: var(--muted); }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat .card { padding: 14px; } .stat .v { font-size: 22px; font-weight: 700; } .stat .k { font-size: 12px; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
table.t th { color: var(--muted); font-weight: 500; font-size: 12px; }
pre.snip { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; margin: 6px 0; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 14px; z-index: 99; max-width: 420px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.err { border-color: var(--red); color: var(--red); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; } .app.nav .sidebar { display: flex; position: fixed; inset: 0 30% 0 0; z-index: 40; }
  .burger { display: inline-flex !important; }
  .diff-layout, .grid2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .ev.user { margin-left: 0; }
}
.burger { display: none !important; }

/* строка ролей */
.roles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 16px; }
.role { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line2); color: var(--dim); background: var(--panel); }
.role.on { color: var(--text); border-color: var(--accent); background: var(--accent-bg); }
.role.done { color: var(--green); border-color: transparent; background: var(--green-bg); }
.roles .arrow { color: var(--dim); font-size: 12px; }
/* журнал */
.ev.tool .verb { color: var(--accent2); font-family: inherit; font-weight: 600; margin-right: 4px; }
.ev.tool code { color: var(--muted); }
.ev.milestone { background: none; border: 0; text-align: center; color: var(--green); font-size: 13px; padding: 8px 0; white-space: normal; }
/* история */
.gitbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.gitbar .btn { text-decoration: none; }
.gitbar .disabled-link { opacity: .5; }
.gitexplain { margin-top: 10px; display: grid; gap: 2px; }
.bar { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* новая сессия */
.nc-wrap { display: flex; flex-direction: column; justify-content: flex-end; }
.nc { width: min(820px, 100%); margin: 0 auto; padding-top: 20px; }
.nc-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.nc-sentence { font-size: 18px; color: var(--muted); margin: 6px 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
select.inline { width: auto; background: transparent; border: 0; color: var(--text); font-size: 18px; font-weight: 600; padding: 2px 4px; cursor: pointer; }
select.inline:hover { background: var(--panel2); }
.nc-box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 12px; }
.nc-box textarea { border: 0; background: transparent; resize: none; font-size: 15px; padding: 4px; min-height: 64px; }
.nc-box textarea:focus { border: 0; }
.nc-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.nc-tools .tool { background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; color: var(--muted); }
.nc-tools .tool.on { color: var(--text); border-color: var(--accent); background: var(--accent-bg); }
.mini { width: auto; font-size: 12.5px; padding: 5px 8px; background: var(--panel2); }
input.mini { width: 170px; }
.nc-modes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chipbtn { background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: var(--muted); }
.chipbtn b { color: var(--text); }
.chipbtn.active { border-color: var(--green); color: var(--text); }
.nc-opts { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); }
.nc-opts label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.nc-opts input { width: auto; accent-color: var(--accent); }
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.pipeline span.on { color: var(--green); }
.pipeline i { width: 18px; border-top: 1px dashed var(--line2); }
table.workers { width: 100%; border-collapse: collapse; }
table.workers td { padding: 3px 4px; }
table.workers select, table.workers input { font-size: 12.5px; padding: 5px 8px; }
.link { background: none; border: 0; color: var(--accent2); font-size: 12.5px; padding: 2px 6px; }
.link.danger { color: var(--red); }
.qst { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.qst.running { color: var(--blue); background: var(--blue-bg); } .qst.done { color: var(--green); background: var(--green-bg); } .qst.attention { color: var(--amber); background: var(--amber-bg); }

/* светлая тема */
:root[data-theme="light"] { --bg: #f5f6fa; --panel: #ffffff; --panel2: #eef0f6; --line: #e2e5ee; --line2: #d3d7e3; --text: #1b1e27; --muted: #5d6578; --dim: #8b93a7; color-scheme: light; }
body.tint .card, body.tint .nc-box, body.tint .nc-card { background: linear-gradient(var(--accent-bg), var(--accent-bg)), var(--panel); }
body.bg-grid .main { background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 28px 28px; }
body { background-size: cover; background-position: center; }
.app.collapsed { grid-template-columns: 0 1fr; } .app.collapsed .sidebar { display: none; }
.side-foot { flex-direction: column; gap: 2px; }
.side-foot button { text-align: left; padding: 7px 10px; font-size: 13px; }
.settings-layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; max-width: 1100px; margin: 0 auto; align-items: start; }
.snav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.snav-g { font-size: 10.5px; letter-spacing: .08em; color: var(--dim); margin: 12px 0 4px 8px; }
.snav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; border: 1px solid transparent; }
.snav a:hover { background: var(--panel2); color: var(--text); } .snav a.on { background: var(--accent-bg); color: var(--text); border-color: var(--accent); }
.sh { font-size: 18px; margin: 0 0 4px; }
.srow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: 0; }
.themes { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-card { width: 150px; padding: 6px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); text-align: left; }
.theme-card i { display: block; height: 60px; border-radius: 6px; margin-bottom: 6px; }
.th-dark i { background: #0d0f14; } .th-light i { background: #f5f6fa; border: 1px solid #ddd; } .th-system i { background: linear-gradient(90deg, #0d0f14 50%, #f5f6fa 50%); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.accents { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.acc { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; }
.acc.on { border-color: var(--text); }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { background: none; border: 0; padding: 4px 12px; border-radius: 6px; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); }
kbd { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--line2); }
.eng { padding: 12px 0; border-bottom: 1px solid var(--line); } .eng:last-child { border-bottom: 0; }
.pal-bg { align-items: start; padding-top: 12vh; }
.palette { width: min(620px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 14px; font-size: 14px; }
.pal-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.pal-item.sel, .pal-item:hover { background: var(--accent-bg); }
.pal-group { font-size: 10px; letter-spacing: .06em; color: var(--dim); background: var(--panel2); padding: 2px 6px; border-radius: 4px; }
.pal-key { font-size: 11.5px; color: var(--dim); }
.contrib { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; gap: 3px; margin-top: 10px; overflow-x: auto; }
.contrib i, .contrib-l i { display: inline-block; width: 100%; min-width: 9px; height: 11px; border-radius: 2px; background: var(--panel2); }
.contrib-l { display: inline-flex; gap: 3px; } .contrib-l i { width: 11px; }
.l1 { background: var(--accent-bg) !important; } .l2 { background: color-mix(in srgb, var(--accent) 45%, transparent) !important; }
.l3 { background: color-mix(in srgb, var(--accent) 70%, transparent) !important; } .l4 { background: var(--accent) !important; }
.stat .k { font-size: 11px; letter-spacing: .05em; }
.pick { padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.pick:hover { border-color: var(--accent); }
@media (max-width: 860px) { .settings-layout { grid-template-columns: 1fr; } .snav { position: static; } }

/* обёртка экрана должна занимать высоту окна — иначе .content не прокручивается */
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* голосовой помощник */
#assistant { position: fixed; right: 18px; bottom: 18px; z-index: 60; }
.as-fab { background: var(--accent); color: #fff; border: 0; border-radius: 99px; padding: 12px 18px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); position: relative; }
.as-fab.busy { animation: pulse 1.4s infinite; }
.as-badge { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.as-panel { width: min(420px, calc(100vw - 36px)); height: min(640px, calc(100vh - 36px)); background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.as-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.as-head select { max-width: 120px; }
.as-ico { background: none; border: 0; font-size: 16px; padding: 4px 6px; border-radius: 6px; opacity: .8; }
.as-ico:hover, .as-ico.on { background: var(--panel2); opacity: 1; }
.as-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.as-msg { padding: 9px 12px; border-radius: 12px; font-size: 13.5px; max-width: 90%; }
.as-msg.user { align-self: flex-end; background: var(--accent); color: #fff; white-space: pre-wrap; }
.as-msg.assistant { align-self: flex-start; background: var(--panel2); }
.as-msg.err { color: var(--red); }
.as-msg .md p { margin: 4px 0; }
.as-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.as-tools span { font-size: 11px; color: var(--green); background: var(--green-bg); border-radius: 99px; padding: 1px 8px; }
.as-ev { font-size: 12.5px; background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 8px 10px; }
.as-ev a { color: inherit; }
.as-hello { color: var(--muted); font-size: 13px; line-height: 1.6; padding: 6px; }
.as-state { font-size: 11.5px; color: var(--muted); padding: 0 12px 4px; min-height: 16px; display: flex; align-items: center; gap: 6px; }
.as-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
.as-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.as-input textarea { min-height: 38px; max-height: 120px; resize: none; }
.as-mic { width: 42px; height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); font-size: 17px; flex: none; }
.as-mic.on { background: var(--red); border-color: var(--red); color: #fff; animation: pulse 1.2s infinite; }
.as-tools-row { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.as-tools-row select { flex: 1; min-width: 0; max-width: none; }
.as-min { font-weight: 600; }
