/* Раздел «Списки и метки» (web/js/pages/lists). Размеры и цвета — по docs/spec/30-lists.md; цвета — токенами. */

.cl-lsts { display: flex; height: 100%; overflow: hidden; background: var(--white); }
.cl-lsts-main { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; background: var(--white); }
.cl-lsts-strong { font-weight: var(--font-weight-medium); color: var(--text-primary); }

/* ============ А. Вкладки и счётчики лимитов ============ */
.cl-lsts-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex: none; height: 82px; padding: 20px; }
.cl-lsts-top__limits { display: flex; align-items: center; gap: 10px; }
.cl-lsts-limit {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 33px;
  padding: 6px 12px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-8);
  background: var(--white);
  font-size: 14px;
  line-height: 19px;
  white-space: nowrap;
}
.cl-lsts-limit__label { color: var(--text-secondary); }
.cl-lsts-limit__value { color: var(--text-primary); }
.cl-lsts-limit__max { color: var(--text-caption); }
.cl-lsts-limit__bar { flex: none; width: 40px; height: 5px; border-radius: 3px; background: var(--grey-100); overflow: hidden; }
.cl-lsts-limit__fill { display: block; height: 100%; border-radius: 3px; background: var(--brand-500); }
.cl-lsts-limit__fill.is-hot { background: var(--orange-600); }

/* ============ Б. Поиск и действия ============ */
.cl-lsts-bar { display: flex; align-items: center; flex: none; margin-top: 20px; padding: 0 20px 20px; }
.cl-lsts-bar__search { flex: 1 1 auto; min-width: 0; }
.cl-lsts-bar__search .cl-input__control { padding: 8px 56px 8px 16px; }
.cl-lsts-bar__search .cl-input__icon { right: 16px; color: var(--grey-400); }
.cl-lsts-bar__tools { display: flex; flex: none; margin-left: 12px; }
/* Пока режим выбора включён, кнопка остаётся серой, как при наведении */
.cl-lsts-bar__tools .cl-iconbtn.is-selected, .cl-lsts-bar__tools .cl-iconbtn.is-selected:hover {
  background: var(--grey-200);
  border-color: transparent;
  color: var(--icon-primary-default);
}
.cl-lsts-bar__create { flex: none; margin-left: 5px; }

/* ============ В. Перечень ============ */
.cl-lsts-scroll { position: relative; flex: none; max-height: calc(100vh - 230px); overflow-x: hidden; overflow-y: scroll; }
.cl-lsts.is-bulk { --lsts-head-top: 66px; }

/* Панель массового удаления */
.cl-lsts-bulk {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 66px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-secondary-default);
  border-bottom: 1px solid var(--brand-500);
  background: var(--white);
}
.cl-lsts-bulk__text { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 21px; color: var(--grey-600); }
.cl-lsts-bulk__count { font-weight: var(--font-weight-medium); color: var(--brand-500); }

/* Заголовок группы-папки */
.cl-lsts-group__head {
  position: sticky;
  top: var(--lsts-head-top, 0px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 41px;
  padding: 9px 20px;
  border-top: 1px solid var(--border-primary-default);
  background: var(--grey-50);
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.cl-lsts-group.is-open > .cl-lsts-group__head { height: 42px; border-bottom: 1px solid var(--border-primary-default); }
.cl-lsts-group__head:hover { background: var(--grey-100); }
.cl-lsts-group__head:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-500); }
.cl-lsts-group__chevron { color: var(--grey-400); transform: rotate(-90deg); transition: transform .2s; }
.cl-lsts-group.is-open > .cl-lsts-group__head .cl-lsts-group__chevron { transform: none; }
.cl-lsts-group__folder { color: var(--brand-500); }
.cl-lsts-group__name { max-width: 60%; font-size: 14px; font-weight: var(--font-weight-medium); line-height: 21px; color: var(--text-primary); }
.cl-lsts-group__count {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 16px;
  color: var(--text-caption);
}
.cl-lsts-group__rows { display: none; }
.cl-lsts-group.is-open > .cl-lsts-group__rows { display: block; }
.cl-lsts-group__empty { padding: 14px 20px; border-bottom: 1px solid var(--border-tertiary-default); font-size: 14px; line-height: 21px; color: var(--text-disabled); }

/* Строка списка */
.cl-lsts-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 69px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-tertiary-default);
  background: var(--white);
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-row);
}
.cl-lsts-row:hover, .cl-lsts-row:has(.cl-lsts-row__menu.is-open) { background: var(--grey-50); }
.cl-lsts-row.is-selected { background: var(--brand-50); }
.cl-lsts-row.is-selected::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 0 var(--radius-2) var(--radius-2) 0;
  background: var(--brand-500);
}
.cl-lsts-row:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-500); }
.cl-lsts-row__check { display: none; flex: none; }
.cl-lsts.is-bulk .cl-lsts-row__check { display: inline-flex; }
.cl-lsts-row__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-10);
  background: var(--brand-100);
  color: var(--brand-500);
}
.cl-lsts-row__tile--label { color: var(--text-secondary); }
.cl-lsts-row__body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.cl-lsts-row__name { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 21px; color: var(--text-primary); }
.cl-lsts-row.is-checked .cl-lsts-row__name { color: var(--brand-500); }
.cl-lsts-row__meta { display: flex; align-items: center; min-width: 0; font-size: 14px; line-height: 21px; color: var(--text-caption); white-space: nowrap; }
.cl-lsts-row__meta > span { flex: none; }
.cl-lsts-row__meta > .cl-lsts-row__desc { flex: 0 1 auto; }
.cl-lsts-row__sep { margin: 0 4px; padding: 0 2px; color: var(--grey-400); }
.cl-lsts-row__sep--wide { padding: 0 4px; margin: 0 2px; }
.cl-lsts-row__clients {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-width: 64px;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 21px;
  color: var(--text-primary);
}
.cl-lsts-row__clients .cl-icon { color: var(--brand-500); }
.cl-lsts-row__menu { flex: none; opacity: 0; transition: opacity var(--duration-row), background var(--duration-row), color var(--duration-row); }
.cl-lsts-row:hover .cl-lsts-row__menu,
.cl-lsts-row.is-selected .cl-lsts-row__menu,
.cl-lsts-row__menu.is-open,
.cl-lsts-row__menu:focus-visible { opacity: 1; }
.cl-lsts-row__menu:hover, .cl-lsts-row__menu.is-open { background: var(--grey-100); color: var(--grey-600); }
/* Ход массовой операции над списком */
.cl-lsts-row__progress {
  position: absolute;
  right: 20px;
  bottom: 4px;
  left: 20px;
  height: 3px;
  border-radius: 17px;
  background: var(--lsts-progress-track);
  overflow: hidden;
}
.cl-lsts-row__progress-fill { display: block; width: 0; height: 100%; border-radius: 17px; background: var(--green-500); transition: width .3s; }

/* «Показать ещё» */
.cl-lsts-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 41px;
  border-top: 1px solid var(--border-tertiary-default);
  background: var(--white);
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 21px;
  color: var(--grey-600);
}
button.cl-lsts-more:hover { background: var(--grey-50); }
.cl-lsts-more.is-loading { cursor: default; }

/* Итог поиска и «Ничего не найдено» */
.cl-lsts-summary { padding: 16px 20px 24px; font-size: 14px; line-height: 21px; text-align: center; color: var(--text-caption); }
.cl-lsts-summary__more { margin-top: 12px; }
.cl-lsts-nothing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0 20px 20px;
  padding: 24px 16px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-12);
  background: var(--white);
}
.cl-lsts-nothing__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-8);
  background: var(--grey-100);
  color: var(--grey-500);
}
.cl-lsts-nothing__text { font-size: 14px; line-height: 21px; color: var(--text-secondary); }

/* На вкладке нет ни одной записи */
.cl-lsts-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: calc(100vh - 190px);
  padding: 0 20px;
  text-align: center;
}
.cl-lsts-blank__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: var(--brand-100);
  color: var(--brand-500);
}
.cl-lsts-blank__title { margin-top: 20px; font-size: 18px; font-weight: var(--font-weight-medium); line-height: 26px; color: var(--text-primary); }
.cl-lsts-blank__text { max-width: 440px; margin-top: 10px; font-size: 14px; line-height: 21px; color: var(--text-primary); }
.cl-lsts-blank__action { margin-top: 22px; }

/* ============ Меню действий строки ============ */
.cl-lsts-menu {
  width: 256px;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-12);
  background: var(--white);
  box-shadow: var(--lsts-menu-shadow);
}
.cl-lsts-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 39px;
  padding: 9px 12px;
  border-radius: var(--radius-8);
  font-size: 14px;
  line-height: 21px;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  transition: background var(--duration-row), color var(--duration-row);
}
.cl-lsts-menu__item .cl-icon { color: var(--grey-400); transition: color var(--duration-row); }
.cl-lsts-menu__item:hover, .cl-lsts-menu__item:focus-visible { background: var(--grey-100); color: var(--text-primary); }
.cl-lsts-menu__item--danger { color: var(--text-danger); }
.cl-lsts-menu__item--danger .cl-icon { color: var(--red-400); }
.cl-lsts-menu__item--danger:hover, .cl-lsts-menu__item--danger:focus-visible { background: var(--red-100); color: var(--red-700); }
.cl-lsts-menu__item--danger:hover .cl-icon, .cl-lsts-menu__item--danger:focus-visible .cl-icon { color: var(--red-500); }
.cl-lsts-menu__divider { height: 1px; margin: 4px 0; background: var(--border-tertiary-default); }

/* ============ Перетаскивание ============ */
.cl-lsts-ghost {
  position: fixed;
  z-index: 2500;
  margin: 0;
  border-radius: var(--radius-8);
  background: var(--white);
  box-shadow: var(--lsts-ghost-shadow);
  opacity: .96;
  pointer-events: none;
}
.cl-lsts-ghost.cl-lsts-row::before { display: none; }
.is-drag-source { display: none !important; }
.cl-lsts-drop { border-bottom: 1px solid var(--border-tertiary-default); background: var(--grey-100); }
.cl-lsts-fdrop { height: 50px; background: var(--grey-200); }
body.cl-lsts-dragging, body.cl-lsts-dragging * { cursor: grabbing !important; user-select: none; }

/* ============ Правая панель ============ */
.cl-lsts-side {
  flex: none;
  width: var(--lsts-panel-width);
  height: 100%;
  margin-right: 0;
  border-left: 1px solid var(--border-primary-default);
  background: var(--white);
  overflow-x: hidden;
  overflow-y: scroll;
  transition: margin-right var(--duration-panel);
}
.cl-lsts.is-panel-closed .cl-lsts-side { margin-right: calc(-1 * var(--lsts-panel-width)); }
/* Столбик на всю высоту панели: при короткой форме подвал всё равно стоит у нижнего края */
.cl-lsts-side { display: flex; flex-direction: column; }
.cl-lsts-side > * { flex: none; }
.cl-lsts-side > .cl-lsts-body, .cl-lsts-formhost { display: flex; flex-direction: column; flex: 1 0 auto; }
.cl-lsts-formhost > .cl-lsts-form { flex: 1 0 auto; justify-content: flex-start; }

/* Пустое состояние */
.cl-lsts-side__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex: 1 0 auto;
  padding: 60px 20px 20px;
  color: var(--grey-300);
}
.cl-lsts-side__empty-text { font-size: 18px; font-weight: var(--font-weight-semibold); line-height: 26px; color: var(--text-inherit); }

/* Шапка выбранного списка */
.cl-lsts-head { padding: 20px; border-bottom: 1px solid var(--border-primary-default); }
.cl-lsts-head__top { display: flex; align-items: center; gap: 6px; height: 24px; margin-bottom: 12px; }
.cl-lsts-head__kind, .cl-lsts-head__id {
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 21px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-caption);
}
.cl-lsts-head__dot { color: var(--grey-400); }
.cl-lsts-head__id { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: color var(--duration-row); }
.cl-lsts-head__id .cl-icon { color: var(--grey-400); }
.cl-lsts-head__id:hover, .cl-lsts-head__id:focus-visible { color: var(--text-secondary); }
.cl-lsts-head__count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 24px;
  padding: 0 12px 0 8px;
  border-radius: var(--radius-6);
  background: var(--brand-100);
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  line-height: 21px;
  white-space: nowrap;
  color: var(--brand-500);
}
.cl-lsts-head__namerow { display: flex; align-items: center; gap: 10px; height: 44px; }
.cl-lsts-head__name { flex: 1 1 auto; min-width: 0; }
.cl-lsts-head__name .cl-input__control { padding: 8px 48px 8px 12px; }
.cl-lsts-head__save.cl-btn { flex: none; height: 44px; }
.cl-lsts-head__hint { margin-top: 8px; font-size: 14px; line-height: 1.4; color: var(--text-caption); }
.cl-lsts-head__desc { display: flex; align-items: center; gap: 6px; min-height: 24px; margin-top: 10px; }
.cl-lsts-head__desc-text { min-width: 0; font-size: 14px; line-height: 21px; color: var(--grey-600); overflow-wrap: anywhere; }
.cl-lsts-head__desc-text.is-empty { color: var(--text-caption); }
.cl-lsts-head__desc.is-editing { display: block; }
.cl-lsts-head__desc-actions { display: flex; gap: 4px; margin-top: 4px; }
.cl-lsts-head__color { margin-top: 16px; }
.cl-lsts-head__color-label { margin-bottom: 8px; font-size: 14px; line-height: 21px; color: var(--text-primary); }
/* Образцы цвета метки: у выбранного белая галочка и двойное кольцо (белое + цвета образца) */
.cl-lsts-head__color .cl-swatch { position: relative; }
.cl-lsts-head__color .cl-swatch:hover { box-shadow: 0 0 0 1px var(--grey-400); }
.cl-lsts-head__color .cl-swatch.is-selected { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--swatch); }
.cl-lsts-head__color .cl-swatch.is-selected::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 10px;
  width: 7px;
  height: 11px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.cl-lsts-head__actions { display: flex; align-items: center; gap: 8px; height: 34px; margin-top: 16px; }
.cl-lsts-head__mailwrap { position: relative; flex: none; }
.cl-lsts-head__mail.is-open, .cl-lsts-head__mail.is-open:hover { background: var(--brand-480); }
.cl-lsts-mailmenu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 5;
  width: 100%;
  padding: 6px 0;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  box-shadow: var(--shadow-dropdown);
}
.cl-lsts-mailmenu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 14px;
  text-align: left;
  color: var(--text-primary);
}
.cl-lsts-mailmenu__item:hover, .cl-lsts-mailmenu__item:focus-visible { background: var(--grey-100); }

/* Форма добавления и исключения клиентов */
.cl-lsts-body { padding: 8px 8px 0; }
.cl-lsts-mode { margin-bottom: 16px; }
.cl-lsts-mode.is-remove .cl-tab.is-active { color: var(--red-500); box-shadow: var(--shadow-segment-hover); }
.cl-lsts-skeleton { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.cl-lsts-form, .cl-lsts-form__filters, .cl-lsts-form__file, .cl-lsts-form__parts { display: flex; flex-direction: column; gap: 12px; }
.cl-lsts-body .cl-field__label { color: var(--grey-500); }
.cl-lsts-form__notice { align-items: center; color: var(--text-secondary); }
.cl-lsts-form__notice--text { align-items: flex-start; }
.cl-lsts-form__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.cl-lsts-file { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cl-lsts-file__name { font-size: 14px; line-height: 21px; color: var(--text-caption); }
.cl-lsts-file__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Подвал формы прилипает к низу панели */
.cl-lsts-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 63px;
  margin-top: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border-primary-default);
  background: var(--white);
}
.cl-lsts-foot__found { display: flex; align-items: center; gap: 8px; }
.cl-lsts-foot__found.is-hidden { visibility: hidden; }
.cl-lsts-foot__label { font-size: 14px; line-height: 21px; color: var(--text-secondary); }
.cl-lsts-foot__value { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 21px; color: var(--text-primary); }
.cl-lsts-foot__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-8);
  background: var(--white);
  color: var(--brand-500);
  transition: background var(--duration-row);
}
.cl-lsts-foot__count:hover { background: var(--brand-50); }
.cl-lsts-foot__count.is-loading { cursor: default; }
.cl-lsts-foot__bar {
  position: absolute;
  top: -2px;
  right: 0;
  left: 0;
  height: 3px;
  border-radius: 17px;
  background: var(--lsts-progress-track);
  overflow: hidden;
}
.cl-lsts-foot__bar-fill { display: block; width: 0; height: 100%; border-radius: 17px; background: var(--green-500); transition: width .3s; }

/* ============ Окна ============ */
/* «Создать список» / «Создать метку» */
.cl-lsts-dlgform { display: flex; flex-direction: column; gap: 16px; }
.cl-lsts-dlgform .cl-field { gap: 5px; }
.cl-lsts-dlgform .cl-field__label { line-height: 18px; color: var(--text-primary); }

/* «Настройка папок» и «Создать папку» */
.cl-modal.cl-wdlg.cl-lsts-folders { max-height: min(764px, calc(100vh - 72px)); }
.cl-lsts-folders .cl-modal__header { justify-content: flex-start; }
.cl-lsts-folders .cl-modal__title { flex: 1 1 auto; }
.cl-lsts-folders__back { flex: none; margin-left: -6px; }
.cl-lsts-folders__loading { min-height: 120px; }
.cl-lsts-folders__empty { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 12px 0; color: var(--grey-300); }
.cl-lsts-folders__empty-text { font-size: 14px; line-height: 21px; color: var(--text-primary); }
.cl-lsts-folders__list { margin: -8px 0; }
.cl-lsts-fcard {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--lsts-folder-line);
  background: var(--white);
}
.cl-lsts-folders__list > .cl-lsts-fcard:last-child { border-bottom-color: transparent; }
.cl-lsts-fcard__grip { display: inline-flex; flex: none; color: var(--grey-400); cursor: grab; touch-action: none; }
.cl-lsts-fcard__name { flex: 1 1 auto; margin-left: 12px; font-size: 14px; line-height: 19px; color: var(--text-primary); }
.cl-lsts-fcard__edit { flex: 1 1 auto; min-width: 0; margin: -8px 0; }
.cl-lsts-fcard__actions { display: flex; align-items: center; gap: 12px; flex: none; margin-left: 12px; }
.cl-lsts-ghost.cl-lsts-fcard { border-bottom-color: transparent; }
.cl-lsts-folders__checks-title { margin-bottom: -8px; font-size: 14px; line-height: 18px; color: var(--text-primary); }
.cl-lsts-folders__checks { display: flex; flex-direction: column; gap: 12px; }
.cl-lsts-folders__checks .cl-check { min-height: 22px; }
.cl-lsts-folders__none { font-size: 14px; line-height: 21px; color: var(--text-caption); }
/* «Готово» полупрозрачна и не реагирует, пока не отмечен ни один список */
.cl-lsts-folders__done.is-idle { opacity: .5; pointer-events: none; }

/* «Добавить в папку» (окно прежнего образца, 768 px) */
.cl-lsts-tofolder__name { font-size: 14px; line-height: 21px; color: var(--text-primary); overflow-wrap: anywhere; }
.cl-lsts-tofolder__actions { display: flex; margin-top: -1px; }
.cl-lsts-tofolder .cl-field { max-width: 716px; }   /* выпадающий список 716×40, как в образце */
