/* Составные виджеты (web/js/widgets). Размеры и цвета — по спецификациям 11, 20, 30, 40. */

/* Свои значения виджетов (тени, цвета макета чата и т. п.) — токены --w-* в tokens.css. */

/* ============ Окно 560 px (шапка 67, тело 20, серый подвал 69) ============ */
.cl-modal.cl-wdlg {
  max-width: 560px;
  max-height: calc(100vh - 72px);
  margin-top: calc(48px - 10vh); /* подложка отступает на 10 % высоты, окну нужно 48 px от верха */
  border-radius: var(--w-radius-dialog);
  box-shadow: var(--w-shadow-dialog);
}
.cl-wdlg .cl-modal__header { height: 67px; padding: 16px 20px; }
.cl-wdlg .cl-modal__title { font-size: 18px; line-height: 26px; }
.cl-wdlg .cl-modal__body { padding: 20px; }
.cl-wdlg .cl-modal__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-primary-default);
  border-radius: 0 0 var(--w-radius-dialog) var(--w-radius-dialog);
  background: var(--grey-50);
}

/* ============ Редактор текста сообщения ============ */
.cl-msged { display: flex; flex-direction: column; min-width: 0; }
.cl-msged__text {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-weight: var(--font-weight-regular);
  resize: none;
}
.cl-msged__text::placeholder { color: var(--text-caption); }
.cl-msged__counter { font-size: 12px; line-height: 16px; color: var(--text-caption); white-space: nowrap; }
.cl-msged__counter.is-over { color: var(--text-danger); }
.cl-msged__tools { display: flex; gap: 4px; }
/* Десять кнопок по 32 px с зазором 4 шире панели 355 px на 1 px — кнопкам разрешено ужаться на долю пикселя */
.cl-msged__tool { flex: 0 1 32px; min-width: 0; }
.cl-msged__warn, .cl-attach__warn {
  padding: 5px;
  border-radius: var(--radius-5);
  background: var(--w-warn-background);
  font-size: 14px;
  line-height: 19px;
  color: var(--w-warn-text);
}
.cl-msged__warn { margin: 10px 0; }

/* Редактор блока */
.cl-msged--block .cl-msged__text {
  height: 120px;
  min-height: 120px;
  max-height: 260px;
  padding: 6px 24px 6px 8px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  font-size: 16px;
  line-height: 22px;
  resize: vertical;
  overflow-y: auto;
  transition: border-color var(--duration-input) ease-out;
}
.cl-msged--block .cl-msged__text:focus { border-color: var(--border-brand); }
.cl-msged--block .cl-msged__counter { margin-top: 2px; text-align: right; }
.cl-msged--block .cl-msged__tools { margin-top: 2px; }

/* Мастер рассылки */
.cl-msged--mailing { border: 1px solid var(--border-primary-default); border-radius: var(--radius-10); background: var(--white); overflow: hidden; }
.cl-msged__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  height: 40px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-primary-default);
  background: var(--grey-50);
}
.cl-msged--mailing .cl-msged__tools { flex-wrap: nowrap; gap: 4px; }
.cl-msged--mailing .cl-msged__tool { flex: none; }
.cl-msged--mailing .cl-tabs--segment .cl-tab { height: 26px; padding: 0 10px; font-size: 13px; line-height: 20px; }
.cl-msged--mailing .cl-msged__text { min-height: 160px; padding: 12px 16px; font-size: 14px; line-height: 20px; overflow-y: auto; }
.cl-msged__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  height: 32px;
  padding: 0 16px;
  border-top: 1px solid var(--border-primary-default);
  background: var(--grey-50);
}
.cl-msged__mode { font-size: 12px; line-height: 16px; color: var(--text-caption); }

/* Поле ввода диалога */
.cl-msged--dialog { height: 100%; background: var(--white); }
.cl-msged__area { position: relative; display: flex; flex: 1 1 auto; min-height: 88px; padding-top: 16px; }
.cl-msged--dialog .cl-msged__text {
  flex: 1 1 auto;
  min-height: 72px;
  padding: 0 48px 0 16px;
  font-size: 16px;
  line-height: 24px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}
.cl-msged__emoji.cl-iconbtn { position: absolute; top: 16px; right: 16px; --ib-size: 20px; border: 0; color: var(--w-emoji-button); }
.cl-msged__emoji.cl-iconbtn:hover, .cl-msged__emoji.cl-iconbtn.is-selected { background: transparent; color: var(--icon-brand); }
.cl-msged__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; height: 60px; padding: 12px 16px; }
.cl-msged--dialog .cl-msged__tools { flex-wrap: nowrap; gap: 6px; }
.cl-msged--dialog .cl-msged__tool { flex: none; border-radius: var(--radius-8); }
.cl-msged__trailing { display: flex; align-items: center; gap: 8px; flex: none; }
.cl-msged.is-disabled .cl-msged__text { color: var(--text-disabled); cursor: not-allowed; }

/* ============ Окно эмодзи ============ */
.cl-emoji {
  display: flex;
  flex-direction: column;
  width: 275px;
  height: 218px;
  overflow: hidden;
  border: 1px solid var(--brand-light);
  border-radius: var(--radius-6);
  background: var(--white);
  box-shadow: var(--shadow-dropdown);
  font-family: var(--w-emoji-font);
  user-select: none;
}
.cl-emoji__tabs { display: flex; flex: none; height: 40px; background: var(--grey-100); }
.cl-emoji__tab, .cl-emoji__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  overflow: hidden;
  font-family: inherit;
  font-size: 24px;
  line-height: 32px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--duration-row);
}
.cl-emoji__tab { height: 40px; }
.cl-emoji__tab:hover, .cl-emoji__tab.is-active { background: var(--grey-200); }
.cl-emoji__grid {
  display: grid;
  grid-template-columns: repeat(8, 32px);
  grid-auto-rows: 32px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.cl-emoji__cell { height: 32px; border-radius: var(--radius-4); }
.cl-emoji__cell:hover { background: var(--grey-100); }
/* Флаги, нарисованные системой парой букв */
.cl-emoji__grid--letters .cl-emoji__cell, .cl-emoji__tab--letters { font-size: 15px; font-weight: var(--font-weight-semibold); color: var(--text-secondary); }

/* ============ Окно «Вставить переменную» ============ */
.cl-modal.cl-varpick { max-height: calc(90vh - 31px); border-radius: var(--radius-6); }
.cl-varpick .cl-modal__body { overflow: hidden; }
.cl-varpick__search { flex: none; }
.cl-varpick__groups { flex: 1 1 auto; min-height: 0; margin-right: -22px; padding-right: 11px; overflow-y: auto; }
.cl-varpick__group + .cl-varpick__group { margin-top: 20px; }
.cl-varpick__title { margin-bottom: 16px; font-size: 14px; line-height: 19px; color: var(--text-secondary); }
.cl-varpick__rows { display: flex; flex-direction: column; gap: 8px; }
.cl-varpick__row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 10px 6px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-5);
  background: var(--white);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-row), border-color var(--duration-row);
}
.cl-varpick__row:hover, .cl-varpick__row:focus-visible { background: var(--grey-50); border-color: var(--border-primary-hover); }
.cl-varpick__name { flex: none; font-weight: var(--font-weight-medium); }
.cl-varpick__desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-varpick__empty { padding: 24px 0; font-size: 14px; line-height: 20px; color: var(--text-caption); text-align: center; }

/* ============ Окно «Конвертировать текст» ============ */
.cl-convert__source, .cl-convert__result {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-6);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
}
.cl-convert__source { height: 120px; border: 1px solid var(--border-secondary-default); background: var(--white); resize: vertical; }
.cl-convert__source:focus { border-color: var(--border-brand); }
.cl-convert__result { height: 60px; border: 0; background: var(--grey-100); resize: none; }
.cl-convert__label { margin-bottom: -10px; font-size: 14px; line-height: 18px; color: var(--text-primary); }

/* ============ Редактор кнопок ============ */
.cl-btned { display: flex; flex-direction: column; min-width: 0; }
.cl-btned--frame, .cl-attach--frame {
  padding: 8px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--grey-40);
}
.cl-btned__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cl-btned__title { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 18px; color: var(--text-primary); }
.cl-btned.is-danger .cl-btned__title { color: var(--red-700); }

/* Ряды и «Добавить кнопку» плавно прячутся тумблером «Показать кнопки» */
.cl-btned__list { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--duration-panel), opacity var(--duration-panel); }
.cl-btned__list.is-collapsed { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
.cl-btned__list-inner { min-height: 0; overflow: hidden; }
.cl-btned__rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.cl-btned__row { display: flex; align-items: flex-start; gap: 6px; min-height: 36px; }
.cl-btned__row.is-empty { display: none; }
.cl-btned__cells { display: flex; flex: 1 1 auto; gap: 5px; min-width: 0; }
.cl-btned__cell { position: relative; flex: 1 1 0; min-width: 0; }
.cl-btned__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  padding: 0 7px;
  border: 1px solid var(--btn-color, var(--w-btn-border));
  border-radius: var(--radius-6);
  background: var(--white);
  font-size: 14px;
  font-weight: var(--font-weight-regular);
  line-height: 20px;
  color: var(--btn-color, var(--text-secondary));
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: background-color var(--duration-row), border-color var(--duration-row);
}
.cl-btned__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-btned__type { position: absolute; top: 0; right: 0; color: var(--grey-500); }
.cl-btned__cell:hover .cl-btned__btn { background: var(--grey-100); border-color: transparent; }
.cl-btned__cell:hover .cl-btned__type { display: none; }
.cl-btned__remove {
  position: absolute;
  top: 0;
  right: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-4);
  color: var(--text-primary);
  opacity: .5;
  cursor: pointer;
}
.cl-btned__cell:hover .cl-btned__remove, .cl-btned__remove:focus-visible { display: flex; }
.cl-btned__remove:hover { opacity: 1; }
.cl-btned__note { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--text-caption); }
.cl-btned__plus { margin-top: 1px; }
.cl-btned__source { padding: 6px 0 10px; font-size: 14px; line-height: 20px; color: var(--text-caption); }
.cl-btned__add .cl-btn__label { overflow: visible; }

/* Перетаскивание: оторванная кнопка следует за курсором, на месте вставки — серая заглушка */
.cl-btned__placeholder { flex: 1 1 0; min-width: 0; height: 36px; border-radius: var(--radius-6); background: var(--w-drop-placeholder); }
.cl-btned__ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-tooltip);
  margin: 0;
  box-shadow: var(--shadow-dropdown);
  pointer-events: none;
  cursor: grabbing;
}
.cl-btned.is-dragging, .cl-btned.is-dragging * { cursor: grabbing; user-select: none; }
.cl-btned.is-dragging .cl-btned__cell { pointer-events: none; }

/* Тип клавиатуры: три сегмента столбиком */
.cl-btned__keyboard {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  padding: 3px;
  border-radius: var(--radius-6);
  background: var(--grey-100);
}
.cl-btned__seg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 29px;
  border-radius: var(--radius-4);
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 20px;
  color: var(--text-caption);
  cursor: pointer;
  transition: background-color var(--duration-tab), color var(--duration-tab), box-shadow var(--duration-tab);
}
.cl-btned__seg.is-active { background: var(--white); color: var(--text-primary); box-shadow: var(--w-shadow-segment-soft); }
.cl-btned__seg:focus-visible { outline: 2px solid var(--border-brand); outline-offset: -2px; }

/* «Расширенные настройки» */
.cl-btned__more {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 17px;
  color: var(--text-secondary);
  cursor: pointer;
}
.cl-btned__more:hover { color: var(--text-primary); }
.cl-btned__advanced { display: flex; flex-direction: column; margin-top: 8px; }
.cl-btned__toggles { display: flex; flex-direction: column; margin-bottom: 4px; }
.cl-btned__toggles .cl-toggle { padding: 7px 0; }
.cl-btned__label { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; font-size: 14px; line-height: 18px; color: var(--text-primary); }
.cl-btned__copy { margin-left: auto; }
.cl-btned__advanced textarea.cl-input__control { padding: 5px 5px 0 10px; font-family: var(--font-mono); font-size: 13px; }

/* Мастер рассылки */
.cl-btned--mailing .cl-btned__head { margin-bottom: 12px; }
.cl-btned--mailing .cl-btned__title { font-size: 16px; font-weight: var(--font-weight-semibold); line-height: 22px; }
.cl-btned__advlink { font-size: 13px; font-weight: var(--font-weight-medium); line-height: 18px; color: var(--text-brand); cursor: pointer; transition: color var(--duration-button); }
.cl-btned__advlink:hover { color: var(--link-brand-text-hover); }
.cl-btned--mailing .cl-btned__add { border-radius: var(--radius-8); }
.cl-btned--mailing .cl-btned__add:not(:disabled) { color: var(--text-brand); }
.cl-btned--mailing .cl-btned__kind { align-self: flex-start; margin-top: 12px; }
.cl-btned--mailing .cl-btned__advanced { margin-top: 12px; }

/* Окно кнопки */
.cl-btndlg__count { position: absolute; top: 0; right: 16px; font-size: 14px; line-height: 40px; color: var(--text-caption); pointer-events: none; }
.cl-btndlg .cl-select__trigger { border-color: var(--border-primary-default); }
.cl-btndlg .cl-select.is-open .cl-select__trigger, .cl-btndlg .cl-select__trigger:focus { border-color: var(--input-solid-border-focused); }
.cl-btndlg__extra { display: flex; flex-direction: column; gap: 16px; }
.cl-btndlg__palette { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-btndlg__swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-6);
  background: var(--swatch, var(--white));
  color: var(--white);
  cursor: pointer;
  transition: box-shadow var(--duration-row);
}
.cl-btndlg__swatch .cl-icon { opacity: 0; transition: opacity var(--duration-row); }
.cl-btndlg__swatch:hover { box-shadow: 0 0 0 1px var(--white), 0 0 0 2px var(--grey-400); }
/* Выбранный цвет: галочка и двойное кольцо (белое + цвет образца) */
.cl-btndlg__swatch.is-selected { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--swatch, var(--grey-400)); }
.cl-btndlg__swatch.is-selected .cl-icon { opacity: 1; }
.cl-btndlg__swatch--none { box-shadow: inset 0 0 0 1px var(--border-secondary-default); color: var(--text-primary); }
.cl-btndlg__swatch--none:hover { box-shadow: inset 0 0 0 1px var(--grey-400); }
.cl-btndlg__swatch--none.is-selected { box-shadow: inset 0 0 0 1px var(--border-secondary-default), 0 0 0 2px var(--white), 0 0 0 4px var(--grey-400); }
.cl-btndlg__color { width: 220px; }
.cl-btndlg__color .cl-input__control { padding-left: 48px; text-transform: uppercase; }
.cl-btndlg__pick { position: absolute; top: 8px; left: 12px; width: 24px; height: 24px; overflow: hidden; border-radius: var(--radius-4); cursor: pointer; }
.cl-btndlg__sample { display: block; width: 24px; height: 24px; border-radius: var(--radius-4); box-shadow: inset 0 0 0 1px var(--border-secondary-default); }
.cl-btndlg__sample.is-empty { background: linear-gradient(135deg, var(--white) 46%, var(--red-500) 46%, var(--red-500) 54%, var(--white) 54%); }
.cl-btndlg__native { position: absolute; inset: 0; width: 24px; height: 24px; padding: 0; border: 0; opacity: 0; cursor: pointer; }

/* ============ Редактор вложений ============ */
.cl-attach { display: flex; flex-direction: column; min-width: 0; }
.cl-attach__tabs { display: flex; gap: 12px; }
.cl-attach__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  color: var(--icon-primary-default);
  cursor: pointer;
  transition: background-color var(--duration-button), border-color var(--duration-button), color var(--duration-button);
}
.cl-attach__tab:hover { background: var(--grey-100); }
.cl-attach__tab.is-selected, .cl-attach__tab.is-selected:hover { background: var(--brand-100); border-color: var(--border-brand); color: var(--icon-brand); }

/* Область загрузки раскрывается плавно после выбора типа */
.cl-attach__collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--duration-panel); }
.cl-attach__collapse.is-open { grid-template-rows: 1fr; }
.cl-attach__collapse-inner { min-height: 0; overflow: hidden; }
.cl-attach__area {
  display: flex;
  flex-direction: column;
  min-height: 138px;
  margin: 12px 0 15px;
  border: 2px dashed var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  transition: background-color var(--duration-button);
}
.cl-attach__area.is-drag { background: var(--brand-100); }
.cl-attach__drop {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  min-height: 66px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
}
.cl-attach__drop .cl-icon { color: var(--grey-400); }
.cl-attach__url { flex: 1 1 auto; padding: 12px 16px; border-top: 1px solid var(--border-primary-default); }
.cl-attach__toggles { display: flex; flex-direction: column; }
.cl-attach__toggle { display: flex; align-items: center; gap: 4px; padding: 7px 0; }
.cl-attach__warn { margin-top: 8px; }

/* Карточки файлов */
.cl-attach__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 12px; }
.cl-attach__card { min-width: 0; }
.cl-attach__tile {
  position: relative;
  height: 100px;
  overflow: hidden;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
}
.cl-attach__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  color: var(--grey-400);
}
button.cl-attach__preview { cursor: pointer; }
.cl-attach__preview img, .cl-attach__preview video { width: 100%; height: 100%; object-fit: cover; }
.cl-attach__remove {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 0 var(--radius-6) 0 var(--radius-6);
  background: var(--w-file-remove);
  color: var(--white);
  cursor: pointer;
}
.cl-attach__name {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cl-attach__size { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 16px; color: var(--text-caption); }
.cl-attach__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 0 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--brand-500);
  text-align: center;
}
.cl-attach__loading span:not(.cl-progress):not(.cl-progress__fill):not(.cl-spinner) { color: var(--text-caption); }
.cl-attach__more {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  border: 1px dashed var(--border-secondary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  color: var(--grey-400);
  cursor: pointer;
  transition: background-color var(--duration-button), color var(--duration-button);
}
.cl-attach__more:hover { background: var(--grey-100); color: var(--icon-brand); }

/* Мастер рассылки */
.cl-attach__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cl-attach--mailing .cl-attach__title { display: flex; align-items: center; gap: 4px; font-size: 16px; font-weight: var(--font-weight-semibold); line-height: 22px; color: var(--text-primary); }
.cl-attach__stat { font-size: 13px; line-height: 18px; color: var(--text-caption); }
.cl-attach__choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border: 1px dashed var(--border-secondary-default);
  border-radius: var(--radius-10);
  background: var(--grey-50);
  transition: background-color var(--duration-button), border-color var(--duration-button);
}
.cl-attach__choice.is-drag { background: var(--brand-100); border-color: var(--border-brand); }
.cl-attach__choice-title { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); text-align: center; }
.cl-attach__types { display: flex; gap: 8px; max-width: 100%; }
.cl-attach .cl-attach__type { --btn-h: 36px; --btn-pad: 12px; width: 132px; border-radius: var(--radius-8); }
.cl-attach .cl-attach__type:not(.is-selected):not(:disabled) { color: var(--text-secondary); }
.cl-attach .cl-attach__type--image { width: 148px; }
.cl-attach .cl-attach__type--link { width: 568px; max-width: 100%; }
.cl-attach--mailing .cl-attach__area { margin-bottom: 0; }
.cl-attach--mailing .cl-attach__toggles { margin-top: 8px; }

/* ============ Перечень с галочками ============ */
.cl-msel { position: relative; display: block; min-width: 0; }
.cl-msel__field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 3px 30px 3px 6px;
  border: 1px solid var(--border-secondary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--duration-input) ease-out;
}
.cl-msel.is-filled .cl-msel__field { padding-right: 56px; }
.cl-msel__field:focus, .cl-msel.is-open .cl-msel__field { border-color: var(--input-solid-border-focused); }
.cl-msel.is-error .cl-msel__field { border-color: var(--border-error); }
.cl-msel.is-disabled .cl-msel__field { border-color: var(--border-primary-default); background: var(--grey-50); cursor: not-allowed; }
.cl-msel__values { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.cl-msel__placeholder, .cl-msel__text {
  min-width: 0;
  padding-left: 9px;
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-msel__placeholder { color: var(--text-placeholder); }
.cl-msel__text { color: var(--text-primary); }
.cl-msel__chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 2px 4px;
  border-radius: var(--radius-5);
  background: var(--brand-90);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
}
.cl-msel__chip-label { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-msel__chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-4);
  color: var(--grey-500);
  opacity: .7;
  cursor: pointer;
  transition: opacity var(--duration-row);
}
.cl-msel__chip-remove:hover { opacity: 1; }
.cl-msel__chevron, .cl-msel__clear { position: absolute; top: 50%; display: flex; width: 20px; height: 20px; margin-top: -10px; }
.cl-msel__chevron { right: 9px; color: var(--icon-primary-default); pointer-events: none; transition: transform var(--duration-input); }
.cl-msel.is-open .cl-msel__chevron { transform: rotate(180deg); }
.cl-msel__clear { right: 32px; align-items: center; justify-content: center; border-radius: var(--radius-4); color: var(--grey-400); cursor: pointer; }
.cl-msel__clear:hover { color: var(--icon-primary-default); }
.cl-msel__below { margin-top: 8px; }

.cl-msel-list {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  padding: 6px;
  border: 1px solid var(--border-secondary-default);
  border-radius: var(--radius-12);
  background: var(--white);
  box-shadow: var(--w-shadow-select);
}
.cl-msel-list--inline { max-height: 320px; box-shadow: none; }
.cl-msel-list__search { flex: none; margin: 6px 6px 8px; }
.cl-msel-list__items { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.cl-msel-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-8);
  font-size: 14px;
  font-weight: var(--font-weight-regular);
  line-height: 20px;
  color: var(--text-primary);
  cursor: pointer;
}
.cl-msel-opt:hover, .cl-msel-opt.is-active { background: var(--grey-60); }
.cl-msel-opt.is-selected { background: var(--brand-90); }
.cl-msel-opt.is-disabled { color: var(--text-option-disabled); background: transparent; cursor: not-allowed; }
.cl-msel-opt__box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-5);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--border-primary-default);
  color: var(--white);
}
.cl-msel-opt__box .cl-icon { opacity: 0; }
.cl-msel-opt.is-selected .cl-msel-opt__box { background: var(--controls-active-background-default); box-shadow: none; }
.cl-msel-opt.is-selected .cl-msel-opt__box .cl-icon { opacity: 1; }
.cl-msel-opt__color { flex: none; width: 12px; height: 12px; margin-right: -4px; border-radius: 3px; }
.cl-msel-opt .cl-icon { flex: none; }
.cl-msel-opt__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-msel-opt__hint { flex: none; color: var(--text-caption); }
.cl-msel-list__title {
  padding: 8px 12px 2px;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-caption);
}
.cl-msel-list__empty { padding: 9px 12px; font-size: 14px; line-height: 22px; color: var(--text-caption); }
.cl-msel-list__create { display: flex; flex-direction: column; gap: 8px; flex: none; margin-top: 6px; padding: 8px 6px 2px; border-top: 1px solid var(--border-tertiary-default); }
.cl-msel-list__create-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 6px;
  border-radius: var(--radius-8);
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 20px;
  color: var(--text-brand);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-row);
}
.cl-msel-list__create-btn:hover { background: var(--brand-75); }
.cl-msel-list__create-btn:disabled { color: var(--text-disabled); background: none; }
.cl-msel-list__create-btn span { min-width: 0; overflow-wrap: anywhere; }
.cl-msel-list__hint { padding: 0 6px 4px; font-size: 12px; line-height: 16px; color: var(--text-caption); }

/* ============ Построитель отбора клиентов ============ */
.cl-fbuild { display: flex; flex-direction: column; min-width: 0; }

/* Диалоги: столбик полей */
.cl-fbuild--dialogs { gap: 12px; }
.cl-fbuild--dialogs .cl-field__label { color: var(--text-caption); }
.cl-fbuild--dialogs > .cl-check { align-self: flex-start; }
.cl-fbuild__dates { display: flex; flex-direction: column; gap: 8px; }
.cl-fbuild__range { display: flex; align-items: center; gap: 8px; }
.cl-fbuild__range > .cl-field { flex: 1 1 0; }
.cl-fbuild__dash { flex: none; color: var(--text-caption); }

/* Рассылки: сетка в две колонки */
.cl-fbuild--mailing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.cl-fbuild__wide { grid-column: 1 / -1; min-width: 0; }
.cl-fbuild__panel { padding: 10px 14px; border-radius: var(--radius-10); background: var(--grey-50); }
.cl-fbuild__panel .cl-toggle { gap: 8px; font-size: 15px; font-weight: var(--font-weight-medium); color: var(--text-primary); }
.cl-fbuild__panel-note { margin-left: 44px; font-size: 13px; line-height: 18px; color: var(--text-caption); }

/* Списки: раскрывающиеся блоки */
.cl-fbuild__title {
  padding: 4px 0 12px;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 20px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-caption);
}
.cl-fbuild__acc { margin-bottom: 10px; border: 1px solid var(--border-primary-default); border-radius: var(--radius-10); background: var(--white); }
.cl-fbuild__acc:last-child { margin-bottom: 0; }
.cl-fbuild__acc-head {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 47px;
  padding: 13px 15px;
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-row);
}
.cl-fbuild__acc-head > .cl-icon:first-child { color: var(--icon-primary-default); }
.cl-fbuild__acc.is-open .cl-fbuild__acc-head { border-radius: 9px 9px 0 0; background: var(--grey-50); }
.cl-fbuild__acc-name { flex: none; font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); }
.cl-fbuild__acc-note { min-width: 0; overflow: hidden; font-size: 14px; line-height: 20px; color: var(--text-caption); text-overflow: ellipsis; white-space: nowrap; }
.cl-fbuild__acc-chevron { margin-left: auto; color: var(--grey-400); transition: transform var(--duration-input); }
.cl-fbuild__acc.is-open .cl-fbuild__acc-chevron { transform: rotate(180deg); }
.cl-fbuild__acc-body { display: none; flex-direction: column; gap: 12px; padding: 8px 15px 16px; border-top: 1px solid var(--border-tertiary-default); }
.cl-fbuild__acc.is-open .cl-fbuild__acc-body { display: flex; }
.cl-fbuild--lists .cl-field__label { color: var(--grey-500); }
.cl-fbuild__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.cl-fbuild__cols > [hidden] + .cl-field { grid-column: 1 / -1; }
.cl-fbuild__flags { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

/* Строки «переменная — оператор — значение» */
.cl-fvars { display: flex; flex-direction: column; gap: 8px; }
.cl-fvars__row { display: flex; align-items: center; gap: 10px; }
.cl-fvars__name, .cl-fvars__value { flex: 1 1 0; min-width: 0; }
.cl-fvars .cl-input__control { padding: 8px 12px; border-color: var(--border-primary-default); }
.cl-fvars .cl-input__control:focus { border-color: var(--input-solid-border-focused); }
.cl-fvars .cl-fvars__value .cl-input__control { padding-right: 40px; }
.cl-fvars__op {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-5);
  background: var(--brand-100);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 24px;
  color: var(--text-brand);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--duration-button);
}
.cl-fvars__op:hover { background: var(--brand-200); }
.cl-fvars--wide .cl-fvars__row { gap: 16px; }
.cl-fvars--wide .cl-input__control { border-color: var(--border-secondary-default); }
.cl-fvars--wide .cl-fvars__add { border-radius: var(--radius-8); }
.cl-fvars__ops {
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  box-shadow: var(--shadow-dropdown);
}
.cl-fvars__opt {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-5);
  background: var(--grey-100);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 24px;
  color: var(--text-caption);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--duration-button), color var(--duration-button);
}
.cl-fvars__opt:hover, .cl-fvars__opt.is-selected { background: var(--brand-100); color: var(--text-brand); }

/* ============ Выбор каналов ============ */
.cl-chanpick--tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cl-chanpick__tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--w-radius-dialog);
  background: var(--white);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-button), border-color var(--duration-button);
}
.cl-chanpick__tile:hover { border-color: var(--border-brand); }
.cl-chanpick__tile.is-selected { border-color: var(--border-brand); background: var(--brand-90); }
.cl-chanpick__tile:focus-visible, .cl-chanpick__chip:focus-visible { outline: 2px solid var(--border-brand); outline-offset: 1px; }
.cl-chanpick__body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.cl-chanpick__name { overflow: hidden; font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); text-overflow: ellipsis; white-space: nowrap; }
.cl-chanpick__meta { overflow: hidden; font-size: 14px; line-height: 20px; color: var(--text-caption); text-overflow: ellipsis; white-space: nowrap; }
.cl-chanpick__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-5);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--border-primary-default);
  color: var(--white);
}
.cl-chanpick__mark .cl-icon { opacity: 0; }
.cl-chanpick__tile.is-selected .cl-chanpick__mark { background: var(--controls-active-background-default); box-shadow: none; }
.cl-chanpick__tile.is-selected .cl-chanpick__mark .cl-icon { opacity: 1; }
.cl-chanpick__mark--radio { border-radius: 50%; box-shadow: inset 0 0 0 2px var(--border-primary-default); }
.cl-chanpick__mark--radio i { width: 9px; height: 9px; border-radius: 50%; }
.cl-chanpick__tile.is-selected .cl-chanpick__mark--radio { background: var(--white); box-shadow: inset 0 0 0 2px var(--border-brand); }
.cl-chanpick__tile.is-selected .cl-chanpick__mark--radio i { background: var(--brand-500); }
.cl-chanpick--chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-chanpick__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 34px;
  padding: 0 14px 0 6px;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--duration-tab), border-color var(--duration-tab), color var(--duration-tab);
}
.cl-chanpick__chip:hover { background: var(--grey-50); }
.cl-chanpick__chip.is-selected { background: var(--brand-100); border-color: var(--brand-300); color: var(--text-brand); }
.cl-chanpick__chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-chanpick__dot { display: flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 50%; color: var(--white); }
.cl-chanpick__dot--telegram { background: var(--messenger-telegram); }
.cl-chanpick__dot--vk { background: var(--messenger-vk); }
.cl-chanpick__empty { font-size: 14px; line-height: 20px; color: var(--text-caption); }

/* ============ Окно выбора блока воронки ============ */
.cl-overlay.cl-overlay--blockpick { padding: 43px 36px; background: var(--w-overlay-dark); }
.cl-modal.cl-blockpick {
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  border-radius: var(--radius-6);
  background: var(--brand-50);
  box-shadow: var(--w-shadow-wide);
}
.cl-blockpick .cl-modal__header { height: 53px; padding: 0 13px 0 20px; border-bottom: 0; background: var(--grey-200); }
.cl-blockpick .cl-modal__title { line-height: 19px; }
.cl-blockpick .cl-modal__close { --ib-size: 27px; }
.cl-blockpick .cl-modal__close:hover { background: var(--grey-300); }
.cl-blockpick .cl-modal__body { gap: 0; padding: 0; overflow: hidden; }
.cl-blockpick__layout { display: flex; flex: 1 1 auto; min-height: 0; }
.cl-blockpick__side {
  display: flex;
  flex-direction: column;
  flex: none;
  width: 330px;
  padding: 16px 0;
  overflow-y: auto;
  border-right: 1px solid var(--border-primary-default);
}
.cl-blockpick__search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 40px;
  margin: 0 20px 12px;
  padding: 0 12px;
  border-radius: var(--radius-6);
  background: var(--grey-100);
  color: var(--grey-400);
  cursor: text;
}
.cl-blockpick__search-input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; font-size: 14px; line-height: 20px; color: var(--text-primary); }
.cl-blockpick__list { display: flex; flex-direction: column; flex: none; }
.cl-blockpick__heading { padding: 16px 20px 8px; font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-caption); }
.cl-blockpick__item {
  display: flex;
  align-items: center;
  flex: none;
  width: 100%;
  height: 40px;
  padding: 10.5px 40px 10.5px 20px;
  font-size: 14px;
  line-height: 19px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-row);
}
.cl-blockpick__item:hover { background: var(--grey-100); }
.cl-blockpick__item.is-selected { background: var(--grey-200); }
.cl-blockpick__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 316px);
  grid-auto-rows: 170px;
  gap: 16px;
  align-content: start;
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px 20px;
  overflow-y: auto;
}
.cl-blockpick__grid.is-center { display: flex; align-items: center; justify-content: center; }
.cl-blockpick__card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 316px;
  height: 170px;
  overflow: hidden;
  border: 1px solid var(--border-primary-default);
  border-radius: var(--radius-6);
  background: var(--white);
  color: var(--text-primary);
  cursor: pointer;
  transition: box-shadow var(--duration-button);
}
.cl-blockpick__card:hover { box-shadow: var(--shadow-dropdown); }
.cl-blockpick__card:focus-visible { outline: 2px solid var(--border-brand); outline-offset: 1px; }
.cl-blockpick__card.is-selected { box-shadow: 0 0 0 2px var(--border-brand); }
.cl-blockpick__card--k4 { border-color: var(--w-block-start-border); background: var(--w-block-start-background); color: var(--green-700); }
.cl-blockpick__text {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 40px 12px 16px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cl-blockpick__star { position: absolute; top: 8px; right: 8px; display: flex; width: 24px; height: 24px; color: var(--grey-300); cursor: pointer; transition: color var(--duration-button); }
.cl-blockpick__star:hover, .cl-blockpick__star.is-on { color: var(--w-star); }
.cl-blockpick__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 40px;
  padding: 11px 16px;
  border-top: 1px solid var(--border-primary-default);
  background: var(--white);
  font-size: 14px;
  line-height: 18px;
  color: var(--text-caption);
}
.cl-blockpick__foot b { flex: none; font-weight: var(--font-weight-semibold); color: var(--text-primary); }
.cl-blockpick__empty { font-size: 14px; line-height: 20px; color: var(--text-caption); }
.cl-blockpick__progress.cl-progress { width: 320px; height: 8px; }
.cl-blockpick__progress.is-running .cl-progress__fill { width: 40% !important; animation: cl-loading-bar 2s ease-in-out infinite; }

/* ============ Разметка текста в предпросмотре ============ */
.cl-markup__spoiler { border-radius: 3px; background: var(--grey-300); color: transparent; transition: color var(--duration-button), background-color var(--duration-button); }
.cl-markup__spoiler:hover { background: var(--grey-100); color: inherit; }
.cl-markup__link { color: var(--w-chat-send); overflow-wrap: anywhere; }
.cl-markup__code, .cl-markup__pre { border-radius: 3px; background: var(--alpha-black-05); font-family: var(--font-mono); font-size: .93em; }
.cl-markup__code { padding: 0 3px; }
.cl-markup__pre { margin: 2px 0; padding: 4px 6px; white-space: pre-wrap; }
.cl-markup__quote { margin: 2px 0; padding-left: 8px; border-left: 3px solid var(--w-chat-send); }

/* ============ Предпросмотр сообщения в виде чата ============ */
.cl-chatpv { display: flex; flex-direction: column; min-width: 0; }
.cl-chatpv__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cl-chatpv__title { font-size: 16px; font-weight: var(--font-weight-medium); line-height: 22px; color: var(--text-primary); }
.cl-chatpv__switch .cl-tab { width: 32px; height: 28px; padding: 0; opacity: .55; }
.cl-chatpv__switch .cl-tab.is-active, .cl-chatpv__switch .cl-tab:hover { opacity: 1; }
.cl-chatpv__switch .cl-tab .cl-icon { width: 20px; height: 20px; }
.cl-chatpv__switch .cl-tab__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cl-chatpv__phone { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-primary-default); border-radius: var(--radius-12); background: var(--white); }
.cl-chatpv__screen {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 12px;
  background: linear-gradient(180deg, var(--w-chat-background-light), var(--w-chat-background));
}
.cl-chatpv__day {
  align-self: center;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--w-chat-plate);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 16px;
  color: var(--white);
}
.cl-chatpv__feed { display: flex; flex-direction: column; gap: 4px; }
.cl-chatpv__msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.cl-chatpv__msg--bot { align-self: flex-start; }
.cl-chatpv__msg--client { align-self: flex-end; }
.cl-chatpv__col { display: flex; flex-direction: column; min-width: 0; max-width: 340px; }
.cl-chatpv__msg--client .cl-chatpv__col { align-items: flex-end; }
.cl-chatpv__bubble {
  position: relative;
  align-self: flex-start;
  min-width: 76px;
  max-width: 100%;
  padding: 6px 10px 18px;
  border-radius: 12px 12px 12px 4px;
  background: var(--white);
  box-shadow: var(--w-chat-bubble-shadow);
}
.cl-chatpv__text { font-size: 15px; line-height: 20px; color: var(--black); white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-chatpv__text.is-placeholder { color: var(--w-chat-muted); }
.cl-chatpv__time { position: absolute; right: 8px; bottom: 3px; font-size: 11px; line-height: 14px; color: var(--w-chat-muted); }

/* Вложения в пузыре */
.cl-chatpv__media { display: block; width: 260px; max-width: calc(100% + 20px); margin: -6px -10px 6px; overflow: hidden; border-radius: 12px 12px 0 0; background: var(--grey-200); }
.cl-chatpv__bubble > .cl-chatpv__text + .cl-chatpv__media { margin: 6px -10px -2px; border-radius: 0; }
.cl-chatpv__media img { width: 100%; max-height: 240px; object-fit: cover; }
.cl-chatpv__media--grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
.cl-chatpv__media--grid img { height: 96px; }
.cl-chatpv__media-stub, .cl-chatpv__video { display: flex; align-items: center; justify-content: center; width: 100%; height: 140px; color: var(--grey-400); }
.cl-chatpv__media--grid .cl-chatpv__media-stub, .cl-chatpv__media--grid .cl-chatpv__video { height: 96px; }
.cl-chatpv__video { background: var(--grey-800); }
.cl-chatpv__play { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--w-chat-send); color: var(--white); }
.cl-chatpv__files, .cl-chatpv__links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; font-size: 14px; line-height: 20px; }
.cl-chatpv__file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cl-chatpv__file-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: var(--radius-6); background: var(--grey-100); color: var(--icon-primary-default); }
.cl-chatpv__file-name { display: -webkit-box; min-width: 0; overflow: hidden; font-size: 14px; line-height: 18px; color: var(--text-primary); overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Кнопки: «в тексте» — под пузырём, клавиатура — полосой над строкой ввода */
.cl-chatpv__buttons { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cl-chatpv__buttons--inline { align-self: stretch; min-width: 200px; margin-top: 4px; }
.cl-chatpv__brow { display: flex; gap: 4px; }
.cl-chatpv__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-6);
  background: var(--w-chat-plate);
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 18px;
  color: var(--white);
  text-align: center;
}
button.cl-chatpv__btn { cursor: pointer; }
.cl-chatpv__btn-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-chatpv__btn-mark { position: absolute; top: 3px; right: 3px; opacity: .8; }
.cl-chatpv__keyboard-slot { padding: 6px; border-top: 1px solid var(--border-primary-default); background: var(--w-chat-input); }
.cl-chatpv__buttons--keyboard .cl-chatpv__btn { background: var(--white); box-shadow: var(--w-chat-bubble-shadow); color: var(--black); }
.cl-chatpv__input { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border-primary-default); background: var(--white); }
.cl-chatpv__field { flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--w-chat-input); font-size: 14px; line-height: 36px; color: var(--w-chat-muted); }
.cl-chatpv__send { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--w-chat-send); color: var(--white); }

/* Оформление ВКонтакте: светлый экран, серый пузырь, кнопки четырёх цветов */
.cl-chatpv[data-messenger="vk"] .cl-chatpv__screen { background: var(--white); }
.cl-chatpv[data-messenger="vk"] .cl-chatpv__day { background: transparent; color: var(--w-chat-muted); }
.cl-chatpv[data-messenger="vk"] .cl-chatpv__bubble { border-radius: 16px 16px 16px 4px; background: var(--grey-100); box-shadow: none; }
.cl-chatpv[data-messenger="vk"] .cl-chatpv__send { background: var(--w-vk-primary); }
.cl-chatpv__buttons[data-messenger="vk"] .cl-chatpv__btn { border-radius: var(--radius-8); box-shadow: none; }
.cl-chatpv__buttons .cl-chatpv__btn--primary { background: var(--w-vk-primary); color: var(--white); }
.cl-chatpv__buttons .cl-chatpv__btn--negative { background: var(--w-vk-negative); color: var(--white); }
.cl-chatpv__buttons .cl-chatpv__btn--positive { background: var(--w-vk-positive); color: var(--white); }
.cl-chatpv__buttons .cl-chatpv__btn--secondary { background: var(--w-vk-secondary); color: var(--text-primary); }

/* Вид ленты «Тестирование бота» */
.cl-chatpv--test .cl-chatpv__phone { border: 0; border-radius: 0; background: transparent; }
.cl-chatpv--test .cl-chatpv__screen { min-height: 0; padding: 16px; border-radius: var(--radius-12) var(--radius-12) 0 0; background: var(--grey-50); }
.cl-chatpv--test .cl-chatpv__day, .cl-chatpv--test .cl-chatpv__input { display: none; }
.cl-chatpv--test .cl-chatpv__keyboard-slot { padding: 0 16px; border: 0; background: var(--grey-50); }
.cl-chatpv__msg--test { align-items: flex-start; gap: 8px; }
.cl-chatpv__msg--test .cl-chatpv__col { max-width: 325px; }
.cl-chatpv__msg--test.cl-chatpv__msg--client .cl-chatpv__col { max-width: 360px; }
.cl-chatpv__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 2px var(--white);
  color: var(--white);
}
.cl-chatpv__msg--test .cl-chatpv__bubble { min-width: 0; padding: 8px 16px; border-radius: 12px 12px 12px 2px; box-shadow: var(--w-test-shadow); }
.cl-chatpv__msg--test .cl-chatpv__text { display: inline; font-size: 14px; line-height: 20px; color: var(--w-test-text); }
.cl-chatpv__msg--test .cl-chatpv__time { position: static; float: right; margin: 6px 0 0 12px; font-size: 12px; color: var(--grey-400); }
.cl-chatpv__msg--test.cl-chatpv__msg--client .cl-chatpv__bubble { border-radius: 12px 12px 2px 12px; background: var(--brand-600); box-shadow: var(--w-test-client-shadow); }
.cl-chatpv__msg--test.cl-chatpv__msg--client .cl-chatpv__text { color: var(--white); }
.cl-chatpv__msg--test.cl-chatpv__msg--client .cl-chatpv__time { color: var(--white); opacity: .8; }
.cl-chatpv__msg--test .cl-chatpv__media { width: 300px; max-width: calc(100% + 28px); margin: -6px -14px 6px; border-radius: 10px; }
.cl-chatpv__msg--test .cl-chatpv__buttons--inline { gap: 6px; margin-top: 13px; }
.cl-chatpv__buttons--test .cl-chatpv__brow { gap: 6px; }
.cl-chatpv__buttons--test .cl-chatpv__btn {
  padding: 8px 16px;
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-12);
  background: var(--white);
  box-shadow: none;
  color: var(--text-brand);
}
.cl-chatpv__buttons--test.cl-chatpv__buttons--keyboard { gap: 6px; max-height: 200px; padding: 5px; overflow-y: auto; border-radius: var(--radius-12) var(--radius-12) 0 0; background: var(--white); }

/* ============ Витрина виджетов (#/_widgets) ============ */
.cl-wdemo__cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.cl-wdemo__col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cl-wdemo__note { max-width: 760px; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
/* Колонка шириной с правую панель конструктора: поля 12 → содержимое 355 px */
.cl-wdemo__panel { display: flex; flex-direction: column; gap: 8px; width: 381px; padding: 12px; border: 1px solid var(--border-primary-default); border-radius: var(--radius-12); background: var(--white); }
.cl-wdemo__card { width: 822px; max-width: 100%; padding: 16px; border: 1px solid var(--border-primary-default); border-radius: var(--radius-12); background: var(--white); }
.cl-wdemo__box { border: 1px solid var(--border-primary-default); border-radius: var(--radius-12); background: var(--white); }
.cl-wdemo__json {
  width: 360px;
  max-width: 100%;
  max-height: 420px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: var(--radius-8);
  background: var(--grey-50);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 17px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cl-wdemo__json--wide { width: 100%; }
