/* frontend/css/chat-widget.css
   Виджет чата: изолированные стили с префиксом cw-. */

.cw-root {
  --cw-bg: #15171a;
  --cw-panel: #1a1c20;
  --cw-panel-2: #202329;
  --cw-line: rgba(255, 255, 255, 0.08);
  --cw-line-strong: rgba(255, 255, 255, 0.14);
  --cw-text: #f1f2f3;
  --cw-muted: rgba(255, 255, 255, 0.45);
  --cw-green: #66d36e;
  --cw-green-dark: #3aa34a;
  --cw-orange: #ff9f43;

  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--cw-text);
  text-align: left;
}

.cw-root *,
.cw-root *::before,
.cw-root *::after {
  box-sizing: border-box;
}

.cw-root [hidden] {
  display: none !important;
}

.cw-root :where(button, textarea, input) {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.cw-root :where(button) {
  margin: 0;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

.cw-root a {
  color: var(--cw-green);
  text-decoration: none;
}

.cw-root a:hover {
  text-decoration: underline;
}

.cw-root button:focus-visible,
.cw-root textarea:focus-visible,
.cw-root a:focus-visible {
  outline: 2px solid rgba(102, 211, 110, 0.75);
  outline-offset: 2px;
}

/* ---------- Кнопка-кружок ---------- */

.cw-launcher {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #66d36e;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cw-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.cw-launcher:active {
  transform: scale(0.97);
}

.cw-launcher__icon {
  pointer-events: none;
}

.cw-launcher__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  border: 2px solid #f4f8f5;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- Приветственный пузырь ---------- */

.cw-greeting {
  position: absolute;
  width: 280px;
  max-width: calc(100vw - 32px);
  padding: 14px 34px 14px 17px;
  border-radius: 14px;
  background: #fff;
  color: #2c2f33;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24), 0 2px 8px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  opacity: 1;
  transform: translateY(8px);
  transition: transform 0.2s ease;
  z-index: 2;
}

.cw-greeting.is-visible {
  transform: none;
}

.cw-greeting::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -9px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 10px 0 0;
  border-color: #fff transparent transparent transparent;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.06));
}

.cw-greeting__bubble {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: #2c2f33;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.cw-greeting__bubble:hover {
  color: #111;
}

.cw-greeting__close {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #9aa0a6;
  font-size: 19px;
  line-height: 1;
}

.cw-greeting__close:hover {
  background: #f1f3f4;
  color: #3c4043;
}

/* ---------- Окно чата ---------- */

.cw-panel {
  position: absolute;
  right: 24px;
  bottom: 96px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cw-bg);
  border: 1px solid var(--cw-line);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.cw-panel.is-open {
  opacity: 1;
  transform: none;
}

.cw-panel.is-dragging,
.cw-launcher.is-dragging {
  transition: none;
}

.cw-header {
  flex: 0 0 auto;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 12px;
  background: var(--cw-panel-2);
  border-bottom: 1px solid var(--cw-line);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.cw-header:active {
  cursor: grabbing;
}

.cw-tabs {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 100%;
}

.cw-tab {
  position: relative;
  height: 100%;
  padding: 0 16px;
  color: var(--cw-muted);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
}

.cw-tab:hover {
  color: var(--cw-text);
}

.cw-tab.is-active {
  color: var(--cw-green);
}

.cw-tab.is-active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--cw-green);
}

.cw-tab__badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--cw-orange);
  color: #1a1108;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  vertical-align: 1px;
}

.cw-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cw-online {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(102, 211, 110, 0.1);
  color: #8fe39a;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cw-online:hover {
  background: rgba(102, 211, 110, 0.18);
}

.cw-online__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cw-green);
  box-shadow: 0 0 0 3px rgba(102, 211, 110, 0.15);
}

.cw-online__label {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11.5px;
}

.cw-online-pop {
  position: absolute;
  top: 60px;
  right: 8px;
  z-index: 30;
  width: 280px;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--cw-line-strong);
  border-radius: 12px;
  background: var(--cw-panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.cw-online-pop__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--cw-line);
  color: var(--cw-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cw-online-pop__count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(102, 211, 110, 0.14);
  color: var(--cw-green);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  letter-spacing: 0;
}

.cw-online-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.cw-online-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--cw-line);
  color: var(--cw-text);
  text-align: left;
}

.cw-online-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.cw-online-row:last-child {
  border-bottom: 0;
}

.cw-online__avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #101010;
  font-size: 12px;
  font-weight: 700;
}

.cw-online__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.cw-online-empty {
  padding: 22px 14px;
  color: var(--cw-muted);
  font-size: 12px;
  text-align: center;
}

.cw-online-login {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-top: 1px solid var(--cw-line);
  color: var(--cw-muted);
  font-size: 11.5px;
  text-align: center;
}

.cw-iconbtn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--cw-muted);
}

.cw-iconbtn:hover {
  color: var(--cw-text);
  background: rgba(255, 255, 255, 0.07);
}

/* ---------- Лента ---------- */

.cw-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--cw-bg);
}

.cw-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cw-feed-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cw-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.cw-feed::-webkit-scrollbar {
  width: 6px;
}

.cw-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

.cw-loadmore {
  flex: 0 0 auto;
  width: 100%;
  padding: 7px 10px;
  border-bottom: 1px solid var(--cw-line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--cw-muted);
  font-size: 12px;
}

.cw-loadmore:hover {
  color: var(--cw-text);
  background: rgba(255, 255, 255, 0.05);
}

.cw-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--cw-muted);
  text-align: center;
  pointer-events: none;
}

.cw-day {
  display: flex;
  justify-content: center;
  margin: 4px 0 10px;
}

.cw-day span {
  padding: 2px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--cw-muted);
  font-size: 11px;
}

.cw-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.cw-msg--own {
  flex-direction: row-reverse;
}

.cw-msg__avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3a4a3d;
  color: #0f1510;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  user-select: none;
}

.cw-msg__avatar.cw-avatar--level {
  font-size: 12px;
  letter-spacing: -0.3px;
}

.cw-msg__content {
  min-width: 0;
  max-width: calc(100% - 40px);
}

.cw-msg__head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
  min-width: 0;
}

.cw-msg--own .cw-msg__head {
  justify-content: flex-end;
}

.cw-msg__nick {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #8fe39a;
  font-size: 12.5px;
  font-weight: 600;
}

.cw-msg__nick--link {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.cw-msg__nick--link:hover {
  color: #b6f0bc;
  text-decoration: underline;
}

.cw-admin-badge {
  display: inline-block;
  flex: 0 0 auto;
  padding: 0 5px;
  border: 1px solid rgba(255, 159, 67, 0.45);
  border-radius: 6px;
  background: rgba(255, 159, 67, 0.16);
  color: #ffb066;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 15px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  vertical-align: 1px;
}

.cw-msg__time {
  flex: 0 0 auto;
  color: var(--cw-muted);
  font-size: 11px;
}

.cw-msg__edited {
  flex: 0 0 auto;
  color: var(--cw-muted);
  font-size: 10.5px;
}

.cw-msg__reply {
  flex: 0 0 auto;
  width: 22px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--cw-muted);
  font-size: 14px;
  line-height: 1;
  opacity: 0.55;
}

.cw-msg__reply:hover {
  opacity: 1;
  color: var(--cw-text);
  background: rgba(255, 255, 255, 0.08);
}

.cw-msg__bubble {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-top-left-radius: 3px;
  background: var(--cw-panel-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.cw-msg--own .cw-msg__bubble {
  border-top-left-radius: 10px;
  border-top-right-radius: 3px;
  border-color: rgba(102, 211, 110, 0.22);
  background: rgba(102, 211, 110, 0.13);
}

.cw-msg--pending .cw-msg__bubble {
  opacity: 0.65;
}

.cw-msg.cw-flash .cw-msg__bubble {
  box-shadow: 0 0 0 2px rgba(255, 159, 67, 0.75);
  transition: box-shadow 0.2s ease;
}

.cw-msg__quote {
  margin-bottom: 5px;
  padding: 3px 7px;
  border-left: 3px solid var(--cw-green);
  border-radius: 3px 6px 6px 3px;
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.cw-msg__quote:hover {
  background: rgba(0, 0, 0, 0.32);
}

.cw-msg__quote-author {
  color: var(--cw-orange);
  font-size: 11.5px;
  font-weight: 600;
}

.cw-msg__quote-text {
  overflow: hidden;
  color: var(--cw-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cw-msg__quote--deleted .cw-msg__quote-text {
  font-style: italic;
}

.cw-newpill {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--cw-orange);
  color: #1a1108;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

/* ---------- Поле ввода ---------- */

.cw-composer {
  flex: 0 0 auto;
  padding: 8px 10px 7px;
  background: var(--cw-panel);
  border-top: 1px solid var(--cw-line);
}

.cw-quote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  padding: 5px 6px 5px 9px;
  border: 1px solid rgba(255, 159, 67, 0.3);
  border-radius: 9px;
  background: rgba(255, 159, 67, 0.09);
}

.cw-quote__info {
  flex: 1 1 auto;
  min-width: 0;
}

.cw-quote__author {
  color: var(--cw-orange);
  font-size: 11.5px;
  font-weight: 600;
}

.cw-quote__text {
  overflow: hidden;
  color: var(--cw-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cw-quote__cancel {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--cw-muted);
  font-size: 18px;
  line-height: 1;
}

.cw-quote__cancel:hover {
  color: var(--cw-text);
  background: rgba(255, 255, 255, 0.08);
}

.cw-editbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  padding: 5px 6px 5px 9px;
  border: 1px solid rgba(102, 211, 110, 0.35);
  border-radius: 9px;
  background: rgba(102, 211, 110, 0.08);
}

.cw-editbar__text {
  color: var(--cw-green);
  font-size: 11.5px;
  font-weight: 600;
}

.cw-editbar__cancel {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--cw-muted);
  font-size: 18px;
  line-height: 1;
}

.cw-editbar__cancel:hover {
  color: var(--cw-text);
  background: rgba(255, 255, 255, 0.08);
}

.cw-menu {
  position: fixed;
  z-index: 50;
  min-width: 160px;
  padding: 5px;
  border: 1px solid var(--cw-line-strong);
  border-radius: 10px;
  background: var(--cw-panel-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.cw-menu__item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--cw-text);
  font-size: 12.5px;
  text-align: left;
}

.cw-menu__item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.cw-menu__item--danger {
  color: #ff9b9b;
}

.cw-menu__item--danger:hover {
  background: rgba(255, 118, 117, 0.12);
}

.cw-menu__sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--cw-line);
}

.cw-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cw-input {
  flex: 1 1 auto;
  min-height: 38px;
  max-height: 110px;
  padding: 8px 11px;
  border: 1px solid var(--cw-line-strong);
  border-radius: 12px;
  background: #101114;
  color: var(--cw-text);
  line-height: 1.35;
  resize: none;
  outline: none;
  scrollbar-width: thin;
}

.cw-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.cw-input:focus {
  border-color: rgba(102, 211, 110, 0.55);
}

.cw-input:disabled {
  min-height: 58px;
  max-height: 58px;
  overflow: hidden;
  opacity: 0.55;
  cursor: not-allowed;
  background: #131417;
}

.cw-input:disabled::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.cw-send {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cw-green) 0%, var(--cw-green-dark) 100%);
  color: #0d150e;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.cw-send:hover {
  filter: brightness(1.08);
}

.cw-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.cw-under {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 16px;
  margin-top: 4px;
}

.cw-count {
  color: var(--cw-muted);
  font-size: 11px;
}

.cw-locked {
  padding: 11px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
}

.cw-locked__title {
  color: rgba(255, 255, 255, 0.48);
  font-size: 12.5px;
  line-height: 1.45;
}

.cw-locked__actions {
  margin-top: 6px;
  color: var(--cw-muted);
  font-size: 12.5px;
}

.cw-locked__actions span {
  margin: 0 4px;
}

.cw-banned {
  border-color: rgba(255, 118, 117, 0.35);
  background: rgba(255, 118, 117, 0.06);
}

.cw-banned .cw-locked__title {
  color: #ff9b9b;
}

.cw-locked__reason:not(:empty) {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11.5px;
}

/* ---------- Уведомление ---------- */

.cw-toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  max-width: min(340px, calc(100vw - 32px));
  padding: 9px 14px;
  border: 1px solid rgba(255, 159, 67, 0.45);
  border-radius: 10px;
  background: #2a1c10;
  color: #ffd9b8;
  font-size: 12.5px;
  text-align: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cw-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cw-toast--error {
  border-color: rgba(255, 118, 117, 0.5);
  background: #2b1515;
  color: #ffc9c9;
}

/* ---------- Личные сообщения ---------- */

.cw-view--dm {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cw-dm-locked {
  align-self: center;
  width: calc(100% - 36px);
  margin: 24px 18px;
  padding: 18px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
}

.cw-dm-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cw-dm-search {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cw-line);
  background: var(--cw-bg);
}

.cw-dm-search input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--cw-line-strong);
  border-radius: 10px;
  background: #101114;
  color: var(--cw-text);
  outline: none;
}

.cw-dm-search input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.cw-dm-search input:focus {
  border-color: rgba(102, 211, 110, 0.55);
}

.cw-search-results {
  position: absolute;
  left: 10px;
  right: 10px;
  top: calc(100% + 2px);
  z-index: 5;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--cw-line-strong);
  border-radius: 10px;
  background: var(--cw-panel-2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.cw-search-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  color: var(--cw-text);
}

.cw-search-result:hover {
  background: rgba(255, 255, 255, 0.06);
}

.cw-search-result__avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #101010;
  font-size: 12px;
  font-weight: 700;
}

.cw-search-result__avatar.cw-avatar--level {
  font-size: 11px;
  letter-spacing: -0.3px;
}

.cw-search-result__nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.cw-search-empty {
  padding: 10px;
  color: var(--cw-muted);
  font-size: 12px;
  text-align: center;
}

.cw-dm-threads {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.cw-dm-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--cw-line);
  text-align: left;
  color: var(--cw-text);
}

.cw-dm-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.cw-dm-item__avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #101010;
  font-size: 15px;
  font-weight: 700;
}

.cw-dm-item__avatar.cw-avatar--level {
  font-size: 13px;
  letter-spacing: -0.4px;
}

.cw-dm-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.cw-dm-item__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cw-dm-item__nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13.5px;
}

.cw-dm-item__name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.cw-dm-item__time {
  flex: 0 0 auto;
  color: var(--cw-muted);
  font-size: 11px;
}

.cw-dm-item__preview {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cw-muted);
  font-size: 12px;
}

.cw-dm-item__badge {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--cw-orange);
  color: #1a1108;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.cw-dm-list-empty {
  padding: 28px 18px;
  color: var(--cw-muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

.cw-dm-thread {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cw-dm-thread__head {
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-bottom: 1px solid var(--cw-line);
  background: var(--cw-panel-2);
}

.cw-dm-thread__peer {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 13.5px;
}

.cw-dm-thread__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (pointer: coarse) {
  .cw-msg__text,
  .cw-msg__bubble {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* ---------- Телефон ---------- */

@media (max-width: 767px) {
  .cw-panel {
    left: 0 !important;
    top: var(--cw-vt, 0px) !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100% !important;
    height: 100vh !important;
    height: var(--cw-vh, 100dvh) !important;
    max-height: 100vh !important;
    max-height: var(--cw-vh, 100dvh) !important;
    border: 0;
    border-radius: 0;
    transform: none;
  }

  .cw-panel.is-open {
    transform: none;
  }

  .cw-header {
    height: 58px;
    padding-top: env(safe-area-inset-top);
  }

  .cw-dm-thread__head {
    height: 48px;
  }

  .cw-online__label {
    display: none;
  }

  .cw-online-pop {
    top: 62px;
    right: 8px;
    width: calc(100% - 16px);
    max-height: calc(100% - 80px);
  }

  .cw-composer {
    padding-bottom: calc(7px + env(safe-area-inset-bottom));
  }

  .cw-launcher {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .cw-toast {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

body.cw-lock {
  overflow: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
  .cw-panel,
  .cw-launcher,
  .cw-toast {
    transition: none !important;
  }
}
