/* DocLib — оформление каталога и админки */
:root {
  --ink: #1d2327;
  --muted: #667079;
  --line: #d9dee3;
  --soft: #f4f6f8;
  --paper: #ffffff;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --ok: #1e7a46;
  --ok-bg: #e7f4ec;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --err: #a12a2a;
  --err-bg: #fbe9e9;
  --wait-bg: #e9f1f8;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--soft);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "PT Sans", Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: .2em 0 .6em; }
h2 { font-size: 1.2rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
code { font-family: var(--mono); font-size: .9em; background: var(--soft); padding: 1px 4px; border-radius: 3px; word-break: break-all; }
code.big { font-size: 1rem; }
pre.codes { font-family: var(--mono); background: #fff; padding: 10px; border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: .92em; }
.err { color: var(--err); }

/* шапка */
header.top { display: flex; align-items: center; gap: 8px 18px; padding: 0 16px; min-height: 52px; background: #17324a; color: #fff; }
header.top a { color: #fff; text-decoration: none; }
header.top a:hover { text-decoration: underline; }
header.top .brand { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
header.top .me { margin-left: auto; font-size: .9em; opacity: .95; white-space: nowrap; }
header.top .me button.link { color: #fff; }
body.has-side header.top { position: sticky; top: 0; z-index: 30; }
.hsearch { flex: 0 1 420px; min-width: 0; margin-left: 12px; }
header.top .hsearch input { width: 100%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; padding: 6px 10px; border-radius: 4px; }
header.top .hsearch input::placeholder { color: rgba(255,255,255,.7); }
header.top .hsearch input:focus { background: #fff; color: var(--ink); outline: none; }
.burger { display: none; flex-direction: column; justify-content: center; gap: 4px; width: 38px; height: 38px; margin-left: -8px; padding: 0 8px;
  background: none; border: 0; cursor: pointer; }
.burger span { display: block; height: 2px; background: #fff; border-radius: 1px; }
nav.crumbs { padding: 8px 16px; font-size: .9em; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); }

/* боковая панель админки */
body.has-side .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 52px); }
nav.side { position: sticky; top: 52px; align-self: start; height: calc(100vh - 52px); overflow-y: auto; background: var(--paper);
  border-right: 1px solid var(--line); padding: 8px 0 16px; font-size: .94em; }
nav.side .grp { padding: 4px 0 6px; }
nav.side .gt { padding: 10px 18px 4px; font-size: .74em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
nav.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px 6px 15px; color: var(--ink);
  text-decoration: none; border-left: 3px solid transparent; }
nav.side a:hover { background: var(--soft); }
nav.side a.on { background: #e9f1f8; border-left-color: var(--accent); color: #143c5a; font-weight: 600; }
nav.side .foot { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
nav.side .ver { padding: 6px 18px; color: var(--muted); font-size: .8em; }
.nb { flex: none; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #e6eaee; color: #39434c; font-size: .76em; font-weight: 600; line-height: 18px; text-align: center; }
.nb-wait { background: var(--wait-bg); color: #24577f; }
.nb-warn { background: #f6dc9a; color: #6b4600; }
.nb-err { background: var(--err); color: #fff; }
.side-bg { position: fixed; inset: 52px 0 0 0; z-index: 38; background: rgba(15, 30, 45, .35); }
.content { min-width: 0; }

/* Обзор: что требует внимания */
ul.attn { list-style: none; padding: 0; margin: 0; }
ul.attn li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
ul.attn li:last-child { border-bottom: 0; }
ul.attn li a { margin-left: auto; white-space: nowrap; }
ul.attn .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); position: relative; top: -1px; }
ul.attn li.err .dot { background: var(--err); }
ul.attn li.warn .dot { background: #d59b12; }
ul.attn li.ok .dot { background: var(--ok); }
.ok-line { color: var(--ok); margin: 4px 0; }
details.box > summary { color: var(--ink); padding: 2px 0; }
details.box > summary b { color: var(--accent); }
details.box[open] > summary { margin-bottom: 8px; }
main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.pub main { max-width: 980px; background: var(--paper); margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px 40px; }
body.plain main.narrow, .narrow { max-width: 440px; margin: 40px auto; }
body.plain main.narrow { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }

/* формы и кнопки */
.form { display: flex; flex-direction: column; gap: 12px; margin: 10px 0 20px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .93em; }
.form label.chk, label.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea, button { font: inherit; }
input[type=text], input:not([type]), input[type=search], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  padding: 7px 9px; border: 1px solid #b9c1c9; border-radius: 4px; background: #fff; color: var(--ink); max-width: 100%; font-weight: 400;
}
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 20px; }
.grid2 .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
legend { font-weight: 600; padding: 0 4px; }
.inline-form { flex-direction: row; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
.btn {
  display: inline-block; padding: 7px 14px; border: 1px solid #aeb7c0; border-radius: 4px; background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none; line-height: 1.3; white-space: nowrap;
}
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #174a6d; }
.btn.danger { color: var(--err); border-color: #d9a5a5; }
.btn.small { padding: 3px 8px; font-size: .88em; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.head h1 { margin-bottom: .3em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 16px; }
.search { display: flex; gap: 8px; margin: 10px 0 18px; }
.search input { flex: 1; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; }
.tabs a { padding: 7px 12px; text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0; }
.tabs a.on { background: var(--paper); border-color: var(--line); color: var(--ink); font-weight: 600; margin-bottom: -1px; }

/* сообщения и метки */
.flash { padding: 10px 14px; border-radius: var(--radius); margin: 8px 0; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); border-color: #b9dfc8; }
.flash.warn { background: var(--warn-bg); border-color: #efd69a; }
.flash.err { background: var(--err-bg); border-color: #ecc0c0; }
.flash.wait { background: var(--wait-bg); border-color: #c4d9ea; }
.warn { background: var(--warn-bg); padding: 8px 12px; border-radius: var(--radius); }
.note { background: var(--soft); padding: 8px 12px; border-left: 3px solid var(--line); }
.badge { display: inline-block; font-size: .78em; padding: 1px 7px; border-radius: 10px; background: #e6eaee; color: #39434c; text-decoration: none; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err, .badge.s-error { background: var(--err-bg); color: var(--err); }
.badge.wait, .badge.s-running, .badge.s-queued { background: var(--wait-bg); color: #24577f; }
.badge.s-done { background: var(--ok-bg); color: var(--ok); }
.st, .tq, .q, .ck { font-size: .86em; white-space: nowrap; }
.st-active { color: var(--ok); } .st-replaced, .st-cancelled { color: var(--err); } .st-draft { color: var(--warn); } .st-unknown { color: var(--muted); }
.tq-ocr { color: var(--warn); } .tq-needs_ocr, .tq-none { color: var(--err); font-weight: 600; } .tq-pending { color: var(--muted); }
.q-auto { color: var(--warn); } .q-verified { color: var(--ok); } .q-source { color: #35526b; }
.ck-changed { color: var(--warn); font-weight: 600; } .ck-unavailable { color: var(--err); } .ck-unchanged { color: var(--ok); } .ck-manual { color: var(--muted); } .ck-confirmed { color: var(--ok); font-weight: 600; } .ck-outdated { color: var(--warn); font-weight: 600; } .ck-expired { color: var(--err); }
td.cmdc { min-width: 260px; } td.cmdc code { white-space: pre-wrap; word-break: break-all; }
.ck.ckw { white-space: normal; } td.ckdoc { min-width: 240px; max-width: 420px; }
fieldset.actf { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px 10px; }

/* списки и таблицы интерфейса */
table.list, table.card { width: 100%; border-collapse: collapse; background: var(--paper); }
table.list th, table.list td, table.card th, table.card td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list thead th { background: #eef1f4; font-size: .88em; color: #3b4650; font-weight: 600; }
table.list tr.cur td { background: #f3f8fc; }
table.list tr.off td { color: var(--muted); }
table.card th { width: 220px; color: #3b4650; font-weight: 600; background: #fafbfc; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 14px 0; }
.box h2 { margin-top: .2em; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; }
.cols .box { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.stat { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); text-decoration: none; }
.stat b { font-size: 1.5rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .88em; }
.stat.warn { border-color: #e7c873; background: #fffaf0; }
ul.log { list-style: none; padding: 0; margin: 0; }
ul.log li { padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: .93em; }
nav.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
nav.pager a, nav.pager b, nav.pager span { padding: 3px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; text-decoration: none; }
nav.pager b { background: var(--accent); color: #fff; border-color: var(--accent); }
details summary { cursor: pointer; color: var(--accent); }
.form.compact { gap: 6px; margin: 6px 0; }
.drop { border: 2px dashed #9fb1c2; border-radius: var(--radius); background: #fafcfe; padding: 26px; text-align: center; }
.drop.over { background: #e9f1f8; border-color: var(--accent); }
label.link { color: var(--accent); text-decoration: underline; cursor: pointer; display: inline; font-weight: 400; }
#flist input { width: 100%; }
.newver { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* дерево парсера */
ul.tree, ul.tree ul { list-style: none; padding-left: 22px; margin: 0; }
ul.tree { padding-left: 0; }
ul.tree li { margin: 3px 0; }
ul.tree .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
ul.tree input.pname { font-weight: 600; min-width: 260px; flex: 0 1 460px; }
ul.tree input.dname { min-width: 240px; width: min(520px, 70vw); }
ul.tree li.doc { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.totals { position: sticky; bottom: 0; background: #fffdf5; border: 1px solid #e7d9a8; border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; }
.tree-tools { display: flex; gap: 8px; margin-bottom: 8px; }

/* редактор таблиц */
.tedit { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tright { position: sticky; top: 8px; max-height: 96vh; overflow: auto; }
.tright img { width: 100%; border: 1px solid var(--line); background: #fff; }
.tright figure { margin: 0 0 10px; }
.ttools { display: flex; gap: 6px; margin: 6px 0; }
.editable td, .editable th { outline: none; }
.editable td:focus, .editable th:focus { background: #fffbe6; box-shadow: inset 0 0 0 2px #e7c873; }
.editable tr { position: relative; }
.rowdel { position: absolute; left: -26px; border: 0; background: none; color: var(--err); cursor: pointer; font-size: 16px; }
.tw.editable { padding-left: 28px; }

/* читаемая часть: текст документа */
.doc, .reader { font-size: 16px; line-height: 1.6; }
.doc p { margin: .55em 0; }
.doc p.c { text-align: center; }
.doc h2, .doc h3, .doc h4 { scroll-margin-top: 10px; }
.pg { color: #8a949d; font-size: .8em; margin: 1em 0 .3em; font-family: var(--mono); }
span.pg { margin: 0 .2em; }
.doclabel { color: var(--muted); font-size: .92em; }
nav.partnav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; margin: 10px 0; font-size: .95em; }
figure.tbl { margin: 1.2em 0; }
figure.tbl figcaption { margin-bottom: 6px; }
figure.tbl .tl { font-size: .85em; }
.tw { overflow-x: auto; max-width: 100%; }
.tw table { border-collapse: collapse; font-size: .92em; background: #fff; }
.tw th, .tw td { border: 1px solid #9aa5af; padding: 4px 7px; vertical-align: top; text-align: left; }
.tw thead th, .tw th { background: #eef2f5; font-weight: 600; }
.tnote { font-size: .9em; color: var(--muted); }
ul.toc { list-style: none; padding-left: 0; }
ul.toc li.l2 { padding-left: 20px; }
ul.toc li.l3 { padding-left: 40px; font-size: .95em; }
ol.parts li { margin: 3px 0; }
ol.parts .muted { margin-left: 6px; }
.pageimg img { max-width: 100%; border: 1px solid var(--line); background: #fff; }
ol.pagelist { columns: 4 160px; }
.hit { margin: 10px 0; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.hit p { margin: 4px 0; }
mark { background: #fff0a8; }
.diff { font-family: var(--mono); font-size: .86em; background: #fff; border: 1px solid var(--line); padding: 8px; overflow-x: auto; }
.diff div { white-space: pre-wrap; padding: 1px 4px; }
.d-del { background: #fbe9e9; } .d-ins { background: #e7f4ec; } .d-hunk { color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }
.qr svg { width: 200px; height: 200px; background: #fff; }
.secret { font-size: 1rem; letter-spacing: .05em; }

@media (max-width: 900px) {
  body.has-side .shell { display: block; }
  .burger { display: flex; }
  nav.side { position: fixed; top: 52px; left: 0; bottom: 0; z-index: 40; width: 280px; max-width: 85vw; height: auto;
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: 4px 0 18px rgba(0,0,0,.15); }
  body.nav-open nav.side { transform: none; }
  header.top .role { display: none; }
  .hsearch { margin-left: 0; flex: 1 1 auto; }
}
@media (max-width: 560px) {
  body.has-side header.top .brand { display: none; }
  header.top { gap: 8px 10px; }
}
@media (max-width: 760px) {
  .cols, .tedit { grid-template-columns: 1fr; }
  table.card th { width: 40%; }
  header.top .me { margin-left: 0; }
  .pub main { padding: 14px; border-left: 0; border-right: 0; border-radius: 0; }
  table.list { font-size: .9em; }
  table.list.docs td:nth-child(3), table.list.docs th:nth-child(3) { display: none; }
}

/* типы, метки, массовые действия */
.small { font-size: .85em; }
.hidden { display: none !important; }
.form label > span:first-child { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
button.link.small { font-weight: 400; }
.qsecbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--wait-bg); border-radius: var(--radius); }
.qsecbox input[type=text] { min-width: 240px; }
.tagsug { position: absolute; z-index: 50; background: #fff; border: 1px solid #b9c1c9; border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 4px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 460px; }
.tagsug button { border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 2px 9px; cursor: pointer; font-size: .9em; }
.tagsug button:hover { background: var(--wait-bg); }
.tags { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.tags a { font-size: .78em; padding: 0 7px; border-radius: 10px; background: #eef1f4; color: #39434c; text-decoration: none; }
.tags a:hover { background: var(--wait-bg); }
.bulkbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin: 0 0 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.bulkbar #bulkcount { font-weight: 600; margin-right: 6px; }
.bulkf { display: inline-flex; align-items: center; gap: 6px; }
.bulkf[hidden] { display: none; }
table.docs td:first-child input[type=checkbox] { width: 16px; height: 16px; }
.typenav { line-height: 1.9; }
.secdesc { color: #39434c; background: var(--soft); border-left: 3px solid var(--line); padding: 8px 12px; margin: 0 0 14px; }
.sitenotice { background: var(--soft); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85em; padding: 6px 16px; }
pre.wrap { white-space: pre-wrap; word-break: break-word; background: var(--bg2, #f4f4f4); padding: .6em .8em; border-radius: 6px; font-size: .92em; }
details > pre.wrap { margin: .4em 0; }
.fgis-form .fgis-pick { display: flex; flex-direction: column; gap: .3em; max-width: 560px; }
.fgis-form .fgis-subjects { width: 100%; max-width: 560px; height: auto; min-height: 14em; }
.fgis-form select.fgis-zones, .fgis-form select.fgis-periods { max-width: 560px; }
.fgis-form .fgis-warn { margin: .4em 0; }
@media (max-width: 760px) {
  main table.list { display: block; overflow-x: auto; }
}

/* очередь и журнал: длинный текст сворачивается */
details.more > summary { color: inherit; cursor: pointer; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary .muted { display: none; }
.filters input[type=search] { min-width: 220px; }
table.queue td:nth-child(4) { max-width: 420px; }

/* обращения */
.thread .msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 10px; max-width: 760px; }
.thread .msg-adm { background: var(--wait-bg); margin-left: auto; }
.thread .msg-usr { background: var(--paper); }
.thread .mh { margin-bottom: 4px; }
.tst { font-size: .86em; font-weight: 600; white-space: nowrap; }
.tst-new { color: var(--warn); } .tst-work { color: var(--accent); } .tst-done { color: var(--ok); } .tst-rejected { color: var(--muted); }
header.top .me a.hmsg { margin-right: 12px; opacity: .9; }
@media (max-width: 700px) { header.top .me a.hmsg { display: none; } }

/* ИИ-помощник */
.aichat { max-width: 900px; }
.aimsg { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin: 0 0 10px; background: var(--paper); }
.aimsg.ai-u { background: var(--wait-bg); margin-left: 12%; white-space: normal; }
.aimsg .mb > :first-child { margin-top: 0; }
.aimsg .mb > :last-child { margin-bottom: 0; }
.aimsg .md h2, .aimsg .md h3, .aimsg .md h4 { margin: .9em 0 .35em; }
.aimsg .md h2 { font-size: 1.12rem; }
.aimsg .md h3, .aimsg .md h4 { font-size: 1rem; }
.aimsg .md ul, .aimsg .md ol { padding-left: 1.4em; margin: .4em 0; }
.aimsg .md pre { background: var(--soft); padding: 8px 10px; border-radius: var(--radius); overflow-x: auto; }
.aimsg .md pre code { background: none; padding: 0; word-break: normal; white-space: pre; }
.aimsg .md blockquote { margin: .5em 0; padding: 0 0 0 10px; border-left: 3px solid var(--line); color: var(--muted); }
.mdtable { overflow-x: auto; margin: .5em 0; }
.mdtable table { border-collapse: collapse; font-size: .93em; }
.mdtable th, .mdtable td { border: 1px solid var(--line); padding: 3px 8px; vertical-align: top; text-align: left; }
.mdtable th { background: var(--soft); }
.mdtable td.num { text-align: right; white-space: nowrap; }
.aicost { text-align: right; font-size: .78em; color: var(--muted); margin-top: 4px; }
.aifb { margin-top: 6px; padding: 4px 8px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); }
.aimwrap { overflow-x: auto; }
.aimodels { width: 100%; border-collapse: collapse; }
.aimodels select { width: auto; }
.aimodels tr.aim2 input { display: inline-block; }
.aimodels th { text-align: left; font-size: .85em; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.aimodels td { vertical-align: middle; padding: 4px 6px; }
.aimodels tr.aim1 td { padding-top: 10px; }
.aimodels tr.aim2 td { border-bottom: 1px solid var(--line); padding-bottom: 10px; color: var(--muted); }
.aimodels tr.aim2 label.inl { margin-right: 10px; white-space: nowrap; }
.aimodels input, .aimodels select { margin: 0; }
.aimodels tr.aim1 input[name$="[id]"] { width: 12em; }
.aimodels tr.aim1 input[name$="[name]"] { width: 100%; min-width: 12em; }
.aimodels tr.muted td { opacity: .6; }
.aimodels td.c { text-align: center; }
.aimodels .nowrap, td.nowrap { white-space: nowrap; }
.aitool { margin: 0 0 6px 14px; font-size: .85em; color: var(--muted); max-width: 860px; }
.aitool summary { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aitool pre { white-space: pre-wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; max-height: 360px; overflow: auto; color: var(--ink); }
.aityping { color: var(--muted); font-style: italic; }
.aicursor { animation: aiblink 1s steps(1) infinite; color: var(--accent); }
@keyframes aiblink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .aicursor { animation: none; } }
.aistate { max-width: 900px; min-height: 1.5em; margin-bottom: 8px; }
.aiform { max-width: 900px; }
.aiform textarea { width: 100%; }
.aiform [hidden], .aistate [hidden] { display: none !important; }
.form label.inl, label.inl { display: inline-flex; flex-direction: row; gap: 6px; align-items: center; font-weight: 400; }
label.inl select { width: auto; max-width: 22em; }
.aiform .inline-form { display: flex; gap: 8px; }
@media (max-width: 640px) { .aimsg.ai-u { margin-left: 0; } }
.aiattach { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.aiattbtn { cursor: pointer; }
form.aidrop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.aifile { margin-top: 6px; font-size: .9em; }
.aifile.aif-error .muted { color: var(--err); }
.aifile.aif-pending .muted, .aifile.aif-processing .muted { font-style: italic; }
.aifiletext { white-space: pre-wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: .85em; max-height: none; }
.form label.aiattbtn { display: inline-flex; flex-direction: row; font-weight: 400; }
/* черновик ЛСР */
.aiestbox { max-width: 1100px; }
.aiestbox > summary { cursor: pointer; }
.esttab { width: 100%; }
.esttab tr.estsec td { background: var(--soft); font-weight: 600; }
.esttab tr.estsum td { font-weight: 600; background: var(--wait-bg); }
.esttab tr.estbad td { background: var(--err-bg); }
.esttab td.num { white-space: nowrap; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

/* 1.31: интерфейс «только ИИ-помощник» */
nav.ai-side .ainew { display: block; margin: 10px 14px 4px; text-align: center; color: #fff; border-left: 0; padding: 8px 12px; }
nav.ai-side .ainew:hover { background: #174a6d; }
nav.ai-side .aiconv a span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
nav.ai-side .aiconv a { font-size: .93em; }
header.top .me a.hbal { margin-right: 14px; padding: 3px 10px; border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; }
header.top .me a.hbal:hover { background: rgba(255, 255, 255, .24); }
body.ai-only header.top .me a.hmsg { display: inline; }
@media (max-width: 560px) { body.ai-only header.top .me a.hmsg { display: none; } header.top .me a.hbal { margin-right: 8px; } }
.aihome { max-width: 860px; }
.aihome h1 { margin-bottom: .3em; }
.aichips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.aichips .aichip { border-radius: 18px; }
body.ai-only #aiform { margin-bottom: 14px; }
body.ai-only #aiform textarea { min-height: 3.2em; }
body.ai-only .aiform select { max-width: 100%; }
body.ai-only .aiform .inline-form label.inl { max-width: 100%; }
@media (max-width: 560px) {
  body.ai-only .aiform label.inl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; width: 100%; }
  body.ai-only .aiform label.inl select { flex: 1 1 0; min-width: 0; width: 100%; }
}
/* 1.32: /smeta — вход и регистрация */
.smauth .tabs { margin: 14px 0 12px; }
.form label.hp, label.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
/* 1.34: сплит-форма разговора */
.ainote { text-align: center; color: var(--muted); margin: 8px 0; padding: 4px 10px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.aisplitline { margin-top: -6px; }
