:root {
  --surface-1:      #fcfcfb;
  --page-plane:     #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --border:         rgba(11,11,11,0.10);

  /* Всплывающие окна: фон чуть темнее страницы + средне-серый контур,
     чтобы окно читалось на любом фоне (не «белое на белом»). */
  --modal-surface:  #eef0f3;
  --modal-ring:     rgba(60,60,60,0.45);

  --slot-blue:    #2a78d6;
  --slot-aqua:    #1baf7a;
  --slot-yellow:  #eda100;
  --slot-green:   #008300;
  --slot-violet:  #4a3aa7;
  --slot-red:     #e34948;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --accent: #2a78d6;
  --accent-glow: rgba(42,120,214,0.35);
}
/* Тёмная тема — ТОЛЬКО по явному переключателю data-bs-theme="dark" (правило КИТ),
   а не автоматически от ОС: база светлая с цветными зонами (классика Кит). */
[data-bs-theme="dark"] {
  --surface-1:      #1a1a19;
  --page-plane:     #0d0d0d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:       #2c2c2a;
  --border:         rgba(255,255,255,0.10);

  /* Тёмная схема: окно светлее страницы (#0d0d0d) + светлый контур. */
  --modal-surface:  #26261f;
  --modal-ring:     rgba(180,180,180,0.45);

  --slot-blue:    #3987e5;
  --slot-aqua:    #199e70;
  --slot-yellow:  #c98500;
  --slot-green:   #008300;
  --slot-violet:  #9085e9;
  --slot-red:     #e66767;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --accent: #3987e5;
  --accent-glow: rgba(57,135,229,0.40);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* top navigation bar */
.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
}
/* Значок КИТ (стиль Кит: логотип-«кит» слева от названия приложения) */
.brand-logo { display: block; flex: none; object-fit: contain; }
/* Название — двумя цветами: смысловые части разными акцентами. Подберите
   пару под проект (эталон Make1s: акцент + slot-yellow). */
.brand-name .b-1 { color: var(--accent); }
.brand-name .b-2 { color: var(--slot-yellow); }
.brand .accent { color: var(--accent); }
/* значок идущей загрузки с releases.1c.ru — в шапке после версии,
   ссылка на страницу прогресса */
.brand .dl-indicator {
  display: inline-flex;
  margin-left: 8px;
  vertical-align: 1px;
}
.brand .app-version {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  vertical-align: 2px;
}
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.nav-links a:hover {
  background: var(--page-plane);
  color: var(--text-primary);
}
.nav-links a.active {
  background: var(--accent);
  color: #fff;
}
.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.topbar-user .user-name {
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}
a.user-name:hover { color: var(--accent); }
.topbar-user .logout-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.topbar-user .logout-link:hover {
  color: var(--text-primary);
  background: var(--page-plane);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
header.page-header { margin-bottom: 28px; }
header.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}
header.page-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}
section h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 2px;
}
section .subtitle {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin: 0 0 16px;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.section-head .subtitle { margin-bottom: 16px; }
.section-head form { flex: none; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--gridline);
}
tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--gridline);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--page-plane); }
tr.row-link td a { color: var(--accent); text-decoration: none; font-weight: 500; }
/* ссылка-кнопка внутри строки-ссылки — текст кнопки, а не ссылки */
tr.row-link td a.btn { color: #fff; }
tr.row-link td a.btn.secondary { color: var(--text-primary); }

/* Список серверов: слева компактные метаданные сервера в столбик,
   справа — широкая колонка «Установленные 1С». */
.servers-table { table-layout: fixed; }
.servers-table .col-server { width: 300px; }
.server-cell { width: 300px; }
.server-name { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.server-meta { margin: 0; }
.server-meta > div { display: flex; gap: 8px; font-size: 12px; line-height: 1.5; }
.server-meta dt { flex: 0 0 78px; color: var(--text-secondary); }
.server-meta dd { margin: 0; min-width: 0; word-break: break-word; }
.server-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.server-actions .scan-form { margin: 0; }

.installed-cell .onec-ver { margin-bottom: 10px; }
.installed-cell .onec-ver:last-of-type { margin-bottom: 4px; }
.onec-head { font-weight: 500; }
.onec-svc { padding-left: 16px; font-size: 12.5px; color: var(--text-secondary); }
/* Разделение кластеров (каждый экземпляр службы = кластер на своём порту)
   горизонтальной линией. */
.onec-svc + .onec-svc { border-top: 1px solid var(--border); margin-top: 5px; padding-top: 5px; }
.onec-run { color: #2e7d32; font-weight: 500; }
.onec-stopped { color: #b26a00; font-weight: 500; }
.onec-none { color: var(--text-muted); }
/* потребители лицензий (rmngr/rphost у сервера лицензирования) */
.onec-consumers { color: #2e7d32; font-size: 12px; padding-left: 14px; }
/* мини-кнопки пуск/стоп экземпляра прямо в списке серверов */
.power-form { display: inline; margin-left: 6px; }
.btn-mini {
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.4;
  padding: 2px 7px;
  vertical-align: 1px;
}
.btn-mini.icon-start { background: #2e7d32; }
.btn-mini.icon-stop { background: #c62828; }
.btn-mini.icon-delete { background: #8e2424; font-weight: 700; }
.btn-mini.icon-add { background: #2e7d32; font-weight: 700; margin-left: 6px; }
/* деинсталляция компонентов версии — открывает консоль с планом */
.onec-uninst { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.onec-uninst form { margin: 0; }
.btn-mini.uninst {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--status-critical);
  font-size: 10.5px;
}
.btn-mini.uninst:hover { border-color: var(--status-critical); }
/* подключение сервера лицензирования — открывает предварительный план */
.btn-mini.lic-connect {
  background: transparent;
  border: 1px solid var(--border);
  color: #2e7d32;
  font-size: 10.5px;
  margin-left: 6px;
}
.btn-mini.lic-connect:hover { border-color: #2e7d32; }

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 4px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
/* ячейка со своим действием — по ней строка-ссылка не переходит */
.cell-nolink { white-space: nowrap; }

/* формы */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  max-width: 560px;
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.field input[type="text"]:focus,
.field input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}
.field .select {
  width: 100%;
  max-width: 560px;
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
}
.field .select:focus { outline: none; border-color: var(--accent); }
.form-actions { margin-top: 4px; }
.form-actions .btn + .btn { margin-left: 8px; }
.field.checkboxes { display: flex; gap: 20px; }
.field.checkboxes label { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--text-primary); }

/* строки «сеть → путь» в настройках дистрибутивов */
.path-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.path-row input[type="text"]:first-child { max-width: 260px; }
.path-row input[type="text"]:last-child { max-width: 480px; }

/* блоки команд (предпросмотр установки) */
pre.code {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 8px;
  overflow-x: auto;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
}
.step-note {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin: 0;
}
.survey-error { color: var(--status-critical); }
.survey-time { color: var(--text-muted); font-size: 11px; }
/* версия агента sInformer (дотягивается фоном в списке и карточке) */
.agent-ver-err { color: var(--text-muted); }

/* итог действия со службой — сообщением прямо в строке сервера */
.row-msg {
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
}
.row-msg.ok {
  background: rgba(12,163,12,0.10);
  border: 1px solid var(--status-good);
  color: var(--status-good);
}
.row-msg.err {
  background: rgba(208,59,59,0.10);
  border: 1px solid var(--status-critical);
  color: var(--status-critical);
}

/* общее количество лицензий сервера (сумма «Количество пользователей») */
.lic-total { margin-top: 8px; font-weight: 600; font-size: 12px; }

/* текст файла программной лицензии (Linux /var/1C/licenses,
   Windows C:\ProgramData\1C\licenses) — как есть */
.lic-text {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* установленные службы 1С в карточке сервера */
.svc-table td { vertical-align: top; }
.svc-sub { color: var(--text-secondary); font-size: 11.5px; margin-top: 2px; }
.svc-ok { color: #2e7d32; font-weight: 600; }
.svc-lic { color: #2e7d32; }
.svc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.svc-actions form { margin: 0; }
/* кнопки-иконки старт/стоп службы (подсказка — в title) */
.btn-icon { gap: 5px; }
.btn-icon .icon-label { font-weight: 500; }
.btn-icon.icon-start { background: #2e7d32; }
.btn-icon.icon-stop { background: #c62828; }
.btn-icon.icon-delete { background: #8e2424; }
/* статус фоновой загрузки блока служб в карточке */
.svc-wait { display: flex; align-items: center; gap: 10px; }
.spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.svc-recreate { display: flex; gap: 6px; align-items: center; }

/* консоль установки/удаления (потоковый вывод, как командная строка) */
.console {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 4px;
  height: 460px;
  overflow-y: auto;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #d7d7d2;
}
.console .cline { white-space: pre-wrap; word-break: break-word; }
.console .c-head   { color: #6f9bd6; font-weight: 600; }
.console .c-step   { color: #f0f0ea; font-weight: 600; }
.console .c-where  { color: #898781; }
.console .c-cmd    { color: #c3c2b7; }
.console .c-note   { color: #7c8a6a; }
.console .c-prompt { color: #6fd67a; }
.console .c-out    { color: #d7d7d2; }
.console .c-ok     { color: #4fd06a; font-weight: 600; }
.console .c-err    { color: #e66767; font-weight: 600; }

/* модальное окно «Сканирование» — действия и результаты опроса сервера */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--modal-surface);
  border: 1px solid var(--modal-ring);
  border-radius: 10px;
  width: 640px;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--modal-ring);
}
/* Высококонтрастные схемы Windows: цвета переопределяются системой —
   гарантируем видимую рамку окна системным цветом. */
@media (forced-colors: active) {
  .modal { border: 2px solid CanvasText; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}
.modal-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
/* Имя сервера в заголовке окна — всегда крупнее и в акцентном цвете. */
.modal-head .srv-name { font-size: 1.25em; font-weight: 700; color: var(--accent); }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 6px;
}
.modal-close:hover { color: var(--text-primary); background: var(--page-plane); }
.modal .console {
  margin: 0 16px 16px;
  height: auto;
  min-height: 140px;
  max-height: 55vh;
}
.modal .scan-wait { display: flex; align-items: center; gap: 10px; }
/* окно-форма («Создать агента») */
.modal-body { padding: 0 16px 16px; overflow-y: auto; }
.modal-body .field input[type="text"],
.modal-body .field input[type="password"] { max-width: none; }
/* Поля ввода в окнах запроса: рамка подсвечена всегда (даже без фокуса),
   при выборе — ярче, со свечением. */
.modal-body .field input[type="text"],
.modal-body .field input[type="password"],
.modal-body .field .select {
  border-color: var(--accent);
}
.modal-body .field input[type="text"]:focus,
.modal-body .field input[type="password"]:focus,
.modal-body .field .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
/* окно подтверждения (вместо системного confirm) */
.modal-confirm { width: 480px; }
.confirm-text {
  padding: 2px 16px 0;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-line;
}
.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px;
}
.btn.danger { background: #c62828; }

/* служебные сообщения */
.notice {
  background: rgba(12,163,12,0.10);
  border: 1px solid var(--status-good);
  color: var(--status-good);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}
.notice.error {
  background: rgba(208,59,59,0.10);
  border-color: var(--status-critical);
  color: var(--status-critical);
}

footer {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 24px 0;
}

/* ==========================================================================
   ЗОНИРОВАНИЕ И СПИСКИ (классика Кит) — добавлено 2026-08-21
   Зоны обведены яркой рамкой со скруглением, у каждой — свой тусклый цветной
   фон-тинт (эталон .modal-section + .sect-* из buh/static/style.css).
   ========================================================================== */

/* Шапка страницы: заголовок + кнопка действия */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; font-weight: 600; margin: 0; }

/* Кнопки-варианты, которых не было */
.btn.primary { background: var(--accent); color: #fff; border: none; }
.btn.ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
}
.btn.ghost:hover { color: var(--text-primary); border-color: var(--accent); }

/* --- Обрамлённая зона с цветным тинтом --- */
.modal-section {
  border: 1.5px solid var(--sect-border, rgba(42,120,214,.7));
  border-radius: 12px;
  background: var(--sect-bg, rgba(42,120,214,.06));
  padding: 14px 16px;
  margin-bottom: 18px;
}
.modal-section:last-child { margin-bottom: 0; }
.modal-section > .modal-section-head {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--sect-border);
  margin: 0 0 10px;
}
/* Яркие рамки + разные тусклые цветные фоны (правило владельца 2026-08-13) */
.modal-section.sect-blue  { --sect-border: rgba(42,120,214,.70); --sect-bg: rgba(42,120,214,.055); }
.modal-section.sect-green { --sect-border: rgba(25,135,84,.72);  --sect-bg: rgba(25,135,84,.06); }
.modal-section.sect-amber { --sect-border: rgba(214,151,28,.85); --sect-bg: rgba(237,161,0,.09); }
.modal-section.sect-slate { --sect-border: rgba(90,110,140,.78); --sect-bg: rgba(109,127,150,.07); }
[data-bs-theme="dark"] .modal-section.sect-blue  { --sect-border: rgba(90,150,255,.75); --sect-bg: rgba(42,120,214,.14); }
[data-bs-theme="dark"] .modal-section.sect-green { --sect-border: rgba(80,210,150,.70); --sect-bg: rgba(25,135,84,.16); }
[data-bs-theme="dark"] .modal-section.sect-amber { --sect-border: rgba(255,205,90,.75); --sect-bg: rgba(237,161,0,.13); }
[data-bs-theme="dark"] .modal-section.sect-slate { --sect-border: rgba(170,190,215,.70); --sect-bg: rgba(109,127,150,.16); }

/* --- Панель фильтра/поиска --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.filter-bar select,
.filter-bar input[type="text"] {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--sect-border, var(--border));
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.filter-sep { flex: 1 1 12px; }

/* --- Классический поиск «Стиль Кит» --- */
.filter-label {
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.filter-label.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.filter-count { font-size: 12.5px; color: var(--text-muted); min-width: 60px; }

/* --- Зона таблицы --- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--gridline);
}
.data-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--gridline);
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover td { background: rgba(42,120,214,.06); }
.data-table .num-col { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table .nowrap { white-space: nowrap; }
.empty-row { color: var(--text-muted); text-align: center; padding: 22px 10px !important; cursor: default; }
/* подсветка/курсор поиска */
.data-table tbody tr.match td { background: rgba(237,161,0,.18); }
.data-table tbody tr.cursor td { box-shadow: inset 3px 0 0 var(--accent); }
.data-table tbody tr.match.cursor td { background: rgba(237,161,0,.28); }
tr.hidden { display: none; }

/* --- Бейджи статуса --- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.badge-blue   { color: var(--slot-blue);   border-color: var(--slot-blue);   background: rgba(42,120,214,.10); }
.badge-yellow { color: var(--slot-yellow); border-color: var(--slot-yellow); background: rgba(237,161,0,.12); }
.badge-green  { color: var(--slot-green);  border-color: var(--slot-green);  background: rgba(0,131,0,.10); }

/* --- Оверлей модалки списка --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay .modal {
  background: var(--modal-surface);
  border: 1px solid var(--modal-ring);
  border-radius: 12px;
  min-width: 420px; max-width: 92vw;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.dev-note { color: var(--text-muted); font-style: italic; padding: 8px 0; }

/* --- Поля форм: select, число, текст-значение (подписи слева, правило Кит) --- */
.field select,
.field input[type="number"] {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.field select:focus,
.field input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field-text { color: var(--text-primary); font-weight: 500; }
.settings-wrap { max-width: 640px; }

/* ==========================================================================
   Вход: выбор пользователя, админ-раздел, карточка наряда, согласование
   (добавлено 2026-08-21)
   ========================================================================== */

/* Вход */
.login-wrap { display: flex; justify-content: center; padding: 40px 0; }
.login-box {
  background: var(--surface-1);
  border: 1.5px solid rgba(42,120,214,.5);
  border-radius: 12px;
  padding: 26px 28px;
  width: 420px;
  max-width: 100%;
}
.login-title { margin: 0 0 18px; font-size: 20px; }
.login-title small { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.login-form .field input[type="password"],
.login-form .field .select,
.login-form .field select { width: 100%; max-width: none; }
.login-form select {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
}
.login-form select:focus { outline: none; border-color: var(--accent); }

/* Вкладки админ-раздела */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.admin-tabs a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.admin-tabs a:hover { color: var(--text-primary); border-color: var(--accent); }
.admin-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Формы в панелях: узкие текстовые поля */
.filter-bar input[type="text"],
.filter-bar input[type="date"] {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--sect-border, var(--border));
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  max-width: 220px;
}
.filter-bar input[type="date"] { max-width: 160px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.pwd-input { width: 130px; }
tr.naznach-closed td { color: var(--text-muted); }

/* Матрица прав должность×сущность */
.perm-table td.perm-cell { white-space: nowrap; }
.perm-flag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.perm-flag input { accent-color: var(--accent); }
.perm-table th.perm-ent { min-width: 130px; }

/* Карточка наряда */
.page-sub { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 22px;
}
.card-kv { font-size: 13.5px; }
.card-kv > span {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--text-muted);
}
.lines-table .descr-col { min-width: 260px; }
.line-date { color: var(--text-muted); font-size: 11.5px; }
.labor { color: var(--slot-aqua); }
td .labor { display: block; font-size: 12px; }
.raw-val { color: var(--status-serious); font-size: 12px; }
.total-row td { border-top: 2px solid var(--gridline); padding-top: 8px; }
.badge-red { color: var(--slot-red); border-color: var(--slot-red); background: rgba(227,73,72,.10); }
tr.step-current td { background: rgba(237,161,0,.12); }
.decide-bar { margin-top: 10px; }
.soglas-history { margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.row-open { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Мои настройки: две колонки на широком экране */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 0 18px;
  align-items: start;
}
.max-steps { margin: 8px 0; padding-left: 20px; }
.max-steps li { margin-bottom: 6px; }
.settings-form input[type="text"],
.settings-form input[type="password"] { flex: 1 1 auto; max-width: 320px; }

/* ==========================================================================
   АДАПТИВНОСТЬ (компьютер + телефон) — добавлено 2026-08-21
   ========================================================================== */
@media (max-width: 860px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 8px;
    row-gap: 4px;
  }
  .nav-links {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 10px; white-space: nowrap; }
  .topbar-user { gap: 8px; }
  .topbar-user .user-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main { padding: 16px 10px 48px; }
  .page-head { flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
  .page-head h1 { font-size: 18px; }
  .modal-section { padding: 10px 10px; border-radius: 10px; }

  /* Панели фильтров и форм — в столбик, поля на всю ширину */
  .filter-bar { gap: 8px; }
  .filter-bar label {
    flex: 1 1 100%;
    justify-content: space-between;
    white-space: normal;
  }
  .filter-bar select,
  .filter-bar input[type="text"],
  .filter-bar input[type="date"] { flex: 1 1 auto; min-width: 0; max-width: none; }
  .filter-sep { display: none; }

  /* Таблицы прокручиваются по горизонтали (данные не режем) */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { font-size: 12px; }
  .data-table tbody td, .data-table thead th { padding: 7px 6px; }
  .lines-table .descr-col { min-width: 200px; }

  /* Модалки — на весь экран */
  .modal-overlay { padding: 8px; align-items: flex-start; }
  .modal-overlay .modal { min-width: 0; width: 100%; max-height: 94vh; overflow-y: auto; }
  .modal-backdrop { padding: 8px; }
  .modal { width: 100%; max-height: 94vh; }

  .card-grid { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .login-wrap { padding: 12px 0; }
  .login-box { padding: 18px 14px; }
  footer { padding: 14px 0; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 14px; }
  .brand .app-version { display: none; }
  .inline-form { flex-wrap: wrap; }
}
.settings-form .field {
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-form .field label {
  min-width: 200px;
  margin-bottom: 0;
  white-space: nowrap;
}
.form-actions { margin-top: 8px; }
