/* Раздел «Каналы». Размеры и цвета — по docs/spec/50-channels.md; свои тени — токены --ch-* в конце tokens.css. */

/* ============ Страница ============ */
/* Место под полосу прокрутки занято всегда: колонка не прыгает, когда карточек становится много */
.cl-ch-scroll { background: var(--white); scrollbar-gutter: stable; }
.cl-ch {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  font-size: 14px;
  line-height: 21px;
  color: var(--text-primary);
}
.cl-ch__heading {
  margin: 0;
  font-size: 16px;
  font-weight: var(--font-weight-regular);
  line-height: 21px;
  color: var(--text-caption);
}

/* Плитки «подключить нового» */
.cl-ch__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-top: 16px;
  padding-bottom: 16px;
}
.cl-ch-tile {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 20px 0 10px;
  border: 0;
  border-radius: var(--radius-6);
  color: var(--white);
  cursor: pointer;
  transition: box-shadow .5s;
}
.cl-ch-tile--tg { background: var(--messenger-telegram); }
.cl-ch-tile--vk { background: var(--messenger-vk); }
.cl-ch-tile--tg:hover, .cl-ch-tile--tg:focus-visible { box-shadow: var(--ch-tile-shadow-telegram); }
.cl-ch-tile--vk:hover, .cl-ch-tile--vk:focus-visible { box-shadow: var(--ch-tile-shadow-vk); }
.cl-ch-tile .cl-ch-glyph { flex: none; }
.cl-ch-tile__label {
  margin: 0 auto;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 21px;
  text-shadow: var(--ch-tile-text-shadow);
}

/* Знак мессенджера в квадрате его цвета */
.cl-ch-glyph { display: block; pointer-events: none; user-select: none; }
.cl-ch-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-12);
  color: var(--white);
}
.cl-ch-icon--s { border-radius: var(--radius-8); }
.cl-ch-icon--tg { background: var(--messenger-telegram); }
.cl-ch-icon--vk { background: var(--messenger-vk); }

/* ============ Группа и карточка канала ============ */
.cl-ch-group__title { margin: 24px 0 16px; }
.cl-ch-card { overflow: hidden; }
.cl-ch-card__body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 180px; }
.cl-ch-card__title {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  max-width: 100%;
  text-decoration: none;
  transition: color var(--duration-row);
}
.cl-ch-card__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-ch-card__title .cl-icon { flex: none; color: var(--grey-400); }
a.cl-ch-card__title:hover .cl-ch-card__name, a.cl-ch-card__title:focus-visible .cl-ch-card__name { color: var(--text-brand); }
.cl-ch-card__sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 14px;
  line-height: 21px;
  color: var(--text-caption);
}
.cl-ch-sep { margin: 0 2px; color: var(--grey-400); }
.cl-ch-card__status { display: flex; justify-content: flex-start; flex: 0 0 208px; }
.cl-ch-card__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; min-width: 282px; }

/* Полоса-предупреждение с причиной сбоя */
.cl-ch-card__warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-primary-default);
  background: var(--grey-50);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-caption);
}
.cl-ch-card__warn .cl-icon { flex: none; }
.cl-ch-card__warn--red { background: var(--red-100); color: var(--red-700); }
.cl-ch-card__warn--orange { background: var(--orange-50); color: var(--orange-800); }

/* Полоса «Ссылки этого бота» */
.cl-ch-links { border-top: 1px solid var(--border-primary-default); }
.cl-ch-links__head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  padding: 8px 20px;
  cursor: pointer;
  user-select: none;
}
.cl-ch-links__head:focus-visible { outline: none; background: var(--grey-50); }
.cl-ch-links__chevron { flex: none; color: var(--grey-500); transition: transform var(--duration-row), color var(--duration-row); }
.cl-ch-links.is-open .cl-ch-links__chevron { color: var(--icon-brand); transform: rotate(90deg); }
.cl-ch-links__title { font-size: 14px; line-height: 21px; color: var(--text-brand); }
.cl-ch-links__count { margin-left: 4px; }
.cl-ch-links__add { margin-left: auto; }

.cl-ch-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 97px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-primary-default);
}
.cl-ch-link__body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.cl-ch-link__top { display: flex; align-items: center; gap: 8px; min-height: 26px; min-width: 0; }
.cl-ch-link__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  line-height: 21px;
  color: var(--text-primary);
}
.cl-ch-link__tag {
  flex: none;
  max-width: 50%;
  height: 26px;
  padding: 3px 12px;
  overflow: hidden;
  border-radius: var(--radius-4);
  background: var(--brand-100);
  font-size: 12px;
  line-height: 20px;
  color: var(--text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-ch-link__url {
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  line-height: 21px;
  color: var(--text-brand);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-ch-link__url:hover { text-decoration: underline; }
.cl-ch-link__meta { overflow: hidden; font-size: 14px; line-height: 21px; color: var(--text-caption); text-overflow: ellipsis; white-space: nowrap; }
.cl-ch-link__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.cl-iconbtn.cl-ch-link__copy { border-radius: 9px; }
.cl-iconbtn.cl-ch-link__copy:hover { border-color: var(--border-secondary-default); background: var(--grey-50); }

/* ============ Меню «Ещё» и меню ссылки ============ */
.cl-menu.cl-ch-menu {
  min-width: 210px;
  max-width: 280px;
  padding: 6px;
  border-radius: var(--radius-12);
  box-shadow: var(--ch-menu-shadow);
  animation: cl-ch-menu-in .12s ease-out;
}
.cl-ch-menu .cl-menu__item {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: var(--radius-8);
  white-space: normal;
}
.cl-ch-menu .cl-menu__label { overflow: visible; overflow-wrap: anywhere; }
.cl-ch-menu .cl-menu__item--danger:hover, .cl-ch-menu .cl-menu__item--danger:focus { background: var(--red-100); }
.cl-ch-menu .cl-menu__divider { margin: 6px 4px; }
.cl-menu.cl-ch-menu--link { max-width: 320px; box-shadow: var(--ch-link-menu-shadow); }
.cl-ch-menu--link .cl-menu__item { padding: 9px 12px; color: var(--text-secondary); }
.cl-ch-menu--link .cl-menu__item--danger { color: var(--text-danger); }
@keyframes cl-ch-menu-in {
  from { transform: translateY(-4px) scale(.98); }
  to { transform: none; }
}

/* ============ Окна раздела ============ */
.cl-ch-modal .cl-modal__body { gap: 0; }
.cl-ch-modal .cl-toggle { gap: 8px; }
.cl-btn.cl-ch-cancel { padding: 1px 6px; }
.cl-ch-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.cl-ch-b { font-weight: var(--font-weight-medium); color: var(--text-secondary); }
.cl-ch-a { color: var(--text-brand); text-decoration: none; transition: color var(--duration-row); }
.cl-ch-a:hover { color: var(--link-brand-text-hover); }
.cl-ch-plate {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-4);
  background: var(--grey-100);
  color: var(--text-caption);
}

/* Поле токена или ключа: подпись с указателем, поле, ошибка, подсказка */
.cl-ch-token__labels { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.cl-ch-token__label { font-size: 14px; line-height: 20px; color: var(--text-primary); }
.cl-ch-token__pointer { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 18px; color: var(--text-brand); }
.cl-ch-token .cl-input.is-error .cl-input__control { border-color: var(--red-600); }
.cl-ch-token__error { margin-top: 6px; font-size: 14px; line-height: 18px; color: var(--red-700); overflow-wrap: anywhere; }
.cl-ch-token__warn { margin-top: 8px; }
.cl-ch-token__hint { margin: 6px 0 14px; font-size: 14px; line-height: 18px; color: var(--grey-500); }
/* Ключ ВКонтакте вне фокуса скрыт точками (значение при этом остаётся обычным текстом) */
.cl-ch-token.is-masked .cl-input__control { -webkit-text-security: disc; }

/* Окно подключения: слева форма 540, справа инструкция 460 */
.cl-modal.cl-ch-connect { overflow: hidden; }
.cl-ch-connect > .cl-modal__header, .cl-ch-connect > .cl-modal__footer { display: none; }
.cl-ch-connect > .cl-modal__body { flex-direction: row; padding: 0; overflow: hidden; }
.cl-ch-connect__form { display: flex; flex-direction: column; flex: 0 0 54%; min-width: 0; overflow-y: auto; }
.cl-ch-connect__head { display: flex; align-items: center; gap: 8px; flex: none; height: 56px; padding: 18px 22px 4px; }
.cl-ch-connect__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: var(--font-weight-medium);
  line-height: 20px;
  color: var(--text-primary);
}
.cl-ch-connect__fields { flex: 1 0 auto; padding: 14px 22px 0; }
.cl-ch-connect__intro { margin-bottom: 18px; font-size: 14px; line-height: 20px; color: var(--grey-500); }
.cl-ch-connect__toggle { display: flex; margin: 15px 0; }
.cl-ch-connect__note { margin: 15px 0; font-size: 14px; line-height: 18px; color: var(--text-caption); }
.cl-ch-connect__foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
  padding: 14px 22px;
  border-top: 1px solid var(--border-primary-default);
  background: var(--white);
}

.cl-ch-guide {
  display: flex;
  flex-direction: column;
  flex: 0 0 46%;
  min-width: 0;
  padding: 22px 24px;
  overflow-y: auto;
  border-left: 1px solid var(--border-primary-default);
  background: var(--grey-60);
}
.cl-ch-guide__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cl-ch-guide__title { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); }
.cl-ch-guide__time {
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--border-primary-default);
  border-radius: 100px;
  background: var(--white);
  font-size: 14px;
  line-height: 18px;
  color: var(--grey-500);
}
.cl-ch-steps { position: relative; margin: 12px 0 0; padding: 0; list-style: none; }
.cl-ch-steps::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 13px;
  width: 2px;
  background: var(--border-primary-default);
}
.cl-ch-step { position: relative; display: flex; gap: 13px; padding: 9px 0; }
.cl-ch-step__num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-primary-default);
  border-radius: 50%;
  background: var(--white);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 18px;
  color: var(--grey-600);
}
.cl-ch-step:last-child .cl-ch-step__num {
  border-color: var(--brand-500);
  background: var(--brand-500);
  box-shadow: var(--ch-step-ring);
  color: var(--white);
}
.cl-ch-step__body { min-width: 0; }
.cl-ch-step__title { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); }
.cl-ch-step__text { margin-top: 4px; font-size: 14px; line-height: 18px; color: var(--grey-500); }
.cl-ch-guide__more { margin-top: auto; padding-top: 14px; }
.cl-ch-guide__more-inner { padding-top: 14px; border-top: 1px solid var(--border-primary-default); font-size: 14px; line-height: 21px; }

/* «Параметры канала» ВКонтакте */
.cl-ch-vkset > .cl-modal__header { height: auto; }
.cl-ch-vkset > .cl-modal__header .cl-modal__title { display: none; }
.cl-ch-vkset__head { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.cl-ch-vkset__titles { display: flex; flex-direction: column; min-width: 0; }
.cl-ch-vkset__title { font-size: 16px; font-weight: var(--font-weight-medium); line-height: 22px; color: var(--text-primary); }
.cl-ch-vkset__sub { font-size: 12px; line-height: 18px; color: var(--text-caption); }
.cl-ch-vkset__info { margin-bottom: 14px; font-size: 14px; line-height: 20px; color: var(--text-caption); overflow-wrap: anywhere; }
.cl-ch-vkset__group + .cl-ch-vkset__group { margin-top: 20px; }
.cl-ch-vkset__group-title { margin-bottom: 8px; font-size: 12px; line-height: 18px; color: var(--text-caption); }
.cl-ch-vkset__toggles { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.cl-ch-vkset__note { margin-top: 20px; font-size: 14px; line-height: 18px; color: var(--text-caption); }

/* «Токен» / «Ключ доступа» */
.cl-ch-secret__value {
  padding: 10px 12px;
  border-radius: var(--radius-6);
  background: var(--grey-100);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  user-select: all;
}
.cl-ch-secret__text { margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--text-caption); }

/* «Новая ссылка» */
.cl-ch-linkform { display: flex; flex-direction: column; gap: 16px; }
.cl-ch-linkform__preview { margin-top: 6px; font-size: 14px; line-height: 20px; color: var(--text-caption); overflow-wrap: anywhere; }

/* «Удаление бота» */
.cl-modal.cl-ch-delete > .cl-modal__body { padding: 20px; }
.cl-ch-delete__question { font-size: 14px; line-height: 20px; color: var(--text-primary); overflow-wrap: anywhere; }
.cl-ch-delete__meta { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--grey-500); }
.cl-ch-delete__options { margin-top: 16px; }
.cl-ch-delete__options .cl-check__dot { width: 10px; height: 10px; }
.cl-ch-delete__target { margin-top: 12px; }

/* ============ Карточка «Google Таблицы» ============ */
.cl-ch-icon--sheets { background: var(--success-solid); }
.cl-ch-sheets .cl-ch-card__status { flex-basis: auto; }
/* Поля адреса и секрета с кнопками в одну строку; кнопки стоят вровень с полями (подпись поля — 20 + 5 px) */
.cl-ch-sheets__form {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border-primary-default);
}
.cl-ch-sheets__buttons { display: flex; align-items: center; gap: 8px; margin-top: 25px; }
.cl-btn.cl-ch-sheets__off { padding: 1px 6px; color: var(--text-caption); }
.cl-ch-sheets .cl-field__hint { overflow-wrap: anywhere; }
/* Секрет вне фокуса скрыт точками (значение при этом остаётся обычным текстом) */
.cl-ch-sheets__secret.is-masked .cl-input__control { -webkit-text-security: disc; }
.cl-ch-sheets__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.cl-ch-card__warn--green { background: var(--success-background); color: var(--success-text); }
.cl-btn.cl-ch-sheets__retry { display: inline-flex; padding: 0 2px; vertical-align: baseline; color: inherit; text-decoration: underline; }

/* «Таблицы проекта»: список привязанных таблиц и строка привязки по ссылке */
.cl-ch-tables { padding: 14px 20px 16px; border-top: 1px solid var(--border-primary-default); }
.cl-ch-tables__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cl-ch-tables__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cl-ch-tables__title { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); }
.cl-ch-tables__sub, .cl-ch-tables__version { font-size: 14px; line-height: 20px; color: var(--text-caption); }
.cl-ch-tables__version { flex: none; white-space: nowrap; }
.cl-ch-tables__hint { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-6); background: var(--grey-50); font-size: 14px; line-height: 20px; color: var(--text-caption); overflow-wrap: anywhere; }
.cl-ch-tables__list { margin-top: 10px; border: 1px solid var(--border-primary-default); border-radius: var(--radius-8); }
.cl-ch-tables__row { display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 8px 8px 8px 14px; }
.cl-ch-tables__row + .cl-ch-tables__row { border-top: 1px solid var(--border-primary-default); }
.cl-ch-tables__row.is-loose { background: var(--orange-50); }
.cl-ch-tables__names { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.cl-ch-tables__name, .cl-ch-tables__google { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-ch-tables__name { font-size: 14px; font-weight: var(--font-weight-medium); line-height: 20px; color: var(--text-primary); }
.cl-ch-tables__google { font-size: 12px; line-height: 16px; color: var(--text-caption); }
.cl-ch-tables__meta { flex: none; font-size: 14px; line-height: 20px; color: var(--text-caption); white-space: nowrap; }
.cl-ch-tables__open { flex: none; font-size: 14px; line-height: 20px; }
.cl-ch-tables__actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; flex: none; min-width: 78px; }
.cl-ch-tables__empty { padding: 14px; font-size: 14px; line-height: 20px; color: var(--text-caption); }
.cl-ch-tables__form { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) auto; align-items: start; gap: 12px; margin-top: 12px; }
.cl-ch-tables .cl-field__hint { overflow-wrap: anywhere; }
