/* RAppServer веб-клиент — визуальный редизайн: типографика, сетка, карточки, тени */

@import url('/fonts.css');

:root {
  /* Палитра */
  --bg: #0c0e12;
  --bg-elevated: #13161d;
  --surface: #181c24;
  /* Карточки, попапы, модалки поверх страницы — непрозрачный слой (раньше использовался без объявления) */
  --surface-elevated: #1e2430;
  --surface-hover: #1e232d;
  --border: #2a3140;
  --border-muted: #1f252e;
  --text: #f0f2f5;
  --text-muted: #8b92a2;
  --text-subtle: #5c6474;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-muted: rgba(99, 102, 241, 0.15);
  --accent-focus: rgba(99, 102, 241, 0.35);
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.12);
  --warn: #eab308;
  --warn-muted: rgba(234, 179, 8, 0.12);
  --err: #ef4444;
  --err-muted: rgba(239, 68, 68, 0.12);
  --error: var(--err);
  --error-muted: var(--err-muted);
  --info: #3b82f6;
  --info-muted: rgba(59, 130, 246, 0.12);
  --danger: var(--err);
  --file-tint-pdf: rgba(239, 68, 68, 0.14);
  --file-tint-doc: rgba(129, 140, 248, 0.16);
  --file-tint-sheet: rgba(34, 197, 94, 0.14);
  --file-tint-image: rgba(234, 179, 8, 0.14);
  --file-tint-archive: rgba(139, 146, 162, 0.16);
  --file-tint-generic: rgba(42, 49, 64, 0.55);
  --radius: var(--radius-md);
  /* Типографика: масштаб и шрифты */
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --leading-tight: 1.35;
  --leading-normal: 1.5;
  --tracking-tight: -0.02em;
  --tracking-wide: 0.04em;
  /* Сетка и отступы */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --container-max: 1280px;
  --panel-card-width: 90vw;
  --content-gutter: 1.5rem;
  /* Радиусы */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  /* Тени */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.28);
  --transition: 0.2s ease;
  /* Фоны для списков/дропдаунов — непрозрачные, чтобы не сливаться с подложкой */
  --bg-1: var(--surface);
  --bg-2: var(--surface-hover);
  --bg-3: var(--surface-hover);
  /* Feedback component variables (reuse existing tokens where possible) */
  --toast-top: var(--space-6);
  --toast-gap: var(--space-2);
  --progress-bar-height: 4px;
  --progress-border-radius: var(--radius-sm);
  /* Семантическая шкала слоёв (dropdown → sticky → modal → tooltip → toast → command palette) */
  --z-base: 0;
  --z-raised: 1;
  --z-sticky: 100;
  --z-header-overlay: 125;
  --z-dropdown: 200;
  --z-popover: 300;
  --z-modal-backdrop: 3000;
  --z-modal: 3001;
  --z-tooltip: 4000;
  --z-toast: 5000;
  --z-command-palette: 6000;
  --z-toast-dialog: 2147483647;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* --- Шапка: строка 1 — бренд + действия; строка 2 — навигация (underline tabs) --- */
.header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-muted);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-8) var(--space-2);
  min-height: 3.25rem;
}

.header__brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.header__groups {
  width: 100%;
  padding: var(--space-2) var(--space-8) 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-muted);
}

.nav-groups-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.header__nav.tabs {
  width: 100%;
  padding: 0 var(--space-8) var(--space-1);
  background: var(--bg-elevated);
  border-top: 1px solid color-mix(in srgb, var(--border-muted) 65%, transparent);
  position: static;
}

.header h1,
.header-brand__title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  font-family: 'Roboto', sans-serif;
  color: var(--text);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Акценты бренда — те же, что на login.html (.login-brand__title) */
.header-brand__title .login-brand__title-accent {
  color: #ff6600;
}

.header-brand__title .login-brand__title-accent-secondary {
  color: #23aadd;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.header label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.admin-api-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.admin-api-settings__hint {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 42rem;
}

.admin-api-settings__field {
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: min(100%, 20rem);
}

.admin-api-settings__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.admin-api-settings input#baseUrl {
  width: min(100%, 20rem);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-api-settings input#baseUrl::placeholder {
  color: var(--text-subtle);
}

.admin-api-settings input#baseUrl:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.admin-api-settings__status {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  min-width: 2rem;
}

.header select {
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-width: 12rem;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition);
}

.header select:focus {
  outline: none;
  border-color: var(--accent);
}

.header button:not(.burger-btn):not(.header-icon-btn) {
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

.header button:not(.burger-btn):not(.header-icon-btn):hover {
  background: var(--accent-hover);
}

.header button:not(.burger-btn):not(.header-icon-btn):active {
  transform: scale(0.98);
}

.admin-api-settings__status:not(:empty),
#healthStatus:not(:empty) {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* Панель «Действую от лица» (только администратор), правый нижний угол */
.impersonate-sticker {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 125;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(20rem, calc(100vw - var(--space-8)));
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
}

.impersonate-sticker[hidden] {
  display: none !important;
}

body.app-login-open .impersonate-sticker {
  display: none !important;
}

.impersonate-sticker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.impersonate-sticker__head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.impersonate-sticker__title {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-head, var(--text));
  min-width: 0;
}

.impersonate-sticker__summary {
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.impersonate-sticker__toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  min-width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition);
}

.impersonate-sticker__toggle:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-hover, var(--surface-elevated));
}

.impersonate-sticker__toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.impersonate-sticker__toggle-icon {
  display: block;
  line-height: 1;
}

.impersonate-sticker__panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.impersonate-sticker__label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  cursor: default;
}

.impersonate-sticker__field-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.impersonate-sticker__select {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition);
}

.impersonate-sticker__select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Свернуто: компактная полоска в углу, без сдвига за край экрана */
.impersonate-sticker_collapsed {
  width: auto;
  max-width: min(16rem, calc(100vw - var(--space-8)));
  gap: 0;
  padding: var(--space-2);
}

.impersonate-sticker_collapsed .impersonate-sticker__panel {
  display: none;
}

.impersonate-sticker_collapsed .impersonate-sticker__title {
  display: none;
}

.impersonate-sticker_collapsed .impersonate-sticker__summary {
  display: block;
  font-size: var(--text-sm);
  color: var(--text);
}

.impersonate-sticker_collapsed .impersonate-sticker__summary[hidden] {
  display: none;
}

.impersonate-sticker_collapsed .impersonate-sticker__summary:not([hidden])::before {
  content: 'От лица: ';
  color: var(--text-muted);
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .impersonate-sticker,
  .impersonate-sticker__toggle {
    transition: none;
  }
}

/* --- Навигация (вкладки во 2-й строке шапки, underline-nav) --- */
.tabs-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* Бургер слева от логотипа; выпадающее меню — под кнопкой */
.burger-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  position: relative;
}

/* Группы верхнего уровня */
.header .nav-groups-inner button[data-nav-group] {
  flex-shrink: 0;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  min-height: 2.5rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.header .nav-groups-inner button[data-nav-group]:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}

.header .nav-groups-inner button[data-nav-group]:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: -2px;
}

.header .nav-groups-inner button[data-nav-group].active,
.header .nav-groups-inner button[data-nav-group][aria-current='page'] {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: transparent;
}

/* Вкладки в шапке: текст + нижняя граница (NN/G, Primer UnderlineNav) */
.header .tabs-inner button[data-tab] {
  flex-shrink: 0;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  min-height: 2.75rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.header .tabs-inner button[data-tab]:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.header .tabs-inner button[data-tab]:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: -2px;
}

.header .tabs-inner button[data-tab].active,
.header .tabs-inner button[data-tab][aria-selected='true'] {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
  background: transparent;
}

/* --- Impersonation: forbidden tab in reveal mode --- */
button.nav-tab--forbidden {
  color: var(--color-danger, #ef4444);
  opacity: 0.65;
  cursor: not-allowed;
  text-decoration: line-through;
}
button.nav-tab--forbidden:hover {
  opacity: 0.8;
}
button.nav-tab--forbidden::after {
  content: ' 🔒';
  font-size: 0.75em;
}
button.nav-tab--forbidden[aria-disabled="true"] {
  pointer-events: none;
}

/* --- Impersonation banner (inside sticker) --- */
.impersonation-banner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--accent-muted, color-mix(in srgb, var(--accent) 12%, transparent));
}

.impersonation-banner[hidden] {
  display: none !important;
}

.impersonation-banner__text {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.impersonate-sticker .impersonation-reveal-toggle {
  width: 100%;
  min-height: 2.75rem;
  justify-content: center;
  font-size: var(--text-xs);
  white-space: normal;
  text-align: center;
}

/* Кнопка мобильного меню (nav-mobile-dialog) */
.header button.burger-btn {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: var(--space-2);
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.header button.burger-btn:hover {
  color: var(--text);
  background: var(--surface);
}
/* Иконка: три горизонтальные полоски в квадратике */
.burger-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
  background-size: 14px 2px;
  background-position: center 6px, center 11px, center 16px;
  background-repeat: no-repeat;
  vertical-align: middle;
}

/* Мобильное меню: кнопка слева, дерево групп → вкладки */
.burger-group.nav-mobile {
  display: none;
  flex-shrink: 0;
}

.nav-mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-header-overlay);
  background: color-mix(in srgb, var(--text) 35%, transparent);
  border: none;
  padding: 0;
  margin: 0;
}

.nav-mobile-backdrop[hidden] {
  display: none;
}

.nav-mobile-drawer {
  position: fixed;
  top: var(--nav-mobile-drawer-top, 3.5rem);
  left: 0;
  bottom: 0;
  width: min(20rem, 88vw);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  padding: calc(var(--space-3) + env(safe-area-inset-top, 0px)) var(--space-4) var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0px));
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-muted);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 220ms;
}

.nav-mobile-drawer[aria-hidden='false'] {
  transform: translateX(0);
  visibility: visible;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}

.nav-mobile-drawer__nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.nav-mobile-brand {
  display: none;
  margin: 0;
  flex-shrink: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.nav-mobile-context {
  display: none;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-width: 12rem;
  line-height: var(--leading-tight);
}

.nav-mobile-context__tab {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-mobile-context__sep {
  display: none;
}

.nav-mobile-context__group {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-mobile-tree {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-1);
}

.nav-mobile-panel__title {
  margin: 0;
  padding: 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  text-wrap: balance;
}

.nav-mobile-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-mobile-back {
  align-self: flex-start;
  margin: 0 0 var(--space-1);
  padding: var(--space-2) var(--space-2);
  min-height: 2.75rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.nav-mobile-back:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.nav-mobile-back:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.nav-mobile-group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  margin: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.nav-mobile-group-btn:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.nav-mobile-group-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.nav-mobile-group-btn.active,
.nav-mobile-group-btn[aria-current='page'] {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.nav-mobile-group-btn__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-mobile-group-btn__meta {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 1.25rem;
  text-align: right;
}

.nav-mobile-tab {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  margin: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--leading-normal);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.nav-mobile-tab:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.nav-mobile-tab:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.nav-mobile-tab.active,
.nav-mobile-tab[aria-current='page'] {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

body.nav-mobile-open {
  overflow: hidden;
}

body.nav-mobile-open .header {
  z-index: calc(var(--z-dropdown) + 2);
}

@media (max-width: 900px) {
  .burger-group.nav-mobile {
    display: flex;
  }

  .nav-mobile-context:not([hidden]) {
    display: flex;
  }

  .header__groups,
  .header__nav.tabs {
    display: none;
  }

  .header__top {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .header__brand-row {
    gap: var(--space-2);
    min-width: 0;
    flex: 1;
  }

  .header-brand__title {
    display: none;
  }

  .nav-mobile-brand {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-mobile-drawer {
    transition: none;
  }
}

/* Модалка настройки навигации */
.nav-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}
.nav-settings-modal.hidden {
  display: none;
}
.nav-settings-modal-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.nav-settings-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
}
.nav-settings-hint {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.nav-settings-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.nav-settings-list h4 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.nav-settings-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-settings-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-muted);
}
.nav-settings-items li:last-child {
  border-bottom: none;
}

/* --- Monitoring (Grafana link) --- */
.content:has(#panel-monitoring:not(.hidden)) {
  max-width: none;
  width: 100%;
  padding: var(--space-4);
  margin: 0;
  overflow: visible;
}

#panel-monitoring:not(.hidden) {
  width: 100%;
  max-width: none;
  align-self: stretch;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#panel-monitoring:not(.hidden) > h2 {
  margin: 0 0 var(--space-3) 0;
  padding: 0;
  flex: 0 0 auto;
}

.monitoring-link {
  width: 100%;
  max-width: 56rem;
  padding: var(--space-4);
  margin: 0;
}

.monitoring-link__hint {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-sm);
}

.monitoring-link__actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.monitoring-link__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}

.monitoring-link__btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.nav-settings-items button[data-move] {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-settings-items button[data-move]:hover {
  background: var(--accent-muted);
}
/* Состояние перетаскивания: подсветка зоны сброса и перетаскиваемого элемента */
.nav-settings-list.nav-settings-drag-over .nav-settings-items {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.nav-settings-items li.nav-settings-dragging {
  opacity: 0.6;
}
.nav-settings-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}
.nav-settings-actions button {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-settings-actions [data-action="save"] {
  background: var(--accent);
  color: white;
  border: none;
}
.nav-settings-actions [data-action="cancel"] {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Настройка меню в профиле (вкладка «Меню») */
.profile-menu-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.profile-nav-settings-root {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.profile-nav-settings-group__head {
  margin: 0 0 var(--space-2);
}

.profile-nav-settings-group__title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.profile-nav-settings-group__hint {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-muted);
  text-wrap: pretty;
}

.profile-nav-settings-items {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.profile-nav-settings-item {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-elevated);
}

.profile-nav-settings-item:last-child {
  border-bottom: none;
}

.profile-nav-settings-item__grip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.profile-nav-settings-item__grip-icon {
  display: block;
  opacity: 0.65;
}

.profile-nav-settings-item__label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  cursor: pointer;
  margin: 0;
}

.profile-nav-settings-item__check {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--accent);
}

.profile-nav-settings-item__text {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.profile-nav-settings-item_dragging {
  opacity: 0.55;
}

.profile-nav-settings-items_drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

.profile-nav-settings-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-muted);
}

.profile-nav-settings-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.profile-display-prefs {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.profile-display-prefs__label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  min-height: 2.75rem;
  margin: 0;
}

.profile-display-prefs__check {
  margin-top: 0.15rem;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--accent);
}

.profile-display-prefs__copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.profile-display-prefs__text {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.profile-display-prefs__hint {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-muted);
  text-wrap: pretty;
}

.profile-nav-settings-status {
  margin: 0;
  min-height: 1.25rem;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-muted);
}

.profile-nav-settings-status:empty {
  display: none;
}

.profile-nav-settings-status.err {
  color: var(--err, #c62828);
}

.profile-menu-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.profile-admin-tools__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.profile-admin-tools__btn {
  flex: 1 1 12rem;
  min-width: min(100%, 12rem);
  min-height: 2.75rem;
}

/* --- Контент: сетка --- */
.content {
  width: 100%;
  min-width: 0;
  padding: var(--space-8);
  max-width: var(--container-max);
  margin: 0 auto;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Редактор процессов открыт: контент на всю ширину экрана, без отступов и обрезки. */
.content:has(#panel-workflow-editor:not(.hidden)) {
  max-width: none;
  padding: 0;
  margin: 0;
  overflow: visible;
}

/* Табель / расчёт ЗП открыт: контент на всю ширину экрана (без ограничения container-max). */
.content:has(#panel-timesheet:not(.hidden)),
.content:has(#panel-payroll-calculation:not(.hidden)) {
  max-width: none;
  width: 100%;
}

/* Реестровые панели: единая ширина .card (--panel-card-width), по центру */
.content:has(#panel-directors-board:not(.hidden)),
.content:has(#panel-employees:not(.hidden)),
.content:has(#panel-marks:not(.hidden)),
.content:has(#panel-projects:not(.hidden)),
.content:has(#panel-docflow-sites:not(.hidden)),
.content:has(#panel-docflow-customers:not(.hidden)),
.content:has(#panel-admin:not(.hidden)),
.content:has(#panel-docflow:not(.hidden)),
.content:has(#panel-positions:not(.hidden)),
.content:has(#panel-individuals:not(.hidden)),
.content:has(#panel-subdivisions:not(.hidden)),
.content:has(#panel-organizations:not(.hidden)),
.content:has(#panel-business-directions:not(.hidden)),
.content:has(#panel-idle-personnel:not(.hidden)) {
  max-width: none;
  width: 100%;
}

.content:has(#panel-staffing-requests:not(.hidden)),
.content:has(#panel-work-crews:not(.hidden)),
.content:has(#panel-chats:not(.hidden)),
.content:has(#panel-anviz-pass-history:not(.hidden)),
.content:has(#panel-movements:not(.hidden)),
.content:has(#panel-warehouses:not(.hidden)),
.content:has(#panel-shipments:not(.hidden)),
.content:has(#panel-mount-reporting:not(.hidden)) {
  max-width: none;
  width: 100%;
}

#panel-directors-board:not(.hidden),
#panel-employees:not(.hidden),
#panel-marks:not(.hidden),
#panel-projects:not(.hidden),
#panel-docflow-sites:not(.hidden),
#panel-docflow-customers:not(.hidden),
#panel-admin:not(.hidden),
#panel-docflow:not(.hidden),
#panel-positions:not(.hidden),
#panel-individuals:not(.hidden),
#panel-subdivisions:not(.hidden),
#panel-organizations:not(.hidden),
#panel-business-directions:not(.hidden),
#panel-idle-personnel:not(.hidden),
#panel-staffing-requests:not(.hidden),
#panel-work-crews:not(.hidden),
#panel-chats:not(.hidden),
#panel-movements:not(.hidden),
#panel-warehouses:not(.hidden),
#panel-shipments:not(.hidden),
#panel-mount-reporting:not(.hidden) {
  width: var(--panel-card-width);
  max-width: 100%;
  box-sizing: border-box;
  align-self: center;
}

#panel-directors-board:not(.hidden) > .card,
#panel-employees:not(.hidden) > .card,
#panel-marks:not(.hidden) > .card,
#panel-projects:not(.hidden) > .card,
#panel-docflow-sites:not(.hidden) > .card,
#panel-docflow-customers:not(.hidden) > .card,
#panel-admin:not(.hidden) > .card,
#panel-docflow:not(.hidden) > .card,
#panel-positions:not(.hidden) > .card,
#panel-individuals:not(.hidden) > .card,
#panel-subdivisions:not(.hidden) > .card,
#panel-organizations:not(.hidden) > .card,
#panel-business-directions:not(.hidden) > .card,
#panel-idle-personnel:not(.hidden) > .card,
#panel-staffing-requests:not(.hidden) > .card,
#panel-work-crews:not(.hidden) > .card,
#panel-chats:not(.hidden) > .card,
#panel-anviz-pass-history:not(.hidden) > .card,
#panel-movements:not(.hidden) > .card,
#panel-warehouses:not(.hidden) > .card,
#panel-shipments:not(.hidden) > .card,
#panel-mount-reporting:not(.hidden) > .card {
  width: 100%;
  box-sizing: border-box;
}

#panel-admin:not(.hidden):has(#admin-sub-module-permissions:not(.hidden)) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

#panel-admin:not(.hidden) > .admin-sub-panel:not(.hidden) {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* Матрица модулей: без прокрутки страницы — только тело таблицы */
html:has(#admin-sub-module-permissions:not(.hidden)),
body:has(#admin-sub-module-permissions:not(.hidden)) {
  overflow: hidden;
  max-height: 100vh;
}

.content:has(#admin-sub-module-permissions:not(.hidden)) {
  overflow: hidden;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

#admin-sub-module-permissions:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  padding: var(--space-2) var(--space-3) var(--space-3);
  overflow: hidden;
}

#admin-sub-module-permissions:not(.hidden).card {
  overflow: hidden;
}

#module-permissions-matrix-root {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* --- Панели: карточки и блоки --- */
.panel {
  display: block;
  animation: panelIn 0.25s ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel.hidden {
  display: none !important;
}

.panel h2 {
  margin: 0 0 var(--space-6);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text);
}

/* Персональная настройка: скрыть дублирующий заголовок раздела (см. профиль → Меню). */
body.rappserver-hide-panel-titles .panel > h2,
body.rappserver-hide-panel-titles .panel > .workflow-editor-panel-header > h2,
body.rappserver-hide-panel-titles .profile-panel__title {
  display: none !important;
}

body.rappserver-hide-panel-titles .profile-panel__intro:has(.profile-panel__title:only-child),
body.rappserver-hide-panel-titles .profile-panel__intro:not(:has(.profile-panel__lead:not(:empty))) {
  margin-bottom: 0;
}


.timesheet-layout {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  margin-top: var(--space-3);
}










.timesheet-workflow-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: var(--space-2);
  color: var(--text);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.timesheet-control-section {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 93%, #0f172a);
}


.timesheet-filters-collapsible {
  margin-bottom: var(--space-3);
  padding: 0;
  overflow: hidden;
}

.timesheet-ops-collapsible {
  margin-bottom: var(--space-3);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 95%, #111827);
}

.timesheet-filters-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  list-style: none;
  margin: 0;
  background: color-mix(in srgb, var(--surface) 88%, #111827);
  border-bottom: 1px solid var(--border-muted);
}

.timesheet-ops-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  list-style: none;
  margin: 0;
  background: color-mix(in srgb, var(--surface) 88%, #111827);
  border-bottom: 1px solid var(--border-muted);
}

.timesheet-filters-summary::-webkit-details-marker {
  display: none;
}

.timesheet-ops-summary::-webkit-details-marker {
  display: none;
}

.timesheet-filters-summary::after {
  content: '▸';
  color: var(--text-muted);
  transition: transform 0.18s ease;
}

.timesheet-ops-summary::after {
  content: '▸';
  color: var(--text-muted);
  transition: transform 0.18s ease;
}

.timesheet-filters-collapsible[open] .timesheet-filters-summary::after {
  transform: rotate(90deg);
}

.timesheet-ops-collapsible[open] .timesheet-ops-summary::after {
  transform: rotate(90deg);
}

.timesheet-filters-summary .timesheet-section-title {
  margin: 0;
}

.timesheet-ops-summary .timesheet-section-title {
  margin: 0;
}

.timesheet-filters-summary-caption {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timesheet-filters-body {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.timesheet-ops-group {
  display: grid;
  gap: var(--space-2);
}

.timesheet-ops-group + .timesheet-ops-group {
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border-muted);
}

.timesheet-ops-group-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timesheet-ops-collapsible .timesheet-layout {
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 0;
}

.timesheet-ops-collapsible .timesheet-control-section {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.timesheet-ops-collapsible .timesheet-section-title {
  margin: 0 0 4px;
  font-size: 12px;
}

.timesheet-ops-collapsible .timesheet-section-hint {
  display: none;
}

.timesheet-ops-collapsible .timesheet-toolbar {
  margin-bottom: var(--space-2);
}

.timesheet-ops-collapsible .timesheet-toolbar-form {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
}

.timesheet-ops-collapsible .timesheet-toolbar-form label {
  gap: 3px;
  font-size: 11px;
}

.timesheet-ops-collapsible .timesheet-toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding-bottom: 2px;
}

.timesheet-ops-collapsible .timesheet-toolbar :is(button, input, select) {
  min-height: 24px;
  padding: 1px 6px;
  font-size: 11px;
}

.timesheet-ops-collapsible .timesheet-toolbar-actions button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.timesheet-shift-actions-row {
  flex-wrap: nowrap;
  overflow-x: auto;
}

.timesheet-shift-actions-row button {
  min-width: 0;
}

.timesheet-ops-collapsible .timesheet-ops-group-title {
  display: none;
}

#panel-timesheet .is-role-hidden {
  display: none;
}

.timesheet-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.timesheet-section-hint {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timesheet-toolbar {
  margin-bottom: var(--space-3);
}

.timesheet-toolbar:last-child {
  margin-bottom: 0;
}

.timesheet-toolbar label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text);
  line-height: var(--leading-normal);
}

.timesheet-toolbar-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-3);
}

.timesheet-toolbar-form label {
  display: grid;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timesheet-filter-bar {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.timesheet-filter-bar label {
  gap: 4px;
}

.timesheet-filter-bar :is(input, select) {
  min-height: 32px;
  padding: 4px 8px;
  font-size: var(--text-sm);
}



.timesheet-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.timesheet-toolbar-actions button {
  font-weight: 600;
}

.timesheet-toolbar-actions button:first-child {
  background: color-mix(in srgb, var(--accent) 38%, #0f172a);
  border-color: color-mix(in srgb, var(--accent) 65%, #93c5fd);
  color: var(--text);
}

.timesheet-toolbar-actions button:first-child:hover {
  background: color-mix(in srgb, var(--accent) 48%, #111827);
}

.timesheet-toolbar input,
.timesheet-toolbar select,
.timesheet-toolbar button {
  min-height: 38px;
}

#panel-timesheet :is(button, input, select):focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

#panel-timesheet.role-accountant .timesheet-control-section {
  border-color: color-mix(in srgb, var(--border) 60%, #93c5fd);
}

#panel-timesheet.role-accountant .timesheet-section-title {
  font-size: var(--text-lg);
}

#panel-timesheet.role-accountant .timesheet-section-hint {
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

@media (max-width: 960px) {
  .timesheet-rolebar {
    padding: var(--space-3);
  }

  .timesheet-role-tabs {
    width: 100%;
  }

  .timesheet-role-tabs [role="tab"] {
    flex: 1 1 0;
    min-width: 0;
  }

  .timesheet-toolbar-actions button {
    width: 100%;
  }

  .timesheet-filter-bar {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .timesheet-filter-sticky {
    top: 56px;
  }
}

@media (max-width: 640px) {
  .timesheet-filter-bar {
    grid-template-columns: 1fr;
  }
}

.timesheet-zone-status {
  margin: 0 0 var(--space-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
  color: var(--text-muted);
  font-size: var(--text-xs);
  background: color-mix(in srgb, var(--surface) 96%, #111827);
}

.timesheet-zone-status.is-loading {
  border-color: #93c5fd;
  color: #bfdbfe;
}

.timesheet-zone-status.is-success {
  border-color: #4ade80;
  color: #86efac;
}

.timesheet-zone-status.is-error {
  border-color: #f87171;
  color: #fca5a5;
}

.timesheet-zone-status.is-empty {
  border-color: #9ca3af;
  color: #d1d5db;
}

.timesheet-report-card {
  margin-bottom: var(--space-3);
}

.timesheet-report-card:last-child {
  margin-bottom: 0;
}

.timesheet-conflicts-banner {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, #ef4444 55%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, #7f1d1d 14%, var(--surface));
}

.timesheet-conflicts-banner-head {
  display: grid;
  gap: 4px;
}

.timesheet-conflicts-banner-head strong {
  color: #fecaca;
  font-size: var(--text-sm);
}

.timesheet-conflicts-banner-head span {
  color: #fca5a5;
  font-size: var(--text-xs);
}

.timesheet-conflicts-details {
  margin-top: var(--space-2);
}

.timesheet-conflicts-details summary {
  cursor: pointer;
  color: #fecaca;
  font-size: var(--text-xs);
  font-weight: 600;
}

.timesheet-conflicts-list {
  margin: var(--space-2) 0 0;
  padding-left: 1rem;
  display: grid;
  gap: var(--space-2);
}

.timesheet-conflicts-list-item {
  color: #fee2e2;
}

.timesheet-conflicts-list-main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--text-xs);
}

.timesheet-conflicts-type {
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #fca5a5 60%, transparent);
}

.timesheet-conflicts-list-desc {
  margin-top: 4px;
  color: #fecaca;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

.timesheet-brigade-block {
  margin-bottom: var(--space-6);
}

.timesheet-brigade-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  color: var(--text);
}

.timesheet-project-block {
  margin-bottom: var(--space-8);
}

.timesheet-project-title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-lg);
  color: var(--text);
}

.timesheet-gantt-head,
.timesheet-gantt-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr 64px;
  gap: var(--space-3);
  align-items: center;
}

.timesheet-gantt-head {
  margin-bottom: var(--space-2);
}

.timesheet-gantt-hours-grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(10px, 1fr));
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.timesheet-gantt-hours-grid span {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.timesheet-gantt-grid {
  position: relative;
  min-height: 28px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(
      to right,
      transparent,
      transparent calc(100% / 24 - 1px),
      color-mix(in srgb, var(--border-muted) 80%, transparent) calc(100% / 24 - 1px),
      color-mix(in srgb, var(--border-muted) 80%, transparent) calc(100% / 24)
    );
}

.timesheet-gantt-segment {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--radius-sm);
  z-index: 2;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  border: 1px solid #93c5fd;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25) inset;
}

.timesheet-gantt-marker {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.timesheet-gantt-marker-start {
  left: 0;
  background: #22c55e;
}

.timesheet-gantt-marker-end {
  left: 100%;
  background: #ef4444;
}

.timesheet-gantt-marker-live {
  left: 100%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.timesheet-gantt-night {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background-color: #c084fc;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.75 15.5A9.75 9.75 0 0 1 8.5 2.25a.75.75 0 0 0-.9-.95A10.5 10.5 0 1 0 22.7 16.4a.75.75 0 0 0-.95-.9Z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.75 15.5A9.75 9.75 0 0 1 8.5 2.25a.75.75 0 0 0-.9-.95A10.5 10.5 0 1 0 22.7 16.4a.75.75 0 0 0-.95-.9Z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  pointer-events: none;
}

.timesheet-gantt-night-start {
  left: 0;
}

.timesheet-gantt-night-end {
  left: 100%;
}

.timesheet-gantt-person,
.timesheet-gantt-hours {
  font-size: var(--text-sm);
}

.timesheet-gantt-person {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.timesheet-gantt-hours {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.timesheet-gantt-head .timesheet-gantt-hours-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-subtle);
}

.timesheet-gantt-row:nth-child(odd) .timesheet-gantt-grid {
  background-color: color-mix(in srgb, var(--surface) 85%, #1f2937);
}

.timesheet-gantt-row:nth-child(even) .timesheet-gantt-grid {
  background-color: color-mix(in srgb, var(--surface) 93%, #111827);
}

.timesheet-empty-row {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.timesheet-month-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.timesheet-month-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: auto;
}

.timesheet-month-table th,
.timesheet-month-table td {
  border: 1px solid var(--border-muted);
  padding: 3px 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.timesheet-month-table thead th {
  text-align: center;
  font-weight: 600;
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-card);
}

.timesheet-month-table tbody tr:nth-child(odd) {
  background: color-mix(in srgb, var(--surface) 92%, #1f2937);
}

.timesheet-month-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface) 98%, #111827);
}

.timesheet-month-name-col {
  min-width: 240px;
  max-width: 320px;
  text-align: left !important;
  position: sticky;
  left: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--bg-card) 94%, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timesheet-month-day-cell {
  min-width: 36px;
}

.timesheet-open-shift-marker {
  display: inline-block;
  margin-right: 2px;
  vertical-align: baseline;
}

.timesheet-month-total {
  font-weight: 600;
}

/* Табель: высота списка должна быть динамической по количеству строк. */
#timesheet-report {
  max-height: none;
  overflow: visible;
}

.timesheet-panel-status {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-muted);
  background: color-mix(in srgb, var(--surface) 92%, #111827);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  box-shadow: var(--shadow-lg);
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.timesheet-panel-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.timesheet-panel-status.is-loading {
  border-color: #93c5fd;
  color: #bfdbfe;
}

.timesheet-panel-status.is-success {
  border-color: #4ade80;
  color: #86efac;
}

.timesheet-panel-status.is-error {
  border-color: #f87171;
  color: #fca5a5;
}

.timesheet-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.timesheet-filter-group {
  padding: var(--space-3);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, #111827);
}

.timesheet-filter-group-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.timesheet-filter-group .timesheet-filter-bar {
  margin: 0;
}

.timesheet-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.timesheet-action-cluster {
  padding: var(--space-3);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 95%, #0f172a);
}

.timesheet-action-cluster-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.timesheet-action-cluster .timesheet-shift-actions-row {
  margin: 0;
}

.timesheet-action-cluster button {
  min-width: 132px;
}

#panel-timesheet button:focus-visible,
#panel-timesheet input:focus-visible,
#panel-timesheet select:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.profile-panel-wrap {
  display: grid;
  gap: var(--space-5);
}

#profile-report .profile-section {
  background: color-mix(in srgb, var(--surface) 92%, #1a202c);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

#profile-report .profile-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  line-height: var(--leading-tight);
}

#profile-report .profile-subsection-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#profile-report .profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3) var(--space-4);
}

#profile-report .profile-summary-grid p {
  margin: 0;
  display: grid;
  gap: 2px;
}

#profile-report .profile-k {
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#profile-report .profile-v {
  color: var(--text);
  font-size: var(--text-sm);
}

#profile-report .profile-v-strong {
  font-size: var(--text-base);
  font-weight: 700;
}

#profile-report .profile-empty {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

#profile-report .profile-timesheet-mobile-nav {
  display: none;
  margin-bottom: var(--space-3);
}

#profile-report .profile-timesheet-view_mobile {
  display: none;
}

#profile-report .profile-month-details {
  display: none;
}

#profile-report .profile-section_timesheet.profile-report--mobile .profile-timesheet-mobile-nav {
  display: block;
}

#profile-report .profile-section_timesheet.profile-report--mobile .profile-timesheet-day-label {
  display: none;
}

#profile-report .profile-section_timesheet.profile-report--mobile.profile-report--day-mode .profile-timesheet-view_desktop {
  display: none;
}

#profile-report .profile-section_timesheet.profile-report--mobile.profile-report--day-mode .profile-timesheet-view_mobile {
  display: block;
}

#profile-report .profile-section_timesheet.profile-report--mobile .profile-timesheet-desktop-calendar {
  display: none;
}

#profile-report .profile-section_timesheet.profile-report--mobile .profile-month-details {
  display: block;
  margin-top: var(--space-3);
}

#profile-report .profile-day-mobile-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

#profile-report .profile-day-mobile-card {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

#profile-report .profile-day-mobile-card__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

#profile-report .profile-day-mobile-card__hours {
  font-size: var(--text-lg);
  font-weight: 700;
}

#profile-report .profile-day-mobile-card__intervals {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  white-space: normal;
  overflow: visible;
}

.profile-tabs__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-totp-status__recovery {
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.5;
}

#profile-report .profile-timesheet-day-label {
  margin: 0 0 var(--space-2);
  color: var(--text);
  font-weight: 600;
}

#profile-report .profile-timesheet-intervals {
  margin: 2px 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  min-height: 18px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profile-report .profile-timesheet-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-3) 0;
}

#profile-report .profile-timesheet-empty-gantt {
  min-height: 84px;
}

#profile-report .profile-gantt-brigade-line {
  min-height: 20px;
  display: flex;
  align-items: center;
}

#profile-timesheet-day-content {
  min-height: 180px;
}

#profile-report .profile-gantt-compact-row {
  min-height: 32px;
}

#profile-report .profile-gantt-compact-head,
#profile-report .profile-gantt-compact-row {
  grid-template-columns: 1fr 64px;
}

#profile-report .profile-gantt-compact-row .timesheet-gantt-hours {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

#profile-report .profile-month-calendar {
  display: grid;
  gap: 4px;
}

#profile-report .profile-month-week-head,
#profile-report .profile-month-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

#profile-report .profile-month-week-head span {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

#profile-report .profile-month-day,
#profile-report .profile-month-day-empty {
  min-height: 44px;
  border-radius: 8px;
}

#profile-report .profile-month-day-empty {
  background: transparent;
}

#profile-report .profile-month-day {
  border: 1px solid var(--border-muted);
  background: color-mix(in srgb, var(--surface) 90%, #1f2937);
  color: var(--text);
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

#profile-report .profile-month-day.is-weekend {
  background: color-mix(in srgb, var(--surface) 82%, #334155);
}

#profile-report .profile-month-day.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

#profile-report .profile-month-day-num {
  font-size: var(--text-sm);
  line-height: 1;
}

#profile-report .profile-month-day-hours {
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
}

#profile-report .profile-month-total {
  margin: var(--space-3) 0 0;
  font-size: var(--text-lg);
}

#profile-report table {
  margin-top: var(--space-2);
}

#profile-report tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-hover) 85%, #1f2937);
}

.panel h3 {
  margin: var(--space-8) 0 var(--space-4);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-muted);
}

/* Тулбар панели: кнопки и фильтры в одну полосу */
/* Тулбар панели: единая высота элементов, выравнивание по базовой линии (best practice) */
.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
}

.panel-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

.panel-toolbar select {
  padding: var(--space-2) var(--space-3);
  min-height: 2.25rem;
  min-width: 10rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.panel-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.panel-toolbar input[type="text"] {
  padding: var(--space-2) var(--space-3);
  min-height: 2.25rem;
  min-width: 10rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.panel-toolbar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.panel-toolbar input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
  vertical-align: middle;
}

.panel-toolbar .btn-upload {
  margin: 0;
}

/* Кнопка «Создать» (+) — стили задаются в общем правиле .projects-registry .panel-toolbar button (как в Для директоров) */

/* Кнопка «+» в тулбаре и в компактных заголовках (табель РО и др.) */
.panel-toolbar-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.panel-toolbar-add:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.panel-toolbar-add:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Кнопка «Создать задачу» (+): в одну высоту с тулбаром, стиль как у .panel button */
#btn-task-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-task-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-task-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#btn-brigade-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-brigade-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-brigade-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#btn-user-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-user-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-user-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#btn-work-type-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-work-type-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-work-type-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#btn-individual-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-individual-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-individual-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#btn-organization-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-organization-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-organization-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#btn-position-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
#btn-position-create:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
#btn-position-create:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Кнопки редактирования/удаления в таблицах справочников (Должности, Виды работ, Физлица, Пользователи, Сотрудники) */
.positions-actions,
.panel-list-actions {
  white-space: nowrap;
}
.positions-actions .btn-icon,
.panel-list-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  margin: 0 0.15rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.positions-actions .btn-icon:hover,
.panel-list-actions .btn-icon:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.positions-actions .btn-icon:focus-visible,
.panel-list-actions .btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}



.employee-actions-menu summary::-webkit-details-marker {
  display: none;
}


/* Таблица «Сотрудники» (BEM внутри .employees-registry): ФИО, id записи, ЗУП — см. блок в конце файла */

.panel-toolbar-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
}

/* Сворачиваемый поиск: иконка лупы, по клику раскрывается поле (best practice — focus-within, ~240ms, a11y). */
.shipments-search-wrap,
.panel-search-wrap {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: width 0.24s ease;
  width: 2.25rem;
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .shipments-search-wrap,
  .panel-search-wrap {
    transition: none;
  }
}
.shipments-search-wrap.expanded,
.shipments-search-wrap:focus-within,
.panel-search-wrap.expanded,
.panel-search-wrap:focus-within {
  width: 14rem;
  max-width: min(14rem, 100%);
}
.shipments-search-toggle,
.panel-search-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.shipments-search-toggle:hover,
.panel-search-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}
.shipments-search-toggle:focus-visible,
.panel-search-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}
.shipments-search-wrap.expanded .shipments-search-toggle,
.shipments-search-wrap:focus-within .shipments-search-toggle,
.panel-search-wrap.expanded .panel-search-toggle,
.panel-search-wrap:focus-within .panel-search-toggle {
  border-right-color: transparent;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.shipments-search-icon,
.panel-search-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.shipments-search-toggle .shipments-search-icon,
.panel-search-toggle .panel-search-icon {
  color: inherit;
}
.shipments-search-input,
.panel-search-input {
  width: 100%;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  min-height: 2.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.shipments-search-input::placeholder,
.panel-search-input::placeholder {
  color: var(--text-subtle);
}
.shipments-search-input:focus,
.panel-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

/* ——— Марки: реестр (зеркало users-registry / employees-registry) ——— */
.panel-body_marks-registry {
  padding-top: var(--space-4);
}

.marks-registry {
  --mr-control-height: 44px;
  --mr-control-radius: var(--radius-md);
  --mr-label-row: calc(var(--text-xs) * 1.5 + var(--space-2));
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.marks-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.marks-registry__summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

.marks-registry__summary-project {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  max-width: 28rem;
}

.marks-registry__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.marks-registry__stats.hidden {
  display: none;
}

.marks-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.marks-registry__stat.hidden {
  display: none;
}

.marks-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.marks-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.marks-registry__stat-val_err {
  color: var(--err);
}

.marks-registry__stat-val_success {
  color: var(--success);
}

.marks-registry__stat-val_progress {
  color: var(--accent);
}

.marks-registry__status-groups {
  margin: 0;
  padding: 0;
}

.marks-registry__status-groups.hidden {
  display: none;
}

.marks-registry__status-groups-label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
}

.marks-registry__status-groups-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: 0;
}

.marks-registry__status-group {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
}

.marks-registry__status-group-term {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marks-registry__status-group-val {
  margin: 0;
}

.marks-registry__status-group-btn {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: pointer;
}

.marks-registry__status-group-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.marks-registry__status-group-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.marks-registry__status-group-share {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
}

.marks-registry__stat_filter .marks-registry__stat-val[role='button'] {
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
}

.marks-registry__stat_filter .marks-registry__stat-val[role='button']:hover {
  text-decoration: underline;
}

.marks-registry__stat-val_active.marks-registry__stat-val_err {
  background: var(--err-muted);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-2));
}

.marks-registry__stat-val_active.marks-registry__stat-val_success {
  background: var(--success-muted);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-2));
}

.marks-registry__filter-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--err-muted);
  color: var(--err);
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  vertical-align: middle;
  text-decoration: none;
}

.marks-registry__filter-reset:hover {
  background: var(--err);
  color: #fff;
}

.marks-registry__filter-reset svg {
  width: 10px;
  height: 10px;
}

.marks-registry__pane .marks-registry__toolbar {
  margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.marks-registry__toolbar {
  width: 100%;
}

.marks-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.marks-registry__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.marks-registry__field_project {
  flex: 0 1 16rem;
}

.marks-registry__field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
  line-height: 1.45;
}

.marks-registry__toolbar-search {
  flex: 1 1 14rem;
  min-width: min(100%, 12rem);
  max-width: 22rem;
  display: flex;
  align-items: center;
}

.marks-registry__toolbar-search .marks-registry__control {
  width: 100%;
  min-width: 0;
}

.marks-registry__control {
  box-sizing: border-box;
  width: 100%;
  height: var(--mr-control-height);
  min-height: var(--mr-control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--mr-control-radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.marks-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.marks-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* Тулбар: одна высота 44px — перебивает глобальный .panel button */
#panel-marks .marks-registry__toolbar-row button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--mr-control-height);
  min-height: var(--mr-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--mr-control-radius);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

#panel-marks .marks-registry__toolbar-row button:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

#panel-marks .marks-registry__toolbar-row button:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

#panel-marks .marks-registry__toolbar-row button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.marks-registry__icon-btn {
  width: var(--mr-control-height);
  min-width: var(--mr-control-height);
  padding: 0;
}

.marks-registry__icon-btn-svg {
  flex-shrink: 0;
  pointer-events: none;
}

.marks-registry__toggle-text {
  padding: 0 var(--space-3);
  white-space: nowrap;
}

#panel-marks .marks-registry__icon-btn[aria-pressed='true'],
#panel-marks .marks-registry__toggle-text[aria-pressed='true'] {
  color: var(--text);
  background: var(--accent-muted, rgba(255, 255, 255, 0.18));
  border-color: var(--accent, rgba(255, 255, 255, 0.35));
}

.marks-registry__pane {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.marks-registry__pane-head {
  margin-bottom: var(--space-3);
}

.marks-registry__pane-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.marks-registry__list-host {
  min-width: 0;
}

.marks-registry__table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.marks-registry__table {
  width: 100%;
  border-collapse: collapse;
}

.marks-registry__table thead th.marks-registry__th-cell {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

.marks-registry__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.marks-registry__th-chip .marks-registry__th,
.marks-registry__th-chip .marks-registry__head-static,
.marks-registry__th-chip .marks-registry__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.marks-registry__th-chip .marks-registry__th,
.marks-registry__th-chip .marks-registry__head-static {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

.marks-registry__th {
  box-sizing: border-box;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.marks-registry__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.marks-registry__th:hover {
  background: transparent;
}

.marks-registry__th:hover .marks-registry__th-label {
  color: var(--accent-hover);
}

.marks-registry__th:focus-visible,
.marks-registry__th-filter:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.marks-registry__th-sort {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.marks-registry__head-static {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
}

.marks-registry__th-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.marks-registry__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
}

.marks-registry__th-filter:hover {
  color: var(--accent-hover);
}

.marks-registry__th-filter_active {
  color: var(--accent);
}

.marks-registry__th-chip:has(.marks-registry__th-filter_active) {
  border-color: var(--accent);
}

.marks-registry__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

.marks-registry__pane .marks-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.marks-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.marks-registry__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.marks-registry__active-filters-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
}

.marks-registry__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.marks-registry__filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.marks-registry__filter-chip-detail {
  color: var(--text-subtle);
}

.marks-registry__active-filters-clear-all {
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.marks-registry__active-filters-clear-all:hover {
  text-decoration: underline;
}

.marks-registry__empty-row td {
  padding: var(--space-4);
  vertical-align: top;
}

select.marks-registry__control_project {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 0.65rem auto;
}

@media (max-width: 56rem) {
  .marks-registry__toolbar-row {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .marks-registry__field_project {
    flex: 1 1 100%;
  }

  .marks-registry__toolbar-search {
    flex: 1 1 100%;
  }
}

@media (max-width: 40rem) {
  .panel-body_marks-registry {
    padding-top: var(--space-3);
  }

  .marks-registry {
    gap: var(--space-4);
  }

  .marks-registry__summary-project {
    max-width: none;
  }

  .marks-registry__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .marks-registry__stat {
    padding: var(--space-3);
  }

  .marks-registry__stat-term {
    font-size: 0.6875rem;
    letter-spacing: normal;
    text-transform: none;
  }

  .marks-registry__stat-val {
    font-size: var(--text-xl);
  }

  .marks-registry__toolbar-row {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .marks-registry__toolbar-search {
    flex: 1 1 100%;
    width: 100%;
  }

  .marks-registry__pane {
    padding: var(--space-3);
  }

  .marks-registry__table {
    min-width: 34rem;
  }
}

.marks-registry__loading {
  margin: 0;
  padding: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.marks-registry__skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.marks-registry__skeleton-line {
  height: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--border-muted);
}
.marks-registry__skeleton-line_wide {
  width: 100%;
}
.marks-registry__skeleton-line_short {
  width: 42%;
}

.marks-registry__empty {
  margin: 0;
  padding: var(--space-6);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.marks-registry__empty-title {
  margin: 0 0 var(--space-2);
  font-weight: 600;
  color: var(--text);
}
.marks-registry__empty-hint {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.marks-registry__empty-reset {
  min-height: 2.75rem;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
  cursor: pointer;
}

#marks-file-list .marks-file-cell-code,
#marks-file-list td:nth-child(3),
#marks-file-list td:nth-child(4),
#marks-file-list td.marks-file-cell-quantity {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

#marks-file-list table thead th.marks-file-th-issues {
  width: 3.5rem;
  text-align: center;
}

#marks-file-list table thead th.marks-file-th-status {
  min-width: 11rem;
  text-align: left;
}

#marks-file-list .marks-view-3d {
  min-width: 2.25rem;
  min-height: 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
}

@media (hover: none) {
  #marks-file-list .marks-view-3d {
    display: inline-flex;
  }
}

.marks-instance-history-truncated {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  list-style: none;
  margin-left: calc(-1 * var(--space-6));
}


/* Первый столбец (марка): жирный шрифт, ячейка не меняется при наведении (иконка — position: absolute) */
#marks-file-list .marks-file-cell-code {
  position: relative;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  padding-right: 1.5em;
}
#marks-file-list tr[data-mark-id] .marks-file-cell-code:hover {
  text-decoration: underline;
}

/* Расхождение BIM vs сервер статусов: надстрочный +N (зелёный) / -N (красный) */
#marks-file-list .marks-instance-count-diff {
  vertical-align: super;
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 2px;
}

/* Иконка глаза (3D-сборка): absolute, высота как у строки — при появлении строка не разъезжается */
#marks-file-list .marks-view-3d {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--accent);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition), color var(--transition);
}
#marks-file-list .marks-file-cell-code:hover .marks-view-3d,
#marks-file-list tr[data-mark-id]:focus-within .marks-file-cell-code .marks-view-3d {
  display: inline-flex;
}
#marks-file-list .marks-view-3d:hover {
  background-color: var(--bg-elevated);
  color: var(--accent);
}
#marks-file-list .marks-view-3d:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#marks-file-list .marks-view-3d.marks-view-3d-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-muted);
}
#marks-file-list .marks-view-3d.marks-view-3d-disabled svg {
  filter: grayscale(1);
}
#marks-file-list .marks-view-3d.marks-view-3d-disabled::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 1px;
  background: currentColor;
  transform: rotate(-35deg);
  opacity: 0.8;
}
#marks-file-list .marks-view-3d svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

#marks-file-list .marks-instances-row td {
  padding: var(--space-3);
  vertical-align: top;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
#marks-file-list .marks-instances-row td.marks-instance-status-lost {
  background: var(--err-muted);
}
#marks-file-list .marks-instances-row td.marks-instance-status-installed {
  background: var(--success-muted);
}
#marks-file-list .marks-instances-block {
  margin: 0;
  padding: var(--space-3);
}
#marks-file-list .marks-instances-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}
#marks-file-list .marks-instances-table {
  width: 100%;
  font-size: var(--text-sm);
}
#marks-file-list .marks-instance-status-cell {
  text-align: left;
  cursor: pointer;
}
#marks-file-list .marks-instance-status-cell:hover {
  background: var(--bg-3);
}
#marks-file-list .marks-instances-table thead th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border);
}

#marks-file-list .marks-instances-table td.marks-instance-status-cell {
  text-align: left;
  min-width: 10rem;
}

#marks-file-list .marks-instances-table .marks-instance-ordinal-cell {
  width: 3rem;
  text-align: left;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
#marks-file-list .marks-instance-status-dropdown {
  position: fixed;
  z-index: var(--z-dropdown, 1200);
  min-width: 160px;
  padding: var(--space-1);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
#marks-file-list .marks-instance-status-dropdown button {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  margin: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
#marks-file-list .marks-instance-status-dropdown button:hover {
  background: var(--bg-2);
}
#marks-file-list .marks-instance-status-dropdown button.marks-instance-status-lost {
  background: var(--err-muted);
  color: var(--err);
}
#marks-file-list .marks-instance-status-dropdown button.marks-instance-status-lost:hover {
  background: rgba(239, 68, 68, 0.25);
}
#marks-file-list .marks-instance-status-dropdown button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
#marks-file-list .marks-instances-empty {
  margin: 0;
  color: var(--text-muted);
}

/* Ячейка «Статус» марки из файла: кольцо прогресса; двойной клик — то же меню статусов, что у инстанса */
#marks-file-list .marks-file-cell-status {
  vertical-align: middle;
  min-width: 11rem;
  text-align: left;
  cursor: pointer;
}
#marks-file-list .marks-file-cell-status:hover {
  background: var(--bg-3);
}
#marks-file-list .marks-file-mark-status-cell {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

#marks-file-list .marks-file-mark-status-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#marks-file-list .marks-file-mark-status-cell .marks-instance-percent-ring,
#marks-file-list .marks-file-mark-status-cell .marks-instance-percent-ring-wrap {
  flex-shrink: 0;
}
#marks-file-list .marks-file-mark-has-lost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--err-muted);
  color: var(--err);
  font-weight: 700;
  font-size: var(--text-sm);
  line-height: 1;
}

/* Круговая диаграмма «Выполнено на»: от полупрозрачной серой (0%) до зелёной (100%) */
#marks-file-list .marks-instance-percent-cell {
  vertical-align: middle;
  text-align: center;
}
#marks-file-list .marks-instance-percent-ring-wrap {
  display: inline-block;
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
/* Со статуса «На площадке» (70%): центр кольца зелёный */
#marks-file-list .marks-instance-percent-ring-wrap--center-green::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80%;
  height: 80%;
  margin-left: -40%;
  margin-top: -40%;
  border-radius: 50%;
  background: var(--success);
}
#marks-file-list .marks-instance-percent-ring {
  --percent: 0;
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  /* До «В пути» (60%): оранжевый; от 60% и выше — зелёный (через --phase2) */
  background: conic-gradient(
    var(--warn) 0deg,
    var(--warn) calc(var(--percent) * 3.6deg),
    var(--text-subtle) calc(var(--percent) * 3.6deg),
    var(--text-subtle) 360deg
  );
  /* Вырезаем центр — остаётся только кольцо */
  mask: radial-gradient(circle, transparent 40%, black 40%, black 100%);
  -webkit-mask: radial-gradient(circle, transparent 40%, black 40%, black 100%);
  flex-shrink: 0;
}
/* От «В пути» (60%) и дальше: 0–60% оранжевый, 60%–--percent зелёный */
#marks-file-list .marks-instance-percent-ring.marks-instance-percent-ring--phase2 {
  background: conic-gradient(
    var(--warn) 0deg,
    var(--warn) 216deg,
    var(--success) 216deg,
    var(--success) calc(var(--percent) * 3.6deg),
    var(--text-subtle) calc(var(--percent) * 3.6deg),
    var(--text-subtle) 360deg
  );
}
/* Статус «Установлено» (100%): всё кольцо зелёное */
#marks-file-list .marks-instance-percent-ring.marks-instance-percent-ring--installed {
  background: conic-gradient(var(--success) 0deg, var(--success) 360deg);
}
/* Статус «Утеряно»: кольцо красным только у этого инстанса (строка внутренней таблицы), не у всех в блоке */
#marks-file-list tr.marks-instance-row:has(td.marks-instance-status-lost) .marks-instance-percent-ring {
  background: var(--err-muted);
}


/* Ячейка № инстанса: кликабельна для открытия истории (best practice — явный cursor и hover) */
#marks-file-list .marks-instance-ordinal-cell {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#marks-file-list .marks-instance-ordinal-cell:hover {
  color: var(--accent);
}
#marks-file-list .marks-instance-ordinal-cell:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Диалог создания проекта: нативный <dialog>, showModal(), best practice 2025–2026 */
.dialog-project-create {
  max-width: min(90vw, 26rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 24px -8px rgba(0, 0, 0, 0.45),
    0 24px 48px -16px rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  opacity: 0;
  transform: scale(0.97) translateY(-8px);
}
.dialog-project-create[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
}
.dialog-project-create::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s ease, backdrop-filter 0.2s ease;
}
.dialog-project-create[open]::backdrop {
  @starting-style {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}
.dialog-project-create-inner {
  overflow: hidden;
  border-radius: inherit;
}
/* --- Форма создания проекта: компактный модал по PatternFly/Intergalactic (2025) --- */
/* Шапка: заголовок + крестик в одну линию, компактные отступы */
.dialog-project-create-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-2);
}
.dialog-project-create-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.dialog-project-create-close-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background-color: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dialog-project-create-close-icon:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}
.dialog-project-create-close-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Тело формы: md-отступ от заголовка (PatternFly), компактные поля (space-3 между полями) */
.form-project-create-stack {
  display: flex;
  flex-direction: column;
}
.dialog-project-create-body {
  padding: var(--space-3) var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.form-project-create-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-project-create-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-project-create-stack .form-field input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-project-create-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-project-create-stack .form-field input:hover {
  border-color: var(--border-muted);
}
.form-project-create-stack .form-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}
/* Футер: lg-отступ от контента (PatternFly), компактный паддинг */
.dialog-project-create-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-4);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}
.dialog-project-create-footer .btn-secondary {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dialog-project-create-footer .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-muted);
}
.dialog-project-create-footer .btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dialog-project-create-footer .btn-primary {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.dialog-project-create-footer .btn-primary:hover {
  background: var(--accent-hover);
}
.dialog-project-create-footer .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Экран входа (поверх интерфейса до валидной JWT-сессии) */
.app-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: #0c0e12;
  background: var(--bg, #0c0e12);
}

.app-login-overlay.hidden {
  display: none !important;
}


/* Gate загрузки SPA (дублирует критический inline в index.html) */
body.app-boot-loading > *:not(#app-boot-loading):not(#app-fatal-overlay) {
  display: none !important;
}

body.app-login-open > *:not(#app-login-overlay):not(#app-fatal-overlay) {
  display: none !important;
}

body.app-boot-fatal > *:not(#app-fatal-overlay) {
  display: none !important;
}

body.app-boot-update > *:not(#app-fatal-overlay) {
  display: none !important;
}

/* Экран загрузки до проверки сессии */
#app-boot-loading.app-boot-loading {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop, 3000);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--bg, #0c0e12);
}

#app-boot-loading.app-boot-loading.hidden {
  display: none !important;
}

.app-boot-loading__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  color: var(--text, #d6dbe3);
}

.app-boot-loading__spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid color-mix(in srgb, var(--accent, #14b8a6) 22%, transparent);
  border-top-color: var(--accent, #14b8a6);
  border-radius: 50%;
  animation: app-boot-spinner 0.75s linear infinite;
}

@keyframes app-boot-spinner {
  to {
    transform: rotate(360deg);
  }
}

.app-boot-loading__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

.app-boot-loading__hint {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted, #8b92a2);
}

/* Фатальная ошибка загрузки SPA */
#app-fatal-overlay.app-fatal {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal-backdrop, 3000) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--bg, #0c0e12);
}

#app-fatal-overlay.app-fatal.hidden {
  display: none !important;
}

.app-fatal__shell {
  width: min(100%, 26rem);
}

.app-fatal__card {
  padding: var(--space-5);
  border-radius: var(--radius-xl, 18px);
  border: 1px solid var(--border, #2a3140);
  background: var(--surface, #1e2430);
  color: var(--text, #d6dbe3);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 12px 28px -12px rgba(0, 0, 0, 0.45);
}

.app-fatal__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.app-fatal__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md, 10px);
  background: color-mix(in srgb, var(--err, #ef4444) 12%, var(--surface-elevated, #1e2430));
  color: var(--err, #ef4444);
}

.app-fatal_kind-network .app-fatal__icon {
  background: color-mix(in srgb, var(--warn, #f59e0b) 12%, var(--surface-elevated, #1e2430));
  color: var(--warn, #f59e0b);
}

.app-fatal__icon-svg {
  display: block;
}

.app-fatal__icon-svg_network {
  display: none;
}

.app-fatal_kind-network .app-fatal__icon-svg_client {
  display: none;
}

.app-fatal_kind-network .app-fatal__icon-svg_network {
  display: block;
}

.app-fatal__icon-svg_update {
  display: none;
}

.app-fatal_kind-update .app-fatal__icon-svg_client,
.app-fatal_kind-update .app-fatal__icon-svg_network {
  display: none;
}

.app-fatal_kind-update .app-fatal__icon-svg_update {
  display: block;
}

.app-fatal_kind-update .app-fatal__icon {
  background: color-mix(in srgb, var(--accent, #14b8a6) 14%, var(--surface-elevated, #1e2430));
  color: var(--accent, #14b8a6);
}

.app-fatal_kind-update .app-fatal__actions {
  display: none !important;
}

.app-fatal__update-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.app-fatal__update-actions.hidden {
  display: none;
}

.app-fatal__snooze {
  width: 100%;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md, 10px);
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted, #8b92a2);
  cursor: pointer;
}

.app-fatal__snooze:hover {
  color: var(--text, #d6dbe3);
  background: color-mix(in srgb, var(--text, #d6dbe3) 6%, transparent);
  border-color: var(--border, #2a3140);
}

.app-fatal__snooze:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent, #14b8a6));
  outline-offset: 2px;
}

.app-fatal__countdown {
  display: block;
  width: 100%;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md, 10px);
  border: 1px solid color-mix(in srgb, var(--accent, #14b8a6) 28%, var(--border, #2a3140));
  background: color-mix(in srgb, var(--accent, #14b8a6) 6%, var(--surface-elevated, #1e2430));
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #d6dbe3);
  text-align: center;
  cursor: pointer;
}

.app-fatal__countdown:hover {
  border-color: color-mix(in srgb, var(--accent, #14b8a6) 55%, var(--border, #2a3140));
}

.app-fatal__countdown:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent, #14b8a6));
  outline-offset: 2px;
}

.app-fatal__countdown:disabled {
  cursor: wait;
  opacity: 0.85;
}

.app-fatal__countdown-num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  font-size: 1.125rem;
  color: var(--accent, #14b8a6);
}

.app-fatal__headings {
  min-width: 0;
}

.app-fatal__title {
  margin: 0 0 var(--space-1);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
  color: var(--text, #d6dbe3);
}

.app-fatal__message {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  text-wrap: pretty;
  color: var(--text-muted, #8b92a2);
}

.app-fatal__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.app-fatal__action {
  width: 100%;
  min-height: 2.75rem;
}

.app-fatal__details {
  margin-top: var(--space-1);
  border-top: 1px solid var(--border, #2a3140);
  padding-top: var(--space-3);
}

.app-fatal__details-summary {
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text, #d6dbe3);
  list-style: none;
}

.app-fatal__details-summary::-webkit-details-marker {
  display: none;
}

.app-fatal__details-summary::before {
  content: "▸ ";
  color: var(--text-muted, #8b92a2);
}

.app-fatal__details[open] .app-fatal__details-summary::before {
  content: "▾ ";
}

.app-fatal__details-summary:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent, #14b8a6));
  outline-offset: 2px;
  border-radius: var(--radius-sm, 6px);
}

.app-fatal__technical {
  margin: var(--space-3) 0 var(--space-2);
  padding: var(--space-3);
  max-height: 11rem;
  overflow: auto;
  border-radius: var(--radius-md, 10px);
  border: 1px solid var(--border, #2a3140);
  background: var(--bg, #0f1215);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted, #8b92a2);
}

.app-fatal__copy {
  margin-top: 0;
  min-height: 2.75rem;
}

.app-fatal__copy:focus-visible,
.app-fatal__action:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent, #14b8a6));
  outline-offset: 2px;
}

@media (min-width: 480px) {
  .app-fatal__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .app-fatal__action {
    width: auto;
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-boot-loading__spinner {
    animation: none;
    border-top-color: color-mix(in srgb, var(--accent, #14b8a6) 22%, transparent);
  }

  #app-boot-loading.app-boot-loading,
  #app-fatal-overlay.app-fatal {
    transition: none;
  }
}

.app-login__card {
  width: 100%;
  max-width: min(90vw, 22rem);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 12px 28px -8px rgba(0, 0, 0, 0.45),
    0 24px 48px -16px rgba(0, 0, 0, 0.4);
}

.app-login__card .dialog-user-create-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
  font-weight: 600;
}

.app-login__hint {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.app-login__error {
  margin: var(--space-2) 0 0;
}

/* Оверлей логина в index.html — стили в .login-card ниже */

/* === LOGIN PAGE REDESIGN (Reztsoff Style) === */

.login-page-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: #ffffff;
}

/* Brand Side */
.login-brand-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

.login-brand-side__pattern {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: 
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ff6600' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.login-brand {
  text-align: center;
  max-width: 400px;
}

.login-brand__title {
  font-family: 'Roboto', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: #212121;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.02em;
}

.login-brand__title-accent {
  color: #ff6600;
}

.login-brand__title-accent-secondary {
  color: #23aadd;
}

.login-brand__subtitle {
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  color: #424242;
  line-height: 1.5;
  margin: 0;
}

/* Form Side */
.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--bg);
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 28rem;
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
}

.login-card__header {
  margin-bottom: var(--space-6);
}

.login-card__header h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: #212121;
  font-family: 'Roboto', sans-serif;
}

.login-card__subtitle {
  margin: 0;
  font-size: var(--text-sm);
  color: #424242;
  line-height: 1.5;
}

/* Login Form - using design system form-field styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Form fields - matching design system */
.login-form .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.login-form .form-field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #212121;
  letter-spacing: 0.01em;
  font-family: 'Roboto', sans-serif;
}

.login-form .form-field input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: 'Roboto', sans-serif;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #424242;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form .form-field input::placeholder {
  color: #9e9e9e;
}

.login-form .form-field input:hover {
  border-color: #bdbdbd;
}

.login-form .form-field input:focus {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.1);
}

/* TOTP Field — всегда видим (#app-login-totp-wrap без отдельного layout) */

#app-login-totp {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  letter-spacing: 0.15em;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#app-login-totp:focus {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.1);
}

/* Validation states for TOTP input */
#app-login-totp:valid:not(:placeholder-shown) {
  border-color: var(--success);
}

#app-login-totp:invalid:not(:placeholder-shown) {
  border-color: var(--err);
}

.totp-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: #ff6600;
}

.form-field__hint {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: #424242;
  line-height: 1.4;
  text-align: center;
}

/* Error Message */
.login-error {
  margin: 0;
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: #d32f2f;
  background: #ffebee;
  border-radius: var(--radius-sm);
  border: 1px solid #d32f2f;
  line-height: 1.4;
}

.login-error.hidden {
  display: none;
}

/* Login Button with Loader */
.login-card__footer {
  margin-top: var(--space-4);
}

.btn-login {
  width: 100%;
  min-height: 2.75rem;
  padding: 16px 24px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: #ff6600;
  color: #ffffff;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 20px;
  border: none;
  border-radius: 1px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-login:hover {
  background: #23aadd;
}

.btn-login__loader {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spinner 0.6s linear infinite;
}

@keyframes btn-spinner {
  to { transform: rotate(360deg); }
}

.btn-login.is-loading .btn-login__text {
  opacity: 0.7;
}

.btn-login.is-loading .btn-login__loader {
  display: block;
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-login--secondary {
  width: 100%;
  min-height: 2.75rem;
  padding: 12px 24px;
  background: #ffffff;
  color: #424242;
  font-family: 'Roboto', sans-serif;
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.25;
  border: 1px solid #e0e0e0;
  border-radius: 1px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-login--secondary:hover {
  background: #f5f5f5;
  border-color: #bdbdbd;
  color: #212121;
}

.btn-login--secondary:focus-visible {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.1);
}

.btn-login--compact {
  min-height: 2.25rem;
  padding: 8px 16px;
  width: auto;
  flex-shrink: 0;
}

.login-card__footer--stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.login-passkey {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.login-passkey.hidden {
  display: none;
}

.login-passkey__divider {
  margin: 0;
  text-align: center;
  font-size: var(--text-xs);
  color: #9e9e9e;
  line-height: 1.4;
}

.login-passkey__divider span {
  display: inline-block;
  padding: 0 var(--space-2);
}

/* Диалог предложения passkey после входа по TOTP */
.dialog-passkey-offer__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-1);
}

.dialog-passkey-offer__lead {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-secondary, #bdbdbd);
}

.dialog-passkey-offer__list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-secondary, #bdbdbd);
}

.dialog-passkey-offer__list li + li {
  margin-top: var(--space-2);
}

.dialog-passkey-offer__note {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: #9e9e9e;
}

.dialog-passkey-offer__footer {
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-start;
}

.dialog-passkey-offer__footer .btn-primary,
.dialog-passkey-offer__footer .btn-login {
  flex: 1 1 auto;
  min-width: 10rem;
}

.login-card__subtitle.hidden {
  display: none;
}

/* Footnote */
.login-card__footnote {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

.login-card__footnote p {
  margin: 0;
  font-size: var(--text-xs);
  color: #9e9e9e;
  line-height: 1.55;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .login-page-wrapper {
    grid-template-columns: 1fr;
  }

  .login-brand-side {
    display: none;
  }

  .login-form-side {
    padding: var(--space-6);
  }

  .login-card {
    max-width: 28rem;
  }
}

@media (max-width: 640px) {
  .login-form-side {
    padding: var(--space-4);
    align-items: flex-start;
    padding-top: var(--space-10);
  }

  .login-card {
    padding: var(--space-6);
    max-width: 100%;
  }

  .login-card__header h2 {
    font-size: var(--text-xl);
  }
  
  .login-brand-side {
    padding: var(--space-4);
  }
  
  .login-brand__title {
    font-size: 2rem;
  }

  .login-card .login-enrollment__words,
  .login-card .login-enrollment__platform-grid {
    grid-template-columns: 1fr;
  }

}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn-login__loader {
    animation: none;
  }
}

.profile-sessions-wrap[aria-busy='true'] {
  opacity: 0.72;
  pointer-events: none;
}

.profile-sessions-list {
  margin-bottom: var(--space-4);
}

.profile-sessions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-session-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-elevated, var(--bg));
}

.profile-session-item_current {
  border-color: color-mix(in srgb, var(--accent, #5b8def) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #5b8def) 8%, var(--surface-elevated, var(--bg)));
}

.profile-session-item__icon {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-session-item__body {
  flex: 1;
  min-width: 0;
}

.profile-session-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.profile-session-item__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.profile-session-item__badge {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px var(--space-2);
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent, #5b8def) 22%, transparent);
  color: var(--accent, #7eb0ff);
}

.profile-session-item__details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-session-item__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 0;
}

.profile-session-item__meta-label {
  color: var(--text-muted);
}

.profile-session-item__meta-value {
  color: var(--text-muted);
}

.profile-session-item__ip-line {
  display: block;
}

.profile-session-item__ip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.profile-session-item__end {
  flex-shrink: 0;
  align-self: center;
}

.profile-sessions-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.profile-logout-btn {
  max-width: 16rem;
}

.profile-empty_compact {
  padding: var(--space-3) 0;
}

/* Общие стили модальных окон (унификация по doc/web-client-modals.md): контейнер, backdrop, анимация */
.dialog-user-create,
.dialog-task-create,
.dialog-task-view,
.dialog-work-type-create,
.dialog-subdivision-create,
.dialog-brigade-create,
.dialog-individual-create,
.dialog-organization-create,
.dialog-position-create,
.dialog-employee-create,
.dialog-contract-create,
.shipments-cargo-dialog {
  max-width: min(90vw, 26rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 24px -8px rgba(0, 0, 0, 0.45),
    0 24px 48px -16px rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  opacity: 0;
  transform: scale(0.97) translateY(-8px);
}
.dialog-user-create[open],
.dialog-task-create[open],
.dialog-task-view[open],
.dialog-work-type-create[open],
.dialog-subdivision-create[open],
.dialog-brigade-create[open],
.dialog-individual-create[open],
.dialog-organization-create[open],
.dialog-position-create[open],
.dialog-employee-create[open],
.dialog-contract-create[open],
.shipments-cargo-dialog[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
}
.dialog-user-create::backdrop,
.dialog-task-create::backdrop,
.dialog-task-view::backdrop,
.dialog-work-type-create::backdrop,
.dialog-subdivision-create::backdrop,
.dialog-brigade-create::backdrop,
.dialog-individual-create::backdrop,
.dialog-organization-create::backdrop,
.dialog-position-create::backdrop,
.dialog-employee-create::backdrop,
.dialog-contract-create::backdrop,
.shipments-cargo-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s ease, backdrop-filter 0.2s ease;
}
.dialog-user-create[open]::backdrop,
.dialog-task-create[open]::backdrop,
.dialog-task-view[open]::backdrop,
.dialog-work-type-create[open]::backdrop,
.dialog-subdivision-create[open]::backdrop,
.dialog-brigade-create[open]::backdrop,
.dialog-individual-create[open]::backdrop,
.dialog-organization-create[open]::backdrop,
.dialog-position-create[open]::backdrop,
.dialog-employee-create[open]::backdrop,
.dialog-contract-create[open]::backdrop,
.shipments-cargo-dialog[open]::backdrop {
  @starting-style {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}
/* Шапка, заголовок, кнопка закрытия (×) — единый стиль для всех модалок */
.dialog-user-create-header,
.dialog-task-create-header,
.dialog-task-view-header,
.dialog-work-type-create-header,
.dialog-subdivision-create-header,
.dialog-brigade-create-header,
.dialog-individual-create-header,
.dialog-organization-create-header,
.dialog-position-create-header,
.dialog-employee-create-header,
.dialog-contract-create-header,
.shipments-cargo-dialog-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-2);
}
.dialog-user-create-title,
.dialog-task-create-title,
.dialog-task-view-title,
.dialog-work-type-create-title,
.dialog-subdivision-create-title,
.dialog-brigade-create-title,
.dialog-individual-create-title,
.dialog-organization-create-title,
.dialog-position-create-title,
.dialog-employee-create-title,
.dialog-contract-create-title,
.shipments-cargo-dialog-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.dialog-user-create-close-icon,
.dialog-task-create-close-icon,
.dialog-task-view-close-icon,
.dialog-work-type-create-close-icon,
.dialog-subdivision-create-close-icon,
.dialog-brigade-create-close-icon,
.dialog-individual-create-close-icon,
.dialog-organization-create-close-icon,
.dialog-position-create-close-icon,
.dialog-employee-create-close-icon,
.dialog-contract-create-close-icon,
.shipments-cargo-dialog-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background-color: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dialog-user-create-close-icon:hover,
.dialog-task-create-close-icon:hover,
.dialog-task-view-close-icon:hover,
.dialog-work-type-create-close-icon:hover,
.dialog-subdivision-create-close-icon:hover,
.dialog-brigade-create-close-icon:hover,
.dialog-individual-create-close-icon:hover,
.dialog-organization-create-close-icon:hover,
.dialog-position-create-close-icon:hover,
.dialog-employee-create-close-icon:hover,
.dialog-contract-create-close-icon:hover,
.shipments-cargo-dialog-close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}
.dialog-user-create-close-icon:focus-visible,
.dialog-task-create-close-icon:focus-visible,
.dialog-task-view-close-icon:focus-visible,
.dialog-work-type-create-close-icon:focus-visible,
.dialog-subdivision-create-close-icon:focus-visible,
.dialog-brigade-create-close-icon:focus-visible,
.dialog-individual-create-close-icon:focus-visible,
.dialog-organization-create-close-icon:focus-visible,
.dialog-position-create-close-icon:focus-visible,
.dialog-employee-create-close-icon:focus-visible,
.dialog-contract-create-close-icon:focus-visible,
.shipments-cargo-dialog-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Тело и футер модалок — единые отступы (кроме dialog-task-create: см. design-system.css) */
.dialog-user-create-body,
.dialog-work-type-create-body,
.dialog-subdivision-create-body,
.dialog-brigade-create-body,
.dialog-individual-create-body,
.dialog-organization-create-body,
.dialog-position-create-body,
.dialog-employee-create-body,
.dialog-contract-create-body,
.shipments-cargo-dialog-body {
  padding: var(--space-3) var(--space-5) var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.shipments-cargo-dialog-body {
  display: block;
  overflow: auto;
  max-height: min(70vh, 28rem);
}
.dialog-user-create-inner,
.dialog-work-type-create-inner,
.dialog-subdivision-create-inner,
.dialog-organization-create-inner,
.dialog-position-create-inner,
.dialog-employee-create-inner,
.dialog-contract-create-inner,
.shipments-cargo-dialog-inner {
  overflow: hidden;
  border-radius: inherit;
}

/* Модалка «Груз» перевозки: шире под таблицу, типографика и цвета под тёмную тему */
.shipments-cargo-dialog {
  max-width: min(90vw, 42rem);
  color: var(--text);
  background: var(--surface);
  font-family: var(--font-sans);
}
.shipments-cargo-dialog-inner {
  color: inherit;
  background: inherit;
}
.shipments-cargo-dialog-body {
  color: var(--text);
}
.shipments-cargo-dialog-body > p {
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.shipments-cargo-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  color: var(--text);
}
.shipments-cargo-table th,
.shipments-cargo-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
/* Первая колонка (Марка) — в одну строку, ширина по самой длинной марке */
.shipments-cargo-table th:first-child,
.shipments-cargo-table td:first-child {
  white-space: nowrap;
}
/* Колонки веса — минимальная ширина, чтобы не обрезались */
.shipments-cargo-table th:nth-child(3),
.shipments-cargo-table td:nth-child(3) {
  min-width: 7rem;
}
.shipments-cargo-table th:nth-child(4),
.shipments-cargo-table td:nth-child(4) {
  min-width: 6rem;
}
.shipments-cargo-table th {
  color: var(--text-muted);
  font-weight: 500;
}
.shipments-cargo-table tbody td {
  color: var(--text);
}
.shipments-cargo-table tfoot td {
  border-bottom: none;
  border-top: 2px solid var(--border);
  font-weight: 600;
  color: var(--text);
  background: transparent;
}
.shipments-cargo-btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.shipments-cargo-btn:hover {
  background: var(--accent);
  color: var(--text);
}
.shipments-cargo-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Таблица перевозок: сортировка по клику на заголовок */
#shipments-list .shipments-table {
  width: 100%;
}
#shipments-list .shipments-table th {
  padding: 0;
  vertical-align: middle;
}
#shipments-list .shipments-table .shipments-th-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 100%;
  padding: var(--space-3) var(--space-4);
  margin: 0;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition), background var(--transition);
}
#shipments-list .shipments-table .shipments-th-sort:hover {
  color: var(--text);
  background: var(--surface-hover);
}
#shipments-list .shipments-table .shipments-th-sort:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: -2px;
}
#shipments-list .shipments-table .shipments-th-sort[aria-sort="ascending"],
#shipments-list .shipments-table .shipments-th-sort[aria-sort="descending"] {
  color: var(--accent);
}
/* Иконки сортировки — inline SVG (как крестик закрытия модалок и сброс фильтра на марках), без зависимости от шрифта */
#shipments-list .shipments-table .shipments-th-sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.6;
}
#shipments-list .shipments-table .shipments-th-sort[aria-sort="ascending"] .shipments-th-sort-icon,
#shipments-list .shipments-table .shipments-th-sort[aria-sort="descending"] .shipments-th-sort-icon {
  opacity: 1;
}
#shipments-list .shipments-table .shipments-th-sort-icon svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
#shipments-list .shipments-table .shipments-th-sort-icon svg[fill="currentColor"] {
  fill: currentColor;
}
#shipments-list .shipments-table .shipments-th-sort-icon svg[stroke="currentColor"] {
  stroke: currentColor;
}

/* === shipments-registry (Module Panel Pattern §3) === */
.panel-body_shipments-registry {
  padding-top: var(--space-4);
}

.shipments-registry {
  --sr-control-height: 44px;
  --sr-control-radius: var(--radius-md);
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.shipments-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shipments-registry__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .shipments-registry__stats {
    grid-template-columns: 1fr;
  }
}

.shipments-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.shipments-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.shipments-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.shipments-registry .panel-toolbar {
  flex-wrap: wrap;
  margin: 0;
  gap: var(--space-2);
}

.shipments-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  width: 100%;
}

.shipments-registry__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.shipments-registry__field_project {
  flex: 0 1 14rem;
  min-width: 10rem;
}

.shipments-registry__field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.45;
}

.shipments-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--sr-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--sr-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.shipments-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.shipments-registry__refresh-btn {
  min-height: var(--sr-control-height);
  padding: 0 var(--space-4);
  white-space: nowrap;
}

.shipments-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
}

.shipments-registry .shipments-search-wrap {
  width: var(--sr-control-height);
}

.shipments-registry .shipments-search-wrap.expanded,
.shipments-registry .shipments-search-wrap:focus-within {
  width: min(16rem, 100%);
  max-width: 100%;
}

.shipments-registry .shipments-search-toggle {
  width: var(--sr-control-height);
  height: var(--sr-control-height);
  min-width: var(--sr-control-height);
  min-height: var(--sr-control-height);
}

.shipments-registry .shipments-search-input {
  min-height: var(--sr-control-height);
}

.shipments-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.shipments-registry__pane-head {
  margin: 0;
}

.shipments-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

.shipments-registry__table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.shipments-registry__list-host {
  min-width: 0;
}

.shipments-registry__list-foot {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.shipments-registry__cell-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
}

.shipments-registry__cell-muted {
  color: var(--text-muted);
}

.shipments-registry__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.shipments-registry__empty-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.shipments-registry__empty-hint {
  margin: 0;
  max-width: 36ch;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

.shipments-registry__error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
  border-radius: var(--radius-md);
  background: var(--err-muted);
}

.shipments-registry__error-text {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--err);
}

#shipments-list .shipments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

#shipments-list .shipments-table tbody tr:nth-child(odd) {
  background: var(--surface);
}

#shipments-list .shipments-table tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

#shipments-list .shipments-table tbody tr:hover {
  background: var(--surface-hover);
}

#shipments-list .shipments-table th,
#shipments-list .shipments-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

#shipments-list .shipments-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elevated);
  box-shadow: 0 1px 0 var(--border);
}

@media (max-width: 40rem) {
  .shipments-registry__toolbar-search {
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: stretch;
  }

  .shipments-registry .shipments-search-wrap,
  .shipments-registry .shipments-search-wrap.expanded,
  .shipments-registry .shipments-search-wrap:focus-within {
    width: 100%;
  }
}

.dialog-user-create-footer,
.dialog-task-create-footer,
.dialog-work-type-create-footer,
.dialog-subdivision-create-footer,
.dialog-brigade-create-footer,
.dialog-individual-create-footer,
.dialog-organization-create-footer,
.dialog-organization-create-actions,
.dialog-position-create-footer,
.dialog-employee-create-footer,
.dialog-contract-create-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-4);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

/* === Универсальная сетка форм сущностей документооборота === */
.docflow-entity-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: start;
  width: 100%;
}

.docflow-entity-form-grid .docflow-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  min-width: 0;
}

.docflow-entity-form-grid .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  min-width: 0;
}

.docflow-entity-form-grid .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.docflow-entity-form-grid .form-field input:not([type='checkbox']),
.docflow-entity-form-grid .form-field select {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--field-height, 2.75rem);
  height: var(--field-height, 2.75rem);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.docflow-entity-form-grid .form-field input:not([type='checkbox']):hover,
.docflow-entity-form-grid .form-field select:hover {
  border-color: var(--border-muted);
}

.docflow-entity-form-grid .form-field input:not([type='checkbox']):focus,
.docflow-entity-form-grid .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.docflow-entity-form-grid .docflow-form-field--full,
.docflow-entity-form-grid .docflow-field-hint,
.docflow-entity-form-grid .docflow-form-field:has(.docflow-switch),
.docflow-entity-form-grid .docflow-form-field:has(.docflow-form-checklist),
.docflow-entity-form-grid .docflow-form-field:has(.director-sections-fieldset) {
  grid-column: 1 / -1;
}

.docflow-create-fields:not([hidden]) {
  display: contents;
}

.docflow-create-fields[hidden] {
  display: none;
}

.docflow-form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.docflow-form-control,
.docflow-entity-form-grid .docflow-form-field input:not([type='checkbox']),
.docflow-entity-form-grid .docflow-form-field select {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--field-height, 2.75rem);
  height: var(--field-height, 2.75rem);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.docflow-form-control::placeholder,
.docflow-entity-form-grid input::placeholder {
  color: var(--text-muted);
}

.docflow-form-control:hover,
.docflow-entity-form-grid .docflow-form-field input:not([type='checkbox']):hover,
.docflow-entity-form-grid .docflow-form-field select:hover {
  border-color: var(--border-muted);
}

.docflow-form-control:focus,
.docflow-entity-form-grid .docflow-form-field input:not([type='checkbox']):focus,
.docflow-entity-form-grid .docflow-form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.docflow-form-control:disabled,
.docflow-entity-form-grid .docflow-form-field input:disabled,
.docflow-entity-form-grid .docflow-form-field select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.docflow-form-hint {
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

.docflow-form-error {
  display: block;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--err);
}

.docflow-entity-form-grid .docflow-switch,
.docflow-entity-form-grid .docflow-switch--segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  width: 100%;
}

.docflow-entity-form-grid .docflow-switch-btn {
  box-sizing: border-box;
  min-height: var(--field-height, 2.75rem);
  height: var(--field-height, 2.75rem);
  padding: 0 var(--space-3);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.docflow-form-checklist,
.docflow-entity-form-grid .director-sections-fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 12rem;
  overflow-y: auto;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  margin: 0;
}

.docflow-entity-form-grid .director-sections-legend {
  padding: 0;
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.docflow-entity-form-grid .director-sections-checkboxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: none;
  overflow: visible;
}

.docflow-form-checklist__item,
.docflow-entity-form-grid .director-section-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--field-height, 2.75rem);
  padding: 0 var(--space-2);
  margin: 0;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  cursor: pointer;
  transition: background var(--transition);
}

.docflow-form-checklist__item:hover,
.docflow-entity-form-grid .director-section-checkbox-label:hover {
  background: var(--surface-hover);
}

.docflow-form-checklist__item input[type='checkbox'],
.docflow-entity-form-grid .director-section-checkbox-label input[type='checkbox'] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.docflow-form-checklist__empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.docflow-field-hint {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.docflow-field-hint--info {
  color: var(--text-muted);
}

.docflow-field-hint--warn {
  color: var(--warn);
  background: var(--warn-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .docflow-entity-form-grid {
    grid-template-columns: 1fr;
  }
}

#dialog-docflow-site-create,
#dialog-docflow-site-profile {
  width: min(96vw, 72rem);
  max-width: min(96vw, 72rem);
}

#dialog-docflow-site-create .dialog-employee-card__inner,
#dialog-docflow-site-profile .dialog-employee-card__inner {
  max-height: min(92vh, 46rem);
}

@media (max-width: 640px) {
  #dialog-docflow-site-create,
  #dialog-docflow-site-profile {
    width: 96vw;
    max-width: 96vw;
  }
}

/* === Модалка создания (#dialog-docflow-create) === */
.dialog-docflow-create-footer {
  justify-content: space-between;
}

.dialog-docflow-create-footer .btn-secondary {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: var(--field-height, 2.75rem);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.dialog-docflow-create-footer .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-muted);
}

.dialog-docflow-create-footer .btn-primary {
  min-height: var(--field-height, 2.75rem);
}

.dialog-organization-create-footer .btn-secondary,
.dialog-organization-create-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-height, 2.75rem);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dialog-organization-create-footer .btn-secondary:hover,
.dialog-organization-create-actions .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-muted);
}

.dialog-organization-create-footer .btn-secondary:focus-visible,
.dialog-organization-create-actions .btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dialog-user-create-footer .btn-primary,
.dialog-task-create-footer .btn-primary,
.dialog-work-type-create-footer .btn-primary,
.dialog-subdivision-create-footer .btn-primary,
.dialog-brigade-create-footer .btn-primary,
.dialog-individual-create-footer .btn-primary,
.dialog-organization-create-footer .btn-primary,
.dialog-organization-create-actions .btn-primary,
.dialog-position-create-footer .btn-primary,
.dialog-employee-create-footer .btn-primary,
.dialog-contract-create-footer .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-height, 2.75rem);
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.dialog-user-create-footer .btn-primary:hover,
.dialog-task-create-footer .btn-primary:hover,
.dialog-work-type-create-footer .btn-primary:hover,
.dialog-subdivision-create-footer .btn-primary:hover,
.dialog-brigade-create-footer .btn-primary:hover,
.dialog-individual-create-footer .btn-primary:hover,
.dialog-organization-create-footer .btn-primary:hover,
.dialog-organization-create-actions .btn-primary:hover,
.dialog-position-create-footer .btn-primary:hover,
.dialog-employee-create-footer .btn-primary:hover,
.dialog-contract-create-footer .btn-primary:hover {
  background: var(--accent-hover);
}
.dialog-user-create-footer .btn-primary:focus-visible,
.dialog-task-create-footer .btn-primary:focus-visible,
.dialog-work-type-create-footer .btn-primary:focus-visible,
.dialog-subdivision-create-footer .btn-primary:focus-visible,
.dialog-brigade-create-footer .btn-primary:focus-visible,
.dialog-individual-create-footer .btn-primary:focus-visible,
.dialog-organization-create-footer .btn-primary:focus-visible,
.dialog-organization-create-actions .btn-primary:focus-visible,
.dialog-position-create-footer .btn-primary:focus-visible,
.dialog-employee-create-footer .btn-primary:focus-visible,
.dialog-contract-create-footer .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === Чекбоксы направлений деятельности (директор / прораб) === */
.director-sections-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}
.director-sections-legend {
  font-weight: 600;
  color: var(--text);
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
}
.director-sections-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-1) var(--space-2);
}
.director-sections-checkboxes .director-section-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--field-height-sm, 36px);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  margin: 0;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.director-section-checkbox-label:hover {
  background: var(--surface-hover);
}

.director-sections-checkboxes .director-section-checkbox-label input[type='checkbox'] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.director-sections-checkboxes .director-section-checkbox-label input[type='checkbox']:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 2px;
}

/* Диалог создания задачи: legacy-темы (new-dark/new-light — design-system.css). */
/* Форма создания задачи: тот же стиль и типографика, что и у формы проекта (doc/web-client-modals.md) */

/* Панель дерева марок по проекту — всегда видима справа от формы. */

/* Табличная часть формы создания задачи */

/* Дерево подбора марок: заголовок группы и отступ пунктов */

/* Диалог просмотра задачи: в общей теме сервиса — типографика и цвета */
.dialog-task-view {
  max-width: min(90vw, 32rem);
  color: var(--text);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}
.dialog-task-view-inner {
  overflow: hidden;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  color: inherit;
  background: inherit;
}
.dialog-task-view-body {
  padding: var(--space-3) var(--space-5) var(--space-4);
  flex: 1;
  overflow-y: auto;
  color: var(--text);
}
.dialog-task-view-body > p {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  color: var(--text);
}
.dialog-task-view-body > p:last-child {
  margin-bottom: 0;
}
.dialog-task-view-body strong {
  font-weight: 600;
  color: var(--text-muted);
}
.dialog-task-view-body p.err {
  color: var(--err);
  background: var(--err-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--err);
}
.dialog-task-view-body .dialog-task-view-meta {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-muted);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.dialog-task-view-body .dialog-task-view-meta code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  word-break: break-all;
}
.dialog-task-view-footer {
  display: none;
}
.dialog-task-view-footer:not(:empty) {
  display: block;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Блок решения прораба */
.dialog-task-view-proj-manager-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.dialog-task-view-proj-manager-label {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.dialog-task-view-proj-manager-buttons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Кнопки решения прораба — семантические состояния */
.dialog-task-view-proj-manager-buttons .btn-decision {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  line-height: var(--leading-tight);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.dialog-task-view-proj-manager-buttons .btn-decision:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dialog-task-view-proj-manager-buttons .btn-decision-agree {
  background: var(--success-muted);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}
.dialog-task-view-proj-manager-buttons .btn-decision-agree:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.dialog-task-view-proj-manager-buttons .btn-decision-refuse {
  background: var(--err-muted);
  color: var(--err);
  border-color: rgba(239, 68, 68, 0.3);
}
.dialog-task-view-proj-manager-buttons .btn-decision-refuse:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.dialog-task-view-proj-manager-buttons .btn-decision-pause {
  background: var(--warn-muted);
  color: var(--warn);
  border-color: rgba(234, 179, 8, 0.3);
}
.dialog-task-view-proj-manager-buttons .btn-decision-pause:hover {
  background: rgba(234, 179, 8, 0.22);
  border-color: rgba(234, 179, 8, 0.5);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
}

/* Поле комментария в блоке решения прораба */
.dialog-task-view-proj-manager-actions .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.dialog-task-view-proj-manager-actions .form-field label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.01em;
}
.dialog-task-view-proj-comment {
  width: 100%;
  box-sizing: border-box;
  min-height: 4.5rem;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dialog-task-view-proj-comment::placeholder {
  color: var(--text-subtle);
}
.dialog-task-view-proj-comment:hover {
  border-color: var(--border-muted);
}
.dialog-task-view-proj-comment:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Ширина модалок создания: подразделение, вид работ, должность, бригада — 28rem; организация, пользователь — 32rem; физлицо — 36rem */
.dialog-subdivision-create,
.dialog-work-type-create,
.dialog-position-create,
.dialog-brigade-create {
  max-width: min(90vw, 28rem);
}
#dialog-warehouse.dialog-position-create.warehouses-dialog {
  max-width: 100dvw;
  width: 100dvw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border-radius: 0;
}
.dialog-organization-create {
  max-width: min(90vw, 32rem);
}
.dialog-user-create {
  max-width: min(95vw, 28rem);
  width: min(95vw, 28rem);
}
.dialog-individual-create {
  max-width: min(90vw, 36rem);
}

/* Формы подразделения, бригады и пользователя: тот же стиль и типографика, что и у формы проекта (doc/web-client-modals.md) */
.dialog-subdivision-create-body,
.dialog-brigade-create-body,
.dialog-user-create-body,
.dialog-work-type-create-body {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--space-3);
}

/* Тело диалога редактирования пользователя — скролл если много полей */
#dialog-user-edit .dialog-user-create-body {
  max-height: min(55vh, 22rem);
  overflow-y: auto;
}

/* Инфо-карточка пользователя: единый grid (dl), header span на обе колонки + разделитель */
.dialog-user-edit-info__detail-value--copy:hover {
  color: var(--accent);
}
@media (max-width: 360px) {
  .dialog-user-edit-info__details {
    grid-template-columns: 1fr;
    gap: var(--space-1) 0;
  }
}


/* Группа полей формы (Логин, Имя, Роль) — карточка, как у info */

.form-subdivision-create-stack,
.form-brigade-create-stack {
  display: flex;
  flex-direction: column;
}
.form-subdivision-create-stack .form-field,
.form-brigade-create-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-brigade-create-stack .form-field-checkbox {
  justify-content: center;
}
.form-brigade-create-stack .form-field-checkbox label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-weight: 500;
}
.form-subdivision-create-stack .form-field label,
.form-brigade-create-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-subdivision-create-stack .form-field input,
.form-subdivision-create-stack .form-field select,
.form-brigade-create-stack .form-field input,
.form-brigade-create-stack .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-subdivision-create-stack .form-field input::placeholder,
.form-brigade-create-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-subdivision-create-stack .form-field input:hover,
.form-subdivision-create-stack .form-field select:hover,
.form-brigade-create-stack .form-field input:hover,
.form-brigade-create-stack .form-field select:hover {
  border-color: var(--border-muted);
}
.form-subdivision-create-stack .form-field input:focus,
.form-subdivision-create-stack .form-field select:focus,
.form-brigade-create-stack .form-field input:focus,
.form-brigade-create-stack .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Форма создания пользователя: те же стили полей */
.form-user-create-stack {
  display: flex;
  flex-direction: column;
}
.form-user-create-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-user-create-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-user-create-stack .form-field input,
.form-user-create-stack .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-user-create-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-user-create-stack .form-field input:hover,
.form-user-create-stack .form-field select:hover {
  border-color: var(--border-muted);
}
.form-user-create-stack .form-field input:focus,
.form-user-create-stack .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Форма создания вида работ: те же стили полей */
.form-work-type-create-stack {
  display: flex;
  flex-direction: column;
}
.form-work-type-create-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-work-type-create-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-work-type-create-stack .form-field input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-work-type-create-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-work-type-create-stack .form-field input:hover {
  border-color: var(--border-muted);
}
.form-work-type-create-stack .form-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Форма создания физлица: те же стили полей, тело — два столбца (grid) */
.form-individual-create-stack {
  display: flex;
  flex-direction: column;
}
.dialog-individual-create-body.form-individual-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
}
@media (max-width: 480px) {
  .dialog-individual-create-body.form-individual-create-grid {
    grid-template-columns: 1fr;
  }
}
.form-individual-create-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-individual-create-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-individual-create-stack .form-field input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-individual-create-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-individual-create-stack .form-field input:hover {
  border-color: var(--border-muted);
}
.form-individual-create-stack .form-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Форма создания/редактирования организации: колонка полей, те же стили что у пользователя/подразделения */
.dialog-organization-create .dialog-organization-create-body {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.form-organization-create-stack {
  display: flex;
  flex-direction: column;
}
.form-organization-create-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-organization-create-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-organization-create-stack .form-field input,
.form-organization-create-stack .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-organization-create-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-organization-create-stack .form-field input:hover,
.form-organization-create-stack .form-field select:hover {
  border-color: var(--border-muted);
}
.form-organization-create-stack .form-field input:focus,
.form-organization-create-stack .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Блок «Заполнить по ИНН из Checko» в модалке создания организации */
.organization-create-checko {
  padding: var(--space-3);
  margin: 0 0 var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.organization-create-checko-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.organization-create-checko-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.organization-create-checko-row label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}
.organization-create-checko-row input {
  width: 8rem;
  min-width: 6rem;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
}
.organization-create-checko-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}
.organization-create-checko-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.organization-create-checko-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-muted);
}
.organization-create-checko-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Формы складов (создание/редактирование): колонка полей, те же стили что у организации */
.form-warehouse-stack .dialog-position-create-body {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.form-warehouse-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-warehouse-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-warehouse-stack .form-field input,
.form-warehouse-stack .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-warehouse-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-warehouse-stack .form-field input:hover,
.form-warehouse-stack .form-field select:hover {
  border-color: var(--border-muted);
}
.form-warehouse-stack .form-field input:focus,
.form-warehouse-stack .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}
.form-warehouse-stack .form-field-checkbox {
  justify-content: center;
}
.form-warehouse-stack .form-field-checkbox label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-weight: 500;
}
.form-warehouse-stack .form-field-checkbox input[type="checkbox"] {
  width: auto;
  min-height: auto;
  padding: 0;
  margin: 0;
}

/* Формы сотрудников (приём/редактирование): колонка полей */
.form-employee-stack .dialog-employee-create-body {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.form-employee-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-employee-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-employee-stack .form-field input,
.form-employee-stack .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-employee-stack .form-field input::placeholder {
  color: var(--text-subtle);
}
.form-employee-stack .form-field input:hover,
.form-employee-stack .form-field select:hover {
  border-color: var(--border-muted);
}
.form-employee-stack .form-field input:focus,
.form-employee-stack .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Поля формы внутри body (form-inline) */
.dialog-subdivision-create-body .form-inline,
.dialog-brigade-create-body .form-inline,
.dialog-user-create-body .form-inline,
.dialog-work-type-create-body .form-inline,
.dialog-organization-create-body .form-inline,
.dialog-position-create-body .form-inline,
.dialog-employee-create-body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
/* Блок выбора работников при создании бригады (fieldset + чекбоксы) */
.dialog-brigade-create .brigade-create-workers-fieldset {
  width: 100%;
  margin: 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: color-mix(in oklab, var(--bg-elevated) 90%, transparent);
}
.dialog-brigade-create .brigade-create-workers-fieldset legend {
  padding: 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}
.dialog-brigade-create .brigade-create-workers-list {
  max-height: 12rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-1);
}
.dialog-brigade-create .brigade-create-workers-list label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: normal;
  font-size: var(--text-sm);
  color: var(--text);
}
/* Чекбоксы списка работников: компактный размер по best practice (M 16px, Intergalactic/PatternFly), весь label кликабелен */
.dialog-brigade-create .brigade-create-workers-list input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  border-radius: var(--radius-sm);
  /* Уменьшаем визуальный размер, если браузер рисует крупно; кликабельная область — весь label */
  transform: scale(0.875);
  transform-origin: left center;
}
.dialog-brigade-create .brigade-create-workers-list label:hover {
  color: var(--text);
}

/* Диалог истории инстанса: единый стиль по doc/web-client-modals.md (backdrop blur, анимация, шапка с ×) */
.marks-instance-history-dialog {
  max-width: min(90vw, 28rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 24px -8px rgba(0, 0, 0, 0.45),
    0 24px 48px -16px rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  opacity: 0;
  transform: scale(0.97) translateY(-8px);
}
.marks-instance-history-dialog[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
}
.marks-instance-history-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.marks-instance-history-inner {
  overflow: hidden;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
}
.marks-instance-history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-2);
}
.marks-instance-history-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.marks-instance-history-close.marks-instance-history-close-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background-color: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.marks-instance-history-close.marks-instance-history-close-icon:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}
.marks-instance-history-close.marks-instance-history-close-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.marks-instance-history-body {
  padding: var(--space-3) var(--space-5) var(--space-3);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.marks-instance-history-body .marks-instance-history-list {
  margin: 0;
  padding-left: var(--space-6);
  max-height: 20rem;
  overflow-y: auto;
}
.marks-instance-history-body .marks-instance-history-list li {
  margin-bottom: var(--space-2);
}
.marks-instance-history-body .marks-instance-history-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Диалог 3D-вьювера: единый стиль по doc/web-client-modals.md (backdrop blur, анимация, --radius-xl) */
.marks-viewer-3d-dialog {
  width: min(95vw, 960px);
  height: min(85vh, 720px);
  max-width: none;
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 24px -8px rgba(0, 0, 0, 0.45),
    0 24px 48px -16px rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  opacity: 0;
  transform: scale(0.97) translateY(-8px);
}
.marks-viewer-3d-dialog[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
}
/* Развёрнутый на весь размер окна вкладки (кнопка «Развернуть на весь экран») */
.marks-viewer-3d-dialog.marks-viewer-3d-dialog--expanded {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
}
.marks-viewer-3d-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.marks-viewer-3d-inner {
  overflow: hidden;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.marks-viewer-3d-header {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.marks-viewer-3d-header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.marks-viewer-3d-fullscreen {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.marks-viewer-3d-fullscreen:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.marks-viewer-3d-fullscreen:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.marks-viewer-3d-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.marks-viewer-3d-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.marks-viewer-3d-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.marks-viewer-3d-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.marks-viewer-3d-iframe {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: none;
  display: block;
  /* Явно разрешаем pointer-events, чтобы клики/движение мыши доходили до canvas внутри (критично в Safari/iframe). */
  pointer-events: auto;
}

/* Карточка: список или форма */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.panel-body {
  padding: var(--space-4);
}

/* Диаграмма Ганта на вкладке «Задачи»: строки — бригады, ось X — даты (текущая ±5 дней) */
.tasks-gantt {
  padding: var(--space-4);
  margin-bottom: var(--space-6);
}
.tasks-gantt .gantt-header-row,
.tasks-gantt .gantt-row {
  display: grid;
  grid-template-columns: 184px repeat(11, minmax(52px, 1fr));
  gap: 1px;
  align-items: stretch;
}
.tasks-gantt .gantt-dates-header {
  margin-bottom: var(--space-2);
}
.tasks-gantt .gantt-corner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 32px;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.tasks-gantt .gantt-anchor-date {
  flex: 1 1 auto;
  min-width: 118px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-xs);
  padding: 2px 6px;
}
.tasks-gantt .gantt-anchor-today-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tasks-gantt .gantt-anchor-today-btn:hover,
.tasks-gantt .gantt-anchor-today-btn:focus-visible {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.tasks-gantt .gantt-day-header {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.tasks-gantt .gantt-shift-day-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), background var(--transition), border-color var(--transition);
}
.tasks-gantt .gantt-day-header-edge-left .gantt-shift-day-btn {
  left: 4px;
}
.tasks-gantt .gantt-day-header-edge-right .gantt-shift-day-btn {
  right: 4px;
}
.tasks-gantt .gantt-day-header-edge-left:hover .gantt-shift-day-btn,
.tasks-gantt .gantt-day-header-edge-right:hover .gantt-shift-day-btn,
.tasks-gantt .gantt-shift-day-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.tasks-gantt .gantt-shift-day-btn:hover,
.tasks-gantt .gantt-shift-day-btn:focus-visible {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.tasks-gantt .gantt-row-label {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
}
.tasks-gantt .gantt-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: var(--space-1);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  align-content: flex-start;
}
.tasks-gantt .gantt-bar {
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tasks-gantt .gantt-bar:hover {
  background: var(--accent-focus);
  border-color: var(--accent-hover);
}
.tasks-gantt .gantt-body .gantt-row + .gantt-row {
  margin-top: 2px;
}

/* Кнопки в панелях (не в шапке и не вкладки) */
.panel > button,
.panel .btn-upload {
  margin-bottom: 0;
}

.panel button:not(.tabs button):not(.header button):not(.foreman-ts__cell):not(.foreman-ts__guest-remove):not(.foreman-ts__th-sort-btn):not(.foreman-ts__th-filter):not(.docflow-files__download-btn):not(.project-th):not(.directors-board__th):not(.directors-board__th-filter):not(.directors-board__cell-value_clickable):not(.directors-board__cell-clear-btn):not(.directors-board__foreman-transfer-btn):not(.directors-board__clear-btn):not(.docflow-customers-registry__th):not(.organizations-registry__th):not(.positions-registry__th):not(.employees-registry__th):not(.employees-registry__th-filter):not(.users-registry__th):not(.users-registry__th-filter):not(.marks-registry__th):not(.marks-registry__th-filter):not(.idle-personnel__th):not(.idle-personnel__th-filter):not(.work-crews-registry__th):not(.work-crews-registry__th-filter):not(.work-crews-registry__filter-chip):not(.work-crews-registry__active-filters-clear-all):not(.work-crews-registry__bulk-toggle):not(.movements-registry__th):not(.movements-registry__th-filter):not(.movements-registry__filter-chip):not(.movements-registry__active-filters-clear-all):not(.projects-registry__th):not(.projects-registry__th-filter):not(.projects-registry__filter-chip):not(.projects-registry__active-filters-clear-all):not(.mount-reporting-registry__th):not(.mount-reporting-registry__th-filter):not(.mount-reporting-registry__filter-chip):not(.mount-reporting-registry__active-filters-clear-all):not(.docidx-registry__th-filter):not(.docidx-registry__filter-chip):not(.docidx-registry__active-filters-clear-all):not(.idle-personnel__kpi_btn):not(.idle-personnel__duration-chip):not(.idle-personnel__alert):not(.idle-personnel__longest-item):not(.idle-personnel__breakdown-row):not(.ts-sum__th-filter):not(.docflow-flat-th):not(.dialog-position-create-close-icon):not(.dialog-organization-create-close):not(.dialog-employee-create-close-icon):not(.dialog-user-create-close-icon):not(.btn-primary):not(.btn-secondary):not(.chats-toolbar-icon):not(.chats-filter-tab):not(.chats-tool-btn):not(.chats-send-submit):not(.chats-attach-btn):not(.chats-thread-back):not(.chats-sidebar-toggle):not(.chats-selection-delete):not(.chats-selection-cancel):not(.chats-thread-empty__cta):not(.chats-action-btn):not(.chats-helper-item):not(.chats-media-open-btn):not(.chats-composer-btn) {
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.panel button:not(.tabs button):not(.header button):not(.foreman-ts__cell):not(.foreman-ts__guest-remove):not(.foreman-ts__th-sort-btn):not(.foreman-ts__th-filter):not(.docflow-files__download-btn):not(.project-th):not(.directors-board__th):not(.directors-board__th-filter):not(.directors-board__cell-value_clickable):not(.directors-board__cell-clear-btn):not(.directors-board__foreman-transfer-btn):not(.directors-board__clear-btn):not(.docflow-customers-registry__th):not(.organizations-registry__th):not(.positions-registry__th):not(.employees-registry__th):not(.employees-registry__th-filter):not(.users-registry__th):not(.users-registry__th-filter):not(.marks-registry__th):not(.marks-registry__th-filter):not(.idle-personnel__th):not(.idle-personnel__th-filter):not(.work-crews-registry__th):not(.work-crews-registry__th-filter):not(.work-crews-registry__filter-chip):not(.work-crews-registry__active-filters-clear-all):not(.work-crews-registry__bulk-toggle):not(.movements-registry__th):not(.movements-registry__th-filter):not(.movements-registry__filter-chip):not(.movements-registry__active-filters-clear-all):not(.projects-registry__th):not(.projects-registry__th-filter):not(.projects-registry__filter-chip):not(.projects-registry__active-filters-clear-all):not(.mount-reporting-registry__th):not(.mount-reporting-registry__th-filter):not(.mount-reporting-registry__filter-chip):not(.mount-reporting-registry__active-filters-clear-all):not(.docidx-registry__th-filter):not(.docidx-registry__filter-chip):not(.docidx-registry__active-filters-clear-all):not(.idle-personnel__kpi_btn):not(.idle-personnel__duration-chip):not(.idle-personnel__alert):not(.idle-personnel__longest-item):not(.idle-personnel__breakdown-row):not(.ts-sum__th-filter):not(.docflow-flat-th):not(.dialog-position-create-close-icon):not(.dialog-organization-create-close):not(.dialog-employee-create-close-icon):not(.dialog-user-create-close-icon):not(.btn-primary):not(.btn-secondary):not(.chats-toolbar-icon):not(.chats-filter-tab):not(.chats-tool-btn):not(.chats-send-submit):not(.chats-attach-btn):not(.chats-thread-back):not(.chats-sidebar-toggle):not(.chats-selection-delete):not(.chats-selection-cancel):not(.chats-thread-empty__cta):not(.chats-action-btn):not(.chats-helper-item):not(.chats-media-open-btn):not(.chats-composer-btn):hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* Загрузка файла */
.btn-upload {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-upload:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* --- Формы --- */
.form-inline,
.form-block {
  margin-top: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.form-inline {
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  max-width: 100%;
}



.form-inline input,
.form-inline select,
.form-block input,

.form-inline input:focus,
.form-inline select:focus,
.form-block input:focus,
.form-block select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.form-inline button[type="submit"],
.form-block button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
}

.form-inline button[type="submit"]:hover,
.form-block button[type="submit"]:hover {
  background: var(--accent-hover);
}

/* --- Таблицы --- */
.panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--surface);
}

.panel thead {
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border);
}

.panel th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

.panel td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-muted);
}

/* Чередующиеся строки по теме */
.panel tbody tr:nth-child(odd) {
  background: var(--surface);
}
.panel tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

.panel tbody tr:hover {
  background: var(--surface-hover);
}

.panel tbody tr:last-child td {
  border-bottom: none;
}

.panel td button:not(.foreman-ts__cell):not(.foreman-ts__guest-remove) {
  margin-right: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
}

.panel td button.get { background: var(--accent); color: #fff; }
.panel td button.danger { background: var(--err); color: #fff; }
.panel td button.success { background: var(--success); color: #fff; }
.panel td button.warn { background: var(--warn); color: #fff; }

/* Пустые списки и сообщения об ошибках */
.panel #users-list p,
/* Редактирование описания проекта по двойному клику */
#projects-list .project-desc-edit {
  width: 100%;
  min-width: 0;
  padding: var(--space-1) var(--space-2);
  font-size: inherit;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  outline: none;
}
#projects-list .project-desc-cell {
  cursor: pointer;
}

/* Прогресс производства: бар 0–100%, цвет от серого к зелёному */
#projects-list .project-progress-cell {
  min-width: 6rem;
  vertical-align: middle;
}
#projects-list .project-progress-bar {
  background: var(--border-muted);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  min-width: 4rem;
}
#projects-list .project-progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent-muted), var(--accent));
  border-radius: 999px;
}

/* Ячейка «Номер проекта»: иконка глаза — absolute, не увеличивает высоту строки при появлении */
#projects-list .project-number-cell {
  position: relative;
  white-space: nowrap;
  padding-right: 2rem;
}
#projects-list .project-number-cell .bim-view-eye-container {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition), color var(--transition);
}
#projects-list .project-number-cell:hover .bim-view-eye-container {
  display: inline-flex;
}
#projects-list .bim-view-link.bim-view-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  font: inherit;
  color: var(--accent);
  background: transparent;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition), color var(--transition);
}
#projects-list .bim-view-link.bim-view-eye:hover {
  background-color: var(--bg-elevated);
  color: var(--accent);
}
#projects-list .bim-view-link.bim-view-eye:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#projects-list .bim-view-eye.bim-eye-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
  border-radius: var(--radius-sm);
}
#projects-list .bim-view-eye svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
#projects-list .bim-view-eye.bim-eye-disabled svg {
  filter: grayscale(1);
}
#projects-list .bim-view-eye.bim-eye-disabled::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 1px;
  background: currentColor;
  transform: rotate(-35deg);
  opacity: 0.8;
}
#projects-list .bim-view-eye-container .bim-view-link,
#projects-list .bim-view-eye-container .bim-view-eye.bim-eye-disabled {
  position: relative;
}

/* Чекбоксы выбора проектов: по умолчанию видны при наведении на строку; при выборе хотя бы одного — у всех строк */
#projects-list .project-checkbox-cell {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  padding: var(--space-1);
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
#projects-list .project-row-checkbox,
#projects-list .project-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
#projects-list tbody tr:hover .project-row-checkbox,
#projects-list .projects-table.projects-has-selection .project-row-checkbox,
#projects-list .projects-table.projects-has-selection .project-select-all-checkbox {
  opacity: 1;
}

.projects-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.projects-bulk-actions.hidden {
  display: none !important;
}

#brigades-list .brigade-checkbox-cell {
  width: 2.5rem;
  padding: var(--space-2);
  vertical-align: middle;
}
#brigades-list .brigade-row-checkbox,
#brigades-list .brigade-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
#brigades-list tbody tr:hover .brigade-row-checkbox,
#brigades-list .brigades-table.brigades-has-selection .brigade-row-checkbox,
#brigades-list .brigades-table.brigades-has-selection .brigade-select-all-checkbox {
  opacity: 1;
}

.brigades-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.brigades-bulk-actions.hidden {
  display: none !important;
}

#projects-list {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Таблица проектов — как референс directors-board */
#projects-list .projects-table {
  table-layout: fixed;
}

#projects-list .projects-table th,
#projects-list .projects-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}

#projects-list .projects-table thead th {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

#projects-list .projects-table tbody td {
  line-height: var(--leading-normal);
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#projects-list .projects-table tbody tr:nth-child(odd) {
  background: var(--surface);
}

#projects-list .projects-table tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

#projects-list .projects-table tbody tr:hover {
  background: var(--surface-hover);
}

#projects-list .projects-table tbody tr:last-child td {
  border-bottom: none;
}

/* Сортировщики и autofilter: chip + ▼ (эталон employees-registry). */
#panel-projects #projects-list .projects-registry__table thead th {
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

#panel-projects #projects-list .projects-registry__table thead th.projects-registry__checkbox-cell {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  padding: var(--space-1);
  text-align: center;
  box-sizing: border-box;
}

#panel-projects #projects-list .projects-registry__table thead th.projects-registry__th-cell:not(.projects-registry__checkbox-cell) {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

#panel-projects .projects-registry__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

#panel-projects .projects-registry__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

#panel-projects .projects-registry__th-chip:has(.projects-registry__th-filter_active) {
  border-color: var(--accent);
}

#panel-projects .projects-registry__th-chip .projects-registry__th,
#panel-projects .projects-registry__th-chip .projects-registry__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#panel-projects .projects-registry__th-chip .projects-registry__th {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

#panel-projects .projects-registry__th {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    background var(--transition),
    border-color var(--transition);
}

#panel-projects .projects-registry__th:hover {
  background: transparent;
}

#panel-projects .projects-registry__th[aria-pressed='true'] {
  background: transparent;
}

#panel-projects .projects-registry__th:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

#panel-projects .projects-registry__th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-subtle);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

#panel-projects .projects-registry__th:hover .projects-registry__th-label {
  color: var(--accent-hover);
}

#panel-projects .projects-registry__th[aria-pressed='true'] .projects-registry__th-label {
  color: var(--accent);
  font-weight: 700;
}

#panel-projects .projects-registry__th-sort {
  flex: 0 0 auto;
  font-size: 0.625rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

#panel-projects .projects-registry__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--transition);
}

#panel-projects .projects-registry__th-filter::before {
  content: "";
  position: absolute;
  inset: -0.375rem;
}

#panel-projects .projects-registry__th-filter:hover,
#panel-projects .projects-registry__th-filter_active {
  color: var(--accent);
}

#panel-projects .projects-registry__th-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#panel-projects .projects-registry__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

.projects-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.projects-registry__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.projects-registry__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 2.75rem;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.panel #projects-list p,
.panel #marks-file-list .marks-file-list-empty,
.panel #tasks-list p,
.panel #work-types-list p,
.panel #subdivisions-list p,
.panel #warehouses-list p,
.panel #unloading-places-list p,
.panel #equipment-list p {
  margin: 0;
  padding: var(--space-6);
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}

.panel p.err {
  color: var(--err);
  background: var(--err-muted);
  border-color: var(--err);
}

/* Реестр проектов — как в Для директоров */
.projects-registry {
  --pr-control-height: 44px;
  --pr-control-radius: var(--radius-md);
  --pr-label-row: calc(var(--text-xs) * 1.5 + var(--space-2));

  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.projects-registry .panel-toolbar {
  flex-wrap: nowrap;
  margin: 0;
}

/* Toolbar: единый flex-row, кнопки + поиск на одной строке, одной высоты */
.projects-registry__toolbar-main {
  display: flex;
  width: 100%;
  min-width: 0;
}

.projects-registry__btn-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

/* ВСЕ кнопки тулбара — одной высоты и скругления (как в Для директоров).
   Специфичность #panel-projects (1,0,0) перебивает дефолтный .panel button:not(...) (0,3,1) */
#panel-projects .panel-toolbar button,
#panel-projects .panel-toolbar .btn-upload {
  box-sizing: border-box;
  height: var(--pr-control-height);
  min-height: var(--pr-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--pr-control-radius);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

#panel-projects .panel-toolbar button:hover,
#panel-projects .panel-toolbar .btn-upload:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

#panel-projects .panel-toolbar button:focus-visible,
#panel-projects .panel-toolbar .btn-upload:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.projects-registry__stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .projects-registry__stats {
    grid-template-columns: 1fr;
  }
}

.projects-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.projects-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.projects-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.projects-registry__field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

/* Растягивает поле на всю оставшуюся ширину тулбара */
.projects-registry__field_grow {
  flex: 1 1 auto;
  min-width: 0;
}

.projects-registry__field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.45;
}

.projects-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--pr-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--pr-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.projects-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.projects-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* --- Карточки задач --- */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.task-card[data-task-id] {
  cursor: pointer;
}

.task-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}

.task-card .status {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--accent);
}

.task-card .meta {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.task-actions {
  margin-top: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Тосты --- */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  max-width: 22rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  font-size: var(--text-sm);
  font-weight: 500;
  animation: toastIn 0.3s ease;
  white-space: pre-line; /* поддержка \n в тексте тоста */
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Плавающая подсказка (hover/focus), z-index: --z-tooltip */
.ui-hover-tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  max-width: min(22rem, calc(100vw - 1rem));
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
  line-height: 1.4;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 80ms linear, transform 80ms ease-out;
}

.ui-hover-tooltip_visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .ui-hover-tooltip {
    transition: none;
  }

  .ui-hover-tooltip,
  .ui-hover-tooltip_visible {
    transform: none;
  }
}

.toast.hidden {
  display: none !important;
}

.toast.ok {
  background: var(--success);
  color: #fff;
}

.toast.err {
  background: var(--err);
  color: #fff;
}

.toast.toast-in-dialog {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  max-width: min(28rem, calc(100% - var(--space-8)));
  z-index: 2147483647;
}

/* Состояние загрузки кнопки: спиннер + текст, без сдвига layout (best practice 2025–2026) */
.btn-loading {
  cursor: wait !important;
  opacity: 0.85;
  pointer-events: none;
}
.btn-loading .btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: var(--space-2);
  vertical-align: middle;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}
@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}
.btn-loading .btn-loading-msg {
  vertical-align: middle;
}
/* Живой таймер секунд внутри кнопки синхронизации */
.btn-loading .btn-loading-timer {
  display: inline-block;
  vertical-align: middle;
  margin-left: var(--space-2);
  font-size: 0.78em;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
  letter-spacing: 0.02em;
  min-width: 2.2em;
  text-align: left;
}

.hidden {
  display: none !important;
}

/* Бригады: layout 50/50 — слева карточка бригады, справа доступные работники */
.brigades-detail-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
  max-width: 1200px;
}
.brigades-detail-dialog {
  position: relative;
  margin: auto;
  width: min(1200px, calc(100vw - 2 * var(--space-6)));
  max-height: calc(100vh - 2 * var(--space-6));
  padding: var(--space-5);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: 1.2rem;
  background: color-mix(in srgb, var(--surface) 84%, #0a1020);
  box-shadow: 0 24px 56px rgba(2, 6, 23, 0.65);
  overflow: auto;
}
.brigades-detail-dialog::backdrop {
  background: color-mix(in srgb, #020617 72%, transparent);
  backdrop-filter: blur(3px);
}
@media (max-width: 900px) {
  .brigades-detail-wrap {
    grid-template-columns: 1fr;
  }
}

/* Бригады: левая колонка — карточка с составом */
.brigades-detail {
  min-width: 0;
  background: color-mix(in srgb, var(--surface) 92%, #0f172a);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border-muted));
  border-radius: 1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}
.brigades-detail-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.brigades-members-list.brigades-members-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.brigades-detail-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5) var(--space-4) var(--space-5);
  padding-right: 4.25rem;
  background: color-mix(in srgb, var(--surface) 88%, #0b1222);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
}
.brigades-detail-title {
  margin: 0;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}
.brigades-detail-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 5;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 72%, #c7d2fe);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 0.85rem;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}
.brigades-detail-close:hover {
  color: #e0e7ff;
  background: color-mix(in srgb, var(--accent) 20%, #0f172a);
  border-color: color-mix(in srgb, var(--accent) 75%, #a5b4fc);
  transform: translateY(-1px);
}
.brigades-detail-close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, #c4b5fd);
  outline-offset: 2px;
}
.brigades-detail-body {
  padding: var(--space-5);
}
.brigades-detail-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-muted);
}
.brigades-detail-meta-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}
.brigades-detail-meta-value {
  font-size: var(--text-base);
  color: var(--text);
}
.brigades-detail-delivery-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.brigades-detail-delivery-toggle #brigades-detail-is-delivery {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.brigades-detail-delivery-switch {
  position: relative;
  display: inline-block;
  width: 3.3rem;
  height: 1.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-subtle) 35%, var(--surface));
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.brigades-detail-delivery-switch::before {
  content: '0';
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: color var(--transition), opacity var(--transition);
}
.brigades-detail-delivery-switch::after {
  content: '';
  position: absolute;
  top: 0.12rem;
  left: 0.12rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition);
}
.brigades-detail-delivery-toggle #brigades-detail-is-delivery:checked + .brigades-detail-delivery-switch {
  background: var(--success);
  border-color: color-mix(in srgb, var(--success) 70%, var(--border));
}
.brigades-detail-delivery-toggle #brigades-detail-is-delivery:checked + .brigades-detail-delivery-switch::before {
  content: 'I';
  left: auto;
  right: 0.62rem;
  color: #fff;
}
.brigades-detail-delivery-toggle #brigades-detail-is-delivery:checked + .brigades-detail-delivery-switch::after {
  transform: translateX(1.45rem);
}
.brigades-detail-delivery-toggle #brigades-detail-is-delivery:focus-visible + .brigades-detail-delivery-switch {
  box-shadow: 0 0 0 3px var(--accent-focus);
}
.brigades-detail-meta-value #brigades-detail-project-select {
  min-width: 220px;
  margin-right: var(--space-2);
}
.brigades-detail-section {
  margin: 0;
}
.brigades-detail-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
/* Список участников: чипы в сетке (доступно, визуально упорядочено) */
.brigades-members-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 2.5rem;
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-muted);
}
.brigades-members-list:empty {
  align-items: center;
  justify-content: center;
}
.brigades-members-list:empty::before {
  content: 'Нет участников';
  font-size: var(--text-sm);
  color: var(--text-subtle);
}
.brigade-member-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  list-style: none;
  transition: border-color var(--transition), background var(--transition);
}
.brigade-member-chip:hover {
  border-color: var(--border-muted);
  background: var(--surface-hover);
}
.brigade-member-chip[draggable="true"] {
  cursor: grab;
}
.brigade-member-chip[draggable="true"]:active,
.brigade-member-chip-dragging {
  cursor: grabbing;
  opacity: 0.7;
}
.brigade-remove-member {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.brigade-remove-member:hover {
  color: var(--err);
  background: var(--err-muted);
}
.brigade-remove-member:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* Форма добавления работника */
.brigades-add-member-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Панель «Доступные работники» — правая колонка */
.brigades-available-workers {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.brigades-available-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}
.brigades-available-hint {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.brigades-available-search,
.brigades-available-position {
  width: 100%;
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.brigades-available-search:focus,
.brigades-available-position:focus {
  outline: none;
  border-color: var(--accent);
}
.brigades-available-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.brigades-available-item {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: border-color var(--transition), background var(--transition);
}
.brigades-available-item:hover {
  border-color: var(--border-muted);
  background: var(--surface-hover);
}
.brigades-available-item:active,
.brigades-available-item.dragging {
  cursor: grabbing;
  opacity: 0.85;
}
.brigades-available-item-position {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: var(--space-2);
}

/* Подсветка строки таблицы бригад при перетаскивании работника */
#brigades-list tr[data-brigade-id].brigades-row-drop-target {
  background: var(--accent-muted);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* История изменений бригады */
.brigades-history-list {
  margin: 0;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-height: 12rem;
  overflow-y: auto;
}
.brigades-history-loading,
.brigades-history-empty {
  margin: 0;
  color: var(--text-subtle);
  font-style: italic;
}
.brigades-history-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-muted);
}
.brigades-history-entry:last-child {
  border-bottom: none;
}
.brigades-history-event {
  font-weight: 500;
  color: var(--text);
}
.brigades-history-actor {
  color: var(--text-muted);
}
.brigades-history-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
}

/* Чаты: двухколоночный layout, список разговоров, лента сообщений */

#panel-chats:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#panel-chats:not(.hidden) > .card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#panel-chats .panel-body_chats-registry {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.chats-registry {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  flex: 1 1 auto;
}
.chats-registry__toolbar {
  margin-bottom: 0;
}
.chats-registry__toolbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}
.chats-registry__btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chats-registry__field {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 12rem;
}
.chats-registry__field_grow {
  flex: 1 1 14rem;
  min-width: 10rem;
}
.chats-registry__field-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}
.chats-registry__control {
  min-height: var(--field-height, 44px);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated, var(--surface));
  color: var(--text);
  font-size: var(--text-sm);
  width: 100%;
}
.chats-registry__control::placeholder {
  color: var(--text-muted);
}
.chats-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 1px;
  border-color: var(--accent);
}

.chats-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.chats-toolbar-icon {
  min-height: var(--field-height, 44px);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
}
.chats-toolbar-label {
  line-height: 1.2;
}
.chats-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: inline-block;
}
.chats-toolbar-icon:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-muted);
}
.chats-toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 var(--space-1);
}
.chats-toolbar-icon .chats-icon {
  opacity: 1;
  fill: currentColor;
  stroke: none;
}

.chats-filter-segmented,
.chats-filter-tabs {
  display: inline-flex;
  gap: 0;
  margin-bottom: 0;
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated, var(--surface));
}

.chats-filter-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius-md) - 2px);
  min-height: var(--field-height-sm, 36px);
  padding: 0 var(--space-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
}
.chats-filter-tab__label {
  line-height: 1.2;
}

.chats-filter-tab.is-active {
  color: var(--accent-hover);
  background: var(--accent-muted);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.chats-filter-tab:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 1px;
}

/* layout: чат заполняет карточку панели (без вложенной «карточки») */
.chats-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 0;
  flex: 1 1 auto;
  min-height: min(420px, 55vh);
  height: auto;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  background: var(--bg-elevated, var(--surface));
  container-type: inline-size;
  container-name: chats-layout;
}
.chats-layout--compact {
  grid-template-columns: 88px minmax(0, 1fr);
}
.chats-layout--detail {
  grid-template-columns: minmax(0, 1fr);
}
.chats-sidebar {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.chats-sidebar-head {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.chats-sidebar-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chats-sidebar-toggle .chats-icon {
  transition: transform 0.2s ease;
}
.chats-sidebar-toggle.is-compact .chats-icon {
  transform: scaleX(-1);
}
.chats-sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}
.chats-conversations-list {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
  padding: var(--space-2);
}
.chats-empty-hint {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4);
  margin: 0;
}
.chats-conv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chats-conv-list-item {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chats-conv-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  font: inherit;
  text-align: left;
  color: inherit;
  background: transparent;
  box-sizing: border-box;
}
.chats-conv-item:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 1px;
}
.chats-conv-item-time {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
  line-height: 1.4;
}
.chats-conv-item:hover,
.chats-conv-item:focus {
  background: var(--surface-hover);
  border-color: var(--border-muted);
  outline: none;
}
.chats-conv-item-active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--text);
}
.chats-conv-name {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-tight);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}
.chats-conv-badge {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-hover);
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.chats-conv-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chats-conv-name-full {
  display: inline;
}
.chats-conv-name-short {
  display: none;
}
.chats-conv-type {
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
}
.chats-conv-preview {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chats-conv-preview--empty {
  font-style: italic;
  opacity: 0.9;
}
.chats-messages-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  margin: 0;
}

/* Правая колонка: оболочка чата */
.chats-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.chats-thread-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
  padding: var(--space-2) var(--space-4);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky, 10);
  background: var(--surface);
}
.chats-thread-back {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.chats-thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}
.chats-thread-empty__title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}
.chats-thread-empty__body {
  margin: 0;
  max-width: 36ch;
  line-height: 1.5;
}
.chats-thread-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-2);
}
.chats-thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chats-thread-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chats-composer-tools {
  display: none;
}
.chats-composer-btn {
  width: var(--field-height, 44px);
  height: var(--field-height, 44px);
  min-width: var(--field-height, 44px);
  min-height: var(--field-height, 44px);
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  user-select: none;
  background: var(--surface-elevated, var(--surface));
  color: var(--text);
}
.chats-composer-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.chats-composer-btn:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 1px;
}
.chats-tool-btn {
  border-radius: var(--radius-md);
  background: var(--surface-elevated, var(--surface));
}
.chats-tool-btn .chats-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.chats-helper-panel {
  position: fixed;
  z-index: var(--z-popover, 40);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  max-width: min(420px, calc(100vw - var(--space-8)));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  box-shadow: var(--shadow-md);
}
.chats-helper-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  font-size: var(--text-sm);
}
.chats-helper-item:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

/* Панель эмодзи: системный шрифт, сетка со скроллом */
.chats-emoji-panel {
  position: fixed;
  z-index: var(--z-popover, 40);
  width: min(20rem, calc(100vw - var(--space-8)));
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.chats-emoji-panel.hidden {
  display: none;
}
.chats-emoji-panel__scroll {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: min(18rem, 42vh);
  padding: var(--space-2);
  -webkit-overflow-scrolling: touch;
}
.chats-emoji-panel__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
}
.chats-emoji-panel__btn {
  border: none;
  margin: 0;
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-size: 1.375rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}
.chats-emoji-panel__btn:hover {
  background: var(--surface-hover);
}
.chats-emoji-panel__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Область сообщений */
.chats-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  min-height: 0;
  scroll-behavior: smooth;
}
.chats-messages-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.chats-msg-date {
  align-self: center;
  margin: var(--space-2) 0;
  padding: 2px var(--space-3);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated, var(--surface));
  border: 1px solid var(--border-muted);
  border-radius: 999px;
}

/* Одно сообщение: avatar + bubble */
.chats-msg {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  max-width: min(78%, 42rem);
  animation: chats-msg-in 0.18s ease-out;
}
.chats-msg-own {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chats-msg--grouped {
  margin-top: -4px;
}
.chats-msg--grouped .chats-msg-avatar {
  visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .chats-msg {
    animation: none;
  }
}

/* Круглый аватар с инициалами */
.chats-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-on-accent, #0f1215);
  flex-shrink: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  user-select: none;
  background: var(--accent-muted);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.chats-msg-avatar--tone-0 { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chats-msg-avatar--tone-1 { background: color-mix(in srgb, var(--info, #3b82f6) 18%, var(--surface)); border-color: color-mix(in srgb, var(--info, #3b82f6) 40%, transparent); }
.chats-msg-avatar--tone-2 { background: color-mix(in srgb, var(--success, #22c55e) 16%, var(--surface)); border-color: color-mix(in srgb, var(--success, #22c55e) 38%, transparent); }
.chats-msg-avatar--tone-3 { background: color-mix(in srgb, var(--warn, #f59e0b) 16%, var(--surface)); border-color: color-mix(in srgb, var(--warn, #f59e0b) 38%, transparent); }
.chats-msg-avatar--tone-4 { background: color-mix(in srgb, var(--text-muted) 14%, var(--surface)); border-color: var(--border); }
.chats-msg-avatar--tone-5 { background: color-mix(in srgb, var(--accent-hover) 20%, var(--surface)); border-color: color-mix(in srgb, var(--accent-hover) 42%, transparent); }

/* Бабл сообщения */
.chats-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  min-width: 4rem;
  max-width: 100%;
}
.chats-msg-own .chats-msg-bubble {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}
.chats-msg-sender {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-hover);
  display: block;
}
.chats-msg-body {
  display: block;
  word-break: break-word;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}
.chats-msg-attachments {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
.chats-msg-image {
  max-width: min(280px, 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-muted);
  background: var(--surface);
}
.chats-media-open-btn {
  border: none;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.chats-media-view-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(70vh, 36rem);
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.chats-msg-link {
  color: var(--accent-hover);
  text-decoration: underline;
  word-break: break-all;
}
.chats-msg-meta {
  display: block;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
  text-align: right;
}
.chats-messages-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.chats-messages-loading::before {
  content: '';
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: chats-spin 0.7s linear infinite;
}
@keyframes chats-spin {
  to { transform: rotate(360deg); }
}
@keyframes chats-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .chats-messages-loading::before {
    animation: none;
    border-top-color: var(--accent);
  }
}

.chats-selection-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}
.chats-selection-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.chats-selection-delete {
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger-border, #b91c1c);
  background: var(--danger-muted, rgba(185, 28, 28, 0.12));
  color: var(--danger-text, #b91c1c);
  cursor: pointer;
}
.chats-selection-cancel {
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.chats-msg--selectable .chats-msg-bubble {
  cursor: pointer;
}
.chats-msg--selectable .chats-msg-bubble:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chats-msg--selected .chats-msg-bubble {
  box-shadow: 0 0 0 2px var(--accent);
}
.chats-msg-deleted {
  display: inline-block;
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  background: var(--bg-muted, var(--bg-elevated));
  border: 1px dashed var(--border-muted);
}
.chats-msg-deleted-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger-text, #b91c1c);
  margin-bottom: var(--space-1);
}
.chats-msg-body--audit {
  opacity: 0.72;
  text-decoration: line-through;
  text-decoration-color: var(--text-subtle);
}
.chats-msg--deleted-audit .chats-msg-bubble {
  border-style: dashed;
}

/* Action-кнопки внутри сообщения */
.chats-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-muted);
}
.chats-action-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.chats-action-btn:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.chats-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Семантические модификаторы кнопок действий */
.chats-action-btn--success:hover {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.chats-action-btn--danger:hover {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}
.chats-action-btn--warn:hover {
  background: var(--warn);
  border-color: var(--warn);
  color: #000;
}

/* Форма отправки */
.chats-send-form {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.chats-message-input,
.chats-send-form input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: var(--field-height, 44px);
  max-height: 8rem;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated, var(--bg-elevated));
  color: var(--text);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  line-height: 1.45;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}
.chats-message-input:focus-visible,
.chats-send-form input:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 1px;
  border-color: var(--accent);
}
.chats-attach-btn {
  cursor: pointer;
}
.chats-send-submit {
  background: var(--accent);
  color: var(--text-on-accent, #0f1215);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}
.chats-send-submit .chats-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.chats-send-submit:hover {
  background: var(--accent-hover);
  border-color: transparent;
}

@media (max-width: 760px) {
  .chats-send-form {
    gap: 6px;
    padding: 8px;
  }
  .chats-toolbar-label,
  .chats-filter-tab__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .chats-toolbar-icon {
    min-width: var(--field-height, 44px);
    padding: 0;
    justify-content: center;
  }
  .chats-filter-tab {
    padding: 0 var(--space-2);
  }
  .chats-message-input,
  .chats-send-form input {
    padding: 8px 10px;
    font-size: 13px;
  }
  .chats-composer-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  .chats-emoji-panel {
    width: min(18rem, calc(100vw - 24px));
  }
  .chats-emoji-panel__grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .chats-helper-panel {
    max-width: min(300px, calc(100vw - 32px));
  }
}
.chats-tool-btn .chats-icon {
  width: 16px;
  height: 16px;
}

.chats-layout--compact .chats-conv-item {
  justify-content: center;
  padding: var(--space-2);
}
.chats-layout--compact .chats-conv-item .chats-conv-main {
  align-items: center;
}
.chats-layout--compact .chats-conv-name-full,
.chats-layout--compact .chats-conv-preview,
.chats-layout--compact .chats-conv-type,
.chats-layout--compact .chats-conv-item-time,
.chats-layout--compact .chats-conv-main {
  display: none;
}
.chats-layout--compact .chats-conv-name-short {
  display: inline;
}
.chats-layout--compact .chats-conv-name {
  justify-content: center;
}
.chats-layout--detail .chats-sidebar {
  display: none;
}

/* Открытый тред: переписка на всю ширину, список только в expanded (явный toggle) */
.chats-layout:has(.chats-thread:not(.hidden)):not(.chats-layout--expanded) {
  grid-template-columns: minmax(0, 1fr);
}
.chats-layout:has(.chats-thread:not(.hidden)):not(.chats-layout--expanded) .chats-sidebar {
  display: none;
}

/* Узкая колонка чатов: те же правила через container query */
@container chats-layout (max-width: 980px) {
  .chats-layout:has(.chats-thread:not(.hidden)) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .chats-layout:has(.chats-thread:not(.hidden)) .chats-sidebar {
    display: none !important;
  }
  .chats-layout:has(.chats-thread:not(.hidden)) .chats-main {
    display: flex !important;
  }
}

@media (max-width: 980px) {
  .chats-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .chats-layout .chats-main {
    display: none;
  }
  .chats-layout:has(.chats-thread:not(.hidden)) .chats-main {
    display: flex;
  }
  .chats-layout:has(.chats-thread:not(.hidden)) .chats-sidebar {
    display: none;
  }
  .chats-layout--expanded:not(:has(.chats-thread:not(.hidden))) .chats-sidebar {
    display: flex;
  }
  .chats-layout--expanded:not(:has(.chats-thread:not(.hidden))) .chats-main {
    display: none;
  }
  .chats-layout:has(.chats-thread:not(.hidden)) {
    grid-template-columns: minmax(0, 1fr);
  }
  .chats-msg {
    max-width: min(92%, 42rem);
  }
}

.chats-thread.is-archived .chats-send-form {
  display: none;
}

.chats-thread.is-archived .chats-action-btn {
  pointer-events: none;
  opacity: 0.5;
}

/* Просмотр изображения в чатах */
.dialog-chats-media-view {
  max-width: min(92vw, 48rem);
}
.dialog-chats-media-view-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

/* --- Админка: подвкладки в шапке, без дублирующего h2 и внутренней полосы --- */
#panel-admin > .admin-sub-tabs {
  display: none !important;
}

.admin-sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}
.admin-sub-tab {
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.admin-sub-tab:hover {
  color: var(--text);
  border-color: var(--border);
}
.admin-sub-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.admin-sub-panel {
  padding: var(--space-4);
}

/* Матрица: название в шапке, без лишнего верхнего поля */
#admin-sub-module-permissions.admin-sub-panel {
  padding-top: var(--space-2);
}

/* Шапка ролей вынесена из .pm-matrix__scroll — overflow:hidden на панели безопасен */
#admin-sub-module-permissions.admin-sub-panel.card {
  overflow: hidden;
}
.admin-sub-panel p {
  margin: 0 0 var(--space-2);
}
.admin-go-tab {
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.admin-go-tab:hover {
  background: var(--accent-hover);
}

.xml-src-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.xml-src-create-plus {
  min-width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.xml-src-create-plus:hover {
  background: var(--accent-hover);
}

.xml-src-create-plus:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.xml-src-create-actions {
  margin-top: var(--space-2);
}

.xml-src-table td {
  vertical-align: middle;
}

.xml-src-table-row {
  cursor: pointer;
}

.xml-src-table-row:hover td {
  background: var(--surface-hover);
}

.xml-src-table-row:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: -2px;
}

.xml-src-path-short {
  display: inline-block;
  max-width: 24rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.xml-src-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: var(--text-xs);
  border: 1px solid transparent;
}

.xml-src-badge.is-active {
  background: var(--accent-muted);
  border-color: var(--accent-focus);
  color: var(--accent-hover);
}

.xml-src-badge.is-paused {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text-muted);
}

.xml-src-actions-cell {
  text-align: center;
  width: 40px;
}

.xml-src-force-upload-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--accent, #5e9cff);
  border-radius: 4px;
  transition: background-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.xml-src-force-upload-btn:hover {
  background-color: rgba(94, 156, 255, 0.1);
}

.xml-src-force-upload-btn:active {
  background-color: rgba(94, 156, 255, 0.2);
}

.xml-src-credentials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.xml-src-dialog-inner {
  width: auto;
}

.xml-src-dialog-grid {
  margin-bottom: var(--space-2);
}

.xml-src-dialog-advanced h4 {
  margin: var(--space-2) 0;
}

.xml-src-dialog-footer {
  justify-content: flex-end;
}

#dialog-xml-source-connection {
  max-width: min(96vw, 74rem);
  color: var(--text);
}

#dialog-xml-source-connection .dialog-position-create-body {
  display: block;
  padding: var(--space-3) var(--space-5) var(--space-4);
  max-height: none;
  overflow: visible;
}

#dialog-xml-source-connection .xml-src-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: end;
}

#dialog-xml-source-connection .xml-src-dialog-grid .bim-models-field {
  min-width: 0;
}

#dialog-xml-source-connection .xml-src-dialog-grid .bim-models-field input,
#dialog-xml-source-connection .xml-src-dialog-grid .bim-models-field select {
  width: 100%;
}

/* Поле пути с кнопкой Обзор */



#dialog-xml-source-connection .xml-src-browse-btn:hover {
  background: var(--accent-hover);
}

#dialog-xml-source-connection .xml-src-browse-btn:active {
  transform: scale(0.98);
}

#dialog-xml-source-connection .xml-src-browse-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-focus);
}

#dialog-xml-source-connection .xml-src-dialog-grid .sync-settings-toggle {
  grid-column: 1 / -1;
}

#dialog-xml-source-connection .dialog-position-create-title {
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  font-weight: 700;
  color: var(--text);
}

#dialog-xml-source-connection .bim-models-field span,
#dialog-xml-source-connection .xml-src-inline-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
}

#dialog-xml-source-connection .bim-models-field input,
#dialog-xml-source-connection .bim-models-field select {
  color: var(--text);
  font-size: var(--text-base);
  background: var(--bg-elevated, var(--bg));
  border: 1px solid var(--border);
  opacity: 1;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}

#dialog-xml-source-connection .bim-models-field input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

#dialog-xml-source-connection .bim-models-field input:focus,
#dialog-xml-source-connection .bim-models-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

#dialog-xml-source-connection .sync-settings-toggle span {
  color: var(--text);
  font-weight: 600;
}

#dialog-xml-source-connection .xml-src-dialog-sections {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

#dialog-xml-source-connection .xml-src-dialog-section h4 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#dialog-xml-source-connection .xml-src-credentials-grid {
  grid-template-columns: 1fr;
  margin-bottom: var(--space-2);
}

#dialog-xml-source-connection .xml-src-actions-row {
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

#dialog-xml-source-connection .xml-src-password-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

#dialog-xml-source-connection .xml-src-actions-row .rp-save-btn {
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  font-weight: 600;
}

#dialog-xml-source-connection .xml-src-run-select {
  min-width: 12rem;
}

#dialog-xml-source-connection .xml-src-metrics-row,
#dialog-xml-source-connection .xml-src-state-row {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

#dialog-xml-source-connection .xml-src-dialog-logs-wrap {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

#dialog-xml-source-connection .xml-src-dialog-logs-caption {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  line-height: 1.35;
}

#dialog-xml-source-connection .xml-src-dialog-logs-pre {
  max-height: 14rem;
  overflow: auto;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

#dialog-xml-source-connection .xml-src-dialog-footer .btn-secondary {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

#dialog-xml-source-connection .xml-src-dialog-footer .btn-secondary:hover {
  background: var(--surface-hover);
}

#dialog-xml-source-connection .xml-src-dialog-footer #xml-src-dialog-delete:not(.hidden) {
  min-height: 2.5rem;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #fff;
  border: 1px solid var(--err, var(--error, #b42318));
  border-radius: var(--radius-md);
  background: var(--err, var(--error, #b42318));
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(16, 24, 40, 0.2));
}

#dialog-xml-source-connection .xml-src-dialog-footer #xml-src-dialog-delete:not(.hidden):hover {
  filter: brightness(1.06);
}

#dialog-xml-source-connection .xml-src-dialog-footer #xml-src-dialog-delete:not(.hidden):focus-visible {
  outline: 2px solid var(--err-muted, #fda29b);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  #dialog-xml-source-connection {
    max-width: min(96vw, 42rem);
  }

  #dialog-xml-source-connection .dialog-position-create-body {
    max-height: min(74vh, 36rem);
    overflow: auto;
  }

  #dialog-xml-source-connection .xml-src-dialog-grid {
    grid-template-columns: 1fr;
  }

  #dialog-xml-source-connection .xml-src-dialog-sections {
    grid-template-columns: 1fr;
  }
}

.xml-src-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.xml-src-runs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.xml-src-inline-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.xml-src-run-select {
  min-width: 14rem;
  max-width: 100%;
}

.xml-src-metrics-row,
.xml-src-state-row {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.xml-src-report-actions {
  margin-top: var(--space-2);
}

.xml-src-help {
  margin-top: var(--space-3);
}






.docflow-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 2.2rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.docflow-mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}


.docflow-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 28%) minmax(0, 72%);
  gap: var(--space-4);
  align-items: start;
}


.docflow-tree-panel,
.docflow-detail-panel {
  padding: var(--space-4);
  max-height: calc(100vh - 2 * var(--space-6));
  overflow: auto;
}

.docflow-tree-panel {
  position: sticky;
  top: var(--space-4);
}

.docflow-detail-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--space-2);
}

.docflow-tree-content {
  max-height: 65vh;
  overflow: auto;
  margin-top: var(--space-3);
}

/* ============================================
   DOCFLOW: MODERN TREE-VIEW (2026)
   Направляющие: контраст выше border-muted, «локти» к строкам узла (VS Code / Finder).
   ============================================ */

.docflow-tree-panel,
.docflow-tree-content {
  --docflow-tree-guide-width: 2px;
  --docflow-tree-indent: 0.875rem;
  --docflow-tree-guide: color-mix(in srgb, var(--text-muted) 48%, var(--border));
  --docflow-tree-guide-nested: color-mix(in srgb, var(--text-muted) 38%, var(--border));
  --docflow-tree-guide-active: color-mix(in srgb, var(--accent) 62%, var(--docflow-tree-guide));
}

#docflow-catalogs-page {
  min-width: 0;
}

#docflow-catalogs-page > .rp-loading,
#docflow-catalogs-page > .rp-error {
  padding: var(--space-4);
}

.docflow-tree-structure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  flex-wrap: wrap;
}

/* .panel h3 (margin-top: space-8) сильнее одного класса — сбрасываем в контексте панели */
#panel-docflow .docflow-tree-structure-title,
#admin-sub-document-index .docflow-tree-structure-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
}

.docflow-tree-structure-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.docflow-tree-toggle-led {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--text-muted) 28%, transparent);
  border: 1px solid color-mix(in srgb, var(--text-muted) 45%, transparent);
  box-shadow: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.docflow-switch-btn.docflow-tree-structure-toggle.active .docflow-tree-toggle-led {
  background: var(--success);
  border-color: color-mix(in srgb, var(--success) 75%, #fff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--success) 35%, transparent),
    0 0 8px color-mix(in srgb, var(--success) 55%, transparent);
}

.docflow-tree-toggle-label {
  line-height: 1.2;
}

/* Compact search bar */
.docflow-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.docflow-search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.docflow-search-bar-icon {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.docflow-search-bar-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  outline: none;
  padding: 0;
}

.docflow-search-bar-input::placeholder {
  color: var(--text-subtle);
}

.docflow-search-bar-shortcut {
  padding: 2px 6px;
  font-size: var(--text-xs);
  color: var(--text-subtle);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.docflow-search-bar-shortcut:hover {
  color: var(--text);
  background: var(--border);
  border-color: var(--text-muted);
}

/* Modern tree node row */
.docflow-tree-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: pointer;
}

.docflow-tree-row:hover {
  background: var(--surface-hover);
}

.docflow-tree-row--active {
  background: var(--accent-muted);
  border-left: 2px solid var(--accent);
  padding-left: calc(var(--space-2) - 1px);
}

.docflow-tree-picker-cb {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: var(--space-2, 6px);
  margin-top: 0.1rem;
  flex-shrink: 0;
  accent-color: var(--accent, #1a73e8);
  cursor: pointer;
}

.docflow-tree-row--picked {
  background-color: rgba(0, 100, 200, 0.08);
}

.docflow-tree-row--partial {
  position: relative;
}

.docflow-tree-row--partial::after {
  content: '✓';
  position: absolute;
  left: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.35;
  pointer-events: none;
  color: var(--accent, #1a73e8);
  font-weight: 700;
  line-height: 1;
}

.docflow-tree-picker-cb--partial {
  opacity: 0.45;
}

/* Node type icons */
.docflow-node-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Expand/collapse chevron */
.docflow-tree-expand {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--text-muted) 85%, var(--text));
  cursor: pointer;
  padding: 0;
  margin: 0;
  outline: none;
  box-shadow: none;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.docflow-tree-expand,
.docflow-tree-expand:focus,
.docflow-tree-expand:focus-visible,
.docflow-tree-expand:active,
.docflow-tree-expand:hover {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
}

.docflow-tree-expand::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
}

.docflow-tree-expand--expanded::before {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  border-bottom: none;
  transform: translate(-50%, -40%);
}

.docflow-tree-expand:hover {
  color: var(--text);
}

.docflow-tree-expand--spacer {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  visibility: hidden;
}

/* Tree node container */
.docflow-tree-node {
  margin: 1px 0;
  list-style: none;
}

/* Tree connecting lines */
.docflow-tree-root,
.docflow-tree-children {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.docflow-tree-root > .docflow-tree-node > .docflow-tree-children {
  --docflow-tree-guide: color-mix(in srgb, var(--text-muted) 52%, var(--border));
}

.docflow-tree-children {
  position: relative;
  margin-left: calc(var(--space-2) + 0.625rem);
  padding-left: var(--docflow-tree-indent);
  border-left: var(--docflow-tree-guide-width) solid var(--docflow-tree-guide);
  border-radius: 0;
}

.docflow-tree-children .docflow-tree-children {
  --docflow-tree-guide: var(--docflow-tree-guide-nested);
  margin-left: var(--space-3);
}

.docflow-tree-children > .docflow-tree-node {
  position: relative;
}

/* Горизонтальная ветка от ствола к строке узла */
.docflow-tree-children > .docflow-tree-node::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--docflow-tree-indent));
  top: 1.125rem;
  width: var(--docflow-tree-indent);
  height: var(--docflow-tree-guide-width);
  background: var(--docflow-tree-guide);
  border-radius: 1px;
  pointer-events: none;
  z-index: 0;
}

/* У последнего ребёнка ствол не тянется ниже «локтя» */
.docflow-tree-children > .docflow-tree-node:last-child::after {
  content: '';
  position: absolute;
  left: calc(-1 * var(--docflow-tree-indent) - var(--docflow-tree-guide-width));
  top: calc(1.125rem + var(--docflow-tree-guide-width));
  bottom: -2px;
  width: calc(var(--docflow-tree-guide-width) + 2px);
  background: var(--surface);
  pointer-events: none;
  z-index: 1;
}

/* Активная ветка — направляющие чуть ярче */
.docflow-tree-node:has(> .docflow-tree-row--active) > .docflow-tree-children,
.docflow-tree-node:has(.docflow-tree-row--active) > .docflow-tree-children {
  border-left-color: var(--docflow-tree-guide-active);
}

.docflow-tree-node:has(> .docflow-tree-row--active) > .docflow-tree-children > .docflow-tree-node::before,
.docflow-tree-node:has(.docflow-tree-row--active) > .docflow-tree-children > .docflow-tree-node::before {
  background: var(--docflow-tree-guide-active);
}

/* Договоры и индексация: без направляющих — только indent (Finder / VS Code sidebar) */
#panel-docflow .docflow-tree-children,
#admin-sub-document-index .docflow-tree-children {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: none;
}

#panel-docflow .docflow-tree-children .docflow-tree-children,
#admin-sub-document-index .docflow-tree-children .docflow-tree-children {
  margin-left: 0;
}

#panel-docflow .docflow-tree-children > .docflow-tree-node::before,
#panel-docflow .docflow-tree-children > .docflow-tree-node:last-child::after,
#admin-sub-document-index .docflow-tree-children > .docflow-tree-node::before,
#admin-sub-document-index .docflow-tree-children > .docflow-tree-node:last-child::after {
  display: none;
  content: none;
}

#panel-docflow .docflow-tree-row--active,
#admin-sub-document-index .docflow-tree-row--active {
  border-left: none;
  padding-left: var(--space-2);
}

#panel-docflow .docflow-tree-expand--spacer,
#admin-sub-document-index .docflow-tree-expand--spacer {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
}

#panel-docflow .docflow-counter-badge--placeholder,
#admin-sub-document-index .docflow-counter-badge--placeholder {
  visibility: hidden;
}

#panel-docflow .docflow-tree-node > .docflow-tree-meta,
#admin-sub-document-index .docflow-tree-node > .docflow-tree-meta {
  display: none;
}

.docflow-tree-row,
.docflow-tree-meta {
  position: relative;
  z-index: 1;
}

/* Counter badge */
.docflow-counter-badge {
  margin-left: auto;
  padding: 1px var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  background: var(--surface);
  border-radius: 99px;
  min-width: 1.5rem;
  text-align: center;
  font-weight: 500;
}

.docflow-counter-badge:empty {
  display: none;
}

.docflow-tree-file-count {
  margin-left: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
  white-space: nowrap;
}

.docflow-tree-meta:empty {
  display: none;
  margin: 0;
  padding: 0;
}

/* Search highlight */
.docflow-search-highlight {
  background: var(--warn-muted);
  color: var(--warn);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}

/* Node content layout */
.docflow-tree-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.docflow-tree-prefix {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.1;
  font-weight: 500;
}

.docflow-tree-text {
  font-size: var(--text-sm);
  line-height: 1.25;
  color: var(--text);
}


/* Tree meta info */
.docflow-tree-meta,

.docflow-tree-meta-end {
  white-space: nowrap;
}

.docflow-tree-meta-end--overdue {
  color: var(--err);
  font-weight: 600;
}

.docflow-flat-table {
  margin-top: var(--space-3);
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.docflow-flat-table thead th {
  border-bottom: 1px solid var(--border-muted);
}

.docflow-flat-table th,
.docflow-flat-table td {
  padding: 0.5rem var(--space-2);
  vertical-align: middle;
}

.docflow-flat-table tbody tr + tr td {
  border-top: 1px solid var(--border-muted);
}

.docflow-flat-table th:nth-child(1),
.docflow-flat-table td:nth-child(1) {
  width: 6.8rem;
}

.docflow-flat-table th:nth-child(2),
.docflow-flat-table td:nth-child(2) {
  width: 42%;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.docflow-flat-link {
  border: 1px solid var(--border-muted);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem var(--space-2);
  text-align: left;
  width: 100%;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.docflow-sort-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.35rem var(--space-2);
  border-radius: 0;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
}

.docflow-sort-btn.active {
  color: var(--text);
  background: var(--accent-muted);
}

.docflow-sort-arrow {
  font-size: 0.66rem;
  opacity: 0.9;
}

/* Договоры: flat-list sort headers (режим «Плоский список», web-ui-style §3.5) */
#panel-docflow .docflow-flat-table thead th.docflow-flat-th-cell {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

#panel-docflow .docflow-flat-table .docflow-flat-th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: 0 var(--space-1);
  border: none;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  min-height: 0;
}

#panel-docflow .docflow-flat-table .docflow-flat-th:hover {
  background: var(--surface-hover);
}

#panel-docflow .docflow-flat-table .docflow-flat-th[aria-pressed='true'] {
  background: var(--accent-muted);
}

#panel-docflow .docflow-flat-table .docflow-flat-th:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

#panel-docflow .docflow-flat-table .docflow-flat-th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#panel-docflow .docflow-flat-table .docflow-flat-th-sort {
  flex: 0 0 auto;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

#panel-docflow .docflow-flat-table tbody tr:nth-child(odd),
#panel-docflow .docflow-flat-table tbody tr:nth-child(even) {
  background: transparent;
}

#panel-docflow .panel-toolbar button:not(.docflow-search-bar-shortcut) {
  box-sizing: border-box;
  height: var(--field-height, 44px);
  min-height: var(--field-height, 44px);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

#panel-docflow .panel-toolbar button:not(.docflow-search-bar-shortcut):hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.docflow-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-4);
  line-height: 1.5;
  font-size: var(--text-xs);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.docflow-breadcrumbs--empty {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.docflow-breadcrumb-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: none !important;
  background: none !important;
  color: var(--text-muted);
  padding: 0 !important;
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  outline: none;
  transition: color 0.15s;
}

.docflow-breadcrumb-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.docflow-breadcrumb-btn svg {
  display: block;
  flex-shrink: 0;
}

.docflow-breadcrumb-sep {
  color: var(--text-subtle);
  font-size: var(--text-xs);
  margin: 0 2px;
}

.docflow-detail-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4);
}

.docflow-detail-empty--inline {
  padding: var(--space-4);
  margin: 0;
}

.docflow-detail-view__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.docflow-detail-view__header .docflow-breadcrumbs {
  border: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.docflow-detail-view__header:not(:has(.docflow-detail-mode-tabs)) .docflow-breadcrumbs {
  border-radius: var(--radius-md);
}

.docflow-detail-mode-tabs {
  display: inline-flex;
  gap: var(--space-2);
  margin-bottom: 0;
  flex-wrap: wrap;
}

.docflow-detail-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--field-height, 2.75rem);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
}

.docflow-detail-mode-tab.active {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.docflow-detail-mode-tab-label {
  font-size: var(--text-sm);
  line-height: 1;
}

.docflow-detail-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.docflow-detail-view__inner {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: none;
}

.docflow-detail-view__inner > .contract-card__hero {
  margin: 0;
  background: transparent;
  border: none;
  padding: var(--space-3) var(--space-4) 0;
}

.docflow-detail-view__inner > .contract-card__info-grid {
  margin-top: 0;
  padding: var(--space-3) var(--space-4) 0;
}

.docflow-detail-view__inner > .docflow-index-status,
.docflow-detail-view__inner > .docflow-doc-search,
.docflow-detail-view__inner > .docflow-files,
.docflow-detail-view__inner > .docflow-doc-search__hint--section {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.docflow-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.docflow-detail-actions .btn-primary,
.docflow-detail-actions .btn-secondary {
  box-sizing: border-box;
  min-height: var(--field-height, 2.75rem);
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.docflow-detail-actions .btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
}

.docflow-detail-actions .btn-secondary:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.docflow-panel__delete-btn {
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 35%, var(--border));
}

.docflow-panel__delete-btn:hover {
  border-color: var(--err);
  background: var(--err-muted);
  color: var(--err);
}

.docflow-panel__action-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-height, 2.75rem);
  padding: 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
}

.docflow-panel__action-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.docflow-detail-view__inner > .docflow-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-3) var(--space-4) var(--space-4);
  margin-top: 0;
  border-top: 1px solid var(--border);
}

.docflow-detail-view__inner > .contract-card__form {
  padding: var(--space-4);
}

.docflow-status-chip {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-2);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.docflow-status-chip--active {
  color: #b7ffd6;
  border-color: rgba(68, 191, 115, 0.6);
  background: rgba(40, 126, 74, 0.24);
}

.docflow-status-chip--closed {
  color: #ffd1d1;
  border-color: rgba(214, 104, 104, 0.6);
  background: rgba(128, 48, 48, 0.24);
}

.docflow-card-title,
.docflow-child-title {
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.docflow-kv {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.docflow-kv-row {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: var(--space-2);
}

.docflow-kv-key {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.docflow-kv-val {
  color: var(--text);
  font-size: var(--text-sm);
}

.docflow-kv-val--overdue {
  color: var(--err);
  font-weight: 600;
}

.docflow-form {
  display: grid;
  gap: var(--space-3);
  border: none;
  padding: 0;
  background: transparent;
}

.docflow-form-field {
  margin-bottom: 0;
}

.docflow-form-field > span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.docflow-form-field input,
.docflow-form-field select {
  width: 100%;
  height: 2.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 0 var(--space-2);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text);
}

.docflow-form-field input:focus,
.docflow-form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.docflow-switch {
  display: inline-grid;
  grid-auto-flow: column;
  gap: var(--space-2);
}

.docflow-switch-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font-size: var(--text-xs);
  line-height: 1.2;
}

.docflow-switch-btn.active {
  border-color: var(--accent-focus);
  color: #fff;
  background: color-mix(in srgb, var(--accent) 34%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.docflow-switch-btn[data-contract-status='active'].active {
  border-color: rgba(68, 191, 115, 0.8);
  background: rgba(44, 146, 86, 0.42);
}

.docflow-switch-btn[data-contract-status='closed'].active {
  border-color: rgba(214, 104, 104, 0.8);
  background: rgba(138, 55, 55, 0.42);
}

.docflow-status-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.docflow-field-error {
  color: var(--danger);
  font-size: var(--text-xs);
}

.docflow-field-hint {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.docflow-block-title {
  margin: 0 0 var(--space-2);
}

.docflow-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-muted);
}

.docflow-action-btn {
  min-width: 7.5rem;
  height: 2.2rem;
  padding: 0 var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
}

.docflow-action-btn--secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.docflow-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.docflow-btn-icon {
  display: inline-grid;
  place-items: center;
  line-height: 1;
  font-size: 0.95rem;
}






.docflow-card,
.docflow-form {
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--surface);
}

.docflow-empty-detail {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.docflow-audit-list {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.docflow-audit-item {
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--surface);
}

.docflow-audit-main {
  font-size: var(--text-sm);
  color: var(--text);
}

.docflow-audit-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 1200px) {
  .docflow-layout {
    grid-template-columns: 1fr;
  }
  .docflow-tree-panel {
    position: static;
  }
  .docflow-controls-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Матрица прав: современный card + toggle-switch дизайн
   ============================================================ */

/* Шапка секции */
.rp-header {
  margin-bottom: var(--space-6);
}
.rp-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-1);
}
.rp-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Список карточек */
.rp-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Карточка одного права */
.rp-card {
  background: var(--surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.rp-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}
.rp-card-locked {
  opacity: 0.75;
}

/* Заголовок карточки */
.rp-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.rp-card-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.rp-card-info {
  flex: 1;
  min-width: 0;
}
.rp-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}
.rp-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Счётчик активных ролей */
.rp-count-badge {
  flex-shrink: 0;
  padding: 2px var(--space-2);
  background: var(--accent-muted);
  color: var(--accent-hover);
  border: 1px solid var(--accent-focus);
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  align-self: center;
}

/* Бейдж «только миграции» */
.rp-locked-badge {
  flex-shrink: 0;
  padding: 2px var(--space-2);
  background: var(--surface-hover);
  color: var(--text-subtle);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  align-self: center;
}

/* Сетка ролей */
.rp-roles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Элемент роли — кликабельный для редактируемых, статический для locked */
.rp-role-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}
.rp-role-item input.rp-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.rp-role-item:hover:not(.rp-role-locked) {
  border-color: var(--border);
  color: var(--text);
}
.rp-role-locked {
  cursor: default;
}

/* Состояние «выключено» */
.rp-role-off {
  opacity: 0.55;
}
.rp-role-off:hover:not(.rp-role-locked) {
  opacity: 0.8;
}

/* Имя роли */
.rp-role-name {
  text-transform: capitalize;
}

/* Toggle-переключатель (визуальный) */
.rp-toggle {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
  background: var(--border);
  border-radius: 99px;
  transition: background var(--transition);
}
.rp-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform var(--transition);
}
.rp-role-on .rp-toggle {
  background: currentColor;
  opacity: 0.85;
}
.rp-role-on .rp-toggle::after {
  transform: translateX(14px);
}

/* Текстовый бейдж для locked */
.rp-role-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  opacity: 0.7;
}

/* Подвал с кнопкой сохранения */
.rp-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-muted);
}

.rp-save-btn {
  padding: var(--space-2) var(--space-6);
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}
.rp-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.rp-save-btn--dirty {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.rp-save-btn--dirty:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Статус сохранения */
.rp-status {
  font-size: var(--text-sm);
  font-weight: 500;
  transition: opacity var(--transition);
}
.rp-status--success {
  color: var(--success);
}
.rp-status--error {
  color: var(--err);
}

/* Состояние загрузки */
.rp-loading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.rp-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rp-spin 0.7s linear infinite;
}
@keyframes rp-spin {
  to { transform: rotate(360deg); }
}

/* Ошибка */
.rp-error {
  padding: var(--space-4);
  background: var(--err-muted);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  color: var(--err);
  font-size: var(--text-sm);
}

/* ============================================================
   Статусы марок (админка)
   ============================================================ */

.ms-header {
  margin-bottom: var(--space-6);
}
.ms-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-1);
}
.ms-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ms-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}
.ms-table th,
.ms-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border-muted);
}
.ms-table th {
  font-weight: 600;
  color: var(--text-muted);
}
.ms-table .ms-name {
  font-weight: 500;
  color: var(--text);
}
.ms-table .ms-percent {
  color: var(--text-muted);
}
.ms-color-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ms-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
/* Нативный пикер цвета: клик открывает палитру ОС. */
.ms-color-picker {
  width: 36px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
}
.ms-color-picker:hover {
  border-color: var(--accent);
}
.ms-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.ms-color-picker::-webkit-color-swatch { border: none; border-radius: 2px; }
.ms-color-clear {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ms-color-clear:hover {
  color: var(--text);
  border-color: var(--border);
}
.ms-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* ============================================================
   Audit Log
   ============================================================ */

.rp-audit-section {
  margin-top: var(--space-8);
  border-top: 1px solid var(--border-muted);
  padding-top: var(--space-6);
}

/* --- Загрузка 3Д моделей (админка): переключатель режима раскраски --- */
.bim-models-settings .bim-models-header {
  margin-bottom: var(--space-6);
}
.bim-models-toggle-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.bim-models-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: var(--space-4);
  width: 100%;
}
.bim-models-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.bim-models-toggle-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}
.bim-models-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
}
.bim-models-radio input {
  margin: 0;
}
.bim-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  width: 100%;
}
.bim-models-presets {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  width: 100%;
}
.bim-models-presets-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.bim-models-preset-btn {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}
.bim-models-preset-btn:hover {
  border-color: var(--accent);
}
.bim-models-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--text);
}
.bim-models-field span {
  color: var(--text-muted);
}
.bim-models-help {
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--text-subtle);
}
.bim-models-field b {
  color: var(--text);
  font-weight: 600;
}
.bim-models-field select,
.bim-models-field input[type="range"] {
  width: 100%;
}
.bim-preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bim-preview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
}
.bim-preview-fps {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}
.bim-preview-canvas {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: #0f131b;
  display: block;
}
.sync-settings-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
}
.sync-settings-toggle input {
  margin: 0;
}
@media (max-width: 1100px) {
  .bim-models-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 820px) {
  .sync-settings-toggle {
    align-items: flex-start;
  }
}

/* Шапка секции audit */
.audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.audit-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.audit-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}
.audit-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.audit-refresh-btn {
  padding: var(--space-1) var(--space-3);
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.audit-refresh-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

/* Пустой состояние */
.audit-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-subtle);
  font-size: var(--text-sm);
  border: 1px dashed var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* Таймлайн событий */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Одна строка журнала */
.audit-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-muted);
  position: relative;
}
.audit-row:last-child {
  border-bottom: none;
}
.audit-row:hover {
  background: var(--surface);
  margin: 0 calc(-1 * var(--space-3));
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  border-radius: var(--radius-sm);
}

/* Дот таймлайна */
.audit-action-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  box-shadow: 0 0 0 2px var(--bg-elevated);
}
.audit-dot-granted {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34,197,94,0.4), 0 0 0 2px var(--bg-elevated);
}
.audit-dot-revoked {
  background: var(--err);
  box-shadow: 0 0 6px rgba(239,68,68,0.4), 0 0 0 2px var(--bg-elevated);
}

/* Тело строки */
.audit-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.audit-row-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.audit-row-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Бейдж действия */
.audit-action-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 1px var(--space-2);
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.audit-badge-granted {
  background: var(--success-muted);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.25);
}
.audit-badge-revoked {
  background: var(--err-muted);
  color: var(--err);
  border: 1px solid rgba(239,68,68,0.2);
}

/* Пилл роли */
.audit-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-2);
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Название права */
.audit-perm-label {
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
}

/* Мета-инфо */
.audit-by {
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.audit-time {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  font-family: var(--font-mono);
  margin-left: auto;
}

/* Редактор процессов (этап 3.1.1): layout холста и палитры */
/* Панель редактора — во всю ширину и высоту (контент уже растянут через :has выше). */
#panel-workflow-editor:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}
/* Шапка панели (заголовок + hint + тулбар): по умолчанию — колонка. */
#panel-workflow-editor:not(.hidden) .workflow-editor-panel-header {
  flex-shrink: 0;
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}
#panel-workflow-editor:not(.hidden) .workflow-editor-hint,
#panel-workflow-editor:not(.hidden) .workflow-editor-panel-header .panel-toolbar {
  flex-shrink: 0;
}
#panel-workflow-editor:not(.hidden) .workflow-editor-panel-header h2 {
  flex-shrink: 0;
  margin-bottom: var(--space-2);
  margin-top: var(--space-2);
  padding: 0;
}
#panel-workflow-editor:not(.hidden) .workflow-editor-hint {
  margin: 0 0 var(--space-2);
  padding: 0;
}
#panel-workflow-editor:not(.hidden) .workflow-editor-panel-header .panel-toolbar {
  margin-bottom: var(--space-4);
  padding-left: 0;
  padding-right: 0;
}
/* Редактор графа открыт: шапка в одну строку, hint скрыт, максимум места — холсту. */
#panel-workflow-editor.workflow-editor-active .workflow-editor-panel-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-8);
  margin: 0;
}
#panel-workflow-editor.workflow-editor-active .workflow-editor-panel-header h2 {
  margin: 0;
}
#panel-workflow-editor.workflow-editor-active .workflow-editor-hint {
  display: none;
}
#panel-workflow-editor.workflow-editor-active .workflow-editor-panel-header .panel-toolbar {
  margin-bottom: 0;
  margin-left: auto;
  padding: 0;
  min-height: auto;
  background: transparent;
  border: none;
  border-radius: 0;
}
#panel-workflow-editor:not(.hidden) #workflow-editor-root {
  flex: 1 1 0;
  min-height: 0;
  max-width: none;
  margin-bottom: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.workflow-editor-root {
  display: flex;
  flex-direction: column;
  min-height: min(60vh, 600px);
}
.workflow-editor-root #workflow-editor-placeholder.hidden {
  display: none;
}
.workflow-editor-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}
/* Тулбар: компактный, не отъедает высоту у холста (бестпрактис: одна строка + ограничение по высоте). */
/* Вкладки по видам работ и кнопка «Все процессы» (этап 4). */
.workflow-work-type-tab:hover {
  background: var(--border);
}
.workflow-work-type-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Блок выбора проекта и индикатор override (этап 4). */
.workflow-reset-default-btn:hover {
  background: var(--border);
}
/* Тулбар (2b: кнопка 14px, сообщения 13px, семантический --danger, focus-visible). */
.workflow-save-btn:hover:not(:disabled) {
  background: var(--border);
}
.workflow-save-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workflow-save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
/* Кнопки тулбара: «К списку», «Удалить выбранный». */
.workflow-toolbar-btn {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.workflow-toolbar-btn:hover:not(:disabled) {
  background: var(--border);
}
.workflow-toolbar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workflow-toolbar-btn--secondary {
  background: var(--surface);
  color: var(--text-muted);
}
.workflow-toolbar-btn--secondary:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-elevated);
}
.workflow-toolbar-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.workflow-toolbar-btn--danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--err-muted, color-mix(in srgb, var(--danger) 15%, transparent));
}
.workflow-toolbar-btn--danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.workflow-save-error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--danger);
}
/* Блок валидации в тулбаре: компактный, не растягивает строку. */
.workflow-validation-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: min(420px, 100%);
  min-width: 0;
}
.workflow-validation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm);
  max-height: 2.6em;
  overflow-y: auto;
  max-width: 100%;
}
.workflow-validation-item {
  padding: var(--space-1) 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workflow-validation-error {
  color: var(--danger);
}
.workflow-validation-warning {
  color: var(--warn);
}
.workflow-save-blocked-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  width: 100%;
}
.workflow-validation-fix-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 100%;
  line-height: 1.4;
}
.workflow-validation-fix-hint kbd {
  padding: 2px 6px;
  font-size: 0.85em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.workflow-save-caption {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Экран списка процессов (3.1.6) */
.workflow-editor-layout--list {
  padding: var(--space-4);
}
.workflow-process-list-wrap {
  max-width: 56rem;
  margin: 0 auto;
}
.workflow-process-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.workflow-process-list-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
}
.workflow-process-list-create-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--bg);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.workflow-process-list-create-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}
.workflow-process-list-create-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.workflow-process-list-loading,
.workflow-process-list-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.workflow-process-list-error {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--danger);
}
.workflow-process-list-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.workflow-process-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.workflow-process-list-table th,
.workflow-process-list-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.workflow-process-list-table th {
  font-weight: 600;
  background: var(--bg-muted);
}
.workflow-process-list-table tbody tr:hover {
  background: var(--bg-muted);
}
.workflow-process-list-cell-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.workflow-process-list-open-btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.workflow-process-list-open-btn:hover {
  background: var(--primary);
  color: var(--bg);
}

.workflow-load-status {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.workflow-load-error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.workflow-load-error-dismiss {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-2);
  font-size: 1rem;
  line-height: 1;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.workflow-load-error-dismiss:hover {
  background: var(--border);
}
.workflow-load-error-dismiss:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Основная зона: палитра + холст; гарантированная минимальная высота холста. */
.workflow-editor-main {
  flex: 1 1 0;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.workflow-editor-palette-wrap {
  width: 180px;
  flex-shrink: 0;
  padding: var(--space-3);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.workflow-editor-canvas-wrap {
  flex: 1 1 0;
  min-height: 240px;
  min-width: 0;
}
.workflow-editor-canvas-wrap .react-flow {
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Палитра блоков (2b: touch target 44px, типографика 14/13px, line-height 1.4, hover). */
.workflow-editor-palette {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.workflow-editor-palette-title {
  margin: 0 0 var(--space-2) 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: var(--leading-tight);
}
.workflow-editor-palette-block {
  min-height: 44px;
  padding: 10px var(--space-3);
  text-align: left;
  cursor: grab;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text);
  transition: background-color var(--transition), border-color var(--transition);
}
.workflow-editor-palette-block:hover {
  background: var(--surface);
  border-color: var(--border-muted);
}
.workflow-editor-palette-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workflow-editor-palette-block:active {
  cursor: grabbing;
}
.workflow-editor-palette-block-label {
  display: block;
}

/* Цвета типов нод (бестпрактис: разные цвета для быстрого чтения процесса, Camunda — умеренное использование) */
.workflow-editor-canvas-wrap {
  --wf-start: #22c55e;
  --wf-end: #64748b;
  --wf-human-task: #3b82f6;
  --wf-condition: #f59e0b;
  --wf-multi-approval: #8b5cf6;
  --wf-notification: #14b8a6;
}

/* Кастомные ноды редактора (2b: типографика 13–14px, контраст, лёгкая тень, min-height 44px). */
.workflow-editor-canvas-wrap .workflow-node {
  position: relative;
  padding: var(--space-2) var(--space-3);
  min-width: 80px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: var(--text-sm);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.workflow-editor-canvas-wrap .workflow-node-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--leading-tight);
  word-break: break-word;
  max-width: 140px;
}

/* Старт: скруглённый прямоугольник, порт справа — без clip-path, чтобы Handle был кликабелен. */
.workflow-node-start {
  border: 2px solid var(--wf-start);
  padding-left: var(--space-3);
  padding-right: var(--space-5);
  min-width: 88px;
  min-height: 44px;
  background: color-mix(in srgb, var(--wf-start) 18%, var(--bg));
  color: var(--text);
}
.workflow-node-start .workflow-node-label {
  padding-right: 2px;
}
/* Конец: скруглённый прямоугольник, порт слева — без clip-path, чтобы Handle был кликабелен. */
.workflow-node-end {
  border: 2px solid var(--wf-end);
  padding-left: var(--space-5);
  padding-right: var(--space-3);
  min-width: 88px;
  min-height: 44px;
  background: color-mix(in srgb, var(--wf-end) 18%, var(--bg));
  color: var(--text);
}
.workflow-node-end .workflow-node-label {
  padding-left: 2px;
}
.workflow-node-human-task {
  border-color: var(--wf-human-task);
  background: color-mix(in srgb, var(--wf-human-task) 12%, var(--bg));
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.workflow-node-human-task .workflow-node-approver {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
  line-height: 1.3;
}
.workflow-node-human-task .workflow-node-handles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}
.workflow-node-human-task .workflow-node-handle-button-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.workflow-node-human-task .workflow-node-handle-chip {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--wf-human-task) 20%, var(--bg));
  border: 1px solid var(--border);
  color: var(--text);
}
.workflow-node-multi-approval {
  border: 2px solid var(--wf-multi-approval);
  background: color-mix(in srgb, var(--wf-multi-approval) 12%, var(--bg));
  box-shadow: inset 0 0 0 1px var(--wf-multi-approval);
}
.workflow-node-multi-approval .workflow-node-multi-approval-icon {
  margin-right: var(--space-1);
  font-size: 1rem;
}
.workflow-node-send-notification {
  border-color: var(--wf-notification);
  background: color-mix(in srgb, var(--wf-notification) 12%, var(--bg));
}
.workflow-node-send-notification .workflow-node-notification-icon {
  margin-right: var(--space-1);
  font-size: 1rem;
}

/* Нода «Условие» — ромб в стиле BPMN Exclusive Gateway (XOR): clip-path, без скруглений, маркер X, подпись снизу */
.workflow-node-condition {
  padding: 0;
  min-width: 72px;
  min-height: 82px;
  border: none;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Обёртка ромба: внешний слой — обводка (BPMN-стиль) */
.workflow-node-condition-diamond {
  width: 48px;
  height: 48px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.workflow-node-condition-diamond::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
  background: var(--wf-condition);
}
.workflow-node-condition-diamond::after {
  content: '';
  position: absolute;
  inset: 2px;
  clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
  background: color-mix(in srgb, var(--wf-condition) 14%, var(--bg));
}
/* Маркер X поверх ромба (z-index чтобы был над ::after) */
.workflow-node-condition-diamond .workflow-node-condition-x {
  position: relative;
  z-index: 1;
}
/* Маркер X (BPMN XOR) — узнаваемый символ условия */
.workflow-node-condition-x {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  user-select: none;
}
.workflow-node-condition-label-wrap {
  margin-top: 4px;
  max-width: 100px;
  text-align: center;
}
.workflow-node-condition-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* Handles: визуально 12px; зона клика слегка расширена (2b), у human_task несколько handles в ряд — без перекрытия. */
.workflow-editor-canvas-wrap .react-flow__handle {
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  padding: 5px;
  margin: -5px;
  box-sizing: content-box;
}

/* Подпись над панелью масштаба (Controls): чтобы кнопки были с обозначением */
/* Панель «Масштаб»: подпись над кнопками zoom, без наезда на кнопки. */
.workflow-editor-canvas-wrap .workflow-controls-caption-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-bottom: var(--space-2);
}
.workflow-editor-canvas-wrap .workflow-controls-caption {
  display: block;
  margin-bottom: var(--space-1);
}
/* Кнопки масштаба React Flow: контраст и видимость иконок на тёмном фоне. */
.workflow-editor-canvas-wrap .react-flow__controls {
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.workflow-editor-canvas-wrap .react-flow__controls-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 6px;
  background: var(--surface) !important;
  color: var(--text) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
}
.workflow-editor-canvas-wrap .react-flow__controls-button:last-child {
  border-bottom: none !important;
}
.workflow-editor-canvas-wrap .react-flow__controls-button:hover {
  background: var(--bg-elevated) !important;
  color: var(--text) !important;
}
.workflow-editor-canvas-wrap .react-flow__controls-button svg {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  fill: currentColor;
}
.workflow-editor-canvas-wrap .workflow-minimap {
  border-radius: var(--radius);
  overflow: hidden;
}
.workflow-editor-canvas-wrap .workflow-layout-panel {
  padding: var(--space-2);
}
.workflow-editor-canvas-wrap .workflow-magic-layout-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.workflow-editor-canvas-wrap .workflow-magic-layout-btn:hover {
  background: var(--bg-hover, color-mix(in srgb, var(--text) 8%, var(--bg)));
}
.workflow-editor-canvas-wrap .workflow-magic-layout-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.workflow-editor-canvas-wrap .workflow-magic-layout-icon {
  font-size: 1.125rem;
}
.workflow-editor-canvas-wrap .workflow-magic-layout-label {
  white-space: nowrap;
}
.workflow-editor-canvas-wrap .workflow-undo-redo-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.workflow-editor-canvas-wrap .workflow-undo-btn,
.workflow-editor-canvas-wrap .workflow-redo-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.workflow-editor-canvas-wrap .workflow-undo-btn:hover:not(:disabled),
.workflow-editor-canvas-wrap .workflow-redo-btn:hover:not(:disabled) {
  background: var(--bg-hover, color-mix(in srgb, var(--text) 8%, var(--bg)));
}
.workflow-editor-canvas-wrap .workflow-undo-btn:focus-visible,
.workflow-editor-canvas-wrap .workflow-redo-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.workflow-editor-canvas-wrap .workflow-undo-btn:disabled,
.workflow-editor-canvas-wrap .workflow-redo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.workflow-editor-canvas-wrap .workflow-undo-icon,
.workflow-editor-canvas-wrap .workflow-redo-icon {
  font-size: 1.125rem;
}
.workflow-editor-canvas-wrap .workflow-undo-label,
.workflow-editor-canvas-wrap .workflow-redo-label {
  white-space: nowrap;
}
.workflow-editor-canvas-wrap .workflow-search-trigger-wrap {
  padding: var(--space-2);
}
.workflow-editor-canvas-wrap .workflow-search-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.workflow-editor-canvas-wrap .workflow-search-trigger-btn:hover {
  background: var(--bg-hover, color-mix(in srgb, var(--text) 8%, var(--bg)));
}
.workflow-editor-canvas-wrap .workflow-search-trigger-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.workflow-editor-canvas-wrap .workflow-search-panel {
  padding: var(--space-2);
  max-width: 320px;
}
.workflow-editor-canvas-wrap .workflow-search-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.workflow-editor-canvas-wrap .workflow-search-input {
  flex: 1;
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.workflow-editor-canvas-wrap .workflow-search-input::placeholder {
  color: var(--text-muted);
}
.workflow-editor-canvas-wrap .workflow-search-close-btn {
  padding: var(--space-2);
  min-width: 44px;
  min-height: 44px;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.workflow-editor-canvas-wrap .workflow-search-close-btn:hover {
  color: var(--text);
}
.workflow-editor-canvas-wrap .workflow-search-results {
  margin: var(--space-2) 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.workflow-editor-canvas-wrap .workflow-search-result {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.workflow-editor-canvas-wrap .workflow-search-result:last-child {
  border-bottom: none;
}
.workflow-editor-canvas-wrap .workflow-search-result--selected,
.workflow-editor-canvas-wrap .workflow-search-result:hover {
  background: color-mix(in srgb, var(--text) 8%, var(--bg));
}
.workflow-editor-canvas-wrap .workflow-search-result--empty {
  color: var(--text-muted);
  cursor: default;
}
.workflow-editor-canvas-wrap .workflow-search-hint {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.workflow-editor-canvas-wrap .workflow-controls-caption-wrap .workflow-controls-caption {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Панель свойств (этап 4): Drawer справа, overlay. Явная типографика под тёмную тему. */
.workflow-props-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 10;
}
.workflow-props-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100%;
  background: var(--bg);
  color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
  z-index: 11;
  display: flex;
  flex-direction: column;
}
.workflow-props-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.workflow-props-drawer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: var(--leading-tight);
}
.workflow-props-drawer-close {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.workflow-props-drawer-close:hover {
  background: var(--border);
  color: var(--text);
}
.workflow-props-drawer-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workflow-props-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  color: var(--text);
  line-height: var(--leading-normal);
}
.workflow-props-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.workflow-props-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}
.workflow-props-input,
.workflow-props-select,
.workflow-props-textarea {
  width: 100%;
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  background: var(--bg-elevated);
  color: var(--text);
  line-height: var(--leading-normal);
}
.workflow-props-input::placeholder,
.workflow-props-textarea::placeholder {
  color: var(--text-muted);
}
.workflow-props-select {
  cursor: pointer;
}
.workflow-props-select option {
  background: var(--bg-elevated);
  color: var(--text);
}
.workflow-props-textarea {
  resize: vertical;
  min-height: 60px;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}
.workflow-props-input-sm {
  flex: 1;
  min-width: 0;
}
.workflow-props-checkbox-wrap {
  flex-direction: row;
  align-items: center;
  color: var(--text);
}
.workflow-props-checkbox-wrap input {
  margin-right: var(--space-2);
}
.workflow-props-muted {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}
.workflow-props-hint {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.workflow-props-section-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}
.workflow-props-report-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.workflow-props-report-settings--error {
  padding: var(--space-2);
  border-radius: var(--radius);
  border: 1px solid var(--border-error, #c53030);
  background: color-mix(in srgb, var(--border-error, #c53030) 8%, var(--bg));
}
.workflow-props-error {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-error, #c53030);
  line-height: var(--leading-normal);
}
.workflow-props-preview {
  margin-top: var(--space-4);
}
.workflow-props-preview-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.workflow-props-preview-content .workflow-props-muted {
  margin: 0;
}
/* Combobox */
.workflow-props-combobox {
  position: relative;
}
.workflow-props-combobox input {
  color: var(--text);
  background: var(--bg-elevated);
}
.workflow-props-combobox-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  max-height: 200px;
  overflow-y: auto;
  z-index: 12;
}
.workflow-props-combobox-item {
  padding: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text);
}
.workflow-props-combobox-item:hover {
  background: var(--border);
}
.workflow-props-combobox-item-empty {
  color: var(--text-muted);
  cursor: default;
}
.workflow-props-multiselect .workflow-props-multiselect-check {
  display: inline-block;
  width: 1.2em;
  margin-right: var(--space-1);
}
.workflow-props-multiselect label {
  color: var(--text);
}
/* Кнопки (human_task, multi_approval) */
.workflow-props-buttons-section {
  margin-top: var(--space-2);
}
.workflow-props-buttons-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}
.workflow-props-btn-add {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}
.workflow-props-btn-add:hover {
  background: var(--border);
}
.workflow-props-btn-add:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workflow-props-buttons-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.workflow-props-button-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.workflow-props-button-card .workflow-props-input-sm {
  flex: 1;
}
.workflow-props-btn-remove {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.workflow-props-btn-remove:hover {
  background: var(--border);
  color: var(--text);
}
.workflow-props-btn-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Валидация на нодах (2b / этап 6): индикатор и тултип — заготовки для Status Dots. */
.workflow-node-validation-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: 4px;
  right: 4px;
  z-index: 2;
  pointer-events: none;
}
.workflow-node-validation-dot--error {
  background: var(--danger);
}
.workflow-node-validation-dot--warning {
  background: var(--warn);
}
.workflow-node-validation-tooltip {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  max-width: 240px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Панель «Договоры»: наследует общую стилистику сайта (flex-колонка, полная ширина) */
.panel-body_docflow {
  padding-top: var(--space-4);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Панель «Для директоров»: сводка, фильтры, две колонки (таблица / карточки) */
.panel-body_directors-board {
  padding-top: var(--space-4);
}

.directors-board {
  /* Основная колонка 2/3, справа сегмент «прорабы | договоры» 1/3 */
  --db-col-main: minmax(0, 2fr);
  --db-col-aside: minmax(0, 1fr);
  --db-gap: var(--space-5);
  --db-control-height: 44px;
  --db-control-radius: var(--radius-md);
  --db-label-row: calc(var(--text-xs) * 1.5 + var(--space-2));

  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.directors-board__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.directors-board__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .directors-board__stats {
    grid-template-columns: 1fr;
  }
}

.directors-board__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.directors-board__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.directors-board__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.directors-board__stats_skeleton {
  display: flex;
  gap: var(--space-3);
}

.directors-board__skel_stat {
  flex: 1;
  height: 72px;
  border-radius: var(--radius);
}

.directors-board__toolbar {
  width: 100%;
}

.directors-board__toolbar-grid {
  display: grid;
  grid-template-columns: var(--db-col-main) var(--db-col-aside);
  gap: var(--db-gap);
  align-items: end;
  width: 100%;
}

.directors-board__toolbar-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: end;
  min-width: 0;
}

.directors-board__toolbar-aside {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  min-width: 0;
  overflow: visible;
}

/* view-segmented: inner-pill (как неделя|месяц), без pill-капсулы и ghost-дуг по краям */
.directors-board__toolbar-segmented.foreman-ts__view-segmented {
  flex-shrink: 0;
}

.directors-board__toolbar-segmented.foreman-ts__view-segmented .foreman-ts__segment {
  min-height: calc(var(--db-control-height) - 4px);
  padding: 0 var(--space-4);
}

@media (max-width: 1100px) {
  .directors-board__toolbar-grid {
    grid-template-columns: 1fr;
  }

  .directors-board__toolbar-aside {
    justify-content: stretch;
  }

  .directors-board__toolbar-segmented.foreman-ts__segmented {
    width: 100%;
  }

  .directors-board__toolbar-segmented .foreman-ts__segment {
    flex: 1 1 0;
    text-align: center;
  }
}

.directors-board__field_grow {
  min-width: 0;
}

.directors-board__toolbar-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0;
  flex-shrink: 0;
}

/* Пустая строка как у label поля поиска — нижний край кнопки = нижний край input */
.directors-board__toolbar-spacer {
  display: block;
  height: var(--db-label-row);
  flex-shrink: 0;
}

.directors-board__refresh-btn {
  box-sizing: border-box;
  height: var(--db-control-height);
  min-height: var(--db-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--db-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.directors-board__refresh-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.directors-board__toolbar_skeleton .directors-board__toolbar-grid {
  align-items: stretch;
}

.directors-board__skel_label-row {
  display: block;
  width: 4rem;
  height: var(--db-label-row);
}

.directors-board__skel_toolbar-btn {
  width: 160px;
  height: var(--db-control-height);
}

.directors-board__skel_toolbar-field {
  height: calc(var(--db-label-row) + var(--db-control-height));
  width: 100%;
  border-radius: var(--db-control-radius);
}

.directors-board__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  width: 100%;
}

.directors-board__field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.45;
}

.directors-board__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--db-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--db-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.directors-board__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.directors-board__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.directors-board__layout {
  display: grid;
  grid-template-columns: var(--db-col-main) var(--db-col-aside);
  gap: var(--db-gap);
  align-items: stretch;
}

.directors-board__layout > .directors-board__pane,
.directors-board__layout > .directors-board__aside {
  min-width: 0;
}

.directors-board__aside {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.directors-board__aside-panels {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.directors-board__aside-panel {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.directors-board__aside-panel[hidden] {
  display: none !important;
}

.directors-board__pane-head_aside {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.directors-board__pane-head_contracts.directors-board__pane-head_aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.directors-board__table-scroll_aside {
  max-height: min(62vh, 560px);
}

.directors-board__skel_segment {
  display: block;
  width: 12rem;
  height: var(--db-control-height);
  border-radius: 999px;
}

@media (max-width: 1100px) {
  .directors-board__layout {
    grid-template-columns: 1fr;
  }
}

.directors-board__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.directors-board__pane_employees {
  border-top: 3px solid var(--accent);
}

.directors-board__pane_foremen {
  border-top: 3px solid rgba(249, 115, 22, 0.75);
  min-width: 0;
}

.directors-board__pane_contracts {
  border-top: 3px solid rgba(34, 197, 94, 0.65);
  min-width: 0;
}

.directors-board__pane-head_contracts {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.directors-board__field_inline {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.directors-board__control_select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.directors-board__tree-scroll {
  width: 100%;
  min-width: 0;
  overflow: auto;
  max-height: min(62vh, 560px);
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.directors-board__tree-scroll .docflow-tree-root {
  width: 100%;
  min-width: 0;
}

.directors-board__tree-scroll .docflow-tree-row {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.directors-board__tree-scroll .docflow-tree-main {
  min-width: 0;
  flex: 1 1 auto;
}

.directors-board__tree-text_stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.directors-board__tree-primary {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directors-board__tree-secondary {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directors-board__tree-empty {
  margin: var(--space-4);
  font-size: var(--text-sm);
}

.directors-board__tree-drop.directors-board__drop-target_drag-over,
.directors-board__foreman-row_drop.directors-board__drop-target_drag-over {
  outline: 2px solid var(--accent-focus);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.directors-board__tree-warning {
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  background: var(--bg-warning, #fff8e1);
  border-radius: var(--radius-sm, 4px);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.directors-board__foreman-row_drop {
  cursor: copy;
}

.directors-board__foreman-row_readonly {
  opacity: 0.85;
}

.directors-board__foreman-no-user {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
}

.directors-board__substitute-badge {
  display: inline-block;
  font-size: var(--text-xs);
  padding: 0 var(--space-1);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
  vertical-align: middle;
}

.directors-board__foreman-cell {
  position: relative;
  padding-right: calc(var(--space-8) + var(--space-2));
}

.directors-board__foreman-title {
  display: inline;
}

.directors-board__foreman-transfer-btn {
  position: absolute;
  top: 50%;
  right: var(--space-1);
  transform: translateY(-50%);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-height-sm, 2.25rem);
  min-width: var(--field-height-sm, 2.25rem);
  margin: 0;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font: 500 var(--text-xs) / 1.2 var(--font-sans);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, color 0.15s ease-out, border-color 0.15s ease-out, background 0.15s ease-out;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .directors-board__foreman-transfer-btn {
    transition: none;
  }
}

.directors-board__foreman-row:hover .directors-board__foreman-transfer-btn,
.directors-board__foreman-row:focus-within .directors-board__foreman-transfer-btn {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .directors-board__foreman-cell .directors-board__foreman-transfer-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.directors-board__foreman-transfer-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.directors-board__foreman-transfer-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--accent-focus);
  outline-offset: 1px;
}

.directors-board__foreman-transfer-btn:disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.directors-board__foreman-row:hover .directors-board__foreman-transfer-btn:disabled,
.directors-board__foreman-row:focus-within .directors-board__foreman-transfer-btn:disabled {
  opacity: 0.45;
}

.directors-board__foreman-brigade-details {
  margin: var(--space-3) 0;
  font-size: var(--text-sm);
}

.directors-board__foreman-brigade-details summary {
  cursor: pointer;
  color: var(--link);
}

.directors-board__foreman-brigade-list {
  width: 100%;
  margin-top: var(--space-2);
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.directors-board__foreman-brigade-list td {
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

.directors-board__foreman-brigade-list th {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.directors-board__order-lead {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
}

.directors-board__order-summary {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  font-weight: 600;
}

.directors-board__order-hint {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.directors-board__cell_muted {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.directors-board__table_compact th,
.directors-board__table_compact td {
  padding: var(--space-2) var(--space-3);
}

/* Таблица прорабов: «Направление» — фиксированная ширина под полный заголовок */
.directors-board__table_compact .directors-board__th-cell_business_direction_name,
.directors-board__table_compact tbody td.directors-board__cell_muted {
  width: 9rem;
  min-width: 9rem;
  max-width: 9rem;
}

.directors-board__table_compact thead th.directors-board__th-cell_business_direction_name {
  overflow: visible;
  max-width: none;
}

.directors-board__table_compact .directors-board__th-cell_business_direction_name .directors-board__th-label {
  flex: 0 0 auto;
  min-width: auto;
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
}

.directors-board__table_compact .directors-board__th-cell_name {
  width: auto;
  max-width: none;
}

.directors-board__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.directors-board__pane-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.directors-board__pane-head-row .directors-board__pane-title {
  flex: 0 0 auto;
}

.directors-board__direction-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-width: 0;
}

.directors-board__direction-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
  min-height: 28px;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}

.directors-board__direction-pill-count {
  font-weight: 500;
  color: var(--text-secondary);
}

.directors-board__direction-pill:hover {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
}

.directors-board__direction-pill_active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-elevated));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.directors-board__direction-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.directors-board__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

/* Глобально `.panel h3` задаёт большой margin-top — внутри доски директоров это лишняя «пустая строка» над заголовком */
#panel-directors-board .directors-board .directors-board__pane-title {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.directors-board__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}

.directors-board__tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--db-control-radius);
  border: 1px solid var(--border-muted);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: var(--db-control-height);
  box-shadow: none;
  transition:
    border-color var(--transition),
    background var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

/* Выключенный фильтр — явно «приглушён» */
.directors-board__tab:not(.directors-board__tab_active):hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}

.directors-board__tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Включённый фильтр — акцентная заливка и контур, чтобы отличать от выкл. */
.directors-board__tab_active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.28);
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.45),
    0 4px 14px rgba(99, 102, 241, 0.22);
}

.directors-board__tab_active:hover {
  border-color: var(--accent-hover);
  background: rgba(99, 102, 241, 0.36);
}

.directors-board__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.directors-board__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.directors-board__table th,
.directors-board__table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.directors-board__table tbody td {
  line-height: var(--leading-normal);
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directors-board__table thead th {
  padding: var(--space-2) var(--space-3);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

#panel-directors-board .directors-board__table thead th.directors-board__checkbox-cell {
  width: 2.5rem;
  max-width: 2.5rem;
  padding: var(--space-2);
  vertical-align: middle;
}

.directors-board__table .directors-board__checkbox-cell {
  width: 2.5rem;
  max-width: 2.5rem;
}

.directors-board__table tbody .directors-board__checkbox-cell {
  max-width: 2.5rem;
  overflow: visible;
  white-space: normal;
}

.directors-board__table col.directors-board__col_checkbox {
  width: 2.5rem;
}

.directors-board__table col.directors-board__col_full_name {
  width: 11%;
}

.directors-board__table col.directors-board__col_position {
  width: 13%;
}

.directors-board__table col.directors-board__col_object {
  width: 14%;
}

.directors-board__table col.directors-board__col_direction {
  width: 5rem;
}

.directors-board__table col.directors-board__col_docflow {
  width: 26%;
}

.directors-board__table col.directors-board__col_foreman {
  width: 18%;
}

.directors-board__th-cell_full_name,
.directors-board__th-cell_position_name,
.directors-board__th-cell_object_name,
.directors-board__th-cell_business_direction_name,
.directors-board__th-cell_docflow_node,
.directors-board__th-cell_foreman {
  width: auto;
}

/* Приоритетные колонки: площадка/договор, прораб — без ellipsis */
.directors-board__table thead th.directors-board__th-cell_docflow_node,
.directors-board__table thead th.directors-board__th-cell_foreman,
.directors-board__table tbody td.directors-board__cell_assign.directors-board__cell_priority {
  max-width: none;
  overflow: visible;
  white-space: normal;
  word-break: normal;
}

.directors-board__th-cell_docflow_node .directors-board__th-label,
.directors-board__th-cell_foreman .directors-board__th-label {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.directors-board__table thead th.directors-board__th-cell_position_name,
.directors-board__table thead th.directors-board__th-cell_object_name {
  max-width: none;
  overflow: visible;
  white-space: normal;
}

.directors-board__th-cell_position_name .directors-board__th-label,
.directors-board__th-cell_object_name .directors-board__th-label {
  white-space: normal;
  line-height: 1.15;
  overflow: visible;
  text-overflow: unset;
}

.directors-board__table tbody td.directors-board__cell_wrap {
  max-width: none;
  overflow: visible;
  white-space: normal;
  word-break: normal;
  line-height: 1.3;
  vertical-align: top;
}

.directors-board__cell_wrap .directors-board__cell-text {
  display: block;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
}

.directors-board__table tbody td.directors-board__cell_fio {
  overflow: hidden;
  white-space: nowrap;
}

.directors-board__cell_fio .directors-board__cell-fio-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#panel-directors-board .directors-board__table-scroll .directors-board__table thead th.directors-board__checkbox-cell,
#panel-directors-board .directors-board__table-scroll .directors-board__table tbody td.directors-board__checkbox-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--bg-elevated);
}

#panel-directors-board .directors-board__table-scroll .directors-board__table tbody td.directors-board__checkbox-cell {
  z-index: 2;
  background: var(--bg);
}

#panel-directors-board .directors-board__table-scroll .directors-board__table thead th.directors-board__th-cell_full_name,
#panel-directors-board .directors-board__table-scroll .directors-board__table tbody td.directors-board__cell_fio {
  position: sticky;
  left: 2.5rem;
  z-index: 3;
  background: var(--bg-elevated);
  box-shadow: var(--foreman-ts-sticky-col-shadow, 3px 0 8px -4px color-mix(in srgb, var(--text) 12%, transparent));
}

#panel-directors-board .directors-board__table-scroll .directors-board__table tbody td.directors-board__cell_fio {
  z-index: 1;
  background: var(--bg);
}

#panel-directors-board .directors-board__table-scroll .directors-board__row_selected td.directors-board__checkbox-cell,
#panel-directors-board .directors-board__table-scroll .directors-board__row_selected td.directors-board__cell_fio {
  background: var(--accent-muted);
}

.directors-board__tbody_dense .directors-board__row {
  content-visibility: auto;
  contain-intrinsic-size: auto 2.75rem;
}

.directors-board__assign-label {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  line-height: 1.25;
  text-align: left;
  max-width: 100%;
}

.directors-board__assign-primary {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directors-board__assign-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
  white-space: nowrap;
}

.directors-board__th-cell_business_direction_name .directors-board__th-label {
  text-align: center;
  width: 100%;
}

.directors-board__cell_text_business_direction_name {
  text-align: center;
}

.directors-board__cell_text_business_direction_name .directors-board__cell-text {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.directors-board__cell_priority .directors-board__cell-text,
.directors-board__cell_priority .directors-board__cell-value,
.directors-board__cell_assign .directors-board__cell-value_clickable {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: normal;
}

.directors-board__cell-value_clickable {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  max-width: 100%;
  touch-action: manipulation;
}

.directors-board__cell-value_clickable:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-underline-offset: 0.15em;
}

.directors-board__cell-value_clickable:focus-visible {
  color: var(--accent);
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.15em;
}

@media (max-width: 900px) {
  .directors-board__table col.directors-board__col_position {
    width: 0;
  }

  .directors-board__table th.directors-board__th-cell_position_name,
  .directors-board__table td.directors-board__cell_text_position_name {
    display: none;
    width: 0;
    padding: 0;
    border: 0;
  }

  .directors-board__table col.directors-board__col_docflow {
    width: 30%;
  }

  .directors-board__table col.directors-board__col_foreman {
    width: 22%;
  }
}

.directors-board__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: 0 var(--space-1);
  border: none;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  min-height: 0;
}

.directors-board__th:hover {
  background: var(--surface-hover);
}

.directors-board__th:hover .directors-board__th-label {
  color: var(--text);
}

.directors-board__th[aria-pressed='true'] {
  background: var(--accent-muted);
}

.directors-board__th[aria-pressed='true'] .directors-board__th-label {
  color: var(--accent);
  font-weight: 700;
}

#panel-directors-board .directors-board__table .directors-board__th[aria-pressed='true'] .directors-board__th-label {
  color: var(--accent);
  font-weight: 700;
}

.directors-board__th:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.directors-board__th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directors-board__th-sort {
  flex: 0 0 auto;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

/* Заголовок колонки: рамка chip + ▼ autofilter (см. doc/web-column-autofilter.md §11). */
.directors-board__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.directors-board__th-chip .directors-board__th,
.directors-board__th-chip .directors-board__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.directors-board__th-chip .directors-board__th {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

.directors-board__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.directors-board__th-chip:has(.directors-board__th-filter_active) {
  border-color: var(--accent);
}

.directors-board__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  bottom: auto;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--transition);
}

.directors-board__th-filter::before {
  content: "";
  position: absolute;
  inset: -0.375rem;
}

.directors-board__th-filter:hover {
  color: var(--accent-hover);
}

.directors-board__th-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.directors-board__th-filter_active {
  color: var(--accent);
}

#panel-directors-board .directors-board__table th.directors-board__th-cell:not(.directors-board__checkbox-cell) {
  vertical-align: middle;
}

.directors-board__table thead th.directors-board__th-cell {
  max-width: none;
  overflow: visible;
}

.directors-board__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

.directors-board__active-filters {
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2);
}

.directors-board__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.directors-board__active-filters-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
}

.directors-board__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.directors-board__filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.directors-board__filter-chip-detail {
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.directors-board__active-filters-clear-all {
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.directors-board__active-filters-clear-all:hover {
  text-decoration: underline;
}

.directors-board__cell-text,
.directors-board__cell-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directors-board__cell_draggable[draggable='true'] {
  cursor: grab;
}

.directors-board__cell_draggable[draggable='true']:active {
  cursor: grabbing;
}

/* Ячейки «Площадка / договор» и «Прораб»: сброс по hover/focus */
.directors-board__cell_assign {
  position: relative;
}

.directors-board__cell_assign:has(.directors-board__cell-clear-btn) {
  padding-right: calc(var(--space-6) + var(--space-2));
}

.directors-board__cell-clear-btn {
  position: absolute;
  top: 50%;
  right: var(--space-1);
  transform: translateY(-50%);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font: 600 1.125rem/1 system-ui, sans-serif;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s, background 0.15s;
}

.directors-board__cell_assign:hover .directors-board__cell-clear-btn,
.directors-board__cell_assign:focus-within .directors-board__cell-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .directors-board__cell_assign:has(.directors-board__cell-clear-btn) .directors-board__cell-clear-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.directors-board__cell-clear-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.directors-board__cell-clear-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.directors-board__cell-clear-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.directors-board__empty-row td {
  padding: var(--space-8) var(--space-4);
}

.directors-board__empty-cell {
  text-align: center;
  vertical-align: middle;
}

.directors-board__empty-title {
  display: block;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.directors-board__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.directors-board__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: min(62vh, 560px);
  overflow: auto;
  padding-right: var(--space-1);
  padding-bottom: var(--space-1);
}

.directors-board__card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.directors-board__card_drop:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.directors-board__card_drag-over {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 2px var(--accent-focus);
  transform: translateY(-1px);
}

.directors-board__card_drop.directors-board__card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.directors-board__card-title {
  font-weight: 600;
  word-break: break-word;
}

.directors-board__card-sub {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: var(--leading-normal);
  word-break: break-all;
}

.directors-board__card-foot {
  margin-top: var(--space-1);
}

.directors-board__card-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.directors-board__card_foreman_no-user {
  border-style: dashed;
}

.directors-board__card_foreman_no-user.directors-board__card:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 2px;
}

.directors-board__card-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
}

.directors-board__cards-empty {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(24, 28, 36, 0.65);
}

.directors-board__cards-empty-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.directors-board__cards-empty-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.directors-board__fatal {
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}

.directors-board__fatal-text {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
}

.directors-board_state_loading {
  padding: var(--space-2);
}

.directors-board_state_loading .directors-board__loading-msg {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

.directors-board__skel {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-hover) 0%,
    var(--border) 50%,
    var(--surface-hover) 100%
  );
  background-size: 200% 100%;
  animation: directors-board-skel-shimmer 1.2s ease-in-out infinite;
}

.directors-board__skel_btn {
  width: 160px;
  height: var(--db-control-height);
}

.directors-board__skel_title {
  height: 22px;
  width: 55%;
  max-width: 260px;
  margin-bottom: var(--space-2);
}

.directors-board__skel_line {
  height: 14px;
  width: 88%;
  max-width: 400px;
  margin-bottom: var(--space-3);
}

.directors-board__skel_table {
  min-height: 200px;
  width: 100%;
}

.directors-board__skel_cards {
  min-height: 160px;
  width: 100%;
}

@keyframes directors-board-skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* Чекбоксы выбора сотрудников: по умолчанию видны при наведении на строку; при выборе — у всех */
.directors-board__checkbox-cell {
  width: 2.5rem;
  padding: var(--space-2);
  vertical-align: middle;
  text-align: center;
}
.directors-board__checkbox-cell input[type='checkbox'] {
  cursor: pointer;
  opacity: 0.4;
  transition: opacity var(--transition);
}
.directors-board__table tbody tr:hover .directors-board-row-checkbox,
.directors-board__table.directors-board-has-selection .directors-board-row-checkbox,
.directors-board__table.directors-board-has-selection .directors-board-select-all-checkbox {
  opacity: 1;
}
.directors-board__row_selected .directors-board-row-checkbox {
  opacity: 1;
}
.directors-board__row_selected {
  background: rgba(59, 130, 246, 0.08);
}
.directors-board__row_dragging {
  opacity: 0.55;
}
.directors-board__row_dragging .directors-board__cell_draggable {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* Панель массовых действий (Переместить) */
.directors-board__bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(59, 130, 246, 0.08);
}
.directors-board__bulk-actions.hidden {
  display: none !important;
}
.directors-board__bulk-count {
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 600;
}
.directors-board__bulk-move-btn {
  min-height: var(--db-control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--accent);
  border-radius: var(--db-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.directors-board__bulk-move-btn:hover {
  background: var(--accent);
  color: #fff;
}
.directors-board__bulk-move-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* Попап приказа о перемещении */
.directors-board__dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0;
  max-width: 560px;
  width: 90vw;
  box-shadow: var(--shadow-lg);
}

.directors-board__dialog_compact {
  max-width: min(90vw, 26rem);
}
.directors-board__dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.directors-board__dialog-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.directors-board__dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.directors-board__dialog-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
}
.directors-board__dialog-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xl);
  cursor: pointer;
  padding: 0 var(--space-1);
  line-height: 1;
}
.directors-board__dialog-close:hover {
  color: var(--text);
}
.directors-board__dialog-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.directors-board__dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
}

/* Секции внутри попапа приказа */
.directors-board__order-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.directors-board__order-heading {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.directors-board__order-emp-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 200px;
  overflow-y: auto;
}
.directors-board__order-emp {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.directors-board__order-emp:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}
.directors-board__order-emp-name {
  font-weight: 600;
}
.directors-board__order-emp-position {
  color: var(--text-muted);
}
.directors-board__order-emp-object,
.directors-board__order-emp-direction {
  color: var(--text-muted);
}
.directors-board__order-emp-node {
  color: var(--text-subtle);
  font-size: var(--text-xs);
}
.directors-board__dialog-footer .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.directors-board__dialog-footer .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-muted);
}
.directors-board__dialog-footer .btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.directors-board__dialog-footer .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.directors-board__dialog-footer .btn-primary:hover {
  background: var(--accent-hover);
}
.directors-board__dialog-footer .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.directors-board__dialog-footer .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.directors-board__order-section .directors-board__control {
  width: 100%;
}

.directors-board__clear-intro {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.directors-board__clear-fieldset {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.directors-board__clear-legend {
  padding: 0;
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.directors-board__clear-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}
.directors-board__clear-option input[type="checkbox"] {
  margin-top: 0.15em;
  flex-shrink: 0;
}
.directors-board__clear-option:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Панель «Сотрудники»: сетка тулбара, поле поиска, карточка с таблицей — в духе «Для директоров» */
.panel-body_employees-registry {
  padding-top: var(--space-4);
}

.employees-registry {
  --er-control-height: 44px;
  --er-control-radius: var(--radius-md);

  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.employees-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.employees-registry__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .employees-registry__stats {
    grid-template-columns: 1fr;
  }
}

.employees-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.employees-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.employees-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

/* Панель «Договоры»: Module Panel Pattern — h2 снаружи, всё остальное в .card */
.panel-body_docflow {
  padding-top: var(--space-4);
}

.docflow-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  width: 100%;
  min-width: 0;
}

.docflow-panel__toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

@media (max-width: 640px) {
  .docflow-panel__toolbar-row {
    flex-wrap: wrap;
  }
}

.docflow-panel__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
}

.docflow-panel__search-bar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  min-height: var(--field-height);
  height: var(--field-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.docflow-panel__search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.docflow-panel__search-icon {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.docflow-panel__search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  outline: none;
  padding: 0;
}

.docflow-panel__search-input::placeholder {
  color: var(--text-muted);
}

.docflow-panel__search-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.docflow-panel__search-bar .docflow-search-bar-shortcut {
  flex-shrink: 0;
  margin: 0;
  min-height: 1.5rem;
  line-height: 1.2;
}

.docflow-panel__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--field-height);
  height: var(--field-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.docflow-panel__control::placeholder {
  color: var(--text-muted);
}

.docflow-panel__control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.docflow-panel__control:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.docflow-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 900px) {
  .docflow-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .docflow-stats {
    grid-template-columns: 1fr;
  }
}

.docflow-stats__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.docflow-stats__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.docflow-stats__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.employees-registry__toolbar {
  width: 100%;
}

/* Одна строка: приём (+), обновление, поиск */
.employees-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

@media (max-width: 640px) {
  .employees-registry__toolbar-row {
    flex-wrap: wrap;
  }
}

.employees-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.employees-registry__toolbar-search .employees-registry__control {
  width: 100%;
  min-width: 0;
}

/* Registry toolbar actions: btn-secondary исключён из .panel button — задаём chrome явно */
:is(
  .employees-registry__icon-btn,
  .employees-registry__refresh-btn,
  .employees-registry__export-btn,
  .employees-registry__bulk-remote-btn,
  .employees-registry__bulk-delete-btn,
  .positions-registry__icon-btn,
  .positions-registry__refresh-btn,
  .positions-registry__bulk-delete-btn,
  .users-registry__icon-btn,
  .users-registry__refresh-btn,
  .users-registry__bulk-delete-btn,
  .organizations-registry__icon-btn,
  .organizations-registry__refresh-btn,
  .organizations-registry__bulk-delete-btn,
  .docflow-customers-registry__icon-btn,
  .docflow-customers-registry__refresh-btn,
  .docflow-customers-registry__bulk-delete-btn,
  .subdivisions-registry__icon-btn,
  .subdivisions-registry__refresh-btn,
  .shipments-registry__refresh-btn,
  .individuals-registry__icon-btn,
  .individuals-registry__refresh-btn,
  .movements-registry__refresh-btn,
  .movements-registry__bulk-close-btn,
  .marks-registry__icon-btn,
  .marks-registry__toggle-text
) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

:is(
  .employees-registry__icon-btn,
  .employees-registry__refresh-btn,
  .employees-registry__export-btn,
  .employees-registry__bulk-remote-btn,
  .positions-registry__icon-btn,
  .positions-registry__refresh-btn,
  .users-registry__icon-btn,
  .users-registry__refresh-btn,
  .organizations-registry__icon-btn,
  .organizations-registry__refresh-btn,
  .docflow-customers-registry__icon-btn,
  .docflow-customers-registry__refresh-btn,
  .subdivisions-registry__icon-btn,
  .subdivisions-registry__refresh-btn,
  .shipments-registry__refresh-btn,
  .individuals-registry__icon-btn,
  .individuals-registry__refresh-btn,
  .movements-registry__refresh-btn,
  .movements-registry__bulk-close-btn,
  .marks-registry__icon-btn,
  .marks-registry__toggle-text
):hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

:is(
  .employees-registry__bulk-delete-btn,
  .positions-registry__bulk-delete-btn,
  .users-registry__bulk-delete-btn,
  .organizations-registry__bulk-delete-btn,
  .docflow-customers-registry__bulk-delete-btn
):hover {
  border-color: var(--err);
  background: var(--err-muted);
  color: var(--err);
}

:is(
  .employees-registry__icon-btn,
  .employees-registry__refresh-btn,
  .employees-registry__export-btn,
  .employees-registry__bulk-remote-btn,
  .employees-registry__bulk-delete-btn,
  .positions-registry__icon-btn,
  .positions-registry__refresh-btn,
  .positions-registry__bulk-delete-btn,
  .users-registry__icon-btn,
  .users-registry__refresh-btn,
  .users-registry__bulk-delete-btn,
  .organizations-registry__icon-btn,
  .organizations-registry__refresh-btn,
  .organizations-registry__bulk-delete-btn,
  .docflow-customers-registry__icon-btn,
  .docflow-customers-registry__refresh-btn,
  .docflow-customers-registry__bulk-delete-btn,
  .subdivisions-registry__icon-btn,
  .subdivisions-registry__refresh-btn,
  .shipments-registry__refresh-btn,
  .individuals-registry__icon-btn,
  .individuals-registry__refresh-btn,
  .movements-registry__refresh-btn,
  .movements-registry__bulk-close-btn,
  .marks-registry__icon-btn,
  .marks-registry__toggle-text
):focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* Toolbar panel actions: btn-secondary вне registry и .panel button */
:is(
  .directors-board__refresh-btn,
  .ts-sum__month-btn,
  .ts-sum__export-btn,
  .ts-sum__reset-btn,
  .ts-ana-registry__month-btn,
  .ts-ana-registry__reset-btn,
  .ts-rep__month-btn,
  .ts-rep__export-btn,
  .anviz-ph-registry__quick-btn,
  .anviz-ph-registry__action-btn,
  .pm-matrix__toolbar-icon-btn
) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

:is(
  .directors-board__refresh-btn,
  .ts-sum__month-btn,
  .ts-sum__export-btn,
  .ts-sum__reset-btn,
  .ts-ana-registry__month-btn,
  .ts-ana-registry__reset-btn,
  .ts-rep__month-btn,
  .ts-rep__export-btn,
  .anviz-ph-registry__quick-btn,
  .anviz-ph-registry__action-btn,
  .pm-matrix__toolbar-icon-btn
):hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

:is(
  .directors-board__refresh-btn,
  .ts-sum__month-btn,
  .ts-sum__export-btn,
  .ts-sum__reset-btn,
  .ts-ana-registry__month-btn,
  .ts-ana-registry__reset-btn,
  .ts-rep__month-btn,
  .ts-rep__export-btn,
  .anviz-ph-registry__quick-btn,
  .anviz-ph-registry__action-btn,
  .pm-matrix__toolbar-icon-btn
):focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.employees-registry__icon-btn {
  width: var(--er-control-height);
  min-width: var(--er-control-height);
  height: var(--er-control-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--er-control-radius);
}

.employees-registry__refresh-btn,
.employees-registry__export-btn,
.employees-registry__bulk-remote-btn,
.employees-registry__bulk-delete-btn {
  min-height: var(--er-control-height);
  height: var(--er-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--er-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.employees-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--er-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--er-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.employees-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.employees-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.employees-registry__control_inline {
  min-height: var(--er-control-height);
  margin-left: var(--space-2);
  max-width: min(100%, 420px);
}

.employees-registry__inline-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
}

.employees-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--accent);
}

.employees-registry__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.employees-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#panel-employees .employees-registry .employees-registry__pane-title {
  margin: 0;
}

.employees-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.employees-registry__list-host {
  min-height: 80px;
}

.employees-registry__loading {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.employees-registry__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.employees-registry__table th,
.employees-registry__table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
}

.employees-registry__table td {
  line-height: var(--leading-normal);
}

.employees-registry__table thead th {
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.employees-registry__table thead th.employees-registry__th-cell {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

/* Заголовок колонки: одна рамка; ▼ в правом нижнем углу внутри (Excel autofilter).
   Кнопки th/th-filter исключены из глобального .panel button (см. ~6423). */
.employees-registry__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.employees-registry__th-chip .employees-registry__th,
.employees-registry__th-chip .employees-registry__head-static,
.employees-registry__th-chip .employees-registry__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employees-registry__th-chip .employees-registry__th,
.employees-registry__th-chip .employees-registry__head-static {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

.employees-registry__th {
  box-sizing: border-box;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition:
    background var(--transition),
    border-color var(--transition);
}

.employees-registry__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.employees-registry__th:hover {
  background: transparent;
}

.employees-registry__th:hover .employees-registry__th-label {
  color: var(--accent-hover);
}

.employees-registry__th:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.employees-registry__th-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.employees-registry__th-sort {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.employees-registry__head-static {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.employees-registry__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  bottom: auto;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--transition);
}

.employees-registry__th-filter::before {
  content: "";
  position: absolute;
  inset: -0.375rem;
}

.employees-registry__th-filter:hover {
  color: var(--accent-hover);
}

.employees-registry__th-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.employees-registry__th-filter_active {
  color: var(--accent);
}

.employees-registry__th-chip:has(.employees-registry__th-filter_active) {
  border-color: var(--accent);
}

.employees-registry__th-filter_active:hover {
  color: var(--accent-hover);
}

.employees-registry__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

.employees-registry__col-filter-popover,
.employees-registry__col-filter-dialog {
  position: fixed;
  z-index: var(--z-dropdown, 40);
  box-sizing: border-box;
  width: min(20rem, calc(100vw - 16px));
  min-width: 14rem;
  max-height: min(28rem, calc(100vh - 24px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg, var(--shadow-md));
}

.employees-registry__col-filter-dialog[open] {
  position: fixed;
  inset: auto;
  margin: 0;
  max-width: min(20rem, calc(100vw - 16px));
}

.employees-registry__col-filter-dialog::backdrop {
  display: none;
}

.employees-registry__col-filter-dialog_bottom-sheet::backdrop {
  display: block;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.employees-registry__col-filter-dialog_bottom-sheet {
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(85dvh, 28rem);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.employees-registry__col-filter-form {
  display: flex;
  flex-direction: column;
  max-height: min(28rem, calc(100vh - 24px));
  margin: 0;
}

.employees-registry__col-filter-form-head {
  flex: 0 0 auto;
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 88%, var(--bg));
}

.employees-registry__col-filter-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: var(--space-2) var(--space-3);
}

.employees-registry__col-filter-form-foot {
  flex: 0 0 auto;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 92%, var(--bg));
}

.employees-registry__col-filter-fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-inline-size: 0;
}

.employees-registry__col-filter-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.employees-registry__col-filter-apply:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.employees-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.employees-registry__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.employees-registry__active-filters-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
}

.employees-registry__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.employees-registry__filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.employees-registry__filter-chip-detail {
  color: var(--text-subtle);
}

.employees-registry__active-filters-clear-all {
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.employees-registry__active-filters-clear-all:hover {
  text-decoration: underline;
}

@media (max-width: 56rem) {
  .employees-registry__toolbar-row {
    flex-wrap: wrap;
  }

  .employees-registry__toolbar-search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .employees-registry__th-chip {
    min-height: 40px;
  }

  .employees-registry__th,
  .employees-registry__head-static {
    min-height: 40px;
    padding: var(--space-1) var(--space-2);
  }

  .employees-registry__th-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .employees-registry__filter-chip-detail {
    max-width: 10rem;
  }
}

.employees-registry__col-filter-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.employees-registry__col-filter-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.employees-registry__col-filter-head-clear {
  flex: 0 0 auto;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
}

.employees-registry__col-filter-head-clear:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--surface-hover);
}

.employees-registry__col-filter-head-clear:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.employees-registry__col-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.employees-registry__col-filter-actions_bottom {
  margin-top: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.employees-registry__col-filter-form-foot-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.employees-registry__col-filter-apply-hint,
.employees-registry__col-filter-live {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.employees-registry__col-filter-form-foot:has(.employees-registry__col-filter-live:not(:empty)) {
  gap: var(--space-2);
}

.employees-registry__col-filter-action,
.employees-registry__col-filter-cancel {
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.employees-registry__col-filter-action:hover,
.employees-registry__col-filter-cancel:hover {
  text-decoration: underline;
}

.employees-registry__col-filter-apply {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}

.employees-registry__col-filter-apply:hover {
  background: var(--accent-hover);
}

.employees-registry__col-filter-apply:focus-visible,
.employees-registry__col-filter-cancel:focus-visible,
.employees-registry__col-filter-action:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.employees-registry__col-filter-search-wrap {
  margin-bottom: var(--space-2);
}

.employees-registry__col-filter-search-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
}

.employees-registry__col-filter-search {
  box-sizing: border-box;
  width: 100%;
  min-height: 36px;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.employees-registry__col-filter-option_master {
  margin: 0 0 var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 92%, var(--surface-elevated));
  font-weight: 500;
}

.employees-registry__col-filter-option_master .employees-registry__col-filter-option-label {
  color: var(--text-subtle);
}

.employees-registry__col-filter-list {
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.employees-registry__col-filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  cursor: pointer;
}

.employees-registry__col-filter-option-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.employees-registry__filter-chip-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.employees-registry__col-filter-option-count {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
}

.employees-registry__col-filter-loading,
.employees-registry__col-filter-empty,
.employees-registry__col-filter-error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.employees-registry__col-filter-error {
  color: var(--err);
}

@media (prefers-reduced-motion: reduce) {
  .employees-registry__th-filter,
  .employees-registry__col-filter-popover {
    transition: none;
  }
}

.employees-registry__th-cell_anviz {
  width: 7rem;
  max-width: 7rem;
  text-align: center;
}
.employees-registry__table td.employees-registry__cell_anviz {
  width: 7rem;
  max-width: 7rem;
  text-align: center;
  vertical-align: middle;
}
.employees-registry__anviz-code {
  font-variant-numeric: tabular-nums;
  font-size: 0.9em;
}
.employees-registry__th-cell_zup {
  width: 7rem;
  max-width: 7rem;
  text-align: center;
}
.employees-registry__table td.employees-registry__cell_zup {
  width: 7rem;
  max-width: 7rem;
  text-align: center;
  vertical-align: middle;
}

.employees-registry__table thead th:nth-child(2),
.employees-registry__table tbody td:nth-child(2) {
  min-width: 10rem;
}

.employees-registry__cell_fio {
  overflow: hidden;
  vertical-align: middle;
}

.employees-registry__cell-fio-stack {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  max-width: 100%;
}

.employees-registry__cell-fio-surname {
  display: block;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employees-registry__cell-fio-given {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: var(--leading-tight);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employees-registry__cell-fio-given_only {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.employees-registry__cell-fio-fallback {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Инфоблок в карточке сотрудника: ID, даты, источник */
.employee-profile-info {
  margin: 0 0 var(--space-4);
}

.employee-profile-info__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2) 0;
}

.employee-profile-info__item {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.employee-profile-info__label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
  line-height: 1.4;
}

.employee-profile-info__value {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

/* Секция пользователя в карточке */
.employee-profile-user-section {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.employee-profile-user-section.hidden {
  display: none;
}

.employee-profile-user-info__text {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text);
}

.employee-profile-create-user-btn {
  display: inline-flex;
}

.employees-registry__table tbody tr.employees-registry__row[data-employee-id] {
  cursor: pointer;
}

.employees-registry__table tbody tr.employees-registry__row[data-employee-id]:hover {
  background: var(--surface-hover);
}

.employees-registry__sentinel .employees-registry__sentinel-cell {
  text-align: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  border-bottom: none;
  cursor: default;
  user-select: none;
}

.employees-registry__load-more-text {
  display: inline-block;
  max-width: 100%;
}

.dialog-employee-profile.dialog-employee-create {
  max-width: min(92vw, 50rem);
}

.dialog-employee-profile-body.dialog-employee-create-body {
  display: block;
  max-height: min(78vh, 36rem);
  min-height: min(50vh, 18rem);
  overflow-y: auto;
  color: var(--text);
  padding: var(--space-4);
}
.employee-profile-position-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.employee-profile-position-form .form-field {
  margin: 0;
}

.employee-profile-position-form .form-field label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.employee-profile-position-form select {
  width: 100%;
}

.employee-profile-position-form__hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

/* Основной контент карточки (рендер из JS) */
.employee-profile-report {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text);
}

.employee-profile-report p {
  margin: 0 0 var(--space-2);
  color: var(--text);
}

.employee-profile-report p:last-child {
  margin-bottom: 0;
}

.employee-profile-report b {
  font-weight: 600;
  color: var(--text);
}

/* Заголовки секций */
.employee-profile-report h4 {
  margin: var(--space-5) 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Таблицы */
.employee-profile-report table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.employee-profile-report table:last-child {
  margin-bottom: 0;
}

.employee-profile-report thead {
  background: var(--bg-elevated);
}

.employee-profile-report th,
.employee-profile-report td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.employee-profile-report th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.employee-profile-report td {
  color: var(--text);
}

.employee-profile-report tbody tr:last-child td {
  border-bottom: none;
}

.employee-docflow-foreman-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.employee-docflow-foreman-table:last-child {
  margin-bottom: 0;
}

.employee-docflow-foreman-table th,
.employee-docflow-foreman-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.employee-docflow-foreman-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  background: var(--bg-elevated);
}

.employee-docflow-foreman-table tbody tr:last-child td {
  border-bottom: none;
}

.employee-docflow-foreman-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* Пустая секция в карточке сотрудника */
.employee-profile-empty-section {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* Загрузка */
.employee-profile-report .employee-profile-report__loading {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-6);
  font-size: var(--text-sm);
}

/* Кнопка повтора после ошибки */
.employee-profile-report__retry-wrap {
  text-align: center;
  margin: var(--space-3) 0 0;
}

/* === Карточка пользователя (dialog-user-edit) — best practices 2026 === */
.dialog-user-card {
  max-width: min(90vw, 28rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 6px rgba(0, 0, 0, 0.15),
    0 20px 40px -10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
  opacity: 0;
  transform: scale(0.96) translateY(-10px);
  overflow: hidden;
}
.dialog-user-card[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
}
.dialog-user-card::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.dialog-user-card[open]::backdrop {
  @starting-style {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}
.dialog-user-card__inner {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 40rem);
  overflow: hidden;
}
.dialog-user-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-3);
  flex-shrink: 0;
}
.dialog-user-card__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.dialog-user-card__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dialog-user-card__close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}
.dialog-user-card__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dialog-user-card__body {
  /* Не растягиваем пустое пространство: body по контенту, но со скроллом при переполнении. */
  flex: 0 1 auto;
  overflow-y: auto;
  max-height: min(calc(88vh - 10rem), calc(40rem - 10rem));
  padding: 0 var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.dialog-user-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-4);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.dialog-user-card__footer .btn-primary {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}
.dialog-user-card__footer .btn-primary:hover {
  background: var(--accent-hover);
}
.dialog-user-card__footer .btn-primary:active {
  transform: scale(0.98);
}
.dialog-user-card__footer .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero */
.user-card__hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, color-mix(in srgb, var(--bg-elevated) 90%, var(--accent)) 0%, var(--bg-elevated) 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.user-card__avatar {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 0 0 3px var(--surface), 0 2px 8px rgba(0,0,0,0.25);
  background: var(--avatar-bg, var(--accent));
}
.user-card__identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.user-card__role-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
}
.user-card__name {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: var(--leading-tight);
  word-break: break-word;
}

/* Info Grid */
.user-card__info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.user-card__info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.user-card__info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}
.user-card__info-value {
  font-size: var(--text-sm);
  color: var(--text);
  word-break: break-word;
  font-family: var(--font-sans);
}
.user-card__info-value--mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.user-card__info-value--copy {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.user-card__info-value--copy:hover {
  color: var(--accent);
}
.user-card__info-value--copy::after {
  content: 'копировать';
  font-size: 10px;
  color: var(--text-subtle);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.user-card__info-value--copy:hover::after {
  opacity: 1;
}

.user-card__info-value--mono {
  font-family: var(--font-mono);
}

.user-card__info-value--warn {
  color: color-mix(in srgb, var(--warn, #eab308) 80%, var(--text));
  cursor: default;
}

.user-card__info-value--warn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Баннер блокировки в карточке — alert style */
.user-card__lockout-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
}

.user-card__lockout-banner.hidden {
  display: none;
}

.user-card__lockout-banner--warning {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.35);
}

.user-card__lockout-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.user-card__lockout-text {
  flex: 1;
  line-height: 1.5;
}

.user-card__lockout-text strong {
  font-weight: 600;
  color: var(--err);
}

.user-card__lockout-banner--warning .user-card__lockout-text strong {
  color: var(--warn);
}

.user-card__lockout-reset-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--err);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.user-card__lockout-reset-btn:hover {
  background: #dc2626;
}

.user-card__lockout-reset-btn:active {
  transform: scale(0.97);
}

.user-card__lockout-reset-btn:focus-visible {
  outline: 2px solid var(--err);
  outline-offset: 2px;
}

/* Section Card */
.user-card__section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  /* Не даём секциям "растягиваться" по высоте в flex-контейнере модалки. */
  flex: 0 0 auto;
}
.user-card__section-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.user-card__section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 1rem;
  background: var(--accent);
  border-radius: 2px;
}

.user-card__section--collapsible > summary.user-card__section-title {
  cursor: pointer;
  list-style: none;
}

.user-card__section--collapsible > summary.user-card__section-title::-webkit-details-marker {
  display: none;
}

.user-card__section--collapsible > summary.user-card__section-title::after {
  content: '▾';
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.user-card__section--collapsible[open] > summary.user-card__section-title::after {
  transform: rotate(-180deg);
}

.user-card__field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* User card: recovery email (админ, секция «Безопасность») */
.user-card-recovery-email-host.hidden {
  display: none;
}

.user-card-recovery-email {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.user-card-recovery-email__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.user-card-recovery-email__title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.user-card-recovery-email__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

.user-card-recovery-email__badge_on {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: color-mix(in srgb, var(--success) 8%, var(--bg-elevated));
}

.user-card-recovery-email__badge_warn {
  color: var(--text-muted);
}

.user-card-recovery-email__hint {
  margin: 0 0 var(--space-3);
}

.user-card-recovery-email__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-end;
}

.user-card-recovery-email__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 14rem;
  min-width: 0;
}

.user-card-recovery-email__field-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.user-card-recovery-email__field input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
}

.user-card-recovery-email__field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.user-card-recovery-email__submit {
  min-height: 2.5rem;
  flex-shrink: 0;
}

.user-card-recovery-email__status {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 1.25rem;
}

.user-card-recovery-email__status_ok {
  color: var(--success);
}

.user-card-recovery-email__status_error {
  color: var(--danger, #dc2626);
}

.user-card-recovery-email__status_info {
  color: var(--text-muted);
}

.user-card-recovery-email__loading {
  margin: 0;
}

.user-card-recovery-email__error {
  margin: 0;
  color: var(--danger, #dc2626);
}

.user-card__form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.user-card__form .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
}
.user-card__form .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.user-card__form .form-field input,
.user-card__form .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.user-card__form .form-field input::placeholder {
  color: var(--text-subtle);
}
.user-card__form .form-field input:hover,
.user-card__form .form-field select:hover {
  border-color: var(--border-muted);
}
.user-card__form .form-field input:focus,
.user-card__form .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Password toggle */
.user-card__password-toggle {
  margin-top: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface);
}
.user-card__password-toggle summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  list-style: none;
}
.user-card__password-toggle summary::-webkit-details-marker {
  display: none;
}
.user-card__password-toggle summary svg {
  color: var(--text-subtle);
  flex-shrink: 0;
}
.user-card__password-toggle[open] summary {
  margin-bottom: var(--space-3);
  color: var(--text);
}
.user-card__password-toggle .form-field_password {
  margin: 0;
}

/* TOTP status в карточке */
.user-card__form .form-field_totp-wizard-trigger .totp-wizard-trigger__status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.user-card__form .totp-wizard-trigger__btn {
  margin-left: auto;
}

/* Audit log section */
.user-card__audit-log {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.user-card__audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.user-card__audit-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.user-card__audit-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.user-card__audit-item:first-child {
  padding-top: 0;
}
.user-card__audit-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-card__audit-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.user-card__audit-event {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text);
}
.user-card__audit-meta {
  display: flex;
  gap: 1rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}
.user-card__audit-time {
  font-family: var(--font-mono);
}
.user-card__audit-location {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Status badges */
.user-card__status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 600;
}
.user-card__status-badge--active {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
}
.user-card__status-badge--pending {
  background: color-mix(in srgb, var(--warning) 15%, transparent);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
}
.user-card__status-badge--inactive {
  background: color-mix(in srgb, var(--text-subtle) 15%, transparent);
  color: var(--text-subtle);
  border: 1px solid var(--border);
}

/* Замещение ролей в карточке пользователя */
.user-card-substitute-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.user-card-substitute-check input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* === Экспорт сотрудников (dialog-employees-export) === */
.employees-export-dialog {
  max-width: min(92vw, 36rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 6px rgba(0, 0, 0, 0.15),
    0 20px 40px -10px rgba(0, 0, 0, 0.5);
}
.employees-export-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
.employees-export-dialog__inner {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 32rem);
}
.employees-export-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-2);
  flex-shrink: 0;
}
.employees-export-dialog__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}
.employees-export-dialog__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
}
.employees-export-dialog__close:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.employees-export-dialog__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.employees-export-dialog__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.employees-export-dialog__scope {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.employees-export-dialog__legend {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  padding: 0;
  margin: 0 0 var(--space-1);
}
.employees-export-dialog__radio,
.employees-export-dialog__checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}
.employees-export-dialog__checkbox_fired {
  margin-left: var(--space-1);
}
.employees-export-dialog__checkbox_fired.hidden {
  display: none;
}
.employees-export-dialog__fields-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.employees-export-dialog__presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.employees-export-dialog__preset-btn {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
}
.employees-export-dialog__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.employees-export-dialog__field-group-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.employees-export-dialog__field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-2) var(--space-3);
}
.employees-export-dialog__field-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}
.employees-export-dialog__field-label input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.employees-export-dialog__status {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 1.25rem;
}
.employees-export-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5) var(--space-4);
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.employees-registry__export-btn.hidden {
  display: none;
}

.employees-remote-bulk-dialog {
  max-width: min(96vw, 52rem);
}
.employees-remote-bulk-dialog .employees-export-dialog__inner {
  max-height: min(88vh, 36rem);
}
.employees-remote-bulk-dialog__hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}
.employees-remote-bulk-dialog__summary {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  font-weight: 600;
}
.employees-remote-bulk-dialog__bulk-role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}
.employees-remote-bulk-dialog__bulk-role-label {
  font-size: var(--text-sm);
  font-weight: 600;
  flex: 0 0 auto;
}
.employees-remote-bulk-dialog__bulk-role-select {
  flex: 1 1 10rem;
  min-width: 10rem;
  max-width: 16rem;
}
.employees-remote-bulk-dialog__bulk-role-hint {
  flex: 1 1 100%;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}
@media (min-width: 40rem) {
  .employees-remote-bulk-dialog__bulk-role-hint {
    flex: 1 1 auto;
    min-width: 12rem;
  }
}
.employees-remote-bulk-dialog__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.employees-remote-bulk-dialog__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.employees-remote-bulk-dialog__table th,
.employees-remote-bulk-dialog__table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.employees-remote-bulk-dialog__table th {
  font-weight: 600;
  background: var(--surface-elevated);
  white-space: nowrap;
}
.employees-remote-bulk-dialog__table tr:last-child td {
  border-bottom: none;
}
.employees-remote-bulk-dialog__table tr.is-skipped {
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}
.employees-remote-bulk-dialog__table select {
  width: 100%;
  min-width: 9rem;
}
.employees-remote-bulk-dialog__skip-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.employees-registry__bulk-remote-btn.hidden {
  display: none;
}

/* === Карточка сотрудника (dialog-employee-profile) — P-ENTITY-CARD === */
.dialog-employee-card {
  max-width: min(92vw, 50rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 6px rgba(0, 0, 0, 0.15),
    0 20px 40px -10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
  opacity: 0;
  transform: scale(0.96) translateY(-10px);
  overflow: hidden;
}
.dialog-employee-card[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
}
.dialog-employee-card::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.dialog-employee-card[open]::backdrop {
  @starting-style {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}
.dialog-employee-card__inner {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 40rem);
  overflow: hidden;
}
.dialog-employee-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-3);
  flex-shrink: 0;
}
.dialog-employee-card__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.dialog-employee-card__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dialog-employee-card__close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}
.dialog-employee-card__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dialog-employee-card__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.dialog-employee-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-4);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Hero */
.employee-card__hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, color-mix(in srgb, var(--bg-elevated) 90%, var(--accent)) 0%, var(--bg-elevated) 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.employee-card__avatar {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 0 0 3px var(--surface), 0 2px 8px rgba(0,0,0,0.25);
  background: var(--avatar-bg, var(--accent));
  overflow: hidden;
}
.employee-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.employee-card__avatar--photo {
  text-shadow: none;
}
.employee-card__identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.employee-card__status-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.employee-card__status-badge--fired {
  background: color-mix(in srgb, var(--err) 15%, transparent);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 25%, transparent);
}
.employee-card__name {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: var(--leading-tight);
  word-break: break-word;
}

/* Info Grid */
.employee-card__info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.employee-card__info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.employee-card__info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}
.employee-card__info-value {
  font-size: var(--text-sm);
  color: var(--text);
  word-break: break-word;
  font-family: var(--font-sans);
}
.employee-card__info-value--mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.employee-card__info-value--warning {
  color: #fbbf24; /* amber-400 для тёмной темы */
  font-weight: 600;
}
.employee-card__info-value--warning::before {
  content: '⚠ ';
  color: #fbbf24;
}

/* Section Card */
.employee-card__section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.employee-card__section-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.employee-card__section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 1rem;
  background: var(--accent);
  border-radius: 2px;
}
.employee-card__field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.employee-card__field-group .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
}
.employee-card__field-group .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.employee-card__field-group .form-field input,
.employee-card__field-group .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.employee-card__field-group .form-field input:hover,
.employee-card__field-group .form-field select:hover {
  border-color: var(--border-muted);
}
.employee-card__field-group .form-field input:focus,
.employee-card__field-group .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* User section */
.employee-card__user-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.employee-card__user-section.hidden {
  display: none;
}
.employee-card__user-info {
  font-size: var(--text-sm);
  color: var(--text);
}

/* Report content */
.employee-card__report {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text);
}

/* === Карточка договора (dialog-contract-card) === */
.dialog-contract-card {
  max-width: min(90vw, 28rem);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 6px rgba(0, 0, 0, 0.15),
    0 20px 40px -10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
  opacity: 0;
  transform: scale(0.96) translateY(-10px);
  overflow: hidden;
}
.dialog-contract-card[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
  @starting-style {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
}
.dialog-contract-card::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.dialog-contract-card[open]::backdrop {
  @starting-style {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}
.dialog-contract-card__inner {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 40rem);
  overflow: hidden;
}
.dialog-contract-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-3);
  flex-shrink: 0;
}
.dialog-contract-card__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}
.dialog-contract-card__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dialog-contract-card__close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}
.dialog-contract-card__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dialog-contract-card__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.dialog-contract-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-4);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.dialog-contract-card__footer .btn-primary {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}
.dialog-contract-card__footer .btn-primary:hover {
  background: var(--accent-hover);
}
.dialog-contract-card__footer .btn-primary:active {
  transform: scale(0.98);
}
.dialog-contract-card__footer .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero */
.contract-card__hero {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, color-mix(in srgb, var(--bg-elevated) 90%, var(--accent)) 0%, var(--bg-elevated) 100%);
  flex-shrink: 0;
}
.contract-card__hero-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
  align-self: flex-start;
}
.contract-card__hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}
.contract-card__hero-sep {
  color: var(--text-subtle);
}
.contract-card__counterparty-tag {
  display: inline-flex;
  align-items: center;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.contract-card__avatar {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 0 0 3px var(--surface), 0 2px 8px rgba(0,0,0,0.25);
  background: var(--avatar-bg, var(--accent));
}
.contract-card__avatar--accent {
  background: var(--accent);
}
.contract-card__identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.contract-card__status-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.contract-card__status-badge--active {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}
.contract-card__status-badge--closed {
  background: color-mix(in srgb, var(--text-subtle) 15%, transparent);
  color: var(--text-subtle);
  border: 1px solid var(--border);
}
.contract-card__name {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: var(--leading-tight);
  word-break: break-word;
}

/* Info Grid */
.contract-card__info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.contract-card__info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.contract-card__info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}
.contract-card__info-value {
  font-size: var(--text-sm);
  color: var(--text);
  word-break: break-word;
  font-family: var(--font-sans);
}
.contract-card__info-value--mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* Section Card */
.contract-card__section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.contract-card__section-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.contract-card__section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 1rem;
  background: var(--accent);
  border-radius: 2px;
}
.contract-card__field-group.docflow-entity-form-grid {
  margin: 0;
}

/* legacy: карточка без сетки (не используется в docflow forms) */
.contract-card__field-group:not(.docflow-entity-form-grid) {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
}
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field input,
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field input:hover,
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field select:hover {
  border-color: var(--border-muted);
}
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field input:focus,
.contract-card__field-group:not(.docflow-entity-form-grid) .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}
/* Направления в карточке договора — чекбоксы внутри docflow-entity-form-grid */
.contract-card__field-group.docflow-entity-form-grid .docflow-business-directions-field .director-sections-fieldset {
  margin-top: 0;
}
.contract-card__form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--space-4);
}
.employee-card__report p {
  margin: 0 0 var(--space-2);
}
.employee-card__report p:last-child {
  margin-bottom: 0;
}
.employee-card__report b {
  font-weight: 600;
  color: var(--text);
}
.employee-card__report h4 {
  margin: var(--space-4) 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}
.employee-card__report table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.employee-card__report table:last-child {
  margin-bottom: 0;
}
.employee-card__report thead {
  background: var(--bg-elevated);
}
.employee-card__report th,
.employee-card__report td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.employee-card__report th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.employee-card__report td {
  color: var(--text);
}
.employee-card__report tbody tr:last-child td {
  border-bottom: none;
}

/* Адаптив */
@media (max-width: 640px) {
  .dialog-employee-card {
    max-width: 96vw;
    border-radius: var(--radius-lg);
  }
  .employee-card__info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .employee-card__hero {
    padding: var(--space-3) var(--space-4);
  }
  .dialog-employee-card__header,
  .dialog-employee-card__body {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}
@media (max-width: 480px) {
  .dialog-user-card {
    max-width: 96vw;
    border-radius: var(--radius-lg);
  }
  .user-card__info-grid {
    grid-template-columns: 1fr;
  }
  .user-card__hero {
    padding: var(--space-3) var(--space-4);
  }
  .dialog-user-card__header,
  .dialog-user-card__body,
  .dialog-user-card__footer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
  .employee-card__info-grid {
    grid-template-columns: 1fr;
  }
}

.employee-profile-report p.err {
  color: var(--err);
  background: var(--err-muted);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
}

.employees-registry__bulk-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}
.employees-registry__bulk-actions.hidden {
  display: none !important;
}

.employees-registry__bulk-delete-btn {
  white-space: nowrap;
}

#employees-list .employees-registry__checkbox-cell {
  width: 2.5rem;
  max-width: 2.75rem;
  padding: var(--space-2);
  vertical-align: middle;
}
#employees-list .employees-registry-row-checkbox,
#employees-list .employees-registry-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
#employees-list tbody tr:hover .employees-registry-row-checkbox,
#employees-list .employees-registry__table.employees-registry-has-selection .employees-registry-row-checkbox,
#employees-list .employees-registry__table.employees-registry-has-selection .employees-registry-select-all-checkbox {
  opacity: 1;
}

.employees-registry__th-cell.employees-registry__checkbox-cell {
  padding: var(--space-2);
  vertical-align: middle;
  text-align: center;
}

.employees-registry__missing {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.employees-registry__zup-ok {
  display: inline-block;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--success, #16a34a);
  line-height: 1;
}

.employees-registry__zup-pending {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-muted);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  line-height: 1.3;
}

/* Бейдж «Уволен» в ячейке таблицы */
.employees-registry__fired-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: #fff;
  background: var(--danger, #dc2626);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  line-height: 1.35;
  vertical-align: baseline;
  margin-right: 0.25rem;
}

/* Строка уволенного сотрудника — лёгкий красный оттенок */
.employees-registry__row_fired td {
  background: color-mix(in srgb, var(--danger, #dc2626) 6%, transparent);
}

/* ФИО уволенного — бледно-красный + маркер */
.employees-registry__row_fired .employees-registry__cell_fio {
  position: relative;
  padding-left: 1.25rem;
  color: var(--danger-muted, #b91c1c);
}
.employees-registry__row_fired .employees-registry__cell-fio-surname,
.employees-registry__row_fired .employees-registry__cell-fio-given {
  color: inherit;
}
.employees-registry__row_fired .employees-registry__cell_fio::before {
  content: '•';
  position: absolute;
  left: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--danger, #dc2626);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
}

/* Баннер «Уволен» в карточке сотрудника */
.employee-profile-fired-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--danger, #dc2626) 10%, transparent);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--danger, #dc2626);
}

/* Тоггл «Уволенные» в тулбаре сотрудников */
.employees-registry__toggle-fired {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-muted);
  user-select: none;
}
.employees-registry__toggle-fired input[type="checkbox"] {
  accent-color: var(--danger, #dc2626);
  width: 1rem;
  height: 1rem;
}
.employees-registry__toggle-fired:has(input:checked) span {
  color: var(--danger, #dc2626);
  font-weight: 600;
}

/* Подсказка «Скрыто уволенных: N» рядом с заголовком реестра */
.employees-registry__fired-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: var(--space-2);
}

.employees-registry__empty-row td {
  border-bottom: none;
}

.employees-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.employees-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.employees-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.employees-registry__error {
  margin: 0;
  padding: var(--space-4);
  color: var(--danger);
  font-size: var(--text-sm);
}

.employees-registry__aside {
  margin-top: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.employees-registry__aside_secondary {
  border-top: 3px solid var(--border-muted);
}

.employees-registry__aside-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#panel-employees .employees-registry__aside .employees-registry__aside-title {
  margin-top: 0;
}

.employees-registry__aside-body {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.employees-registry__aside-body table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

.employees-registry__aside-body th,
.employees-registry__aside-body td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.employees-registry__aside-empty {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border: 1px dashed var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.employees-registry__aside-error {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--err);
  background: var(--err-muted);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
}

.employees-registry__salary-form {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.employees-registry__salary-form-actions {
  margin-top: var(--space-2);
}

.employees-registry__field-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: var(--leading-normal);
}

.employees-registry__salary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

.employees-registry__salary-table th,
.employees-registry__salary-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.employees-registry__salary-table thead th {
  background: var(--bg-elevated);
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.employees-registry__cell-numeric {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.employee-profile-report__loading {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.employee-profile-report__error {
  margin: 0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--err);
  background: var(--err-muted);
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
}

/* Панель «Должности»: реестр positions-registry (§1.1 ui-guidelines, зеркало employees-registry) */
.panel-body_positions-registry {
  padding-top: var(--space-4);
}

.positions-registry {
  --pr-control-height: 44px;
  --pr-control-radius: var(--radius-md);
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.positions-registry__sr-only,
.registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.positions-registry__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .positions-registry__stats {
    grid-template-columns: 1fr;
  }
}

.positions-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.positions-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.positions-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.positions-registry__toolbar {
  width: 100%;
}

.positions-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

@media (max-width: 640px) {
  .positions-registry__toolbar-row {
    flex-wrap: wrap;
  }
}

.positions-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.positions-registry__toolbar-search .positions-registry__control {
  width: 100%;
  min-width: 0;
}

.positions-registry__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--pr-control-height);
  min-width: var(--pr-control-height);
  height: var(--pr-control-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--pr-control-radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.positions-registry__icon-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.positions-registry__refresh-btn {
  min-height: var(--pr-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--pr-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.positions-registry__refresh-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.positions-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--pr-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--pr-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.positions-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.positions-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.positions-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--accent);
}

.positions-registry__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.positions-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#panel-positions .positions-registry .positions-registry__pane-title {
  margin: 0;
}

.positions-registry__dup-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.positions-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.positions-registry__list-host {
  min-height: 80px;
}

.positions-registry__loading {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.positions-registry__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.positions-registry__table th,
.positions-registry__table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.positions-registry__table td {
  word-wrap: break-word;
}

.positions-registry__table thead th {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.positions-registry__table thead th.positions-registry__th-cell {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

.positions-registry__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.positions-registry__th:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.positions-registry__th:hover .positions-registry__th-label {
  color: var(--accent-hover);
}

.positions-registry__th:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.positions-registry__th-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.positions-registry__th-sort {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.positions-registry__head-static {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  width: 100%;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.positions-registry__th-cell_actions {
  text-align: center;
}

.positions-registry__table thead th:nth-child(1),
.positions-registry__table tbody td:nth-child(1) {
  width: 52%;
  min-width: 8rem;
}

.positions-registry__table thead th:nth-child(2),
.positions-registry__table tbody td:nth-child(2) {
  width: 28%;
  min-width: 6rem;
}

.positions-registry__table thead th:nth-child(3),
.positions-registry__table tbody td:nth-child(3) {
  width: 20%;
  min-width: 5.5rem;
  text-align: center;
}

.positions-registry__cell_name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.positions-registry__cell-record-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.positions-registry__missing {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.positions-registry__empty-row td {
  border-bottom: none;
}

.positions-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.positions-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.positions-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.positions-registry__error {
  margin: 0;
  padding: var(--space-4);
  color: var(--danger);
  font-size: var(--text-sm);
}

/* Панель «Заказчики»: реестр (зеркало subdivisions-registry / employees-registry) */
.panel-body_docflow-customers-registry {
  padding-top: var(--space-4);
}

/* Создание площадки: список договоров заказчика */
.docflow-site-create-contracts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 14rem;
  overflow-y: auto;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.docflow-site-create-contracts__empty {
  margin: 0;
  font-size: var(--text-sm);
}

.docflow-site-create-contracts__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  cursor: pointer;
}

.docflow-site-create-contracts__item input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Площадки: таблица выбора договоров в модалке (создание / редактирование) */
.docflow-site-contracts-picker-host {
  min-height: 0;
}

.docflow-tree-root-host {
  min-height: 0;
}

.docflow-tree-picker-wrapper {
  max-height: min(48vh, 360px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: var(--space-1) 0;
}

.docflow-site-contracts-picker {
  width: 100%;
}

.docflow-site-contracts-picker__scroll {
  width: 100%;
  overflow: auto;
  max-height: min(48vh, 360px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.docflow-site-contracts-picker__scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.docflow-site-contracts-picker__table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.docflow-site-contracts-picker__col-check {
  width: 2.75rem;
}

.docflow-site-contracts-picker__col-number {
  width: 7.5rem;
}

.docflow-site-contracts-picker__col-subject {
  width: 28%;
}

.docflow-site-contracts-picker__col-directions {
  width: 16%;
}

.docflow-site-contracts-picker__col-date {
  width: 6.25rem;
}

.docflow-site-contracts-picker__col-status {
  width: 6.5rem;
}

.docflow-site-contracts-picker__table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.docflow-site-contracts-picker__table tbody td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: var(--leading-snug);
}

.docflow-site-contracts-picker__table tbody tr:last-child td {
  border-bottom: none;
}

.docflow-site-contracts-picker__row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.docflow-site-contracts-picker__row:nth-child(even) {
  background: color-mix(in srgb, var(--bg-elevated) 42%, transparent);
}

.docflow-site-contracts-picker__row:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.docflow-site-contracts-picker__row.is-selected {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
}

.docflow-site-contracts-picker__row.is-selected:hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg));
}

.docflow-site-contracts-picker__th-check,
.docflow-site-contracts-picker__td-check {
  text-align: center;
  vertical-align: middle;
}

.docflow-site-contracts-picker__th-check input,
.docflow-site-contracts-picker__td-check input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.docflow-site-contracts-picker__number {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  word-break: break-word;
}

.docflow-site-contracts-picker__subject,
.docflow-site-contracts-picker__directions {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--text);
  word-break: break-word;
}

.docflow-site-contracts-picker__td-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-muted);
}

.docflow-site-contracts-picker__date--overdue {
  color: var(--danger);
  font-weight: 600;
}

.docflow-site-contracts-picker__cell-muted {
  color: var(--text-muted);
}

.docflow-site-contracts-picker__td-status .docflow-status-chip {
  font-size: var(--text-xs);
  white-space: nowrap;
}

.docflow-site-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.docflow-site-active-toggle__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.docflow-site-active-toggle.rp-role-on .docflow-site-active-toggle__label {
  color: var(--text);
}

/* Площадки: сетка полей в карточке / модалке создания (как employee-card__info-grid) */
.docflow-site-card__field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.docflow-site-card__field-grid .form-field--span-full {
  grid-column: 1 / -1;
}

.docflow-site-card__field-grid .form-field__label-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Форма карточки площадки: body скроллится, футер с кнопками закреплён */
#form-docflow-site-create,
#form-docflow-site-profile,
.docflow-site-card-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  min-width: 0;
}
.docflow-site-card-form .dialog-employee-card__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.docflow-site-card__field-grid .employees-registry__field-hint {
  margin: var(--space-1) 0 0;
}

@media (max-width: 640px) {
  .docflow-site-contracts-picker__table {
    min-width: 44rem;
  }

  .docflow-site-card__field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .docflow-site-card__field-grid {
    grid-template-columns: 1fr;
  }
}

.docflow-customers-registry__row_inactive .docflow-customers-registry__cell_name {
  color: var(--text-subtle);
}

.docflow-customers-registry__cell_toggle {
  white-space: nowrap;
}

/* Заказчики + Площадки: каркас как directors-board (inline stats, flat pane, зебра tbody) */
#panel-docflow-customers .docflow-customers-registry,
#panel-docflow-sites .docflow-customers-registry {
  gap: var(--space-5);
}

#panel-docflow-customers .docflow-customers-registry__stats,
#panel-docflow-sites .docflow-customers-registry__stats {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 28px;
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border);
  margin: 0;
  grid: none;
}

@media (max-width: 720px) {
  #panel-docflow-customers .docflow-customers-registry__stats,
  #panel-docflow-sites .docflow-customers-registry__stats {
    flex-direction: column;
    gap: var(--space-1);
  }
}

#panel-docflow-customers .docflow-customers-registry__stat,
#panel-docflow-sites .docflow-customers-registry__stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

#panel-docflow-customers .docflow-customers-registry__stat-term,
#panel-docflow-sites .docflow-customers-registry__stat-term {
  order: 1;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted);
}

#panel-docflow-customers .docflow-customers-registry__stat-val,
#panel-docflow-sites .docflow-customers-registry__stat-val {
  order: 0;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-head);
}

#panel-docflow-customers .docflow-customers-registry__control,
#panel-docflow-sites .docflow-customers-registry__control {
  min-height: var(--field-height, 2.75rem);
  height: var(--field-height, 2.75rem);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
}

#panel-docflow-customers .docflow-customers-registry__icon-btn,
#panel-docflow-customers .docflow-customers-registry__refresh-btn,
#panel-docflow-customers .docflow-customers-registry__bulk-delete-btn,
#panel-docflow-sites .docflow-customers-registry__icon-btn,
#panel-docflow-sites .docflow-customers-registry__refresh-btn,
#panel-docflow-sites .docflow-customers-registry__bulk-delete-btn {
  min-height: var(--field-height, 2.75rem);
  height: var(--field-height, 2.75rem);
  border-radius: var(--dcr-control-radius, var(--radius-md));
}

#panel-docflow-customers .docflow-customers-registry__pane,
#panel-docflow-sites .docflow-customers-registry__pane {
  padding: 0;
  gap: 0;
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: none;
}

#panel-docflow-customers .docflow-customers-registry__pane-head,
#panel-docflow-sites .docflow-customers-registry__pane-head {
  padding: var(--space-2) var(--space-3) 0;
}

#panel-docflow-customers .docflow-customers-registry__pane-title,
#panel-docflow-sites .docflow-customers-registry__pane-title {
  font-size: var(--text-sm);
  font-weight: 600;
}

#panel-docflow-customers .docflow-customers-registry__table-scroll,
#panel-docflow-sites .docflow-customers-registry__table-scroll {
  border: none;
  border-radius: 0;
  background: transparent;
}

#panel-docflow-customers .docflow-customers-registry__table tbody tr:nth-child(odd),
#panel-docflow-sites .docflow-customers-registry__table tbody tr:nth-child(odd) {
  background: var(--surface);
}

#panel-docflow-customers .docflow-customers-registry__table tbody tr:nth-child(even),
#panel-docflow-sites .docflow-customers-registry__table tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

#panel-docflow-customers .docflow-customers-registry__table tbody tr:hover,
#panel-docflow-sites .docflow-customers-registry__table tbody tr:hover,
#panel-docflow-customers .docflow-customers-registry__row:hover td,
#panel-docflow-sites .docflow-customers-registry__row:hover td {
  background: var(--surface-hover);
}

.organizations-registry {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.organizations-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.organizations-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.organizations-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.organizations-registry__toolbar-search .organizations-registry__control {
  width: 100%;
  min-width: 0;
}

.organizations-registry__bulk-actions {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

.organizations-registry__bulk-actions.hidden {
  display: none;
}

.organizations-registry__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.organizations-registry__table tbody tr.organizations-registry__row {
  cursor: pointer;
}

.organizations-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
}

.organizations-registry__loading,
.organizations-registry__error {
  padding: var(--space-8);
  text-align: center;
}

.organizations-registry__error {
  color: var(--err);
}

.organizations-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.organizations-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 700;
}

.organizations-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Module Panel Pattern A — flat sort headers (#panel-organizations, web-ui-style §3.5) */
#organizations-list .organizations-registry__table thead th.organizations-registry__th-cell:not(.organizations-registry__checkbox-cell) {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

#organizations-list .organizations-registry__table .organizations-registry__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: 0 var(--space-1);
  border: none;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  min-height: 0;
}

#organizations-list .organizations-registry__table .organizations-registry__th:hover {
  background: var(--surface-hover);
}

#organizations-list .organizations-registry__table .organizations-registry__th:hover .organizations-registry__th-label {
  color: var(--text);
}

#organizations-list .organizations-registry__table .organizations-registry__th[aria-pressed='true'] {
  background: var(--accent-muted);
}

#organizations-list .organizations-registry__table .organizations-registry__th[aria-pressed='true'] .organizations-registry__th-label {
  color: var(--accent);
  font-weight: 700;
}

#organizations-list .organizations-registry__table .organizations-registry__th:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

#organizations-list .organizations-registry__table .organizations-registry__th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#organizations-list .organizations-registry__table .organizations-registry__th-sort {
  flex: 0 0 auto;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

/* === warehouses-registry (Module Panel Pattern §3) === */
.warehouses-registry {
  --wh-control-height: 44px;
  --wh-control-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.warehouses-registry__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .warehouses-registry__stats {
    grid-template-columns: 1fr;
  }
}

.warehouses-registry__stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.warehouses-registry__stat-term {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.warehouses-registry__stat-val {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.warehouses-registry__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  width: 100%;
}

.warehouses-registry__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: var(--space-3);
  min-width: 0;
}

@media (max-width: 900px) {
  .warehouses-registry__layout {
    grid-template-columns: 1fr;
  }

  .warehouses-registry__pane_hidden {
    display: none;
  }
}

.warehouses-registry__pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 360px;
}

.warehouses-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
}

#warehouses-list .warehouses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

#warehouses-list .warehouses-table th,
#warehouses-list .warehouses-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

#warehouses-list .warehouses-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.warehouses-empty {
  padding: var(--space-8);
  text-align: center;
}

.warehouses-empty__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-head);
}

#warehouses-list .warehouses-table tbody tr.warehouses-table__row {
  cursor: pointer;
}

#warehouses-list .warehouses-table tbody tr.warehouses-table__row:hover {
  background: var(--surface-hover);
}

.warehouses-empty__hint {
  margin: 0;
}

.docflow-customers-registry {
  --dcr-control-height: 44px;
  --dcr-control-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.docflow-customers-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.docflow-customers-registry__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .docflow-customers-registry__stats {
    grid-template-columns: 1fr;
  }
}

.docflow-customers-registry__stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.docflow-customers-registry__stat-term {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.docflow-customers-registry__stat-val {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.docflow-customers-registry__toolbar {
  display: block;
}

.docflow-customers-registry__toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
}

@media (max-width: 640px) {
  .docflow-customers-registry__toolbar-row {
    flex-wrap: wrap;
  }
}

.docflow-customers-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.docflow-customers-registry__toolbar-search .docflow-customers-registry__control {
  width: 100%;
  min-width: 0;
}

.docflow-customers-registry__icon-btn,
.docflow-customers-registry__refresh-btn {
  min-height: var(--dcr-control-height);
  border-radius: var(--dcr-control-radius);
}

.docflow-customers-registry__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--dcr-control-height);
  min-width: var(--dcr-control-height);
  height: var(--dcr-control-height);
  padding: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1;
}

.docflow-customers-registry__refresh-btn {
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.docflow-customers-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--dcr-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--dcr-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.docflow-customers-registry__bulk-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}

.docflow-customers-registry__bulk-actions.hidden {
  display: none !important;
}

.docflow-customers-registry__bulk-delete-btn {
  white-space: nowrap;
}

.docflow-customers-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--accent);
}

.docflow-customers-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
}

.docflow-customers-registry__pane-hint {
  margin: 0;
  font-size: var(--text-sm);
}

.docflow-customers-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.docflow-customers-registry__list-host {
  min-height: 80px;
}

.docflow-customers-registry__loading,
.docflow-customers-registry__error {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
}

.docflow-customers-registry__error {
  color: var(--danger);
}

.docflow-customers-registry__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.docflow-customers-registry__table th,
.docflow-customers-registry__table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.docflow-customers-registry__table thead th {
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.docflow-customers-registry__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.docflow-customers-registry__th:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.docflow-customers-registry__th:hover .docflow-customers-registry__th-label {
  color: var(--accent-hover);
}

.docflow-customers-registry__th:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.docflow-customers-registry__th-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.docflow-customers-registry__head-static {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  width: 100%;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.docflow-customers-registry__th-sort {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.docflow-customers-registry__table thead th.docflow-customers-registry__th-cell {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

.docflow-customers-registry__cell_name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docflow-customers-registry__cell_sites {
  text-align: center;
}

.docflow-customers-registry__row {
  cursor: pointer;
}

.docflow-customers-registry__row:hover td {
  background: var(--surface-hover);
}

#docflow-customers-list .docflow-customers-registry__checkbox-cell,
#docflow-sites-list .docflow-customers-registry__checkbox-cell {
  width: 2.5rem;
  max-width: 2.75rem;
  padding: var(--space-2);
  vertical-align: middle;
}

#docflow-customers-list .docflow-customers-registry-row-checkbox,
#docflow-sites-list .docflow-customers-registry-row-checkbox,
#docflow-customers-list .docflow-customers-registry-select-all-checkbox,
#docflow-sites-list .docflow-customers-registry-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

#docflow-customers-list tbody tr:hover .docflow-customers-registry-row-checkbox,
#docflow-sites-list tbody tr:hover .docflow-customers-registry-row-checkbox,
#docflow-customers-list .docflow-customers-registry__table.docflow-customers-registry-has-selection .docflow-customers-registry-row-checkbox,
#docflow-sites-list .docflow-customers-registry__table.docflow-customers-registry-has-selection .docflow-customers-registry-row-checkbox,
#docflow-customers-list .docflow-customers-registry__table.docflow-customers-registry-has-selection .docflow-customers-registry-select-all-checkbox,
#docflow-sites-list .docflow-customers-registry__table.docflow-customers-registry-has-selection .docflow-customers-registry-select-all-checkbox {
  opacity: 1;
}

/* Заказчики / Площадки: Flat Pattern sort headers (web-ui-style §3.5) */
#docflow-customers-list .docflow-customers-registry__checkbox-cell,
#docflow-sites-list .docflow-customers-registry__checkbox-cell {
  max-width: 2.5rem;
}

#docflow-customers-list .docflow-customers-registry__table thead th,
#docflow-sites-list .docflow-customers-registry__table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

#docflow-customers-list .docflow-customers-registry__table thead th.docflow-customers-registry__th-cell:not(.docflow-customers-registry__checkbox-cell),
#docflow-sites-list .docflow-customers-registry__table thead th.docflow-customers-registry__th-cell:not(.docflow-customers-registry__checkbox-cell) {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: 0 var(--space-1);
  border: none;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  min-height: 0;
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th:hover,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th:hover {
  background: var(--surface-hover);
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th:hover .docflow-customers-registry__th-label,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th:hover .docflow-customers-registry__th-label {
  color: var(--text);
  text-decoration: none;
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th[aria-pressed='true'],
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th[aria-pressed='true'] {
  background: var(--accent-muted);
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th[aria-pressed='true'] .docflow-customers-registry__th-label,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th[aria-pressed='true'] .docflow-customers-registry__th-label {
  color: var(--accent);
  font-weight: 700;
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th:focus-visible,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th-label,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

#docflow-customers-list .docflow-customers-registry__table .docflow-customers-registry__th-sort,
#docflow-sites-list .docflow-customers-registry__table .docflow-customers-registry__th-sort {
  flex: 0 0 auto;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

#docflow-customers-list .docflow-customers-registry__head-static,
#docflow-sites-list .docflow-customers-registry__head-static {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: 0 var(--space-1);
  border: none;
  border-radius: 0;
  background: none;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.docflow-customers-registry__th-cell.docflow-customers-registry__checkbox-cell {
  padding: var(--space-2);
  vertical-align: middle;
  text-align: center;
}

.docflow-customers-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.docflow-customers-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 700;
}

.docflow-customers-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

#docflow-customer-card-actions-section.hidden {
  display: none;
}

#docflow-customer-card-sites-section .employee-card__report table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

#docflow-customer-card-sites-section .employee-card__report th,
#docflow-customer-card-sites-section .employee-card__report td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

#docflow-customer-card-sites-section .employee-card__report thead th {
  background: var(--bg-elevated);
  font-weight: 600;
}

/* Панель «Графики работы» (P-REGISTRY, кожа positions-registry) */
.work-schedules-registry__intro {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

.work-schedules-registry__preset {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 1px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  vertical-align: middle;
}

.work-schedules-registry__summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

#panel-work-schedules .positions-registry__table thead th:nth-child(1),
#panel-work-schedules .positions-registry__table tbody td:nth-child(1) {
  width: 26%;
  min-width: 7rem;
}
#panel-work-schedules .positions-registry__table thead th:nth-child(2),
#panel-work-schedules .positions-registry__table tbody td:nth-child(2) {
  width: 16%;
  min-width: 5rem;
}
#panel-work-schedules .positions-registry__table thead th:nth-child(3),
#panel-work-schedules .positions-registry__table tbody td:nth-child(3) {
  width: 36%;
  min-width: 8rem;
}
#panel-work-schedules .positions-registry__table thead th:nth-child(4),
#panel-work-schedules .positions-registry__table tbody td:nth-child(4) {
  width: 14%;
  min-width: 5rem;
}
#panel-work-schedules .positions-registry__table thead th:nth-child(5),
#panel-work-schedules .positions-registry__table tbody td:nth-child(5) {
  width: 8%;
  min-width: 5.5rem;
  text-align: center;
}

/* Панель «Подразделения»: реестр subdivisions-registry (§1.1 ui-guidelines, зеркало employees-registry) */
.panel-body_subdivisions-registry {
  padding-top: var(--space-4);
}

.subdivisions-registry {
  --sr-control-height: 44px;
  --sr-control-radius: var(--radius-md);
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.subdivisions-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.subdivisions-registry__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .subdivisions-registry__stats {
    grid-template-columns: 1fr;
  }
}

.subdivisions-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.subdivisions-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.subdivisions-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.subdivisions-registry__toolbar {
  width: 100%;
}

.subdivisions-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

@media (max-width: 640px) {
  .subdivisions-registry__toolbar-row {
    flex-wrap: wrap;
  }
}

.subdivisions-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.subdivisions-registry__toolbar-search .subdivisions-registry__control {
  width: 100%;
  min-width: 0;
}

.subdivisions-registry__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sr-control-height);
  min-width: var(--sr-control-height);
  height: var(--sr-control-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--sr-control-radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.subdivisions-registry__icon-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.subdivisions-registry__refresh-btn {
  min-height: var(--sr-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--sr-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.subdivisions-registry__refresh-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.subdivisions-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--sr-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--sr-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.subdivisions-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.subdivisions-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.subdivisions-registry__bulk-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}

.subdivisions-registry__bulk-actions.hidden {
  display: none !important;
}

.subdivisions-registry__bulk-delete-btn {
  white-space: nowrap;
}

.subdivisions-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--accent);
}

.subdivisions-registry__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.subdivisions-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#panel-subdivisions .subdivisions-registry .subdivisions-registry__pane-title {
  margin: 0;
}

.subdivisions-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.subdivisions-registry__list-host {
  min-height: 80px;
}

.subdivisions-registry__loading {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.subdivisions-registry__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.subdivisions-registry__table th,
.subdivisions-registry__table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.subdivisions-registry__table td {
  word-wrap: break-word;
}

.subdivisions-registry__table thead th {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.subdivisions-registry__th-cell {
  vertical-align: middle;
}

.subdivisions-registry__head-static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  width: 100%;
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.subdivisions-registry__table thead th.subdivisions-registry__checkbox-cell {
  text-align: center;
  width: 2.5rem;
}

.subdivisions-registry__table tbody td.subdivisions-registry__checkbox-cell {
  width: 2.5rem;
  text-align: center;
}

.subdivisions-registry__table thead th:nth-child(2),
.subdivisions-registry__table tbody td:nth-child(2) {
  width: 38%;
  min-width: 8rem;
}

.subdivisions-registry__table thead th:nth-child(3),
.subdivisions-registry__table tbody td:nth-child(3) {
  width: 22%;
  max-width: 14rem;
}

.subdivisions-registry__table thead th:nth-child(4),
.subdivisions-registry__table tbody td:nth-child(4) {
  width: 24%;
  min-width: 6.5rem;
}

.subdivisions-registry__cell_code,
.subdivisions-registry__cell-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.subdivisions-registry__cell_name {
  font-weight: 500;
  color: var(--text);
}

.subdivisions-registry__empty-row td {
  border-bottom: none;
}

.subdivisions-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.subdivisions-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.subdivisions-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.subdivisions-registry__error {
  margin: 0;
  padding: var(--space-4);
  color: var(--danger);
  font-size: var(--text-sm);
}

#subdivisions-list .subdivisions-registry__checkbox-cell {
  width: 2.5rem;
  max-width: 2.75rem;
  padding: var(--space-2);
  vertical-align: middle;
}

#subdivisions-list .subdivisions-registry-row-checkbox,
#subdivisions-list .subdivisions-registry-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

#subdivisions-list tbody tr:hover .subdivisions-registry-row-checkbox,
#subdivisions-list .subdivisions-registry__table.subdivisions-registry-has-selection .subdivisions-registry-row-checkbox,
#subdivisions-list .subdivisions-registry__table.subdivisions-registry-has-selection .subdivisions-registry-select-all-checkbox {
  opacity: 1;
}

/* Панель «Пользователи»: реестр users-registry (§1.1 ui-guidelines, зеркало subdivisions-registry) */
.panel-body_users-registry {
  padding-top: var(--space-4);
}

.users-registry {
  --ur-control-height: 44px;
  --ur-control-radius: var(--radius-md);
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.users-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.users-registry__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) and (min-width: 40.0625rem) {
  .users-registry__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.users-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.users-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.users-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.users-registry__toolbar {
  width: 100%;
}

.users-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

@media (max-width: 56rem) {
  .users-registry__toolbar-row {
    flex-wrap: wrap;
  }

  .users-registry__toolbar-search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .users-registry__th-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .users-registry__filter-chip-detail {
    max-width: 10rem;
  }
}

/* ≤40rem: приоритет колонок, компактный layout (adapt + layout) */
@media (max-width: 40rem) {
  .panel-body_users-registry {
    padding-top: var(--space-3);
  }

  .users-registry {
    gap: var(--space-4);
  }

  .users-registry__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .users-registry__stat {
    padding: var(--space-3);
  }

  .users-registry__stat-term {
    font-size: 0.6875rem;
    letter-spacing: normal;
    text-transform: none;
  }

  .users-registry__stat-val {
    font-size: var(--text-xl);
  }

  .users-registry__toolbar-row {
    display: grid;
    grid-template-columns: var(--ur-control-height) 1fr;
    grid-template-areas:
      'create refresh'
      'search search'
      'bulk bulk';
    gap: var(--space-2);
    align-items: stretch;
  }

  .users-registry__icon-btn {
    grid-area: create;
  }

  .users-registry__refresh-btn {
    grid-area: refresh;
    justify-self: stretch;
    width: 100%;
  }

  .users-registry__toolbar-search {
    grid-area: search;
    flex: none;
    width: 100%;
  }

  .users-registry__bulk-actions:not(.hidden) {
    grid-area: bulk;
    width: 100%;
  }

  .users-registry__bulk-actions:not(.hidden) .users-registry__bulk-delete-btn {
    width: 100%;
  }

  .users-registry__pane {
    padding: var(--space-3);
  }

  /* Скрыть второстепенные колонки — меньше горизонтального scroll */
  .users-registry__th-cell_totp,
  .users-registry__th-cell_account_status,
  .users-registry__cell_totp,
  .users-registry__cell_account-status {
    display: none;
  }

  .users-registry__table {
    min-width: 38rem;
  }

  .users-registry__active-filters-inner {
    gap: var(--space-1);
  }

  .users-registry__filter-chip {
    max-width: 100%;
  }
}

.users-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.users-registry__toolbar-search .users-registry__control {
  width: 100%;
  min-width: 0;
}

.users-registry__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ur-control-height);
  min-width: var(--ur-control-height);
  height: var(--ur-control-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--ur-control-radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.users-registry__icon-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.users-registry__refresh-btn {
  min-height: var(--ur-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--ur-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.users-registry__refresh-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.users-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ur-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--ur-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.users-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.users-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.users-registry__bulk-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}

.users-registry__bulk-actions.hidden {
  display: none !important;
}

.users-registry__bulk-delete-btn {
  white-space: nowrap;
}

.users-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.users-registry__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.users-registry__pane-hint {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.users-registry__pane-hint-mobile,
.users-registry__pane-hint-narrow {
  display: none;
}

@media (max-width: 56rem) {
  .users-registry__pane-hint-mobile {
    display: inline;
  }
}

@media (max-width: 40rem) {
  .users-registry__pane-hint-narrow {
    display: inline;
  }
}

.users-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#panel-users .users-registry .users-registry__pane-title {
  margin: 0;
}

.users-registry__table-scroll {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.users-registry__list-host {
  min-height: 80px;
}

.users-registry__loading {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.users-registry__table {
  width: 100%;
  min-width: 52rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.users-registry__table th,
.users-registry__table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.users-registry__table td {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: normal;
}

.users-registry__cell_login,
.users-registry__cell_name {
  overflow-wrap: anywhere;
}

.users-registry__cell_totp,
.users-registry__cell_account-status,
.users-registry__cell_lockout,
.users-registry__cell_role {
  white-space: nowrap;
}

.users-registry__table thead th {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.users-registry__th-cell {
  vertical-align: middle;
}

.users-registry__table thead th.users-registry__th-cell {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

/* Заголовок колонки: одна рамка; ▼ в правом углу (Excel autofilter, как у «Сотрудники»). */
.users-registry__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.users-registry__th-chip .users-registry__th,
.users-registry__th-chip .users-registry__head-static,
.users-registry__th-chip .users-registry__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.users-registry__th-chip .users-registry__th,
.users-registry__th-chip .users-registry__head-static {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

.users-registry__th {
  box-sizing: border-box;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition:
    background var(--transition),
    border-color var(--transition);
}

.users-registry__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.users-registry__th:hover {
  background: transparent;
}

.users-registry__th:hover .users-registry__th-label {
  color: var(--accent-hover);
}

.users-registry__th:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.users-registry__th-sort {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.users-registry__head-static {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.users-registry__th-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.users-registry__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  bottom: auto;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--transition);
}

.users-registry__th-filter::before {
  content: "";
  position: absolute;
  inset: -0.375rem;
}

.users-registry__th-filter:hover {
  color: var(--accent-hover);
}

.users-registry__th-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.users-registry__th-filter_active {
  color: var(--accent);
}

.users-registry__th-chip:has(.users-registry__th-filter_active) {
  border-color: var(--accent);
}

.users-registry__th-filter_active:hover {
  color: var(--accent-hover);
}

.users-registry__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .users-registry__th,
  .users-registry__th-chip,
  .users-registry__th-filter {
    transition: none;
  }
}

.users-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.users-registry__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.users-registry__active-filters-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
}

.users-registry__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.users-registry__filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.users-registry__filter-chip-detail {
  color: var(--text-subtle);
}

.users-registry__active-filters-clear-all {
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.users-registry__active-filters-clear-all:hover {
  text-decoration: underline;
}

.users-registry__table thead th.users-registry__checkbox-cell {
  text-align: center;
  width: 2.5rem;
}

.users-registry__table tbody td.users-registry__checkbox-cell {
  width: 2.5rem;
  text-align: center;
}

.users-registry__th-cell_actions {
  width: 6.5rem;
  min-width: 5.5rem;
  text-align: center;
}

.users-registry__table thead th:nth-child(2),
.users-registry__table tbody td:nth-child(2) {
  width: 22%;
  min-width: 7rem;
}

.users-registry__table thead th:nth-child(3),
.users-registry__table tbody td:nth-child(3) {
  width: 28%;
  min-width: 8rem;
}

.users-registry__table thead th:nth-child(4),
.users-registry__table tbody td:nth-child(4) {
  width: 16%;
  min-width: 6rem;
}

.users-registry__table thead th:nth-child(5),
.users-registry__table tbody td:nth-child(5) {
  width: 6%;
  min-width: 4.5rem;
}

.users-registry__table thead th:nth-child(6),
.users-registry__table tbody td:nth-child(6) {
  width: 14%;
  min-width: 7.5rem;
}

.users-registry__table thead th:nth-child(7),
.users-registry__table tbody td:nth-child(7) {
  width: 12%;
  min-width: 6.5rem;
}

.users-registry__cell_login {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text);
}

.users-registry__cell_name {
  font-weight: 500;
  color: var(--text);
}

.users-registry__cell_role {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.users-registry__cell_actions {
  text-align: center;
  white-space: nowrap;
}


/* Строка таблицы кликабельна — открывает модалку редактирования */
#users-list tbody tr.users-registry__row {
  cursor: pointer;
}
.users-registry__empty-row td {
  border-bottom: none;
}

.users-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.users-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.users-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.users-registry__error {
  margin: 0;
  padding: var(--space-4);
  color: var(--danger);
  font-size: var(--text-sm);
}

#users-list .users-registry__checkbox-cell {
  width: 2.5rem;
  max-width: 2.75rem;
  padding: var(--space-2);
  vertical-align: middle;
}

#users-list .users-registry-row-checkbox,
#users-list .users-registry-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

#users-list tbody tr:hover .users-registry-row-checkbox,
#users-list tbody tr:focus-within .users-registry-row-checkbox,
#users-list .users-registry__table.users-registry-has-selection .users-registry-row-checkbox,
#users-list .users-registry__table.users-registry-has-selection .users-registry-select-all-checkbox {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  #users-list .users-registry-row-checkbox,
  #users-list .users-registry-select-all-checkbox {
    opacity: 1;
  }
}

/* Блокировка входа: бейджи и кнопки */
.users-registry__cell_lockout {
  vertical-align: middle;
  padding: var(--space-2);
  white-space: nowrap;
}

.users-registry__lockout-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.users-registry__lockout-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
  cursor: default;
  border: 1px solid transparent;
}

.users-registry__lockout-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.users-registry__lockout-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}

.users-registry__lockout-chip--warn {
  background: color-mix(in srgb, var(--warn, #eab308) 14%, var(--surface, #fff));
  border-color: color-mix(in srgb, var(--warn, #eab308) 35%, var(--border, #ccc));
  color: var(--text);
}

.users-registry__lockout-chip--warn .users-registry__lockout-chip-icon {
  border-radius: 50%;
  background: color-mix(in srgb, var(--warn, #eab308) 28%, transparent);
  color: color-mix(in srgb, var(--warn, #eab308) 90%, var(--text-head, #111));
}

.users-registry__lockout-chip--locked {
  background: color-mix(in srgb, var(--warn, #eab308) 12%, var(--surface, #fff));
  border-color: color-mix(in srgb, var(--warn, #eab308) 32%, var(--border, #ccc));
  color: var(--text);
}

.users-registry__lockout-chip--locked .users-registry__lockout-chip-icon {
  font-size: 0.75rem;
  font-weight: 400;
}

.users-registry__lockout-chip-label {
  font-weight: 600;
}

.users-registry__lockout-chip-meta {
  font-weight: 400;
  opacity: 0.85;
  font-size: 0.625rem;
}

.users-registry__lockout-reset-btn {
  padding: 3px 10px;
  font-size: 11px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: auto;
}

.users-registry__lockout-reset-btn:hover {
  background: #c82333;
}

.users-registry__lockout-reset-btn:focus-visible {
  outline: 2px solid #dc3545;
  outline-offset: 2px;
}

.users-registry__row_locked {
  background: rgba(255, 193, 7, 0.05);
}

.users-registry__row_locked:hover {
  background: rgba(255, 193, 7, 0.1);
}

.users-registry__dismissal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: color-mix(in srgb, var(--err) 12%, transparent);
  color: var(--err);
  border: 1px solid color-mix(in srgb, var(--err) 28%, transparent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.users-registry__dismissal-badge--warn {
  background: color-mix(in srgb, var(--warn, #b8860b) 12%, transparent);
  color: var(--warn, #b8860b);
  border-color: color-mix(in srgb, var(--warn, #b8860b) 28%, transparent);
}

.users-registry__row_dismissed {
  background: color-mix(in srgb, var(--err) 4%, transparent);
}

.users-registry__row_dismissed:hover {
  background: color-mix(in srgb, var(--err) 8%, transparent);
}

.user-card__status-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.user-card__status-badge.hidden {
  display: none;
}

.user-card__status-badge--dismissed {
  background: color-mix(in srgb, var(--err) 15%, transparent);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 25%, transparent);
}

.user-card__lockout-banner--dismissed {
  background: color-mix(in srgb, var(--err) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--err) 30%, transparent);
}

.user-card__lockout-banner--dismissed .user-card__lockout-text {
  color: var(--text);
}

/* Панель «Физлица»: реестр individuals-registry (§1.1 ui-guidelines, зеркало positions-registry (§1.1)) */
.panel-body_individuals-registry {
  padding-top: var(--space-4);
}

.individuals-registry {
  --ir-control-height: 44px;
  --ir-control-radius: var(--radius-md);
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.individuals-registry__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.individuals-registry__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .individuals-registry__stats {
    grid-template-columns: 1fr;
  }
}

.individuals-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.individuals-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.individuals-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.individuals-registry__toolbar {
  width: 100%;
}

.individuals-registry__toolbar-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

@media (max-width: 640px) {
  .individuals-registry__toolbar-row {
    flex-wrap: wrap;
  }
}

.individuals-registry__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.individuals-registry__toolbar-search .individuals-registry__control {
  width: 100%;
  min-width: 0;
}

.individuals-registry__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ir-control-height);
  min-width: var(--ir-control-height);
  height: var(--ir-control-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--ir-control-radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.individuals-registry__icon-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.individuals-registry__refresh-btn {
  min-height: var(--ir-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--ir-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.individuals-registry__refresh-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.individuals-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ir-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--ir-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.individuals-registry__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.individuals-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.individuals-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--accent);
}

.individuals-registry__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.individuals-registry__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

#panel-individuals .individuals-registry .individuals-registry__pane-title {
  margin: 0;
}

.individuals-registry__dup-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.individuals-registry__table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.individuals-registry__list-host {
  min-height: 80px;
}

.individuals-registry__loading {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.individuals-registry__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  table-layout: fixed;
}

.individuals-registry__table th,
.individuals-registry__table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.individuals-registry__table td {
  word-wrap: break-word;
}

.individuals-registry__table thead th {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.individuals-registry__table thead th.individuals-registry__th-cell {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

.individuals-registry__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.individuals-registry__th:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.individuals-registry__th:hover .individuals-registry__th-label {
  color: var(--accent-hover);
}

.individuals-registry__th:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.individuals-registry__th-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.individuals-registry__th-sort {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.individuals-registry__head-static {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  width: 100%;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.individuals-registry__th-cell_actions {
  text-align: center;
}

.individuals-registry__table thead th:nth-child(1),
.individuals-registry__table tbody td:nth-child(1) {
  width: 17%;
  min-width: 7rem;
}

.individuals-registry__table thead th:nth-child(2),
.individuals-registry__table tbody td:nth-child(2) {
  width: 8%;
  min-width: 4.25rem;
}

.individuals-registry__table thead th:nth-child(3),
.individuals-registry__table tbody td:nth-child(3) {
  width: 14%;
  min-width: 5.5rem;
}

.individuals-registry__table thead th:nth-child(4),
.individuals-registry__table tbody td:nth-child(4) {
  width: 7%;
  min-width: 4.25rem;
}

.individuals-registry__table thead th:nth-child(5),
.individuals-registry__table tbody td:nth-child(5) {
  width: 9%;
  min-width: 4.5rem;
}

.individuals-registry__table thead th:nth-child(6),
.individuals-registry__table tbody td:nth-child(6) {
  width: 7%;
  min-width: 3.5rem;
}

.individuals-registry__table thead th:nth-child(7),
.individuals-registry__table tbody td:nth-child(7) {
  width: 9%;
  min-width: 4.25rem;
}

.individuals-registry__table thead th:nth-child(8),
.individuals-registry__table tbody td:nth-child(8) {
  width: 17%;
  min-width: 6rem;
}

.individuals-registry__table thead th:nth-child(9),
.individuals-registry__table tbody td:nth-child(9) {
  width: 12%;
  min-width: 5.5rem;
  text-align: center;
}

.individuals-registry__cell_name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.individuals-registry__cell_emp {
  white-space: normal;
  word-break: break-word;
}

.individuals-registry__cell-nowrap {
  white-space: nowrap;
}

.individuals-registry__actions-cell {
  text-align: center;
}

.individuals-registry__actions-inner {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  max-width: 100%;
}

.individuals-registry__cell-record-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.individuals-registry__missing {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.individuals-registry__empty-row td {
  border-bottom: none;
}

.individuals-registry__empty-cell {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.individuals-registry__empty-title {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.individuals-registry__empty-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.individuals-registry__error {
  margin: 0;
  padding: var(--space-4);
  color: var(--danger);
  font-size: var(--text-sm);
}

.individuals-registry__list-foot {
  margin: 0;
  padding: var(--space-2) var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 1.25rem;
}

/* Индивидуалы: checkbox cells и bulk actions */
.individuals-registry__table thead th.individuals-registry__checkbox-cell {
  text-align: center;
  width: 2.5rem;
}

.individuals-registry__table tbody td.individuals-registry__checkbox-cell {
  width: 2.5rem;
  text-align: center;
}

#individuals-list .individuals-registry__checkbox-cell {
  width: 2.5rem;
  max-width: 2.75rem;
  padding: var(--space-2);
  vertical-align: middle;
}

#individuals-list .individuals-registry-row-checkbox,
#individuals-list .individuals-registry-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

#individuals-list tbody tr:hover .individuals-registry-row-checkbox,
#individuals-list .individuals-registry__table.individuals-registry-has-selection .individuals-registry-row-checkbox,
#individuals-list .individuals-registry__table.individuals-registry-has-selection .individuals-registry-select-all-checkbox {
  opacity: 1;
}

/* Строка таблицы кликабельна — открывает модалку редактирования */
#individuals-list tbody tr.individuals-registry__row {
  cursor: pointer;
}

/* Bulk actions bar */
.individuals-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.individuals-bulk-actions.hidden {
  display: none !important;
}

/* Табель прораба / РО: document scrollport (класс на body из timesheet-sticky-layout.js) */
body.rappserver-timesheet-document-scroll {
  overflow-y: auto;
}

body.rappserver-timesheet-document-scroll .content {
  max-width: 100%;
  flex: 1 0 auto;
  min-height: auto;
  overflow: visible;
}

body.rappserver-timesheet-document-scroll #panel-foreman-timesheet:not(.hidden),
body.rappserver-timesheet-document-scroll #panel-object-manager-timesheet:not(.hidden) {
  max-width: 100%;
}

.content:has(#panel-timesheet:not(.hidden)),
.content:has(#panel-timesheet-analytics:not(.hidden)) {
  max-width: 100%;
}

#panel-foreman-timesheet:not(.hidden),
#panel-object-manager-timesheet:not(.hidden),
#panel-timesheet:not(.hidden),
#panel-timesheet-analytics:not(.hidden),
#panel-payroll-calculation:not(.hidden) {
  max-width: 100%;
}

.panel-body_timesheet-analytics {
  padding: var(--space-4);
}

/* ===== Табели: Module Panel Pattern (h2 + .card), overflow для sticky ===== */
#panel-foreman-timesheet > .card,
#panel-object-manager-timesheet > .card,
#panel-timesheet > .card,
#panel-payroll-calculation > .card,
:is(#panel-timesheet, #panel-timesheet-analytics) > .card {
  overflow: visible;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-4) var(--space-6);
  margin: 0;
  padding: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__stats .positions-registry__stat {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__stats .positions-registry__stat-term::after {
  content: ':';
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__stat-val_up {
  color: var(--warn, #d97706);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__stat-val_down {
  color: var(--accent);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__movers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  font-size: var(--text-sm);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__movers-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__mover {
  color: var(--text);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__mover strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__toolbar {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__period-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__period-label {
  min-width: 12rem;
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__month-btn {
  min-width: var(--field-height);
  width: var(--field-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .positions-registry__refresh-btn,
:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__reset-btn,
:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__filter {
  min-height: var(--field-height);
  height: var(--field-height);
  box-sizing: border-box;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__filter {
  min-width: 9rem;
  max-width: 14rem;
  font-size: var(--text-sm);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__section-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alerts-host {
  min-height: 2rem;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alerts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alert {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alert_warn {
  border-color: color-mix(in srgb, var(--warn, #d97706) 45%, var(--border));
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alert-title {
  font-weight: 600;
  color: var(--text);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alert-msg {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__alert-meta {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-subtle);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.95fr);
  gap: var(--space-4);
  align-items: start;
}

@media (max-width: 1100px) {
  :is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__layout {
    grid-template-columns: 1fr;
  }
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  min-width: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__pane-head {
  margin: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__pane-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__pane-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__heatmap-host {
  overflow: auto;
  max-height: min(58vh, 42rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__legend-bar {
  width: 7rem;
  height: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(to right, rgba(20, 184, 166, 0.08), rgba(20, 184, 166, 0.75));
  border: 1px solid var(--border);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__head,
:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__row {
  display: grid;
  gap: 2px;
  align-items: stretch;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__corner,
:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__row-label {
  display: flex;
  align-items: center;
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__row-label {
  position: sticky;
  left: 0;
  z-index: 1;
  color: var(--text);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 2.25rem;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__col-title {
  font-size: var(--text-xs);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__cell {
  min-height: 2.25rem;
  border: 1px solid var(--border-light, var(--border));
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-heat__cell_active {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: 1px;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__empty {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__empty strong {
  color: var(--text);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__sub {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__kv {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-3) 0 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__kv > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-light, color-mix(in srgb, var(--border) 50%, transparent));
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__kv dt {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-subtle);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__kv dd {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__charts {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
  min-width: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__chart {
  min-width: 0;
  overflow: hidden;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__chart-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-subtle);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__chart-empty {
  margin: 0;
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 9rem;
  aspect-ratio: 320 / 140;
  overflow: hidden;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__bars {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__bar-row {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) 2rem;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__bar-track {
  height: 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__bar-fill {
  height: 100%;
  border-radius: inherit;
  background: rgba(20, 184, 166, 0.55);
  min-width: 2px;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__grid {
  stroke: var(--border);
  stroke-width: 1;
  opacity: 0.45;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__line {
  stroke: rgba(20, 184, 166, 0.95);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__bar-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-detail__bar-val {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__empty,
:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__loading {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__error {
  color: var(--err, #ef4444);
  font-size: var(--text-sm);
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__fatal {
  padding: var(--space-4);
  text-align: center;
}

:is(#panel-timesheet, #panel-timesheet-analytics) .ts-ana-registry__fatal p {
  margin: 0 0 var(--space-3);
  color: var(--err, #ef4444);
}

/* ===== Сводка по табелю (ts-sum) — legacy + base under #panel-timesheet ===== */
#panel-timesheet .panel-body_timesheet-summary {
  padding: var(--space-4);
}

#panel-timesheet .ts-sum {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#panel-timesheet .ts-sum__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-4) var(--space-6);
  margin: 0;
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border);
}

#panel-timesheet .ts-sum__stats .positions-registry__stat {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

#panel-timesheet .ts-sum__stats .positions-registry__stat-term::after {
  content: ':';
}

#panel-timesheet .ts-sum__stats .positions-registry__stat-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

#ts-sum-root:has(#ts-sum-mode option[value="hours"]:checked) #ts-sum-stat-money-wrap,
#ts-sum-root:has(#ts-sum-mode option[value="hours"]:checked) .ts-sum__stat_money {
  display: none !important;
}

#ts-sum-root:not(.ts-sum--view-map) #ts-sum-stat-delta-wrap,
#ts-sum-root:not(.ts-sum--view-map) .ts-sum__stat_map {
  display: none !important;
}

#panel-timesheet .ts-sum__toolbar {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

#panel-timesheet .ts-sum__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

#panel-timesheet .ts-sum__toolbar-row_map {
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}

#panel-timesheet .ts-sum__period-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

#panel-timesheet .ts-sum__period-label {
  min-width: 12rem;
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
}

#panel-timesheet .ts-sum__month-btn {
  min-width: var(--field-height);
  width: var(--field-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

#panel-timesheet .positions-registry__control,
#panel-timesheet .positions-registry__refresh-btn,
#panel-timesheet .ts-sum__export-btn,
#panel-timesheet .ts-sum__reset-btn,
#panel-timesheet .ts-sum__filter {
  min-height: var(--field-height);
  height: var(--field-height);
  box-sizing: border-box;
  font-size: var(--text-sm);
}

#panel-timesheet .ts-sum__filter {
  min-width: 9rem;
  max-width: 14rem;
}

#panel-timesheet .ts-sum__toolbar-search {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 20rem;
}

#panel-timesheet .ts-sum__view-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

#panel-timesheet .ts-sum__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: var(--space-3);
  align-items: start;
}

#panel-timesheet .ts-sum__pane_aside {
  position: sticky;
  top: var(--space-2);
  max-height: calc(100dvh - var(--space-2) - var(--space-3));
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  align-self: start;
}

@media (max-width: 1100px) {
  #panel-timesheet .ts-sum__layout {
    grid-template-columns: 1fr;
  }

  #panel-timesheet .ts-sum--has-selection:not(.ts-sum--view-map) .ts-sum__pane_aside {
    order: -1;
    top: 0;
    z-index: 5;
    max-height: min(42vh, 22rem);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  }
}

#panel-timesheet .ts-sum__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

#panel-timesheet .ts-sum__pane-head {
  margin: 0;
}

#panel-timesheet .ts-sum__pane-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
}

#panel-timesheet .ts-sum__pane-hint {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

#panel-timesheet .ts-sum__aside-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

#panel-timesheet .ts-sum__aside-head-row .ts-sum__pane-title {
  margin: 0;
}

#panel-timesheet .ts-sum__clear-selection {
  flex-shrink: 0;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
}

#panel-timesheet .ts-sum__aside-selection {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 500;
}

#panel-timesheet .ts-sum__tree-host,
#panel-timesheet .ts-sum__table-host,
#panel-timesheet .ts-sum__details-host {
  min-width: 0;
  overflow-x: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

#panel-timesheet .ts-sum__mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

#panel-timesheet .ts-sum__tree {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

#panel-timesheet .ts-sum__tree-node {
  border-left: 2px solid var(--border);
  padding-left: var(--space-2);
  margin-bottom: var(--space-1);
}

#panel-timesheet .ts-sum__tree-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1);
  cursor: default;
  list-style: none;
  padding: var(--space-1) 0;
}

#panel-timesheet .ts-sum__tree-summary::-webkit-details-marker {
  display: none;
}

#panel-timesheet .ts-sum__tree-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

#panel-timesheet .ts-sum__tree-toggle:hover {
  background: var(--surface-hover);
}

#panel-timesheet .ts-sum__tree-toggle:active {
  background: var(--accent-muted);
}

#panel-timesheet .ts-sum__tree-node[open] > .ts-sum__tree-summary .ts-sum__tree-toggle {
  color: var(--text-head);
}

#panel-timesheet .ts-sum__tree-node:has(.ts-sum__row_selected) {
  border-left-color: var(--accent);
}

#panel-timesheet .ts-sum__tree-node:has(.ts-sum__row_selected) > .ts-sum__tree-summary .ts-sum__tree-toggle {
  color: var(--accent);
}

#panel-timesheet .ts-sum__tree-toggle:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

#panel-timesheet .ts-sum__tree-toggle-icon {
  display: block;
  transition: transform 0.15s ease-out;
}

#panel-timesheet .ts-sum__tree-node[open] > .ts-sum__tree-summary .ts-sum__tree-toggle-icon {
  transform: rotate(90deg);
}

#panel-timesheet .ts-sum__tree-select {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

#panel-timesheet .ts-sum__tree-select:hover {
  background: var(--surface-hover);
}

#panel-timesheet .ts-sum__tree-label,
#panel-timesheet .ts-sum__tree-leaf-label {
  flex: 1 1 12rem;
  font-weight: 600;
}

#panel-timesheet .ts-sum__tree-type {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

#panel-timesheet .ts-sum__tree-metrics {
  font-size: var(--text-sm);
  margin-left: auto;
}

#panel-timesheet .ts-sum__tree-leaf {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  margin-left: var(--space-3);
}

#panel-timesheet .ts-sum__tree-leaf[data-key] {
  cursor: pointer;
}

#panel-timesheet .ts-sum__tree-leaf[data-key]:hover,
#panel-timesheet .ts-sum__row:hover,
#panel-timesheet .ts-sum__table-row:hover {
  background: var(--surface-hover);
}

#panel-timesheet .ts-sum__row:focus-visible,
#panel-timesheet .ts-sum__tree-leaf[data-key]:focus-visible,
#panel-timesheet .ts-sum__table-row:focus-visible {
  outline: 2px solid var(--accent-focus, var(--accent));
  outline-offset: -2px;
}

#panel-timesheet .ts-sum__tree-select.ts-sum__row_selected,
#panel-timesheet .ts-sum__tree-leaf.ts-sum__row_selected,
#panel-timesheet .ts-sum__row_selected,
#panel-timesheet .ts-sum__table-row.ts-sum__row_selected {
  background: var(--accent-muted);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

#panel-timesheet .ts-sum__tree-select.ts-sum__row_selected .ts-sum__tree-label,
#panel-timesheet .ts-sum__tree-leaf.ts-sum__row_selected .ts-sum__tree-leaf-label {
  color: var(--accent);
}

#panel-timesheet .ts-sum__emp-group {
  margin: 0 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#panel-timesheet .ts-sum__emp-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

#panel-timesheet .ts-sum__emp-group .ts-sum__table tbody tr:last-child td {
  border-bottom: none;
}

#panel-timesheet .ts-sum__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

#panel-timesheet .ts-sum__table thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-subtle);
}

#panel-timesheet .ts-sum__table th,
#panel-timesheet .ts-sum__table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}

#panel-timesheet .ts-sum__table th.ts-sum__num,
#panel-timesheet .ts-sum__table td.ts-sum__num {
  text-align: right;
}

#panel-timesheet .ts-sum__table_compact th,
#panel-timesheet .ts-sum__table_compact td {
  padding: 4px 6px;
}

#panel-timesheet .ts-sum__warnings-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

#panel-timesheet .ts-sum__warning-item {
  padding: var(--space-2) var(--space-3);
  border: 1px solid color-mix(in srgb, var(--warn, #d97706) 35%, var(--border));
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--text-sm);
}

#panel-timesheet .ts-sum__empty {
  padding: var(--space-4) var(--space-2);
  text-align: center;
}

#panel-timesheet .ts-sum__empty-title {
  margin: 0 0 var(--space-1);
  font-weight: 600;
}

#panel-timesheet .ts-sum__hint,
#panel-timesheet .ts-sum__loading,
#panel-timesheet .ts-sum__status {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

#panel-timesheet .ts-sum__loading {
  padding: var(--space-3) 0;
  text-align: center;
}

#panel-timesheet .ts-sum__fatal {
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--err, #ef4444) 40%, var(--border));
  border-radius: var(--radius-md);
}

#panel-timesheet .ts-sum__fatal-text {
  margin: 0 0 var(--space-2);
  color: var(--err, #ef4444);
}

#panel-timesheet .ts-sum__details-chart {
  margin-bottom: var(--space-2);
}

#panel-timesheet .ts-sum__spark {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Map view: strip main pane chrome, scoped ts-ana inside ts-sum */
#ts-sum-root.ts-sum--view-map .ts-sum__pane_main {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

#ts-sum-root.ts-sum--view-map .ts-sum__pane-head {
  display: none;
}

#ts-sum-root #ts-ana-registry {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

#panel-timesheet #ts-sum-root .ts-ana-registry__movers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  font-size: var(--text-sm);
}

#panel-timesheet #ts-sum-root .ts-ana-registry__movers-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
}

#panel-timesheet #ts-sum-root .ts-ana-registry__mover strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

#panel-timesheet #ts-sum-root .ts-ana-registry__section-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

#panel-timesheet #ts-sum-root .ts-ana-registry__map-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

#panel-timesheet #ts-sum-root .ts-ana-registry__alerts-host {
  min-height: 2rem;
}

#panel-timesheet #ts-sum-root .ts-ana-registry__heatmap-host {
  overflow: auto;
  max-height: min(58vh, 42rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

#ts-sum-stat-delta.ts-ana-registry__stat-val_up {
  color: var(--success, var(--warn, #16a34a));
}

#ts-sum-stat-delta.ts-ana-registry__stat-val_down {
  color: var(--err, #ef4444);
}

@media (max-width: 720px) {
  #panel-timesheet .ts-sum__stats {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  #panel-timesheet .ts-sum__period-label {
    min-width: 0;
    flex: 1 1 auto;
  }

  #panel-timesheet .ts-sum__toolbar-search {
    flex: 1 1 100%;
    max-width: none;
  }

  #panel-timesheet .ts-sum__filter {
    flex: 1 1 calc(50% - var(--space-1));
    min-width: 0;
    max-width: none;
  }

  #panel-timesheet #ts-sum-root .ts-ana-registry__heatmap-host {
    max-height: min(50vh, 32rem);
  }
}

/* sticky сайдбара: overflow:hidden на обёртке обрезает position:sticky */
#panel-foreman-timesheet .panel-body_foreman-ts,
#panel-object-manager-timesheet .panel-body_foreman-ts {
  overflow: visible;
}

.panel-body_foreman-ts {
  padding-top: var(--space-3);
}

#panel-foreman-timesheet .panel-body_foreman-ts {
  padding-top: var(--space-2);
}

:root {
  /* fallback до ResizeObserver; JS пишет px на documentElement */
  --foreman-ts-app-header-offset: 6.5rem;
}

/* P-TIMESHEET: сводка (dl) и панель контента — как §1.1 ui-guidelines + web-design-system §6 */
.foreman-ts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow: visible;
  --foreman-ts-sticky-gap: var(--space-3);
  --foreman-ts-sticky-top: calc(var(--foreman-ts-app-header-offset) + var(--foreman-ts-sticky-gap));
  --foreman-ts-sticky-chrome-height: calc(var(--foreman-ts-period-bar-height) + var(--space-4));
  --foreman-ts-sticky-aside-top: calc(var(--foreman-ts-sticky-top) + var(--foreman-ts-sticky-chrome-height) + var(--space-3));
  --foreman-ts-period-bar-height: 2.75rem;
  --foreman-ts-sticky-col-shadow: 3px 0 8px -4px color-mix(in srgb, var(--text) 12%, transparent);
  --foreman-ts-sticky-col-shadow-end: -3px 0 8px -4px color-mix(in srgb, var(--text) 12%, transparent);
}

.foreman-ts__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.foreman-ts__stats {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 28px;
  margin: 0;
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border);
}

.foreman-ts__stat {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
}

.foreman-ts__stat-term {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
  order: 1;
}

.foreman-ts__stat-val {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-head, var(--text));
  order: 0;
}

@media (max-width: 720px) {
  .foreman-ts__stats {
    gap: var(--space-4);
  }
}

.foreman-ts__layout > .foreman-ts__pane {
  min-width: 0;
}

.foreman-ts__pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  min-width: 0;
  /* Горизонтальный скролл только у .foreman-ts__table-scroll; overflow-x:auto здесь
     по спеке превращает overflow-y в auto → ловушка прокрутки под легендой Anviz */
}

.foreman-ts__pane-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.foreman-ts__pane-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

.foreman-ts__pane-desc {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.foreman-ts__toolbar {
  margin-bottom: var(--space-4);
}

.foreman-ts__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Одна навигация по дню/периоду: mobile-bar или desktop-only, не оба (legacy + new). */
.foreman-ts__toolbar-row_mobile-bar {
  display: none;
}

.foreman-ts--mobile .foreman-ts__toolbar-row_mobile-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-1);
  min-height: 2.75rem;
  min-width: 0;
}

.foreman-ts--mobile .foreman-ts__toolbar-row_desktop-only {
  display: none;
}

.foreman-ts__toolbar-row_top {
  justify-content: flex-start;
}

/* Desktop: одна липкая строка — период, поиск по центру, навигация справа. */
.foreman-ts:not(.foreman-ts--mobile) > .foreman-ts__sticky-chrome {
  position: sticky;
  top: var(--foreman-ts-sticky-top);
  z-index: calc(var(--z-sticky, 100) - 1);
  width: 100%;
  max-width: 100%;
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.foreman-ts:not(.foreman-ts--mobile) > .foreman-ts__sticky-chrome > .foreman-ts__toolbar-row_top {
  margin-bottom: 0;
}

.foreman-ts:not(.foreman-ts--mobile) > .foreman-ts__sticky-chrome > .foreman-ts__toolbar-row_search_mobile {
  display: none;
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__toolbar {
  display: none;
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__period-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  width: 100%;
  min-height: var(--foreman-ts-period-bar-height);
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__period-strip-search {
  flex: 1 1 10rem;
  min-width: 0;
  margin: 0 var(--space-1);
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__period-strip-search .foreman-ts__toolbar-search {
  width: 100%;
  min-width: 0;
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__period-strip-search .foreman-ts__search-bar {
  width: 100%;
  min-width: 0;
  min-height: var(--field-height-sm, 2.25rem);
  height: var(--field-height-sm, 2.25rem);
}

.foreman-ts--mobile .foreman-ts__period-strip-search {
  display: none;
}

/* Mobile: chip/день над поиском (DOM: chrome → header, порядок через flex order). */
.foreman-ts--mobile > .foreman-ts__toolbar {
  order: 1;
}

.foreman-ts--mobile > .foreman-ts__sticky-chrome {
  order: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.foreman-ts--mobile > .foreman-ts__layout {
  order: 3;
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__toolbar-row_desktop-only.foreman-ts__toolbar-row_compact {
  /* overflow-y:hidden у .foreman-ts__toolbar-row_compact ломает sticky */
  overflow: visible;
  flex-wrap: nowrap;
  gap: 0;
}

.foreman-ts__toolbar-row_desktop-only .foreman-ts__period-nav {
  flex-shrink: 0;
  margin-left: 0;
  padding-left: var(--space-2);
  border-left: 1px solid var(--border-muted);
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__toolbar-row_desktop-only .foreman-ts__period-nav[aria-busy='true'] {
  opacity: 0.72;
  pointer-events: none;
}

.foreman-ts:not(.foreman-ts--mobile) [data-foreman-search-match],
.foreman-ts:not(.foreman-ts--mobile) [data-om-ts-search-match],
.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__group {
  scroll-margin-top: calc(var(--foreman-ts-sticky-top) + var(--foreman-ts-sticky-chrome-height));
}

/* Одна строка: Н/М, период, режим, навигация */
.foreman-ts__toolbar-row_compact {
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.foreman-ts__toolbar-row_compact > .foreman-ts__period {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.foreman-ts__period-prefix {
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__period-range {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}

.foreman-ts__toolbar-row_compact .foreman-ts__access {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 2px var(--space-2);
  border: 1px solid var(--border-muted, var(--border));
  border-radius: var(--radius-sm);
  background: var(--surface-subtle, var(--surface));
}

.foreman-ts__filter-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.foreman-ts__filter-check-input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent, var(--primary));
}

.foreman-ts__filter-check-label {
  line-height: 1.2;
}

.foreman-ts__stat-muted {
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: 400;
}

.foreman-ts__period-nav {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 0.8125rem;
  line-height: 1;
  margin-left: auto;
}

.foreman-ts__period-nav_brigade {
  margin-left: 0;
  flex-shrink: 0;
}

/* Поиск — docflow-panel__search-bar (web-ui-style §3.4, §4.6) */
.foreman-ts__toolbar-row_search {
  margin-bottom: 0;
  width: 100%;
}

.foreman-ts__toolbar-search.docflow-panel__toolbar-search {
  flex: 1 1 100%;
  max-width: none;
  width: 100%;
}

.foreman-ts__search-bar.docflow-panel__search-bar {
  gap: var(--space-2);
}

.foreman-ts__search-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.foreman-ts__search-meta_hidden {
  display: none;
}

.foreman-ts__search-occurrences {
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__search-sep {
  color: var(--text-subtle);
}

.foreman-ts__search-count {
  min-width: 2.5rem;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__search-nav {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-left: var(--space-1);
}

.foreman-ts__search-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--field-height-sm, 2.25rem);
  min-width: var(--field-height-sm, 2.25rem);
  height: var(--field-height-sm, 2.25rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-base);
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.foreman-ts__search-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
  color: var(--text);
}

.foreman-ts__search-nav-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.foreman-ts__search-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.foreman-ts__search-match_active.foreman-ts__td-name,
.foreman-ts__search-match_active.foreman-ts__brigade-foreman-name,
.foreman-ts__search-match_active.foreman-ts__node-btn {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
}

.foreman-ts__brigade-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-light);
}

.foreman-ts__brigade-toolbar .foreman-ts__brigade-foreman-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 10rem;
}

[data-foreman-search-match],
[data-om-ts-search-match] {
  scroll-margin-top: var(--space-4);
  scroll-margin-bottom: var(--space-4);
}

.foreman-ts__period-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 3px;
  border: none;
  border-radius: var(--radius-sm, 4px);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__period-btn {
  min-width: var(--field-height-sm, 36px);
  min-height: var(--field-height-sm, 36px);
  height: var(--field-height-sm, 36px);
  padding: 0 var(--space-1);
}

.foreman-ts:not(.foreman-ts--mobile) .foreman-ts__period-date {
  display: inline-flex;
  align-items: center;
  min-height: var(--field-height-sm, 36px);
}
.foreman-ts__period-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.foreman-ts__period-btn_today {
  font-weight: 600;
  color: var(--accent);
}
.foreman-ts__period-btn_today:hover {
  background: var(--accent-muted);
  color: var(--accent);
}
.foreman-ts__period-btn_refresh {
  font-size: 0.875rem;
  opacity: 0.6;
}
.foreman-ts__period-btn_refresh:hover {
  opacity: 1;
}
.foreman-ts__period-date {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm, 4px);
  min-width: 6.5ch;
  justify-content: center;
}
.foreman-ts__period-date:hover {
  background: var(--surface-hover);
  color: var(--accent);
}
.foreman-ts__date-picker {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Сегмент «неделя | месяц» — компактный pill, ориентир M3 segmented buttons */
.foreman-ts__segmented {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.foreman-ts__segmented_aside {
  flex: 0 0 auto;
}

.foreman-ts__segment {
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  min-width: 2rem;
}

.foreman-ts__segment:last-child {
  border-right: none;
}

.foreman-ts__segment:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.foreman-ts__segment:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210 90% 45%));
  outline-offset: 2px;
  z-index: 1;
}

.foreman-ts__segment_active {
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.foreman-ts__view-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 0 auto;
}

.foreman-ts__view-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Вид неделя/месяц — inner-pill как profile-segmented, без inset-обводки на pill */
.foreman-ts__view-segmented.foreman-ts__segmented {
  box-sizing: border-box;
  flex-shrink: 0;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-md);
  overflow: visible;
  background: var(--surface);
}

.foreman-ts__view-segmented .foreman-ts__segment {
  box-sizing: border-box;
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--field-height-sm, 2.25rem) - 4px);
  padding: 0 var(--space-3);
  border: none;
  border-right: none;
  border-radius: calc(var(--radius-md) - 2px);
  white-space: nowrap;
}

.foreman-ts__view-segmented .foreman-ts__segment:hover {
  z-index: 1;
}

.foreman-ts__view-segmented .foreman-ts__segment:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210 90% 45%));
  outline-offset: 1px;
  z-index: 2;
}

.foreman-ts__view-segmented .foreman-ts__segment_active {
  z-index: 1;
  background: var(--bg-elevated, var(--surface-elevated));
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.foreman-ts__view-segmented .foreman-ts__segment:disabled,
.foreman-ts__view-segmented .foreman-ts__segment[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Одиночный переключатель "Н/М" — legacy, не используется в sticky toolbar. */
.foreman-ts__seg-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  min-width: 2.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.foreman-ts__seg-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.foreman-ts__seg-toggle:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210 90% 45%));
  outline-offset: 2px;
}

/* aria-pressed=true => Неделя (Н) “включено” */
.foreman-ts__seg-toggle_on,
.foreman-ts__seg-toggle[aria-pressed="true"] {
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.foreman-ts__period-dates {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.foreman-ts__period {
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  min-width: 0;
}

.foreman-ts__layout > .foreman-ts__aside {
  flex: 0 0 var(--foreman-ts-aside-width, 240px);
  width: var(--foreman-ts-aside-width, 240px);
  max-width: 55%;
  min-width: 0;
}

.foreman-ts__layout > .foreman-ts__pane {
  flex: 1 1 0;
  min-width: 0;
}

.foreman-ts__layout-split {
  position: relative;
  flex: 0 0 var(--foreman-ts-split-col, 6px);
  width: var(--foreman-ts-split-col, 6px);
  min-width: var(--foreman-ts-split-col, 6px);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  align-self: stretch;
  z-index: 2;
  flex-shrink: 0;
}

.foreman-ts__layout-split::before {
  content: '';
  position: absolute;
  top: var(--space-2);
  bottom: var(--space-2);
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: var(--radius-sm);
  background: var(--border);
  transition: background 0.15s ease-out;
}

.foreman-ts__layout-split:hover::before,
.foreman-ts__layout-split:focus-visible::before,
.foreman-ts__layout-split[aria-grabbed='true']::before {
  background: var(--accent);
}

.foreman-ts__layout-split:focus-visible {
  outline: none;
}

.foreman-ts__layout-split:focus-visible::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  outline: 2px solid var(--accent-focus);
  outline-offset: 0;
}

.foreman-ts__layout_resizing,
body.foreman-ts-layout-resizing {
  cursor: col-resize;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .foreman-ts__layout-split::before {
    transition: none;
  }
}

.foreman-ts__aside {
  width: 100%;
  min-width: 0;
  max-width: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
}

#panel-foreman-timesheet .foreman-ts__aside,
#panel-object-manager-timesheet .foreman-ts__aside {
  padding: var(--space-2) var(--space-3) var(--space-3);
  position: sticky;
  top: var(--foreman-ts-sticky-top);
  max-height: calc(100vh - var(--foreman-ts-sticky-top) - var(--foreman-ts-sticky-gap));
  max-height: calc(100dvh - var(--foreman-ts-sticky-top) - var(--foreman-ts-sticky-gap));
  box-sizing: border-box;
  overflow: hidden;
}

#panel-foreman-timesheet .foreman-ts:not(.foreman-ts--mobile) .foreman-ts__aside,
#panel-object-manager-timesheet .foreman-ts:not(.foreman-ts--mobile) .foreman-ts__aside {
  top: var(--foreman-ts-sticky-aside-top);
  max-height: calc(100vh - var(--foreman-ts-sticky-aside-top) - var(--foreman-ts-sticky-gap));
  max-height: calc(100dvh - var(--foreman-ts-sticky-aside-top) - var(--foreman-ts-sticky-gap));
}

/* .panel h3 даёт margin-top: var(--space-8) — «пустая строка» над «Договоры» */
#panel-foreman-timesheet.panel .foreman-ts__aside .foreman-ts__aside-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

#panel-foreman-timesheet .foreman-ts__aside-head {
  margin: 0 0 var(--space-2);
  padding-top: 0;
}

.foreman-ts__aside-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-shrink: 0;
}

.foreman-ts__aside-title {
  margin: 0;
  font-size: var(--text-base);
  flex: 1 1 auto;
  min-width: 0;
}

.foreman-ts__aside-toggle {
  flex-shrink: 0;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
}

.foreman-ts__aside-toggle-icon {
  display: inline-block;
}

.foreman-ts__aside-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(70vh, 28rem);
}

.foreman-ts__aside-panels {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.foreman-ts__aside-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.foreman-ts__aside-panel[hidden] {
  display: none !important;
}

#panel-foreman-timesheet .foreman-ts__aside-body,
#panel-object-manager-timesheet .foreman-ts__aside-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Узлы свернуты влево — табель на всю оставшуюся ширину */
.foreman-ts__layout_nodes-collapsed {
  --foreman-ts-aside-width: 2.75rem;
}

.foreman-ts__layout_nodes-collapsed > .foreman-ts__aside {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  max-width: 2.75rem;
}

.foreman-ts__layout_nodes-collapsed .foreman-ts__layout-split {
  display: none;
}

.foreman-ts__layout_nodes-collapsed .foreman-ts__aside {
  width: 2.75rem;
  min-width: 2.75rem;
  max-width: 2.75rem;
  padding: var(--space-2) var(--space-1);
}

#panel-foreman-timesheet .foreman-ts__layout_nodes-collapsed .foreman-ts__aside,
#panel-object-manager-timesheet .foreman-ts__layout_nodes-collapsed .foreman-ts__aside {
  max-height: calc(100dvh - var(--foreman-ts-sticky-top) - var(--foreman-ts-sticky-gap));
}

.foreman-ts__layout_nodes-collapsed .foreman-ts__aside-head {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0;
  gap: 0;
}

.foreman-ts__layout_nodes-collapsed .foreman-ts__aside-head .foreman-ts__aside-title {
  display: none;
}

.foreman-ts__layout_nodes-collapsed .foreman-ts__aside-body {
  display: none;
}

.foreman-ts__layout_nodes-collapsed .foreman-ts__aside-toggle {
  width: 100%;
}

.foreman-ts__node-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foreman-ts__node-item {
  padding: var(--space-1) var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.foreman-ts__node-item_filtered .foreman-ts__node-path {
  color: var(--text-muted);
}

.foreman-ts__node-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: transparent;
  box-sizing: border-box;
}

.foreman-ts__node-card:hover,
.foreman-ts__node-card:focus-within {
  background: var(--surface-hover);
}

.foreman-ts__node-details {
  margin: var(--space-1) 0 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--link, hsl(210 90% 40%));
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  align-self: flex-end;
  position: relative;
  z-index: 1;
}

.foreman-ts__node-details:hover {
  color: var(--link-hover, hsl(210 90% 32%));
}

.foreman-ts__node-details:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210 90% 45%));
  outline-offset: 2px;
}

.foreman-ts__node-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}

.foreman-ts__node-btn-main {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  width: 100%;
}

.foreman-ts__node-btn-main .foreman-ts__node-detail {
  flex: 1 1 100%;
  white-space: normal;
}

.foreman-ts__node-btn:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210 90% 45%));
  outline-offset: 2px;
}

.foreman-ts__node-path {
  flex: 1 1 8rem;
  min-width: 0;
  word-break: break-word;
}

.foreman-ts__node-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: var(--space-1);
}

.foreman-ts__node-empty {
  list-style: none;
  margin: 0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-muted, var(--border));
  background: var(--surface-subtle, var(--surface));
}

.foreman-ts__node-empty-title {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  margin: 0 0 var(--space-1);
}

.foreman-ts__node-empty-text {
  display: block;
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.foreman-ts__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.foreman-ts__group {
  margin-bottom: var(--space-5);
  scroll-margin-top: var(--foreman-ts-sticky-top);
}

.foreman-ts__group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

.foreman-ts__group-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  line-height: var(--leading-tight);
  flex: 1 1 auto;
  min-width: 0;
}

/* Командировочный / гость: ФИО и компактное исключение в одной строке (высота как у прораба). */
.foreman-ts__name-cell_guest {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.foreman-ts__name-cell_guest > .employees-registry__cell-fio-stack,
.foreman-ts__name-cell_guest > .employees-registry__cell-fio-stack_fallback,
.foreman-ts__name-cell_guest > .foreman-ts__name-stack {
  flex: 1 1 auto;
  min-width: 0;
}

.foreman-ts__guest-remove {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.foreman-ts__guest-remove-glyph {
  display: block;
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1;
  color: inherit;
  pointer-events: none;
}

#panel-object-manager-timesheet.panel .foreman-ts__table td.foreman-ts__td-name .foreman-ts__guest-remove,
#panel-foreman-timesheet.panel .foreman-ts__table td.foreman-ts__td-name .foreman-ts__guest-remove {
  margin: 0;
  padding: 0;
  min-width: 1.75rem;
  min-height: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: inherit;
  font-weight: inherit;
}

.foreman-ts__guest-remove:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}

.foreman-ts__name-cell_with-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.foreman-ts__name-cell_with-actions > .employees-registry__cell-fio-stack,
.foreman-ts__name-cell_with-actions > .employees-registry__cell-fio-stack_fallback {
  flex: 1 1 auto;
  min-width: 0;
}

.foreman-ts__movements-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.foreman-ts__movements-link-glyph {
  display: block;
  font-size: 0.875rem;
  line-height: 1;
  pointer-events: none;
}

#panel-object-manager-timesheet.panel .foreman-ts__table td.foreman-ts__td-name .foreman-ts__movements-link,
#panel-foreman-timesheet.panel .foreman-ts__table td.foreman-ts__td-name .foreman-ts__movements-link {
  min-width: 1.75rem;
  min-height: 1.75rem;
}

.foreman-ts__table tbody tr:hover .foreman-ts__movements-link,
.foreman-ts__table tbody tr:focus-within .foreman-ts__movements-link {
  opacity: 1;
  pointer-events: auto;
}

.foreman-ts__movements-link:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.foreman-ts__movements-link:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 2px;
}

@media (hover: none) {
  .foreman-ts__name-cell .foreman-ts__movements-link,
  .foreman-ts__name-cell .foreman-ts__assign-foreman-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.foreman-ts__name-cell-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-1);
}

.foreman-ts__assign-foreman-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  padding: 0 var(--space-2);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.foreman-ts__table tbody tr:hover .foreman-ts__assign-foreman-btn,
.foreman-ts__table tbody tr:focus-within .foreman-ts__assign-foreman-btn {
  opacity: 1;
  pointer-events: auto;
}

.foreman-ts__assign-foreman-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.foreman-ts__assign-foreman-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 2px;
}

.foreman-ts__assign-popover {
  z-index: 1200;
  max-width: min(22rem, calc(100vw - 1rem));
}

.foreman-ts__assign-popover-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: min(24rem, calc(100vh - 2rem));
}

.foreman-ts__assign-popover-employee {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.foreman-ts__assign-popover-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.foreman-ts__assign-popover-search {
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.foreman-ts__assign-popover-body {
  overflow: auto;
  min-height: 2rem;
}

.foreman-ts__assign-popover-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.foreman-ts__assign-popover-item {
  display: flex;
  width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.foreman-ts__assign-popover-item:last-child {
  border-bottom: 0;
}

.foreman-ts__assign-popover-item:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.foreman-ts__assign-popover-item:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: -2px;
}

.foreman-ts__assign-popover-item_disabled,
.foreman-ts__assign-popover-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.foreman-ts__assign-popover-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.foreman-ts__assign-popover-item-title {
  font-weight: 600;
  line-height: 1.3;
}

.foreman-ts__assign-popover-item-sub {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}

.foreman-ts__assign-popover-item-dir {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.foreman-ts__assign-popover-badge,
.foreman-ts__assign-popover-no-user {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.foreman-ts__assign-popover-empty {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.foreman-ts__assign-popover-empty_error {
  color: var(--danger);
}

.movements-registry__employee-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
}

.movements-registry__employee-chip-label {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movements-registry__employee-chip-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
}

.movements-registry__employee-chip-clear:hover {
  color: var(--text);
}

.movements-registry__employee-chip-clear:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 2px;
}

.foreman-ts__guest-remove:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 2px;
}

.foreman-ts__guest-remove:active {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

/* Командировочный / гость в табеле РО: лёгкая подсветка строки (отличие от прорабов площадки) */
#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest > td {
  background-color: var(--warn-muted);
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-name {
  box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--warn) 65%, transparent);
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-total {
  background-color: color-mix(in srgb, var(--warn-muted) 80%, var(--surface-subtle, var(--surface)));
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-day.foreman-ts__day-col_today {
  background-color: color-mix(
    in srgb,
    var(--warn-muted) 55%,
    color-mix(in srgb, var(--accent-muted) 32%, transparent)
  );
  box-shadow:
    inset 2px 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent),
    inset -2px 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
}

#panel-object-manager-timesheet .foreman-ts__table-scroll_month .foreman-ts__table_month tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-name,
#panel-object-manager-timesheet .foreman-ts__table-scroll_month .foreman-ts__table_month tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-total:last-child {
  background-color: color-mix(in srgb, var(--warn) 10%, var(--surface-elevated));
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest_ended > td {
  background-color: color-mix(in srgb, var(--warn-muted) 55%, var(--surface));
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest_ended > td.foreman-ts__td-name {
  box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--text-muted) 50%, transparent);
}

.foreman-ts__name-cell_guest_ended {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.foreman-ts__guest-ended-badge {
  flex-shrink: 0;
  padding: 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text-muted) 8%, var(--surface));
  white-space: nowrap;
}

/* Дни периода командировки (ручной состав) */
#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-day.foreman-ts__day-col_guest-period {
  background-color: color-mix(in srgb, var(--warn) 14%, transparent);
  box-shadow: inset 0 -2px 0 0 color-mix(in srgb, var(--warn) 55%, transparent);
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest > td.foreman-ts__td-day.foreman-ts__day-col_guest-period.foreman-ts__day-col_today {
  background-color: color-mix(
    in srgb,
    var(--warn) 12%,
    color-mix(in srgb, var(--accent-muted) 32%, transparent)
  );
}

#panel-object-manager-timesheet .foreman-ts__table tbody tr.foreman-ts__tr_guest_ended > td.foreman-ts__td-day.foreman-ts__day-col_guest-period {
  background-color: color-mix(in srgb, var(--warn) 10%, var(--surface));
}

#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_guest_ended {
  cursor: default;
  color: var(--text-muted);
}

/* Табель: часы > 10 (разрешены, но должны быть заметны) */
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_overcap,
#panel-foreman-timesheet.panel .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_overcap {
  color: var(--danger, #dc2626);
  border-color: color-mix(in srgb, var(--danger, #dc2626) 55%, var(--border));
  background-color: color-mix(in srgb, var(--danger, #dc2626) 10%, var(--surface));
  font-weight: 600;
}

/* Модалка добавления сотрудника в табель РО — общий dialog-employee-create + колонка полей */
.om-ts-add-employee-dialog.dialog-employee-create {
  max-width: min(90vw, 32rem);
}

.om-ts-add-employee-body.form-employee-stack {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: var(--space-3);
}

.om-ts-add-employee-results-wrap {
  flex: none;
  width: 100%;
  min-height: 10rem;
  max-height: 16rem;
}

.om-ts-add-employee-results-wrap .task-create-marks-picker-item {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
}

.foreman-ts__brigade-head {
  margin: 0 0 var(--space-3);
}

.foreman-ts__brigade-meta {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.35;
}

.foreman-ts__brigade-meta-type {
  font-weight: 600;
  color: var(--text-secondary, var(--text-muted));
}

.foreman-ts__brigade-number {
  margin-left: var(--space-2);
  font-weight: 500;
}

.foreman-ts__brigade-subject {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

.foreman-ts__brigade-subject_muted {
  font-weight: 500;
  color: var(--text-muted);
}

.foreman-ts__node-detail {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foreman-ts__brigade-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  color: var(--text-muted);
}

.foreman-ts__brigade-block + .foreman-ts__brigade-block {
  margin-top: var(--space-4);
}

.foreman-ts__brigade-foreman-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__brigade-block > .foreman-ts__brigade-foreman-title {
  margin-bottom: var(--space-2);
}

.foreman-ts__brigade-foreman-name {
  font-weight: 600;
}

.foreman-ts__table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  /* Одна минимальная ширина сетки для всех бригад — колонки совпадают по вертикали */
  min-width: min(100%, 58rem);
}

/* Месяц: широкая сетка дней — прокрутка по горизонтали, без жёсткой нижней границы min-width */
.foreman-ts__table-scroll_month {
  min-width: 0;
  /* Полоса horizontal scrollbar не перекрывает нижнюю строку (итого бригады) */
  padding-bottom: max(14px, var(--space-3));
  box-sizing: border-box;
}

.foreman-ts__table-scroll_month > table.foreman-ts__table.foreman-ts__table_month {
  margin-bottom: var(--space-2);
}

.foreman-ts__table {
  table-layout: fixed;
  width: 100%;
  min-width: 48.6rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.foreman-ts__table_month {
  font-size: 0.75rem;
  /* Ширина задаётся inline из JS (14rem + N×день + итог), без растягивания на 100% —
     иначе table-layout:fixed разъезжается с colgroup и липкими колонками. */
  table-layout: fixed;
}

/* Месяц: колонка дня — на ~10% уже прежних 3.5rem; синхрон: monthDayColRem в foreman-timesheet.js */
.foreman-ts__table_month col.foreman-ts__col-day {
  width: 3.15rem;
}

.foreman-ts__table_month thead th.foreman-ts__th-day,
.foreman-ts__table_month tbody td.foreman-ts__td-day {
  width: 3.15rem;
  min-width: 3.15rem;
  max-width: 3.15rem;
  box-sizing: border-box;
  padding: 2px 1px;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
}

.foreman-ts__table_month thead th.foreman-ts__th-day .foreman-ts__th-dow,
.foreman-ts__table_month thead th.foreman-ts__th-day .foreman-ts__th-date {
  text-align: center;
}

/* Ячейка дня: только текст по центру; без обводки/паддингов (глобальные .panel button/.panel td button давали «пилюлю»). */
#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day {
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 2.25rem;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

/* Фон под буквами для «статусных» значений (выходной/дорога/прогул и т.п.). */
.foreman-ts__cell-badge {
  /* Дефолтные токены (нейтральная плашка); модификаторы ниже задают свои HSL. */
  --badge-h: 220;
  --badge-s: 10%;
  --badge-l: 78%;
  --badge-a: 0.18;
  --badge-stroke-a: 0.34;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 0.06rem 0.35rem;
  border-radius: 0.42rem;
  line-height: 1.15;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Плашка: фон + тонкий контур — читаемо в dark-mode без «кислоты». */
  background: hsla(var(--badge-h), var(--badge-s), var(--badge-l), var(--badge-a));
  box-shadow:
    inset 0 0 0 1px hsla(var(--badge-h), var(--badge-s), var(--badge-l), var(--badge-stroke-a));
}

.foreman-ts__cell-badge_absence {
  --badge-h: 220;
  --badge-s: 10%;
  --badge-l: 78%;
}

.foreman-ts__cell-badge_weekend {
  /* Выходной: серо-стальной, отдельный от нейтрального absence. */
  --badge-h: 205;
  --badge-s: 14%;
  --badge-l: 74%;
  --badge-a: 0.16;
}

.foreman-ts__cell-badge_travel {
  /* Дорога: синий. */
  --badge-h: 206;
  --badge-s: 82%;
  --badge-l: 68%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_vacation {
  /* Отпуск: фиолетовый. */
  --badge-h: 283;
  --badge-s: 72%;
  --badge-l: 70%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_vacation_extra {
  /* Доп. отпуск: магента (не повторяем отпуск). */
  --badge-h: 318;
  --badge-s: 70%;
  --badge-l: 70%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_sick {
  /* Больничный: зелёный. */
  --badge-h: 142;
  --badge-s: 58%;
  --badge-l: 64%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_no-show {
  /* Неявка: янтарный. */
  --badge-h: 44;
  --badge-s: 84%;
  --badge-l: 64%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_truancy {
  /* Прогул: красный. */
  --badge-h: 6;
  --badge-s: 78%;
  --badge-l: 64%;
  --badge-a: 0.22;
  --badge-stroke-a: 0.42;
}

.foreman-ts__cell-badge_childcare {
  /* Уход за ребёнком: бирюзовый. */
  --badge-h: 175;
  --badge-s: 62%;
  --badge-l: 64%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_unpaid {
  /* Неоплачиваемый: коричнево-оранжевый. */
  --badge-h: 28;
  --badge-s: 78%;
  --badge-l: 62%;
  --badge-a: 0.18;
  --badge-stroke-a: 0.38;
}

.foreman-ts__cell-badge_business-trip {
  /* Командировка (К): индиго. */
  --badge-h: 252;
  --badge-s: 78%;
  --badge-l: 70%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_weekend-work {
  /* Работа в выходной (РВ): салатовый/лайм. */
  --badge-h: 98;
  --badge-s: 70%;
  --badge-l: 66%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

.foreman-ts__cell-badge_halfday {
  /* Полдня (ПО): циан. */
  --badge-h: 192;
  --badge-s: 78%;
  --badge-l: 66%;
  --badge-a: 0.20;
  --badge-stroke-a: 0.40;
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_empty,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_empty {
  color: var(--text-muted);
}

/* Прошедшие дни: пустая ячейка (пропуск заполнения) — мягкий “attention” фон + пунктирная рамка. */
#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_missing,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_missing {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 26%, transparent);
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_missing.foreman-ts__cell_editable:hover,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_missing.foreman-ts__cell_editable:hover,
#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_missing.foreman-ts__cell_editable:focus-visible,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_missing.foreman-ts__cell_editable:focus-visible {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--danger) 38%, transparent);
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable {
  cursor: pointer;
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable:hover,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable:hover,
#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable:focus,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable:focus,
#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable:focus-visible,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell_editable:focus-visible {
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
}

#panel-foreman-timesheet .foreman-ts__table_month td.foreman-ts__td-day > button.foreman-ts__cell,
#panel-object-manager-timesheet .foreman-ts__table_month td.foreman-ts__td-day > button.foreman-ts__cell {
  min-height: 2rem;
  font-size: 0.75rem;
}

/* Столбец текущего дня (UTC): постоянная подсветка всей колонки (шапка + тело) */
#panel-foreman-timesheet .foreman-ts__table thead th.foreman-ts__day-col_today,
#panel-object-manager-timesheet .foreman-ts__table thead th.foreman-ts__day-col_today {
  background-color: color-mix(in srgb, var(--accent-muted) 42%, var(--surface-elevated));
  box-shadow:
    inset 2px 0 0 0 color-mix(in srgb, var(--accent) 38%, transparent),
    inset -2px 0 0 0 color-mix(in srgb, var(--accent) 38%, transparent);
}

#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__td-day.foreman-ts__day-col_today,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__td-day.foreman-ts__day-col_today {
  background-color: color-mix(in srgb, var(--accent-muted) 32%, transparent);
  box-shadow:
    inset 2px 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent),
    inset -2px 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
}

#panel-foreman-timesheet .foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td.foreman-ts__td-day.foreman-ts__day-col_today.foreman-ts__td-brigade-sum-gap,
#panel-object-manager-timesheet .foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td.foreman-ts__td-day.foreman-ts__day-col_today.foreman-ts__td-brigade-sum-gap {
  background-color: color-mix(in srgb, var(--accent-muted) 28%, var(--surface-subtle, var(--surface)));
  box-shadow:
    inset 2px 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent),
    inset -2px 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Производственный календарь: нерабочие/особые дни (праздники, выходные, переносы, сокращённые дни). */
#panel-foreman-timesheet .foreman-ts__table thead th.foreman-ts__day-col_off,
#panel-object-manager-timesheet .foreman-ts__table thead th.foreman-ts__day-col_off {
  background-color: color-mix(in srgb, var(--danger-muted) 55%, var(--surface-elevated));
}

#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__td-day.foreman-ts__day-col_off,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__td-day.foreman-ts__day-col_off {
  background-color: color-mix(in srgb, var(--danger-muted) 35%, transparent);
}

#panel-foreman-timesheet .foreman-ts__table thead th.foreman-ts__day-col_short,
#panel-object-manager-timesheet .foreman-ts__table thead th.foreman-ts__day-col_short {
  background-color: color-mix(in srgb, var(--warn-muted) 55%, var(--surface-elevated));
}

#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__td-day.foreman-ts__day-col_short,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__td-day.foreman-ts__day-col_short {
  background-color: color-mix(in srgb, var(--warn-muted) 35%, transparent);
}

/* Tooltip (облачко) для табеля: показываем сразу при hover/focus вместо нативного title. */
.foreman-ts__tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  max-width: 420px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 80ms linear, transform 80ms ease-out;
}

.foreman-ts__tooltip_visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .foreman-ts__tooltip {
    transition: none;
  }

  .foreman-ts__tooltip,
  .foreman-ts__tooltip_visible {
    transform: none;
  }
}

.foreman-ts__brigade-head {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

/* Отклонение от ожидаемых часов по графику (пока: daily_hours + учёт производственного календаря). */
#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell.foreman-ts__cell_sched_mismatch,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell.foreman-ts__cell_sched_mismatch {
  background-color: color-mix(in srgb, var(--surface-hover) 70%, var(--warn-muted) 30%);
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell.foreman-ts__cell_sched_over,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell.foreman-ts__cell_sched_over {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--danger) 28%, transparent);
}

#panel-foreman-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell.foreman-ts__cell_sched_under,
#panel-object-manager-timesheet .foreman-ts__table td.foreman-ts__td-day > button.foreman-ts__cell.foreman-ts__cell_sched_under {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Ячейка дня: подсветка только прошлые даты и сегодня (UTC); будущие колонки не подсвечиваем */
#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_past:hover,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_past:hover,
#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_past:focus-within,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_past:focus-within {
  background-color: color-mix(in srgb, var(--surface-hover) 85%, var(--text) 4%);
  box-shadow: inset 0 0 0 2px var(--border-muted, var(--border));
}

#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_today:hover,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_today:hover,
#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_today:focus-within,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_today:focus-within {
  background-color: color-mix(in srgb, var(--surface-hover) 55%, var(--accent-muted) 45%);
  box-shadow:
    inset 2px 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent),
    inset -2px 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent),
    inset 0 0 0 2px color-mix(in srgb, var(--accent) 28%, var(--border-muted, var(--border)));
}

#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_future:hover,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_future:hover,
#panel-foreman-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_future:focus-within,
#panel-object-manager-timesheet .foreman-ts__table tbody td.foreman-ts__day-col_future:focus-within {
  background-color: transparent;
  box-shadow: none;
}

#panel-foreman-timesheet .foreman-ts__table thead th.foreman-ts__day-col_past:hover,
#panel-object-manager-timesheet .foreman-ts__table thead th.foreman-ts__day-col_past:hover {
  background-color: color-mix(in srgb, var(--surface-hover) 85%, var(--text) 4%);
  box-shadow: inset 0 0 0 2px var(--border-muted, var(--border));
}

#panel-foreman-timesheet .foreman-ts__table thead th.foreman-ts__day-col_today:hover,
#panel-object-manager-timesheet .foreman-ts__table thead th.foreman-ts__day-col_today:hover {
  background-color: color-mix(in srgb, var(--surface-hover) 55%, var(--accent-muted) 45%);
  box-shadow:
    inset 2px 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent),
    inset -2px 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent),
    inset 0 0 0 2px color-mix(in srgb, var(--accent) 28%, var(--border-muted, var(--border)));
}

#panel-foreman-timesheet .foreman-ts__table thead th.foreman-ts__day-col_future:hover,
#panel-object-manager-timesheet .foreman-ts__table thead th.foreman-ts__day-col_future:hover {
  background-color: transparent;
  box-shadow: none;
}

.foreman-ts__table_month .foreman-ts__th-date {
  font-size: 0.62rem;
  letter-spacing: -0.02em;
}

.foreman-ts__table_month .foreman-ts__th-dow {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Липкая колонка ФИО и итог — при горизонтальном скролле месяца */
.foreman-ts__table-scroll_month .foreman-ts__table_month thead th.foreman-ts__th-name,
.foreman-ts__table-scroll_month .foreman-ts__table_month tbody td.foreman-ts__td-name {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 14rem;
  min-width: 14rem;
  max-width: 14rem;
  box-sizing: border-box;
  background: var(--surface-elevated);
  box-shadow: var(--foreman-ts-sticky-col-shadow);
}

.foreman-ts__table-scroll_month .foreman-ts__table_month thead th.foreman-ts__th-name {
  z-index: 2;
}

.foreman-ts__table-scroll_month .foreman-ts__table_month thead th.foreman-ts__th-total:last-child,
.foreman-ts__table-scroll_month .foreman-ts__table_month tbody td.foreman-ts__td-total:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  width: 3.75rem;
  min-width: 3.75rem;
  max-width: 3.75rem;
  box-sizing: border-box;
  box-shadow: var(--foreman-ts-sticky-col-shadow-end);
}

.foreman-ts__table-scroll_month .foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td.foreman-ts__td-name,
.foreman-ts__table-scroll_month .foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td.foreman-ts__td-brigade-sum-gap,
.foreman-ts__table-scroll_month .foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td.foreman-ts__td-total {
  background: var(--surface-subtle, var(--surface));
}

.foreman-ts__tr-brigade-sum_month .foreman-ts__td-brigade-sum-label {
  text-align: center;
  vertical-align: middle;
}

/* Подпись «Итого бригады» — иерархия как у ФИО: заголовок + вторая строка */
.foreman-ts__sum-stack {
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  min-width: 0;
  text-align: left;
}

.foreman-ts__sum-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-muted);
  letter-spacing: normal;
}

.foreman-ts__sum-meta {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-muted);
}

.foreman-ts__table_month .foreman-ts__sum-title {
  font-size: var(--text-xs);
}

.foreman-ts__table_month .foreman-ts__sum-meta {
  font-size: 0.625rem;
}

.foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td {
  border-top: 2px solid var(--border-muted, var(--border));
}

.foreman-ts__table_month tbody tr.foreman-ts__tr-brigade-sum_month td.foreman-ts__td-brigade-sum-gap {
  padding: 2px 1px;
  min-height: 2rem;
  vertical-align: middle;
  line-height: 1.2;
}

/* Шапка «Сотрудник» вровень с узкими колонками дат — без «высокой кнопки» */
.foreman-ts__th-sort-btn_month {
  min-height: 0;
  min-width: 0;
  padding: 4px var(--space-2);
  gap: var(--space-1);
  border: none;
  background: transparent;
  align-items: flex-end;
  font-size: 0.72rem;
  line-height: 1.2;
}

.foreman-ts__th-sort-btn_month:hover {
  background: var(--surface-hover);
}

.foreman-ts__th-sort-btn_month .foreman-ts__th-sort-label {
  text-decoration: none;
}

.foreman-ts__th-sort-btn_month .foreman-ts__th-sort-ind {
  font-size: 0.65rem;
  line-height: 1;
}

.foreman-ts__table_month thead th.foreman-ts__th-name_sort {
  padding: 4px 2px 6px var(--space-2);
  vertical-align: bottom;
}

.foreman-ts__table_month thead th.foreman-ts__th-day {
  vertical-align: bottom;
  padding: 4px 1px 6px;
  line-height: 1.15;
}

.foreman-ts__table_month thead th.foreman-ts__th-day .foreman-ts__th-day-btn {
  line-height: 1.15;
}

.foreman-ts__table_month thead th.foreman-ts__th-total {
  vertical-align: bottom;
  padding: 4px 2px 6px;
  font-size: 0.68rem;
}

.foreman-ts__table_month th,
.foreman-ts__table_month td {
  padding: 3px 1px;
}

.foreman-ts__table_month .foreman-ts__td-name {
  padding: 3px var(--space-2);
}

.foreman-ts__table_month .foreman-ts__td-total {
  padding: 3px 4px;
  font-size: 0.72rem;
}

.foreman-ts__col-name {
  width: 14rem;
}

.foreman-ts__col-total {
  width: 3.75rem;
}

/* Остаток ширины таблицы поровну между 7 днями (table-layout: fixed) */

/* Табель внутри .panel: не наследовать зебру/uppercase глобальных .panel table */
#panel-foreman-timesheet.panel .foreman-ts__table,
#panel-object-manager-timesheet.panel .foreman-ts__table {
  font-size: inherit;
  background: transparent;
}

#panel-foreman-timesheet.panel .foreman-ts__table thead,
#panel-object-manager-timesheet.panel .foreman-ts__table thead {
  background: transparent;
  border-bottom: none;
}

#panel-foreman-timesheet.panel .foreman-ts__table th,
#panel-object-manager-timesheet.panel .foreman-ts__table th {
  padding: var(--space-2);
  text-align: center;
  font-size: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: inherit;
}

#panel-foreman-timesheet.panel .foreman-ts__table td,
#panel-object-manager-timesheet.panel .foreman-ts__table td {
  padding: var(--space-2);
  border-bottom: none;
  text-align: center;
}

#panel-foreman-timesheet.panel .foreman-ts__table.foreman-ts__table_month th,
#panel-foreman-timesheet.panel .foreman-ts__table.foreman-ts__table_month td,
#panel-object-manager-timesheet.panel .foreman-ts__table.foreman-ts__table_month th,
#panel-object-manager-timesheet.panel .foreman-ts__table.foreman-ts__table_month td {
  padding: 2px 1px;
}

#panel-foreman-timesheet.panel .foreman-ts__table tbody tr:nth-child(odd),
#panel-foreman-timesheet.panel .foreman-ts__table tbody tr:nth-child(even),
#panel-object-manager-timesheet.panel .foreman-ts__table tbody tr:nth-child(odd),
#panel-object-manager-timesheet.panel .foreman-ts__table tbody tr:nth-child(even) {
  background: transparent;
}

#panel-foreman-timesheet.panel .foreman-ts__table tbody tr:hover,
#panel-object-manager-timesheet.panel .foreman-ts__table tbody tr:hover {
  background: transparent;
}

#panel-foreman-timesheet.panel .foreman-ts__th-name_sort,
#panel-object-manager-timesheet.panel .foreman-ts__th-name_sort {
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  padding: var(--space-1);
}

.foreman-ts__table th,
.foreman-ts__table td {
  border: 1px solid var(--border);
  padding: var(--space-2);
  text-align: center;
  vertical-align: middle;
}

/* Месячная сетка: общий padding у .foreman-ts__table td иначе толще col → набегающее смещение по дням */
.foreman-ts__table.foreman-ts__table_month th,
.foreman-ts__table.foreman-ts__table_month td {
  padding: 2px 1px;
}

.foreman-ts__th-name {
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
}

/* Заголовок «Сотрудник»: сортировка по ФИО как у колонки «ФИО» в реестре сотрудников */
.foreman-ts__th-name_sort {
  white-space: normal;
  padding: var(--space-1);
  vertical-align: bottom;
}

.foreman-ts__th-sort-btn {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  min-height: 44px;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.foreman-ts__th-sort-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.foreman-ts__th-sort-btn:hover .foreman-ts__th-sort-label {
  color: var(--accent-hover);
}

.foreman-ts__th-sort-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.foreman-ts__th-sort-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.foreman-ts__th-sort-ind {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
}

.foreman-ts__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.foreman-ts__th-chip .foreman-ts__th-sort-btn,
.foreman-ts__th-chip .foreman-ts__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.foreman-ts__th-chip .foreman-ts__th-sort-btn {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

.foreman-ts__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.foreman-ts__th-chip .foreman-ts__th-sort-btn:hover {
  background: transparent;
}

.foreman-ts__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  bottom: auto;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--transition);
}

.foreman-ts__th-filter::before {
  content: "";
  position: absolute;
  inset: -0.375rem;
}

.foreman-ts__th-filter:hover {
  color: var(--accent-hover);
}

.foreman-ts__th-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.foreman-ts__th-filter_active {
  color: var(--accent);
}

.foreman-ts__th-chip_filtered,
.foreman-ts__th-chip:has(.foreman-ts__th-filter_active) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.foreman-ts__th-chip_filtered .foreman-ts__th-sort-label,
.foreman-ts__th-chip:has(.foreman-ts__th-filter_active) .foreman-ts__th-sort-label {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.foreman-ts__th-chip_filtered .foreman-ts__th-filter,
.foreman-ts__th-chip:has(.foreman-ts__th-filter_active) .foreman-ts__th-filter {
  color: var(--accent);
}

.foreman-ts__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

.foreman-ts__active-filters,
.foreman-ts__section-active-filters {
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2);
}

.foreman-ts__section-active-filters {
  margin-top: calc(-1 * var(--space-1));
}

.foreman-ts__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.foreman-ts__active-filters-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
}

.foreman-ts__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.foreman-ts__filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.foreman-ts__filter-chip-detail {
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.foreman-ts__active-filters-clear-all {
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.foreman-ts__active-filters-clear-all:hover {
  text-decoration: underline;
}

.foreman-ts__td-name {
  text-align: left;
  overflow: hidden;
  max-width: 0; /* с fixed layout — колонка по col */
  vertical-align: middle;
}

.foreman-ts__td-name .employees-registry__cell-fio-stack {
  white-space: normal;
}

.foreman-ts__name-stack {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  max-width: 100%;
}

.foreman-ts__name-fio {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foreman-ts__name-position {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: var(--leading-tight);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foreman-ts__name-cell_with-actions > .foreman-ts__name-stack {
  flex: 1 1 auto;
  min-width: 0;
}

.foreman-ts__th-day {
  min-width: 0;
}

/* Кнопка в заголовке дня для массового заполнения */
.foreman-ts__th-day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: default;
  padding: 0;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.foreman-ts__th-day-btn_clickable {
  cursor: pointer;
}

.foreman-ts__th-day-btn_clickable:hover {
  background: var(--surface-hover);
}

.foreman-ts__th-day-btn:disabled {
  cursor: default;
  opacity: 0.72;
}

.foreman-ts__th-day-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.foreman-ts__th-dow {
  display: block;
  font-weight: 600;
}

.foreman-ts__th-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.foreman-ts__th-total {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-muted);
}

.foreman-ts__td-total {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: var(--surface-subtle, var(--surface));
}

.foreman-ts__tr-brigade-sum:not(.foreman-ts__tr-brigade-sum_month) .foreman-ts__th-brigade-sum,
.foreman-ts__tr-brigade-sum:not(.foreman-ts__tr-brigade-sum_month) .foreman-ts__td-total {
  border-top: 2px solid var(--border-muted, var(--border));
}

.foreman-ts__tr-brigade-sum .foreman-ts__th-brigade-sum {
  text-align: center;
  vertical-align: middle;
  padding: var(--space-2) var(--space-2);
  font-weight: 400;
  font-size: inherit;
  background: var(--surface-subtle, var(--surface));
  color: inherit;
}

/* Сумма по секции: подпись по центру под “Сотрудник”. */
.foreman-ts__tr-brigade-sum .foreman-ts__sum-stack {
  align-items: center;
  text-align: center;
}

.foreman-ts__cell {
  width: 100%;
  border: none;
  background: transparent;
  cursor: default;
  font: inherit;
  color: var(--text);
}

.foreman-ts__cell_editable {
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.foreman-ts__cell_editable:hover {
  background: var(--surface-hover);
}

.foreman-ts_readonly .foreman-ts__cell_editable {
  cursor: not-allowed;
}

.foreman-ts_readonly .foreman-ts__th-day-btn_clickable {
  cursor: not-allowed;
}

/* Будущие дни: только просмотр, запись на сервере тоже запрещена */
.foreman-ts__cell_future {
  cursor: not-allowed;
  color: var(--text-muted);
  opacity: 0.72;
}

/* Даты вне интервала назначения сотрудника прорабу */
.foreman-ts__cell_roster_outside {
  cursor: not-allowed;
  color: var(--text-muted);
  opacity: 0.55;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    color-mix(in srgb, var(--text-muted) 8%, transparent) 3px,
    color-mix(in srgb, var(--text-muted) 8%, transparent) 6px
  );
}

.foreman-ts__popover {
  z-index: var(--z-popover, 300);
  min-width: 15.5rem;
  max-width: min(18.5rem, calc(100vw - 16px));
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--text) 8%);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 12px 40px color-mix(in srgb, #000 22%, transparent);
  overflow: visible;
  transform-origin: top center;
}

@media (prefers-reduced-motion: no-preference) {
  .foreman-ts__popover {
    animation: foreman-ts-popover-in 0.14s ease-out;
  }
}

@keyframes foreman-ts-popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.foreman-ts__popover-inner {
  padding: var(--space-3);
}

.foreman-ts__popover-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.foreman-ts__popover-list {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-1);
}

.foreman-ts__popover-list li {
  margin: 0;
  min-width: 0;
}

.foreman-ts__popover-btn {
  width: 100%;
  text-align: center;
  padding: var(--space-2) var(--space-1);
  margin: 0;
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
  line-height: 1.25;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.foreman-ts__popover-btn:hover {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.foreman-ts__popover-btn:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 1px;
}

.foreman-ts__popover-hours {
  margin: 0 0 var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.foreman-ts__popover-hours-label {
  display: block;
  margin: 0 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.foreman-ts__popover-hours-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.foreman-ts__popover-hours-input {
  flex: 1;
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.foreman-ts__popover-hours-input:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 1px;
}

.foreman-ts__popover-hours-apply {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.foreman-ts__popover-hours-apply:hover {
  background: var(--surface-hover);
}

.foreman-ts__popover-hours-apply:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 1px;
}

.foreman-ts__popover-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.foreman-ts__popover-catalog {
  display: block;
  width: 100%;
  padding: var(--space-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--link, var(--accent));
  font: inherit;
  font-size: var(--text-sm);
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.foreman-ts__popover-catalog:hover {
  color: var(--link-hover, var(--accent));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.foreman-ts__popover-catalog:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 1px;
}

.foreman-ts__popover-clear {
  width: 100%;
  padding: var(--space-2);
  font-size: var(--text-sm);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
  color: var(--danger);
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.foreman-ts__popover-clear:hover {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
}

.foreman-ts__popover-clear:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 1px;
}

.foreman-ts__popover-delete {
  width: 100%;
  padding: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.foreman-ts__popover-delete:hover {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
  border-color: var(--danger);
}

.foreman-ts__popover-delete:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 1px;
}

.foreman-ts__fatal {
  padding: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  background: color-mix(in srgb, var(--danger) 6%, var(--surface-elevated));
}

.foreman-ts__fatal-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--danger);
}

.foreman-ts__fatal-msg {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
}

.foreman-ts__fatal-details,
.panel-load-error__details,
.directors-board__fatal-details {
  margin: 0 0 var(--space-3);
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  padding-top: var(--space-2);
}

.foreman-ts__fatal-details-summary,
.panel-load-error__details-summary,
.directors-board__fatal-details-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.foreman-ts__fatal-technical,
.panel-load-error__technical,
.directors-board__fatal-technical {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  max-height: 12rem;
  overflow: auto;
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
}

.directors-board__fatal-title,
.panel-load-error__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--danger);
}

.panel-load-error {
  padding: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  background: color-mix(in srgb, var(--danger) 6%, var(--surface-elevated));
}

.panel-load-error__message {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
}

.foreman-ts__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.foreman-ts-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.foreman-ts-dialog {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: min(720px, 96vw);
  max-height: min(90vh, 720px);
  overflow: hidden;
  /* display не задаём здесь: у закрытого <dialog> должен остаться UA display:none */
  background: var(--surface-elevated);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 24px 48px -16px rgba(0, 0, 0, 0.5);
}

.foreman-ts-dialog[open] {
  display: flex;
  flex-direction: column;
  margin: auto;
}

.foreman-ts-dialog-inner {
  padding: var(--space-4);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.foreman-ts-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.foreman-ts-dialog-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.foreman-ts-dialog-head h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
}

.foreman-ts-dialog-subtitle {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.foreman-ts-dialog-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition:
    background var(--transition),
    color var(--transition);
}

.foreman-ts-dialog-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.foreman-ts-dialog-close:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: 2px;
}

.foreman-ts-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(40vh, 320px);
  overflow: auto;
  margin-bottom: var(--space-3);
}

.foreman-ts-dialog-body_catalog {
  max-height: min(52vh, 420px);
  margin-bottom: var(--space-3);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.foreman-ts-node-dialog-body {
  max-height: min(60vh, 440px);
}

.foreman-ts-node-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
}

.foreman-ts-node-dl dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.foreman-ts-node-dl dd {
  margin: 0;
  word-break: break-word;
}

.foreman-ts-node-code {
  font-size: 0.8rem;
}

.foreman-ts-node-brigades-title {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.foreman-ts-node-brigades {
  margin: 0;
  padding-left: var(--space-4);
  font-size: var(--text-sm);
}

.foreman-ts-node-brigades-meta {
  color: var(--text-muted);
}

.foreman-ts__catalog-scroll {
  max-height: min(52vh, 420px);
  overflow: auto;
}

.foreman-ts__catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}

.foreman-ts__catalog-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
}

.foreman-ts__catalog-table thead th:nth-child(1) {
  width: 4.5rem;
}

.foreman-ts__catalog-table thead th:nth-child(3) {
  width: 7.5rem;
}

.foreman-ts__catalog-table tbody td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
  border-bottom: 1px solid var(--border-muted, var(--border));
  text-align: left;
}

.foreman-ts__catalog-table tbody tr:last-child td {
  border-bottom: none;
}

.foreman-ts__catalog-row {
  cursor: pointer;
  transition: background var(--transition);
}

.foreman-ts__catalog-row:hover {
  background: var(--surface-hover);
}

.foreman-ts__catalog-row:focus-visible {
  outline: 2px solid var(--focus-ring, var(--accent));
  outline-offset: -2px;
}

.foreman-ts__catalog-row_selected {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.foreman-ts__catalog-row_selected:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.foreman-ts__catalog-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-subtle, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  font-weight: 700;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text);
}

.foreman-ts__catalog-code_muted {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--surface-subtle, var(--surface));
}

.foreman-ts__catalog-title {
  display: block;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

.foreman-ts__catalog-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.foreman-ts__catalog-kind {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.foreman-ts__catalog-kind_hours {
  color: color-mix(in srgb, var(--accent) 85%, var(--text));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.foreman-ts__catalog-kind_absence {
  color: color-mix(in srgb, var(--warning, #b45309) 90%, var(--text));
  background: color-mix(in srgb, var(--warning, #f59e0b) 14%, transparent);
}

.foreman-ts__catalog-empty {
  margin: 0;
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.foreman-ts-catalog-apply {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-subtle, var(--surface)));
}

.foreman-ts-catalog-apply__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.foreman-ts-dialog-form {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  margin: 0;
}

.foreman-ts-dialog-form label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.foreman-ts-dialog-form select,
.foreman-ts-dialog-form input[type='text'] {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.foreman-ts-dialog-form select:focus-visible,
.foreman-ts-dialog-form input[type='text']:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.foreman-ts-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-muted, var(--border));
}

.foreman-ts-dialog_catalog .foreman-ts-dialog-inner {
  gap: 0;
}

/* Загрузка: каркас + подпись (не голый спиннер) */
.foreman-ts__loading-zone {
  padding: var(--space-4);
  max-width: 36rem;
}

.foreman-ts__loading-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.foreman-ts__loading-pill {
  display: inline-block;
  width: 4.5rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--surface-hover);
}

.foreman-ts__loading-bar {
  display: inline-block;
  height: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}

.foreman-ts__loading-bar_short {
  width: 6rem;
}

.foreman-ts__loading-bar_nav {
  flex: 1 1 8rem;
  min-width: 6rem;
  max-width: 14rem;
}

.foreman-ts__loading-skel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.foreman-ts__loading-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.foreman-ts__loading-cell {
  flex: 0 0 2.5rem;
  min-height: 2rem;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}

.foreman-ts__loading-cell_wide {
  flex: 1 1 10rem;
}

@keyframes foreman-ts-skel-pulse {
  50% {
    opacity: 0.72;
  }
}

.foreman-ts__loading-pill,
.foreman-ts__loading-bar,
.foreman-ts__loading-cell {
  animation: foreman-ts-skel-pulse 1.35s ease-in-out infinite;
}

.foreman-ts__loading-caption {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .foreman-ts__loading-pill,
  .foreman-ts__loading-bar,
  .foreman-ts__loading-cell {
    animation: none;
  }
}

/* Пустые состояния основной зоны и бригады */
.foreman-ts__empty-state {
  padding: var(--space-5);
  max-width: 32rem;
}

.foreman-ts__empty-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__empty-text {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

.foreman-ts__brigade-empty {
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  border: 1px dashed var(--border-muted, var(--border));
  background: var(--surface-subtle, var(--surface));
}

.foreman-ts__brigade-empty-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__brigade-empty-text {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .foreman-ts__layout {
    flex-direction: column;
    gap: var(--space-3);
  }

  .foreman-ts__layout > .foreman-ts__aside {
    flex: 0 1 auto;
    width: 100%;
    max-width: none;
  }

  .foreman-ts__layout > .foreman-ts__pane {
    flex: 1 1 auto;
    width: 100%;
  }

  .foreman-ts__layout-split {
    display: none;
  }

  #panel-foreman-timesheet .foreman-ts__aside,
  #panel-object-manager-timesheet .foreman-ts__aside {
    position: relative;
    top: auto;
    max-height: min(40vh, 20rem);
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  #panel-foreman-timesheet .foreman-ts__layout_nodes-collapsed .foreman-ts__aside,
  #panel-object-manager-timesheet .foreman-ts__layout_nodes-collapsed .foreman-ts__aside {
    max-height: none;
  }

  /* Недельная сетка: липкая колонка ФИО при горизонтальном скролле (месяц — отдельно ниже). */
  #panel-foreman-timesheet .foreman-ts__table-scroll:not(.foreman-ts__table-scroll_month) .foreman-ts__table thead th.foreman-ts__th-name,
  #panel-object-manager-timesheet .foreman-ts__table-scroll:not(.foreman-ts__table-scroll_month) .foreman-ts__table thead th.foreman-ts__th-name,
  #panel-foreman-timesheet .foreman-ts__table-scroll:not(.foreman-ts__table-scroll_month) .foreman-ts__table tbody td.foreman-ts__td-name,
  #panel-object-manager-timesheet .foreman-ts__table-scroll:not(.foreman-ts__table-scroll_month) .foreman-ts__table tbody td.foreman-ts__td-name {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface-elevated);
    box-shadow: var(--foreman-ts-sticky-col-shadow);
  }

  #panel-foreman-timesheet .foreman-ts__table-scroll:not(.foreman-ts__table-scroll_month) .foreman-ts__table thead th.foreman-ts__th-name,
  #panel-object-manager-timesheet .foreman-ts__table-scroll:not(.foreman-ts__table-scroll_month) .foreman-ts__table thead th.foreman-ts__th-name {
    z-index: 2;
  }
}

@media (max-width: 768px) {
  .foreman-ts__period-btn {
    min-width: var(--field-height, 2.75rem);
    min-height: var(--field-height, 2.75rem);
    height: var(--field-height, 2.75rem);
  }

  .foreman-ts__period-date {
    padding: var(--space-1) var(--space-2);
    min-height: var(--field-height, 2.75rem);
  }

  .foreman-ts__search-nav-btn {
    width: var(--field-height, 2.75rem);
    min-width: var(--field-height, 2.75rem);
    height: var(--field-height, 2.75rem);
  }
}

/* ===== Личный кабинет (панель #panel-profile) ===== */

.profile-panel__intro {
  margin-bottom: var(--space-4);
}

.profile-panel__title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xl);
  font-weight: 600;
}

.profile-panel__lead {
  margin: 0;
  max-width: 42rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--bg-elevated) 88%, var(--accent)) 0%,
    var(--bg-elevated) 55%
  );
}

.profile-hero__avatar {
  width: 4rem;
  height: 4rem;
  font-size: var(--text-xl);
}

.profile-hero__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  flex: 1;
}

.profile-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.profile-hero__role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
}

.profile-hero__stat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.profile-hero__stat_unread {
  color: var(--accent);
  font-weight: 600;
}

.profile-hero__stat_muted {
  color: var(--text-subtle);
}

.profile-hero__fired {
  color: var(--err);
}

.profile-hero__name {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-tight);
  word-break: break-word;
}

.profile-hero__login {
  margin: 0;
  color: var(--text-muted);
}

.profile-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.profile-tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
}

.profile-tabs__btn[hidden] {
  display: none !important;
}

.profile-tabs__btn:disabled,
.profile-tabs__btn[aria-disabled="true"] {
  display: none !important;
}

.profile-tabs__btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.profile-tabs__btn.is-active {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.profile-tabs__icon {
  display: flex;
  opacity: 0.85;
}

.profile-tabs__badge {
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 99px;
  background: var(--error, #e53935);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25rem;
  text-align: center;
}

.profile-tabpanel.hidden {
  display: none;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  gap: var(--space-4);
  align-items: start;
}

.profile-layout__main,
.profile-layout__aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.profile-section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
}

.profile-section-card__head {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border-muted);
}

.profile-section-card__head_row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.profile-section-card__title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
}

.profile-section-card__hint {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.profile-section-card__body {
  padding: var(--space-4);
}

.profile-security-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.profile-name-form {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  gap: var(--space-3);
  align-items: end;
}

.profile-name-form__field {
  margin: 0;
}

.profile-name-form .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  min-width: 0;
}

.profile-name-form .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.profile-name-form .form-field input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-name-form .form-field input::placeholder {
  color: var(--text-subtle);
}

.profile-name-form .form-field input:hover {
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
}

.profile-name-form .form-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.profile-name-form .profile-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-panel .btn-primary,
#panel-profile .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.profile-panel .btn-primary:hover,
#panel-profile .btn-primary:hover {
  background: var(--accent-hover);
}

.profile-panel .btn-primary:active,
#panel-profile .btn-primary:active {
  transform: scale(0.98);
}

.profile-panel .btn-primary:focus-visible,
#panel-profile .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-panel .btn-secondary,
#panel-profile .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.profile-panel .btn-secondary:hover,
#panel-profile .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.profile-panel .btn-secondary:focus-visible,
#panel-profile .btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-3);
}

.profile-info-grid__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.profile-info-grid__item_muted .profile-info-grid__value {
  color: var(--text-muted);
}

.profile-info-grid__item_action {
  grid-column: 1 / -1;
  padding: 0;
  border: none;
  background: transparent;
}

.profile-info-grid__label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.profile-info-grid__value {
  font-size: var(--text-sm);
  color: var(--text);
  word-break: break-word;
}

.profile-account-fired {
  color: var(--err);
  font-weight: 600;
}

.profile-totp-status__state {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.profile-totp-status__badge {
  flex-shrink: 0;
  padding: 2px var(--space-2);
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  color: var(--text-muted);
}

.profile-totp-status__badge_on {
  background: color-mix(in srgb, var(--success, #2e7d32) 22%, transparent);
  color: var(--success, #81c784);
}

.profile-totp-status__text {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
}

.profile-totp-status__recovery {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  line-height: 1.45;
}

.profile-passkey-status__row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.profile-passkey-status__row.hidden {
  display: none;
}

.profile-passkey-status__badge {
  flex-shrink: 0;
  padding: 2px var(--space-2);
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  color: var(--text-muted);
}

.profile-passkey-status__badge_on {
  background: color-mix(in srgb, var(--success, #2e7d32) 22%, transparent);
  color: var(--success, #81c784);
}

.profile-passkey-status__badge_off {
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  color: var(--text-muted);
}

.profile-passkey-status__badge_pending {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  color: var(--text-subtle);
}

.profile-passkey-status__text {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
}

.profile-passkey-status__action {
  width: 100%;
  max-width: 16rem;
}

.profile-passkey-status__error {
  margin: var(--space-2) 0 0;
}

.profile-passkey-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-passkey-list.hidden {
  display: none;
}

.profile-passkey-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.profile-passkey-list__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 12rem;
}

.profile-passkey-list__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.profile-passkey-list__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.profile-passkey-list__revoke {
  flex-shrink: 0;
}

.profile-totp-status__action {
  width: 100%;
  max-width: 16rem;
}

.profile-totp-status__link {
  margin: var(--space-3) 0 0;
}

.profile-notifications-card .profile-section-card__body {
  padding-top: 0;
}

.profile-notifications-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.profile-segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.profile-segmented__item {
  position: relative;
  cursor: pointer;
}

.profile-segmented__item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.profile-segmented__item span {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-3);
  border-radius: calc(var(--radius-md) - 2px);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.profile-segmented__item input:checked + span {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.profile-segmented__item input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.profile-notifications-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.profile-notifications-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.profile-notifications-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  min-height: 8rem;
}

.profile-notifications-list__loading {
  padding: var(--space-5);
  text-align: center;
}

.profile-notification {
  position: relative;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.profile-notification:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--bg-elevated);
}

.profile-notification:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-notification_read {
  opacity: 0.78;
}

.profile-notification__unread {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}

.profile-notification__content {
  flex: 1;
  min-width: 0;
}

.profile-notification__head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.profile-notification__kind {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-notification__title {
  margin: var(--space-2) 0 0;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.35;
}

.profile-notification__body {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.profile-notification_sev-warning {
  border-color: color-mix(in srgb, var(--warn, #e6a700) 45%, var(--border));
  background: color-mix(in srgb, var(--warn-muted, rgba(234, 179, 8, 0.12)) 55%, var(--surface));
}

.profile-notification_sev-critical {
  border-color: color-mix(in srgb, var(--error, #e53935) 45%, var(--border));
  background: color-mix(in srgb, var(--err-muted, rgba(239, 68, 68, 0.12)) 55%, var(--surface));
}

.profile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.profile-empty__icon {
  margin-bottom: var(--space-3);
  color: var(--text-subtle);
  opacity: 0.65;
}

.profile-empty__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
}

.profile-empty__text {
  margin: 0;
  max-width: 22rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

.profile-report-wrap {
  padding: var(--space-4);
}

@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-name-form {
    grid-template-columns: 1fr;
  }

  .profile-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .profile-tabs::-webkit-scrollbar {
    display: none;
  }

  .profile-tabs__btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: var(--space-2) var(--space-3);
  }

  .profile-tabs__label {
    display: inline;
  }
}

@media (max-width: 640px) {
  .content:has(#panel-profile:not(.hidden)) {
    padding: var(--space-3);
  }

  #panel-profile .profile-panel__lead {
    display: none;
  }

  #panel-profile .profile-section-card__head,
  #panel-profile .profile-section-card__body,
  #panel-profile .profile-notifications-toolbar,
  #panel-profile .profile-notifications-list {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  #panel-profile .profile-display-prefs {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  #panel-profile .profile-nav-settings-item__label {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    min-height: 2.75rem;
  }

  #panel-profile .profile-nav-settings-item__grip {
    width: 2.5rem;
  }

  #panel-profile .profile-nav-settings-toolbar__actions {
    width: 100%;
  }

  #panel-profile .profile-nav-settings-toolbar__actions .btn-primary,
  #panel-profile .profile-nav-settings-toolbar__actions .btn-secondary {
    flex: 1 1 auto;
    min-width: 0;
  }

  #panel-profile .profile-nav-settings-toolbar {
    margin-left: 0;
    margin-right: 0;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  }

  #profile-timesheet-day-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--space-3));
    padding: 0 var(--space-3);
  }

  #profile-report .profile-gantt-compact-head,
  #profile-report .profile-gantt-compact-row {
    min-width: 18rem;
  }

  #profile-report .profile-month-day-num,
  #profile-report .profile-month-day-hours {
    font-size: var(--text-xs);
  }

  .profile-notification__head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .profile-notification__time {
    font-size: var(--text-xs);
  }

  .profile-segmented {
    display: flex;
    width: 100%;
  }

  .profile-segmented__item {
    flex: 1 1 0;
  }

  .profile-segmented__item span {
    width: 100%;
    justify-content: center;
  }
}

.header-user-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.header button.header-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.header button.header-icon-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--text);
}

.header button.header-icon-btn.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.header-notifications-btn {
  position: relative;
}

.header-notifications-badge {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(25%, -25%);
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--error, #e53935);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25rem;
  text-align: center;
}

.mono-path {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ===== Визард настройки 2FA (TOTP) ===== */

/* Триггер в карточке пользователя */
.form-field_totp-wizard-trigger {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.totp-wizard-trigger__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.totp-wizard-trigger__btn_danger {
  color: var(--color-danger, #e53e3e);
  border-color: var(--color-danger, #e53e3e);
}

.totp-wizard-trigger__btn_danger:hover {
  background: var(--color-danger, #e53e3e);
  color: #fff;
}

/* Диалог визарда */
.dialog-totp-wizard {
  border: none;
  border-radius: var(--radius-lg, 12px);
  padding: 0;
  max-width: 520px;
  width: 94vw;
  background: var(--bg-card, #1a1d23);
  color: var(--text-primary, #e2e8f0);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dialog-totp-wizard::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-totp-wizard__inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.dialog-totp-wizard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle, #2d3748);
}

.dialog-totp-wizard__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

.dialog-totp-wizard__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted, #a0aec0);
  padding: 0 var(--space-1);
  line-height: 1;
}

.dialog-totp-wizard__close:hover {
  color: var(--text-primary, #e2e8f0);
}

/* Индикатор шагов */
.totp-wizard__steps {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-subtle, #0c0e12);
  border-bottom: 1px solid var(--border-subtle, #2d3748);
}

.totp-wizard__step {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-md, 6px);
  font-size: var(--text-xs);
  color: var(--text-muted, #718096);
  transition: all 0.2s;
}

.totp-wizard__step_active {
  color: var(--text-primary, #e2e8f0);
  background: var(--bg-card, #1a1d23);
}

.totp-wizard__step_done {
  color: var(--color-success, #48bb78);
}

.totp-wizard__step_done .totp-wizard__step-num {
  background: var(--color-success, #48bb78);
  color: #fff;
}

.totp-wizard__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--border-subtle, #2d3748);
  font-size: var(--text-xs);
  font-weight: 600;
  flex-shrink: 0;
}

.totp-wizard__step_active .totp-wizard__step-num {
  background: var(--color-primary, #4299e1);
  color: #fff;
}

.totp-wizard__step-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Тело шага */
.totp-wizard__body {
  padding: var(--space-5);
  overflow-y: auto;
}

.totp-wizard__body-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 600;
}

.totp-wizard__body-subtitle {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-md);
  font-weight: 600;
}

.totp-wizard__text {
  margin: 0 0 var(--space-3);
  line-height: 1.6;
}

.totp-wizard__list {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-5);
  line-height: 1.8;
}

.totp-wizard__list ul {
  margin: var(--space-1) 0;
  padding-left: var(--space-4);
}

.totp-wizard__warn {
  margin: var(--space-3) 0;
  padding: var(--space-3) var(--space-4);
  background: rgba(237, 137, 54, 0.1);
  border: 1px solid var(--color-warning, #ed8936);
  border-radius: var(--radius-sm, 4px);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* QR-код */
.totp-wizard__qr-wrap {
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0;
}

.totp-wizard__qr {
  background: #fff;
  padding: var(--space-3);
  border-radius: var(--radius-md, 6px);
  display: inline-block;
}

.totp-wizard__qr img,
.totp-wizard__qr canvas {
  display: block;
}

/* Ручной ввод секрета */
.totp-wizard__manual-entry {
  margin: var(--space-3) 0 0;
}

.totp-wizard__manual-entry summary {
  cursor: pointer;
  color: var(--color-primary, #4299e1);
  font-size: var(--text-sm);
}

.totp-wizard__secret-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.totp-wizard__secret {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-subtle, #0c0e12);
  border: 1px solid var(--border-subtle, #2d3748);
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  word-break: break-all;
}

.totp-wizard__copy-btn {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-3);
}

/* Поле ввода кода */
.totp-wizard__verify-field {
  margin: var(--space-3) 0;
}

.totp-wizard__code-input {
  width: 200px;
  padding: var(--space-3);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5em;
  font-family: var(--font-mono);
  border: 2px solid var(--border-subtle, #2d3748);
  border-radius: var(--radius-md, 6px);
  background: var(--bg-subtle, #0c0e12);
  color: var(--text-primary, #e2e8f0);
}

.totp-wizard__code-input:focus {
  border-color: var(--color-primary, #4299e1);
  outline: none;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
}

.totp-wizard__error {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
}

/* Советы после успешной настройки */
.totp-wizard__success-tips {
  margin: var(--space-3) 0;
}

/* Подвал визарда */
.dialog-totp-wizard__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle, #2d3748);
}

.totp-wizard__btn {
  min-width: 120px;
}

.totp-wizard__btn_back {
  margin-right: auto;
}

/* Профиль: статус TOTP */
.profile-totp-status {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ============================================
   COMMAND PALETTE (Cmd+K) - 2026
   ============================================ */

.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-command-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: overlay-fade-in 0.2s ease-out;
}

@keyframes overlay-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.command-palette {
  width: min(90vw, 32rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: palette-appear 0.2s ease-out;
}

@keyframes palette-appear {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.command-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.command-palette-input-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.command-palette-input {
  flex: 1;
  font-size: var(--text-base);
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.command-palette-input::placeholder {
  color: var(--text-subtle);
}

.command-palette-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.command-palette-group-title {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.command-palette-group-title:first-child {
  margin-top: 0;
}

.command-palette-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
  transition: background var(--transition);
}

.command-palette-item:hover,
.command-palette-item--active {
  background: var(--accent-muted);
}

.command-palette-item-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.command-palette-item-content {
  flex: 1;
  min-width: 0;
}

.command-palette-item-title {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.3;
  font-weight: 500;
}

.command-palette-breadcrumbs {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  margin-top: 2px;
  line-height: 1.3;
}

.command-palette-empty {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Responsive */
@media (max-width: 768px) {
  .command-palette-overlay {
    padding-top: 10vh;
  }
  
  .command-palette {
    width: 95vw;
  }
  
  /* Docflow responsive */
  .docflow-layout {
    grid-template-columns: 1fr;
  }
  
  .docflow-tree-panel {
    position: relative;
    top: 0;
    max-height: 50vh;
  }
  
  /* Login page responsive */
  .login-brand-side {
    padding: var(--space-6);
  }
  
  .login-brand__title {
    font-size: 2.25rem;
  }
}

/* Inline создание учётки в карточке сотрудника */
.employee-create-user-inline {
  margin-top: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated, var(--surface));
}

.employee-create-user-inline.hidden {
  display: none;
}

.employee-create-user-inline__title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-base);
  font-weight: 600;
}

.employee-create-user-inline__steps {
  margin-bottom: var(--space-5);
}

.employee-create-user-inline__panel.hidden {
  display: none;
}

.employee-create-user-inline__hint {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.employee-create-user-inline__login-preview {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
}

.employee-create-user-inline__success {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
}

.employee-create-user-inline__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.employee-create-user-inline__actions .btn-primary,
.employee-create-user-inline__actions .btn-secondary {
  flex: 1 1 auto;
  min-width: 8rem;
}

/* Матрица прав модулей v2 (pm-matrix) */
.admin-legacy-banner {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-elevated, var(--surface));
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pm-matrix {
  --pm-control-height: 40px;
  --pm-control-radius: var(--radius-md);
  --pm-sticky-header-z: 12;
  --pm-sticky-corner-z: 14;

  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
}

.pm-matrix__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pm-matrix__toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.pm-matrix__toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--pm-control-height);
  min-width: var(--pm-control-height);
  height: var(--pm-control-height);
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--pm-control-radius);
  flex-shrink: 0;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.pm-matrix__toolbar-icon-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.pm-matrix__toolbar-icon-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .pm-matrix__toolbar {
    flex-wrap: wrap;
  }
}

.pm-matrix__toolbar-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.pm-matrix__control {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: var(--pm-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--pm-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.pm-matrix__control::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.pm-matrix__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* Панель сохранения — под таблицей, не перекрывается стикером «Действую от лица» */
.pm-save-dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  box-shadow: 0 -4px 16px color-mix(in srgb, var(--bg) 55%, transparent);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

#panel-admin.hidden .pm-save-dock,
#admin-sub-module-permissions.hidden .pm-save-dock {
  display: none;
}

.pm-save-dock[hidden] {
  display: none !important;
}

.pm-matrix--readonly .pm-matrix__cell-check input,
.pm-matrix--readonly .pm-matrix__bulk-input {
  cursor: not-allowed;
  opacity: 0.72;
}

.pm-matrix--readonly .pm-matrix__role-col-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.pm-matrix__th-role--locked,
.pm-matrix__cell-role--locked {
  background: color-mix(in srgb, var(--surface-elevated) 92%, var(--text-muted));
}

.pm-matrix__cell-role--locked .pm-matrix__cell-check input {
  cursor: not-allowed;
  opacity: 0.72;
}

.pm-save-dock--readonly .pm-save-dock__btn {
  display: none !important;
}

.pm-save-dock__btn[hidden] {
  display: none !important;
}

.pm-save-dock__hint {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-save-dock__hint--dirty {
  color: var(--accent);
  font-weight: 600;
}

.pm-save-dock--dirty {
  border-color: var(--accent);
  box-shadow: 0 -4px 20px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 0 1px var(--accent-muted);
}

.pm-save-dock__status {
  font-size: var(--text-xs);
  white-space: nowrap;
}

.pm-save-dock__status--success {
  color: var(--success);
}

.pm-save-dock__status--error {
  color: var(--err);
}

.pm-save-dock__btn {
  flex-shrink: 0;
  min-height: 2.25rem;
  padding: 0 var(--space-4);
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.pm-save-dock__btn--dirty {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pm-save-dock__btn--dirty:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.pm-matrix__corner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.pm-matrix__corner-title {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.2;
}

.pm-matrix__th-corner .pm-matrix__tree-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.pm-matrix__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  min-width: 1.65rem;
  padding: 0;
  line-height: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.pm-matrix__icon-btn-glyph {
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
}

.pm-matrix__icon-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.pm-matrix__icon-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.pm-matrix__frame {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

/* Строка ролей — вне прокрутки tbody, не уезжает под шапку приложения */
.pm-matrix__roles-head {
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
  scrollbar-width: none;
}

.pm-matrix__roles-head::-webkit-scrollbar {
  display: none;
}

.pm-matrix__scroll {
  flex: 1 1 auto;
  min-height: 14rem;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  scroll-behavior: auto;
}

.pm-matrix__table,
.pm-matrix__table--head,
.pm-matrix__table--body {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-xs);
  line-height: 1.25;
}

.pm-matrix__col-label {
  width: 13rem;
}

.pm-matrix__col-role {
  width: 2.65rem;
}

.pm-matrix__th-corner {
  position: relative;
  left: auto;
  top: auto;
  z-index: 1;
  background: var(--surface-elevated);
  text-align: left;
  vertical-align: bottom;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-width: 10.5rem;
  max-width: 14rem;
  font-size: var(--text-xs);
  font-weight: 600;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.18);
}

.pm-matrix__cell-label {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  text-align: left;
  vertical-align: middle;
  padding: 0.2rem var(--space-2);
  border-bottom: 1px solid var(--border-muted);
  border-right: 1px solid var(--border);
  min-width: 10.5rem;
  max-width: 14rem;
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.1);
}

.pm-matrix__roles-head .pm-matrix__th-role {
  position: relative;
  top: auto;
  z-index: 1;
  isolation: isolate;
  padding: 0;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border-muted);
  background: var(--surface-elevated);
  color: var(--pm-role-color, inherit);
  vertical-align: bottom;
  min-width: 4.5rem;
  max-width: 7rem;
  box-shadow: 0 1px 0 var(--border), 0 4px 8px color-mix(in srgb, var(--bg) 35%, transparent);
}

.pm-matrix__th-role::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface-elevated);
  z-index: -1;
}

.pm-matrix__role-col-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-top: 2px solid var(--pm-role-accent, var(--border));
  background: var(--surface-elevated);
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: var(--text-xs);
}

.pm-matrix__role-label {
  display: block;
  max-width: 6.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
}

/* На широкой панели — узкие колонки ролей (вертикальные подписи) */
.pm-matrix--wide .pm-matrix__th-role {
  min-width: 2.35rem;
  max-width: 2.75rem;
}

.pm-matrix--wide .pm-matrix__role-label {
  display: inline-block;
  max-width: 6.5rem;
  max-height: 7.5rem;
  font-size: 0.6875rem;
  line-height: 1.1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-matrix--wide .pm-matrix__role-col-btn {
  min-height: 7.75rem;
  padding: var(--space-1) 0.15rem;
}

.pm-matrix--wide .pm-matrix__th-corner,
.pm-matrix--wide .pm-matrix__cell-label {
  min-width: 12rem;
  max-width: 16rem;
}

.pm-matrix__role-col-btn:hover,
.pm-matrix__role-col-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pm-matrix__row--group .pm-matrix__cell-label {
  position: sticky;
  left: 0;
  z-index: 5;
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  background: var(--surface-elevated);
  border-bottom-color: var(--border);
}

.pm-matrix__row--module .pm-matrix__cell-label {
  font-weight: 500;
  font-size: var(--text-xs);
}

.pm-matrix__cell-label--op {
  padding-left: calc(var(--space-2) + 0.85rem);
  font-weight: 400;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.pm-matrix__row--op:hover .pm-matrix__cell-label--op,
.pm-matrix__row--op:hover .pm-matrix__cell-role {
  background: var(--surface-hover);
}

.pm-matrix__toggle-icon {
  display: inline-block;
  width: 0.65rem;
  font-size: 0.6rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.pm-matrix__group-toggle,
.pm-matrix__module-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.pm-matrix__module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}

.pm-matrix__bulk {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.pm-matrix__cell-role {
  text-align: center;
  padding: 0.1rem;
  border-bottom: 1px solid var(--border-muted);
  border-right: 1px solid var(--border-muted);
  vertical-align: middle;
  background: var(--surface);
}

.pm-matrix__cell-fill {
  border-bottom: 1px solid var(--border);
}

.pm-matrix__cell-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  min-height: 1.35rem;
  cursor: pointer;
}

.pm-matrix__cell-check input {
  width: 0.8125rem;
  height: 0.8125rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.pm-matrix__cell-role:has(input:checked) {
  background: var(--accent-muted);
}

.pm-matrix__bulk input {
  width: 0.8125rem;
  height: 0.8125rem;
  margin: 0;
}

/* Плотный режим: больше строк в видимой области (высота задаётся flex-родителем) */
.pm-matrix--compact .pm-matrix__scroll {
  min-height: 16rem;
}

.pm-matrix__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.pm-matrix__dirty {
  font-size: var(--text-sm);
  color: var(--accent);
}

.pm-matrix__audit-launch {
  flex-shrink: 0;
  min-height: var(--pm-control-height);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.pm-matrix__audit-launch--active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Журнал — только по кнопке «Журнал», компактная полоса */
.pm-audit {
  flex-shrink: 0;
  margin-top: var(--space-1);
  max-height: 9rem;
  overflow: auto;
  font-size: var(--text-xs);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  background: var(--surface-elevated);
}

.pm-audit.hidden {
  display: none !important;
}

.pm-audit__head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.pm-audit__head-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.pm-audit__inner--compact .pm-audit__head {
  margin-bottom: 0;
}

.pm-audit__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
}

.pm-audit__close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.pm-audit__title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
}

.pm-audit__toggle {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
}

.pm-audit__table {
  width: 100%;
  border-collapse: collapse;
}

.pm-audit__table th,
.pm-audit__table td {
  padding: 0.2rem var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--border-muted);
  vertical-align: top;
}

.pm-audit__table th {
  font-weight: 600;
  color: var(--text-muted);
}

.pm-audit__tbody-more.hidden {
  display: none;
}

.pm-audit__empty,
.pm-audit__error {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pm-audit__error {
  color: var(--err);
}

/* Модалка быстрой выдачи прав */
.pm-grant-dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  color: var(--text);
  max-width: min(28rem, calc(100vw - var(--space-8)));
  width: 100%;
}

.pm-grant-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.pm-grant-dialog__inner {
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 640px);
}

.pm-grant-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-muted);
}

.pm-grant-dialog__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

.pm-grant-dialog__close {
  flex-shrink: 0;
}

.pm-grant-dialog__form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pm-grant-dialog__body {
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pm-grant-dialog__body .form-field select {
  width: 100%;
  min-height: var(--pm-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--pm-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.pm-grant-dialog__ops-fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.pm-grant-dialog__ops-legend {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  padding: 0;
}

.pm-grant-dialog__ops-toolbar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.pm-grant-dialog__ops-btn {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
}

.pm-grant-dialog__ops {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: min(40vh, 280px);
  overflow-y: auto;
  padding: var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.pm-grant-dialog__op {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0 var(--space-2);
  align-items: start;
  padding: var(--space-1) 0;
  cursor: pointer;
  font-size: var(--text-sm);
}

.pm-grant-dialog__op input {
  grid-row: 1 / span 2;
  margin-top: 0.15rem;
}

.pm-grant-dialog__op-label {
  font-weight: 500;
}

.pm-grant-dialog__op-code {
  grid-column: 2;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pm-grant-dialog__ops-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pm-grant-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-muted);
}

.docflow-index-status {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-muted, var(--surface));
}

.docflow-index-status__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.docflow-index-status__title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.docflow-index-status__value {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.docflow-index-status__reindex {
  flex-shrink: 0;
}

.docflow-doc-search {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.docflow-doc-suggestions {
  margin-bottom: var(--space-3);
}

.docflow-doc-suggestions__label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.docflow-doc-suggestions__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.docflow-doc-suggestions__chip {
  max-width: 100%;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  line-height: 1.35;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.docflow-doc-suggestions__chip:hover:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
}

.docflow-doc-suggestions__chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.docflow-doc-suggestions__chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.docflow-doc-suggestions__more {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.docflow-doc-suggestions__empty,
.docflow-doc-suggestions__loading {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.docflow-doc-search__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
}

.docflow-doc-search__bar {
  margin-bottom: var(--space-1);
}

.docflow-doc-search__hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.docflow-doc-search__hint kbd {
  font-family: inherit;
  font-size: 0.95em;
  padding: 0 0.25em;
  border: 1px solid var(--border-muted);
  border-radius: 3px;
  background: var(--bg-elevated);
}

.docflow-doc-ask {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elevated));
}

.docflow-doc-ask__meta {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.docflow-doc-ask__meta-badge {
  font-weight: 500;
  color: var(--text-secondary);
}

.docflow-doc-ask__meta-badge--cloud {
  color: var(--accent, #2563eb);
}

.docflow-doc-ask__meta-badge--local {
  color: var(--text-secondary);
}

.docflow-doc-ask__label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.docflow-doc-ask__summary {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.docflow-doc-ask__parse-warn {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.docflow-doc-ask__raw-json {
  margin: 0;
  padding: var(--space-2);
  max-height: 12rem;
  overflow: auto;
  font-size: var(--text-xs);
  line-height: 1.4;
  background: var(--bg-muted, #f4f4f5);
  border-radius: var(--radius-sm, 4px);
  white-space: pre-wrap;
  word-break: break-word;
}

.docflow-doc-ask__section {
  margin-bottom: var(--space-2);
}

.docflow-doc-ask__section:last-child {
  margin-bottom: 0;
}

.docflow-doc-ask__text {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.docflow-doc-ask__text--md .docflow-doc-ask__h {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.docflow-doc-ask__text--md .docflow-doc-ask__p {
  margin: 0 0 var(--space-2);
}

.docflow-doc-ask__text--md .docflow-doc-ask__p:last-child {
  margin-bottom: 0;
}

.docflow-doc-ask__text--md .docflow-doc-ask__list {
  margin: 0 0 var(--space-2) var(--space-4);
  padding: 0;
  list-style: disc;
}

.docflow-doc-ask__text--md .docflow-doc-ask__list li {
  margin-bottom: var(--space-1);
}

.docflow-doc-ask__text--md strong {
  font-weight: 600;
  color: var(--text);
}

.docflow-doc-ask__text .docflow-files__preview-popover__p {
  margin: 0 0 var(--space-2);
}

.docflow-doc-ask__text .docflow-files__preview-popover__p:last-child {
  margin-bottom: 0;
}

.docflow-doc-ask__sources-title {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.docflow-doc-ask__loading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.docflow-doc-ask__loading-body {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.docflow-doc-ask__progress {
  margin-top: var(--space-2);
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.docflow-doc-ask__progress-bar {
  height: 100%;
  width: 35%;
  border-radius: 2px;
  background: var(--accent);
  animation: docflowAskProgress 1.4s ease-in-out infinite;
}

@keyframes docflowAskProgress {
  0% { transform: translateX(-100%); width: 40%; }
  50% { transform: translateX(80%); width: 55%; }
  100% { transform: translateX(220%); width: 40%; }
}

.docflow-doc-ask__skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.docflow-doc-ask__skeleton-line {
  height: 0.75rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--border) 80%, transparent) 0%,
    color-mix(in srgb, var(--accent) 12%, var(--border)) 50%,
    color-mix(in srgb, var(--border) 80%, transparent) 100%
  );
  background-size: 200% 100%;
  animation: docflowAskSkeleton 1.2s ease-in-out infinite;
}

.docflow-doc-ask__skeleton-line--title {
  height: 1rem;
  width: 55%;
}

.docflow-doc-ask__skeleton-line--short {
  width: 70%;
}

@keyframes docflowAskSkeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.docflow-doc-ask__loading-spinner {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}

.docflow-doc-ask__loading-text {
  flex: 1 1 auto;
  min-width: 12rem;
}

.docflow-doc-ask__loading-dots {
  flex-shrink: 0;
  width: 1.25rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.docflow-doc-ask__error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--err);
}

.docflow-doc-search__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: var(--field-height, 2.75rem);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.docflow-doc-search__summary {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.docflow-doc-search__results-label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.docflow-doc-search__results {
  max-height: 16rem;
  overflow-y: auto;
}

.docflow-doc-search__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docflow-doc-search__hit {
  padding: 0;
  border-bottom: none;
}

.docflow-doc-search__hit-contract {
  margin: 0;
  padding: 0 var(--space-2) var(--space-1) calc(2rem + var(--space-3));
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

.docflow-doc-search__hit-snippet {
  margin: 0;
  padding: 0 var(--space-2) var(--space-2) calc(2rem + var(--space-3));
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.docflow-doc-search__hit-snippet .docflow-doc-search__hl,
.docflow-doc-search__hit-snippet mark {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: inherit;
  font-weight: 600;
  padding: 0 1px;
  border-radius: 2px;
}

.docflow-doc-search__hit-page {
  display: inline-block;
  margin-left: var(--space-2);
  font-size: 0.65rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.docflow-doc-search__empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.docflow-files {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.docflow-files__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
}

.docflow-files__empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.docflow-files__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.docflow-files__list--search {
  max-height: none;
  border: none;
  background: transparent;
}

.docflow-files__item {
  border-bottom: 1px solid var(--border-muted);
}

.docflow-files__item:last-child {
  border-bottom: none;
}

.docflow-files__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: var(--space-1) var(--space-2);
  transition: background var(--transition);
}

.docflow-files__item:hover .docflow-files__row,
.docflow-files__item:focus-within .docflow-files__row {
  background: var(--surface-hover);
}

.docflow-files__icon {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
  color: var(--text-muted);
}

.docflow-files__icon--pdf {
  background: var(--file-tint-pdf);
  color: #f87171;
}

.docflow-files__icon--doc {
  background: var(--file-tint-doc);
  color: #a5b4fc;
}

.docflow-files__icon--sheet {
  background: var(--file-tint-sheet);
  color: #4ade80;
}

.docflow-files__icon--image {
  background: var(--file-tint-image);
  color: #facc15;
}

.docflow-files__icon--archive {
  background: var(--file-tint-archive);
  color: var(--text-muted);
}

.docflow-files__icon--generic {
  background: var(--file-tint-generic);
  color: var(--text-subtle);
}

.docflow-stroke-icon {
  display: block;
  flex-shrink: 0;
  overflow: visible;
  pointer-events: none;
}

.docflow-files__type-glyph {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.72;
}

.docflow-files__ext {
  position: absolute;
  right: 1px;
  bottom: 1px;
  max-width: 1.65rem;
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: inherit;
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  border-radius: 2px;
}

.docflow-files__trailing {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.docflow-files__index-badges {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-1);
}

.docflow-files__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  cursor: help;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.docflow-files__badge:hover {
  border-color: color-mix(in srgb, var(--accent, #60a5fa) 45%, var(--border));
  background: var(--surface-hover);
}

.docflow-files__badge-svg {
  width: 1rem;
  height: 1rem;
}

.docflow-files__badge--rag-none {
  opacity: 0.45;
}

.docflow-files__badge--rag-pending,
.docflow-files__badge--rag-running {
  color: var(--accent, #60a5fa);
  border-color: color-mix(in srgb, var(--accent, #60a5fa) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #60a5fa) 12%, var(--surface));
}

.docflow-files__badge--rag-running {
  animation: docflow-index-pulse 1.2s ease-in-out infinite;
}

@keyframes docflow-index-pulse {
  50% { opacity: 0.55; }
}

.docflow-files__badge--rag-done {
  color: #4ade80;
  border-color: color-mix(in srgb, #4ade80 45%, var(--border));
  background: color-mix(in srgb, #4ade80 14%, var(--surface));
}

.docflow-files__badge--rag-failed {
  color: #f87171;
  border-color: color-mix(in srgb, #f87171 45%, var(--border));
  background: color-mix(in srgb, #f87171 12%, var(--surface));
}

.docflow-files__badge--vec-full {
  color: #a78bfa;
  border-color: color-mix(in srgb, #a78bfa 45%, var(--border));
  background: color-mix(in srgb, #a78bfa 14%, var(--surface));
}

.docflow-files__badge--vec-partial {
  color: #facc15;
  border-color: color-mix(in srgb, #facc15 45%, var(--border));
  background: color-mix(in srgb, #facc15 12%, var(--surface));
}

.docflow-files__badge--vec-none {
  opacity: 0.5;
}

/* LLM-сводка — та же насыщенность, отдельный оттенок (не --color-success и не серый дефолт). */
.docflow-files__badge--summary-ok {
  color: #22d3ee;
  border-color: color-mix(in srgb, #22d3ee 45%, var(--border));
  background: color-mix(in srgb, #22d3ee 14%, var(--surface));
}

.docflow-files__badge--summary-partial {
  color: #facc15;
  border-color: color-mix(in srgb, #facc15 45%, var(--border));
  background: color-mix(in srgb, #facc15 12%, var(--surface));
}

.docflow-files__badge--summary-pending {
  color: var(--accent, #60a5fa);
  border-color: color-mix(in srgb, var(--accent, #60a5fa) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #60a5fa) 12%, var(--surface));
  animation: docflow-index-pulse 1.2s ease-in-out infinite;
}

.docflow-files__badge--summary-failed {
  color: #f87171;
  border-color: color-mix(in srgb, #f87171 45%, var(--border));
  background: color-mix(in srgb, #f87171 12%, var(--surface));
}

.docidx-summary_ok { color: var(--color-success, #2e7d32); }
.docidx-summary_failed { color: var(--color-danger, #c62828); }
.docidx-summary_skipped { color: var(--text-muted); }
.docidx-summary-badge {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
button.docidx-summary-badge {
  margin: 0;
  padding: 1px 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background: transparent;
  text-decoration: none;
}
.docidx-summary-badge_ok {
  color: #0891b2;
  background: rgba(34, 211, 238, 0.14);
  border-color: rgba(34, 211, 238, 0.35);
}
.docidx-summary-badge_partial {
  color: #ca8a04;
  background: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
}
.docidx-summary-badge_pending,
.docidx-summary-badge_running {
  color: #2563eb;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
}
.docidx-summary-badge_failed {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
}
.docidx-summary-badge_skipped,
.docidx-summary-badge_none {
  color: var(--text-muted);
  background: var(--surface-elevated);
}
.docidx-td-summary { font-size: var(--text-xs); white-space: nowrap; }
/* legacy alias — не использовать в новой разметке */
.docidx-summary-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.docidx-summary-btn:hover { opacity: 0.85; }
.docidx-summary-btn:focus-visible {
  outline: 2px solid var(--focus-ring, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}
.docidx-summary-dialog {
  max-width: min(52rem, 92vw);
  width: 100%;
}
.docidx-summary-dialog-inner { max-height: min(85vh, 720px); }
.docidx-summary-dialog-body {
  margin: 0;
  padding: var(--space-3);
  background: var(--surface-elevated, #f4f4f5);
  border-radius: var(--radius-md, 6px);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(60vh, 520px);
  overflow: auto;
}
.docidx-reindex-fieldset .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.docidx-reindex-dialog {
  max-width: min(520px, 96vw);
}
.docidx-reindex-dialog-inner {
  max-height: min(85vh, 640px);
}
.docidx-reindex-dialog-lead {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary, #555);
}
.docidx-reindex-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.docidx-reindex-option {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-size: var(--text-sm);
  line-height: 1.45;
  cursor: pointer;
}
.docidx-reindex-option input {
  margin-top: 0.2em;
  flex-shrink: 0;
}
.docidx-reindex-option_warn span strong {
  color: var(--color-warning, #b45309);
}
.docidx-reindex-dialog-hint {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.docidx-reindex-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle, #e5e7eb);
}
.docidx-summary-dialog-meta {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.docflow-files__badge--ocr {
  color: #38bdf8;
  border-color: color-mix(in srgb, #38bdf8 45%, var(--border));
  background: color-mix(in srgb, #38bdf8 12%, var(--surface));
}

.docflow-files__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.docflow-files__name {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-tight);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docflow-files__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.2;
}

.docflow-files__meta-do {
  font-family: var(--font-sans);
  color: var(--text-secondary);
}

.docflow-files__actions {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.panel .docflow-files__download-btn,
.docflow-files__download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.panel .docflow-files__download-btn:hover:not(:disabled),
.docflow-files__download-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
  color: var(--accent-hover);
}

.panel .docflow-files__download-btn:focus-visible,
.docflow-files__download-btn:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.panel .docflow-files__download-btn:disabled,
.docflow-files__download-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.docflow-files__download-glyph {
  width: 1rem;
  height: 1rem;
}

.docflow-files__no-dl {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  white-space: nowrap;
}

.docflow-files__preview-popover--error .docflow-files__preview-popover__body {
  color: var(--text);
}

.docflow-files__preview-popover--error {
  border-color: color-mix(in srgb, var(--danger, #c53030) 35%, var(--border));
  background: color-mix(in srgb, var(--danger, #c53030) 8%, var(--surface-elevated));
}

.docflow-files__preview-popover--pinned {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

body.docflow-files__preview-popover--dragging {
  cursor: grabbing;
  user-select: none;
}

.docflow-files__preview-popover[hidden] {
  display: none !important;
}

.docflow-files__preview-popover--hover {
  z-index: 1201;
}

.docflow-files__preview-popover--pinned {
  z-index: 1200;
}

.docflow-files__preview-popover {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(32rem, calc(100vw - 2rem));
  height: min(22rem, 55vh);
  min-width: 14rem;
  min-height: 10rem;
  max-width: min(42rem, calc(100vw - 1rem));
  max-height: min(36rem, calc(100vh - 1rem));
  overflow: hidden;
  padding: 0;
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  resize: both;
}

.docflow-files__preview-popover__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
  cursor: grab;
  touch-action: none;
}

.docflow-files__preview-popover__header:active {
  cursor: grabbing;
}

.docflow-files__preview-popover__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-tight);
}

.docflow-files__preview-popover__actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.docflow-files__preview-popover__btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.docflow-files__preview-popover__btn:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}

.docflow-files__preview-popover__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.docflow-files__preview-popover__pin[aria-pressed='true'] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.docflow-files__preview-popover__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.55;
  word-break: break-word;
}

.docflow-files__preview-popover__p {
  margin: 0 0 var(--space-2);
  text-align: left;
}

.docflow-files__preview-popover__p:last-child {
  margin-bottom: 0;
}

.docflow-files__preview-popover--summary {
  max-width: min(36rem, calc(100vw - 1.5rem));
}

.docflow-files__preview-popover__summary-meta {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.docflow-files__preview-popover__summary .docflow-doc-ask__h {
  margin: var(--space-2) 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.docflow-files__preview-popover__summary .docflow-doc-ask__p,
.docflow-files__preview-popover__summary .docflow-doc-ask__list {
  margin: 0 0 var(--space-2);
}

.docflow-files__preview-popover__summary .docflow-doc-ask__list {
  padding-left: 1.25rem;
}

/* --- Админка: индексация документов ДО --- */
.docidx-intro {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 72ch;
}
.docidx-queue-stats {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.docidx-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}
.docidx-stats-errors-btn {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--color-danger, #c62828);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.docidx-stats-errors-btn:hover { opacity: 0.85; }
.docidx-stats-errors-btn:focus-visible {
  outline: 2px solid var(--focus-ring, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}
.docidx-failed-dialog-inner { max-width: min(58rem, 96vw); }
.docidx-failed-dialog-body {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  align-content: stretch;
}
.docidx-failed-dialog__groups-mount,
.docidx-failed-dialog__jobs {
  width: 100%;
  min-width: 0;
}
.docidx-failed-dialog__jobs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--space-2);
}
.docidx-failed-dialog__table-scroll {
  width: 100%;
  min-width: 0;
}
.docidx-failed-dialog__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}
.docidx-failed-dialog__footer-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-right: auto;
}
.docidx-worker {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
}
.docidx-worker_on { color: var(--success, #22c55e); }
.docidx-worker_off { color: var(--warning, #f59e0b); }
.docidx-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}
.docidx-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.docidx-toolbar__label {
  flex: 0 0 auto;
  min-width: 5.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}
.docidx-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.docidx-toolbar__details {
  margin: 0;
}
.docidx-toolbar__summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) 0;
}
.docidx-toolbar__summary::-webkit-details-marker {
  display: none;
}
.docidx-toolbar__summary::before {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--transition);
}
.docidx-toolbar__details[open] .docidx-toolbar__summary::before {
  transform: rotate(45deg);
}
.docidx-toolbar__details-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0 0;
}
.docidx-main.card {
  padding: var(--space-3);
  min-width: 0;
}
.docidx-main__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}
.docidx-main__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.docidx-filter-select {
  min-width: 7.5rem;
}
.docidx-scope-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.docidx-scope-summary:empty {
  display: none;
}
.docidx-scope-stat strong {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  color: var(--text-head, var(--text));
}
.docidx-scope-stat_ok strong {
  color: var(--success, #22c55e);
}
.docidx-scope-stat_err strong {
  color: var(--color-danger, #c62828);
}
.docidx-stats .docidx-worker {
  flex: 1 1 100%;
  margin: var(--space-1) 0 0;
}
.docidx-stats-errors-btn {
  font: inherit;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-danger, #c62828);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.docidx-stats-errors-btn:hover {
  color: var(--text-head, var(--text));
}
.docidx-stats__stat_warn .docflow-stats__stat-val {
  color: var(--color-danger, #c62828);
}
.docidx-confirm-list {
  margin: var(--space-2) 0;
  padding-left: 1.25rem;
}
.docidx-confirm-note {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.docidx-btn-danger {
  border-color: var(--color-danger, #c62828);
  color: var(--color-danger, #c62828);
}
.docidx-btn-danger:hover {
  background: color-mix(in srgb, var(--color-danger, #c62828) 8%, transparent);
}
.docidx-filter-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
#admin-sub-document-index.admin-sub-panel {
  padding: var(--space-4);
}
#admin-sub-document-index .docidx-layout > .card {
  margin-bottom: 0;
}
#admin-sub-document-index .docidx-main {
  min-width: 0;
}
.docidx-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  gap: var(--space-2);
  align-items: start;
}
@media (max-width: 900px) {
  .docidx-layout { grid-template-columns: 1fr; }
}
.docidx-tree-panel.docflow-tree-panel {
  padding: var(--space-2);
  position: sticky;
  top: var(--space-4);
  align-self: start;
  max-height: none;
  overflow: visible;
  min-width: 0;
}
#docidx-tree-search:empty {
  display: none;
}
.docidx-tree-panel .docflow-tree-content {
  max-height: 65vh;
  margin-top: var(--space-3);
  overflow: auto;
}
.docidx-tree-search-mount {
  margin-bottom: 0;
}

.docidx-scope-summary {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.docidx-scope-summary:empty {
  display: none;
  margin: 0;
}
.docidx-table-wrap {
  overflow: auto;
  max-height: min(65vh, 560px);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
}
.docidx-table {
  width: 100%;
  min-width: 48rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--text-xs);
}
.docidx-col-file { width: 18%; }
.docidx-col-contract { width: 11%; }
.docidx-col-status { width: 7%; }
.docidx-col-extract { width: 6%; }
.docidx-col-extract-detail { width: 7%; }
.docidx-col-summary { width: 6%; }
.docidx-col-num { width: 3.5%; }
.docidx-col-err { width: 10%; }
.docidx-col-actions { width: 2.75rem; }
.docidx-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
}
.docidx-table thead th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
  vertical-align: bottom;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  box-shadow: 0 1px 0 var(--border-muted);
}
.docidx-th-actions {
  width: 2.75rem;
  text-align: center;
}
.docidx-td-name,
.docidx-td-contract {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docidx-td-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.docidx-td-err {
  font-size: 11px;
  color: var(--danger, #ef4444);
}
.docidx-td-actions {
  text-align: center;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 4px;
}
.docidx-td-actions .docidx-reindex-one {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.docidx-td-actions .docidx-reindex-one:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.docidx-td-actions .docidx-reindex-one:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.docidx-th-actions,
.docidx-td-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -6px 0 8px -6px color-mix(in srgb, var(--text, #000) 10%, transparent);
}
.docidx-table thead .docidx-th-actions {
  z-index: 3;
  background: var(--surface);
}
.docidx-err {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docidx-status {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.docidx-status_none { background: var(--surface-elevated); color: var(--text-muted); }
.docidx-status_pending { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.docidx-status_running { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.docidx-status_done { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.docidx-status_failed { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.docidx-td-extract,
.docidx-td-extract-detail,
.docidx-td-summary {
  white-space: nowrap;
  font-size: var(--text-xs);
}
.docidx-td-extract-detail {
  color: var(--text-muted);
}
.docidx-extract {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}
.docidx-extract_none { color: var(--text-muted); }
.docidx-extract_pdftotext { background: var(--surface-elevated); color: var(--text-muted); }
.docidx-extract_tesseract { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
.docidx-extract_vision { background: rgba(168, 85, 247, 0.15); color: #7c3aed; }
.docidx-extract-warn { color: #d97706; font-weight: 600; }
.docidx-empty, .docidx-loading {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.btn-compact {
  padding: 2px 8px;
  font-size: var(--text-xs);
}


#staffing-requests-list .positions-registry__table thead th.positions-registry__th-cell,
#staffing-assignments-list .positions-registry__table thead th.positions-registry__th-cell {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

#staffing-requests-list .positions-registry__table .positions-registry__th,
#staffing-assignments-list .positions-registry__table .positions-registry__th {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  padding: 0 var(--space-1);
  border: none;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  min-height: 0;
}

#staffing-requests-list .positions-registry__table .positions-registry__th:hover,
#staffing-assignments-list .positions-registry__table .positions-registry__th:hover {
  background: var(--surface-hover);
}

#staffing-requests-list .positions-registry__table .positions-registry__th[aria-pressed='true'],
#staffing-assignments-list .positions-registry__table .positions-registry__th[aria-pressed='true'] {
  background: var(--accent-muted);
}

#staffing-requests-list .positions-registry__table .positions-registry__th-label,
#staffing-assignments-list .positions-registry__table .positions-registry__th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

#staffing-requests-list .positions-registry__table .positions-registry__th-sort,
#staffing-assignments-list .positions-registry__table .positions-registry__th-sort {
  flex: 0 0 auto;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

#staffing-requests-list .positions-registry__head-static,
#staffing-assignments-list .positions-registry__head-static {
  border: none;
  background: none;
  min-height: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

#panel-staffing-requests .staffing-registry__action-btn {
  margin-right: var(--space-1);
}

#panel-staffing-requests .staffing-registry__action-btn:last-child {
  margin-right: 0;
}

.staffing-approve-dialog__body {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}

.staffing-approve-dialog__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: min(50vh, 20rem);
  overflow: auto;
}

.staffing-approve-dialog__empty {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.staffing-approve-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
}

.staffing-approve-row:hover {
  background: var(--surface-hover);
}

.staffing-approve-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

html[data-theme^="new"] .dialog-staffing-approve-close svg {
  display: none;
}

html[data-theme^="new"] .dialog-staffing-approve-close::after {
  content: '\2715';
  font-size: 1.25rem;
  line-height: 1;
}

html[data-theme^="new"] .dialog-staffing-approve-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

#panel-staffing-requests #staffing-requests-list .positions-registry__table thead th:nth-child(1),
#panel-staffing-requests #staffing-requests-list .positions-registry__table tbody td:nth-child(1) {
  width: 9rem;
  min-width: 7rem;
  text-align: left;
}


/* Удалённый онбординг 2FA — страница входа (Reztsoff / login-card) */
.login-card .login-enrollment {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-card .login-enrollment.hidden {
  display: none;
}

.login-card .login-enrollment .login-form {
  gap: var(--space-4);
}

.login-card .login-enrollment .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.login-card .login-enrollment .form-field label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #212121;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment .form-field input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: 'Roboto', sans-serif;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #424242;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card .login-enrollment .form-field input:hover {
  border-color: #bdbdbd;
}

.login-card .login-enrollment .form-field input:focus {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.1);
}

.login-card .login-enrollment__words {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.login-card .login-enrollment__lead,
.login-card .login-enrollment__manual-hint {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: #424242;
  line-height: 1.5;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__login-banner {
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 102, 0, 0.35);
  background: rgba(255, 102, 0, 0.08);
  text-align: center;
}

.login-card .login-enrollment__login-banner-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  color: #757575;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__login {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  color: #212121;
  font-family: 'Roboto', sans-serif;
  letter-spacing: var(--tracking-tight);
  word-break: break-all;
}

.login-card .login-enrollment__platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.login-card .login-enrollment__passkey {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #ffffff;
}

.login-card .login-enrollment__passkey-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: #212121;
  font-family: 'Roboto', sans-serif;
  margin-bottom: var(--space-1);
}

.login-card .login-enrollment__passkey-text {
  font-size: var(--text-xs);
  color: #424242;
  line-height: 1.5;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__platform {
  display: block;
  cursor: pointer;
}

.login-card .login-enrollment__platform-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-card .login-enrollment__platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 7.5rem;
  padding: var(--space-3);
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #ffffff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.login-card .login-enrollment__platform-input:focus-visible + .login-enrollment__platform-card {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.1);
}

.login-card .login-enrollment__platform-input:checked + .login-enrollment__platform-card {
  border-color: #ff6600;
  background: rgba(255, 102, 0, 0.06);
  box-shadow: 0 0 0 1px #ff6600;
}

.login-card .login-enrollment__platform-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: #212121;
}

.login-card .login-enrollment__platform-icon .platform-icon,
.login-card .login-enrollment__platform-icon img {
  display: block;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

.login-card .login-enrollment__platform-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #212121;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__store {
  margin-top: var(--space-4);
}

.login-card .login-enrollment__store-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #ffffff;
}

.login-card .login-enrollment__store-qr {
  width: 8.75rem;
  height: 8.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eeeeee;
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
}

.login-card .login-enrollment__store-qr canvas,
.login-card .login-enrollment__store-qr img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-card .login-enrollment__store-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #212121;
  font-family: 'Roboto', sans-serif;
  margin-bottom: var(--space-1);
}

.login-card .login-enrollment__store-link {
  font-size: var(--text-xs);
  color: #ff6600;
  text-decoration: none;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__store-link:hover {
  color: #23aadd;
  text-decoration: underline;
}

.login-card .login-enrollment__qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #ffffff;
}

.login-card .login-enrollment__qr img,
.login-card .login-enrollment__qr canvas {
  display: block;
}

.login-card .login-enrollment__manual-entry {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #fafafa;
}

.login-card .login-enrollment__manual-entry summary {
  cursor: pointer;
  color: #ff6600;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__manual-entry[open] summary {
  margin-bottom: var(--space-2);
}

.login-card .login-enrollment__secret-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.login-card .login-enrollment__secret {
  flex: 1 1 12rem;
  min-width: 0;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.45;
  word-break: break-all;
  color: #212121;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
}

.login-card #app-enrollment-totp-code {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  letter-spacing: 0.15em;
  text-align: center;
  padding: var(--space-3) var(--space-4);
}

.login-card .login-enrollment__totp-field .form-field__hint {
  text-align: center;
}

.login-card .login-enrollment__success-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: var(--text-sm);
  color: #424242;
  line-height: 1.55;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__success-list li + li {
  margin-top: var(--space-2);
}

.login-card .login-enrollment__success-list strong {
  color: #212121;
  font-weight: 600;
}

.login-card .login-enrollment__first-time {
  padding: 0;
  border: none;
  background: none;
  color: #ff6600;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
}

.login-card .login-enrollment__first-time:hover {
  color: #23aadd;
}

.login-card .login-enrollment__first-time:focus-visible {
  outline: 2px solid rgba(255, 102, 0, 0.35);
  outline-offset: 2px;
}

.login-card__footnote-enrollment {
  margin-top: var(--space-2);
}

.login-card__footnote-enrollment.hidden {
  display: none;
}

/* Фраза в карточке сотрудника (тёмная тема SPA) */
.login-enrollment__words_readonly {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.login-enrollment__word-pill {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 500;
}

.employee-create-user-inline__hint_warn {
  color: var(--warning, #b45309);
  font-weight: 500;
}

/* --- Recovery email banner (bottom bar) --- */
.recovery-email-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elevated));
  border-top: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
}

.recovery-email-banner.hidden {
  display: none !important;
}

.recovery-email-banner__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}

.recovery-email-banner__content {
  flex: 1 1 20rem;
  min-width: min(100%, 20rem);
}

.recovery-email-banner__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
}

.recovery-email-banner__list {
  margin: 0 0 var(--space-3);
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.recovery-email-banner__list li + li {
  margin-top: var(--space-1);
}

.recovery-email-banner__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-end;
}

.recovery-email-banner__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 14rem;
}

.recovery-email-banner__field-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.recovery-email-banner__field input {
  min-height: 2.75rem;
}

.recovery-email-banner__submit {
  min-height: 2.75rem;
}

.recovery-email-banner__status {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 1.25rem;
}

.recovery-email-banner__status_ok {
  color: var(--success);
}

.recovery-email-banner__status_error {
  color: var(--danger, #dc2626);
}

.recovery-email-banner__status_info {
  color: var(--text-muted);
}

.recovery-email-banner__actions {
  flex: 0 0 auto;
}

.recovery-email-banner__later:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.recovery-email-confirm-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.recovery-email-confirm-page__card {
  max-width: 28rem;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.recovery-email-confirm-page__message {
  margin: var(--space-4) 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.recovery-email-confirm-page__message_ok {
  color: var(--success);
}

.recovery-email-confirm-page__message_err {
  color: var(--err);
}

.recovery-email-confirm-page__hint {
  margin: 0;
  font-size: var(--text-sm);
}

/* --- Profile: recovery email --- */
.profile-recovery-email {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}

.profile-recovery-email__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.profile-recovery-email__title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
}

.profile-recovery-email__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg) 70%, var(--bg-elevated));
  border: 1px solid var(--border);
}

.profile-recovery-email__badge_on {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: color-mix(in srgb, var(--success) 8%, var(--bg-elevated));
}

.profile-recovery-email__hint {
  margin: 0 0 var(--space-3);
}

.profile-recovery-email__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-end;
}

.profile-recovery-email__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 16rem;
}

.profile-recovery-email__field-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.profile-recovery-email__field input {
  min-height: 2.75rem;
}

.profile-recovery-email__submit {
  min-height: 2.75rem;
}

.profile-recovery-email__status {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 1.25rem;
}

.profile-recovery-email__status_ok {
  color: var(--success);
}

.profile-recovery-email__status_error {
  color: var(--danger, #dc2626);
}

.profile-recovery-email__status_info {
  color: var(--text-muted);
}

/* --- Anviz (админка): терминалы и синхронизация --- */
#admin-sub-anviz.admin-sub-panel {
  padding: 0 var(--space-3) var(--space-3);
}

#admin-sub-anviz.admin-sub-panel.card {
  overflow: visible;
  padding-top: 0;
}

#anviz-admin-panel {
  min-width: 0;
}

/* .panel h3 (margin-top: space-8) сильнее одного класса — сброс в контексте Anviz */
#anviz-admin-panel h3,
#anviz-admin-panel h4.anviz-section-title {
  margin: 0;
}

.anviz-admin {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.anviz-admin__tabs.admin-sub-tabs {
  margin: 0 0 var(--space-2);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-muted);
}

.anviz-tab-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding-top: 0;
}

.anviz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
  min-width: 0;
}

.anviz-card--compact {
  padding: var(--space-3);
}

.anviz-card--muted {
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
  border-color: var(--border-muted);
  box-shadow: none;
}

.anviz-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

.anviz-card__header--stack {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.anviz-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.anviz-terminal-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.anviz-terminal-add-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.anviz-terminal-add-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.anviz-terminal-add-btn[hidden] {
  display: none;
}

.anviz-card__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.anviz-card__desc {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

.anviz-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  margin-top: var(--space-2);
  border-top: 1px solid var(--border-muted);
}

.anviz-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.anviz-section-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.anviz-section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 1rem;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.anviz-form-mode {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-subtle);
  padding: 2px var(--space-2);
  border-radius: 99px;
  border: 1px solid var(--border-muted);
  background: var(--bg-elevated);
}

.anviz-form-mode--edit {
  color: var(--accent-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-muted);
}

.anviz-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}

.anviz-form-field--wide {
  grid-column: 1 / -1;
}

.anviz-form-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  min-width: 0;
}

.anviz-form-stack .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.anviz-form-stack .form-field input:not([type="checkbox"]):not([type="radio"]),
.anviz-form-stack .form-field select,
.anviz-terminal-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.anviz-form-stack .form-field input:not([type="checkbox"]):not([type="radio"])::placeholder {
  color: var(--text-subtle);
}

.anviz-form-stack .form-field input:not([type="checkbox"]):not([type="radio"]):hover,
.anviz-form-stack .form-field select:hover,
.anviz-terminal-field select:hover {
  border-color: color-mix(in srgb, var(--border) 70%, var(--text-muted));
}

.anviz-form-stack .form-field input:not([type="checkbox"]):not([type="radio"]):focus,
.anviz-form-stack .form-field select:focus,
.anviz-terminal-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.anviz-field-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-subtle);
}

#anviz-terminal-form-card .sync-settings-toggle {
  margin-top: var(--space-2);
}

#anviz-terminal-form-card .sync-settings-toggle input[type="checkbox"] {
  inline-size: 1rem !important;
  block-size: 1rem !important;
  width: auto !important;
  min-height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.anviz-terminal-field {
  max-width: 28rem;
}

.anviz-sync-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.anviz-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.anviz-action-row--wrap {
  justify-content: flex-end;
}

.anviz-picker-controls {
  width: 100%;
}

.anviz-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.anviz-search-bar {
  flex: 1 1 14rem;
  min-width: 12rem;
  margin-bottom: 0;
}

.anviz-picker-bulk-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.anviz-picker-bulk-actions .anviz-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.anviz-picker-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.anviz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.anviz-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.anviz-btn:active {
  transform: scale(0.98);
}

.anviz-btn--compact {
  min-height: 2rem;
  padding: var(--space-1) var(--space-3);
  font-weight: 500;
}

.anviz-btn--primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.anviz-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.anviz-btn--secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.anviz-btn--secondary:hover {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--border) 60%, var(--text-muted));
}

.anviz-btn--ghost {
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
}

.anviz-btn--ghost:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.anviz-btn--danger {
  color: #fff;
  background: var(--danger, #dc2626);
  border-color: var(--danger, #dc2626);
}

.anviz-btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.anviz-ph-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.anviz-ph-bulk-actions.hidden {
  display: none !important;
}

.anviz-ph-checkbox-cell {
  width: 2.5rem;
  max-width: 2.75rem;
  padding: var(--space-2);
  vertical-align: middle;
  text-align: center;
}

.anviz-history-table .anviz-ph-row-checkbox,
.anviz-history-table .anviz-ph-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity 0.1s;
}

.anviz-history-table tbody tr:hover .anviz-ph-row-checkbox,
.anviz-history-table.anviz-ph-has-selection .anviz-ph-row-checkbox,
.anviz-history-table.anviz-ph-has-selection .anviz-ph-select-all-checkbox {
  opacity: 1;
}

.anviz-sort-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
  display: inline;
}
.anviz-sort-btn:hover {
  color: var(--accent);
}
.anviz-sort-btn.active {
  color: var(--accent);
}
.anviz-sort-arrow {
  font-size: 0.8em;
  vertical-align: middle;
}

.anviz-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 99px;
  border: 1px solid var(--border);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: var(--leading-tight);
  white-space: nowrap;
}

.anviz-badge--ok {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
}

.anviz-badge--warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 28%, transparent);
}

.anviz-badge--err {
  background: color-mix(in srgb, var(--err) 14%, transparent);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 28%, transparent);
}

.anviz-badge--neutral {
  background: color-mix(in srgb, var(--text-subtle) 12%, transparent);
  color: var(--text-muted);
  border-color: var(--border);
}

.anviz-table-host {
  min-width: 0;
}

.anviz-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.anviz-picker-table-host .anviz-picker-table-wrap {
  max-height: min(28rem, 55vh);
  overflow: auto;
}

.anviz-table-wrap .ms-table {
  margin: 0;
  width: 100%;
  min-width: 36rem;
}

.anviz-devices-table {
  min-width: 44rem;
}

.anviz-picker-table {
  margin: 0;
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
  color: var(--text);
}

.anviz-picker-table thead {
  background: var(--bg-elevated);
}

.anviz-picker-table th,
.anviz-picker-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
  vertical-align: middle;
}

.anviz-picker-table tbody tr:last-child td {
  border-bottom: none;
}

/* Чекбоксы: как в «Проектах» — видны при hover или когда есть выбор */
#anviz-picker-table .anviz-picker-checkbox-cell {
  width: 2.5rem;
  padding: var(--space-2);
  vertical-align: middle;
  text-align: center;
}

#anviz-picker-table .anviz-picker-row-checkbox,
#anviz-picker-table .anviz-picker-select-all-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

#anviz-picker-table tbody tr:hover .anviz-picker-row-checkbox,
#anviz-picker-table .anviz-picker-table.anviz-picker-has-selection .anviz-picker-row-checkbox,
#anviz-picker-table .anviz-picker-table.anviz-picker-has-selection .anviz-picker-select-all-checkbox {
  opacity: 1;
}

.anviz-table__mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
}

.anviz-table__nowrap {
  white-space: nowrap;
}

.anviz-table__status {
  min-width: 8rem;
  max-width: 14rem;
}

.anviz-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  white-space: nowrap;
}

.anviz-cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.anviz-cell-stack__primary {
  font-weight: 600;
  color: var(--text);
}

.anviz-cell-stack__muted {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: 1.35;
}

.anviz-cell-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--err);
}

.anviz-empty {
  padding: var(--space-4) var(--space-3);
  text-align: center;
  border: 1px dashed var(--border-muted);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
}

.anviz-empty--compact {
  padding: var(--space-3);
}

.anviz-empty__title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.anviz-empty__text {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

.anviz-status {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-muted);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.anviz-status--ok {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: color-mix(in srgb, var(--success) 8%, var(--bg-elevated));
  color: var(--success);
}

.anviz-status--error {
  border-color: color-mix(in srgb, var(--err) 45%, transparent);
  background: color-mix(in srgb, var(--err) 8%, var(--bg-elevated));
  color: var(--err);
}

.anviz-verify-results {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-muted);
}

.anviz-verify-results__title {
  margin: 0 0 var(--space-2);
}

.anviz-face-photo-form {
  margin-top: var(--space-2);
}

.anviz-face-photo-details {
  padding: 0;
}

.anviz-face-photo-summary {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.anviz-face-photo-summary::-webkit-details-marker {
  display: none;
}

.anviz-face-photo-summary::before {
  content: '▸';
  display: inline-block;
  margin-right: var(--space-2);
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.anviz-face-photo-details[open] .anviz-face-photo-summary::before {
  transform: rotate(90deg);
}

.anviz-face-photo-details .anviz-card__body {
  padding-top: 0;
  border-top: 1px solid var(--border-muted);
}

.anviz-face-photo-field {
  flex: 1 1 16rem;
  min-width: 0;
}

.anviz-face-photo-field input[type="file"] {
  max-width: 100%;
  cursor: default;
}

.anviz-face-photo-status--ok {
  color: var(--success);
}

.anviz-face-photo-status--error {
  color: var(--err);
}

.anviz-face-photo-link {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.anviz-face-photo-results {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  max-height: 12rem;
  overflow: auto;
  font-size: var(--text-sm);
}

.anviz-face-photo-results__list {
  margin: var(--space-2) 0 0;
  padding-left: 1.25rem;
}

.anviz-face-photo-results__list--skip {
  color: var(--text-muted);
}

.anviz-face-photo-preview {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  background: var(--surface-hover);
}

.anviz-face-photo-preview img {
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Anviz: уголки с временем + мини-полоска 0–24ч в ячейке табеля */
.foreman-ts__cell.ts-cell_has-anviz,
button.foreman-ts__cell.ts-cell_has-anviz {
  position: relative;
  overflow: visible;
  padding-bottom: calc(var(--space-2) + 6px);
}

.ts-anviz-corner {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 1px;
  max-width: calc(100% - 6px);
  pointer-events: auto;
  cursor: help;
  z-index: 3;
  line-height: 1;
}

.ts-anviz-corner--in {
  left: 2px;
  bottom: 10px;
  flex-direction: row;
  align-items: flex-end;
}

.ts-anviz-corner--out {
  right: 2px;
  top: 2px;
  flex-direction: row-reverse;
  align-items: flex-start;
}

.ts-anviz-corner__mark {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  opacity: 0.95;
}

.ts-anviz-corner--in .ts-anviz-corner__mark {
  background: var(--success, #2e7d32);
  clip-path: polygon(0 100%, 0 0, 100% 100%);
}

.ts-anviz-corner--out .ts-anviz-corner__mark {
  background: var(--warn, #ed6c02);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.ts-anviz-corner__time {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--text-xs, 0.6875rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-shadow:
    0 0 3px var(--bg, #0f1419),
    0 0 6px var(--bg, #0f1419);
}

.ts-anviz-corner--in .ts-anviz-corner__time {
  color: color-mix(in srgb, var(--success, #2e7d32) 88%, var(--text, #e8eaed));
}

.ts-anviz-corner--out .ts-anviz-corner__time {
  color: color-mix(in srgb, var(--warn, #ed6c02) 92%, var(--text, #e8eaed));
}

.ts-anviz-mini {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  display: block;
  height: 5px;
  pointer-events: auto;
  cursor: help;
  z-index: 2;
}

.ts-anviz-mini__track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: color-mix(in srgb, var(--border-muted) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border-muted) 40%, transparent);
}

.ts-anviz-mini__segment {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--success, #22c55e) 75%, #3b82f6) 0%,
    color-mix(in srgb, #60a5fa 80%, var(--warn, #ed6c02)) 100%
  );
  box-shadow: 0 0 0 1px color-mix(in srgb, #3b82f6 35%, transparent) inset;
}

.ts-anviz-mini__marker {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--bg, #0f1419) 70%, transparent);
  pointer-events: none;
}

.ts-anviz-mini__marker--in {
  left: 0;
  background: var(--success, #22c55e);
}

.ts-anviz-mini__marker--out {
  left: 100%;
  background: var(--warn, #ed6c02);
}

.ts-anviz-mini__marker--live {
  left: 100%;
  background: #f59e0b;
  box-shadow: 0 0 0 1px color-mix(in srgb, #f59e0b 45%, transparent);
}

.ts-anviz-mini__marker--night {
  left: 0;
  width: 3px;
  height: 3px;
  border-radius: 1px;
  background: #c084fc;
  transform: translate(-50%, -50%) rotate(45deg);
}

.ts-anviz-mini__marker--night-end {
  left: 100%;
}

.foreman-ts__anviz-legend-wrap {
  margin: var(--space-3) var(--space-2) 0;
  padding-top: var(--space-2);
  border-top: 1px solid color-mix(in srgb, var(--border-muted) 70%, transparent);
}

.foreman-ts__anviz-legend {
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

.foreman-ts__anviz-legend-label {
  font-weight: 600;
  color: var(--text);
}

.foreman-ts__anviz-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.foreman-ts__anviz-legend-sep {
  margin: 0 var(--space-1);
  opacity: 0.55;
}

.foreman-ts__anviz-legend-mark {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--success, #2e7d32);
  clip-path: polygon(0 100%, 0 0, 100% 100%);
  vertical-align: middle;
}

.foreman-ts__anviz-legend-bar {
  display: inline-block;
  width: 2.5rem;
  height: 5px;
  vertical-align: middle;
  border-radius: 2px;
  background: color-mix(in srgb, var(--border-muted) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border-muted) 40%, transparent);
}

.foreman-ts__anviz-legend-bar-seg {
  display: block;
  width: 65%;
  height: 100%;
  letter-spacing: 0.01em;
}

.anviz-history-filter input:not([type="checkbox"]):not([type="radio"]),
.anviz-history-filter select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.anviz-history-filter input:not([type="checkbox"]):not([type="radio"])::placeholder {
  color: var(--text-subtle);
}

.anviz-history-filter input[type="number"],
.anviz-history-filter input[type="date"] {
  font-family: var(--font-mono);
}

.anviz-history-filter select {
  padding-right: 2.25rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1rem 1rem;
}

.anviz-history-filter input:not([type="checkbox"]):not([type="radio"]):hover,
.anviz-history-filter select:hover {
  border-color: color-mix(in srgb, var(--border) 70%, var(--text-muted));
}

.anviz-history-filter input:not([type="checkbox"]):not([type="radio"]):focus,
.anviz-history-filter select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.anviz-history-check {
  margin: 0;
  min-height: 2.5rem;
  padding-bottom: var(--space-1);
  user-select: none;
}

.anviz-history-refresh {
  margin-left: auto;
}

.anviz-history-table-host {
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.anviz-ph-check {
  grid-area: check;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  min-height: 2.25rem;
  font-size: var(--text-sm);
  color: var(--text);
  align-self: center;
  user-select: none;
}

.anviz-ph-status {
  margin: var(--space-1) 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.3;
  color: var(--text-muted);
  min-height: 1.25rem;
}

@media (max-width: 1100px) {
  .anviz-ph-filters__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "search search search search"
      "terminal terminal date-from date-to"
      "code limit quick quick"
      "check check actions actions";
  }
}

@media (max-width: 640px) {
  .anviz-ph-filters__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "search search"
      "terminal terminal"
      "date-from date-to"
      "code limit"
      "quick quick"
      "check check"
      "actions actions";
  }

  .anviz-ph-filters__quick {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .anviz-ph-filters__quick .anviz-btn {
    width: 100%;
  }

  .anviz-ph-filters__actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .anviz-ph-filters__actions .anviz-btn {
    width: 100%;
  }
}

.anviz-history-table tbody td {
  color: var(--text);
  background: var(--bg-elevated);
}

.anviz-history-table tbody tr:hover td {
  background: color-mix(in srgb, var(--bg-elevated) 85%, var(--accent));
}

.anviz-table-wrap--scroll {
  max-height: 28rem;
  overflow: auto;
}

.anviz-history-table .anviz-raw-hex {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
}

.anviz-raw-hex--btn {
  display: inline-block;
  max-width: 100%;
  padding: 2px var(--space-1);
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.anviz-raw-hex--btn:hover {
  background: var(--accent-muted);
  color: var(--text);
}

.anviz-raw-hex--btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.anviz-devices-table .anviz-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: flex-end;
}

.anviz-picker-name-cell {
  max-width: 16rem;
}

.anviz-picker-employee-open {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}

.anviz-picker-employee-open:hover {
  color: var(--accent-hover, var(--accent));
}

.anviz-picker-employee-open:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.anviz-employee-punch-gantt-host {
  overflow-x: auto;
}

.anviz-punch-gantt {
  min-width: 36rem;
}

.anviz-punch-gantt__meta {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.anviz-punch-gantt__month {
  margin: 0 0 var(--space-3);
  font-weight: 600;
}

.anviz-punch-gantt-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elevated);
}

.anviz-punch-gantt-row--empty .timesheet-gantt-grid {
  opacity: 0.35;
}

.anviz-punch-gantt-day {
  font-size: var(--text-xs);
  white-space: nowrap;
}

.anviz-punch-gantt-legend {
  margin: 0 0 var(--space-2) calc(6rem + var(--space-2));
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.anviz-punch-gantt-segment {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

@media (max-width: 900px) {
  .anviz-sync-top {
    grid-template-columns: 1fr;
  }

  .anviz-form-grid {
    grid-template-columns: 1fr;
  }

  .anviz-picker-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .anviz-picker-bulk-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .anviz-action-row--wrap {
    justify-content: flex-start;
  }

  .anviz-history-filters__row {
    flex-direction: column;
    align-items: stretch;
  }

  .anviz-history-filter {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .anviz-card__footer,
  .anviz-picker-toolbar,
  .anviz-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .anviz-btn {
    width: 100%;
  }
}

.history-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.history-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.history-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

/* === movements-registry === */
.movements-registry {
  --movements-control-height: 44px;
  --movements-control-radius: var(--radius-md);

  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.movements-registry__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

.movements-registry__stat {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.movements-registry__stat-term {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.movements-registry__stat-val {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.movements-registry__toolbar.panel-toolbar {
  flex-wrap: wrap;
  margin: 0;
}

.movements-registry__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.movements-registry__toolbar-row .movements-registry__refresh-btn,
.movements-registry__toolbar-row .movements-registry__bulk-close-btn {
  box-sizing: border-box;
  height: var(--movements-control-height);
  min-height: var(--movements-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--movements-control-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.movements-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  height: var(--movements-control-height);
  min-height: var(--movements-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--movements-control-radius);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-light);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  white-space: nowrap;
}

.movements-toggle:has(input:checked) {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--accent);
}

.movements-toggle input {
  display: none;
}

.movements-registry__field {
  display: flex;
  min-width: 0;
  width: 100%;
}

.movements-registry__field_grow {
  flex: 1;
  min-width: 12rem;
}

.movements-registry__control {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--movements-control-height);
  padding: 0 var(--space-3);
  border-radius: var(--movements-control-radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.movements-registry__control:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.movements-registry__bulk-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.movements-registry__bulk-actions.hidden {
  display: none;
}

.movements-registry__bulk-count {
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 600;
}

.movements-registry__bulk-purge-btn {
  color: var(--err, #b91c1c);
  border-color: var(--err, #b91c1c);
}

.movements-registry__bulk-purge-btn:hover:not(:disabled) {
  background: var(--err, #b91c1c);
  color: var(--bg-elevated);
}

.movements-registry__pane-head {
  margin: 0 0 var(--space-2);
}

.movements-registry__pane-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.movements-registry__table-scroll {
  overflow: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.movements-registry__list-host {
  min-height: 80px;
}

#panel-movements .movements-registry__row {
  cursor: pointer;
}

#panel-movements .movements-registry__row_closed {
  opacity: 0.55;
}

/* Ширины колонок: перекрываем legacy positions-registry (52% / 28% / 20% на nth-child 1–3). */
#panel-movements #movements-list .movements-registry__table {
  table-layout: fixed;
  width: 100%;
}

#panel-movements #movements-list .movements-registry__col_checkbox {
  width: 2.5rem;
}

#panel-movements #movements-list .movements-registry__col_date-from,
#panel-movements #movements-list .movements-registry__col_date-to {
  width: 7.25rem;
}

#panel-movements #movements-list .movements-registry__col_fio {
  width: 14rem;
}

#panel-movements #movements-list .movements-registry__col_type {
  width: 6.75rem;
}

#panel-movements #movements-list .movements-registry__col_target {
  width: auto;
}

#panel-movements #movements-list .movements-registry__col_counterparty {
  width: 9rem;
}

#panel-movements #movements-list .movements-registry__col_status {
  width: 7.25rem;
}

#panel-movements #movements-list .movements-registry__col_order {
  width: 6.5rem;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(1),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(1) {
  width: 2.5rem;
  min-width: 2.5rem;
  max-width: 2.5rem;
  text-align: center;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(2),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(2) {
  width: 14rem;
  min-width: 11rem;
  text-align: left;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(3),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(3),
#panel-movements #movements-list .positions-registry__table thead th:nth-child(4),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(4) {
  width: 7.25rem;
  min-width: 6.75rem;
  max-width: 8rem;
  text-align: left;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(5),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(5) {
  width: 6.75rem;
  min-width: 6.5rem;
  max-width: 7.5rem;
  text-align: left;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(6),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(6) {
  width: auto;
  min-width: 10rem;
  text-align: left;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(7),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(7) {
  width: 9rem;
  min-width: 7rem;
  max-width: 11rem;
  text-align: left;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(8),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(8) {
  width: 7.25rem;
  min-width: 6.5rem;
  max-width: 8rem;
  text-align: left;
}

#panel-movements #movements-list .positions-registry__table thead th:nth-child(9),
#panel-movements #movements-list .positions-registry__table tbody td:nth-child(9) {
  width: 6.5rem;
  min-width: 5.5rem;
  max-width: 8rem;
  text-align: left;
}

#panel-movements #movements-list .movements-registry__table thead th {
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

#panel-movements #movements-list .positions-registry__table thead th.positions-registry__checkbox-cell,
#panel-movements #movements-list .movements-registry__table thead th.movements-registry__checkbox-cell {
  padding: var(--space-2);
}

#panel-movements #movements-list .movements-registry__table thead th.movements-registry__th-cell:not(.movements-registry__checkbox-cell) {
  padding: var(--space-1) var(--space-1) var(--space-2);
  vertical-align: bottom;
}

/* Заголовок колонки: chip + ▼ (doc/web-ui-style.md §3.9, web-column-autofilter.md §6). */
#panel-movements .movements-registry__th-chip {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

#panel-movements .movements-registry__th-chip:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

#panel-movements .movements-registry__th-chip:has(.movements-registry__th-filter_active) {
  border-color: var(--accent);
}

#panel-movements .movements-registry__th-chip .movements-registry__th,
#panel-movements .movements-registry__th-chip .movements-registry__th-filter {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#panel-movements .movements-registry__th-chip .movements-registry__th {
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-2) + 1.375rem) var(--space-2) var(--space-2);
}

#panel-movements .movements-registry__th {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  max-width: 100%;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    background var(--transition),
    border-color var(--transition);
}

#panel-movements .movements-registry__th:hover {
  background: transparent;
}

#panel-movements .movements-registry__th[aria-pressed='true'] {
  background: transparent;
}

#panel-movements .movements-registry__th:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

#panel-movements .movements-registry__th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-subtle);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

#panel-movements .movements-registry__th:hover .movements-registry__th-label {
  color: var(--accent-hover);
}

#panel-movements .movements-registry__th[aria-pressed='true'] .movements-registry__th-label {
  color: var(--accent);
  font-weight: 700;
}

#panel-movements .movements-registry__th-sort {
  flex: 0 0 auto;
  font-size: 0.625rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
}

#panel-movements .movements-registry__th-filter {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: var(--space-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--transition);
}

#panel-movements .movements-registry__th-filter::before {
  content: "";
  position: absolute;
  inset: -0.375rem;
}

#panel-movements .movements-registry__th-filter:hover,
#panel-movements .movements-registry__th-filter_active {
  color: var(--accent);
}

#panel-movements .movements-registry__th-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#panel-movements .movements-registry__th-filter-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  pointer-events: none;
}

.movements-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.movements-registry__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.movements-registry__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 2.75rem;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

#movements-list .positions-registry__checkbox-cell {
  padding: var(--space-2);
  vertical-align: middle;
  text-align: center;
}

#movements-list .movements-registry-row-checkbox,
#movements-list .movements-registry-select-all-checkbox {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0.85;
  transition: opacity var(--transition);
}

#movements-list .movements-registry-row-checkbox:focus-visible,
#movements-list .movements-registry-select-all-checkbox:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

#movements-list tbody tr:hover .movements-registry-row-checkbox,
#movements-list .positions-registry__table.movements-registry-has-selection .movements-registry-row-checkbox,
#movements-list .positions-registry__table.movements-registry-has-selection .movements-registry-select-all-checkbox,
#movements-list .movements-registry__row_selected .movements-registry-row-checkbox {
  opacity: 1;
}

#movements-list .movements-registry__row_selected {
  background: var(--accent-muted);
}

.movements-registry__muted {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

#panel-movements .movements-registry__cell-date {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#panel-movements .movements-registry__date-open {
  color: var(--text-muted);
  font-style: italic;
}

#panel-movements .movements-registry__table-scroll .positions-registry__table thead th.positions-registry__checkbox-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-elevated);
}

#panel-movements .movements-registry__table-scroll .positions-registry__table tbody td.positions-registry__checkbox-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg);
}

#panel-movements .movements-registry__table-scroll .positions-registry__table thead th.movements-registry__th-fio,
#panel-movements .movements-registry__table-scroll .positions-registry__table tbody td.movements-registry__cell-fio {
  position: sticky;
  left: 2.5rem;
  z-index: 1;
  background: var(--bg);
  box-shadow: var(--foreman-ts-sticky-col-shadow, 3px 0 8px -4px color-mix(in srgb, var(--text) 12%, transparent));
}

#panel-movements .movements-registry__table-scroll .positions-registry__table thead th.movements-registry__th-fio {
  z-index: 3;
  background: var(--bg-elevated);
}

#panel-movements .movements-registry__table-scroll .movements-registry__row_selected td.positions-registry__checkbox-cell,
#panel-movements .movements-registry__table-scroll .movements-registry__row_selected td.movements-registry__cell-fio {
  background: var(--accent-muted);
}

#panel-movements .movements-registry__cell-fio {
  min-width: 11rem;
  vertical-align: middle;
}

#panel-movements .movements-registry__cell-target {
  overflow: hidden;
  word-wrap: break-word;
  line-height: 1.35;
}

#panel-movements .movements-registry__cell-type,
#panel-movements .movements-registry__cell-status,
#panel-movements .movements-registry__cell-order {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#panel-movements .movements-registry__cell-counterparty {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#panel-movements .directors-board__cell-fio-stack {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  max-width: 100%;
}

#panel-movements .directors-board__cell-fio-surname {
  display: block;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#panel-movements .directors-board__cell-fio-given {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: var(--leading-tight);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dialog-movement-edit .movements-dialog__summary-value .directors-board__cell-fio-surname {
  font-size: var(--text-sm);
}

#dialog-movement-edit .movements-dialog__summary-value .directors-board__cell-fio-given {
  font-size: var(--text-xs);
}

/* Модалка редактирования — чуть шире create-модалок; компактный режим с доски директоров */
#dialog-movement-edit.dialog-position-create {
  max-width: min(92vw, 30rem);
}

#dialog-movement-edit[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
}

#dialog-movement-edit .movements-dialog__body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: var(--space-4);
  width: 100%;
  box-sizing: border-box;
}

#dialog-movement-edit .movements-dialog__summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__body {
  gap: var(--space-3);
}

#dialog-movement-edit .movements-dialog__context {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

#dialog-movement-edit .movements-dialog__context-text {
  min-width: 0;
  flex: 1 1 auto;
}

#dialog-movement-edit .movements-dialog__context-employee {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
}

#dialog-movement-edit .movements-dialog__context-employee .directors-board__cell-fio-surname {
  font-size: inherit;
}

#dialog-movement-edit .movements-dialog__context-employee .directors-board__cell-fio-given {
  font-size: var(--text-sm);
}

#dialog-movement-edit .movements-dialog__context-target {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

#dialog-movement-edit .movements-dialog__context-status {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

#dialog-movement-edit .movements-dialog__context-status_active {
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
}

#dialog-movement-edit .movements-dialog__context-status_closed {
  background: var(--bg-muted);
  color: var(--text-muted);
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__summary {
  display: none;
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__summary-item_meta {
  display: none;
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__fields .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
}

#dialog-movement-edit .movements-dialog__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  width: 100%;
}

#dialog-movement-edit #movement-edit-order-field {
  grid-column: 1 / -1;
}

@media (max-width: 420px) {
  #dialog-movement-edit .movements-dialog__fields {
    grid-template-columns: 1fr;
  }
}

#dialog-movement-edit .movements-dialog__summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
}

#dialog-movement-edit .movements-dialog__summary-item_wide {
  grid-column: 1 / -1;
}

#dialog-movement-edit .movements-dialog__summary-label {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

#dialog-movement-edit .movements-dialog__summary-value {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text);
  word-break: break-word;
}

#dialog-movement-edit .movements-dialog__fields .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
  margin: 0;
  min-width: 0;
}

#dialog-movement-edit .movements-dialog__fields .form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

#dialog-movement-edit .movements-dialog__fields .form-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--field-height, 2.75rem);
  height: var(--field-height, 2.75rem);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

#dialog-movement-edit .movements-dialog__fields .form-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

#dialog-movement-edit .movements-dialog__field-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

#dialog-movement-edit .progress-indicator {
  margin: 0 var(--space-4) var(--space-3);
  position: relative;
  z-index: 2;
}

#dialog-movement-edit #toast.toast-in-dialog {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 2147483647;
  pointer-events: none;
}

#dialog-movement-edit .movements-dialog__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

#dialog-movement-edit .movements-dialog__footer-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  width: 100%;
}

#dialog-movement-edit .movements-dialog__footer-destructive {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  width: 100%;
}

#dialog-movement-edit .movements-dialog__footer-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-height, 2.75rem);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#dialog-movement-edit .movements-dialog__footer-actions .btn-secondary:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-muted);
}

#dialog-movement-edit .movements-dialog__footer-actions .btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#dialog-movement-edit .movements-dialog__footer-destructive .btn-danger-outline {
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  white-space: nowrap;
}

@media (min-width: 28rem) {
  #dialog-movement-edit .movements-dialog__footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }

  #dialog-movement-edit .movements-dialog__footer-destructive {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  #dialog-movement-edit .movements-dialog__footer-actions {
    flex: 0 0 auto;
    width: auto;
  }

  #dialog-movement-edit.movements-dialog--compact .movements-dialog__footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  #dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-destructive {
    flex: none;
    width: 100%;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-light);
  }

  #dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-actions {
    flex: none;
    width: 100%;
  }
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-destructive {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  width: 100%;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-destructive .btn-danger-outline {
  width: 100%;
  justify-content: center;
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-destructive:not(:has(.movements-dialog__close-movement-btn:not(.hidden))) {
  grid-template-columns: 1fr;
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: var(--space-2);
}

#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-actions .btn-secondary,
#dialog-movement-edit.movements-dialog--compact .movements-dialog__footer-actions .btn-primary {
  min-height: 2.75rem;
  width: 100%;
  justify-content: center;
}

#dialog-movement-edit .movements-dialog__conflict {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--err) 45%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--err) 8%, var(--surface));
  color: var(--err);
  font-size: var(--text-sm);
}

#dialog-movement-edit .movements-dialog__peers-details {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
}

#dialog-movement-edit .movements-dialog__peers-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

#dialog-movement-edit .movements-dialog__peers-summary::-webkit-details-marker {
  display: none;
}

#dialog-movement-edit .movements-dialog__peers-summary::before {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease-out;
  flex-shrink: 0;
}

#dialog-movement-edit .movements-dialog__peers-details[open] > .movements-dialog__peers-summary::before {
  transform: rotate(45deg);
}

#dialog-movement-edit .movements-dialog__peers-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0 var(--space-3) var(--space-3);
  border-top: 1px solid var(--border-light);
}

#dialog-movement-edit .movements-dialog__peers-hint {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  #dialog-movement-edit .movements-dialog__peers-summary::before {
    transition: none;
  }
}

#dialog-movement-edit .movements-dialog__peers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: min(28vh, 12rem);
  overflow-y: auto;
}

#dialog-movement-edit .movements-dialog__peer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

#dialog-movement-edit .movements-dialog__peer-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

#dialog-movement-edit .movements-dialog__peer-target {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

#dialog-movement-edit .movements-dialog__peer-dates,
#dialog-movement-edit .movements-dialog__peer-status,
#dialog-movement-edit .movements-dialog__peer-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

#dialog-movement-edit .movements-dialog__peer-purge-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

#dialog-movement-edit .movements-dialog__peers-empty {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 480px) {
  #dialog-movement-edit .movements-dialog__summary {
    grid-template-columns: 1fr;
  }

  #dialog-movement-edit .movements-dialog__summary-item_wide {
    grid-column: auto;
  }
}

.movement-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.movement-type-docflow {
  background: var(--info-muted);
  color: var(--info);
}

.movement-type-foreman {
  background: var(--accent-muted);
  color: var(--accent);
}

.movement-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.movement-status-active {
  background: var(--success);
}

.movement-status-closed {
  background: var(--text-muted);
}

#panel-movements .movements-registry__dialog-close-btn {
  border-color: var(--danger, #c62828);
  color: var(--danger, #c62828);
}

#panel-movements .movements-registry__dialog-close-btn:hover {
  background: color-mix(in srgb, var(--danger, #c62828) 12%, transparent);
}

@media (max-width: 720px) {
  .movements-registry__stats {
    grid-template-columns: 1fr;
  }

  .movements-registry__toolbar-row {
    flex-wrap: wrap;
  }
}

/* Shared column autofilter popover (directors board) */
.col-autofilter__popover,
.col-autofilter__dialog {
  position: fixed;
  z-index: var(--z-dropdown, 40);
  box-sizing: border-box;
  width: min(20rem, calc(100vw - 16px));
  min-width: 14rem;
  max-height: min(28rem, calc(100vh - 24px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg, var(--shadow-md));
}

.col-autofilter__dialog[open] {
  position: fixed;
  inset: auto;
  margin: 0;
  max-width: min(20rem, calc(100vw - 16px));
}

.col-autofilter__dialog::backdrop {
  display: none;
}

.col-autofilter__dialog_bottom-sheet::backdrop {
  display: block;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.col-autofilter__dialog_bottom-sheet {
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(85dvh, 28rem);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.col-autofilter__form {
  display: flex;
  flex-direction: column;
  max-height: min(28rem, calc(100vh - 24px));
  margin: 0;
}

.col-autofilter__form-head {
  flex: 0 0 auto;
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 88%, var(--bg));
}

.col-autofilter__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: var(--space-2) var(--space-3);
}

.col-autofilter__form-foot {
  flex: 0 0 auto;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 92%, var(--bg));
}

.col-autofilter__fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-inline-size: 0;
}

.col-autofilter__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.col-autofilter__apply:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.employees-registry__active-filters {
  margin: 0 0 var(--space-3);
}

.employees-registry__active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.employees-registry__active-filters-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
}

.employees-registry__filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.employees-registry__filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.col-autofilter__filter-chip-detail {
  color: var(--text-subtle);
}

.employees-registry__active-filters-clear-all {
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.employees-registry__active-filters-clear-all:hover {
  text-decoration: underline;
}

@media (max-width: 56rem) {
  .employees-registry__toolbar-row {
    flex-wrap: wrap;
  }

  .employees-registry__toolbar-search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .employees-registry__th-chip {
    min-height: 40px;
  }

  .employees-registry__th,
  .employees-registry__head-static {
    min-height: 40px;
    padding: var(--space-1) var(--space-2);
  }

  .employees-registry__th-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .col-autofilter__filter-chip-detail {
    max-width: 10rem;
  }
}

.col-autofilter__head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.col-autofilter__title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.col-autofilter__head-clear {
  flex: 0 0 auto;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
}

.col-autofilter__head-clear:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--surface-hover);
}

.col-autofilter__head-clear:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.col-autofilter__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.col-autofilter__actions_bottom {
  margin-top: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.col-autofilter__form-foot-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.col-autofilter__apply-hint,
.col-autofilter__live {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.col-autofilter__form-foot:has(.col-autofilter__live:not(:empty)) {
  gap: var(--space-2);
}

.col-autofilter__action,
.col-autofilter__cancel {
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}

.col-autofilter__action:hover,
.col-autofilter__cancel:hover {
  text-decoration: underline;
}

.col-autofilter__apply {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}

.col-autofilter__apply:hover {
  background: var(--accent-hover);
}

.col-autofilter__apply:focus-visible,
.col-autofilter__cancel:focus-visible,
.col-autofilter__action:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.col-autofilter__search-wrap {
  margin-bottom: var(--space-2);
}

.col-autofilter__search-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
}

.col-autofilter__search {
  box-sizing: border-box;
  width: 100%;
  min-height: 36px;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.col-autofilter__option_master {
  margin: 0 0 var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 92%, var(--surface-elevated));
  font-weight: 500;
}

.col-autofilter__option_master .col-autofilter__option-label {
  color: var(--text-subtle);
}

.col-autofilter__list {
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.col-autofilter__option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  cursor: pointer;
}

.col-autofilter__option-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.col-autofilter__filter-chip-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.col-autofilter__option-count {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
}

.col-autofilter__loading,
.col-autofilter__empty,
.col-autofilter__error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.col-autofilter__error {
  color: var(--err);
}

@media (prefers-reduced-motion: reduce) {
  .employees-registry__th-filter,
  .col-autofilter__popover {
    transition: none;
  }
}

