/**
 * Страница лидов: вторичная навигация CRM, тулбар, переключатель вида, цвета стадий (CRM-like).
 */

.crm-stack {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Горизонтальное меню модуля CRM под шапкой */
.crm-module-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  /* Чтобы при DnG не выделялся текст всей строки — только перетаскиваемый узел */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.crm-module-nav--dnd-active {
  cursor: grabbing;
  touch-action: none;
}

/* На время перетаскивания не переносим полосу на вторую строку — иначе «Ещё» уезжает и зона дропа путается */
.crm-module-nav--dnd-active .crm-module-nav__strip {
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
}

/* Без flex:1 — «Ещё» сразу после последнего пункта полосы, не в правом углу */
.crm-module-nav__strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.crm-module-nav__strip--drag-over {
  background: rgba(47, 198, 246, 0.06);
  border-radius: var(--radius);
}

.crm-module-nav__item--dragging {
  /* opacity не уменьшаем — в связке с DnG иначе пункт «пропадает» в части браузеров */
  box-shadow: 0 0 0 2px var(--color-accent);
  border-radius: var(--radius);
}

.crm-module-nav__dropdown--drag-over {
  outline: 2px dashed var(--color-accent);
  border-radius: 8px;
}

details[data-nav-key="contacts"][hidden] {
  display: none !important;
}

.crm-module-nav [data-nav-strip] [data-nav-key],
.crm-module-nav li[data-nav-overflow-item] {
  cursor: grab;
  -webkit-user-drag: none;
  user-select: none;
}

.crm-module-nav--dnd-active [data-nav-strip] [data-nav-key],
.crm-module-nav--dnd-active li[data-nav-overflow-item] {
  cursor: grabbing;
}

/* Иконки у пунктов полосы (не внутри выпада панели контактов) */
.crm-module-nav__strip > a[data-nav-key] .lucide,
.crm-module-nav__strip > a[data-nav-key] i[data-lucide],
.crm-module-nav__strip > span[data-nav-key] .lucide,
.crm-module-nav__strip > span[data-nav-key] i[data-lucide],
.crm-module-nav__strip > details[data-nav-key] > summary .lucide,
.crm-module-nav__strip > details[data-nav-key] > summary i[data-lucide],
.crm-module-nav li[data-nav-overflow-item] .lucide,
.crm-module-nav li[data-nav-overflow-item] i[data-lucide] {
  pointer-events: none;
}

/* Клон под курсором (pointer DnD), не перехватывает hit-test */
.crm-module-nav__ghost {
  position: fixed;
  z-index: 10050;
  margin: 0;
  padding: 8px 12px;
  pointer-events: none;
  max-width: 280px;
  white-space: nowrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
}

.crm-module-nav__more--drag-over > .crm-module-nav__more-summary {
  background: rgba(47, 198, 246, 0.18);
  outline: 2px dashed var(--color-accent);
  border-radius: var(--radius);
}

.crm-module-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.crm-module-nav a:hover {
  background: var(--color-bg);
  text-decoration: none;
}

.crm-module-nav a.is-active {
  color: var(--color-accent-dark);
  background: rgba(47, 198, 246, 0.12);
}

.crm-module-nav__soon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.crm-module-nav__soon .lucide {
  width: 16px;
  height: 16px;
}

.crm-module-nav .lucide {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* «Ещё» — выпадающее меню разделов CRM */
.crm-module-nav__more {
  position: relative;
  list-style: none;
}

.crm-module-nav__more-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
}

.crm-module-nav__more-summary::-webkit-details-marker {
  display: none;
}

.crm-module-nav__more-summary:hover {
  background: var(--color-bg);
}

.crm-module-nav__more[open] > .crm-module-nav__more-summary {
  background: rgba(47, 198, 246, 0.12);
  color: var(--color-accent-dark);
}

.crm-module-nav__more-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crm-module-nav__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 120;
  min-width: 280px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.crm-module-nav__dropdown li {
  margin: 0;
}

.crm-module-nav__dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

.crm-module-nav__dropdown-link:hover {
  background: var(--color-bg);
}

.crm-module-nav__dropdown-link .lucide {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}

/* «Контакты» — выпадающий список подразделов (как в CRM) */
.crm-module-nav__contacts {
  position: relative;
  list-style: none;
}

.crm-module-nav__contacts-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
}

.crm-module-nav__contacts-summary::-webkit-details-marker {
  display: none;
}

.crm-module-nav__contacts-summary:hover {
  background: var(--color-bg);
}

.crm-module-nav__contacts[open] > .crm-module-nav__contacts-summary,
.crm-module-nav__contacts--current > .crm-module-nav__contacts-summary {
  color: var(--color-accent-dark);
  background: rgba(47, 198, 246, 0.12);
}

.crm-module-nav__contacts-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crm-module-nav__contacts-chevron {
  width: 14px !important;
  height: 14px !important;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.crm-module-nav__contacts[open] .crm-module-nav__contacts-chevron {
  transform: rotate(180deg);
}

.crm-module-nav__contacts-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 125;
  min-width: 300px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.crm-module-nav__contacts-header {
  display: block;
  padding: 10px 14px;
  margin: 0;
  border-left: 3px solid #2066b0;
  background: linear-gradient(180deg, #e8f4fc 0%, #e0f0fa 100%);
  color: #2066b0;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.crm-module-nav__contacts-header:hover {
  text-decoration: underline;
}

.crm-module-nav__contacts-list {
  margin: 0;
  padding: 4px 0 8px;
  list-style: none;
}

.crm-module-nav__contacts-link {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

.crm-module-nav__contacts-link:hover {
  background: var(--color-bg);
}

.crm-module-nav__contacts-link.is-active {
  color: #2066b0;
  background: rgba(32, 102, 176, 0.08);
}

.crm-module-nav__contacts-group {
  margin: 0;
  padding: 0;
}

.crm-module-nav__contacts-group-title {
  display: block;
  padding: 8px 14px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.crm-module-nav__contacts-sublinks {
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

.crm-module-nav__contacts-sublinks a {
  display: block;
  padding: 7px 14px 7px 22px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
}

.crm-module-nav__contacts-sublinks a:hover {
  background: var(--color-bg);
}

/* Чип «Ещё» — доп. фильтры */
.crm-chips__more {
  position: relative;
  list-style: none;
  display: inline-flex;
  align-items: center;
}

.crm-chips__more-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.crm-chips__more-summary::-webkit-details-marker {
  display: none;
}

.crm-chip--more {
  margin: 0;
}

.crm-chips__more[open] .crm-chip--more {
  border-color: var(--color-accent);
  background: rgba(47, 198, 246, 0.08);
}

.crm-chips__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  min-width: 240px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.crm-chips__dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--color-text);
  cursor: pointer;
}

.crm-chips__dropdown-item:hover {
  background: var(--color-bg);
}

.crm-chips__dropdown-item.is-active {
  background: rgba(47, 198, 246, 0.12);
  color: var(--color-accent-dark);
}

/* Страница лидов без глобальной app-header */
.app-main--leads {
  min-height: 0;
}

/* Верхняя полоса: слева ссылки · справа таймер · профиль · логотип и меню (единый тёмный стиль на всех страницах) */
.crm-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 20px;
  background: #2c313a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-top-bar__left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.crm-top-bar .crm-btn-text {
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: #c8d7e8;
  cursor: pointer;
}

.crm-top-bar .crm-btn-text:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Логотип + выпадающее меню — в правом блоке шапки */
.crm-top-bar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 1 auto;
  margin-left: auto;
}

.crm-top-bar__brand {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
}

.crm-top-bar__logo {
  display: none !important;
}

.crm-top-bar__logo:hover {
  opacity: 0.92;
}

.crm-top-bar__logo:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.crm-top-bar__logo-img {
  display: block;
  max-height: 42px;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: right center;
}

.crm-logo-menu {
  position: relative;
  flex-shrink: 0;
  list-style: none;
}

.crm-logo-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  border: none;
  margin: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.42);
  animation: crm-logo-menu-backdrop-in 0.18s ease;
}

@keyframes crm-logo-menu-backdrop-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.crm-logo-menu__trigger {
  position: relative;
  z-index: 260;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.crm-logo-menu__trigger::-webkit-details-marker {
  display: none;
}

.crm-logo-menu__trigger:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: #c5ccd4;
}

.crm-logo-menu[open] > .crm-logo-menu__trigger {
  background: rgba(47, 198, 246, 0.12);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.crm-logo-menu__trigger .lucide {
  width: 14px;
  height: 14px;
}

/* Шапка: кнопка меню у логотипа на тёмном фоне */
.crm-top-bar .crm-logo-menu__trigger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e8eaed;
}

.crm-top-bar .crm-logo-menu__trigger:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.crm-top-bar .crm-logo-menu[open] > .crm-logo-menu__trigger {
  background: rgba(47, 198, 246, 0.22);
  border-color: rgba(47, 198, 246, 0.55);
  color: #9ee5ff;
}

.crm-logo-menu__popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  z-index: 260;
  width: min(420px, calc(100vw - 32px));
  border-radius: 20px;
  background: #eceff1;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.crm-logo-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #3d4555 0%, #323846 100%);
  color: rgba(255, 255, 255, 0.92);
}

.crm-logo-menu__head-url {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.crm-logo-menu__head-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.crm-logo-menu__body {
  padding: 12px 14px 14px;
  background: #eceff1;
}

.crm-logo-menu__stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Карточка-строка (как в CRM) */
.crm-logo-menu__card {
  box-sizing: border-box;
  margin: 0;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.crm-logo-menu__card--row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
}

.crm-logo-menu__card--row:hover {
  background: #fafbfc;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.crm-logo-menu__card--row:active {
  transform: scale(0.995);
}

.crm-logo-menu__row-label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.crm-logo-menu__row-arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  opacity: 0.75;
}

.crm-logo-menu__bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.crm-logo-menu__bubble .lucide {
  width: 20px;
  height: 20px;
  color: #fff;
}

.crm-logo-menu__bubble--grey {
  background: linear-gradient(145deg, #b0bec5, #90a4ae);
}

.crm-logo-menu__bubble--green {
  background: linear-gradient(145deg, #81c784, #43a047);
}

.crm-logo-menu__bubble--yellow {
  background: linear-gradient(145deg, #ffca28, #ffb300);
}

.crm-logo-menu__bubble--slate {
  background: linear-gradient(145deg, #90a4ae, #607d8b);
}

.crm-logo-menu__bubble--muted {
  background: linear-gradient(145deg, #cfd8dc, #b0bec5);
}

/* Реквизиты — полная ширина, кнопки справа */
.crm-logo-menu__card--requisites {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.crm-logo-menu__req-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.crm-logo-menu__req-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crm-logo-menu__req-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.crm-logo-menu__help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 999px;
}

.crm-logo-menu__help-btn:hover {
  color: #2066b0;
}

.crm-logo-menu__help-btn .lucide {
  width: 16px;
  height: 16px;
}

.crm-logo-menu__req-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.crm-logo-menu__pill {
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.crm-logo-menu__pill:hover {
  background: var(--color-bg);
  border-color: #c5ccd4;
}

.crm-logo-menu__more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text-muted);
  cursor: pointer;
}

.crm-logo-menu__more-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.crm-logo-menu__more-btn .lucide {
  width: 18px;
  height: 18px;
}

/* Две колонки: Безопасность | Настройки */
.crm-logo-menu__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 400px) {
  .crm-logo-menu__split {
    grid-template-columns: 1fr;
  }
}

.crm-logo-menu__card--half {
  min-width: 0;
}

.crm-logo-menu__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px 16px;
  background: #eef2f4;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.crm-logo-menu__foot-link {
  font-size: 12px;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
}

.crm-logo-menu__foot-link:hover {
  color: #2066b0;
}

:root[data-theme='dark'] .crm-logo-menu__popover {
  background: #1b2430;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(148, 163, 184, 0.22);
}

:root[data-theme='dark'] .crm-logo-menu__body {
  background: #1f2936;
}

:root[data-theme='dark'] .crm-logo-menu__head {
  background: linear-gradient(180deg, #374151 0%, #2b3442 100%);
  color: #f3f6fb;
}

:root[data-theme='dark'] .crm-logo-menu__head-icon {
  color: #c3cede;
  opacity: 1;
}

:root[data-theme='dark'] .crm-logo-menu__card {
  background: #111a25;
  border-color: #3a4656;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

:root[data-theme='dark'] .crm-logo-menu__card--row,
:root[data-theme='dark'] .crm-logo-menu__req-title,
:root[data-theme='dark'] .crm-logo-menu__row-label {
  color: #e6edf7;
}

:root[data-theme='dark'] .crm-logo-menu__card--row:hover {
  background: #172231;
}

:root[data-theme='dark'] .crm-logo-menu__row-arrow,
:root[data-theme='dark'] .crm-logo-menu__help-btn,
:root[data-theme='dark'] .crm-logo-menu__more-btn {
  color: #b3c0d0;
  opacity: 1;
}

:root[data-theme='dark'] .crm-logo-menu__help-btn:hover {
  color: #8ec2ff;
}

:root[data-theme='dark'] .crm-logo-menu__pill,
:root[data-theme='dark'] .crm-logo-menu__more-btn {
  background: #223042;
  border-color: #3a4656;
  color: #e6edf7;
}

:root[data-theme='dark'] .crm-logo-menu__pill:hover,
:root[data-theme='dark'] .crm-logo-menu__more-btn:hover {
  background: #2a3a4f;
  border-color: #4a5b72;
}

:root[data-theme='dark'] .crm-logo-menu__foot {
  background: #1b2430;
  border-top-color: #3a4656;
}

:root[data-theme='dark'] .crm-logo-menu__foot-link {
  color: #c7d2e2;
}

:root[data-theme='dark'] .crm-logo-menu__foot-link:hover {
  color: #9cc9ff;
}

.crm-top-bar__right .user-menu {
  margin-left: 0;
}

.crm-top-bar__timer {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #e8eaed;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

/* Профиль в тёмной шапке */
.crm-top-bar .user-menu__trigger {
  color: #e8eaed;
}

.crm-top-bar .user-menu__trigger:hover {
  background: rgba(255, 255, 255, 0.08);
}

.crm-top-bar .user-menu__trigger-name {
  color: #e8eaed;
}

.crm-top-bar .user-menu__trigger-chevron {
  color: #9aa0a8;
}

.crm-top-bar .user-menu__trigger-avatar {
  background: rgba(255, 255, 255, 0.15);
  color: #dce3ea;
}

/* Панель: две строки — заголовок/создать/поиск/шестерёнка, затем виды */
.crm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.crm-toolbar__row1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.crm-toolbar__extra-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.crm-toolbar__ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}

.crm-toolbar__ghost:hover {
  background: var(--color-bg);
}

.crm-toolbar__ghost .lucide {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}

.crm-toolbar__row2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.crm-toolbar__title-block {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crm-toolbar__pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.crm-toolbar__pin:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

.crm-toolbar__pin .lucide {
  width: 18px;
  height: 18px;
}

.crm-toolbar__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.crm-toolbar__gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  color: var(--color-text-muted);
}

.crm-toolbar__gear:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.crm-toolbar__gear .lucide {
  width: 18px;
  height: 18px;
}

.crm-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Кнопка «как в CRM» — золотистый градиент */
.btn-create {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-create::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 -34%;
  width: 36%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.34) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-22deg);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.btn-create:hover::after {
  opacity: 1;
  animation: btn-gold-shine 1.15s ease;
}

@keyframes btn-gold-shine {
  from {
    left: -34%;
  }
  to {
    left: 118%;
  }
}

.btn-create:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-create .lucide {
  width: 16px;
  height: 16px;
}

/* Сегмент: Канбан | Список | … */
.view-switcher {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}

.view-switcher button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  font: inherit;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.view-switcher button:last-child {
  border-right: none;
}

.view-switcher button:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.view-switcher button.is-active {
  background: #e8f7fc;
  color: var(--color-text);
  font-weight: 600;
}

.view-switcher button[aria-pressed='true'] {
  background: #e8f7fc;
  color: var(--color-text);
  font-weight: 600;
}

.view-switcher button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.view-switcher button .lucide {
  width: 15px;
  height: 15px;
}

.view-switcher__badge {
  display: inline-block;
  min-width: 1.25em;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.view-switcher button.view-switcher__with-badge {
  opacity: 1;
  cursor: pointer;
}

.view-switcher button.view-switcher__with-badge:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* Чипы фильтров */
.crm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px 12px;
  background: var(--color-bg);
}

.crm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 12px;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
}

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

.crm-chip.is-active {
  border-color: var(--color-accent);
  background: rgba(47, 198, 246, 0.12);
  color: var(--color-accent-dark);
}

.crm-chip .lucide {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}

.crm-chip__count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Контент лидов */
.leads-workspace {
  flex: 1;
  padding: 16px 20px;
  overflow: auto;
  min-height: 0;
}

.leads-workspace.is-hidden {
  display: none;
}

/* Цветные заголовки колонок канбана (не pipeline-режим) */
.kanban__column-header--new:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #00aeef 0%, #0095d4 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--contact:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #00c4fb 0%, #00a8d9 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--qual:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #7bd500 0%, #68b800 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--show:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #ff9d1b 0%, #e8890f 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--contract:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #ff5752 0%, #e04540 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--refusal:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #c62828 0%, #9e1a1a 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--success:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #43a047 0%, #2e7d32 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Фон pipeline-шапки (слой под текстом) — те же градиенты */
.kanban__column-header--bitrix.kanban__column-header--new .kanban__stage-head-bg {
  background: linear-gradient(180deg, #00aeef 0%, #0095d4 100%);
}

.kanban__column-header--bitrix.kanban__column-header--contact .kanban__stage-head-bg {
  background: linear-gradient(180deg, #00c4fb 0%, #00a8d9 100%);
}

.kanban__column-header--bitrix.kanban__column-header--qual .kanban__stage-head-bg {
  background: linear-gradient(180deg, #7bd500 0%, #68b800 100%);
}

/* Красный бейдж «новые» (как в CRM) */
.kanban__stage-head-attn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  margin-left: 8px;
}

.kanban__column-header--bitrix.kanban__column-header--show .kanban__stage-head-bg {
  background: linear-gradient(180deg, #ff9d1b 0%, #e8890f 100%);
}

.kanban__column-header--bitrix.kanban__column-header--contract .kanban__stage-head-bg {
  background: linear-gradient(180deg, #ff5752 0%, #e04540 100%);
}

.kanban__column-header--bitrix.kanban__column-header--refusal .kanban__stage-head-bg {
  background: linear-gradient(180deg, #c62828 0%, #9e1a1a 100%);
}

.kanban__column-header--bitrix.kanban__column-header--success .kanban__stage-head-bg {
  background: linear-gradient(180deg, #43a047 0%, #2e7d32 100%);
}

.kanban__column-header--bitrix.kanban__column-header--deal-show .kanban__stage-head-bg {
  background: linear-gradient(180deg, #00c9b0 0%, #00a896 100%);
}

/* Pipeline «Дела» — те же градиенты, что у простых шапок */
.kanban__column-header--bitrix.kanban__column-header--act-overdue .kanban__stage-head-bg {
  background: linear-gradient(180deg, #ef5350 0%, #c62828 100%);
}

.kanban__column-header--bitrix.kanban__column-header--act-today .kanban__stage-head-bg {
  background: linear-gradient(180deg, #66bb6a 0%, #2e7d32 100%);
}

.kanban__column-header--bitrix.kanban__column-header--act-this-week .kanban__stage-head-bg {
  background: linear-gradient(180deg, #42a5f5 0%, #1565c0 100%);
}

.kanban__column-header--bitrix.kanban__column-header--act-next-week .kanban__stage-head-bg {
  background: linear-gradient(180deg, #4fc3f7 0%, #0277bd 100%);
}

.kanban__column-header--bitrix.kanban__column-header--act-none .kanban__stage-head-bg {
  background: linear-gradient(180deg, #90a4ae 0%, #546e7a 100%);
}

.kanban__column-header--bitrix.kanban__column-header--activities .kanban__stage-head-title,
.kanban__column-header--bitrix.kanban__column-header--activities .kanban__stage-head-count {
  color: #fff;
}

/* Канбан «Дела» — колонки по срокам */
.kanban__column-header--act-overdue:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #ef5350 0%, #c62828 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--act-today:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #66bb6a 0%, #2e7d32 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--act-this-week:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #42a5f5 0%, #1565c0 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--act-next-week:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #4fc3f7 0%, #0277bd 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--act-none:not(.kanban__column-header--bitrix) {
  background: linear-gradient(180deg, #90a4ae 0%, #546e7a 100%);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.kanban__column-header--activities .kanban__column-header-inner {
  flex-wrap: nowrap;
  gap: 6px;
}

.kanban__column-count--paren {
  font-weight: 700;
  font-size: 12px;
  opacity: 0.95;
  white-space: nowrap;
}

.kanban__column-add-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
}

.kanban__column-add-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.kanban__column-add-btn .lucide {
  width: 14px;
  height: 14px;
}

/* Pipeline-шапка стадии: низкая полоса + SVG-стрелка справа */
.kanban__column-header--bitrix {
  position: relative;
  padding: 0;
  border: none;
  border-radius: 0;
  overflow: visible;
  min-height: 30px;
  background: transparent !important;
  border-bottom: none !important;
  margin-right: -6px;
  z-index: 1;
}

.kanban__column-header--bitrix.kanban__column-header--editing {
  margin-right: 0;
  z-index: 4;
}

.kanban__stage-head {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 30px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 2px 0 0;
  border-radius: 3px 0 0 0;
  overflow: hidden;
}

.kanban__stage-head-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 3px 0 0 0;
  pointer-events: none;
}

.kanban__stage-head-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  min-height: 30px;
  padding: 3px 4px 3px 8px;
  box-sizing: border-box;
}

.kanban__stage-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 6px;
}

.kanban__stage-head-title {
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #2a2a2a;
}

.kanban__stage-head-count {
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}

.kanban__stage-head-sum {
  font-size: 10px;
  font-weight: 500;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
}

.kanban__stage-head-edit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-left: 2px;
}

.kanban__stage-head-arrow {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 11px;
  z-index: 3;
  pointer-events: none;
  background-size: 11px 100%;
  background-repeat: no-repeat;
  background-position: center right;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.kanban__stage-head-arrow.kanban__stage-head-arrow--hidden {
  opacity: 0;
  transform: translateX(3px);
}

/* Компактное редактирование: поле + ряд «цвета + кнопки» */
.kanban__stage-head-form {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px;
  margin: 0;
  border-radius: 3px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.kanban__stage-head-form .kanban__stage-head-input,
.kanban__stage-head-form .kanban__column-edit-name {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
}

.kanban__stage-head-form .kanban__column-edit-cancel {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.kanban__stage-head-colors--toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kanban__stage-head-colors--toolbar .kanban__column-edit-presets {
  flex: 1;
  min-width: 0;
  gap: 4px;
}

.kanban__stage-head-colors--toolbar .kanban__column-edit-actions {
  flex-shrink: 0;
  gap: 6px;
}

.kanban__stage-head-form .kanban__column-edit-save {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
}

.kanban__stage-head-form .kanban__column-edit-cancel {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
}

.kanban__stage-head-form .kanban__column-edit-swatch {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border-width: 1px;
}

.kanban__stage-head-form .kanban__column-edit-swatch.is-selected {
  border-width: 2px;
}

.kanban__column-pencil {
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-left: auto;
  padding: 2px;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 3px;
  cursor: pointer;
  color: #333;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.kanban__column-header--bitrix:hover .kanban__column-pencil {
  opacity: 1;
}

.kanban__column-pencil .lucide {
  width: 12px;
  height: 12px;
}

.kanban__column-header-edit-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban__column-edit-name {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  background: #fff;
  color: #1a1d21;
}

.kanban__column-edit-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kanban__column-edit-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.kanban__column-edit-swatch.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.kanban__column-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kanban__column-edit-save {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #1565c0;
  background: #1976d2;
  color: #fff;
}

.kanban__column-edit-cancel {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Колонка «+» — новая стадия */
.kanban__column--no-drag {
  flex: 0 0 56px;
  min-width: 56px;
  max-width: 56px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.kanban__column--no-drag .kanban__add-funnel {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  min-height: 100px;
}

.kanban__add-funnel-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px dashed var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.kanban__add-funnel-btn:hover {
  border-color: #2066b0;
  color: #2066b0;
}

.kanban__add-funnel-btn .lucide {
  width: 20px;
  height: 20px;
}

.kanban__column-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.kanban__column-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban__column-count {
  font-weight: 700;
  font-size: 12px;
  opacity: 0.95;
  white-space: nowrap;
}

.kanban__column-sum {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.95;
  white-space: nowrap;
}

/* Виджеты в колонке «Новый» */
.kanban__new-widgets {
  margin-bottom: 10px;
}

.kanban__quick-lead-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font: inherit;
  font-size: 13px;
  color: #2066b0;
  cursor: pointer;
}

.kanban__quick-lead-btn:hover {
  border-color: #2066b0;
  background: rgba(32, 102, 176, 0.06);
}

.kanban__quick-lead-btn .lucide {
  width: 16px;
  height: 16px;
}

.kanban__widget {
  padding: 10px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 12px;
}

.kanban__widget-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.kanban__widget-lead {
  margin: 0 0 6px;
  color: var(--color-text-muted);
}

.kanban__widget-list {
  margin: 0 0 8px;
  padding-left: 1.1rem;
  color: var(--color-text);
}

.kanban__widget-list--dense li {
  margin-bottom: 2px;
}

.kanban__widget-link {
  display: inline;
  font-size: 12px;
  color: #2066b0;
}

.kanban__widget-cta {
  margin-top: 8px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius);
  background: #2066b0;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kanban__widget-cta:hover {
  background: #1a5592;
}

/* Карточка лида (расширенная) */
.kanban__card-top {
  margin-bottom: 6px;
}

.kanban__card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.kanban__card-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.kanban__card-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
  background: #fff3e0;
  color: #e65100;
}

.kanban__card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.kanban__card-actions .lucide {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}

.kanban__card-price {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.kanban__card-company {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.kanban__card-assignee {
  font-size: 12px;
  color: var(--color-text);
  margin-bottom: 4px;
}

.kanban__card-meta-block {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.kanban__card-source {
  font-size: 12px;
  margin-bottom: 0;
}

.kanban__card-fields {
  margin: 2px 0 8px;
  padding: 10px 0 0;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  display: grid;
  gap: 6px;
}

.kanban__card-field-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 0;
  line-height: 1.35;
}

.kanban__card-field-label {
  color: #7d8791;
  flex: 1;
  min-width: 0;
  font-size: 11px;
}

.kanban__card-field-value {
  text-align: right;
  font-weight: 600;
  max-width: 58%;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

:root[data-theme='dark'] .kanban__card-field-label {
  color: #9fadb9;
}

:root[data-theme='dark'] .kanban__card-field-value {
  color: #e6eef8;
}

.kanban__card-footer--bitrix {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

.kanban__card-task-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  color: #2066b0;
  cursor: pointer;
}

.kanban__card-task-btn .lucide {
  width: 14px;
  height: 14px;
}

/* Выпадающее меню «Дело» на карточке канбана (тип задачи).
   Позиция для режима --floating задаётся только из JS (left/top); не используйте
   top/bottom с !important в базовом классе — иначе инлайновые координаты не применятся. */
.kanban__card-task-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  min-width: 148px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #dbe2ea);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

/* Меню типа задачи уходит в document.body — позиция задаётся из JS */
.kanban__card-task-menu.kanban__card-task-menu--floating {
  position: fixed !important;
  bottom: auto !important;
  margin: 0 !important;
  z-index: 10900;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}

.kanban__card-task-menu__opt {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text, #333);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.kanban__card-task-menu__opt:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text);
}

:root[data-theme='dark'] .kanban__card-task-menu__opt {
  color: #e7edf5;
  -webkit-text-fill-color: #e7edf5;
}

:root[data-theme='dark'] .kanban__card-task-menu__opt:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

/* Мини-форма после выбора типа задачи (внутри карточки — запасной режим) */
.kanban__card-task-quick {
  position: absolute;
  left: 0;
  top: auto;
  bottom: 100%;
  margin-bottom: 6px;
  z-index: 35;
  width: min(320px, calc(100vw - 24px));
  max-height: min(72vh, 440px);
  padding: 10px 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border, #dfe3e6);
  background: var(--color-surface, #fff);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

/* Основной режим: панель в document.body, поверх колонки воронки */
.kanban__card-task-quick.kanban__card-task-quick--floating {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  z-index: 11000;
  max-height: min(85vh, 560px);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
}

:root[data-theme='dark'] .kanban__card-task-quick.kanban__card-task-quick--floating {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.kanban__card-task-quick__head {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text, #333);
  margin: 0 0 8px;
  line-height: 1.35;
}

.kanban__card-task-quick__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.kanban__card-task-quick__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, #6a737f);
}

.kanban__card-task-quick__label--last {
  margin-bottom: 0;
}

.kanban__card-task-quick__comment {
  width: 100%;
  box-sizing: border-box;
  min-height: 56px;
  max-height: 140px;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #dfe3e6);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text, #333);
  background: var(--color-bg, #fafbfc);
  resize: vertical;
}

.kanban__card-task-quick__comment:focus {
  outline: none;
  border-color: var(--color-accent, #2fc6f6);
  box-shadow: 0 0 0 2px rgba(47, 198, 246, 0.2);
}

.kanban__card-task-quick__due {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #dfe3e6);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text, #333);
  background: var(--color-bg, #fafbfc);
}

.kanban__card-task-quick__due:focus {
  outline: none;
  border-color: var(--color-accent, #2fc6f6);
}

.kanban__card-task-quick__actions {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border, #eef0f2);
}

.kanban__card-task-quick__btn {
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.kanban__card-task-quick__btn--ghost {
  border-color: var(--color-border, #dfe3e6);
  background: transparent;
  color: var(--color-text-muted, #6a737f);
}

.kanban__card-task-quick__btn--ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text);
}

.kanban__card-task-quick__btn--primary {
  border-color: var(--color-accent, #2fc6f6);
  background: var(--color-accent, #2fc6f6);
  color: #fff;
}

.kanban__card-task-quick__btn--primary:hover {
  filter: brightness(1.06);
}

:root[data-theme='dark'] .kanban__card-task-quick {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

:root[data-theme='dark'] .kanban__card-task-quick__head {
  color: #e7edf5;
}

:root[data-theme='dark'] .kanban__card-task-quick__comment,
:root[data-theme='dark'] .kanban__card-task-quick__due {
  background: #1b2430;
  border-color: #2b3440;
  color: #e7edf5;
}

:root[data-theme='dark'] .kanban__card-task-quick__btn--ghost {
  border-color: #2b3440;
  color: #c5cdd8;
}

:root[data-theme='dark'] .kanban__card-task-quick__btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

:root[data-theme='dark'] .kanban__card-task-quick__actions {
  border-top-color: #2b3440;
}

/* Пока открыта мини-форма — не обрезать панель по краям карточки */
.kanban__card.kanban__card--with-handle.kanban__card--task-quick-open,
.kanban__card.kanban__card--with-handle:has(.kanban__card-task-quick) {
  overflow: visible;
  z-index: 80;
  position: relative;
}

.kanban__card-task-count {
  font-size: 12px;
  color: var(--color-text-muted);
}

.kanban__card-footer-date {
  font-size: 11px;
  color: var(--color-text-muted);
}

.kanban__card-avatar {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dfe3e6;
  font-size: 9px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

/* Иконки в шапке (поиск) */
.app-header__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  color: var(--color-text-muted);
}

.app-header__icon-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.app-header__icon-btn .lucide {
  width: 18px;
  height: 18px;
}

.app-header__search-wrap {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header__user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.app-header__user-row .lucide {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
}

/* Интерактивный канбан: ширина колонок (как в Excel), порядок колонок, перетаскивание карточек */
.leads-workspace .kanban.kanban--interactive {
  gap: 4px;
}

.leads-workspace .kanban.kanban--interactive .kanban__column {
  position: relative;
  flex: 0 0 auto;
  min-width: 180px;
  cursor: default;
  isolation: isolate;
}

.leads-workspace .kanban.kanban--interactive .kanban__column-body {
  cursor: default;
}

.leads-workspace .kanban.kanban--drag-active {
  user-select: none;
  -webkit-user-select: none;
}

/* Правый край шапки колонки — ресайз ширины всей колонки */
.kanban.kanban--interactive .kanban__column-header {
  position: relative;
}

/* CRM-шапка: ресайзер не перекрывает кнопки «Сохранить» / карандаш */
.kanban.kanban--interactive .kanban__column-header--bitrix > .kanban__column-resizer {
  z-index: 1 !important;
}

.kanban.kanban--interactive .kanban__column-header > .kanban__column-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 100;
  cursor: ew-resize !important;
  touch-action: none;
  pointer-events: auto !important;
  margin: 0;
  padding: 0 4px 0 0;
  box-sizing: content-box;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0 var(--radius) 0 0;
}

.kanban.kanban--interactive .kanban__column-header > .kanban__column-resizer:hover,
.kanban.kanban--interactive .kanban__column-header > .kanban__column-resizer:active {
  cursor: ew-resize !important;
  background: rgba(255, 255, 255, 0.28);
}

.kanban.kanban--interactive .kanban__column-header > .kanban__column-resizer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  opacity: 0.9;
  transition: opacity 0.15s, background 0.15s;
  pointer-events: none;
}

.kanban.kanban--interactive .kanban__column-header > .kanban__column-resizer:hover::after,
.kanban.kanban--interactive .kanban__column-header > .kanban__column-resizer:active::after {
  opacity: 1;
  background: #fff;
}

.kanban__column-header--draggable {
  cursor: grab;
}

.kanban__column-header--draggable:active {
  cursor: grabbing;
}

.kanban__column--dragging {
  opacity: 0.58;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.kanban--interactive .kanban__card {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.kanban--interactive .kanban__card:active {
  cursor: grabbing;
}

/* Ручка и колонка контента: перетаскивание между стадиями (лиды / сделки) */
.kanban__card.kanban__card--with-handle {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.kanban__card-handle {
  flex: 0 0 28px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 4px;
  margin: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  color: var(--color-text-muted);
  background: rgba(0, 0, 0, 0.03);
  border-right: 1px solid var(--color-border);
}

.kanban__card-handle:active {
  cursor: grabbing;
}

.kanban__card-grip {
  font-size: 12px;
  line-height: 1;
  letter-spacing: -2px;
  opacity: 0.75;
}

.kanban__card-inner {
  flex: 1;
  min-width: 0;
  padding: 10px 12px 10px 10px;
}

/* Вертикальный скролл списка по тачу; горизонтальный скролл канбана не цепляется с тела карточки */
.kanban__card.kanban__card--with-handle .kanban__card-inner {
  touch-action: pan-y;
}

.kanban__card--dragging {
  position: relative;
  z-index: 1000;
  opacity: 0.92;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  transform: rotate(1deg);
  touch-action: none;
}

/* --- Форма лида (CRM-подобный редактор сущности) --- */
body.lead-entity-open {
  overflow: hidden;
}

.lead-entity-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(15, 20, 28, 0.45);
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
  animation: lead-entity-fade-in 0.18s ease;
}

@keyframes lead-entity-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lead-entity-panel {
  width: min(560px, 100vw);
  max-height: 100vh;
  background: var(--color-surface, #fff);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: lead-entity-slide-in 0.22s ease;
}

@keyframes lead-entity-slide-in {
  from {
    transform: translateX(12px);
    opacity: 0.92;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.lead-entity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.lead-entity-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.lead-entity-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius, 8px);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.lead-entity-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

.lead-entity-tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.lead-entity-tab {
  padding: 8px 12px;
  font-size: 0.875rem;
  border: none;
  border-radius: var(--radius, 8px);
  background: transparent;
  color: var(--color-text-muted);
  cursor: default;
}

.lead-entity-tab:not(:disabled) {
  cursor: pointer;
}

.lead-entity-tab:not(:disabled):hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
}

.lead-entity-tab.is-active {
  background: rgba(47, 198, 246, 0.12);
  color: var(--color-accent, #2fc6f6);
  font-weight: 600;
}

.lead-photos-viewbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--color-border);
  background: var(--color-bg, #fff);
  color: var(--color-text-muted);
  cursor: pointer;
}

.lead-photos-viewbar__btn:hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
}

.lead-photos-viewbar__btn.is-active {
  border-color: var(--color-accent, #2fc6f6);
  background: rgba(47, 198, 246, 0.12);
  color: var(--color-accent, #2fc6f6);
  font-weight: 600;
}

.lead-photos-viewbar__btn .lucide {
  width: 16px;
  height: 16px;
}

/* Иконка-действие без «салатового» фона (импорт с Диска CRM) */
.crm-disk-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.crm-disk-icon-action:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-accent, #2fc6f6);
}

.crm-disk-icon-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.crm-disk-icon-action .lucide {
  width: 22px;
  height: 22px;
}

/* Зона drag-and-drop: фото / файлы с компьютера или подсказка про Диск CRM */
.crm-file-dropzone {
  position: relative;
  border: 2px dashed var(--color-border, #dfe3e6);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  background: var(--color-bg-subtle, #fafbfc);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.crm-file-dropzone:hover,
.crm-file-dropzone.crm-file-dropzone--drag {
  border-color: var(--color-accent, #2fc6f6);
  background: rgba(47, 198, 246, 0.06);
}

.crm-file-dropzone__hint {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

.crm-file-dropzone__link {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--color-accent, #2fc6f6);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.crm-file-dropzone__link:hover {
  color: var(--color-text, #333);
}

.crm-file-dropzone__native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.lead-entity-form {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lead-entity-tab-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 16px;
}

.lead-entity-hint {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.lead-entity-services-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lead-entity-folder-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.lead-entity-folder-group:last-child {
  margin-bottom: 0;
}

.lead-entity-folder-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text, #333);
  margin: 4px 0 2px;
}

.lead-entity-service-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 8px);
  cursor: pointer;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.lead-entity-service-item:focus-within {
  outline: 2px solid rgba(47, 198, 246, 0.35);
  outline-offset: 1px;
}

.lead-entity-service-item input {
  margin-top: 2px;
  flex-shrink: 0;
}

.lead-entity-service-item__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.lead-entity-service-item__name {
  flex: 1;
  min-width: 0;
}

.lead-entity-service-item__price {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.lead-entity-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.lead-entity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 520px) {
  .lead-entity-grid {
    grid-template-columns: 1fr 1fr;
  }

  .lead-entity-field--checkbox,
  .lead-entity-field--full {
    grid-column: 1 / -1;
  }
}

.lead-entity-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lead-entity-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.lead-entity-field--checkbox input {
  width: auto;
}

/* Диапазон «от — до» (как на Авито: цена / площадь) */
.lead-entity-field--range .lead-entity-label {
  display: block;
  margin-bottom: 6px;
}

.lead-entity-range {
  display: flex;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 8px);
  overflow: hidden;
  background: var(--color-surface, #fff);
}

.lead-entity-range__cell {
  flex: 1;
  min-width: 0;
}

.lead-entity-range__cell + .lead-entity-range__cell {
  border-left: 1px solid var(--color-border);
}

.lead-entity-range__control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  margin: 0;
  cursor: text;
  min-height: 40px;
  box-sizing: border-box;
}

.lead-entity-range__prefix {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.lead-entity-range__input {
  flex: 1 1 48px;
  min-width: 0;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 0.9375rem;
  background: transparent;
  color: var(--color-text);
}

.lead-entity-range__input:focus {
  outline: none;
}

.lead-entity-range__suffix {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.lead-entity-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.lead-entity-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 8px);
  background: var(--color-surface, #fff);
  color: var(--color-text);
}

.lead-entity-input:focus {
  outline: none;
  border-color: var(--color-accent, #2fc6f6);
  box-shadow: 0 0 0 2px rgba(47, 198, 246, 0.2);
}

.lead-entity-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface, #fff);
  flex-shrink: 0;
}

.lead-entity-footer .btn-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entity-draft-status {
  margin-right: auto;
  font-size: 12px;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.entity-draft-status.is-visible {
  opacity: 1;
}

/* Цепочка задач «Подбор → Показ → Контроль» в карточке лида */
.lead-entity-section--task-chain {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.lead-entity-task-chain-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.lead-task-chain__refresh-btn {
  padding: 6px 12px;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.lead-task-chain__refresh-btn:hover:not(:disabled) {
  border-color: var(--color-accent, #2fc6f6);
}

.lead-task-chain__refresh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lead-task-chains-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lead-task-chain--multi {
  margin-bottom: 0;
}

.lead-task-chains-wrapper > .lead-task-chain__tasks-link {
  margin-top: 4px;
}

.lead-task-chain-mount {
  min-height: 0;
}

.lead-task-chain {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-sm);
}

.lead-task-chain--empty {
  box-shadow: none;
}

.lead-task-chain__empty-title {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.lead-task-chain__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.lead-task-chain__head-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lead-task-chain__head-pct {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-accent, #2fc6f6);
}

.lead-task-chain__progress {
  height: 6px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  margin-bottom: 16px;
}

.lead-task-chain__progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--color-accent, #2fc6f6),
    color-mix(in srgb, var(--color-accent, #2fc6f6) 65%, #7dd87d)
  );
  transition: width 0.35s ease;
}

.lead-task-chain__steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lead-task-chain__step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px 12px;
  align-items: flex-start;
  padding: 10px 0;
}

.lead-task-chain__connector {
  grid-column: 1 / -1;
  width: 2px;
  height: 14px;
  margin: -4px 0 -4px 21px;
  border-radius: 2px;
  background: var(--color-border);
}

.lead-task-chain__connector--done {
  background: color-mix(in srgb, var(--color-accent, #2fc6f6) 55%, var(--color-border));
}

.lead-task-chain__step-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.lead-task-chain__step--done .lead-task-chain__step-ring {
  border-color: color-mix(in srgb, var(--color-accent, #2fc6f6) 55%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent, #2fc6f6) 12%, transparent);
  color: var(--color-accent, #2fc6f6);
}

.lead-task-chain__step--active .lead-task-chain__step-ring {
  border-color: var(--color-accent, #2fc6f6);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent, #2fc6f6) 22%, transparent);
  color: var(--color-text);
}

.lead-task-chain__step--locked .lead-task-chain__step-ring {
  opacity: 0.55;
}

.lead-task-chain__step--cancelled .lead-task-chain__step-ring {
  border-style: dashed;
  opacity: 0.75;
}

.lead-task-chain__step-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.lead-task-chain__step-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.lead-task-chain__dot {
  opacity: 0.45;
  margin: 0 4px;
}

.lead-task-chain__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.lead-task-chain__btn {
  padding: 6px 12px;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    opacity 0.18s ease;
}

.lead-task-chain__btn:hover:not(:disabled) {
  border-color: var(--color-accent, #2fc6f6);
}

.lead-task-chain__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lead-task-chain__btn--primary {
  border-color: transparent;
  background: var(--color-accent, #2fc6f6);
  color: #fff;
}

.lead-task-chain__btn--primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.lead-task-chain__locked-hint {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.lead-task-chain__badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.lead-task-chain__badge--done {
  background: color-mix(in srgb, var(--color-accent, #2fc6f6) 14%, transparent);
  color: var(--color-text);
}

.lead-task-chain__badge--cancelled {
  background: color-mix(in srgb, #e54d4d 12%, transparent);
  color: #c0392b;
}

.lead-task-chain__tasks-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-accent, #2fc6f6);
  text-decoration: none;
}

.lead-task-chain__tasks-link:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .lead-task-chain__progress-fill {
    transition: none;
  }
}
