/* =====================================================================
   ПрокатКит — дополнения к дизайн-системе КИТ (style.css скелета).
   Основа — auto.css АвтоКит: вензельные углы зон, цветные обводки и фон,
   подписи слева, классический поиск, модалки, чат поддержки.
   ===================================================================== */

/* Широкая рабочая область под таблицы автосалона */
main { max-width: 1400px; }
.topbar-inner { max-width: 1400px; gap: 18px; height: auto; min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
.nav-links { row-gap: 2px; }
.nav-links { flex-wrap: wrap; }
.nav-links a { padding: 7px 11px; }

/* выпадающие подменю в шапке */
.nav-drop { position: relative; }
.nav-drop-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 220px; z-index: 30;
  background: var(--surface-1); border: 1px solid var(--modal-ring); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.nav-drop:hover .nav-drop-menu, .nav-drop:focus-within .nav-drop-menu { display: block; }
.nav-drop-menu a { display: block; border-radius: 6px; }

/* заголовок страницы с действиями справа */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 600; margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head .actions form { margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; }

/* --- Зонирование: растительный вензель №4, тонкая рамка и цветной фон. --- */
:root {
  --vz-tl: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 76 76' fill='none' stroke='%23fff' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><g><path d='M76 12 C57 12 45 22 28 17 C12 12 6 19 8 31 C10 44 28 46 31 34 C35 21 18 19 18 29 C18 35 24 36 25 32 M28 17 C23 3 9 3 8 12 M8 31 C2 47 19 57 12 76 M35 17 C44 1 62 6 57 16 C53 25 43 20 47 14 M17 48 C32 48 38 58 28 64 C20 69 15 60 22 57 M38 17 Q39 8 32 6 Q30 13 38 17 M63 12 Q63 3 70 5 Q70 10 63 12 M12 68 Q3 60 3 54 Q12 55 12 68'/></g></svg>");
  --vz-tr: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 76 76' fill='none' stroke='%23fff' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(76 0) scale(-1 1)'><path d='M76 12 C57 12 45 22 28 17 C12 12 6 19 8 31 C10 44 28 46 31 34 C35 21 18 19 18 29 C18 35 24 36 25 32 M28 17 C23 3 9 3 8 12 M8 31 C2 47 19 57 12 76 M35 17 C44 1 62 6 57 16 C53 25 43 20 47 14 M17 48 C32 48 38 58 28 64 C20 69 15 60 22 57 M38 17 Q39 8 32 6 Q30 13 38 17 M63 12 Q63 3 70 5 Q70 10 63 12 M12 68 Q3 60 3 54 Q12 55 12 68'/></g></svg>");
  --vz-bl: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 76 76' fill='none' stroke='%23fff' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(0 76) scale(1 -1)'><path d='M76 12 C57 12 45 22 28 17 C12 12 6 19 8 31 C10 44 28 46 31 34 C35 21 18 19 18 29 C18 35 24 36 25 32 M28 17 C23 3 9 3 8 12 M8 31 C2 47 19 57 12 76 M35 17 C44 1 62 6 57 16 C53 25 43 20 47 14 M17 48 C32 48 38 58 28 64 C20 69 15 60 22 57 M38 17 Q39 8 32 6 Q30 13 38 17 M63 12 Q63 3 70 5 Q70 10 63 12 M12 68 Q3 60 3 54 Q12 55 12 68'/></g></svg>");
  --vz-br: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 76 76' fill='none' stroke='%23fff' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(76 76) scale(-1 -1)'><path d='M76 12 C57 12 45 22 28 17 C12 12 6 19 8 31 C10 44 28 46 31 34 C35 21 18 19 18 29 C18 35 24 36 25 32 M28 17 C23 3 9 3 8 12 M8 31 C2 47 19 57 12 76 M35 17 C44 1 62 6 57 16 C53 25 43 20 47 14 M17 48 C32 48 38 58 28 64 C20 69 15 60 22 57 M38 17 Q39 8 32 6 Q30 13 38 17 M63 12 Q63 3 70 5 Q70 10 63 12 M12 68 Q3 60 3 54 Q12 55 12 68'/></g></svg>");
}
section.card {
  /* Растительный вензель №4: окончания (76,12)/(12,76) стыкуются с рамкой. */
  --vz-size: 52px;
  --vz-gap: var(--vz-size);
  --vz-line-w: calc(var(--vz-size) / 76);
  --vz-inset: calc(var(--vz-size) * 11.5 / 76);
  --vz-vshift: 0px;
  position: relative;
  border: none;
  border-radius: 0;
  padding: 32px 42px 34px;
  min-height: calc(2 * var(--vz-size));
  --vz-line: linear-gradient(var(--sect-border, var(--border)), var(--sect-border, var(--border)));
  background:
    var(--vz-line) no-repeat center top var(--vz-inset)    / calc(100% - 2 * var(--vz-gap)) var(--vz-line-w),
    var(--vz-line) no-repeat center bottom var(--vz-inset) / calc(100% - 2 * var(--vz-gap)) var(--vz-line-w),
    var(--vz-line) no-repeat left calc(var(--vz-inset) + var(--vz-vshift)) center           / var(--vz-line-w) calc(100% - 2 * var(--vz-gap)),
    var(--vz-line) no-repeat right max(0px, calc(var(--vz-inset) - var(--vz-vshift))) center / var(--vz-line-w) calc(100% - 2 * var(--vz-gap)),
    color-mix(in srgb, var(--sect-bg, var(--surface-1)) 55%, transparent);
  box-shadow: none;
}
section.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-color: var(--sect-border, var(--border));
  -webkit-mask-image: var(--vz-tl), var(--vz-tr), var(--vz-bl), var(--vz-br);
          mask-image: var(--vz-tl), var(--vz-tr), var(--vz-bl), var(--vz-br);
  -webkit-mask-position: top left, top right, bottom left, bottom right;
          mask-position: top left, top right, bottom left, bottom right;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: var(--vz-size) var(--vz-size); mask-size: var(--vz-size) var(--vz-size);
}
section.card > * { position: relative; z-index: 1; }
section.card > h2 {
  padding: 6px 10px 7px; margin: 0 0 12px; border-radius: 6px 6px 0 0;
  background: var(--sect-head, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--sect-border, var(--border)) 45%, transparent);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
section.card > h2 .h-actions { display: flex; gap: 6px; font-weight: 400; }
/* Цвета зон: яркая насыщенная обводка + заметная цветная заливка (правило владельца
   «контуры поярче, выделение цветом»); заголовок зоны — полоса того же цвета. */
section.card.sect-blue   { --sect-border: rgb(0,98,235);   --sect-bg: rgba(30,120,240,0.20); --sect-head: rgba(30,120,240,0.16); --sect-glow: rgba(0,98,235,0.40); }
section.card.sect-green  { --sect-border: rgb(0,150,60);   --sect-bg: rgba(20,180,90,0.21);  --sect-head: rgba(20,180,90,0.17);  --sect-glow: rgba(0,150,60,0.40); }
section.card.sect-amber  { --sect-border: rgb(230,140,0);  --sect-bg: rgba(245,170,0,0.24);  --sect-head: rgba(245,170,0,0.20);  --sect-glow: rgba(230,140,0,0.42); }
section.card.sect-slate  { --sect-border: rgb(60,90,140);  --sect-bg: rgba(100,125,160,0.22); --sect-head: rgba(100,125,160,0.18); --sect-glow: rgba(60,90,140,0.38); }
section.card.sect-violet { --sect-border: rgb(130,50,220); --sect-bg: rgba(145,80,230,0.19); --sect-head: rgba(145,80,230,0.16); --sect-glow: rgba(130,50,220,0.40); }
section.card.sect-red    { --sect-border: rgb(215,40,40);  --sect-bg: rgba(230,70,70,0.18);  --sect-head: rgba(230,70,70,0.15);  --sect-glow: rgba(215,40,40,0.40); }
section.card.sect-aqua   { --sect-border: rgb(0,155,170);  --sect-bg: rgba(20,180,190,0.20); --sect-head: rgba(20,180,190,0.16); --sect-glow: rgba(0,155,170,0.40); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) section.card.sect-blue   { --sect-border: rgb(95,165,255);  --sect-bg: rgba(50,130,255,0.30); --sect-head: rgba(80,150,255,0.24); --sect-glow: rgba(95,165,255,0.45); }
  :root:not([data-theme="light"]) section.card.sect-green  { --sect-border: rgb(70,235,150);  --sect-bg: rgba(30,190,110,0.30); --sect-head: rgba(60,220,140,0.22); --sect-glow: rgba(70,235,150,0.42); }
  :root:not([data-theme="light"]) section.card.sect-amber  { --sect-border: rgb(255,200,60);  --sect-bg: rgba(240,165,0,0.30);  --sect-head: rgba(255,195,50,0.22); --sect-glow: rgba(255,200,60,0.45); }
  :root:not([data-theme="light"]) section.card.sect-slate  { --sect-border: rgb(165,190,230); --sect-bg: rgba(120,145,185,0.32); --sect-head: rgba(160,185,225,0.22); --sect-glow: rgba(165,190,230,0.40); }
  :root:not([data-theme="light"]) section.card.sect-violet { --sect-border: rgb(190,135,255); --sect-bg: rgba(150,90,240,0.30); --sect-head: rgba(185,130,255,0.22); --sect-glow: rgba(190,135,255,0.45); }
  :root:not([data-theme="light"]) section.card.sect-red    { --sect-border: rgb(255,125,125); --sect-bg: rgba(235,80,80,0.28);  --sect-head: rgba(255,120,120,0.22); --sect-glow: rgba(255,125,125,0.45); }
  :root:not([data-theme="light"]) section.card.sect-aqua   { --sect-border: rgb(80,230,240);  --sect-bg: rgba(30,190,200,0.30); --sect-head: rgba(80,225,235,0.22); --sect-glow: rgba(80,230,240,0.45); }
}
/* ручной выбор тёмной темы (кнопка в шапке) — те же значения */
:root[data-theme="dark"] section.card.sect-blue   { --sect-border: rgb(95,165,255);  --sect-bg: rgba(50,130,255,0.30); --sect-head: rgba(80,150,255,0.24); --sect-glow: rgba(95,165,255,0.45); }
:root[data-theme="dark"] section.card.sect-green  { --sect-border: rgb(70,235,150);  --sect-bg: rgba(30,190,110,0.30); --sect-head: rgba(60,220,140,0.22); --sect-glow: rgba(70,235,150,0.42); }
:root[data-theme="dark"] section.card.sect-amber  { --sect-border: rgb(255,200,60);  --sect-bg: rgba(240,165,0,0.30);  --sect-head: rgba(255,195,50,0.22); --sect-glow: rgba(255,200,60,0.45); }
:root[data-theme="dark"] section.card.sect-slate  { --sect-border: rgb(165,190,230); --sect-bg: rgba(120,145,185,0.32); --sect-head: rgba(160,185,225,0.22); --sect-glow: rgba(165,190,230,0.40); }
:root[data-theme="dark"] section.card.sect-violet { --sect-border: rgb(190,135,255); --sect-bg: rgba(150,90,240,0.30); --sect-head: rgba(185,130,255,0.22); --sect-glow: rgba(190,135,255,0.45); }
:root[data-theme="dark"] section.card.sect-red    { --sect-border: rgb(255,125,125); --sect-bg: rgba(235,80,80,0.28);  --sect-head: rgba(255,120,120,0.22); --sect-glow: rgba(255,125,125,0.45); }
:root[data-theme="dark"] section.card.sect-aqua   { --sect-border: rgb(80,230,240);  --sect-bg: rgba(30,190,200,0.30); --sect-head: rgba(80,225,235,0.22); --sect-glow: rgba(80,230,240,0.45); }
/* зона внутри модалки — без нижнего отступа страницы */
.modal-body > section.card { margin-bottom: 0; }
/* Сетка зон: две колонки на широких экранах */
.zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 18px; align-items: start; margin-bottom: 18px; }
.zones > section { margin-bottom: 0; }
.zones .span2 { grid-column: 1 / -1; }

/* --- Формы: подпись СЛЕВА от поля в одну строку (стиль Кит, эталон Make1s) --- */
.frow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.frow .flabel { flex: 0 0 200px; min-width: 200px; white-space: nowrap; font-size: 12.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
.frow .fctl { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; position: relative; }
.frow input[type=text], .frow input[type=number], .frow input[type=date], .frow input[type=search],
.frow input[type=password], .frow input[type=email], .frow input[type=file], .frow select, .frow textarea {
  width: 100%; background: var(--page-plane); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; color: var(--text-primary); font-family: inherit;
}
.frow input:focus, .frow select:focus, .frow textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.frow input.num { text-align: right; font-variant-numeric: tabular-nums; }
.frow .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.frow .unit { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.frow input[readonly] { color: var(--text-muted); }
.narrow .frow .flabel { flex-basis: 150px; min-width: 150px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.form-actions .btn + .btn { margin-left: 0; }
.hint { font-size: 11.5px; margin: -4px 0 8px 0; }
.hint.ok { color: var(--status-good); }
.hint.warn { color: #b26a00; }
.hint.err { color: var(--status-critical); }
.hint.auto-hint { margin-left: 0; }
.hint.auto-hint:empty { display: none; }
.lookup-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40; background: var(--surface-1);
  border: 1px solid var(--modal-ring); border-radius: 8px; max-height: 260px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.lookup-item { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.lookup-item:hover { background: var(--page-plane); }

/* --- Таблицы: курсор, совпадения поиска (эталон grafost) --- */
table.rows tbody tr { cursor: default; }
table.rows tbody tr:hover td { background: rgba(42,120,214,0.06); }
table.rows tbody tr.match td { background: rgba(240,190,0,0.22); }
table.rows tbody tr.cursor td { background: rgba(42,120,214,0.20); }
table.rows tbody tr.cursor.match td { background: rgba(240,190,0,0.32); }
table.rows tbody tr.cursor td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.rows tbody tr[data-href], table.rows tbody tr[data-modal-open] { cursor: pointer; }
table.rows td.num, table.rows th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rows tfoot td { padding: 10px; font-weight: 600; border-top: 2px solid var(--gridline); }
table.compact td, table.compact th { padding: 6px 8px; }
.table-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.table-filter input[type=search] {
  width: 320px; max-width: 100%; background: var(--page-plane); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--text-primary);
}
.table-filter input[type=search]:focus { outline: none; border-color: var(--accent); }
.filter-label {
  background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
  font-size: 12.5px; color: var(--text-secondary); cursor: pointer;
}
.filter-label.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-count { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; min-width: 80px; }

/* бейджи статусов */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: #fff; }
.badge-blue { background: var(--slot-blue); }
.badge-green { background: var(--slot-green); }
.badge-amber { background: var(--slot-yellow); }
.badge-aqua { background: var(--slot-aqua); }
.badge-violet { background: var(--slot-violet); }
.badge-red { background: var(--slot-red); }
.badge-slate { background: #6d7f96; }
.badge.lite { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); font-weight: 500; }

/* фильтр-чипсы над списком */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips a { text-decoration: none; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.chips a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips a .n { opacity: 0.7; margin-left: 4px; }

/* карточка: подпись/значение */
.kv { display: flex; gap: 8px; padding: 3px 0; font-size: 13px; border-bottom: 1px dashed rgba(128,128,128,0.15); }
.kv:last-child { border-bottom: none; }
.kv-l { flex: 0 0 200px; color: var(--text-muted); }
.kv-v { flex: 1; word-break: break-word; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
/* в колонке сетки подпись уже (было 200px — значение «Склад» сжималось до 1 символа) */
.kv-grid .kv-l { flex: 0 0 45%; max-width: 200px; }
.kv-v { min-width: 0; }
.big-price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-pos { color: var(--status-good); }
.price-neg { color: var(--status-critical); }
/* модалка-форма */
.modal.wide { width: 860px; }
.modal-body { padding: 4px 16px 16px; }
.modal-body .frow .flabel { flex-basis: 170px; min-width: 170px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 16px 16px; }

/* дашборд склада */
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; min-width: 160px; background: var(--surface-1); }
/* плитки-итоги — цветные, по кругу акцентов зон (те же --sect-* что у section.card) */
.stat-cards .stat { border: 1.5px solid var(--sect-border); background: var(--sect-bg); box-shadow: 0 0 12px -4px var(--sect-glow); }
.stat-cards .stat:nth-child(6n+1) { --sect-border: rgb(0,98,235);   --sect-bg: rgba(30,120,240,0.20); --sect-glow: rgba(0,98,235,0.40); }
.stat-cards .stat:nth-child(6n+2) { --sect-border: rgb(0,150,60);   --sect-bg: rgba(20,180,90,0.21);  --sect-glow: rgba(0,150,60,0.40); }
.stat-cards .stat:nth-child(6n+3) { --sect-border: rgb(230,140,0);  --sect-bg: rgba(245,170,0,0.24);  --sect-glow: rgba(230,140,0,0.42); }
.stat-cards .stat:nth-child(6n+4) { --sect-border: rgb(130,50,220); --sect-bg: rgba(145,80,230,0.19); --sect-glow: rgba(130,50,220,0.40); }
.stat-cards .stat:nth-child(6n+5) { --sect-border: rgb(0,155,170);  --sect-bg: rgba(20,180,190,0.20); --sect-glow: rgba(0,155,170,0.40); }
.stat-cards .stat:nth-child(6n)   { --sect-border: rgb(215,40,40);  --sect-bg: rgba(230,70,70,0.18);  --sect-glow: rgba(215,40,40,0.40); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stat-cards .stat:nth-child(6n+1) { --sect-border: rgb(95,165,255);  --sect-bg: rgba(50,130,255,0.30); --sect-glow: rgba(95,165,255,0.45); }
  :root:not([data-theme="light"]) .stat-cards .stat:nth-child(6n+2) { --sect-border: rgb(70,235,150);  --sect-bg: rgba(30,190,110,0.30); --sect-glow: rgba(70,235,150,0.42); }
  :root:not([data-theme="light"]) .stat-cards .stat:nth-child(6n+3) { --sect-border: rgb(255,200,60);  --sect-bg: rgba(240,165,0,0.30);  --sect-glow: rgba(255,200,60,0.45); }
  :root:not([data-theme="light"]) .stat-cards .stat:nth-child(6n+4) { --sect-border: rgb(190,135,255); --sect-bg: rgba(150,90,240,0.30); --sect-glow: rgba(190,135,255,0.45); }
  :root:not([data-theme="light"]) .stat-cards .stat:nth-child(6n+5) { --sect-border: rgb(80,230,240);  --sect-bg: rgba(30,190,200,0.30); --sect-glow: rgba(80,230,240,0.45); }
  :root:not([data-theme="light"]) .stat-cards .stat:nth-child(6n)   { --sect-border: rgb(255,125,125); --sect-bg: rgba(235,80,80,0.28);  --sect-glow: rgba(255,125,125,0.45); }
}
:root[data-theme="dark"] .stat-cards .stat:nth-child(6n+1) { --sect-border: rgb(95,165,255);  --sect-bg: rgba(50,130,255,0.30); --sect-glow: rgba(95,165,255,0.45); }
:root[data-theme="dark"] .stat-cards .stat:nth-child(6n+2) { --sect-border: rgb(70,235,150);  --sect-bg: rgba(30,190,110,0.30); --sect-glow: rgba(70,235,150,0.42); }
:root[data-theme="dark"] .stat-cards .stat:nth-child(6n+3) { --sect-border: rgb(255,200,60);  --sect-bg: rgba(240,165,0,0.30);  --sect-glow: rgba(255,200,60,0.45); }
:root[data-theme="dark"] .stat-cards .stat:nth-child(6n+4) { --sect-border: rgb(190,135,255); --sect-bg: rgba(150,90,240,0.30); --sect-glow: rgba(190,135,255,0.45); }
:root[data-theme="dark"] .stat-cards .stat:nth-child(6n+5) { --sect-border: rgb(80,230,240);  --sect-bg: rgba(30,190,200,0.30); --sect-glow: rgba(80,230,240,0.45); }
:root[data-theme="dark"] .stat-cards .stat:nth-child(6n)   { --sect-border: rgb(255,125,125); --sect-bg: rgba(235,80,80,0.28);  --sect-glow: rgba(255,125,125,0.45); }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--text-muted); }

/* журнал обмена */
pre.code.wrap { white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }

/* вход */
.login-box { max-width: 420px; margin: 60px auto; }
.login-box .frow .flabel { flex-basis: 90px; min-width: 90px; }

/* about */
.about h3 { margin: 18px 0 6px; font-size: 15px; }
.about ul { margin: 4px 0 8px 18px; padding: 0; }
.about li { margin: 2px 0; }

@media print {
  .topbar, footer, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
}

/* --- Комбобокс select[data-combo]: ввод с клавиатуры, фильтр по буквам --- */
.combo { position: relative; flex: 1; min-width: 0; display: flex; }
.combo .combo-input { width: 100%; }
.combo .combo-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; bottom: 0; }
.combo-list { max-height: 320px; z-index: 60; }
section.card > .frow.combo-open { z-index: 50; }
.combo-list .lookup-item mark { background: rgba(240,190,0,0.35); color: inherit; border-radius: 2px; padding: 0 1px; }
.combo-list .lookup-item.active { background: rgba(42,120,214,0.20); }
.combo-list .lookup-item.selected { font-weight: 600; }
.combo-list .lookup-item.selected::after { content: ' ✓'; color: var(--accent); }
.combo-list .lookup-item.muted { color: var(--text-muted); cursor: default; }

/* --- кабинеты, регистрация, подтверждение (0.5.0) --- */
.topbar-user .cab-name { color: var(--text-primary); font-weight: 600; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.topbar-user a.user-name { text-decoration: none; }
.topbar-user a.user-name:hover { color: var(--accent); }
.topbar-user > a.active { color: var(--accent); font-weight: 600; }
.support-banner { background: rgba(240,170,0,0.18); border-bottom: 2px solid rgba(240,170,0,0.7);
  padding: 8px 16px; text-align: center; font-size: 13px; }
.auth-box { max-width: 620px; margin: 30px auto; }
.auth-box .frow .flabel { flex-basis: 170px; min-width: 170px; }
.big-code { font: 700 34px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 4px; text-align: center;
  padding: 16px; margin: 12px 0; border-radius: 10px; background: rgba(42,120,214,0.12);
  border: 2px dashed rgba(42,120,214,0.55); color: var(--accent); user-select: all; }
.confirm-wait { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--text-secondary); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--border);
  border-top-color: var(--accent); animation: kit-spin .9s linear infinite; }
@keyframes kit-spin { to { transform: rotate(360deg); } }
.chan-list { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.chan-list label.off { color: var(--text-muted); }
.hp-field { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.wait-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center;
  justify-content: center; z-index: 200; }
.wait-overlay[hidden] { display: none; }
.wait-box { background: var(--surface-1); color: var(--text-primary); padding: 22px 28px; border-radius: 12px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
.badge.lite { font-weight: 500; }

/* =====================================================================
   Кнопка темы в шапке (светлая / тёмная; выбор — localStorage auto-theme)
   ===================================================================== */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  padding: 0; border: 1px solid var(--border); border-radius: 8px; background: transparent;
  color: var(--text-secondary); cursor: pointer;
}
.theme-toggle:hover { color: var(--text-primary); background: var(--page-plane); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .ico-moon { display: none; }
.theme-toggle.is-dark .ico-sun { display: none; }
.theme-toggle.is-dark .ico-moon { display: block; fill: currentColor; stroke: none; }

.nav-links { align-items: center; }
.topbar-user .reg-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.topbar-user .reg-link:hover { text-decoration: underline; }

/* окно входа гостя */
.modal.modal-login { width: 520px; }
.modal-login .login-to { margin: 0 0 12px; }
.modal-login .frow .flabel { flex-basis: 90px; min-width: 90px; }


/* --- Публичная заставка на «/» (стиль КИТ) --- */
section.landing { background: transparent; border: none; padding: 0; margin: 0; box-shadow: none; }
.landing-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 44px; align-items: center; margin-top: 18px; }
.eyebrow { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 12px; }
.landing-title { font-size: 60px; font-weight: 800; letter-spacing: -0.01em; line-height: 1; margin: 0 0 18px; }
.landing-title .b-1 { color: var(--accent); }
.landing-title .b-2 { color: var(--slot-yellow); }
.landing-lead { font-size: 16px; line-height: 1.6; color: var(--text-secondary); max-width: 540px; margin: 0 0 22px; }
.landing-points { list-style: none; padding: 0; margin: 0 0 30px; max-width: 540px; }
.landing-points li { position: relative; padding-left: 26px; margin-bottom: 10px; font-size: 14.5px; }
.landing-points li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }
.landing-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn.btn-lg { padding: 11px 22px; font-size: 14.5px; }

/* разделы под заставкой */
.land-head { font-size: 17px; font-weight: 600; margin: 30px 0 12px; }
.land-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 12px; }
.land-tile {
  --t: var(--accent);
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; text-decoration: none;
  color: var(--text-primary); background: color-mix(in srgb, var(--t) 12%, transparent);
  border: 2px solid color-mix(in srgb, var(--t) 70%, transparent);
  transition: transform 0.12s, box-shadow 0.12s;
}
.land-tile b { color: var(--t); font-size: 14.5px; }
.land-tile span { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; }
.land-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -6px var(--t); }
.land-tile.t-blue { --t: var(--slot-blue); }   .land-tile.t-aqua { --t: var(--slot-aqua); }
.land-tile.t-green { --t: var(--slot-green); } .land-tile.t-amber { --t: var(--slot-yellow); }
.land-tile.t-red { --t: var(--slot-red); }     .land-tile.t-violet { --t: var(--slot-violet); }
.land-tile.t-slate { --t: #5b7090; }

.landing-grid > * { min-width: 0; }
@media (max-width: 900px) {
  /* шапка на узком экране: меню переносится отдельной строкой под брендом */
  .topbar-inner { height: auto; flex-wrap: wrap; row-gap: 4px; padding: 8px 16px; }
  .nav-links { order: 3; width: 100%; margin-left: 0; gap: 2px; }
  .nav-links a { padding: 6px 9px; font-size: 13px; }
  main { padding-left: 16px; padding-right: 16px; }
  .landing-grid { grid-template-columns: 1fr; gap: 24px; min-height: 0; }
  .landing-art { order: -1; min-height: 0; padding: 18px 12px 14px; }
  .landing-title { font-size: 44px; }
}

/* окно-описание раздела на заставке: текст + скриншоты-примеры (светлый/тёмный кадр — по теме) */
.modal.modal-info { width: 1040px; max-height: 90vh; }
.modal-info .modal-head h3 { font-size: 17px; }
.modal-info .info-lead { font-size: 14.5px; line-height: 1.55; margin: 0 0 12px; color: var(--text-primary); }
.modal-info .info-points { margin: 0; max-width: none; }
.modal-info .info-points li { font-size: 13.5px; margin-bottom: 7px; }
.info-shot { margin: 16px 0 0; }
.info-shot a { display: block; }
.info-shot img {
  display: block; width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--modal-ring); box-shadow: 0 6px 22px -10px rgba(0,0,0,0.45);
}
.info-shot figcaption { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; text-align: center; }
.info-actions { margin-top: 18px; }
.info-shot .shot-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .info-shot .shot-light { display: none; }
  :root:not([data-theme="light"]) .info-shot .shot-dark { display: block; }
}
:root[data-theme="dark"] .info-shot .shot-light { display: none; }
:root[data-theme="dark"] .info-shot .shot-dark { display: block; }
.land-tile { cursor: pointer; }

/* ── Техподдержка (0.5.19): кнопка в шапке, панель чата, бейджи ботов, переписка ── */
.nav-badge { display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 5px; border-radius: 999px;
  background: var(--slot-red); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.nav-badge[hidden] { display: none; }
.nav-chat-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1.5px solid var(--accent);
  border-radius: 8px; background: transparent; color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background 0.12s, color 0.12s; }
.nav-chat-btn:hover { background: var(--accent); color: #fff; }
.nav-chat-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bot-badge { display: inline-block; padding: 1px 6px; border-radius: 5px; color: #fff; font-size: 10.5px;
  font-weight: 700; letter-spacing: .3px; line-height: 16px; vertical-align: 1px; }
.bot-badge-telegram { background: linear-gradient(135deg, #2aabee, #1d7fd6); }
.bot-badge-max { background: linear-gradient(135deg, #7b5cff, #3d7bff); }
.bot-badge-web { background: #6d7f96; }
.footer-support { margin-top: 6px; display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.bot-link { color: var(--text-secondary); text-decoration: none; font-size: 12.5px; }
.bot-link:hover { color: var(--accent); text-decoration: underline; }
.linklike { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }

.chat-panel { position: fixed; right: 18px; bottom: 18px; z-index: 900; width: 380px; max-width: calc(100vw - 24px);
  height: 540px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-1); border: 2px solid var(--accent); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28), 0 0 0 4px var(--accent-glow); }
.chat-panel[hidden] { display: none; }
.chat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); background: rgba(42,120,214,0.14); }
.chat-title { font-weight: 700; font-size: 14px; }
.chat-sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.chat-top-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.chat-top-actions .btn { padding: 3px 6px; }
.chat-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-secondary); padding: 0 4px; }
.chat-close:hover { color: var(--text-primary); }
.chat-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--page-plane); }
.chat-empty { color: var(--text-muted); font-size: 12.5px; text-align: center; margin: auto 0; padding: 10px; }
.chat-msg { max-width: 85%; padding: 7px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; word-break: break-word; }
.chat-msg.from-me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg.from-op { align-self: flex-start; background: var(--surface-1); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.chat-msg-meta { font-size: 10.5px; opacity: 0.75; margin-top: 3px; }
.chat-form { border-top: 1px solid var(--border); padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; }
.chat-form textarea { width: 100%; resize: none; box-sizing: border-box; font: inherit; font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--page-plane); color: var(--text-primary); }
.chat-form textarea:focus { outline: none; border-color: var(--accent); }
.chat-form-actions { display: flex; align-items: center; gap: 6px; }
.chat-gap { flex: 1; }
.chat-attach-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-attach-list[hidden] { display: none; }
.chat-chip { font-size: 11.5px; background: var(--page-plane); border: 1px solid var(--border); border-radius: 12px; padding: 2px 8px; }
.chat-chip button { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 13px; padding: 0 2px; }
.chat-img img { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; margin-top: 4px; }
.chat-file { display: block; margin-top: 4px; font-size: 12.5px; color: inherit; text-decoration: underline; }

/* переписка в карточке обращения (персонал) */
.tk-thread { display: flex; flex-direction: column; gap: 10px; }
.tk-msg { max-width: 78%; padding: 8px 12px; border-radius: 8px; background: var(--surface-1); border: 1px solid var(--border); }
.tk-msg.tk-in  { align-self: flex-start; border-left: 4px solid var(--slot-blue); }
.tk-msg.tk-out { align-self: flex-end; border-left: 4px solid var(--slot-green); background: rgba(20,180,90,0.10); }
.tk-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.tk-meta b { color: var(--text-secondary); }
.tk-text { white-space: pre-wrap; word-break: break-word; }
.tk-reply { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-1); color: var(--text-primary); margin-bottom: 10px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chat-top { background: rgba(57,135,229,0.22); }
  :root:not([data-theme="light"]) .tk-msg.tk-out { background: rgba(30,190,110,0.16); }
}
:root[data-theme="dark"] .chat-top { background: rgba(57,135,229,0.22); }
:root[data-theme="dark"] .tk-msg.tk-out { background: rgba(30,190,110,0.16); }
@media (max-width: 560px) {
  .chat-panel { right: 8px; bottom: 8px; height: calc(100vh - 70px); }
}

/* --- Сцена на заставке: оборудование проката (бетономешалка, перфоратор, генератор) --- */
.landing-art {
  --art-bg: radial-gradient(130% 130% at 30% 10%, #fff8ec 0%, #fde9c9 55%, #f6d6a4 100%);
  --art-ring: rgba(226,113,29,0.45);
  --art-hi: #e9eef4; --art-mid: #8a97a8; --art-low: #2f3b4a; --art-rim: #cfd8e3; --art-line: rgba(30,30,40,0.55);
  --art-edge: #b48a52; --art-lane: #ffffff; --art-shadow: rgba(60,30,0,0.35); --art-spark: #ff9f1c;
  --art-track: rgba(226,113,29,0.45); --art-node: #e2711d; --art-doc-bg: #ffffff; --art-doc-ring: #e2711d; --art-doc-text: #9a4a0c;
  --art-text: #6b3f12; --art-caption: rgba(90,50,10,0.65); --art-led: #22c55e;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--art-bg); border: 2px solid var(--art-ring); border-radius: 20px; padding: 26px 22px 20px;
  overflow: hidden; min-height: 360px; box-shadow: 0 0 24px -8px var(--art-ring);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .landing-art {
    --art-bg: radial-gradient(130% 130% at 30% 15%, #3a2410 0%, #22150a 58%, #150d05 100%);
    --art-ring: rgba(255,170,80,0.55);
    --art-hi: #b8c4d2; --art-mid: #5c6b7c; --art-low: #131a22; --art-rim: #97a6b8; --art-line: rgba(0,0,0,0.6);
    --art-edge: #7a5a30; --art-lane: rgba(255,240,220,0.7); --art-shadow: rgba(0,0,0,0.6); --art-spark: #ffd166;
    --art-track: rgba(255,170,80,0.45); --art-node: #ffaa50; --art-doc-bg: rgba(255,170,80,0.14); --art-doc-ring: #ffaa50; --art-doc-text: #ffe4c4;
    --art-text: rgba(255,235,210,0.85); --art-caption: rgba(255,235,210,0.6); --art-led: #4ade80;
  }
}
:root[data-theme="dark"] .landing-art {
  --art-bg: radial-gradient(130% 130% at 30% 15%, #3a2410 0%, #22150a 58%, #150d05 100%);
  --art-ring: rgba(255,170,80,0.55);
  --art-hi: #b8c4d2; --art-mid: #5c6b7c; --art-low: #131a22; --art-rim: #97a6b8; --art-line: rgba(0,0,0,0.6);
  --art-edge: #7a5a30; --art-lane: rgba(255,240,220,0.7); --art-shadow: rgba(0,0,0,0.6); --art-spark: #ffd166;
  --art-track: rgba(255,170,80,0.45); --art-node: #ffaa50; --art-doc-bg: rgba(255,170,80,0.14); --art-doc-ring: #ffaa50; --art-doc-text: #ffe4c4;
  --art-text: rgba(255,235,210,0.85); --art-caption: rgba(255,235,210,0.6); --art-led: #4ade80;
}
.landing-art-caption { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--art-caption); }
.rent-scene { width: 100%; max-width: 680px; height: auto; display: block; overflow: hidden; }
.rent-scene .rs-track { fill: none; stroke: var(--art-track); stroke-width: 2; stroke-dasharray: 6 9; }
.rent-scene .rs-step { animation: rs-document 8s ease-in-out infinite; animation-delay: var(--delay); }
.rent-scene .rs-step circle { fill: var(--art-node); }
.rent-scene .rs-paper > path:first-child { fill: var(--art-doc-bg); stroke: var(--art-doc-ring); stroke-width: 2; }
.rent-scene .rs-fold, .rent-scene .rs-lines { fill: none; stroke: var(--art-doc-ring); stroke-width: 1.5; }
.rent-scene text { fill: var(--art-doc-text); font: 600 22px system-ui, sans-serif; text-anchor: middle; }
.rent-scene .rs-stage { fill: var(--art-text); font-size: 21px; }
.rent-scene .rs-caption { fill: var(--art-caption); font-size: 16px; font-weight: 500; letter-spacing: .04em; }
.rent-scene .rs-drum { animation: rs-rock 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.rent-scene .rs-drum-stripes { animation: rs-spin 2.4s linear infinite; transform-box: fill-box; transform-origin: center; }
.rent-scene .rs-drum-shine { animation: rs-shine 2.4s linear infinite; transform-box: fill-box; transform-origin: center; }
.rent-scene .rs-bit { animation: rs-hammer .18s linear infinite; }
.rent-scene .rs-sparks { animation: rs-sparks .5s ease-out infinite; transform-box: fill-box; transform-origin: left center; }
.rent-scene .rs-fan { animation: rs-spin .7s linear infinite; transform-box: fill-box; transform-origin: center; }
.rent-scene .rs-led { fill: var(--art-led); animation: rs-blink 1.4s ease-in-out infinite; }
.rent-scene .rs-lane { stroke-dasharray: 60 40; animation: rs-road 2s linear infinite; }
@keyframes rs-document { 0%,27%,100% { opacity: .45 } 5%,22% { opacity: 1 } }
@keyframes rs-spin { to { transform: rotate(360deg) } }
@keyframes rs-rock { 0%,100% { transform: rotate(-28deg) } 50% { transform: rotate(-24deg) } }
@keyframes rs-shine { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }
@keyframes rs-hammer { 0%,100% { transform: translateX(0) } 50% { transform: translateX(-4px) } }
@keyframes rs-sparks { 0% { transform: scale(.4); opacity: 1 } 100% { transform: scale(1.4) translateX(18px); opacity: 0 } }
@keyframes rs-blink { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
@keyframes rs-road { to { stroke-dashoffset: -100 } }
@media (prefers-reduced-motion: reduce) { .rent-scene * { animation: none !important } .rent-scene .rs-step { opacity: 1 } }

/* --- Документы: таблица строк с редактируемыми полями --- */
table.lines td { vertical-align: middle; }
table.lines input[type=number], table.lines input[type=text], table.lines select { width: 100%; min-width: 0; padding: 5px 7px; font-size: 13px;
  background: var(--page-plane); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-family: inherit; }
table.lines input.num { text-align: right; }
table.lines tfoot td { border-top: 2px solid var(--sect-border, var(--border)); padding-top: 8px; font-weight: 600; }
table.lines .ln-nm { min-width: 220px; }
.lookup-wrap { position: relative; flex: 1; min-width: 0; }
.overdue td { background: rgba(230,70,70,0.12) !important; }
.doc-total { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 11.5px; margin: 2px 0 8px; color: var(--text-secondary); }
.hint.ok { color: var(--status-good); } .hint.warn { color: #b26a00; } .hint.err { color: var(--status-critical); }
.hint:empty { display: none; }
.sync-steps label { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.result-ok { color: var(--status-good); } .result-err { color: var(--status-critical); }
@media print {
  .topbar, footer, .no-print, .chat-panel { display: none !important; }
  main { padding: 0; max-width: none; }
  section.card { background: none !important; box-shadow: none; }
}
.paper { max-width: 800px; margin: 0 auto; font-size: 13px; color: #000; background: #fff; padding: 24px; }
.paper h1 { font-size: 18px; margin: 0 0 6px; } .paper table { border-collapse: collapse; width: 100%; }
.paper th, .paper td { border: 1px solid #000; padding: 4px 6px; font-size: 12.5px; color: #000; }
.paper .sign { display: flex; justify-content: space-between; margin-top: 30px; }
