: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;

  /* Фон зоны в рамке (.ornate): чуть ярче страницы, с холодным синим
     оттенком — обрамлённый блок читается как отдельное «окно». */
  --ornate-bg:      #eaf1fb;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --accent: #2a78d6;
  --accent-glow: rgba(42,120,214,0.35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --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;

    --ornate-bg:      #1d2636;

    --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; }
/* Ссылки — цвет акцента в обеих темах; посещённые не красим в системный
   фиолетовый (на тёмном фоне его не видно). :where — нулевая специфичность:
   любые классы (.btn, меню) перекрывают, а системный цвет браузера — нет. */
:where(a:link, a:visited) { color: var(--accent); }
:where(a:link:hover, a:visited:hover) { color: color-mix(in srgb, var(--accent) 75%, var(--text-primary)); }
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: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}
.brand {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}
.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;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  margin-left: 8px;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 11px;
  white-space: nowrap;
  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;
}
/* переключатель меню «Фаза 1 / Фаза 2» */
.phase-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.phase-switch a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 10px;
  white-space: nowrap;
}
.phase-switch a + a { border-left: 1px solid var(--border); }
.phase-switch a:hover { background: var(--page-plane); color: var(--text-primary); }
.phase-switch a.active { background: var(--accent); color: #fff; }
/* полоса «просмотр под пользователем» — заметная, жёлтая, под шапкой */
.imp-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 24px;
  background: rgba(230, 160, 20, 0.22);
  border-bottom: 2px solid #e0a010;
  color: var(--text-primary);
  font-size: 13.5px;
}
.imp-bar form { margin: 0; }
.imp-bar .btn { padding: 5px 14px; }
.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.topbar-user .user-name {
  white-space: nowrap;
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}
.topbar-user a.user-name:hover,
.topbar-user a.user-name.active { 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); }


.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; }

/* inline-выбор компании в таблице баз */
.select-company {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 220px;
}
.select-company:hover { border-color: var(--border); background: var(--page-plane); }
.select-company:focus { outline: none; border-color: var(--accent); background: var(--page-plane); }
td.company-saved { background: #d4edda !important; transition: background 0.8s; }

/* формы */
.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); }


/* блоки команд (предпросмотр установки) */
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); }


.svc-sub { color: var(--text-secondary); font-size: 11.5px; margin-top: 2px; }
/* индикатор загрузки при фоновых запросах к агентам */
.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); } }

/* модальное окно «Сканирование» — действия и результаты опроса сервера */
.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;
}

/* ==========================================================================
   Дизайн-система кабинета (стиль КИТ): значок, меню, вензеля, поиск,
   прилипание, статусы, карточки-метрики, SVG-графика.
   ========================================================================== */

/* Значок КИТ в шапке (static/img/kit.png — сине-серебристый кит) */
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand .brand-logo {
  height: 30px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

/* Выпадающая группа «Админ ▾» в меню (details/summary — без JS) */
details.nav-drop { position: relative; }
details.nav-drop > summary {
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  user-select: none;
}
details.nav-drop > summary::-webkit-details-marker { display: none; }
details.nav-drop > summary:hover { background: var(--page-plane); color: var(--text-primary); }
details.nav-drop[open] > summary,
details.nav-drop > summary.active { background: var(--accent); color: #fff; }
details.nav-drop .drop-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: var(--modal-surface);
  border: 1px solid var(--modal-ring);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
details.nav-drop .drop-menu a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 7px;
}
details.nav-drop .drop-menu a:hover { background: var(--page-plane); }
details.nav-drop .drop-menu a.active { background: var(--accent); color: #fff; }

/* Рамки с вензелями по углам: сине-серебристый росчерк (перекликается с
   изгибом кита в логотипе), читается и в светлой, и в тёмной теме.
   Обрамлённая зона подсвечена чуть более ярким синеватым фоном (--ornate-bg),
   а вензеля вынесены на саму рамку (отрицательный inset — росчерк ложится на
   линию границы блока, а не внутри окна). */
.ornate {
  position: relative;
  background: var(--ornate-bg);
}
.ornate::before {
  content: "";
  position: absolute;
  inset: -3px;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'><g fill='none' stroke='%236d8cb0' stroke-opacity='.55' stroke-linecap='round'><path stroke-width='1.6' d='M3 44V14Q3 3 14 3H44'/><path stroke-width='1.2' d='M14 3Q22 3 22 11Q22 17 16.5 17Q12.5 17 12.5 13.2Q12.5 10.4 15.2 10.4'/></g></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'><g transform='rotate(90 22 22)' fill='none' stroke='%236d8cb0' stroke-opacity='.55' stroke-linecap='round'><path stroke-width='1.6' d='M3 44V14Q3 3 14 3H44'/><path stroke-width='1.2' d='M14 3Q22 3 22 11Q22 17 16.5 17Q12.5 17 12.5 13.2Q12.5 10.4 15.2 10.4'/></g></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'><g transform='rotate(180 22 22)' fill='none' stroke='%236d8cb0' stroke-opacity='.55' stroke-linecap='round'><path stroke-width='1.6' d='M3 44V14Q3 3 14 3H44'/><path stroke-width='1.2' d='M14 3Q22 3 22 11Q22 17 16.5 17Q12.5 17 12.5 13.2Q12.5 10.4 15.2 10.4'/></g></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'><g transform='rotate(270 22 22)' fill='none' stroke='%236d8cb0' stroke-opacity='.55' stroke-linecap='round'><path stroke-width='1.6' d='M3 44V14Q3 3 14 3H44'/><path stroke-width='1.2' d='M14 3Q22 3 22 11Q22 17 16.5 17Q12.5 17 12.5 13.2Q12.5 10.4 15.2 10.4'/></g></svg>");
  background-repeat: no-repeat;
  background-size: 44px 44px;
  background-position: left top, right top, right bottom, left bottom;
}

/* Поиск «Стиль Кит»: слово-режим + поле + счётчик «N из ВСЕГО» */
.table-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.table-filter .filter-label {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}
.table-filter .filter-label:hover { color: var(--text-primary); border-color: var(--accent); }
.table-filter .filter-label.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.table-filter input[type="search"] {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 220px;
}
.table-filter input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.table-filter .filter-count {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 68px;
}
/* подсветка совпадения — тёплый жёлто-оранжевый полупрозрачный фон */
tbody tr.match td { background: rgba(237, 161, 0, 0.16); }
/* курсор — синий; курсор+совпадение — насыщеннее */
tbody tr.cursor td { background: rgba(42, 120, 214, 0.14); }
tbody tr.cursor.match td { background: rgba(42, 120, 214, 0.26); }

/* Прилипание: шапка таблицы держится под верхней панелью (56px) при
   прокрутке; панель действий над таблицей — тоже липкая. */
.sticky-table thead th {
  position: sticky;
  top: 56px;
  background: var(--surface-1);
  z-index: 5;
  box-shadow: 0 1px 0 var(--gridline);
}
.toolbar-sticky {
  position: sticky;
  top: 56px;
  z-index: 6;
  background: var(--page-plane);
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sticky-table.under-toolbar thead th { top: 104px; }
/* фильтр по значению колонки (правый клик по ячейке): строки вне фильтра
   скрыты, над таблицей — плашка «Компания: … ×» */
tbody tr.col-out { display: none; }
td.company-cell { cursor: context-menu; }
td.name-cell.can-imp { cursor: context-menu; }
.col-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(57, 135, 229, 0.12);
  font-size: 13px;
  white-space: nowrap;
}
.col-filter[hidden] { display: none; }
.col-filter-reset {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  padding: 0 6px;
  cursor: pointer;
  border-radius: 6px;
}
.col-filter-reset:hover { background: var(--page-plane); color: var(--text-primary); }

/* Пилюли статусов (бэкап свеж/устарел/ошибка/выключен, база работает…) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--status-good); background: rgba(12,163,12,0.12); }
.pill.warn { color: var(--status-warning); background: rgba(250,178,25,0.14); }
.pill.serious { color: var(--status-serious); background: rgba(236,131,90,0.14); }
.pill.crit { color: var(--status-critical); background: rgba(208,59,59,0.13); }
.pill.off { color: var(--text-muted); background: rgba(137,135,129,0.14); }

/* Порт кластера 1С рядом с именем сервера (нештатный кластер хоста) */
.cluster-port {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(42,120,214,0.13);
  white-space: nowrap;
}

/* Карточки-метрики: цветная рамка + подсветка фона (полос слева не делаем — правило владельца 21.10.26) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  --accent-c: var(--accent);
  background: color-mix(in srgb, var(--accent-c) 9%, var(--surface-1));
  border: 2px solid color-mix(in srgb, var(--accent-c) 70%, transparent);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat .stat-label {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat .stat-value {
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--accent-c);
}
.stat .stat-sub { color: var(--text-muted); font-size: 11.5px; }
.stat.green  { --accent-c: var(--status-good); }
.stat.amber  { --accent-c: var(--status-warning); }
.stat.red    { --accent-c: var(--status-critical); }
.stat.blue { --accent-c: var(--slot-blue); }
.stat .stat-chart { margin-top: 6px; }

/* Плавная смена значения при фоновом обновлении (KitCharts.counter) */
.kit-tick { animation: kit-tick 0.5s ease; }
@keyframes kit-tick {
  0% { color: var(--accent); transform: translateY(-2px); opacity: 0.4; }
  100% { transform: none; opacity: 1; }
}
/* пометка «данные на ЧЧ:ММ» при недоступном агенте + индикатор обновления */
.stale-note { color: var(--status-warning); font-size: 12px; }
.live-note { color: var(--text-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* Вкладки раздела (Счета / Платежи / Акты) */
.tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.tabs a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 7px;
}
.tabs a:hover { color: var(--text-primary); }
.tabs a.active { background: var(--accent); color: #fff; }

/* Заглушка «данные появятся после доработки X» */
.pending-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(250,178,25,0.10);
  border: 1px solid var(--status-warning);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.pending-note strong { color: var(--text-primary); }

/* Панель периода/фильтров над таблицей */
.period-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.period-form input[type="date"],
.period-form .select-inline {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
}
.period-form input[type="date"]:focus,
.period-form .select-inline:focus { outline: none; border-color: var(--accent); }
.field textarea.select { font-family: inherit; resize: vertical; }

/* Переписка по заявке */
.msg-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.msg {
  --msg-c: var(--accent);
  background: color-mix(in srgb, var(--msg-c) 8%, var(--page-plane));
  border: 1px solid color-mix(in srgb, var(--msg-c) 55%, transparent);
  border-radius: 10px;
  padding: 10px 14px;
}
.msg-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 4px; }
.msg-author { font-weight: 600; font-size: 12.5px; }
.msg-date { color: var(--text-muted); font-size: 11.5px; }
.msg-text { font-size: 13px; white-space: pre-line; }

/* Страница «Поддержка» */
.support-card { padding: 30px; }
.support-inner { display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap; }
.support-icon { flex: none; }
.support-text { flex: 1; min-width: 260px; }
.support-text h2 { margin-top: 0; }

/* Карточка-страница входа с лого */
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand img { height: 44px; }
.login-brand .login-title { font-size: 17px; font-weight: 650; }
.login-brand .login-sub { color: var(--text-muted); font-size: 12px; }

/* Карточка базы: крупное редактируемое название в блоке «Сведения» */
.base-name-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.base-name-big {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
}

/* --- Профиль: цветные зоны (стиль Кит) ------------------------------------
   Разные по смыслу секции на одном экране — свой яркий контур (2px) и
   заметный цветной тинт; в тёмной теме и то, и другое насыщеннее. */
.ornate.sect-blue,
.ornate.sect-green,
.ornate.sect-amber,
.ornate.sect-slate {
  border: 2px solid var(--sect-border);
  background: var(--sect-bg);
}
.ornate.sect-blue  { --sect-border: #2a78d6; --sect-bg: rgba(42,120,214,0.09); }
.ornate.sect-green { --sect-border: #1a9a5a; --sect-bg: rgba(26,154,90,0.10); }
.ornate.sect-amber { --sect-border: #e09a12; --sect-bg: rgba(237,161,0,0.11); }
.ornate.sect-slate { --sect-border: #6b7688; --sect-bg: rgba(107,118,136,0.10); }
@media (prefers-color-scheme: dark) {
  .ornate.sect-blue  { --sect-border: #4d95ec; --sect-bg: rgba(77,149,236,0.16); }
  .ornate.sect-green { --sect-border: #2fbf76; --sect-bg: rgba(47,191,118,0.16); }
  .ornate.sect-amber { --sect-border: #f0b23a; --sect-bg: rgba(240,178,58,0.16); }
  .ornate.sect-slate { --sect-border: #98a3b5; --sect-bg: rgba(152,163,181,0.16); }
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  align-items: start;
}
.profile-grid section { margin-bottom: 0; }
.profile-form { margin-top: 14px; }
.profile-sub { font-size: 13.5px; font-weight: 600; margin: 16px 0 2px; }
.profile-entities { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.profile-entities li { margin-bottom: 4px; }
.profile-entities .pill { margin-left: 6px; }

/* Подпись слева от поля, в одну строку (правило владельца) */
.field.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.field.field-row label {
  margin: 0;
  min-width: 140px;
  white-space: nowrap;
}
.field.field-row input[type="text"],
.field.field-row input[type="password"] { flex: 1; max-width: none; }

/* Реквизиты списком «подпись — значение» (карточка базы, заявки, профиль) */
dl.server-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0;
  font-size: 13px;
}
dl.server-meta > div { display: contents; }
dl.server-meta dt { color: var(--text-secondary); font-weight: 500; }
dl.server-meta dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }

/* ==========================================================================
   Фаза 2 — новое меню кабинета: сетка зон, реквизиты, графики, подсказки.
   ========================================================================== */
.p2-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.p2-switch label { font-size: 12.5px; color: var(--text-secondary); }
.p2-switch .select-inline { max-width: 360px; }
.p2-tabs { flex-wrap: wrap; }
.p2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}
.p2-grid section { margin-bottom: 0; }
.p2-grid .span2 { grid-column: 1 / -1; }
section.ornate.sect-red { --sect-border: #c9403f; --sect-bg: rgba(227,73,72,0.09); border: 2px solid var(--sect-border); background: var(--sect-bg); }
section.ornate.sect-violet { --sect-border: #5b4bc4; --sect-bg: rgba(74,58,167,0.09); border: 2px solid var(--sect-border); background: var(--sect-bg); }
@media (prefers-color-scheme: dark) {
  section.ornate.sect-red { --sect-border: #ef7a79; --sect-bg: rgba(230,103,103,0.16); }
  section.ornate.sect-violet { --sect-border: #a89cf0; --sect-bg: rgba(144,133,233,0.16); }
}
section h2 .count { font-weight: 500; color: var(--text-muted); font-size: 12.5px; margin-left: 6px; }
.sect-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sect-foot { margin-top: 12px; font-size: 12.5px; color: var(--text-secondary); }
/* Секрет (пароль портала): скрыт до нажатия «показать» */
.secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.06em; }
button.reveal {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-secondary); font-size: 11px; padding: 1px 8px; margin-left: 8px; cursor: pointer;
}
button.reveal:hover { color: var(--text-primary); border-color: var(--accent); }
/* Ссылки на базы: актуальные и доживающие */
.link-list { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.link-list li { margin-bottom: 2px; overflow-wrap: anywhere; }
.link-list a { color: var(--accent); text-decoration: none; }
.link-legacy a { color: var(--text-muted); text-decoration: line-through; }
.link-legacy .tag { color: var(--status-warning); }
.tag { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-left: 6px; }
/* Графики */
.chart-box { margin-top: 8px; }
.chart-box svg { display: block; }
.chart-switch { display: inline-flex; gap: 4px; background: var(--page-plane); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.chart-switch button { background: transparent; border: none; border-radius: 6px; padding: 4px 10px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.chart-switch button.active { background: var(--accent); color: #fff; }
.kit-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--modal-surface); border: 1px solid var(--modal-ring); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; color: var(--text-primary); box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.kit-tip[hidden] { display: none; }
/* Число «онлайн» с точкой */
.online-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--status-good); margin-right: 6px; box-shadow: 0 0 0 3px rgba(12,163,12,.18); }
/* Прогноз: строки-позиции */
table.compact td, table.compact th { padding: 6px 8px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 650; border-top: 2px solid var(--gridline); }
.warn-text { color: var(--status-serious); font-size: 12.5px; }
.good-text { color: var(--status-good); }
.muted { color: var(--text-muted); }
.note-inline { font-size: 12px; color: var(--text-secondary); margin: 6px 0 0; }
/* Формы обращений: подпись слева (правило владельца), textarea во всю ширину */
.req-form .field.field-row label { min-width: 130px; }
.req-form textarea.select { width: 100%; max-width: none; }
.req-form .field.field-row .select, .req-form .field.field-row input[type="number"],
.req-form .field.field-row input[type="date"] { flex: 1; max-width: none;
  background: var(--page-plane); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-primary); }
.req-form .checks { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.req-form .checks label { display: inline-flex; align-items: center; gap: 6px; }
.req-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 14px; align-items: start; }
.req-grid section { margin-bottom: 0; }
.req-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.req-card h3 { margin: 0 0 4px; font-size: 14px; }
.req-card p { margin: 0 0 10px; font-size: 12.5px; color: var(--text-secondary); }
.est-box { background: rgba(250,178,25,0.10); border: 1px solid var(--status-warning); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin: 8px 0; }
.est-box b { color: var(--text-primary); }
dl.server-meta.wide { grid-template-columns: max-content 1fr; }
.msg.mine { --msg-c: var(--status-good); }

/* --- Заявки ТП (раздел /tp) ---------------------------------------------- */
.tp-stats a.stat { text-decoration: none; color: inherit; cursor: pointer; }
.tp-stats a.stat:hover { border-color: var(--accent); }
.tp-toolbar-right { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
.tp-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
tr.tp-row.st-waiting td { background: rgba(236,131,90,0.08); }
tr.tp-row.st-resolved td { background: rgba(12,163,12,0.07); }
.tp-grid { display: grid; grid-template-columns: minmax(340px, 5fr) minmax(360px, 7fr); gap: 20px; align-items: start; }
.tp-grid .tp-col > section { margin-bottom: 20px; }
@media (max-width: 980px) { .tp-grid { grid-template-columns: 1fr; } }
.tp-body { font-size: 13.5px; line-height: 1.5; }
.tp-edit-btn { margin-left: 10px; vertical-align: middle; }
.tp-actions .tp-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-actions .form-actions { margin-top: 0; }
.tp-reply { margin-top: 14px; }
.tp-reply textarea.select { width: 100%; max-width: none; }
.tp-reply .form-actions { margin-top: 8px; display: flex; align-items: center; gap: 12px; }
.msg.staff { --msg-c: var(--slot-blue, #2a78d6); }
.msg.sys {
  background: color-mix(in srgb, var(--text-muted) 8%, transparent); border: none;
  border-radius: 6px; padding: 2px 12px; font-size: 12px; color: var(--text-muted);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.msg.sys .msg-text { font-size: 12px; white-space: normal; }
.msg.sys .msg-author { font-weight: 500; font-size: 12px; }
/* зоны внутри модалок заявки */
.modal .tp-zone { padding: 12px 14px 4px; margin-bottom: 14px; border-radius: 10px; }
.tp-zone-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-secondary); margin-bottom: 10px; }
.tp-form .field.field-row label { min-width: 120px; }
.tp-form .field.field-row input[type="text"] { flex: 1; max-width: none; }
.tp-members-grid { grid-template-columns: minmax(360px, 7fr) minmax(320px, 5fr); }
.tp-members-grid table td { vertical-align: top; }

/* --- 152-ФЗ: политика, согласие, владелец сайта, акт (lks 0.5.0) --- */
.footer-legal { margin-top: 6px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.footer-legal a { color: var(--text-muted); }
.site-owner {
  margin: 18px 0 0; max-width: 620px; font-size: 12px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 4px 14px;
}
.consent-chk { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 4px; cursor: pointer; }
.consent-chk input { margin-top: 3px; flex: none; }
.consent-note { margin: 0 0 8px; font-size: 12px; }
.legal-doc { max-width: 900px; }
.legal-doc h3 { font-size: 15px; margin: 14px 0 6px; }
.legal-doc li { margin: 3px 0; }
.pd-op th { text-align: left; white-space: nowrap; width: 1%; padding-right: 16px; }
.pd-missing { color: #c62828; font-weight: 600; }
@media print {
  .topbar, footer, .notice { display: none !important; }
  .pd-act .ornate { border: 1px solid #999 !important; background: none !important; }
}

/* кнопка в последней колонке таблицы */
td.actions { white-space: nowrap; text-align: right; }
td.actions form { margin: 0; display: inline; }
td.actions .btn-sm { padding: 1px 10px; font-size: 12px; line-height: 1.6; }

/* --- Создание баз 0.7.0: мастер, карточка задания, админ-страницы ---------- */
.modal.modal-wide { width: 760px; }
.nb-sect { padding: 10px 14px 4px; margin-bottom: 12px; }
.modal-section-head {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--sect-border, var(--text-muted)); margin-bottom: 8px;
}
.nb-hint { font-size: 12px; color: var(--text-muted); margin: -6px 0 10px; line-height: 1.4; }
.nb-hint-inline { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.nb-fixed { font-weight: 500; }
.nb-sect .field.field-row label { min-width: 170px; }
.nb-sect .field.field-row input[type="text"], .nb-sect .field.field-row .select { flex: 1; max-width: none; }
.nb-sect .field.field-row input[type="text"][hidden] { display: none; }
/* 0.8.0: кнопка в строке поля, сводка по кластеру / SQL-серверу под полем */
.nb-row-btn { margin-left: 8px; white-space: nowrap; padding: 3px 10px; font-size: 12px; }
.nb-stats {
  margin: -4px 0 10px 170px; padding: 6px 10px; font-size: 12.5px; line-height: 1.45;
  border: 1px dashed var(--sect-border, var(--border)); border-radius: 8px;
  background: rgba(255,255,255,0.35);
}
@media (prefers-color-scheme: dark) { .nb-stats { background: rgba(0,0,0,0.18); } }
.nb-stats .spinner { width: 12px; height: 12px; vertical-align: middle; }
dl.nb-kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; }
dl.nb-kv > div { display: contents; }
dl.nb-kv dt { color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
dl.nb-kv dd { margin: 0; overflow-wrap: anywhere; }
.nb-dim { color: var(--text-muted); }
.nb-stats .pill { font-size: 11px; padding: 0 7px; }
@media (max-width: 640px) { .nb-stats { margin-left: 0; } }
.job-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.job-grid section { margin-bottom: 20px; }
@media (max-width: 860px) { .job-grid { grid-template-columns: 1fr; } }
.job-steps { list-style: none; margin: 0; padding: 0; }
.job-steps li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--gridline); font-size: 13px; }
.job-steps li:last-child { border-bottom: none; }
.job-steps .step-mark { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--text-muted); opacity: .45; align-self: center; }
.job-steps .step-done .step-mark { background: var(--status-good); opacity: 1; }
.job-steps .step-running .step-mark { background: var(--status-warning); opacity: 1; animation: nb-blink 1s infinite alternate; }
.job-steps .step-failed .step-mark { background: var(--status-critical); opacity: 1; }
.job-steps .step-failed { color: var(--status-critical); }
@keyframes nb-blink { from { opacity: .35; } to { opacity: 1; } }
/* 0.9.4: прогресс задания — общий бар этапов и бар текущего этапа */
.job-total { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.job-total .job-bar { flex: 1; }
.job-steps .step-body { flex: 1; min-width: 0; }
.job-step-bar { margin-top: 6px; }
.job-step-bar .nb-hint-inline { display: block; margin-top: 3px; }
.job-bar { height: 8px; border-radius: 4px; overflow: hidden; background: var(--gridline); }
.job-bar > i { display: block; height: 100%; width: 0; background: var(--status-warning); }
.job-bar > i.good { background: var(--status-good); }
.job-bar > i.bad { background: var(--status-critical); }
.job-bar.indet > i {
  background: repeating-linear-gradient(-45deg, var(--status-warning) 0 10px, transparent 10px 20px);
  background-size: 28px 28px; animation: job-indet 1s linear infinite; opacity: .8;
}
.job-otp { margin-top: 14px; padding: 12px 14px; border: 2px solid var(--status-warning); border-radius: 8px;
  background: color-mix(in srgb, var(--status-warning) 12%, transparent); }
.job-otp .field { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.job-otp .field label { white-space: nowrap; }
.job-otp .field .input { flex: 1; max-width: 180px; font-family: ui-monospace, Consolas, monospace; letter-spacing: 2px; }
/* «Загрузить из .dt» в карточке базы (0.9.7): опасное действие — красная зона */
details.dt-restore { display: inline-block; vertical-align: top; }
details.dt-restore > summary { list-style: none; }
details.dt-restore > summary::-webkit-details-marker { display: none; }
details.dt-restore[open] { display: block; margin-top: 10px; }
details.dt-restore form { margin-top: 10px; padding: 12px 14px; border: 2px solid var(--status-critical); border-radius: 8px;
  background: color-mix(in srgb, var(--status-critical) 10%, transparent); }
details.dt-restore .field { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
details.dt-restore .field label { white-space: nowrap; min-width: 130px; margin: 0; }
details.dt-restore .field input { flex: 1; max-width: 520px; }
@keyframes job-indet { from { background-position: 0 0; } to { background-position: 28px 0; } }
.job-log {
  margin: 0; padding: 10px 12px; max-height: 50vh; overflow: auto; white-space: pre-wrap;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; line-height: 1.45;
  background: var(--page-plane); border-radius: 8px; border: 1px solid var(--gridline);
}
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; }
.input-sm { width: 110px; font-size: 12px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text-primary); }
.danger-text { color: var(--status-critical); }
a.pill { text-decoration: none; margin-left: 6px; vertical-align: middle; }
/* Атрибут hidden сильнее любых display у блоков (flex-строки полей, индикаторы). */
[hidden] { display: none !important; }

/* --- Модули 0.10.0: зоны модулей внутри страниц и модалок ------------------
   .modal-section — обрамлённая зона (стиль Кит) для страниц модулей (docs/MODULES.md:
   модуль использует .modal-section.sect-*, как в buh/ubz) и для секций модалок:
   яркая обводка 2px + заметный тинт, в тёмной теме насыщеннее. */
.modal-section {
  border: 2px solid var(--sect-border, var(--border));
  background: var(--sect-bg, var(--ornate-bg));
  border-radius: 10px;
  padding: 12px 14px 10px;
  margin-bottom: 14px;
}
.modal-section.sect-blue  { --sect-border: #2a78d6; --sect-bg: rgba(42,120,214,0.09); }
.modal-section.sect-green { --sect-border: #1a9a5a; --sect-bg: rgba(26,154,90,0.10); }
.modal-section.sect-amber { --sect-border: #e09a12; --sect-bg: rgba(237,161,0,0.11); }
.modal-section.sect-slate { --sect-border: #6b7688; --sect-bg: rgba(107,118,136,0.10); }
@media (prefers-color-scheme: dark) {
  .modal-section.sect-blue  { --sect-border: #4d95ec; --sect-bg: rgba(77,149,236,0.16); }
  .modal-section.sect-green { --sect-border: #2fbf76; --sect-bg: rgba(47,191,118,0.16); }
  .modal-section.sect-amber { --sect-border: #f0b23a; --sect-bg: rgba(240,178,58,0.16); }
  .modal-section.sect-slate { --sect-border: #98a3b5; --sect-bg: rgba(152,163,181,0.16); }
}
.modal-section .field:last-child { margin-bottom: 4px; }
.mod-card .modal-section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; text-transform: none; letter-spacing: 0; }
.mod-card .mod-ver { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.mod-card dl.server-meta { margin-top: 8px; }
.mod-card .mod-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mod-card .mod-actions .btn + .btn { margin-left: 0; }
.mod-bases-pick { flex-direction: column; gap: 6px; }
.mod-bases-pick label { font-weight: 400; }
/* host_api 1.1: настройки и задачи подключения в карточке модуля */
.mod-card .mod-conf-item { white-space: nowrap; }
.mod-card .mod-task { margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mod-card .mod-task .svc-sub { flex-basis: 100%; }
.tick-state { display: inline-flex; align-items: center; gap: 6px; }
/* Страница модуля: селекты и кнопки модуля наследуют поля кабинета */
.po-fields .select { min-width: 200px; }

/* Реестр и подключения модулей: действия остаются внутри своей зоны. */
.modules-layout { min-width: 0; max-width: 100%; }
.modules-layout section { min-width: 0; scroll-margin-top: 24px; }
.modules-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.modules-heading > div:first-child { flex: 1 1 260px; min-width: 0; }
.modules-heading h1 { margin: 0 0 6px; font-size: 22px; }
.modules-heading .subtitle { margin: 0; color: var(--text-secondary); }
.modules-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.modules-actions form { margin: 0; max-width: 100%; }
.modules-layout .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; justify-content: center; }
.modules-layout .cell-nolink { white-space: normal; }
.modules-layout .cell-nolink .btn { margin: 0 0 4px; }
.modules-layout .tick-state { flex-wrap: wrap; }
.modules-layout .modal-section-head { line-height: 1.5; }
.modules-help { margin: 16px 0; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.modules-help summary, .modules-details summary { cursor: pointer; color: var(--accent); }
.modules-help p { margin: 10px 0; max-width: 80ch; line-height: 1.6; }
.modules-warning { padding: 10px 14px; border: 2px solid #e09a12; background: rgba(237,161,0,.12); border-radius: 8px; overflow-wrap: anywhere; }
.modules-jump { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0; }
.modules-jump a { color: var(--accent); font-size: 13px; padding: 5px 0; }
.modules-table-wrap { width: 100%; max-width: 100%; overflow: auto; overscroll-behavior-x: contain; }
.modules-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.modules-table-wrap table { table-layout: fixed; min-width: 760px; }
.modules-table-wrap th, .modules-table-wrap td { overflow-wrap: anywhere; }
.modules-table-wrap td { line-height: 1.5; }
#modules-table th:first-child { width: 34%; }
#modules-table th:nth-child(2) { width: 19%; }
#modules-table th:nth-child(3) { width: 18%; }
#modules-table th:nth-child(4) { width: 12%; }
#modules-table th:last-child { width: 17%; }
.modules-details { margin-top: 8px; font-size: 12px; }
.modules-log { max-height: 480px; }
.modules-log thead th { position: sticky; top: 0; background: var(--surface-1); z-index: 1; padding-top: 8px; }
.modules-client .p2-header > div, .modules-client .p2-switch { min-width: 0; max-width: 100%; }
.modules-client .p2-switch { flex-wrap: wrap; }
.modules-client .p2-switch select { min-width: 0; max-width: 100%; flex: 1; }
.modules-client .server-meta > div, .modules-client .server-meta dd { min-width: 0; overflow-wrap: anywhere; }
.modules-client .mod-conf-item { white-space: normal; }
.modules-client .mod-actions > * { max-width: 100%; }
@media (max-width: 640px) {
  .modules-layout section { padding: 14px 10px; }
  .modules-heading .modules-actions { width: 100%; }
  .modules-client .p2-header { flex-wrap: wrap; }
}

/* --- Журналы 1С (0.11.0): переключатель периода, плашка обслуживания, SQL-снимок --- */
/* Администрирование пользователей: сводка, явные фильтры и компактные записи. */
.users-admin { min-width: 0; max-width: 100%; }
.users-admin .page-header { margin-bottom: 20px; }
.users-admin .page-header h1 { font-size: 22px; margin: 0 0 6px; }
.users-admin .page-header .subtitle { color: var(--text-secondary); margin: 0; }
.users-admin section { min-width: 0; }
.users-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin: 16px 0 0; }
.users-stats > div { border-left: 3px solid var(--sect-border); padding-left: 12px; }
.users-stats dt { color: var(--text-secondary); font-size: 12px; }
.users-stats dd { margin: 4px 0 0; font-size: 26px; font-weight: 650; line-height: 1.2; }
.users-stats .users-needs-attention { border-color: #e09a12; }
.users-section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.users-hint { color: var(--text-secondary); font-size: 12px; }
.users-toolbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-bottom: 18px; }
.users-toolbar .table-filter { flex: 1 1 100%; margin: 0; min-width: 0; }
.users-toolbar .table-filter input[type="search"] { min-width: 0; flex: 1; width: auto; max-width: 500px; }
.users-filter-field { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 280px; }
.users-filter-field label { white-space: nowrap; color: var(--text-secondary); font-size: 12px; }
.users-filter-field select { flex: 1; min-width: 0; width: 100%; max-width: 100%; }
.users-table-wrap { width: 100%; max-width: 100%; overflow: auto; max-height: 65vh; overscroll-behavior-x: contain; }
.users-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#users-table { table-layout: fixed; min-width: 720px; }
#users-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-1); padding-top: 10px; }
#users-table th:nth-child(1) { width: 29%; }
#users-table th:nth-child(2) { width: 28%; }
#users-table th:nth-child(3) { width: 21%; }
#users-table th:nth-child(4) { width: 22%; }
#users-table td { padding-top: 13px; padding-bottom: 13px; overflow-wrap: anywhere; vertical-align: middle; }
.users-name { display: block; font-size: 13px; }
.users-account { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.users-roles { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.users-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.users-row-actions form { margin: 0; }
.users-row-actions .btn { white-space: normal; max-width: 100%; justify-content: center; margin: 0; }
.users-help summary { color: var(--text-primary); cursor: pointer; font-weight: 600; }
.users-help p { max-width: 80ch; margin: 12px 0 0; color: var(--text-secondary); font-size: 13px; }
.users-admin .modal .field-row { display: flex; align-items: center; gap: 12px; }
.users-admin .modal .field-row label { margin: 0; white-space: nowrap; flex: 0 0 auto; }
.users-admin .modal .field-row select { flex: 1; min-width: 0; }
.users-admin .modal .form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 800px) {
  .users-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .users-admin section { padding: 14px 12px; }
  .users-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-toolbar .table-filter { flex-wrap: wrap; gap: 8px; }
  .users-toolbar .table-filter input[type="search"] { flex-basis: 160px; }
}

.seg-switch {
  display: inline-flex; margin-left: 10px; vertical-align: middle;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  font-size: 12px; font-weight: 500;
}
.seg-switch a { padding: 2px 10px; color: var(--text-secondary); text-decoration: none; }
.seg-switch a + a { border-left: 1px solid var(--border); }
.seg-switch a.active { background: var(--accent); color: #fff; }
.maint-note {
  display: inline-block; margin-top: 4px; padding: 2px 8px;
  font-size: 12px; border: 1px solid; border-radius: 6px;
}
.maint-note.warn { color: var(--status-warning); border-color: var(--status-warning);
  background: color-mix(in srgb, var(--status-warning) 12%, transparent); }
.maint-note.crit { color: var(--status-critical); border-color: var(--status-critical);
  background: color-mix(in srgb, var(--status-critical) 12%, transparent); }
.maint-note.ok { color: var(--text-secondary); border-color: color-mix(in srgb, var(--status-good) 45%, transparent);
  background: color-mix(in srgb, var(--status-good) 8%, transparent); }
.maint-note.big { display: block; margin: 0 0 16px; padding: 10px 14px; font-size: 13.5px; border-width: 2px; }
.sql-snap summary { cursor: pointer; font-size: 11.5px; color: var(--text-secondary); }
.sql-snap pre { max-height: 240px; overflow: auto; white-space: pre-wrap; font-size: 11.5px; margin: 4px 0 0; }

/* --- Раздел «Сделки» (0.12.0): цепочка стадий кружками -------------------- */
.chain { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid; vertical-align: middle; box-sizing: border-box; }
.dot.ok   { background: var(--status-good); border-color: var(--status-good); }
.dot.todo { background: color-mix(in srgb, var(--status-warning) 70%, transparent); border-color: var(--status-warning); }
.dot.bad  { background: var(--status-critical); border-color: var(--status-critical); }
.dot.none { background: transparent; border-color: var(--text-muted); }
.chain.big { gap: 6px; font-size: 12.5px; }
.chain-step { display: inline-flex; align-items: center; gap: 5px; }
.chain-arrow { color: var(--text-muted); }
.chain-tips { margin: 4px 0 12px; padding-left: 18px; font-size: 12px; color: var(--text-secondary); }
.le-tabs { margin-bottom: 6px; }
.deals-staff { margin-bottom: 12px; gap: 8px; }
.qty-input { width: 72px; text-align: right; }
.chain { flex-wrap: nowrap; }
/* Поля формы заказа: подпись слева в одну строку (UI п.6) */
.field.inline { display: flex; align-items: center; gap: 12px; }
.field.inline label { margin: 0; min-width: 200px; white-space: nowrap; }
.field.inline select, .field.inline textarea { flex: 1; max-width: 640px; }
.field.inline textarea { min-height: 64px; }
