/* AnyOrder web — mobile-first, dark by default */

:root {
  --accent: #2aa79b;
  --accent-dim: #23897f;
  --accent-soft: rgba(42, 167, 155, 0.16);
  --bg: #0f1514;
  --surface: #1a2321;
  --surface-2: #223029;
  --surface-press: #24312e;
  --border: #2a3835;
  --text: #e8edec;
  --text-2: #93a5a1;
  --text-3: #647672;
  --danger: #e5484d;
  --red: #e5484d;
  --yellow: #f0b429;
  --green: #46a758;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  --radius: 12px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f5f4;
    --surface: #ffffff;
    --surface-2: #eaf0ee;
    --surface-press: #e2ebe8;
    --border: #dde5e3;
    --text: #17211f;
    --text-2: #5e716d;
    --text-3: #8ba09b;
    --shadow: 0 2px 10px rgba(23, 33, 31, 0.08);
    color-scheme: light;
  }
}

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

/* заслонка заставки «Контур» (docs/97-splash.md): цвет фона поверх страницы, пока не
   запустилась сама заставка (у неё свой слой поверх всего); гаснет и без неё через 4 с */
.splash-gate { position: fixed; inset: 0; z-index: 2147482000; background: var(--bg); }
.splash-gate.gone, html[data-splash="off"] .splash-gate { display: none; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- screen / header ---------- */

.screen { display: flex; flex-direction: column; min-height: 100dvh; }
.order-screen { height: 100dvh; overflow: hidden; }

header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.order-screen header.top { position: static; }

.top-titles { flex: 1; min-width: 0; text-align: center; }
.top-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-sub {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--accent);
}
.icon-btn:active { background: var(--accent-soft); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-spacer { width: 44px; height: 44px; flex: none; }

.page {
  flex: 1;
  min-height: 0;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- controls ---------- */

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  background: var(--surface-2);
  width: 100%;
}
.btn:active { filter: brightness(1.12); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dim); }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.seg {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  flex: 1;
  min-height: 38px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active { background: var(--accent); color: #fff; font-weight: 600; }
.seg-wrap { padding: 10px 16px 2px; }
.order-screen .seg-wrap { padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* ---------- lists / cards ---------- */

.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 64px;
}
button.card:active { background: var(--surface-press); }

.card-main { flex: 1; min-width: 0; }
.card-title {
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-side { flex: none; display: flex; align-items: center; gap: 8px; }
.chevron { color: var(--text-3); flex: none; display: inline-flex; }
.chevron svg { width: 18px; height: 18px; }

.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 1.5px 6px;
  vertical-align: 2px;
  margin-left: 8px;
  white-space: nowrap;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  border: 1.5px solid var(--border);
  background: transparent;
}
.dot.c1 { background: var(--red); border-color: var(--red); }
.dot.c2 { background: var(--yellow); border-color: var(--yellow); }
.dot.c3 { background: var(--green); border-color: var(--green); }
.dot.c4 { background: var(--text-3); border-color: var(--text-3); }

/* Части позиций заявки «в таблицах» (docs/93-server-source-parts.md): цвет подстроки — статус */
.pseg-missing .pseg-dot { background: var(--red); border-color: var(--red); }
.pseg-invoice .pseg-dot { background: var(--yellow); border-color: var(--yellow); }
.pseg-stock .pseg-dot { background: var(--green); border-color: var(--green); }
.pseg-received .pseg-dot { background: var(--text-3); border-color: var(--text-3); }
.pseg-cancelled .pseg-dot { background: transparent; }
.pseg-dot { width: 9px; height: 9px; border-width: 1px; }
.el-segs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; }
.pseg { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pseg.pseg-cancelled { text-decoration: line-through; color: var(--text-3); }
.pseg.pseg-missing { color: var(--red); }
.element-card.el-parts { cursor: pointer; }
.psum { display: flex; flex-direction: column; gap: 6px; width: calc(100% - 32px); margin: 10px 16px 2px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 12px; text-align: left; }
.psum.active { border-color: var(--red); }
.psum:disabled { cursor: default; opacity: 1; }
.psum-chips { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.psum-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.psum-chip.zero { font-weight: 400; color: var(--text-3); }
.psum-hint { font-size: 12px; color: var(--text-3); }
.part-need { font-size: 14px; color: var(--text-2); margin: 8px 0 2px; }
.parts-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.part-card { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
.part-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.part-line { display: flex; gap: 8px; font-size: 13px; line-height: 1.45; }
.part-k { color: var(--text-3); flex: none; min-width: 110px; }
.part-v { overflow-wrap: anywhere; }
.part-meta { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.piece-hint { font-size: 12px; color: var(--text-3); }
/* Кусок позиции: свёрнут — количество и этапы, раскрыт — документ каждого этапа */
.piece { border: 1px solid var(--border); border-radius: 10px; }
.piece-head { display: flex; align-items: center; gap: 10px; padding: 10px 11px; cursor: pointer; list-style: none; }
.piece-head::-webkit-details-marker { display: none; }
.piece-head::before { content: ''; flex: none; width: 6px; height: 6px; margin-right: 2px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform 0.15s; }
.piece[open] > .piece-head::before { transform: rotate(45deg); }
.piece-qty { flex: 1; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.piece-qty.struck { text-decoration: line-through; color: var(--text-3); }
.piece-body { display: grid; gap: 4px; padding: 0 11px 10px 30px; }
.stages { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px 10px; font-size: 12px; color: var(--text-3); }
.stage { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.stage.on { color: var(--text); }
.stage:not(.on) .pseg-dot { background: transparent; border-color: var(--text-3); }
.stage-line { display: flex; gap: 8px; width: 100%; font-size: 13px; line-height: 1.45; text-align: left; }
.stage-line.link .part-v { color: var(--accent); }
.stage-line.link .part-v::after { content: ' ›'; }
/* Документы заявки: список, шапка, строки */
.docs-seg { margin-bottom: 12px; }
.doc-card { min-height: 0; }
.doc-state { font-size: 12px; margin-top: 3px; }
.doc-state.wait { color: var(--orange, #c2410c); }
.doc-state.done { color: var(--green); }
.doc-head { display: grid; gap: 4px; }
.doc-sub { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.doc-lines { display: grid; gap: 8px; }
.doc-line { display: grid; gap: 3px; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
.doc-line:active { background: var(--surface-press); }
.doc-line-name { font-size: 14px; overflow-wrap: anywhere; }
.doc-line-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.doc-line-inv { font-size: 11px; color: var(--text-3); }
.color-note { font-size: 12px; color: var(--text-3); padding: 2px 14px 10px; }
.history { display: flex; flex-direction: column; }
.history-row { padding: 8px 14px; border-top: 1px solid var(--border); }
.history-row:first-child { border-top: none; }
.history-what { font-size: 14px; }
.history-item { color: var(--text-2); }
.history-detail { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.history-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.searchbar { padding: 10px 16px 2px; }
.searchrow { display: flex; gap: 8px; align-items: stretch; }
.searchrow .input { flex: 1; min-width: 0; }
.find-btn { width: auto; flex: none; padding: 0 16px; color: var(--accent); background: var(--surface); border: 1px solid var(--accent); }
.archive-hint { font-size: 12px; color: var(--text-2); padding: 6px 2px 0; line-height: 1.35; }

/* Значки причины совпадения при поиске в архиве */
.card-match { display: flex; gap: 8px; margin-top: 5px; color: var(--accent); }
.match-ico { display: inline-flex; flex: none; }
.match-ico svg { width: 16px; height: 16px; }

/* Фрагменты найденного: что именно совпало в позициях, чате, вложении */
.card-snippets { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.snippet {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-2);
}
.snippet .match-ico svg { width: 13px; height: 13px; margin-top: 1px; color: var(--accent); }
.snippet-body { min-width: 0; }
.snippet-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.snippet-text b { color: var(--text); font-weight: 700; }
.snippet-more { color: var(--text-3); margin-top: 1px; }

/* elements of order list */
.element-card { align-items: flex-start; min-height: 56px; }
.element-card .dot { margin-top: 5px; }
.el-num { font-size: 14px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.el-info { font-size: 13px; color: var(--yellow); margin-top: 3px; }
.thumb {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* info rows */
.info-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}
.info-row { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.info-value { font-size: 15px; word-break: break-word; white-space: pre-wrap; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 18px 4px 8px;
}

.color-picker { display: flex; gap: 12px; padding: 12px 14px; }
.color-opt {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}
.color-opt .dot { width: 20px; height: 20px; }
.color-opt.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
}
.login-logo { width: 84px; height: 84px; border-radius: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.login-title { font-size: 28px; font-weight: 700; }
.login-sub { color: var(--text-2); margin: 6px 0 28px; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.form-error {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ---------- chat ---------- */

.tab-body { flex: 1; min-height: 0; position: relative; }
.tab-panel { position: absolute; inset: 0; overflow-y: auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); display: none; }
.tab-panel.active { display: block; }
.tab-panel.chat-panel { display: none; padding: 0; overflow: hidden; }
.tab-panel.chat-panel.active { display: flex; flex-direction: column; }

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-author { font-size: 12px; font-weight: 600; color: var(--accent); margin: 2px 6px 2px 10px; }
.bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  padding: 9px 12px;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow);
}
.msg.mine .bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  border-radius: 16px;
  border-bottom-right-radius: 6px;
}
.msg.pending .bubble { opacity: 0.65; }
.msg-meta { font-size: 11px; color: var(--text-3); margin: 3px 8px 0; }
.bubble.deleted { font-style: italic; color: var(--text-3); background: transparent; border: 1px dashed var(--border, rgba(127,127,127,.35)); }
.msg.mine .bubble.deleted { color: var(--text-3); background: transparent; }
.msg-caption { font-size: 12px; color: var(--text-2); padding: 4px 8px 2px; overflow-wrap: anywhere; }
.msg.mine .msg-caption { color: rgba(255, 255, 255, 0.85); }
.msg-acts { margin-left: 8px; }
.msg-act { background: none; border: 0; padding: 0 0 0 8px; color: var(--accent, #2aa79b); font: inherit; cursor: pointer; }
.msg-act:hover { text-decoration: underline; }
.msg-edit { align-self: flex-end; width: min(82%, 520px); display: flex; flex-direction: column; gap: 6px; }
.msg-edit-input { width: 100%; resize: vertical; min-height: 56px; }
.msg-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

.bubble.media { padding: 4px; overflow: hidden; }
.msg-img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; cursor: pointer; }
.img-placeholder {
  width: 200px;
  height: 140px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-card { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 6px 8px; text-align: left; }
.file-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg.mine .file-icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.file-icon svg { width: 22px; height: 22px; }
.file-name { font-size: 14px; font-weight: 600; word-break: break-word; }
.file-size { font-size: 12px; opacity: 0.75; }

.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.composer .input { flex: 1; min-height: 44px; border-radius: 22px; }
.composer .icon-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 50%; }
.composer .icon-btn.send { background: var(--accent); border-color: var(--accent); color: #fff; }
.composer .icon-btn:disabled { opacity: 0.5; }

/* Архив только для чтения: вместо строки ввода - пояснение */
.chat-closed {
  flex: none;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.day-sep { align-self: center; font-size: 12px; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px 10px; margin: 6px 0 2px; }

/* ---------- misc ---------- */

.loader { display: flex; justify-content: center; padding: 44px 0; }

.spinner {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner.sm { width: 15px; height: 15px; border-width: 2px; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 14px; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  max-width: min(92vw, 480px);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14.5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--danger); color: var(--danger); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ================= веб-админка сервера: «Настройки ИИ» и «Прокси» =================
   Формы — копии «Рабочего Контура Онлайн» (AiSettings.tsx, ProxySettings.tsx), стили
   .ai-*, .badge*, .linkbtn, .hint, .field/.lab, .btn-sec/.btn-sm — из его globals.css,
   переложенные на переменные AnyOrder. Всё внутри .adm: у AnyOrder свои .badge,
   .card и .btn, их здесь переопределяем, а не трогаем. */

:root {
  --adm-ok: #5fd08a;
  --adm-ok-bg: rgba(70, 167, 88, 0.18);
  --adm-warn: #f0b429;
  --adm-warn-bg: rgba(240, 180, 41, 0.15);
}
@media (prefers-color-scheme: light) {
  :root {
    --adm-ok: #1d7a3c;
    --adm-ok-bg: #e1f3e6;
    --adm-warn: #8a5a06;
    --adm-warn-bg: #faeed2;
  }
}

/* плашка сохранения под заголовком шапки (SavePlate в SettingsShell.tsx);
   в покое пустая, но место держит — иначе шапка прыгала бы при каждом сохранении */
.setsave { min-height: 1.35em; }
.setsave.run { color: var(--text-2); }
.setsave.ok { color: var(--adm-ok); font-weight: 600; }
.setsave.bad { color: var(--danger); font-weight: 600; }
/* ошибку не обрезаем: подсказка title на касание не показывается */
.top-sub.setsave.bad { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
.setsave .spinner.sm { width: 11px; height: 11px; vertical-align: -1px; }

.adm { overflow-wrap: break-word; }
.adm a { color: var(--accent); text-decoration: none; }
.adm a:hover { text-decoration: underline; }
.adm h1 { font-size: 1.35rem; margin: 0 0 4px; }
.adm code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  white-space: nowrap;
}
.adm .adm-list { margin: 6px 0 0; padding-left: 18px; }
.adm .adm-list li + li { margin-top: 3px; }

.adm .hint { color: var(--text-2); font-size: 0.82rem; line-height: 1.45; }
.adm .err { color: var(--danger); font-size: 0.86rem; margin: 8px 0; min-height: 1.2em; }
.adm .group-h {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-2); font-weight: 600; margin: 18px 4px 8px;
}

/* карточки раздела «Прокси»: блоки, а не строки списка, как .card у AnyOrder */
.adm .card { display: block; min-height: 0; padding: 12px 14px; }
.adm .card + .card { margin-top: 10px; }

/* поля */
.adm .field { margin-bottom: 14px; }
.adm .field .lab {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-2); font-weight: 600; margin: 0 2px 5px;
}
.adm .field .lab .badge { text-transform: none; letter-spacing: 0; }
.adm .input { min-height: 44px; padding: 10px 12px; border-radius: 10px; }

/* бейджи статусов */
.adm .badge {
  display: inline-block; min-width: 0; height: auto;
  font-size: 0.7rem; font-weight: 650; line-height: 1.35;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: none;
  color: var(--text-2); background: var(--surface-2);
}
.adm .badge.ok { color: var(--adm-ok); background: var(--adm-ok-bg); }
.adm .badge.warn { color: var(--adm-warn); background: var(--adm-warn-bg); }
.adm .badge.neutral { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }
.adm .badge.bad { color: #fff; background: var(--danger); }

/* кнопки: вторичная маленькая и «ссылка» */
.adm .btn.btn-sm {
  width: auto; min-height: 36px; padding: 7px 12px;
  font-size: 0.84rem; border-radius: 9px;
}
.adm .btn.btn-sec { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.adm .btn.btn-sec:active:not(:disabled) { background: var(--surface-press); }
.adm .adm-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.adm .linkbtn {
  background: none; border: none; padding: 4px 2px; min-height: 32px; cursor: pointer;
  color: var(--text-2); font-size: 0.8rem; text-decoration: underline;
}
.adm .linkbtn:hover:not(:disabled) { color: var(--danger); }
.adm .linkbtn:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

/* галочки и точки: системные на тёмной теме телефона рисуются тёмным пятном —
   рисуем свои, как в «Рабочем Контуре» */
.adm input[type="checkbox"],
.adm input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px; flex: none; margin: 0; padding: 0;
  border: 1.5px solid var(--text-2);
  background: transparent;
  display: inline-block; vertical-align: -4px; position: relative;
  cursor: pointer;
}
.adm input[type="checkbox"] { border-radius: 5px; }
.adm input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.adm input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 5.5px; top: 1.5px;
  width: 6px; height: 11px; box-sizing: border-box;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.adm input[type="radio"] { border-radius: 50%; }
.adm input[type="radio"]:checked { border-color: var(--accent); }
.adm input[type="radio"]:checked::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--accent);
}
.adm input[type="checkbox"]:disabled,
.adm input[type="radio"]:disabled { opacity: 0.4; cursor: default; }
.adm input[type="checkbox"]:focus-visible,
.adm input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- «Настройки ИИ» ---------- */

.ai-wrap { max-width: 760px; }

/* баннер «что сейчас работает» — самый заметный элемент страницы */
.ai-current {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 8px;
}
.ai-current .cap {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-2); font-weight: 600;
}
.ai-current .cur { font-weight: 700; font-size: 1.15rem; color: var(--accent); line-height: 1.2; }
.ai-current .cur small { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-2); }
.ai-current .right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ai-current .total { text-align: right; font-size: 0.8rem; color: var(--text-2); }
.ai-current .total b {
  display: block; font-size: 1.1rem; color: var(--text);
  font-variant-numeric: tabular-nums; font-weight: 700;
}
.ai-current-result { font-size: 0.86rem; margin: 8px 2px 0; overflow-wrap: anywhere; }
.ai-current-result.ok { color: var(--adm-ok); }
.ai-current-result.bad { color: var(--danger); }

/* разбивка «по людям / по разделам» */
.ai-usage-detail { display: grid; gap: 6px; margin: 6px 0 4px; }
.ai-usage-detail summary { cursor: pointer; font-size: 0.92rem; color: var(--accent); }
.ai-usage-detail .row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 3px 0 3px 12px; border-top: 1px solid var(--border); font-size: 0.9rem;
}
.ai-usage-detail .row span { overflow-wrap: anywhere; }
.ai-usage-detail .row b { font-variant-numeric: tabular-nums; }

/* панель источника токена (Amvera / свой аккаунт) */
.ai-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 16px 6px; margin-top: 16px;
}
.ai-panel > .ph { display: flex; align-items: center; gap: 10px; }
.ai-panel > .ph .pt { font-weight: 650; font-size: 1.02rem; }
.ai-panel > .pd { color: var(--text-2); font-size: 0.84rem; margin: 3px 0 12px; }

.ai-token { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 4px; }
.adm .ai-token .field { flex: 1; min-width: 220px; margin: 0; }

/* «Ходить через прокси» у зарубежного сервиса */
.ai-proxy-use { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; margin: 2px 2px 10px; }
.adm .ai-proxy-use input[type="checkbox"] { margin-top: 3px; }
.ai-proxy-use .sub { min-width: 0; }

/* строка модели */
.ai-model {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  margin: 10px 0; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.ai-model:hover { border-color: var(--text-2); }
.ai-model.on { border-color: var(--accent); border-width: 1.5px; background: var(--accent-soft); }
.adm .ai-model input[type="radio"] { margin-top: 3px; }
.ai-model .body { flex: 1; min-width: 0; }
.ai-model .row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-model .m-name { font-weight: 650; }
.ai-model .m-sub { font-size: 0.82rem; color: var(--text-2); margin-top: 2px; }
.ai-model .m-spent b { color: var(--text); font-variant-numeric: tabular-nums; }
.adm .field.ai-model-name { margin: 8px 0 0; max-width: 260px; }
.ai-model .m-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.ai-model .m-msg { font-size: 0.82rem; margin-top: 7px; line-height: 1.4; overflow-wrap: anywhere; }
.ai-model .m-msg.ok { color: var(--adm-ok); }
.ai-model .m-msg.bad { color: var(--danger); }

.ai-usedchip {
  font-size: 0.72rem; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  background: var(--accent); color: #fff; white-space: nowrap;
}

/* вкладки «Статистика / Быстрый поиск / Умный поиск» */
.ai-tabs { margin: 0 0 12px; }
.ai-stat-head { gap: 18px; }
.ai-stat-list .row {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--border); font-size: 0.92rem;
}
.ai-stat-list .row:first-child { border-top: 0; }
.ai-stat-list .row span { overflow-wrap: anywhere; }
.ai-stat-list .row b { font-variant-numeric: tabular-nums; }
.ai-stat-list .row .hint { margin-left: 4px; }
.ai-panel > .ph h2.pt { margin: 0 0 6px; }
/* сервис: строка с точкой, раскрывается в настройки */
.ai-svc { padding: 12px 14px; margin-top: 10px; }
.ai-svc.on { border-color: var(--accent); border-width: 2px; }
.ai-svc-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.adm .ai-svc-head input[type="radio"] { margin: 0; flex: 0 0 auto; }
.ai-svc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-svc-name .m-sub { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }
.ai-svc-toggle {
  border: 0; background: transparent; color: var(--text-2); font-size: 1.2rem;
  min-width: 40px; min-height: 40px; cursor: pointer; border-radius: 8px;
}
.ai-svc-toggle:hover { background: var(--surface-2); }
.ai-svc-body { display: grid; gap: 10px; margin-top: 12px; }
.adm .ai-svc-body .field { margin: 0; }
.ai-svc-body .m-sub { font-size: 0.82rem; color: var(--text-2); }
.ai-svc-body .m-spent b { color: var(--text); font-variant-numeric: tabular-nums; }
.ai-svc-body .m-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-svc-body .m-msg { font-size: 0.82rem; line-height: 1.4; overflow-wrap: anywhere; }
.ai-svc-body .m-msg.ok { color: var(--adm-ok); }

/* Selectel: памятка к ключу, выбранная модель из каталога, остаток (ModelChoice «Рабочего Контура») */
.adm .ai-memo { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 2px; }
.ai-choice { display: grid; gap: 6px; }
.ai-choice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-choice-name { font-weight: 650; overflow-wrap: anywhere; }
.ai-choice-id { font-size: 0.78rem; color: var(--text-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.ai-choice-price { font-size: 0.82rem; color: var(--text-2); }
.ai-choice .btn { flex: 0 0 auto; }
.ai-manual { display: flex; gap: 6px; align-items: center; }
.adm .ai-manual .input { flex: 1; min-width: 0; }
.ai-bal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.86rem; }
.ai-bal b.low { color: var(--adm-warn); }
.ai-bal .hint { margin: 0; }
.adm .err-ink { color: var(--danger); overflow-wrap: anywhere; }

/* экран выбора модели Selectel (ModelPicker) */
.mp-wrap { max-width: 760px; display: grid; gap: 10px; }
.mp-tools { display: grid; gap: 8px; padding: 12px 14px; }
.mp-ctl { display: flex; gap: 8px; flex-wrap: wrap; }
.adm .mp-ctl .input[type="search"] { flex: 1 1 220px; min-width: 0; }
.adm .mp-ctl select.input { flex: 0 1 190px; }
.mp-list { display: grid; gap: 8px; }
.mp-m { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.mp-m.on { border-color: var(--accent); border-width: 2px; }
.mp-m > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: grid; gap: 3px; }
.mp-m > summary::-webkit-details-marker { display: none; }
.mp-l1 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mp-name { font-weight: 650; overflow-wrap: anywhere; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mp-price { font-size: 0.82rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-dev { font-size: 0.8rem; color: var(--text-2); }
.mp-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.mp-chip { font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.mp-body { padding: 0 12px 12px; display: grid; gap: 8px; }
.mp-kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 3px 12px; margin: 0; font-size: 0.86rem; }
.mp-kv dt { color: var(--text-2); }
.mp-kv dd { margin: 0; overflow-wrap: anywhere; }
.mp-body .btn { justify-self: start; }
.mp-more { justify-self: center; }
@media (max-width: 420px) {
  .mp-kv { grid-template-columns: 1fr; }
  .mp-kv dd { margin-bottom: 4px; }
  .mp-price { white-space: normal; }
}
.ai-svc-body .m-msg.bad { color: var(--danger); }

.ai-foot {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* ---------- «Прокси» ---------- */

.adm-proxy { max-width: 720px; }

@keyframes adm-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.adm .fade-in { animation: adm-fade-up 0.32s ease both; }
@media (prefers-reduced-motion: reduce) {
  .adm .fade-in { animation: none; }
}
/* ---------- админка: «Сообщества» и «Пользователи» (docs/70-admin-communities.md) ---------- */
/* переключатель из многих вкладок: не сжимаем подписи, листаем пальцем */
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll .seg-btn { flex: 1 0 auto; padding: 0 12px; white-space: nowrap; }
.adm .adm-center { justify-content: center; }
.adm .adm-toolbar { display: flex; gap: 8px; align-items: center; }
.adm .adm-toolbar .input { flex: 1; min-width: 0; }
.adm .adm-toolbar + .card { margin-top: 10px; }
.adm .adm-count { margin: 10px 4px 8px; }
/* строка-ссылка списка: как карточка сообществ на главной */
.adm a.card.adm-row { display: flex; align-items: center; color: inherit; text-decoration: none; }
.adm a.card.adm-row:hover { text-decoration: none; border-color: var(--accent); }
.adm .list > .card + .card { margin-top: 0; }
.adm .adm-stats {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px;
  font-size: 0.8rem; color: var(--text-2);
}
.adm .adm-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.adm .adm-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.adm .adm-wrap { overflow-wrap: anywhere; font-size: 0.86rem; }
/* участник / отчёт / хранилище */
.adm .adm-member-h { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.adm .adm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700; font-size: 1rem;
}
.adm .adm-lab {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-2); font-weight: 600; margin: 0 2px 6px;
}
.adm .adm-rights { display: grid; gap: 2px; margin-bottom: 10px; }
/* строка с галочкой */
.adm-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 2px; }
.adm .adm-check input[type="checkbox"] { margin-top: 1px; }
.adm-check .sub { display: flex; flex-direction: column; min-width: 0; font-size: 0.92rem; }
.adm-check.nested { padding-left: 22px; }
.adm-check:has(input:disabled) { cursor: default; }
.adm-check:has(input:disabled) .sub { color: var(--text-2); }
/* файл шаблона / хранилище в строку */
.adm .adm-file { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 6px 0; }
.adm .adm-file + .adm-file { border-top: 1px solid var(--border); }
.adm .adm-file b { overflow-wrap: anywhere; }
.adm .adm-grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.adm .btn.danger.btn-sm { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.adm textarea.adm-code-in { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }

/* ---------- склад в заявке: быстрый (Jev) и умный поиск (docs/91-stock-fast-smart.md) ---------- */
.stk-frames { display: grid; gap: 8px; margin: 0 0 12px; }
.stk-frames:empty { display: none; }
.stk-row { display: grid; gap: 3px; }
.stk-frame {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; font-size: 0.86rem; color: var(--text); background: transparent;
  border: 1.5px solid #3b82f6; border-radius: 999px; max-width: 100%; overflow-wrap: anywhere;
}
.stk-frame.smart { border-color: #7c5cd6; border-radius: 4px; }
.stk-frame.rough { border-color: var(--border); color: var(--text-2); background: var(--surface-2); }
.stk-sum { font-size: 0.82rem; color: var(--text-2); padding-left: 4px; }
.stk-sum.rough { color: var(--text-3); }
.stk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stk-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.stk-badges:empty { display: none; }
.stk-badge {
  display: inline-flex; align-items: center; gap: 3px; border: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  min-height: 24px;
}
.stk-badge .stk-ico, .stk-badge .stk-ico svg { width: 12px; height: 12px; display: inline-block; }
.stk-badge.fast.same { background: #dcefe1; color: #16592b; }
.stk-badge.fast.similar { background: #f7e6d3; color: #7a3d00; }
.stk-badge.smart { border-radius: 4px; color: #fff; }
.stk-badge.smart.same { background: #1e7b3a; }
.stk-badge.smart.similar { background: #a65200; }
.stk-badge.rough { background: var(--surface-2); color: var(--text-2); font-weight: 600; }
/* окно кандидатов и карточка склада */
.stk-sheet {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.stk-panel {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto;
  border-radius: 14px 14px 0 0; padding: 12px 16px 24px; display: grid; gap: 12px; align-content: start;
}
@media (min-width: 700px) { .stk-sheet { align-items: center; } .stk-panel { border-radius: 14px; } }
.stk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stk-head h2, .stk-card-title { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.stk-cands { display: grid; gap: 8px; }
.stk-cand {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; color: var(--text); font: inherit; cursor: pointer;
}
.stk-cand:hover { border-color: var(--accent); }
.stk-thumb {
  width: 56px; height: 56px; border-radius: 8px; background: var(--surface-2); flex: 0 0 auto; overflow: hidden;
}
.stk-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stk-cand-main { display: grid; gap: 3px; min-width: 0; }
.stk-cand-name { font-size: 0.95rem; overflow-wrap: anywhere; }
.stk-cand-sub { font-size: 0.8rem; color: var(--text-2); overflow-wrap: anywhere; }
.stk-cand-verdict { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stk-verdict { font-size: 0.75rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; }
.stk-verdict.same { background: #dcefe1; color: #16592b; }
.stk-verdict.similar { background: #f7e6d3; color: #7a3d00; }
.stk-verdict.rough { background: var(--surface-2); color: var(--text-2); }
.stk-card { display: grid; gap: 10px; }
.stk-field-name { font-size: 0.78rem; color: var(--text-2); margin-bottom: 2px; }
.stk-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.stk-actions .btn, .stk-head .btn {
  width: auto; flex: 0 0 auto; min-height: 36px; padding: 6px 14px; font-size: 0.86rem;
}
.stk-btn.fast { border: 1.5px solid #3b82f6; border-radius: 999px; }
.stk-btn.smart { border: 1.5px solid #7c5cd6; border-radius: 4px; }

/* «Копии» (резервные копии AnyOrder) и «Pushover» — docs/95-backup.md */
.bk-head { display: grid; gap: 8px; padding: 12px 14px; }
.bk-last { display: grid; gap: 3px; font-size: 0.88rem; }
.bk-res { font-size: 0.84rem; overflow-wrap: anywhere; }
.bk-res.ok { color: var(--adm-ok); }
.bk-res.bad { color: var(--danger); }
.bk-run { font-size: 0.86rem; color: var(--text-2); display: grid; gap: 5px; }
.bk-run-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; overflow-wrap: anywhere; }
.bk-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.bk-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s ease; }
.bk-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bk-card-head .ai-svc-head { cursor: pointer; flex: 1 1 180px; min-width: 0; }
.adm .bk-card-head input[type="checkbox"] { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.adm .bk-card-head input[type="checkbox"]:disabled { opacity: 0.45; }
.bk-card-head .m-sub { display: block; font-size: 0.82rem; color: var(--text-2); }
.bk-setup { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.adm .bk-steps { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.bk-step { font-size: 0.9rem; line-height: 1.45; overflow-wrap: anywhere; }
.bk-step::marker { font-weight: 600; color: var(--text-2); }
.adm .ai-svc-body .bk-step > .field, .adm .bk-step > .bk-custom { margin-top: 8px; }
.bk-step .btn { vertical-align: middle; }
.bk-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.adm .bk-steps > li { min-width: 0; }
.bk-copy { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 0; max-width: 100%; min-width: 0; }
.bk-copy code { font-size: 0.82rem; padding: 2px 6px; border-radius: 6px; background: var(--border); min-width: 0; word-break: break-all; }
.bk-custom { display: grid; gap: 10px; }
.adm .btn.disabled { pointer-events: none; opacity: 0.5; }
.bk-files { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.bk-dir { display: grid; gap: 6px; }
.bk-dir-h { font-size: 0.9rem; }
.bk-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.bk-file-name { font-size: 0.84rem; overflow-wrap: anywhere; min-width: 0; flex: 1 1 200px; }

/* расписание и сроки копий (свёрнутый блок, «Изменить» раскрывает); кружок на вкладке «Копии» */
.bk-sched { border: 1px solid var(--border); border-radius: 12px; background: var(--bg, transparent); overflow: hidden; }
.bk-sched.open { border-color: var(--accent); }
.bk-sched-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 14px; }
.bk-sched-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.bk-sched-cap { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.bk-sched-main { font-size: 0.98rem; font-weight: 600; }
.bk-sched-sub { font-size: 0.84rem; color: var(--text-2); overflow-wrap: anywhere; }
.adm .bk-sched-head .bk-sched-btn { flex: 0 0 auto; width: auto; min-height: 44px; white-space: nowrap; }
.bk-sched-body { border-top: 1px solid var(--border); padding: 4px 14px 14px; display: grid; }
.bk-sched-body > .hint { margin-top: 12px !important; line-height: 1.45; }
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bk-row-l { display: flex; flex-direction: column; gap: 2px; font-size: 0.95rem; min-width: 0; flex: 1 1 100px; }
.bk-row-l .hint { font-size: 0.78rem; margin: 0; }
.bk-stepper { display: flex; align-items: center; gap: 6px; }
.adm .bk-step-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 1.2rem; justify-content: center; }
.adm .bk-num { width: 56px; height: 44px; text-align: center; padding: 0 4px; -moz-appearance: textfield; }
.adm .bk-num::-webkit-outer-spin-button, .adm .bk-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.adm .bk-time { width: 104px; height: 44px; text-align: center; }
.adm .bk-num.bad { border-color: var(--danger); }
.seg-spin { display: inline-flex; margin-left: 6px; vertical-align: middle; }
.seg-spin.hidden { display: none; }

/* ---------- видео и пачки вложений в чате (docs/92-android.md) ---------- */
.bubble.video { display: flex; flex-direction: column; gap: 4px; }
.msg-video { display: block; max-width: 100%; width: 320px; max-height: 360px; border-radius: 12px; background: #000; }
.video-ph { width: 260px; height: 150px; }
.video-dl {
  background: none; border: 0; padding: 2px 6px 4px; font: inherit; font-size: 12px;
  color: inherit; opacity: 0.75; text-align: left; cursor: pointer; word-break: break-word;
}
.video-card { cursor: default; }
.video-actions { display: flex; gap: 6px; margin-top: 6px; }
.video-actions .btn, .android-banner .btn {
  width: auto; flex: none; min-height: 34px; padding: 6px 12px; font-size: 13px; white-space: nowrap;
}
.msg.mine .video-actions .btn { background: rgba(255, 255, 255, 0.22); color: #fff; border-color: transparent; }
.pending-x {
  background: none; border: 0; padding: 0 0 0 8px; color: inherit; cursor: pointer;
  display: inline-flex; vertical-align: middle; opacity: 0.85;
}
.pending-x svg { width: 16px; height: 16px; }
.chat-panel.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ---------- приложение для Android ---------- */
.android-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 16px 0; padding: 10px 10px 10px 12px;
  border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--border);
}
.android-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.android-text b { font-size: 14px; }
.android-ico { width: 36px; height: 36px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.android-ico svg { width: 22px; height: 22px; }
.android-card { margin-top: 14px; text-decoration: none; color: inherit; align-items: center; gap: 10px; }
.login-wrap + .android-slot, .android-slot:empty { display: contents; }

/* ---------- админка «Видео» ---------- */
.video-mode { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.video-mode input { margin-top: 3px; }
.video-mode > span { display: flex; flex-direction: column; }
.video-times { display: flex; align-items: center; gap: 8px; }
.adm .video-times .bk-time { width: 120px; }
.video-status { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.video-status .bad { color: var(--danger, #d9534f); }

/* «Логотип» в админке (заставка «Контур», docs/97-splash.md): предпросмотр на фоне каждой темы */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 4px; }
.brand-card { min-width: 0; }
.brand-pic { display: flex; align-items: center; justify-content: center; height: 150px; margin-top: 6px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; padding: 14px; }
.brand-pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-pic img.brand-borrowed { opacity: .55; }
.brand-pic .hint { color: inherit; opacity: .6; }
/* кнопки «Заменить» / «Удалить» — отступ от картинки (у .ai-svc-body .m-actions его нет) */
.brand-card .m-actions { margin-top: 10px; }

/* карточка сообщества, вкладка «Документы»: «Разбор ИИ» по месяцам (DocAiStatsSection iOS) */
.adm .cm-ai-list { display: grid; }
.adm .cm-ai-row { display: grid; gap: 2px; padding: 8px 2px; border-top: 1px solid var(--border); min-width: 0; }
.adm .cm-ai-row:first-child { border-top: 0; padding-top: 2px; }
.adm .cm-ai-row:last-child { padding-bottom: 2px; }
.adm .cm-ai-row b { font-size: 0.92rem; font-weight: 650; }
.adm .cm-ai-row .hint { overflow-wrap: anywhere; }

/* «Правки 5»: изменения количества и «История» со «стало / было» */
.el-num .struck, .part-need.struck { text-decoration: line-through; color: var(--text-3); }
.el-chain { font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.part-need + .el-chain { text-align: left; margin-bottom: 6px; }
.qty-changes { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.qty-change { padding: 8px 10px; border-radius: 10px; background: var(--bg-2, rgba(127,127,127,.08)); }
.qty-change-main { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; min-width: 0; }
.qty-change-delta { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qty-change-delta.minus { color: #d9534f; }
.qty-change-delta.plus { color: #2e9d5b; }
.qty-change-word { flex: 1 1 auto; font-size: 13px; color: var(--text-2); }
.qty-change-btns { display: flex; gap: 6px; margin-left: auto; }
.qty-open { margin: 6px 0 10px; }
.qty-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); margin: 10px 0; }
.qty-preview { margin: 8px 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.qty-preview.bad { color: #d9534f; }
.history-item { font-size: 14px; margin-top: 1px; }
.history-now { font-size: 14px; margin-top: 3px; }
.history-was { font-size: 13px; color: var(--text-3); }
.history-label { color: var(--text-2); }
mark.diff { background: rgba(255, 196, 0, .35); color: inherit; border-radius: 3px; padding: 0 1px; }
.history-was mark.diff { background: rgba(127, 127, 127, .25); }
