: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);
}
@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;

    --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;
  align-items: center;
  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;
}
.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;
}

/* ======================= УБЗ: лендинг с миксером ======================= */
.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero h1 {
  font-size: 30px;
  font-weight: 700;
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
}
.hero h1 .b-1 { color: var(--accent); }
.hero h1 .b-2 { color: var(--slot-yellow); }
.hero p.lead {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 26px;
  max-width: 560px;
}
.hero .cta { margin-top: 6px; }
.hero .btn.big { padding: 12px 24px; font-size: 15px; }

/* Автобетоносмеситель (миксер) — inline SVG. Барабан и колёса крутятся. */
.mixer-wrap {
  width: min(520px, 92vw);
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.18));
}
.mixer-wrap svg { width: 100%; height: auto; display: block; }
/* Барабан виден сбоку — вращение вокруг длинной оси читается как «бег»
   спиральных рёбер вдоль барабана. Рёбра-полосы обрезаны силуэтом барабана и
   сдвигаются на один шаг (30px) по кругу — бесшовный цикл. */
.mixer .ribs { animation: drum-mix 1.8s linear infinite; }
.mixer .wheel { transform-box: fill-box; transform-origin: center; animation: wheel-spin 11s linear infinite; }
@keyframes drum-mix { to { transform: translateX(-32px); } }
/* Машина «едет» влево → колёса крутятся против часовой (rotate отрицательный). */
@keyframes wheel-spin { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) {
  .mixer .ribs, .mixer .wheel { animation: none; }
}

/* ======================= Поиск по таблице (Стиль Кит) ======================= */
.table-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.filter-label {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.filter-label.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-filter input[type="text"] {
  flex: 1;
  max-width: 420px;
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
}
.table-filter input[type="text"]:focus { outline: none; border-color: var(--accent); }
.filter-count { color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ======================= Форма периода ======================= */
.period-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.period-form .field { margin-bottom: 0; }
.period-form .field.row { display: flex; align-items: center; gap: 10px; }
.period-form .field.row label { margin-bottom: 0; white-space: nowrap; min-width: 42px; }
.period-form input[type="date"] {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
}
.period-form input[type="date"]:focus { outline: none; border-color: var(--accent); }

/* ======================= Зонирование секций (стиль Кит) =======================
   Каждая логическая зона — отдельная секция с ЯРКОЙ обводкой и подсвеченным
   цветным фоном-тинтом (правило владельца). Цвет зоны задаётся классом
   sect-blue/green/amber/slate. Обе темы. */
.modal-section {
  position: relative;
  border: 2px solid var(--sect-border);
  background: var(--sect-bg);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.modal-section-head {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sect-border);
  margin: -2px 0 12px;
}
.sect-blue  { --sect-border: #2a78d6; --sect-bg: rgba(42,120,214,0.07); }
.sect-green { --sect-border: #1baf7a; --sect-bg: rgba(27,175,122,0.08); }
.sect-amber { --sect-border: #eda100; --sect-bg: rgba(237,161,0,0.09); }
.sect-slate { --sect-border: #64748b; --sect-bg: rgba(100,116,139,0.09); }
@media (prefers-color-scheme: dark) {
  .sect-blue  { --sect-border: #4c94ec; --sect-bg: rgba(57,135,229,0.14); }
  .sect-green { --sect-border: #24c98d; --sect-bg: rgba(27,175,122,0.16); }
  .sect-amber { --sect-border: #f0b52e; --sect-bg: rgba(237,161,0,0.16); }
  .sect-slate { --sect-border: #93a2b6; --sect-bg: rgba(148,163,184,0.16); }
}

/* ======================= Прогресс-бар построения ======================= */
.build-progress { margin-top: 14px; }
.progress-track {
  height: 10px;
  background: rgba(0,0,0,0.10);
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #3987e5, #1baf7a);
  transition: width 0.35s ease;
}
.progress-step { margin-top: 7px; font-size: 12.5px; color: var(--text-secondary); }

/* ======================= Отчёт «Зарплата» (расцветка как в 1С) =======================
   Широкий отчёт (17 колонок): раздвигаем страницу, прокрутка по горизонтали —
   на уровне страницы (чтобы липкие заголовки работали). */
main.report-wide { max-width: 1640px; }
.table-scroll { overflow: visible; }
.report-meta { color: var(--text-secondary); font-size: 12.5px; margin: 0 0 14px; }

.salary-table {
  font-size: 12px;
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  background: #fff;
}
.salary-table th, .salary-table td {
  padding: 4px 8px;
  border: 1px solid #d6dce5;
  white-space: nowrap;
}
.salary-table td.r, .salary-table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.salary-table td { color: #1f2430; background: #fff; }
/* Узкие текстовые колонки: обрезка с многоточием, полный текст — в tooltip (title) */
.salary-table td.c-client { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.salary-table td.c-nom    { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.salary-table td.c-wh     { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* Липкие заголовки (две строки шапки: группы + подписи) */
.salary-table thead th {
  position: sticky;
  z-index: 3;
  background: #4472c4;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  border-color: #2f5597;
  text-align: left;
  vertical-align: middle;
}
.salary-table thead th.r { text-align: right; }
.salary-table thead th.grp { text-align: center; font-size: 11.5px; }
.salary-table thead tr.hdr-grp th { top: 56px; }
.salary-table thead tr.hdr-sub th { top: 82px; }

/* Строка-заголовок группы менеджера (с итогами, синим — как в 1С) */
tr.mgr-head td {
  background: #dbe4f3;
  color: #1f4e79;
  font-weight: 700;
  border-top: 2px solid #4472c4;
  border-bottom: 1px solid #b7c6e0;
  cursor: pointer;
}
tr.mgr-head td:first-child { font-size: 13px; }
/* Общий итог */
tr.grand-total td {
  background: #c6d4ec;
  color: #14375e;
  font-weight: 700;
  border-top: 2px solid #2f5597;
}
td.prem { font-weight: 700; color: #1f4e79; }
tr.detail td.prem { color: #14603f; }
.salary-table .neg { color: #c0392b; }

/* Поиск: подсветка/фильтр/курсор */
tr.detail.hidden { display: none; }
tr.detail.match td { background: #fdeecb; }
tr.detail.cursor td { background: #d7e6fb; }
tr.detail.cursor.match td { background: #f6e0a3; }
.group-collapsed tr.detail { display: none; }

/* ======================= Выбор менеджеров (настройки) ======================= */
.mgr-list {
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid var(--sect-border, var(--border));
  border-radius: 8px;
  padding: 8px;
  columns: 2;
  column-gap: 18px;
}
.mgr-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  font-size: 13px;
  break-inside: avoid;
  cursor: pointer;
}
.mgr-item:hover { background: rgba(0,0,0,0.04); border-radius: 6px; }

/* ======================= Выпадающее меню «Отчёты» ======================= */
.nav-dd { position: relative; display: inline-flex; align-items: center; }
/* Кнопка-дропдаун выглядит ТОЧНО как обычный пункт меню (.nav-links a) */
.nav-dd > .nav-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.nav-dd:hover > .nav-dd-btn { background: var(--page-plane); color: var(--text-primary); }
.nav-dd.open > .nav-dd-btn, .nav-dd > .nav-dd-btn.active { background: var(--accent); color: #fff; }
.nav-dd-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  padding: 6px;
  display: none;
  z-index: 20;
}
.nav-dd:hover .nav-dd-menu, .nav-dd.open .nav-dd-menu { display: block; }
.nav-dd-menu a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 6px;
}
.nav-dd-menu a:hover { background: var(--page-plane); color: var(--text-primary); }
.nav-dd-menu a.active { color: var(--accent); font-weight: 600; }

/* ======================= Адаптив под телефон ======================= */
@media (max-width: 760px) {
  main, main.report-wide { padding: 18px 12px 48px; max-width: 100%; }
  .topbar-inner { height: auto; min-height: 52px; padding: 6px 12px; gap: 10px 14px; flex-wrap: wrap; }
  .topbar-user { margin-left: auto; }
  .nav-links { order: 3; width: 100%; margin: 2px 0 4px; }
  header.page-header h1 { font-size: 19px; }
  .period-form { gap: 10px; }
  .period-form .field.row { width: 100%; }
  .period-form .field.row label { flex: 0 0 auto; }
  .period-form input[type="date"] { flex: 1; width: 100%; min-width: 0; }
  .form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .modal-section { overflow-wrap: anywhere; }

  /* Отчёт → карточки: каждая строка-позиция становится карточкой label:value */
  .salary-table, .salary-table tbody, .salary-table tr, .salary-table td { display: block; }
  .salary-table { width: 100%; min-width: 0; max-width: 100%; }
  .table-scroll { max-width: 100%; }
  .salary-table thead { display: none; }   /* шапку прячем — в карточках подписи в ячейках */

  tr.detail {
    border: 1px solid #d6dce5;
    border-radius: 10px;
    background: #fff;
    padding: 6px 10px;
    margin: 0 0 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  /* Ячейка карточки: подпись слева (float), значение справа с переносом */
  tr.detail td, tr.mgr-head td, tr.grand-total td {
    display: flow-root;
    padding: 3px 0;
    border: none;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
  }
  tr.detail td::before, tr.mgr-head td::before, tr.grand-total td::before {
    content: attr(data-label);
    float: left;
    margin-right: 14px;
    color: #6b7280;
    font-weight: 600;
    font-size: 11.5px;
  }
  tr.detail td:empty, tr.mgr-head td:empty, tr.grand-total td:empty { display: none; }
  /* В карточках текст не обрезаем — показываем полностью */
  .salary-table td.c-client, .salary-table td.c-nom, .salary-table td.c-wh {
    max-width: none; overflow: visible; text-overflow: clip;
  }
  tr.detail td.c-client { font-weight: 700; font-size: 13.5px; color: #14375e; }

  /* Заголовок группы менеджера и общий итог — цветной блок-карточка */
  tr.mgr-head, tr.grand-total { border-radius: 9px; padding: 8px 10px; margin: 16px 0 10px; }
  tr.mgr-head td { font-weight: 700; }
  tr.mgr-head td.mgr-name, tr.grand-total td.mgr-name {
    text-align: left; font-size: 15px; font-weight: 700; margin-bottom: 4px;
  }
  tr.mgr-head td.mgr-name::before, tr.grand-total td.mgr-name::before { content: ""; margin: 0; }

  .table-filter { flex-wrap: wrap; }
  .table-filter input[type="text"] { max-width: none; }
  .mgr-list { columns: 1; }
}

/* ======================= Администрирование ======================= */
.row-form { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.row-form .field.row { margin-bottom: 0; }
.row-form .field.row label { min-width: auto; }
.row-form input[type="text"] { max-width: 220px; }
.hint { color: var(--text-muted); font-size: 12px; }
.na { color: var(--text-muted); }
table .select, table input[type="text"] {
  padding: 5px 8px; font-size: 12.5px; width: 100%;
  background: var(--page-plane); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text-primary);
}
table .cell-nolink { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.btn.btn-sm.danger { background: #c62828; color: #fff; border: none; }
.perm-matrix th, .perm-matrix td { text-align: center; padding: 8px 12px; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; }
.perm-matrix input[type="checkbox"] { width: 18px; height: 18px; }
