/* noneERP — накладка поверх app.css. Правится только заменой файла целиком.
   Подключать после app.css:
     <link rel="stylesheet" href="/css/app.css">
     <link rel="stylesheet" href="/css/noneerp-theme.css">
   Публичные страницы — отдельный файл noneerp-theme-public.css (после public.css).
   Разметка и имена классов не меняются. Что требует новой разметки — списком в чате.

   ШКАЛЫ (три-четыре ступени, больше не вводим)
   радиус   6 / 8 / 12 / 999
   отступ   8 / 14 / 20 / 24
   контрол  32 / 38 / 44 (мобайл)
   тень     --shadow (плоское) / --shadow-lg (карта) / --shadow-pop (всплывает) */

:root {
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --gap-sm: 8px;
  --gap: 14px;
  --gap-lg: 20px;
  --gap-xl: 24px;
  --control-h-sm: 32px;
  --control-h: 38px;
  --shadow: 0 4px 18px rgba(75, 70, 92, .08);
  --shadow-lg: 0 4px 18px rgba(75, 70, 92, .1);
  --shadow-pop: 0 12px 40px rgba(15, 20, 34, .18);
  --shadow-modal: 0 24px 60px rgba(15, 20, 34, .3);
  --sidebar-w: 264px;
  --line: #f0eff4;
  --field: #fafafc;
  --tint: rgba(115, 103, 240, .06);
  --tint-strong: rgba(115, 103, 240, .12);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root[data-theme="dark"] {
  --line: #3a4060;
  --field: rgba(255, 255, 255, .03);
  --tint: rgba(115, 103, 240, .12);
  --tint-strong: rgba(115, 103, 240, .22);
  --shadow: 0 4px 18px rgba(15, 20, 34, .35);
  --shadow-lg: 0 4px 18px rgba(15, 20, 34, .4);
  --shadow-pop: 0 12px 40px rgba(15, 20, 34, .5);
  --shadow-modal: 0 24px 60px rgba(15, 20, 34, .6);
}

body { -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ═══ 1. Оболочка: меню, шапка ═════════════════════════════════ */

.sidebar { padding: 0; }
.sidebar .brand {
  height: 68px;
  box-sizing: border-box;
  padding: 0 var(--gap-lg);
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar nav { padding: 0 10px var(--gap-lg); overflow-y: auto; }
.sidebar nav a,
.sidebar .nav-group-toggle {
  border-left: none;
  border-radius: var(--radius);
  padding: 10px 12px;
  gap: 10px;
  margin-bottom: 2px;
  color: rgba(255, 255, 255, .72);
  min-height: var(--control-h);
  box-sizing: border-box;
}
.sidebar nav a:hover,
.sidebar .nav-group-toggle:hover { background: rgba(255, 255, 255, .07); }
.sidebar nav a.active,
.sidebar .nav-group-toggle.active {
  background: var(--primary);
  color: #fff;
  border-left: none;
  box-shadow: 0 2px 6px rgba(115, 103, 240, .4);
}
.sidebar nav a.sub-link {
  padding-left: 40px;
  font-size: 13px;
  font-weight: 400;
  min-height: 34px;
  color: rgba(255, 255, 255, .58);
}
.sidebar nav a.sub-link.active { background: rgba(255, 255, 255, .12); box-shadow: none; }
.sidebar .group-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .38);
  padding: 16px 12px 6px;
}
.sidebar .nav-group-toggle svg.chevron { opacity: .5; transition: transform .26s cubic-bezier(.4, 0, .2, 1); }
.sidebar .nav-group-toggle[aria-expanded="true"] svg.chevron { transform: rotate(180deg); opacity: .8; }
.sidebar .nav-group { transition: grid-template-rows .28s cubic-bezier(.4, 0, .2, 1); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  box-sizing: border-box;
  padding: 12px var(--gap-xl);
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.topbar h1 { font-size: 20px; letter-spacing: -.01em; }
.rates-strip { gap: var(--gap); }
.rate-pill {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
}
.theme-toggle, .btn-badged { position: relative; }
.btn-badge {
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 2px var(--surface);
  font-size: 10px;
  font-weight: 700;
}

/* ═══ 2. Контент, карточки, статистика ═════════════════════════ */

.content { padding: 22px var(--gap-xl) 40px; }
.card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
}
.card + .card { margin-top: var(--gap-lg); }
.card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.005em;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.card-title .sub, .card-title .count {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.card-tight { padding: var(--gap); }
.panel { border-radius: var(--radius-lg); border-color: var(--line); }
.panel-scroll { border-radius: var(--radius-lg); }

.stat {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  opacity: .0;
}
.stat-danger::before, .stat-success::before, .stat-warning::before, .stat-info::before { opacity: 1; }
.stat-danger::before { background: var(--danger); }
.stat-success::before { background: var(--success); }
.stat-warning::before { background: var(--warning); }
.stat-info::before { background: var(--info); }
.stat-grid { gap: 16px; }
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12px; color: var(--text-disabled); }
.stat-bar { border-radius: var(--radius-pill); overflow: hidden; }
.stat-bar-fill { border-radius: var(--radius-pill); }

/* ═══ 3. Реестр: панель, фильтры, таблица, пагинация ═══════════ */

.toolbar {
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1 1 auto; }
.toolbar > label.u-sm { color: var(--text-muted); white-space: nowrap; }
.toolbar-group { display: inline-flex; gap: 6px; align-items: center; }
/* Опасное действие отделяем зазором и разделителем, а не только цветом */
.toolbar-group-danger {
  margin-left: var(--gap);
  padding-left: var(--gap);
  border-left: 1px solid var(--line);
}
.filters {
  gap: 12px;
  align-items: end;
  padding: var(--gap);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.filters .form-group { margin-bottom: 0; }
.filters label, .filters .form-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card table { border-collapse: separate; border-spacing: 0; }
.card th {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--field);
  height: 40px;
  padding: 0 var(--gap);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.card td {
  padding: 13px var(--gap);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
.card tbody tr:last-child td { border-bottom: none; }
.card tbody tr:hover td { background: var(--tint); }
.card td.num, .card th.num, .card td.u-right, .card th.u-right, .u-metric, .stat-value { font-variant-numeric: tabular-nums; }
.card td.num, .card th.num, .card .u-mono, .u-metric { font-family: var(--mono); }
/* Первая колонка — имя записи: сама ссылка крупнее, пояснение под ней тише */
.card tbody td:first-child > a { font-weight: 600; }
.card td .u-note { font-size: 12px; color: var(--text-disabled); margin-top: 2px; text-wrap: pretty; }
/* Колонка действий: не переносится и не растягивает строку */
.card tbody td:last-child { white-space: nowrap; }
.card tbody td:last-child > .btn + .btn,
.card tbody td:last-child > form + .btn { margin-left: 6px; }

/* Пустое состояние внутри таблицы */
.card td > .empty-state { padding: 40px 0; }
.empty-state {
  color: var(--text-disabled);
  text-align: center;
  padding: 32px 20px;
  text-wrap: pretty;
}
.empty-state-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Пагинатор Laravel идёт с классами Tailwind, а сборки нет — поэтому
   правим его по структуре. Русский текст и убранный scrollIntoView —
   в списке правок разметки. */
nav[aria-label="Pagination Navigation"] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
}
nav[aria-label="Pagination Navigation"] p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  letter-spacing: .02em;
}
nav[aria-label="Pagination Navigation"] p .font-medium { color: var(--text); font-weight: 600; }
nav[aria-label="Pagination Navigation"] .shadow-sm { box-shadow: none; display: inline-flex; gap: 4px; }
nav[aria-label="Pagination Navigation"] span[class*="inline-flex"],
nav[aria-label="Pagination Navigation"] button[class*="inline-flex"] {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--control-h-sm);
  height: var(--control-h-sm);
  padding: 0 10px;
  margin: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
nav[aria-label="Pagination Navigation"] button[class*="inline-flex"]:hover { background: var(--field); color: var(--text); }
nav[aria-label="Pagination Navigation"] [aria-current="page"] span {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
nav[aria-label="Pagination Navigation"] [aria-disabled="true"] span { opacity: .4; cursor: default; }
nav[aria-label="Pagination Navigation"] svg { width: 16px; height: 16px; }
nav[aria-label="Pagination Navigation"] .sm\:hidden { display: none; }
/* Предлагаемая замена (см. список правок): .pager / .pager-info / .pager-pages */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; }
.pager-info { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.pager-pages { display: inline-flex; gap: 4px; }

/* ═══ 4. Форма-страница ════════════════════════════════════════ */

/* Длинная форма = несколько карточек-разделов. Заголовок раздела держим
   на виду, пока крутится содержимое: искать «какой это раздел» не нужно. */
form .card { padding-top: 0; }
form .card > .card-title {
  position: sticky;
  top: 68px;
  z-index: 5;
  margin: 0 -22px 18px;
  padding: 16px 22px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.form-grid { gap: 16px var(--gap-lg); }
.form-row { gap: 16px var(--gap-lg); }
.form-group { margin-bottom: 0; }
/* Подписи полей в шаблонах — обычный <label>, без класса */
.form-group > label,
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-label-spacer { min-height: 19px; }
.form-hint { font-size: 12px; color: var(--text-disabled); margin-top: 5px; text-wrap: pretty; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; font-weight: 500; }
.form-control.is-invalid, .is-invalid .form-control {
  border-color: var(--danger);
  background: rgba(234, 84, 85, .04);
}
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(234, 84, 85, .16); }
.quick-add {
  margin-top: 6px;
  border-style: dashed;
  color: var(--primary);
  border-color: var(--primary-light);
  background: transparent;
}
.quick-add:hover { background: var(--tint); }
.field-row { gap: 8px; align-items: center; }
.field-grip { color: var(--text-disabled); cursor: grab; }
.u-span-all { grid-column: 1 / -1; }

/* Кнопки формы: остаются на виду у длинной формы */
form > .toolbar.u-mt-16,
form > .card + .toolbar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin-top: var(--gap-lg);
  padding: var(--gap) var(--gap-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 -6px 24px rgba(15, 20, 34, .06);
}

/* ═══ 5. Карточка документа: вкладки, статус, действия ═════════ */

.section-tabs {
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--gap-lg);
  overflow-x: auto;
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { height: 0; }
.section-tab {
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 var(--gap);
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-muted);
  position: relative;
  bottom: -1px;
}
.section-tab:hover { background: var(--field); color: var(--text); }
.section-tab.is-active {
  color: var(--primary);
  font-weight: 600;
  background: var(--tint);
  box-shadow: inset 0 -2px 0 var(--primary);
}
.def-list { gap: 14px var(--gap-xl); }
.def-list dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.def-list dd { font-size: 14px; margin: 2px 0 0; text-wrap: pretty; }
.meta-grid { gap: 12px var(--gap-lg); }
.meta-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ═══ 6. Отчёт с итогами ══════════════════════════════════════ */

/* Шапка широкой таблицы примерзает — иначе на 68 строках непонятно,
   что за колонка. Первая колонка тоже: имя работы должно быть видно. */
.table-wide { min-width: 100%; }
.table-wide thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.table-wide tbody td:first-child,
.table-wide thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}
.table-wide thead th:first-child { z-index: 3; background: var(--field); }
.table-wide tbody tr:hover td:first-child { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.table-wide td { padding: 10px var(--gap); }

/* Итоги: <tfoot> или .u-danger-row. Подытоги по группам — нужен класс,
   см. список правок разметки (.row-group / .row-subtotal). */
.card tfoot td, .card tfoot th {
  position: sticky;
  bottom: 0;
  background: var(--field);
  border-top: 2px solid var(--line);
  border-bottom: none;
  font-weight: 700;
  font-size: 14px;
  z-index: 2;
}
.card tr.u-danger-row td { background: rgba(234, 84, 85, .06); }
.card tr.u-danger-row:hover td { background: rgba(234, 84, 85, .1); }
.card tr.row-group td {
  background: var(--field);
  font-weight: 600;
  border-top: 1px solid var(--line);
}
.card tr.row-subtotal td {
  background: var(--field);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
/* Минус видно цветом И знаком: одного цвета мало при печати и дальтонизме */
.u-danger { color: var(--danger); }
.u-danger.u-bold, .u-danger-row .u-bold { font-weight: 700; }
.u-right { text-align: right; }
.u-right-bold { text-align: right; font-weight: 700; }
.u-muted { color: var(--text-disabled); }
.u-note { font-size: 12px; color: var(--text-disabled); text-wrap: pretty; }
.u-sm { font-size: 13px; }
.u-lg { font-size: 16px; }
.u-scroll-x { overflow-x: auto; border-radius: var(--radius); }
.u-split { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }

/* ═══ 7. Кнопки, поля, бейджи, табы ═══════════════════════════ */

.btn {
  min-height: var(--control-h);
  border-radius: var(--radius);
  padding: 0 16px;
  border-color: var(--line);
  font-weight: 500;
  gap: 7px;
  transition: background .14s, box-shadow .14s, opacity .14s;
}
.btn-sm { min-height: var(--control-h-sm); padding: 0 12px; font-size: 13px; }
.btn-primary { box-shadow: 0 2px 6px rgba(115, 103, 240, .3); border-color: transparent; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { box-shadow: 0 2px 6px rgba(234, 84, 85, .3); border-color: transparent; }
.btn-icon { min-width: var(--control-h); padding: 0 10px; }
.btn-group { gap: 6px; }
.btn:disabled, .btn[disabled] { opacity: .5; box-shadow: none; cursor: not-allowed; }
/* Отправка формы: кнопка не «мигает», а гаснет и держит ширину */
.btn[wire\:loading], .btn.is-loading { opacity: .6; pointer-events: none; }

.form-control {
  min-height: var(--control-h);
  border-radius: var(--radius);
  border-color: var(--line);
  background: var(--field);
  padding: 0 12px;
  font-size: 14px;
}
textarea.form-control { padding: 10px 12px; line-height: 1.5; }
select.form-control { padding-right: 30px; }
.form-control:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); outline: none; }
.form-control::placeholder { color: var(--text-disabled); }
.form-control:disabled { opacity: .6; cursor: not-allowed; }
.password-field .password-eye { color: var(--text-muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }

.badge {
  height: 24px;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.badge-outline { box-shadow: inset 0 0 0 1px var(--line); }
.badge-inline { height: auto; padding: 1px 7px; font-size: 11px; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }

.filter-tabs, .tabs { gap: 6px; border-bottom: 1px solid var(--line); }
.filter-tab, .tab {
  height: var(--control-h-sm);
  border-radius: var(--radius);
  padding: 0 12px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-tab:hover, .tab:hover { background: var(--field); }
.filter-tab.active, .tab.active, .filter-tab.is-active, .tab.is-active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.filter-tab .count, .tab .count {
  font-family: var(--mono);
  font-size: 11px;
  opacity: .7;
}

.alert {
  border-radius: var(--radius-lg);
  border: none;
  padding: var(--gap) 16px;
  font-size: 14px;
  text-wrap: pretty;
  box-shadow: inset 3px 0 0 currentColor;
}
.progress, .progress-wrap { border-radius: var(--radius-pill); overflow: hidden; background: var(--field); }
.progress-bar { border-radius: var(--radius-pill); transition: width .3s ease; }
.progress-value { font-family: var(--mono); font-size: 11px; }

/* ═══ 8. Модалки и поповеры ═══════════════════════════════════ */

.modal-backdrop {
  background: rgba(15, 20, 34, .5);
  backdrop-filter: blur(2px);
  padding: var(--gap-xl);
}
.modal {
  border-radius: 14px;
  border: none;
  box-shadow: var(--shadow-modal);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: none;
}
.modal-wide { max-width: 900px; }
.modal-head {
  flex-shrink: 0;
  border-color: var(--line);
  padding: 18px var(--gap-lg);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--gap);
}
/* Длинная форма в модалке: прокручивается только тело, шапка и кнопки на месте */
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--gap-lg);
}
.modal-body > .form-grid { gap: 16px var(--gap-lg); }
.modal-foot {
  flex-shrink: 0;
  border-color: var(--line);
  padding: var(--gap) var(--gap-lg);
  display: flex;
  gap: var(--gap-sm);
  justify-content: flex-end;
  background: var(--surface);
  border-radius: 0 0 14px 14px;
}
/* Подтверждение удаления: узкая модалка, кнопка удаления справа и одна */
.modal:has(.btn-danger) .modal-head { color: var(--danger); }
.modal-close { color: var(--text-muted); border-radius: var(--radius-sm); margin-left: auto; }
.modal-close:hover { background: var(--field); color: var(--text); }

.popover {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-pop);
  padding: 6px;
  min-width: 240px;
}
.popover-item { border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; }
.popover-item:hover { background: var(--field); }
.popover-row { gap: var(--gap-sm); }
.popover-item.is-unread { background: var(--tint); font-weight: 500; }
.popover-item .when { font-family: var(--mono); font-size: 10px; color: var(--text-disabled); }
/* Длинный список внутри поповера: видно ~7 строк, дальше прокрутка */
.panel-scroll, .popover .panel-scroll { max-height: 320px; overflow-y: auto; }

/* ═══ 9. Свои экраны ══════════════════════════════════════════ */

/* Ганта */
.gantt { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.gantt-head, .gantt-months, .gantt-ticks { background: var(--field); }
.gantt-month, .gantt-tick {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.gantt-tick-weekend { background: rgba(75, 70, 92, .04); }
.gantt-label { font-size: 13px; padding: 0 12px; }
.gantt-labels { border-right: 1px solid var(--line); background: var(--surface); }
.gantt-row:hover { background: var(--tint); }
.gantt-bar {
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(15, 20, 34, .18);
  font-size: 11px;
}
.gantt-bar-text { font-family: var(--mono); font-size: 10px; }
.gantt-bar-critical { box-shadow: 0 1px 3px rgba(234, 84, 85, .35); }
.gantt-bar-baseline { border-radius: 2px; opacity: .5; }
.gantt-bar-group { border-radius: 2px; }
.gantt-today { box-shadow: 0 0 0 1px rgba(234, 84, 85, .4); }
.gantt-handle { border-radius: 2px; }
.gantt-legend { font-size: 12px; color: var(--text-muted); gap: var(--gap); padding: 10px var(--gap); }
.gantt-swatch { border-radius: 3px; }
.gantt-nodate { font-size: 12px; color: var(--text-disabled); }

/* Канбан */
.board { gap: var(--gap); align-items: start; }
.board-col {
  border-radius: var(--radius-lg);
  background: var(--field);
  padding: 10px;
}
.board-col-head {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.board-col-head .count { font-weight: 600; color: var(--text); }
.board-card {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow);
  padding: 12px;
  font-size: 13px;
  cursor: grab;
  transition: box-shadow .14s, transform .14s;
}
.board-card:hover { box-shadow: var(--shadow-lg); }
.board-card.dragging { opacity: .5; transform: rotate(1deg); }
.board-col.drag-over { background: var(--tint-strong); box-shadow: inset 0 0 0 2px var(--primary-light); }
.board.is-dragging .board-col { transition: background .14s; }

/* Чат-виджет */
.chat-launcher {
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(115, 103, 240, .4);
  width: 52px;
  height: 52px;
}
.chat-panel {
  border-radius: 16px;
  border: none;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.chat-head { padding: var(--gap) 16px; }
.chat-title { font-size: 15px; font-weight: 600; }
.chat-sub { font-size: 11px; opacity: .75; }
.chat-channels { gap: 6px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none; }
.chat-channels::-webkit-scrollbar { height: 0; }
.chat-chip {
  height: 28px;
  border-radius: var(--radius-pill);
  padding: 0 11px;
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text-muted);
}
.chat-chip.is-active { background: var(--primary); border-color: transparent; color: #fff; font-weight: 600; }
.chat-chip-count { font-family: var(--mono); font-size: 10px; opacity: .8; }
.chat-body { padding: var(--gap) 16px; }
.chat-message { max-width: 84%; }
.chat-text {
  border-radius: 12px;
  background: var(--field);
  padding: 9px 12px;
  font-size: 13px;
  text-wrap: pretty;
}
.chat-message.mine .chat-text { background: var(--primary); color: #fff; }
.chat-meta { font-family: var(--mono); font-size: 10px; color: var(--text-disabled); }
.chat-form { padding: 12px 16px; border-top: 1px solid var(--line); }
.chat-search { border-radius: var(--radius); }
.chat-picker { border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); max-height: 240px; overflow-y: auto; }
.chat-found-row { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.chat-found-row:hover { background: var(--field); }
.chat-found-kind { font-family: var(--mono); font-size: 10px; color: var(--text-disabled); }
.chat-file { border-radius: var(--radius-sm); background: var(--field); font-size: 12px; padding: 5px 8px; }
.chat-file-life { font-family: var(--mono); font-size: 10px; color: var(--text-disabled); }
.chat-empty { color: var(--text-disabled); font-size: 13px; text-align: center; padding: var(--gap-xl) var(--gap); }
.mention, .mention-ref { color: var(--primary); font-weight: 500; }
.mention-file { color: var(--info); }
.mention-gone { color: var(--text-disabled); text-decoration: line-through; }

/* Обсуждения под документом */
.comment-thread { display: flex; flex-direction: column; gap: var(--gap); }
.comment { border-radius: var(--radius-lg); background: var(--field); padding: 12px var(--gap); }
.comment-head { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: var(--gap-sm); }
.comment-time { font-family: var(--mono); font-size: 10px; color: var(--text-disabled); font-weight: 400; }
.comment-body { font-size: 13px; margin-top: 4px; text-wrap: pretty; }
.comment-delete { margin-left: auto; color: var(--text-disabled); }
.comment-delete:hover { color: var(--danger); }

/* Табель и занятость */
.signature-pad { border-radius: var(--radius-lg); border: 1px dashed var(--line); background: var(--field); }
.signature-image { border-radius: var(--radius-sm); }
.bar-chart, .bar-chart-signed { gap: 4px; }
.bar-slot { border-radius: 3px; background: var(--field); }
.bar, .bar-half { border-radius: 3px; }
.bar-positive { background: var(--success); }
.bar-negative { background: var(--danger); }
.bar-zero { background: var(--line); }
.bar-label { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }

/* ═══ 10. Кабинет партнёра и панель вендора ═══════════════════ */

/* Разные двери — разный оттенок шапки, чтобы подрядчик не думал,
   что видит ваш кабинет. Цвета взяты из палитры, новых не вводим. */
.portal-top { border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--info); }
.vendor-top { border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--warning); }
.portal-top__inner, .vendor-top__inner { min-height: 60px; gap: var(--gap); }
.portal-title, .vendor-title { font-size: 18px; font-weight: 600; }
.portal-top__user, .vendor-link { font-size: 13px; color: var(--text-muted); }
.portal-nav, .vendor-nav { gap: 4px; }
.portal-nav a, .vendor-nav a {
  height: var(--control-h-sm);
  border-radius: var(--radius);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
.portal-nav a:hover, .vendor-nav a:hover { background: var(--field); color: var(--text); }
.portal-nav a.is-active { background: var(--tint-strong); color: var(--primary); font-weight: 600; }
.vendor-nav a.is-active { background: rgba(255, 159, 67, .14); color: var(--warning); font-weight: 600; }
.portal-grid { gap: var(--gap-lg); }
.portal-act { border-radius: var(--radius-lg); box-shadow: var(--shadow); border: none; padding: var(--gap); }
.portal-act__head { display: flex; align-items: center; gap: var(--gap-sm); font-weight: 600; font-size: 14px; }
.portal-act__sum { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.portal-chat { border-radius: var(--radius-lg); overflow: hidden; }
.portal-chat__feed { max-height: 320px; overflow-y: auto; padding: var(--gap); display: flex; flex-direction: column; gap: 10px; }
.portal-chat__item { max-width: 84%; }
.portal-chat__body { border-radius: 12px; background: var(--field); padding: 9px 12px; font-size: 13px; }
.portal-chat__item.is-mine .portal-chat__body { background: var(--primary); color: #fff; }
.portal-chat__meta { font-family: var(--mono); font-size: 10px; color: var(--text-disabled); }
.portal-chat__form { padding: 12px var(--gap); border-top: 1px solid var(--line); }
.portal-docs, .portal-fact { font-size: 13px; }
.vendor-dept__name { font-weight: 600; }
.vendor-branch { font-size: 13px; color: var(--text-muted); }
.vendor-2fa__qr { border-radius: var(--radius-lg); border: 1px solid var(--line); padding: var(--gap); background: var(--surface); }
.vendor-2fa__how { font-size: 13px; color: var(--text-muted); text-wrap: pretty; }
.vendor-codes { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }

/* ═══ 11. Мобайл (≤760px) — перелом один, поверх правил app.css ═══ */

@media (max-width: 760px) {
  /* Оболочка */
  .menu-scrim { background: rgba(15, 20, 34, .5); backdrop-filter: blur(2px); }
  .sidebar {
    width: 288px;
    box-shadow: 0 24px 60px rgba(15, 20, 34, .4);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  }
  .sidebar .brand { height: 60px; padding: 0 16px; }
  .sidebar nav a, .sidebar .nav-group-toggle { min-height: 44px; font-size: 15px; }
  .sidebar nav a.sub-link { min-height: 40px; font-size: 14px; }
  .menu-toggle {
    width: 44px; height: 44px;
    margin-left: -8px;
    border: none; background: none;
    border-radius: var(--radius);
    color: var(--text);
  }
  .topbar { min-height: 56px; padding: 8px 12px; gap: var(--gap-sm); flex-wrap: nowrap; }
  .topbar h1 { font-size: 17px; }
  /* Имя и компания на 390px не влезают рядом с «Выйти» — прячем текст,
     кнопки и колокольчик остаются. */
  .topbar .user-chip { font-size: 0; gap: 6px; min-width: 0; flex-shrink: 1; overflow: hidden; }
  .topbar .user-chip > * { font-size: 13px; }
  .rates-strip { display: none; }

  .content { padding: var(--gap) var(--gap) calc(28px + env(safe-area-inset-bottom)); }
  .card { padding: var(--gap); border-radius: var(--radius-lg); }
  .card + .card { margin-top: var(--gap); }
  .card-title { font-size: 15px; }

  /* Реестр: панель фильтров в столбик, кнопка действия во всю ширину */
  .toolbar { gap: var(--gap-sm); margin-bottom: var(--gap); }
  .toolbar .form-control, .toolbar select.form-control { flex: 1 1 100%; max-width: none !important; }
  .toolbar .spacer { display: none; }
  .toolbar > .btn-primary { flex: 1 1 100%; }
  .toolbar .btn-group { width: 100%; }
  .toolbar .btn-group .btn { flex: 1; }
  .filters { grid-template-columns: 1fr; padding: 12px; gap: 10px; }
  .toolbar-group-danger { margin-left: 0; padding-left: 0; border-left: none; border-top: 1px solid var(--line); padding-top: 10px; width: 100%; }

  /* Реестр карточками — вид, механику .table-cards из app.css не трогаем */
  table.table-cards tr {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--gap) 16px;
    margin-bottom: 12px;
  }
  table.table-cards td { padding: 5px 0; font-size: 14px; }
  table.table-cards td::before {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  table.table-cards td:first-child {
    font-size: 15px;
    padding-bottom: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }
  table.table-cards td:last-child {
    gap: var(--gap-sm);
    padding-top: 10px;
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
  }
  table.table-cards td:last-child .btn { min-height: 44px; min-width: 44px; border-radius: 10px; }
  table.table-cards td > .empty-state { padding: 20px 0; }

  /* Широкие таблицы и отчёты: липкая первая колонка, шапка не липнет
     (на 390px она съедала бы пол-экрана) */
  .table-wide thead th { position: static; }
  .table-wide tbody td:first-child, .table-wide thead th:first-child { position: sticky; left: 0; }
  .card tfoot td, .card tfoot th { position: static; }

  /* Форма-страница */
  form .card { padding-top: var(--gap); }
  form .card > .card-title { position: static; margin: 0 0 12px; padding: 0 0 10px; }
  .form-grid, .form-row { grid-template-columns: 1fr; gap: var(--gap); }
  form > .toolbar.u-mt-16, form > .card + .toolbar {
    margin: var(--gap) calc(var(--gap) * -1) 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 12px var(--gap) calc(12px + env(safe-area-inset-bottom));
  }
  form > .toolbar.u-mt-16 .btn, form > .card + .toolbar .btn { flex: 1; }

  /* Вкладки документа и фильтры — лента с прокруткой */
  .section-tabs, .filter-tabs, .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin-bottom: var(--gap);
  }
  .filter-tabs::-webkit-scrollbar, .tabs::-webkit-scrollbar { height: 0; }
  .filter-tab, .tab { flex-shrink: 0; min-height: 36px; }
  .section-tab { height: 44px; font-size: 14px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: var(--gap); border-radius: 10px; }
  .stat-value { font-size: 18px; }
  .def-list, .meta-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Модалка — лист снизу */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(15, 20, 34, .3);
  }
  .modal-head { padding: var(--gap) 16px; }
  .modal-head::before {
    content: '';
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px;
    border-radius: 2px;
    background: var(--line);
  }
  .modal-head { position: relative; padding-top: 18px; }
  .modal-body { padding: 16px; }
  .modal-foot {
    position: sticky;
    bottom: 0;
    border-radius: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .modal-foot .btn { flex: 1; }

  /* Поповер — тоже лист снизу: на 390px привязка к кнопке некуда не влезает */
  .popover { border-radius: 16px 16px 0 0; min-width: 0; }
  .popover .panel-scroll { max-height: 60vh; }
  .popover-item { padding: 12px 10px; min-height: 44px; box-sizing: border-box; }

  /* Свои экраны */
  .board { grid-auto-flow: column; grid-auto-columns: 82vw; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--gap-sm); }
  .board-col { scroll-snap-align: start; }
  .board-card { padding: var(--gap); font-size: 14px; }
  .gantt-labels { min-width: 140px; }
  .gantt-label { font-size: 12px; padding: 0 var(--gap-sm); }
  .gantt-legend { flex-wrap: wrap; gap: var(--gap-sm); font-size: 11px; }
  .chat-launcher { width: 52px; height: 52px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .chat-panel { border-radius: 16px 16px 0 0; }
  .chat-message, .portal-chat__item { max-width: 92%; }
  .comment { padding: 10px 12px; }

  /* Двери партнёра и вендора */
  .portal-top__inner, .vendor-top__inner { min-height: 52px; padding: var(--gap-sm) 12px; flex-wrap: wrap; }
  .portal-nav, .vendor-nav { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .portal-nav a, .vendor-nav a { min-height: 40px; flex-shrink: 0; }
  .portal-grid { grid-template-columns: 1fr; gap: var(--gap); }

  /* Касательные цели. height: auto нужен, потому что в app.css высота
     кнопки задана явно — min-height один её не перебьёт. */
  .btn, .btn-sm, .form-control, .btn-icon,
  .toolbar .btn, .toolbar .btn-sm,
  .modal .btn, .filters .btn,
  table.table-cards td .btn {
    height: auto;
    min-height: 44px;
  }
  .btn-icon, table.table-cards td .btn-icon { min-width: 44px; }
  /* Шапка: «Выйти» важнее имени — имя сжимается, кнопка нет */
  .topbar .user-chip { gap: 4px; }
  .topbar .user-chip form { flex-shrink: 0; }
  .topbar .user-chip form .btn { margin-left: 6px !important; }

  /* Таблица без .table-cards и без обёртки-прокрутки уводит всю страницу
     вбок (реестр лотов). Пока класса нет — прокручиваем саму таблицу;
     правильное решение — .table-cards в разметке, см. список правок. */
  /* .main — флекс-элемент: без min-width: 0 широкая таблица растягивает
     всю страницу, и уезжает шапка вместе с меню. */
  .main, .content { min-width: 0; }
  .content table.table:not(.table-cards) {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  nav[aria-label="Pagination Navigation"] span[class*="inline-flex"],
  nav[aria-label="Pagination Navigation"] button[class*="inline-flex"] { min-width: 44px; height: 44px; }
  .pager { justify-content: center; }
}
