/* ============================================================================
   communities.css — v144 «Сообщества: редизайн с нуля»
   Подключается ПОСЛЕДНИМ, поэтому перекрывает style.css / redesign.css.

   Идея:
     • раскладка как в Discord: рейл серверов → каналы → контент → участники
     • мессенджер внутри сообществ выглядит как вкладка «Чаты» (пузыри)
     • микро-анимации в духе amicro: пружины, stagger, pop-in, ripple
     • телефон — первоклассный сценарий: экраны, шторки, safe-area, 44px

   Оглавление:
     0. Токены и утилиты движения
     1. Каркас (.cm-wrap) и колонки
     2. Рейл сообществ (.cm-rail)
     3. Панель каналов (.cm-side)
     4. Голосовые каналы + плашка звонка
     5. Участники (.cm-members-panel)
     6. Шапка канала (.cm-chat-head)
     7. Лента сообщений — стиль мессенджера (пузыри)
     8. Композер (.cm-compose)
     9. Пустые состояния, скелетоны, модалки
    10. Телефон (≤900px) и мелкие экраны (≤430px)
    11. Доступность и prefers-reduced-motion
   ========================================================================== */

/* ---------------------------------------------------------------------------
   0. ТОКЕНЫ
   ------------------------------------------------------------------------- */
body.view-communities {
  --cm-rail-w: 74px;
  --cm-side-w: 252px;
  --cm-mem-w: 268px;

  --cm-bg: #08080a;
  --cm-rail-bg: #050506;
  --cm-side-bg: #0d0d10;
  --cm-main-bg: #0a0a0c;
  --cm-mem-bg: #0c0c0f;

  --cm-s1: rgba(255, 255, 255, .035);
  --cm-s2: rgba(255, 255, 255, .065);
  --cm-s3: rgba(255, 255, 255, .10);
  --cm-ln: rgba(255, 255, 255, .07);
  --cm-ln2: rgba(255, 255, 255, .13);

  --cm-tx: #f4f4f6;
  --cm-tx2: rgba(255, 255, 255, .62);
  --cm-tx3: rgba(255, 255, 255, .40);

  --cm-voice: #5eead4;
  --cm-bad: #f87171;

  /* пузыри — те же, что во вкладке «Чаты» */
  --cm-in-bg: linear-gradient(180deg, #232328 0%, #1b1b1f 100%);
  --cm-out-bg: linear-gradient(180deg, #fafafa 0%, #eaeaec 100%);

  --cm-r-sm: 12px;
  --cm-r-md: 16px;
  --cm-r-lg: 22px;

  --cm-spring: cubic-bezier(.34, 1.46, .48, 1);
  --cm-soft: cubic-bezier(.22, 1, .36, 1);
  --cm-ui: cubic-bezier(.25, .8, .35, 1);

  --cm-el1: 0 1px 2px rgba(0, 0, 0, .45);
  --cm-el2: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  --cm-el3: 0 28px 72px rgba(0, 0, 0, .66), 0 4px 14px rgba(0, 0, 0, .45);
}

/* ---- ключевые кадры (микро-анимации) ---- */
@keyframes cmRise      { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes cmSlideIn   { from { opacity: 0; transform: translateX(-10px) }            to { opacity: 1; transform: none } }
@keyframes cmPopIn     { from { opacity: 0; transform: translateY(12px) scale(.96) }  to { opacity: 1; transform: none } }
@keyframes cmPopInMine { from { opacity: 0; transform: translateY(12px) translateX(10px) scale(.96) } to { opacity: 1; transform: none } }
@keyframes cmFade      { from { opacity: 0 } to { opacity: 1 } }
@keyframes cmPulse     { 0%, 100% { opacity: .35 } 50% { opacity: 1 } }
@keyframes cmShimmer   { 0% { background-position: -420px 0 } 100% { background-position: 420px 0 } }
@keyframes cmRing      { 0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, .45) } 70% { box-shadow: 0 0 0 10px rgba(94, 234, 212, 0) } 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0) } }
@keyframes cmFlash     { 0% { background: rgba(255, 255, 255, .16) } 100% { background: transparent } }
@keyframes cmSheetUp   { from { opacity: 0; transform: translateY(28px) } to { opacity: 1; transform: none } }

/* ---------------------------------------------------------------------------
   1. КАРКАС
   ------------------------------------------------------------------------- */
body.view-communities .view { overflow: hidden; }

.cm-wrap {
  display: grid !important;
  grid-template-columns: var(--cm-rail-w) var(--cm-side-w) minmax(0, 1fr) var(--cm-mem-w);
  height: 100%;
  min-height: 0;
  background: var(--cm-bg);
}
.cm-wrap > * { min-width: 0; min-height: 0; }

.cm-main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--cm-main-bg);
  position: relative;
}
/* мягкое свечение фона — чат перестаёт быть «плоской дырой» */
.cm-main::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 420px at 8% -12%, rgba(255, 255, 255, .045), transparent 60%),
    radial-gradient(680px 420px at 100% 112%, rgba(255, 255, 255, .03), transparent 62%);
}
.cm-main > * { position: relative; z-index: 1; }

/* ---------------------------------------------------------------------------
   2. РЕЙЛ СООБЩЕСТВ (Discord-style)
   ------------------------------------------------------------------------- */
.cm-rail {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 12px 0 16px;
  background: var(--cm-rail-bg);
  border-right: 1px solid var(--cm-ln);
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.cm-rail::-webkit-scrollbar { width: 0; display: none; }

.cm-rail-item {
  position: relative;
  width: 48px; height: 48px;
  flex: 0 0 auto;
  border: 0; padding: 0; margin: 0;
  border-radius: 16px;
  background: var(--cm-s2);
  color: var(--cm-tx);
  font: inherit; font-size: 16px; font-weight: 700; letter-spacing: -.02em;
  display: grid; place-items: center;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: border-radius .28s var(--cm-spring), background .18s var(--cm-ui),
              transform .26s var(--cm-spring), box-shadow .2s var(--cm-ui);
  animation: cmRise .34s var(--cm-soft) both;
}
.cm-rail-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-rail-item:hover { border-radius: 14px; background: var(--cm-s3); transform: translateY(-2px) scale(1.04); }
.cm-rail-item:active { transform: scale(.94); }
.cm-rail-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.cm-rail-item.active {
  border-radius: 15px;
  background: #fff; color: #0a0a0b;
  box-shadow: 0 6px 18px rgba(255, 255, 255, .16);
}
/* «пилюля» слева — фирменный индикатор Discord, но с пружиной */
.cm-rail-item::before {
  content: ''; position: absolute; left: -13px; top: 50%;
  width: 4px; height: 8px; border-radius: 0 4px 4px 0;
  background: #fff; opacity: 0;
  transform: translateY(-50%) scaleY(.3);
  transition: opacity .18s var(--cm-ui), height .3s var(--cm-spring), transform .3s var(--cm-spring);
}
.cm-rail-item:hover::before { opacity: .55; height: 18px; transform: translateY(-50%) scaleY(1); }
.cm-rail-item.active::before { opacity: 1; height: 28px; transform: translateY(-50%) scaleY(1); }
.cm-rail-item.in-voice { box-shadow: 0 0 0 2px var(--cm-voice); }

/* подсказка с названием */
.cm-rail-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%) translateX(-6px) scale(.96);
  padding: 7px 11px; border-radius: 10px;
  background: rgba(20, 20, 24, .96);
  border: 1px solid var(--cm-ln2);
  box-shadow: var(--cm-el2);
  color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; pointer-events: none; z-index: 60;
  opacity: 0;
  transition: opacity .16s var(--cm-ui), transform .26s var(--cm-spring);
}
.cm-rail-item[data-tip]:hover::after { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }

.cm-rail-sep { width: 30px; height: 1px; background: var(--cm-ln2); margin: 4px 0; flex: 0 0 auto; }

.cm-rail-item.ghost {
  background: var(--cm-s1);
  color: var(--cm-tx2);
  box-shadow: inset 0 0 0 1px var(--cm-ln);
}
.cm-rail-item.ghost:hover { color: #fff; background: var(--cm-s2); }
.cm-rail-item.ghost .material-symbols-outlined { font-size: 23px; transition: transform .32s var(--cm-spring); }
.cm-rail-item.add:hover .material-symbols-outlined { transform: rotate(90deg); }
.cm-rail-item.find:hover .material-symbols-outlined { transform: rotate(-18deg) scale(1.08); }

/* ---------------------------------------------------------------------------
   3. ПАНЕЛЬ КАНАЛОВ
   ------------------------------------------------------------------------- */
.cm-side {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  width: auto !important;
  background: var(--cm-side-bg);
  border-right: 1px solid var(--cm-ln);
  overflow: hidden;
}
.cm-side:empty { display: none; }

.cm-side-head {
  flex: 0 0 auto;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--cm-ln);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0));
}
.cm-side-title {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 46px;
  padding: 8px 10px;
  border: 0; border-radius: var(--cm-r-sm);
  background: transparent; color: var(--cm-tx);
  font: inherit; font-size: 15.5px; font-weight: 700; letter-spacing: -.02em;
  text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s var(--cm-ui), transform .2s var(--cm-spring);
}
.cm-side-title .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-side-title .material-symbols-outlined { font-size: 20px; color: var(--cm-tx2); transition: transform .3s var(--cm-spring); }
.cm-side-title:hover { background: var(--cm-s2); }
.cm-side-title:hover .material-symbols-outlined { transform: translateY(2px); }
.cm-side-title:active { transform: scale(.985); }

.cm-side-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 10px 8px 18px;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin;
}
.cm-side-scroll::-webkit-scrollbar { width: 6px; }
.cm-side-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .10); border-radius: 99px; }
.cm-side-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); }

.cm-group { display: flex; flex-direction: column; gap: 2px; margin: 0; animation: cmSlideIn .3s var(--cm-soft) both; }
.cm-group-h, .cm-sec-h {
  display: flex; align-items: center; gap: 8px;
  min-height: 26px; padding: 2px 8px 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--cm-tx3);
  transition: color .16s var(--cm-ui);
}
.cm-group:hover .cm-group-h, .cm-sec:hover .cm-sec-h { color: var(--cm-tx2); }
.cm-group-h > span, .cm-sec-nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cm-add-ch, .cm-sec-x {
  width: 24px; height: 24px; min-width: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; padding: 0;
  background: transparent; color: var(--cm-tx3); cursor: pointer;
  transition: background .15s var(--cm-ui), color .15s var(--cm-ui), transform .24s var(--cm-spring), opacity .15s;
}
.cm-add-ch:hover { background: var(--cm-s2); color: #fff; transform: rotate(90deg); }
.cm-sec-x { opacity: 0; }
.cm-sec:hover .cm-sec-x { opacity: .7; }
.cm-sec-x:hover { opacity: 1; color: var(--cm-bad); background: rgba(248, 113, 113, .14); transform: scale(1.12); }
.cm-add-ch .material-symbols-outlined, .cm-sec-x .material-symbols-outlined { font-size: 18px; line-height: 1; }

/* ---- строка канала ---- */
.cm-chan {
  position: relative;
  display: grid !important;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  align-items: center; gap: 9px;
  width: calc(100% - 4px);
  min-height: 38px;
  margin: 0 2px;
  padding: 7px 10px;
  border: 0; border-radius: var(--cm-r-sm);
  background: transparent;
  color: var(--cm-tx2);
  font: inherit; font-size: 14px; font-weight: 550; letter-spacing: -.012em;
  text-align: left; cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s var(--cm-ui), color .16s var(--cm-ui), transform .22s var(--cm-spring);
  animation: cmSlideIn .3s var(--cm-soft) both;
}
.cm-chan::before {
  content: ''; position: absolute; left: 0; top: 50%;
  width: 3px; height: 0; border-radius: 0 3px 3px 0;
  background: #fff;
  transform: translateY(-50%);
  transition: height .3s var(--cm-spring);
}
.cm-chan:hover { background: var(--cm-s1); color: var(--cm-tx); transform: translateX(2px); }
.cm-chan:active { transform: translateX(2px) scale(.985); }
.cm-chan:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .28); }
.cm-chan.active {
  background: var(--cm-s2);
  color: #fff; font-weight: 680;
  box-shadow: inset 0 0 0 1px var(--cm-ln);
}
.cm-chan.active::before { height: 20px; }

.cm-chan-hash {
  width: 22px; min-width: 22px; height: 22px;
  display: inline-flex !important; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; opacity: .5;
  transition: opacity .16s var(--cm-ui), transform .24s var(--cm-spring);
}
.cm-chan-hash .material-symbols-outlined { font-size: 18px; line-height: 1; }
.cm-chan:hover .cm-chan-hash { opacity: .9; transform: scale(1.06); }
.cm-chan.active .cm-chan-hash { opacity: 1; }
.cm-chan-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cm-chan-x {
  width: 22px; min-width: 22px; height: 22px;
  display: inline-flex !important; align-items: center; justify-content: center;
  border-radius: 7px; opacity: 0; color: var(--cm-tx3);
  transition: opacity .15s, color .15s, background .15s, transform .22s var(--cm-spring);
}
.cm-chan:hover .cm-chan-x { opacity: .6; }
.cm-chan-x:hover { opacity: 1 !important; color: var(--cm-bad); background: rgba(248, 113, 113, .14); transform: scale(1.14); }
.cm-chan-x .material-symbols-outlined { font-size: 15px; }

/* drag & drop сохраняется — просто выглядит аккуратнее */
.cm-chan.dragging { opacity: .4; }
.cm-chan.drop-before { box-shadow: inset 0 3px 0 0 #fff; }
.cm-chan.drop-after { box-shadow: inset 0 -3px 0 0 #fff; }
.cm-sec.drop-zone, .cm-group.drop-zone {
  outline: 1px dashed rgba(255, 255, 255, .28); outline-offset: 3px; border-radius: var(--cm-r-md);
}

/* ---------------------------------------------------------------------------
   4. ГОЛОСОВЫЕ КАНАЛЫ
   ------------------------------------------------------------------------- */
.cm-vc-block { display: flex; flex-direction: column; padding: 0; border-radius: var(--cm-r-md); transition: background .2s var(--cm-ui); }
.cm-vc-block.joined { background: rgba(94, 234, 212, .06); box-shadow: inset 0 0 0 1px rgba(94, 234, 212, .18); }
.cm-vc-block.joined > .cm-chan { color: #d6fff6; }
.cm-vc-block.joined > .cm-chan .cm-chan-hash { color: var(--cm-voice); opacity: 1; }

.cm-vc-count {
  min-width: 20px; height: 19px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 99px; background: var(--cm-s2);
  font-size: 11px; font-weight: 700; color: var(--cm-tx2);
  font-variant-numeric: tabular-nums;
}
.cm-vc-block.joined .cm-vc-count { color: #062b26; background: var(--cm-voice); }

.cm-vc-watch {
  display: flex; align-items: center; gap: 6px;
  margin: 2px 8px 4px 34px; padding: 5px 9px;
  border-radius: 9px; background: var(--cm-s1);
  font-size: 11.5px; color: var(--cm-tx2);
  min-width: 0;
}
.cm-vc-watch span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-vc-watch .material-symbols-outlined { font-size: 15px; color: var(--cm-voice); }

.cm-vc-users { display: flex; flex-direction: column; gap: 1px; padding: 0 6px 6px 30px; min-width: 0; }
.cm-vc-user {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; min-height: 32px; padding: 4px 8px;
  border-radius: 9px; cursor: pointer;
  font-size: 13px; color: var(--cm-tx2);
  transition: background .15s var(--cm-ui), color .15s, transform .2s var(--cm-spring);
  animation: cmFade .26s var(--cm-soft) both;
}
.cm-vc-user:hover { background: var(--cm-s1); color: #fff; transform: translateX(2px); }
.cm-vc-user .av { flex: 0 0 auto; box-shadow: 0 0 0 0 rgba(94, 234, 212, .6); transition: box-shadow .2s; }
.cm-vc-user.speaking .av { box-shadow: 0 0 0 2px var(--cm-voice); }
.cm-vc-user .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-vc-user.muted { color: var(--cm-tx3); }
.cm-vc-user.muted .av { opacity: .55; filter: grayscale(.4); }
.cm-vc-user .vc-ic { display: grid; place-items: center; flex: 0 0 auto; }
.cm-vc-user .vc-ic .material-symbols-outlined { font-size: 14px; }
.cm-vc-user.muted .vc-ic { color: var(--cm-bad); }
.cm-vc-user .vc-ic.screen { color: var(--cm-voice); }

/* плашка звонка внизу панели */
#cmVoiceBar { flex: 0 0 auto; min-width: 0; padding: 0 8px 8px; }
.vc-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px; border-radius: var(--cm-r-md);
  background: linear-gradient(180deg, rgba(24, 44, 41, .95), rgba(14, 24, 23, .95));
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, .22), var(--cm-el2);
  animation: cmRise .3s var(--cm-soft) both;
}
.vc-bar-info {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 100%; min-width: 0;
  background: transparent; border: 0; padding: 0; cursor: pointer; color: var(--cm-tx);
  text-align: left;
}
.vc-bar-info .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--cm-voice);
}
.vc-bar-info .t { display: flex; flex-direction: column; min-width: 0; }
.vc-bar-info .t b { font-size: 13px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-bar-info .t i { font-size: 11px; font-style: normal; color: var(--cm-voice); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-bar-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.vc-bar-btns button {
  height: 38px; width: 100%;
  display: grid; place-items: center;
  border: 0; border-radius: 11px;
  background: var(--cm-s2); color: var(--cm-tx); cursor: pointer;
  transition: background .15s var(--cm-ui), transform .2s var(--cm-spring), color .15s;
}
.vc-bar-btns button:hover { background: var(--cm-s3); transform: translateY(-1px); }
.vc-bar-btns button:active { transform: scale(.93); }
.vc-bar-btns button.on { background: rgba(248, 113, 113, .18); color: #ffb4b4; }
.vc-bar-btns button.hang { background: rgba(248, 113, 113, .9); color: #180a0a; }
.vc-bar-btns button.hang:hover { background: #ff8a8a; }

.cm-join-bar { flex: 0 0 auto; padding: 10px; border-top: 1px solid var(--cm-ln); }
.cm-join-bar .btn { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------------------
   5. УЧАСТНИКИ
   ------------------------------------------------------------------------- */
.cm-members-panel {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  padding: 0;
  background: var(--cm-mem-bg);
  border-left: 1px solid var(--cm-ln);
  overflow: hidden;
}
.cm-members-panel:empty { display: none; }
.cm-members-head {
  flex: 0 0 auto;
  padding: 16px 14px 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--cm-tx3);
}
.cm-members-list {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0 8px 18px;
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin;
}
.cm-members-list::-webkit-scrollbar { width: 6px; }
.cm-members-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 99px; }

.cm-member {
  display: flex; align-items: center; gap: 9px;
  min-width: 0; min-height: 40px;
  padding: 6px 9px; border-radius: var(--cm-r-sm);
  color: var(--cm-tx2); font-size: 13.5px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s var(--cm-ui), color .16s, transform .22s var(--cm-spring);
  animation: cmSlideIn .3s var(--cm-soft) both;
}
.cm-member:hover { background: var(--cm-s1); color: #fff; transform: translateX(2px); }
.cm-member:active { transform: scale(.985); }
.cm-member .av { flex: 0 0 auto; }
.cm-member .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.cm-role {
  flex: 0 0 auto; padding: 2px 7px; border-radius: 99px;
  background: var(--cm-s2); color: var(--cm-tx3);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}

/* stagger — до 14 строк, дальше без задержки */
.cm-chan:nth-child(1),  .cm-member:nth-child(1)  { animation-delay: .01s }
.cm-chan:nth-child(2),  .cm-member:nth-child(2)  { animation-delay: .03s }
.cm-chan:nth-child(3),  .cm-member:nth-child(3)  { animation-delay: .05s }
.cm-chan:nth-child(4),  .cm-member:nth-child(4)  { animation-delay: .07s }
.cm-chan:nth-child(5),  .cm-member:nth-child(5)  { animation-delay: .09s }
.cm-chan:nth-child(6),  .cm-member:nth-child(6)  { animation-delay: .11s }
.cm-chan:nth-child(7),  .cm-member:nth-child(7)  { animation-delay: .13s }
.cm-chan:nth-child(8),  .cm-member:nth-child(8)  { animation-delay: .15s }
.cm-chan:nth-child(n+9), .cm-member:nth-child(n+9) { animation-delay: .17s }
.cm-rail-item:nth-child(1) { animation-delay: .02s }
.cm-rail-item:nth-child(2) { animation-delay: .05s }
.cm-rail-item:nth-child(3) { animation-delay: .08s }
.cm-rail-item:nth-child(4) { animation-delay: .11s }
.cm-rail-item:nth-child(n+5) { animation-delay: .14s }

/* ---------------------------------------------------------------------------
   6. ШАПКА КАНАЛА
   ------------------------------------------------------------------------- */
.cm-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.cm-chat.drop::after {
  content: 'Отпустите файл'; position: absolute; inset: 10px; z-index: 20;
  display: grid; place-items: center;
  border: 2px dashed rgba(255, 255, 255, .35); border-radius: var(--cm-r-lg);
  background: rgba(10, 10, 12, .7); backdrop-filter: blur(6px);
  font-size: 14px; font-weight: 600; color: #fff;
  animation: cmFade .16s var(--cm-ui) both;
}

.cm-chat-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  min-height: 56px; padding: 10px 14px;
  border-bottom: 1px solid var(--cm-ln);
  background: rgba(12, 12, 15, .72);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  position: sticky; top: 0; z-index: 6;
  animation: cmFade .3s var(--cm-soft) both;
}
.cm-chat-head .h { color: var(--cm-tx3); font-size: 18px; font-weight: 700; }
.cm-chat-head .nm {
  font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; color: #fff;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cm-chat-head .tp {
  min-width: 0; padding-left: 11px; margin-left: 3px;
  border-left: 1px solid var(--cm-ln2);
  color: var(--cm-tx3); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cm-head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cm-head-btn {
  width: 38px; height: 38px; min-width: 38px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px; padding: 0;
  background: transparent; color: var(--cm-tx2); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s var(--cm-ui), color .15s, transform .22s var(--cm-spring);
}
.cm-head-btn:hover { background: var(--cm-s2); color: #fff; transform: translateY(-1px); }
.cm-head-btn:active { transform: scale(.92); }
.cm-head-btn.on { background: var(--cm-s3); color: #fff; }
.cm-head-btn .material-symbols-outlined { font-size: 21px; }

.cm-back {
  display: none;
  width: 38px; height: 38px; min-width: 38px;
  place-items: center;
  border: 0; border-radius: 12px; padding: 0;
  background: transparent; color: var(--cm-tx); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s var(--cm-ui), transform .2s var(--cm-spring);
}
.cm-back:hover { background: var(--cm-s2); }
.cm-back:active { transform: scale(.9); }
.cm-back .material-symbols-outlined { font-size: 21px; }

/* ---------------------------------------------------------------------------
   7. ЛЕНТА СООБЩЕНИЙ — КАК ВО ВКЛАДКЕ «ЧАТЫ»
   ------------------------------------------------------------------------- */
.cm-msgs {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 18px 18px 12px;
  display: flex; flex-direction: column; gap: 3px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}
.cm-msgs::-webkit-scrollbar { width: 8px; display: block; }
.cm-msgs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .09); border-radius: 99px; }
.cm-msgs::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .18); }

/* липкая пилюля с датой — как в мессенджере */
.cm-day { position: sticky; top: 4px; z-index: 5; display: flex; justify-content: center; margin: 12px 0 6px; pointer-events: none; }
.cm-day span {
  padding: 5px 12px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--cm-tx2);
  background: rgba(18, 18, 21, .82); border: 1px solid var(--cm-ln);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--cm-el1);
}

/* строка сообщения: аватар + пузырь, свои — справа */
.cm-msg {
  display: flex; align-items: flex-end; gap: 8px;
  max-width: 100%;
  padding: 0; margin: 0;
  background: none !important;
  border-radius: 0;
  animation: cmPopIn .28s var(--cm-soft) both;
  position: relative;
}
.cm-msg.mine { flex-direction: row-reverse; animation-name: cmPopInMine; }
.cm-msg > .av {
  flex: 0 0 auto; width: 30px !important; height: 30px !important;
  font-size: 12px !important; cursor: pointer;
  margin-bottom: 2px;
  transition: transform .24s var(--cm-spring);
}
.cm-msg > .av:hover { transform: scale(1.08); }
.cm-msg.grouped > .av, .cm-msg.mine > .av { visibility: hidden; height: 0 !important; margin: 0; }
.cm-msg.mine > .av { display: none; }
.cm-msg.grouped { margin-top: -1px; }
.cm-msg.grouped:not(.mine) { padding-left: 38px; }
.cm-msg.grouped > .av { display: none; }

/* сам пузырь */
.cm-msg-body {
  position: relative;
  min-width: 0; max-width: min(660px, 78%);
  padding: 8px 13px 7px;
  border-radius: 20px;
  border: 1px solid var(--cm-ln);
  background: var(--cm-in-bg);
  color: #ececee;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transition: border-color .2s var(--cm-ui), transform .2s var(--cm-spring);
}
.cm-msg:not(.mine) .cm-msg-body { border-bottom-left-radius: 8px; }
.cm-msg:not(.mine):hover .cm-msg-body { border-color: var(--cm-ln2); }
.cm-msg.grouped:not(.mine) .cm-msg-body { border-bottom-left-radius: 20px; }
.cm-msg.mine .cm-msg-body {
  background: var(--cm-out-bg);
  color: #141417;
  border: 1px solid rgba(255, 255, 255, .14);
  border-bottom-right-radius: 8px;
}
.cm-msg.grouped.mine .cm-msg-body { border-bottom-right-radius: 20px; }

.cm-msg-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 2px; flex-wrap: wrap; }
.cm-msg-head .a {
  font-size: 12.5px; font-weight: 700; letter-spacing: -.01em;
  color: rgba(255, 255, 255, .78); cursor: pointer;
}
.cm-msg-head .a:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.cm-msg.mine .cm-msg-head .a { color: rgba(20, 20, 23, .66); }
.cm-msg.mine .cm-msg-head .a:hover { color: #141417; }
.cm-msg-head .t { font-size: 10.5px; color: rgba(255, 255, 255, .45); font-variant-numeric: tabular-nums; }
.cm-msg.mine .cm-msg-head .t { color: rgba(20, 20, 23, .5); }

.cm-msg-text { font-size: 14.8px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.cm-msg-text.big-emoji { font-size: 34px; line-height: 1.22; }
.cm-msg:not(.mine) .cm-msg-text a { color: #fff; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(255, 255, 255, .45); }
.cm-msg.mine .cm-msg-text a { color: #141417; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(20, 20, 23, .45); }

.cm-msg-time { display: block; margin-top: 2px; text-align: right; font-size: 10.5px; color: rgba(255, 255, 255, .45); font-variant-numeric: tabular-nums; }
.cm-msg.mine .cm-msg-time { color: rgba(20, 20, 23, .5); }

/* цитата */
.cm-msg-reply {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 5px; padding: 5px 9px;
  border-radius: 10px; border-left: 2px solid rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .07);
  font-size: 12.5px; color: rgba(255, 255, 255, .72);
  cursor: pointer; min-width: 0;
  transition: background .15s var(--cm-ui);
}
.cm-msg-reply:hover { background: rgba(255, 255, 255, .12); }
.cm-msg-reply b { color: #fff; font-weight: 650; flex: 0 0 auto; }
.cm-msg-reply span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-msg-reply .material-symbols-outlined { font-size: 15px; flex: 0 0 auto; opacity: .7; }
.cm-msg.mine .cm-msg-reply {
  border-left-color: rgba(20, 20, 23, .35);
  background: rgba(20, 20, 23, .09); color: rgba(20, 20, 23, .74);
}
.cm-msg.mine .cm-msg-reply b { color: #141417; }
.cm-msg.mine .cm-msg-reply:hover { background: rgba(20, 20, 23, .14); }

/* медиа / гифки / файлы */
.cm-msg-media { margin: 4px 0 2px; }
.cm-msg-media img {
  display: block; max-width: min(420px, 100%); max-height: 380px;
  width: auto; height: auto; border-radius: 14px; cursor: zoom-in;
  background: #000;
  transition: transform .28s var(--cm-spring), filter .2s;
}
.cm-msg-media img:hover { transform: scale(1.012); filter: brightness(1.05); }
.cm-msg-gif { display: block; max-width: min(320px, 100%); border-radius: 14px; margin: 2px 0; background: #000; }
.cm-msg-gif.gif-broken { display: none; }
.cm-msg-file {
  display: flex; align-items: center; gap: 9px;
  margin: 4px 0 2px; padding: 9px 11px;
  border-radius: 12px; text-decoration: none;
  background: rgba(255, 255, 255, .07); color: inherit;
  border: 1px solid var(--cm-ln); min-width: 0;
  transition: background .16s var(--cm-ui), transform .2s var(--cm-spring);
}
.cm-msg-file:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.cm-msg-file .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.cm-msg-file .sz { font-size: 11px; opacity: .6; flex: 0 0 auto; }
.cm-msg.mine .cm-msg-file { background: rgba(20, 20, 23, .08); border-color: rgba(20, 20, 23, .12); }
.cm-msg.mine .cm-msg-file:hover { background: rgba(20, 20, 23, .14); }

/* роли */
.cm-role-chip {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  color: var(--rc, #fff);
  background: color-mix(in srgb, var(--rc, #6c8cff) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc, #6c8cff) 40%, transparent);
}

/* действия у сообщения — стеклянная плашка, как в мессенджере */
.cm-msg-acts {
  align-self: center; flex: 0 0 auto;
  opacity: 0; transform: translateY(3px);
  transition: opacity .18s var(--cm-ui), transform .22s var(--cm-spring);
}
.cm-msg:hover .cm-msg-acts, .cm-msg:focus-within .cm-msg-acts { opacity: 1; transform: none; }
.cm-msg-more {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--cm-ln);
  background: rgba(20, 20, 23, .82); color: var(--cm-tx2); cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: background .15s var(--cm-ui), transform .2s var(--cm-spring), color .15s;
}
.cm-msg-more:hover { background: rgba(40, 40, 45, .95); color: #fff; transform: scale(1.08); }
.cm-msg-more:active { transform: scale(.92); }
.cm-msg-more .material-symbols-outlined { font-size: 18px; }

.cm-msg.flash .cm-msg-body { animation: cmFlash 1.2s var(--cm-ui) both; }

/* пилюля «к последним» */
.cm-down-btn {
  position: absolute; right: 20px; bottom: 106px; z-index: 8;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--cm-ln2);
  background: rgba(22, 22, 26, .88); color: #fff; cursor: pointer;
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: var(--cm-el2);
  opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none;
  transition: opacity .22s var(--cm-ui), transform .32s var(--cm-spring), background .16s;
}
.cm-down-btn.show { opacity: 1; transform: none; pointer-events: auto; }
.cm-down-btn:hover { background: rgba(38, 38, 44, .95); }
.cm-down-btn:active { transform: scale(.92); }

/* ---------------------------------------------------------------------------
   8. КОМПОЗЕР
   ------------------------------------------------------------------------- */
.cm-compose {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  background: rgba(11, 11, 14, .86);
  border-top: 1px solid var(--cm-ln);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.cm-compose.disabled {
  display: flex; align-items: center; justify-content: center;
  min-height: 62px; color: var(--cm-tx3); font-size: 13.5px;
}

.cm-reply-bar:not([hidden]) {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; padding: 8px 11px;
  border-radius: 14px; border-left: 3px solid #fff;
  background: var(--cm-s1);
  font-size: 12.5px; color: var(--cm-tx2);
  animation: cmRise .24s var(--cm-soft) both;
}
.cm-reply-name { font-weight: 700; color: #fff; flex: 0 0 auto; }
.cm-reply-preview { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-reply-icon { display: grid; place-items: center; opacity: .6; }
.cm-reply-icon .material-symbols-outlined { font-size: 17px; }
.cm-reply-close {
  margin-left: auto; flex: 0 0 auto;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--cm-tx2); cursor: pointer;
  transition: background .15s, color .15s, transform .2s var(--cm-spring);
}
.cm-reply-close:hover { background: var(--cm-s2); color: #fff; transform: rotate(90deg); }
.cm-reply-close .material-symbols-outlined { font-size: 17px; }

.cm-att-prev:not([hidden]) {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 8px; padding: 8px 10px;
  border-radius: 14px; background: var(--cm-s1); border: 1px solid var(--cm-ln);
  animation: cmRise .24s var(--cm-soft) both;
}
.cm-att-prev img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.cm-att-prev .fic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: var(--cm-s2); }
.cm-att-prev .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cm-att-x {
  width: 28px; height: 28px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--cm-tx2); cursor: pointer;
  transition: background .15s, color .15s, transform .2s var(--cm-spring);
}
.cm-att-x:hover { background: rgba(248, 113, 113, .16); color: var(--cm-bad); transform: rotate(90deg); }

.cm-compose-row {
  display: flex; align-items: flex-end; gap: 6px;
  width: 100%; min-width: 0;
  padding: 5px 6px 5px 5px;
  border-radius: 22px;
  background: var(--cm-s1);
  border: 1px solid var(--cm-ln2);
  transition: background .18s var(--cm-ui), border-color .18s var(--cm-ui), box-shadow .22s var(--cm-ui);
}
.cm-compose-row:focus-within {
  background: var(--cm-s2);
  border-color: rgba(255, 255, 255, .3);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .055);
}
.cm-compose textarea {
  flex: 1 1 auto; min-width: 0;
  min-height: 38px; max-height: 220px;
  padding: 9px 4px; margin: 0;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  color: var(--cm-tx); font: inherit; font-size: 14.8px; line-height: 1.45;
  resize: none; outline: none;
  scrollbar-width: thin;
}
.cm-compose textarea::placeholder { color: var(--cm-tx3); }

.cm-ic, .cm-plus {
  width: 38px; height: 38px; min-width: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; padding: 0;
  background: transparent; color: var(--cm-tx2); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s var(--cm-ui), color .15s, transform .22s var(--cm-spring);
}
.cm-ic:hover, .cm-plus:hover { background: var(--cm-s3); color: #fff; }
.cm-ic:active, .cm-plus:active { transform: scale(.9); }
.cm-ic .material-symbols-outlined, .cm-plus .material-symbols-outlined { font-size: 21px; transition: transform .28s var(--cm-spring); }
.cm-plus:hover .material-symbols-outlined { transform: rotate(90deg); }
.cm-ic-group { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.cm-send {
  width: 38px; height: 38px; min-width: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; padding: 0;
  background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .5);
  cursor: pointer;
  transition: background .18s var(--cm-ui), color .18s, transform .24s var(--cm-spring), box-shadow .2s;
}
.cm-send .material-symbols-outlined { font-size: 20px; }
.cm-send.ready { background: #fff; color: #0a0a0b; box-shadow: 0 4px 14px rgba(255, 255, 255, .18); }
.cm-send.ready:hover { transform: scale(1.07); background: #f2f2f2; }
.cm-send:active { transform: scale(.9); }

.cm-compose-hint {
  height: 0; overflow: hidden; opacity: 0;
  padding-left: 14px;
  font-size: 11px; color: var(--cm-tx3);
  transition: height .22s var(--cm-ui), opacity .22s var(--cm-ui), padding .22s;
}
.cm-compose:focus-within .cm-compose-hint { height: 18px; opacity: 1; padding-top: 5px; }

/* ---------------------------------------------------------------------------
   9. ПУСТЫЕ СОСТОЯНИЯ / СКЕЛЕТОНЫ / МОДАЛКИ
   ------------------------------------------------------------------------- */
.cm-empty {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 40px 24px; text-align: center;
  animation: cmRise .38s var(--cm-soft) both;
}
.cm-empty-ic {
  width: 78px; height: 78px; border-radius: 26px;
  display: grid; place-items: center; margin-bottom: 6px;
  background: var(--cm-s1); box-shadow: inset 0 0 0 1px var(--cm-ln);
}
.cm-empty-ic .material-symbols-outlined { font-size: 36px; color: var(--cm-tx2); }
.cm-empty h2 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -.03em; }
.cm-empty p { margin: 0; max-width: 400px; font-size: 13.8px; line-height: 1.55; color: var(--cm-tx2); }
.cm-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

.cm-empty-msgs {
  margin: auto; padding: 40px 16px; text-align: center;
  color: var(--cm-tx3); font-size: 13.5px;
  animation: cmFade .4s var(--cm-soft) both;
}

.cm-loading, .cm-none { padding: 18px; text-align: center; color: var(--cm-tx3); font-size: 13px; }

/* скелетон загрузки ленты */
.cm-skel { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.cm-skel-row { display: flex; gap: 10px; align-items: flex-end; }
.cm-skel-row.mine { flex-direction: row-reverse; }
.cm-skel-av, .cm-skel-b {
  background: linear-gradient(90deg, rgba(255, 255, 255, .05) 8%, rgba(255, 255, 255, .10) 18%, rgba(255, 255, 255, .05) 33%);
  background-size: 420px 100%;
  animation: cmShimmer 1.3s linear infinite;
}
.cm-skel-av { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; }
.cm-skel-b { height: 38px; border-radius: 18px; }

/* модалки сообществ */
.cm-modal-back {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 18px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: cmFade .2s var(--cm-ui) both;
}
.cm-modal {
  width: min(520px, 100%);
  border-radius: 24px;
  background: #0f0f13;
  border: 1px solid var(--cm-ln2);
  box-shadow: var(--cm-el3);
  overflow: hidden;
  animation: cmPopIn .32s var(--cm-spring) both;
}
.cm-modal-h {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--cm-ln);
  font-size: 16px; font-weight: 700; letter-spacing: -.025em;
}
.cm-modal-h .x {
  margin-left: auto; width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--cm-tx2); cursor: pointer;
  transition: background .15s, color .15s, transform .2s var(--cm-spring);
}
.cm-modal-h .x:hover { background: var(--cm-s2); color: #fff; transform: rotate(90deg); }
.cm-modal-b { padding: 18px; max-height: min(70vh, 620px); overflow-y: auto; }
.cm-l { display: block; margin: 14px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--cm-tx3); }
.cm-l:first-child { margin-top: 0; }
.cm-modal-b input[type="text"], .cm-modal-b input:not([type]) {
  width: 100%; height: 44px; padding: 0 13px;
  border-radius: 13px; border: 1px solid var(--cm-ln2);
  background: var(--cm-s1); color: var(--cm-tx); font: inherit; font-size: 14.5px;
  transition: border-color .16s, background .16s, box-shadow .2s;
}
.cm-modal-b input:focus { outline: none; border-color: rgba(255, 255, 255, .32); background: var(--cm-s2); box-shadow: 0 0 0 4px rgba(255, 255, 255, .05); }
.cm-check { display: flex; align-items: center; gap: 9px; margin-top: 14px; font-size: 13.5px; color: var(--cm-tx2); cursor: pointer; }
.cm-check input { width: 18px; height: 18px; accent-color: #fff; }
.cm-hint { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--cm-tx3); }
.cm-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.cm-modal-actions .btn { flex: 1 1 140px; justify-content: center; }

.cm-disc { display: flex; flex-direction: column; gap: 8px; }
.cm-disc-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px; border-radius: var(--cm-r-md);
  background: var(--cm-s1); border: 1px solid var(--cm-ln);
  transition: background .16s var(--cm-ui), border-color .16s, transform .22s var(--cm-spring);
  animation: cmRise .3s var(--cm-soft) both;
}
.cm-disc-row:hover { background: var(--cm-s2); border-color: var(--cm-ln2); transform: translateY(-2px); }
.cm-disc-row img, .cm-disc-row .ic {
  width: 44px; height: 44px; border-radius: 15px; flex: 0 0 auto;
  display: grid; place-items: center; object-fit: cover;
  background: var(--cm-s2); font-weight: 700; font-size: 16px;
}
.cm-disc-row .i { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cm-disc-row .i b { font-size: 14px; }
.cm-disc-row .i i, .cm-disc-row .i u {
  font-style: normal; text-decoration: none; font-size: 12px; color: var(--cm-tx3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   10. ТЕЛЕФОН
   ------------------------------------------------------------------------- */

/* ПК средней ширины: колонка участников по умолчанию скрыта (как в Discord),
   кнопка «Участники» в шапке канала открывает её панелью-оверлеем справа —
   раскладка при этом не едет: колонка уходит из потока. */
@media (min-width: 901px) and (max-width: 1240px) {
  .cm-wrap { grid-template-columns: 66px 220px minmax(0, 1fr) !important; }
  body.view-communities { --cm-rail-w: 66px; }
  .cm-members-panel, #cmMembers { display: none !important; }
  body.cm-members-open .cm-members-panel,
  body.cm-members-open #cmMembers {
    display: flex !important;
    position: fixed !important;
    top: 0 !important; right: 0 !important; bottom: 0 !important;
    left: auto !important;
    width: min(300px, 84vw) !important;
    max-height: none !important;
    z-index: 320 !important;
    border-left: 1px solid var(--cm-ln2) !important;
    border-top: 0 !important;
    border-radius: 0 !important;
    background: #0e0e12 !important;
    box-shadow: var(--cm-el3) !important;
    transform: none !important;
    animation: cmMemSlideIn .26s var(--cm-soft) both;
  }
  body.cm-members-open::after {
    content: ''; position: fixed; inset: 0; z-index: 310;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    animation: cmFade .2s var(--cm-ui) both;
  }
}
@keyframes cmMemSlideIn { from { transform: translateX(30px); opacity: 0 } to { transform: none; opacity: 1 } }

@media (min-width: 1241px) and (max-width: 1460px) {
  .cm-wrap { grid-template-columns: 70px 236px minmax(0, 1fr) 216px !important; }
}

/* Широкий ПК: четыре колонки держатся всегда — старые правила style.css
   (3 колонки с !important) больше не ломают раскладку и не роняют
   колонку участников во второй ряд. */
@media (min-width: 1461px) {
  .cm-wrap { grid-template-columns: var(--cm-rail-w) var(--cm-side-w) minmax(0, 1fr) var(--cm-mem-w) !important; }
}

@media (max-width: 900px) {
  /* каркас: рейл + одна колонка-экран */
  body.view-communities .cm-wrap {
    grid-template-columns: 60px minmax(0, 1fr) !important;
    grid-template-rows: 100%;
  }
  body.view-communities .cm-rail {
    grid-row: 1; grid-column: 1;
    padding: calc(10px + env(safe-area-inset-top)) 0 calc(96px + env(safe-area-inset-bottom));
    gap: 7px;
  }
  .cm-rail-item { width: 42px; height: 42px; border-radius: 14px; font-size: 14px; }
  .cm-rail-item::before { left: -10px; }
  .cm-rail-item[data-tip]::after { display: none; }

  /* каналы = отдельный экран */
  body.view-communities .cm-side {
    grid-column: 2; grid-row: 1;
    width: 100% !important; max-width: 100%;
    border-right: 0;
  }
  body.view-communities .cm-side-head {
    position: sticky; top: 0; z-index: 6;
    padding: calc(10px + env(safe-area-inset-top)) 10px 8px;
    background: rgba(13, 13, 16, .95);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  body.view-communities .cm-side-title { min-height: 48px; font-size: 17px; }
  body.view-communities .cm-side-scroll {
    padding: 10px 10px calc(180px + env(safe-area-inset-bottom));
    gap: 18px;
  }
  body.view-communities .cm-chan { min-height: 46px; padding: 9px 12px; font-size: 15px; border-radius: 13px; }
  body.view-communities .cm-chan-hash .material-symbols-outlined { font-size: 20px; }
  body.view-communities .cm-chan-x { width: 30px; min-width: 30px; height: 30px; opacity: .55; }
  body.view-communities .cm-vc-user { min-height: 40px; }
  body.view-communities .cm-add-ch, body.view-communities .cm-sec-x { width: 34px; height: 34px; min-width: 34px; }
  body.view-communities .cm-sec-x { opacity: .55; }

  /* плашка звонка — над плавающим таббаром */
  body.view-communities:not(.cm-content-open) #cmVoiceBar {
    position: fixed; left: 60px; right: 60px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    z-index: 70; padding: 0 8px;
  }

  /* экран канала поверх списка */
  body.view-communities.cm-content-open .cm-side { display: none; }
  body.view-communities:not(.cm-content-open) .cm-main { display: none; }
  body.view-communities .cm-main { grid-column: 2; grid-row: 1; max-width: 100%; }
  body.view-communities.cm-content-open .cm-main { display: flex; animation: cmSlideIn .26s var(--cm-soft) both; }

  .cm-back { display: grid; }
  body.view-communities .cm-chat-head {
    min-height: 54px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    background: rgba(12, 12, 15, .93);
  }
  body.view-communities .cm-chat-head .tp { display: none; }
  body.view-communities .cm-msgs { padding: 12px 10px 8px; }
  .cm-msg-body { max-width: 84%; }
  .cm-msg-text { font-size: 15.2px; }
  .cm-msg > .av { width: 26px !important; height: 26px !important; font-size: 11px !important; }
  .cm-msg.grouped:not(.mine) { padding-left: 34px; }

  /* действия — всегда видимы (наведения нет) */
  .cm-msg-acts { opacity: .45; transform: none; }
  .cm-msg-more { width: 34px; height: 34px; }

  body.view-communities .cm-compose {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 15, .96);
  }
  .cm-compose-row { padding: 4px 5px; border-radius: 20px; }
  .cm-ic, .cm-plus, .cm-send { width: 42px; height: 42px; min-width: 42px; }
  .cm-compose textarea { min-height: 42px; font-size: 16px; } /* 16px — iOS не зумит */
  .cm-compose-hint { display: none; }
  .cm-down-btn { right: 12px; bottom: 96px; }

  /* участники — нижняя шторка */
  .cm-members-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    z-index: 220;
    max-height: 74vh;
    border-left: 0; border-top: 1px solid var(--cm-ln2);
    border-radius: 24px 24px 0 0;
    background: #0e0e12;
    box-shadow: var(--cm-el3);
    transform: translateY(102%);
    transition: transform .34s var(--cm-soft);
    padding-bottom: env(safe-area-inset-bottom);
    display: flex !important;
  }
  .cm-members-panel::before {
    content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .22);
  }
  body.cm-members-open .cm-members-panel { transform: none; }
  body.cm-members-open .cm-members-panel .cm-members-head { padding-top: 22px; }
  body.cm-members-open::after {
    content: ''; position: fixed; inset: 0; z-index: 210;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    animation: cmFade .2s var(--cm-ui) both;
  }
  body.cm-members-open .cm-member { min-height: 48px; font-size: 14.5px; }

  /* модалки на телефоне — нижний лист */
  .cm-modal-back { align-items: flex-end; padding: 0; }
  .cm-modal {
    width: 100%; max-height: 92vh;
    border-radius: 24px 24px 0 0;
    animation: cmSheetUp .3s var(--cm-soft) both;
  }
  .cm-modal-b { max-height: calc(92vh - 120px); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .cm-modal-actions .btn { flex: 1 1 100%; min-height: 46px; }

  .cm-empty { padding: 28px 18px calc(120px + env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  body.view-communities .cm-wrap { grid-template-columns: 54px minmax(0, 1fr) !important; }
  body.view-communities:not(.cm-content-open) #cmVoiceBar { left: 54px; right: 54px; }
  .cm-rail-item { width: 40px; height: 40px; }
  .cm-msg-body { max-width: 88%; padding: 7px 11px 6px; }
  .cm-chat-head .nm { font-size: 15px; }
  body.view-communities .cm-side-scroll { padding-left: 8px; padding-right: 8px; }
}

/* ---------------------------------------------------------------------------
   11. ДОСТУПНОСТЬ / REDUCED MOTION
   ------------------------------------------------------------------------- */
.cm-rail-item:focus-visible,
.cm-chan:focus-visible,
.cm-member:focus-visible,
.cm-head-btn:focus-visible,
.cm-back:focus-visible,
.cm-send:focus-visible,
.cm-ic:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .32);
}

@media (prefers-reduced-motion: reduce) {
  .cm-wrap *, .cm-wrap *::before, .cm-wrap *::after,
  .cm-modal, .cm-modal-back, .cm-members-panel {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .cm-msgs { scroll-behavior: auto; }
}
body.ui-reduce-motion .cm-wrap *,
body.ui-reduce-motion .cm-wrap *::before,
body.ui-reduce-motion .cm-wrap *::after {
  animation: none !important;
  transition-duration: .05s !important;
}

/* ---------------------------------------------------------------------------
   12. СОВМЕСТИМОСТЬ С СТАРЫМИ СЛОЯМИ (style.css / redesign.css)
   Старые правила сообществ обросли !important и ID-селекторами — именно
   оттуда росла большая часть багов вёрстки. Гасим их адресно и один раз.
   ------------------------------------------------------------------------- */

/* шапка панели каналов: иконка + название + подпись в две строки */
.cm-side-title .av { flex: 0 0 auto; border-radius: 11px; }
.cm-side-title > .nm { display: flex; flex-direction: column; gap: 0; line-height: 1.2; align-items: flex-start; }
.cm-side-title > .nm > .sub {
  display: block; max-width: 100%;
  font-style: normal; font-size: 11px; font-weight: 550; letter-spacing: 0;
  color: var(--cm-tx3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* названия каналов и людей — без принудительного верхнего регистра */
.cm-chan-nm, .cm-chan .cm-chan-nm,
.cm-vc-user .nm, .cm-chat-head .nm, .cm-member .nm, .cm-side-title .nm {
  text-transform: none !important;
}

/* текст в пузырях: redesign.css жёстко ставит #e6e6ea — на светлом своём
   сообщении текст был практически невидим */
.cm-msg:not(.mine) .cm-msg-text { color: #f1f1f4; }
.cm-msg.mine .cm-msg-text,
.cm-msg.mine .cm-msg-text b,
.cm-msg.mine .cm-msg-text i,
.cm-msg.mine .cm-msg-text s,
.cm-msg.mine .cm-msg-text u,
.cm-msg.mine .cm-msg-text span { color: #141417; }
.cm-msg.mine .cm-msg-text code,
.cm-msg.mine .cm-msg-text pre {
  background: rgba(20, 20, 23, .09) !important;
  color: #141417 !important;
  border-color: rgba(20, 20, 23, .14) !important;
}
.cm-msg .cm-msg-body { flex: 0 1 auto; box-sizing: border-box; }
.cm-msg.grouped .cm-msg-body { margin-left: 0; }
.cm-msg:not(.mine).grouped .cm-msg-body { margin-left: 39px; }
.cm-msgs > .cm-msg { max-width: 100% !important; }

/* медиа в сообщении — как в мессенджере, компактно */
.cm-msg-media img, .cm-msg-gif img {
  max-width: min(340px, 100%) !important;
  max-height: 300px !important;
  width: auto !important;
  height: auto;
  object-fit: cover;
}

/* участники: роль не должна съедать имя */
.cm-member .cm-role { max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; padding: 2px 6px; }

/* кнопка отправки — в style.css она синяя и с !important */
.cm-send, .cm-send:not(.ready) {
  background: rgba(255, 255, 255, .13) !important;
  color: rgba(255, 255, 255, .48) !important;
  border: 0 !important;
}
.cm-send:not(.ready) .material-symbols-outlined { color: rgba(255, 255, 255, .48) !important; }
.cm-send.ready { background: #fff !important; color: #0a0a0b !important; }
.cm-send.ready .material-symbols-outlined { color: #0a0a0b !important; }
.cm-send:hover { background: rgba(255, 255, 255, .2) !important; }
.cm-send.ready:hover { background: #f0f0f2 !important; }

/* иконки композера */
.cm-ic-group .cm-ic { color: var(--cm-tx2) !important; }
.cm-ic-group .cm-ic:hover { color: #fff !important; background: var(--cm-s3) !important; }
.cm-plus:hover { background: var(--cm-s3) !important; }
.cm-compose-hint { padding: 0 0 0 12px !important; min-height: 0; }
.cm-compose:focus-within .cm-compose-hint { height: 17px !important; min-height: 0; padding: 4px 0 0 12px !important; opacity: .7; }

/* старая кнопка участников больше не нужна — есть .cm-head-btn */
.cm-mem-btn { display: none !important; }

@media (min-width: 901px) {
  /* Кнопка «Каналы» на ПК не нужна — список каналов всегда слева. */
  #cmHeadSearch { display: none !important; }
}

/* цитата ответа внутри своего (светлого) пузыря */
.cm-msg.mine .cm-msg-reply { background: rgba(20, 20, 23, .075); border-left-color: rgba(20, 20, 23, .32); }
.cm-msg.mine .cm-msg-reply b { color: #141417 !important; }
.cm-msg.mine .cm-msg-reply span { color: rgba(20, 20, 23, .66) !important; }
.cm-msg.mine .cm-msg-reply .material-symbols-outlined { color: rgba(20, 20, 23, .55) !important; }
.cm-msg:not(.mine) .cm-msg-reply b { color: #fff !important; }
.cm-msg:not(.mine) .cm-msg-reply span { color: rgba(255, 255, 255, .6) !important; }

/* ---------------------------- телефон ---------------------------- */
@media (max-width: 900px) {
  /* Список каналов и экран канала — два разных экрана, как в мобильном
     Discord: в чате рейл убирается, чтобы сообщения и поле ввода получили
     всю ширину экрана. Старые правила с !important перебиваются явно. */
  body.view-communities:not(.cm-content-open) .cm-wrap {
    grid-template-columns: 60px minmax(0, 1fr) !important;
  }
  body.view-communities.cm-content-open .cm-wrap {
    grid-template-columns: 60px minmax(0, 1fr) !important;
  }
  body.view-communities.cm-content-open:not(.cm-empty-state) .cm-wrap {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.view-communities.cm-content-open:not(.cm-empty-state) .cm-rail { display: none !important; }
  body.view-communities.cm-content-open:not(.cm-empty-state) .cm-main { grid-column: 1 !important; }
  body.view-communities.cm-content-open .cm-side { display: none !important; }
  body.view-communities:not(.cm-content-open) .cm-main { display: none !important; }
  body.view-communities.cm-content-open .cm-main { display: flex !important; }
  body.view-communities.cm-content-open .cm-chat-head {
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px !important;
    min-height: 54px;
  }
  body.view-communities.cm-content-open .cm-compose,
  body.view-communities .cm-compose {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom)) !important;
  }
  body.view-communities .cm-chan { padding: 9px 12px !important; font-size: 15px; border-radius: 13px; }
  body.view-communities .cm-member { padding: 6px 9px !important; font-size: 14.5px; }
  body.view-communities .cm-vc-user { padding: 4px 8px !important; font-size: 13.5px; }
  body.view-communities:not(.cm-content-open) .cm-side { padding-bottom: 0 !important; }
  body.view-communities .cm-msgs { padding: 12px 10px 8px !important; }
  body.view-communities.cm-content-open .vc-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .cm-msg-media img, .cm-msg-gif img { max-width: min(260px, 100%) !important; max-height: 260px !important; }

  /* на телефоне кнопка «каналы» дублирует стрелку «назад» — убираем */
  #cmHeadSearch { display: none !important; }

  /* Композер: пока поле пустое — одна компактная строка. Как только
     начинаешь писать — поле занимает всю ширину, а кнопки уезжают на
     вторую строку: ничего не пропадает, но писать удобно (как в Slack). */
  body.view-communities .cm-compose-row { flex-wrap: wrap; row-gap: 6px; }
  body.view-communities .cm-compose-row > .cm-send { margin-left: auto; }
  body.view-communities .cm-compose-row:focus-within #cmInput,
  body.view-communities .cm-compose-row #cmInput:not(:placeholder-shown) {
    order: -1; flex: 1 1 100% !important; min-width: 100% !important; width: 100% !important;
  }

  /* была боковая шторка с ID-селекторами → теперь нижний лист */
  body.cm-members-open::before { display: none !important; content: none !important; }
  .cm-members-panel, #cmMembers {
    display: flex !important;
    position: fixed !important;
    left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
    width: auto !important; max-height: 72vh;
    z-index: 320 !important;
    padding: 0 0 env(safe-area-inset-bottom) !important;
    border-left: 0 !important;
    border-top: 1px solid var(--cm-ln2);
    border-radius: 22px 22px 0 0 !important;
    background: #0e0e12 !important;
    box-shadow: var(--cm-el3) !important;
    transform: translateY(103%);
    animation: none !important;
    transition: transform .34s var(--cm-soft);
  }
  body.cm-members-open .cm-members-panel,
  body.cm-members-open #cmMembers { transform: none !important; }
  body.cm-members-open .cm-members-list .cm-member { min-height: 46px; }
  .cm-members-head { padding: 18px 14px 10px !important; text-align: center; }
}

@media (max-width: 430px) {
  body.view-communities:not(.cm-content-open) .cm-wrap,
  body.view-communities.cm-content-open.cm-empty-state .cm-wrap {
    grid-template-columns: 54px minmax(0, 1fr) !important;
  }
}


/* ==================================================================
   13. ЗАГРУЗКИ — скелетоны, шиммер, спиннеры, прогресс
   Ничего не «прыгает»: пока данные летят, на их месте дышат
   плейсхолдеры точно такой же формы, что и будущий контент.
   ================================================================== */

.cm-sk {
  position: relative; overflow: hidden; border-radius: 8px;
  background: linear-gradient(100deg, rgba(255,255,255,.05) 8%, rgba(255,255,255,.14) 44%, rgba(255,255,255,.05) 76%);
  background-size: 280% 100%;
  animation: cmSkShine 1.5s linear infinite, cmSkIn .42s var(--cm-spring) both;
  animation-delay: 0s, calc(var(--i, 0) * 50ms);
}
@keyframes cmSkShine { from { background-position: 140% 0 } to { background-position: -60% 0 } }
@keyframes cmSkIn { from { opacity: 0; transform: translateY(8px) scale(.985) } to { opacity: 1; transform: none } }

/* рейл сообществ */
.cm-sk-rail { width: 46px; height: 46px; border-radius: 16px; margin: 0 auto 10px }

/* панель каналов */
.cm-sk-side-head { display: flex; align-items: center; gap: 10px; padding: 15px 14px 13px; border-bottom: 1px solid var(--cm-ln) }
.cm-sk-col { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0 }
.cm-sk-av { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto }
.cm-sk-side-body { display: flex; flex-direction: column; gap: 7px; padding: 14px 10px }
.cm-sk-sec { width: 44%; height: 9px; margin: 10px 0 3px 6px }
.cm-sk-chan { height: 34px; border-radius: 11px }

/* участники */
.cm-sk-mem { display: flex; align-items: center; gap: 10px; padding: 8px 10px }
.cm-sk-mem .cm-sk-av { width: 28px; height: 28px }

/* чипы сообществ во вкладке «Чаты» */
.cm-sk-chip { width: 58px; height: 62px; border-radius: 18px; flex: 0 0 auto }

/* карточки в «Найти сообщества» */
.cm-sk-disc { height: 64px; border-radius: 16px; margin-bottom: 10px }

/* скелет чата */
.cm-chat-skel .cm-chat-head { gap: 10px }
.cm-compose-skel { padding: 10px 14px 16px; border-top: 1px solid var(--cm-ln) }
.cm-wrap-skel { pointer-events: none }

/* появление списка волной (когда скелетон сменяется данными) */
.cm-stagger > * { animation: cmRise .44s var(--cm-spring) both }
.cm-stagger > *:nth-child(1) { animation-delay: .02s }
.cm-stagger > *:nth-child(2) { animation-delay: .06s }
.cm-stagger > *:nth-child(3) { animation-delay: .1s }
.cm-stagger > *:nth-child(4) { animation-delay: .14s }
.cm-stagger > *:nth-child(5) { animation-delay: .18s }
.cm-stagger > *:nth-child(6) { animation-delay: .22s }
.cm-stagger > *:nth-child(n+7) { animation-delay: .26s }

/* тонкая полоса загрузки сверху экрана */
.cm-topline { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 999; pointer-events: none; opacity: 0; transition: opacity .3s }
.cm-topline::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 38%;
  background: linear-gradient(90deg, transparent, var(--cm-voice), #fff, var(--cm-voice), transparent);
  border-radius: 3px; transform: translateX(-105%);
}
.cm-topline.on { opacity: 1 }
.cm-topline.on::before { animation: cmTopline 1.15s cubic-bezier(.65,.05,.36,1) infinite }
@keyframes cmTopline { from { transform: translateX(-105%) } to { transform: translateX(265%) } }

/* спиннеры на кнопках */
@keyframes cmSpin { to { transform: rotate(360deg) } }
.btn.is-busy, .cm-head-btn.is-busy, .cm-ic.is-busy, .cm-send.is-busy {
  color: transparent !important; position: relative; pointer-events: none; opacity: .9;
}
.btn.is-busy::after, .cm-head-btn.is-busy::after, .cm-ic.is-busy::after, .cm-send.is-busy::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.28); border-top-color: #fff; animation: cmSpin .68s linear infinite;
}
.btn.primary.is-busy::after, .cm-send.is-busy::after { border-color: rgba(0,0,0,.22); border-top-color: #101014 }

/* любой текст «Загрузка…» теперь со спиннером */
body.view-communities .cm-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 28px; color: var(--cm-tx3); font-size: 13px; letter-spacing: .01em;
  animation: cmFade .3s ease both;
}
body.view-communities .cm-loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--cm-ln2); border-top-color: var(--cm-tx2); animation: cmSpin .68s linear infinite;
}

/* картинки в ленте: шиммер-подложка и мягкое проявление */
.cm-msg-media, .cm-msg-gif {
  background: linear-gradient(100deg, rgba(255,255,255,.05) 8%, rgba(255,255,255,.14) 44%, rgba(255,255,255,.05) 76%);
  background-size: 280% 100%; animation: cmSkShine 1.5s linear infinite;
}
.cm-msg-media:has(img.ld), .cm-msg-gif:has(img.ld) { animation: none; background: none }
.cm-msgs img.ld { animation: cmImgIn .5s var(--cm-soft) both }
@keyframes cmImgIn { from { opacity: 0; transform: scale(.98) } to { opacity: 1; transform: none } }

/* бережный режим */
@media (prefers-reduced-motion: reduce) {
  .cm-sk, .cm-msg-media, .cm-msg-gif { animation: none !important; background: rgba(255,255,255,.07) }
  .cm-stagger > * { animation: none !important }
  .cm-topline.on::before { animation: none !important; width: 100%; transform: none }
}
body.ui-reduce-motion .cm-sk,
body.ui-reduce-motion .cm-msg-media,
body.ui-reduce-motion .cm-msg-gif { animation: none !important; background: rgba(255,255,255,.07) }
body.ui-reduce-motion .cm-stagger > * { animation: none !important }


/* ---- финальная полировка v144 ---- */
/* Активное сообщество в рейле — белая плитка с тёмной буквой (как в Discord). */
.cm-rail-item.active {
  background: #fff !important;
  color: #0b0b0d !important;
  border-radius: 17px !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5) !important;
}
.cm-rail-item.active.in-voice { box-shadow: 0 8px 22px rgba(0, 0, 0, .5), 0 0 0 2px var(--cm-voice) !important; }

/* Имя участника забирает всю свободную ширину, чип роли сжимается. */
.cm-member .nm, .cm-member .cm-nm { flex: 1 1 auto !important; min-width: 0 !important; }
.cm-member .cm-role { flex: 0 1 auto !important; max-width: 72px !important; }

/* Колонка участников в скелете загрузки — перебиваем старые id-правила. */
@media (min-width: 1241px) {
  .cm-wrap-skel .cm-members-panel, .cm-wrap-skel #cmMembers { display: flex !important; }
}
