/* ============================================================
   Алабуга Пульс HR CRM — дизайн-система, токены и компоненты
   Единственный источник стилей для всех макетов.
   Стиль: flat, плотный data-heavy SaaS (референсы: Ashby, Attio, Linear).
   Правило: страницы используют ТОЛЬКО эти классы и переменные.
   ============================================================ */

@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/inter-4.1/InterVariable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Токены ---------- */
:root {
  /* Шрифт */
  --font-ui: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;

  /* Размеры текста (десктопный data-dense SaaS) */
  --text-xs: 11px;   /* оверлайны, счётчики */
  --text-sm: 12.5px; /* вторичный текст, бейджи */
  --text-md: 14px;   /* базовый UI-текст */
  --text-lg: 16px;   /* подзаголовки, крупные значения */
  --text-xl: 20px;   /* заголовок страницы */
  --text-2xl: 26px;  /* большие метрики */

  /* Палитра: поверхность и текст (light) */
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F1F3F7;
  --surface-hover: #F5F6FA;
  --border: #E4E7EE;
  --border-strong: #CBD2DE;
  --text-1: #14161F;
  --text-2: #4A5264;
  --text-3: #656E88;

  /* Primary — индиго (осознанно НЕ синий Skillaz) */
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-active: #3730A3;
  --primary-soft: #EEF0FE;
  --primary-soft-border: #D9DCFC;
  --on-primary: #FFFFFF;
  /* --primary-fg — акцент, когда он РИСУЕТСЯ ТЕКСТОМ (ссылка, активный пункт меню,
     бейдж, таб). Отделён от --primary, который остаётся заливкой кнопок и полос:
     в тёмной теме заливке нужен тёмный тон (под белым --on-primary), а тексту —
     светлый, иначе контраст на --primary-soft падает до 3.24:1 при норме 4.5:1. */
  --primary-fg: var(--primary);

  /* Семантика статусов */
  --success: #08734F;  --success-soft: #E6F7F0;  --success-border: #BFE9D8;
  --warning: #B45309;  --warning-soft: #FEF6E7;  --warning-border: #F5DFB8;
  --danger:  #D92D20;  --danger-soft:  #FEEFEC;  --danger-border:  #F7CFC8;
  --info:    #096A9E;  --info-soft:    #EAF5FB;  --info-border:    #C4E2F2;
  --neutral-soft: #EFF1F5; --neutral-border: #DDE1E9;
  /* Текст бейджа --danger на --danger-soft: базовый #D92D20 даёт 4.32:1 при норме 4.5. */
  --danger-fg: #C92A1D;
  --on-danger: #FFFFFF;

  /* Цвета групп этапов воронки (stage groups) */
  --stage-new: #64748B;        --stage-new-soft: #F0F2F6;
  --stage-screening: #096A9E;  --stage-screening-soft: #EAF5FB;
  --stage-interview: #6D4AE0;  --stage-interview-soft: #F0EDFD;
  --stage-assessment: #B45309; --stage-assessment-soft: #FEF6E7;
  --stage-security: #0F766E;   --stage-security-soft: #E8F5F3;
  --stage-offer: #C2410C;      --stage-offer-soft: #FEF0E8;
  --stage-hired: #08734F;      --stage-hired-soft: #E6F7F0;
  --stage-rejected: #98A2B3;   --stage-rejected-soft: #F2F4F7;
  /* Текст бейджа этапа. Отдельно от --stage-*, потому что тот же токен красит
     точки колонок канбана и столбики аналитики, где яркость подбирается иначе.
     Норма — 4.5:1 на соответствующем --stage-*-soft. */
  --stage-new-fg: #5A6880;                     /* базовый #64748B даёт 4.25:1 */
  --stage-screening-fg: var(--stage-screening);
  --stage-interview-fg: var(--stage-interview);
  --stage-assessment-fg: var(--stage-assessment);
  --stage-security-fg: var(--stage-security);
  --stage-offer-fg: var(--stage-offer);
  --stage-hired-fg: var(--stage-hired);
  --stage-rejected-fg: var(--text-2);

  /* Граница поля ввода. WCAG 1.4.11: нетекстовый контраст ≥3:1 к фону поля и к
     фону страницы; --border-strong даёт лишь 1.52:1 (light) / 1.67:1 (dark). */
  --border-field: #7B8497;

  /* Геометрия (плотность 8/10) */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-full: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --sidebar-w: 236px;
  --topbar-h: 52px;
  --row-h: 40px;

  --shadow-1: 0 1px 2px rgba(20, 22, 31, 0.05);
  --shadow-2: 0 4px 16px -2px rgba(20, 22, 31, 0.10), 0 2px 4px rgba(20,22,31,0.05);
  --shadow-3: 0 12px 32px -4px rgba(20, 22, 31, 0.16);

  --dur: 160ms; --ease: cubic-bezier(.2,.6,.3,1);
}

/* Тёмная тема (флип через data-theme на <html>) */
[data-theme="dark"] {
  --bg: #101116;
  --surface: #17181F;
  --surface-2: #1E2029;
  --surface-hover: #1C1E27;
  --border: #262935;
  --border-strong: #3A3E4E;
  --text-1: #F0F1F5;
  --text-2: #A7ADBF;
  --text-3: #8A92A6;
  --primary: #6A61EB; --primary-hover: #6C64E9; --primary-active: #5A52E8;
  --primary-soft: #232345; --primary-soft-border: #35357A;
  /* Заливка (--primary) остаётся тёмной ради белого --on-primary на .btn--primary;
     текстовый акцент осветляем отдельно: 5.7:1 на --primary-soft, 6.8:1 на --surface. */
  --primary-fg: #9A93FF;
  --success: #34C48E; --success-soft: #12291F; --success-border: #1E4634;
  --warning: #E8A23D; --warning-soft: #2C2214; --warning-border: #4D3A1E;
  --danger: #F26D5F;  --danger-soft: #2E1815;  --danger-border: #532721;
  --danger-fg: var(--danger);
  /* Светлый #F26D5F требует тёмной надписи: белая давала 2.95:1. */
  --on-danger: #17181F;
  --info: #4FB3E8;    --info-soft: #12242E;    --info-border: #1E3E52;
  --neutral-soft: #23252F; --neutral-border: #333644;
  --stage-new-soft: #23252F; --stage-screening-soft: #12242E;
  --stage-interview-soft: #201A38; --stage-assessment-soft: #2C2214;
  --stage-security-soft: #122A28; --stage-offer-soft: #2C1D12;
  --stage-hired-soft: #12291F; --stage-rejected-soft: #23252F;
  /* Светлые тона для текста бейджей: тёмные --stage-* давали 2.62–3.20:1. */
  --stage-new-fg: #A3AEC4;        --stage-screening-fg: #4FB3E8;
  --stage-interview-fg: #A896F5;  --stage-assessment-fg: #E8A23D;
  --stage-security-fg: #2FB5A6;   --stage-offer-fg: #F08A5D;
  --stage-hired-fg: #34C48E;      --stage-rejected-fg: var(--text-2);
  --border-field: #6B7285;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 4px 16px -2px rgba(0,0,0,.5);
  --shadow-3: 0 12px 32px -4px rgba(0,0,0,.6);
}

/* ---------- Сброс и базовое ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-fg); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; display: block; }
.tnum { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Каркас приложения ---------- */
.app { display: flex; height: 100vh; min-height: 0; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.content { flex: 1; min-height: 0; padding: var(--sp-6) var(--sp-6) 0; max-width: 1600px; width: 100%; margin: 0 auto; }
.content--full { max-width: none; overflow-x: clip; display: flex; flex-direction: column; min-height: 0; }   /* для канбана/календаря */
.content--narrow { max-width: 960px; }
.content > [data-route].is-visible { padding-bottom: var(--sp-6); }
.mobile-nav-btn { display: none; }
.sidebar-scrim { display: none; }

/* Сайдбар */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__logo {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; height: var(--topbar-h);
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
}
.sidebar__group { padding: var(--sp-3) var(--sp-2) var(--sp-1); }
.sidebar__group-title {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3); padding: 0 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text-1); text-decoration: none; }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary-fg); }
.nav-item.is-active svg { color: var(--primary-fg); }
.nav-item svg { width: 17px; height: 17px; color: var(--text-3); }
.nav-item .nav-count {
  margin-left: auto; font-size: var(--text-xs); font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  padding: 1px 7px; border-radius: var(--r-full);
}
.nav-item.is-active .nav-count { background: var(--surface); color: var(--primary-fg); }

/* Топбар */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
/* Заголовок и поиск сжимаются, но не переносятся: топбар высотой 52px, а справа
   стоит группа демо-инструментов — без этого «Пользователи и роли» ломалось на 3 строки. */
.topbar__title { min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__search {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--sp-2);
  /* shrink 4 — поиск уступает место раньше заголовка страницы. */
  flex: 0 4 264px; min-width: 140px; height: 32px; padding: 0 10px;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: var(--r-md); color: var(--text-2); font-size: 13px;
  cursor: pointer; transition: border-color var(--dur) var(--ease);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__search:hover { border-color: var(--border-strong); }
.topbar__search svg { width: 15px; height: 15px; }
.kbd {
  font-family: var(--font-ui); font-size: var(--text-xs); font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--text-2);
}
.topbar__search .kbd { margin-left: auto; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: none; background: none; border-radius: var(--r-md);
  color: var(--text-2); position: relative;
  transition: background var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-1); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--surface);
}

/* ---------- Контекст роли (WP-01) ---------- */
/* Кластер инструментов показа. Смена демо-роли и «Показать скрытое» — не части продукта,
   поэтому собраны в одну обведённую пунктиром группу с меткой-шестерёнкой. */
.role-context {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0;
  padding: 2px 8px 2px 7px; border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-2);
}
.role-context__tag {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  color: var(--text-3); font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
.role-context__tag svg { width: 13px; height: 13px; }
/* На узком десктопе от метки остаётся только шестерёнка — топбар и так плотный. */
@media (max-width: 1340px) { .role-context__tag { font-size: 0; gap: 0; } }
.role-switch {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; height: 34px; padding: 3px 8px 3px 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-1); text-align: left; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.role-switch:hover { border-color: var(--primary); background: var(--primary-soft); }
.role-switch > svg { color: var(--text-3); }
.role-switch .avatar { width: 24px; height: 24px; font-size: 9px; }
.role-switch__copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.role-switch__name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.role-switch__role { margin-top: 2px; color: var(--text-3); font-size: 10.5px; font-weight: 500; }
.role-switch__chevron {
  width: 0; height: 0; color: var(--text-3); line-height: 1;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor;
}
.role-switch__delegation { max-width: 168px; overflow: hidden; text-overflow: ellipsis; }
.role-switch__delegation-dot { display: none; }
.role-hidden-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--text-xs); font-weight: 500; white-space: nowrap; cursor: pointer; }
.role-hidden-toggle .switch { flex-shrink: 0; }
.permission-guard { display: inline-flex; }
.permission-guard > button[disabled] { pointer-events: none; }
.nav-item--restricted {
  cursor: not-allowed; border: 1px dashed var(--border-strong); color: var(--text-3); background: transparent;
  align-items: flex-start;
}
.nav-item--restricted:hover { background: transparent; color: var(--text-3); }
.nav-item--restricted svg { margin-top: 1px; }
.nav-item__hidden { display: block; margin-left: auto; max-width: 82px; color: var(--text-3); font-size: var(--text-xs); line-height: 1.2; font-weight: 500; text-align: right; white-space: normal; }
@media (max-width: 1220px) {
  .role-hidden-toggle > span:first-child { display: none; }
  .role-switch__name { max-width: 96px; }
  /* .badge задаёт padding: 0 8px ниже по файлу — нужна равная ему по весу двойная
     селекция, иначе точка схлопывается в 2px-полоску. */
  .badge.role-switch__delegation { flex: 0 0 20px; width: 20px; padding: 0; justify-content: center; }
  .role-switch__delegation-text { display: none; }
  .role-switch__delegation-dot { display: block; }
}
@media (max-width: 1040px) {
  .role-switch__name, .role-switch__role { display: none; }
  .role-switch { padding-right: 5px; }
}

@media (max-width: 760px) {
  .app { height: 100dvh; min-height: 100vh; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 120;
    width: min(86vw, 280px); height: 100dvh;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-3);
  }
  .app.is-nav-open .sidebar { transform: translateX(0); }
  .sidebar-scrim {
    display: block; position: fixed; inset: 0; z-index: 110;
    border: 0; padding: 0; background: rgb(15 23 42 / 42%);
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur) var(--ease);
  }
  .app.is-nav-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .mobile-nav-btn { display: grid; flex: 0 0 40px; width: 40px; height: 40px; }
  .main { width: 100%; }
  .topbar { min-height: var(--topbar-h); height: auto; padding: 6px var(--sp-3); gap: var(--sp-2); }
  .topbar__title { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__search { flex: 0 0 40px; width: 40px; min-width: 40px; height: 40px; margin-left: auto; padding: 0; justify-content: center; font-size: 0; }
  .topbar__search .kbd { display: none; }
  .topbar .role-hidden-toggle, .topbar #btn-add-slot, .topbar #btn-theme, .topbar #btn-user { display: none; }
  .topbar .icon-btn { width: 40px; height: 40px; }
  .content { padding: var(--sp-4) var(--sp-4) 0; }
  .page-header { align-items: flex-start; flex-direction: column; gap: var(--sp-3); }
  .page-header__actions { width: 100%; flex-wrap: wrap; }
  .page-header__actions > .btn, .page-header__actions > .select { min-height: 40px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
  .drawer { width: 100vw; max-width: 100vw; }
  .modal { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border-radius: var(--r-md); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--primary:active { background: var(--primary-active); }
.btn--secondary { background: var(--surface); color: var(--text-1); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-hover); }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text-1); }
.btn--danger { background: var(--danger); color: var(--on-danger); }
.btn--danger:hover { filter: brightness(0.92); }
.btn--sm { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn--lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Поля форм ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field__label .req { color: var(--danger); }
.field__hint { font-size: var(--text-xs); color: var(--text-3); }
.field__error { font-size: var(--text-xs); color: var(--danger); }
.input, .select, .textarea {
  height: 32px; padding: 0 10px; width: 100%;
  background: var(--surface); border: 1px solid var(--border-field);
  border-radius: var(--r-md); font-size: 13.5px; color: var(--text-1);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input.is-invalid { border-color: var(--danger); }

/* Видимый фокус у всех интерактивных элементов */
:where(a, button, .btn, .nav-item, .tab, .chip, .segmented button, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
[data-theme="dark"] :where(a, button, .btn, .nav-item, .tab, .chip, .segmented button, [tabindex]):focus-visible {
  outline-color: var(--primary-hover);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7488' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px;
}
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); }
.switch { position: relative; width: 34px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: var(--r-full);
  background: var(--text-3); transition: background var(--dur) var(--ease);
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(14px); }
/* Чекбокс визуально скрыт (0×0, opacity 0) — фокус-кольцо рисуем на дорожке. */
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
[data-theme="dark"] .switch input:focus-visible + .track { outline-color: var(--primary-hover); }

/* ---------- Чипы-фильтры ---------- */
.filter-bar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--r-full); font-size: 12.5px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: border-color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary-fg); }
.chip svg { width: 13px; height: 13px; }
.chip--active {
  border-style: solid; border-color: var(--primary-soft-border);
  background: var(--primary-soft); color: var(--primary-fg);
}
.chip--active .chip__x { display: grid; place-items: center; width: 14px; height: 14px;
  border: none; background: none; padding: 0; color: inherit;
  border-radius: 50%; }
.chip--active .chip__x:hover { background: var(--primary-soft-border); }
.chip__key { font-weight: 400; color: var(--text-3); }
.chip--active .chip__key { color: var(--primary-fg); opacity: 0.7; }

/* ---------- Бейджи и статусы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px; border-radius: var(--r-full);
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--text-2); border: 1px solid var(--neutral-border);
}
.badge .b-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge--warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger-fg);  border-color: var(--danger-border); }
.badge--info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-border); }
.badge--primary { background: var(--primary-soft); color: var(--primary-fg); border-color: var(--primary-soft-border); }
/* Этапы воронки */
.badge--stage-new        { background: var(--stage-new-soft);        color: var(--stage-new-fg);        border-color: transparent; }
.badge--stage-screening  { background: var(--stage-screening-soft);  color: var(--stage-screening-fg);  border-color: transparent; }
.badge--stage-interview  { background: var(--stage-interview-soft);  color: var(--stage-interview-fg);  border-color: transparent; }
.badge--stage-assessment { background: var(--stage-assessment-soft); color: var(--stage-assessment-fg); border-color: transparent; }
.badge--stage-security   { background: var(--stage-security-soft);   color: var(--stage-security-fg);   border-color: transparent; }
.badge--stage-offer      { background: var(--stage-offer-soft);      color: var(--stage-offer-fg);      border-color: transparent; }
.badge--stage-hired      { background: var(--stage-hired-soft);      color: var(--stage-hired-fg);      border-color: transparent; }
.badge--stage-rejected   { background: var(--stage-rejected-soft);   color: var(--stage-rejected-fg);   border-color: transparent; }
.badge--stage-rejected .b-dot { background: var(--stage-rejected); }

/* Приоритет */
.priority { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.priority__bars { display: inline-flex; gap: 2px; align-items: flex-end; }
.priority__bars i { width: 3px; border-radius: 1px; background: var(--border-strong); }
.priority__bars i:nth-child(1) { height: 6px; } .priority__bars i:nth-child(2) { height: 9px; }
.priority__bars i:nth-child(3) { height: 12px; }
.priority--low i:nth-child(1) { background: var(--text-3); }
.priority--medium i:nth-child(-n+2) { background: var(--warning); }
.priority--high i { background: var(--danger); }
.priority--critical { color: var(--danger); }
.priority--critical i { background: var(--danger); }

/* ---------- Аватары ---------- */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: var(--text-3);
}
.avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.avatar--lg { width: 40px; height: 40px; font-size: 15px; }
.avatar--xl { width: 56px; height: 56px; font-size: 20px; }
/* Детеминированные цвета аватаров */
.avatar--a { background: #6D4AE0; } .avatar--b { background: #0E7CB8; }
.avatar--c { background: #0A8A5F; } .avatar--d { background: #B45309; }
.avatar--e { background: #C2410C; } .avatar--f { background: #0F766E; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Карточки и панели ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card__header {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.card__title { font-size: 14px; font-weight: 600; }
.card__subtitle { font-size: var(--text-sm); color: var(--text-3); font-weight: 500; }
.card__body { padding: var(--sp-5); }
.card--flat { box-shadow: none; }

/* Метрики */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); }
.stat { padding: var(--sp-4) var(--sp-5); }
.stat__label { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat__label svg { width: 14px; height: 14px; color: var(--text-3); }
.stat__value { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.stat__delta { font-size: var(--text-xs); font-weight: 600; margin-top: 2px; display: inline-flex; align-items: center; gap: 3px; }
.stat__delta svg { width: 12px; height: 12px; }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }
.stat__delta--flat { color: var(--text-2); }

/* ---------- Таблица ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  height: 36px; padding: 0 var(--sp-3); text-align: left;
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-2); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text-1); }
.table td {
  height: var(--row-h); padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle;
}
.table tbody tr { transition: background var(--dur) var(--ease); cursor: pointer; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-selected { background: var(--primary-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table .cell-main { font-weight: 500; color: var(--text-1); }
.table .cell-sub { font-size: var(--text-xs); color: var(--text-3); }
.table .row-actions { opacity: 0; display: inline-flex; gap: 2px; transition: opacity var(--dur) var(--ease); }
.table tbody tr:hover .row-actions,
.table tbody tr:focus-within .row-actions { opacity: 1; }

/* Панель массовых действий */
.bulkbar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--text-1); color: var(--bg);
  border-radius: var(--r-lg); padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-3); z-index: 100; font-size: 13px; font-weight: 500;
}
[data-theme="dark"] .bulkbar { background: var(--surface-2); color: var(--text-1); border: 1px solid var(--border-strong); }
.bulkbar .btn--ghost { color: inherit; }
.bulkbar .btn--ghost:hover { background: rgba(255,255,255,0.12); color: inherit; }

/* ---------- Табы ---------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); }
.tab {
  padding: 8px 12px; margin-bottom: -1px;
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  border: none; background: none; border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease);
}
.tab:hover { color: var(--text-1); }
.tab.is-active { color: var(--primary-fg); border-bottom-color: var(--primary-fg); font-weight: 600; }
.tab .tab-count { font-size: var(--text-xs); color: var(--text-3); margin-left: 5px; font-weight: 600; }

/* Сегмент-переключатель (канбан/список) */
.segmented {
  display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 2px; gap: 2px;
}
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border: none; background: none;
  border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button svg { width: 14px; height: 14px; }
.segmented button.is-active { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow-1); }

/* ---------- Канбан ---------- */
.kanban { display: flex; gap: var(--sp-3); align-items: stretch; flex: 1; min-width: 0; min-height: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: var(--sp-4); }
.kanban-col { width: 290px; flex-shrink: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); border-radius: var(--r-lg); }
.kanban-col.kanban-col--muted { background: var(--bg); border: 1px solid var(--border); }
.kanban-col--muted .kanban-col__header { color: var(--text-3); }
.kanban-col__header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 13px; font-weight: 600;
}
.kanban-col__dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-col__count { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.kanban-col__sla { margin-left: auto; }
.kanban-col__body { display: flex; flex: 1; flex-direction: column; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2) var(--sp-2); min-height: 0; overflow-y: auto; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 12px; box-shadow: var(--shadow-1); cursor: grab;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.kanban-card__name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.kanban-card__meta { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
.kanban-card__footer { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.kanban-card--ghost { border: 2px dashed var(--primary-soft-border); background: var(--primary-soft); box-shadow: none; min-height: 64px; }

/* ---------- Лента активности ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: var(--sp-3); position: relative; padding-bottom: var(--sp-4); }
.timeline-item::before {
  content: ''; position: absolute; left: 13px; top: 30px; bottom: 2px;
  width: 2px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-item__icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-2); z-index: 1;
}
.timeline-item__icon svg { width: 14px; height: 14px; }
.timeline-item__body { flex: 1; min-width: 0; padding-top: 4px; }
.timeline-item__text { font-size: 13px; color: var(--text-2); }
.timeline-item__text b { color: var(--text-1); font-weight: 600; }
.timeline-item__time { font-size: var(--text-xs); color: var(--text-3); margin-top: 1px; }
.timeline-item__attach {
  margin-top: 8px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 13px;
}

/* ---------- Прогресс и воронка ---------- */
.progress { height: 6px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress__fill { height: 100%; border-radius: var(--r-full); background: var(--primary); }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: var(--sp-3); padding: 6px 0; }
.funnel-row__label { font-size: 13px; font-weight: 500; color: var(--text-2); text-align: right; }
.funnel-row__bar { height: 26px; border-radius: var(--r-sm); min-width: 4px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: 12.5px; font-weight: 600; }
.funnel-row__conv { font-size: 12.5px; color: var(--text-2); }

/* ---------- Модалка / панель / дровер ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 17, 22, 0.45);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 560px; max-width: calc(100vw - 48px); max-height: calc(100vh - 80px);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal__header { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.modal__title { font-size: 15px; font-weight: 600; }
.modal__body { padding: var(--sp-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-4); }
.modal__footer { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); }
/* Ширина — доля экрана, а не константа: на широком мониторе фиксированные 640/720px
   съёживались до четверти окна, и правая панель карточки читалась в две колонки текста. */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
  width: clamp(560px, 32vw, 900px); max-width: 90vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column;
}
.drawer--wide { width: clamp(720px, 38vw, 1180px); }

/* ---------- Разное ---------- */
.page-header { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-header__title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; }
.page-header__count { font-size: 13px; color: var(--text-3); font-weight: 500; }
.page-header__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.menu-pop { max-height: calc(100vh - 16px); overflow-y: auto; }
.divider { height: 1px; background: var(--border); border: none; }
.vdivider { width: 1px; align-self: stretch; background: var(--border); }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.text-sm { font-size: var(--text-sm); } .text-xs { font-size: var(--text-xs); }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); }
.ml-auto { margin-left: auto; }
.grid { display: grid; } .grid-2 { grid-template-columns: 1fr 1fr; }
.w-full { width: 100%; } .min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-8); text-align: center; color: var(--text-3);
}
.empty svg { width: 36px; height: 36px; color: var(--border-strong); }
.empty__title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty__hint { font-size: 13px; max-width: 360px; }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 10px 14px; font-size: 13px; font-weight: 500;
}
.toast svg { width: 16px; height: 16px; color: var(--success); }

.tooltip-demo {
  background: var(--text-1); color: var(--bg);
  font-size: var(--text-xs); font-weight: 500;
  padding: 4px 8px; border-radius: var(--r-sm); box-shadow: var(--shadow-2);
  display: inline-block;
}

/* SLA-индикатор просрочки */
.sla { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 600; }
.sla svg { width: 12px; height: 12px; }
.sla--ok { color: var(--text-2); }
.sla--warn { color: var(--warning); }
.sla--over { color: var(--danger); }

/* ---------- Скелетоны и пульсация ---------- */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-hover) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
[data-theme="dark"] .skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
}
@keyframes skel-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.72); } }

/* Только для скрин-ридеров */
.sr-only {
  position: absolute; left: 0; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Статичная метка-тег (не фильтр) */
.chip--static {
  cursor: default; border-style: solid; border-color: var(--border);
  background: var(--surface-2); color: var(--text-2);
}
.chip--static:hover { border-color: var(--border); background: var(--surface-2); }

/* Врезка с текстом: письмо, комментарий, заметка */
.note {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 10px;
  font-size: var(--text-sm); color: var(--text-2); line-height: 1.5;
}

/* Оверлайны (заголовки колонок, подписи групп) */
.overline { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }

/* Скроллбары */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
