:root {
  --cx-bg: #0b0b0b;
  --cx-panel: #1a1a1a;
  --cx-panel-2: #212121;
  --cx-line: rgba(255,255,255,0.06);
  --cx-text: #f2f2f2;
  --cx-muted: rgba(255,255,255,0.6);
  --cx-accent: #f2c94c;
  --cx-accent-2: #e0b93c;
  --cx-me-text: #111;
  --cx-bubble-them: #2a2a2a;
  --cx-bubble-me: #f2c94c;
}

.cx-chat-app {
  display: flex;
  gap: 18px;
  height: 70vh;
  min-height: 520px;
  background: transparent;
  color: var(--cx-text);
}

.lk .cx-chat-app {
  max-width: 1100px;
  margin: 0 auto;
}

.cx-chat-app[data-mode="popup"] {
  height: 100vh;
  min-height: 100vh;
}

.cx-chat-sidebar {
  width: 320px;
  background: var(--cx-panel);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cx-chat-sidebar-header {
  font-size: 22px;
  font-weight: 700;
}

.cx-chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.cx-chat-empty {
  font-size: 14px;
  color: var(--cx-muted);
  margin-top: 12px;
  display: none;
}

.cx-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--cx-panel-2);
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border .2s ease, transform .2s ease, background .2s ease;
}

.cx-chat-item:hover {
  transform: translateY(-1px);
  border-color: rgba(242,201,76,0.4);
}

.cx-chat-item.active {
  border-color: rgba(242,201,76,0.7);
  background: rgba(242,201,76,0.12);
}

.cx-chat-item img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(242,201,76,0.4);
}

.cx-chat-info {
  flex: 1;
  min-width: 0;
}

.cx-chat-info .cx-name {
  font-weight: 600;
  font-size: 15px;
}

.cx-chat-info .cx-last {
  font-size: 13px;
  color: var(--cx-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cx-chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.cx-chat-time {
  font-size: 12px;
  color: var(--cx-muted);
}

.cx-chat-unread {
  background: var(--cx-accent);
  color: #111;
  font-size: 12px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.cx-chat-main {
  flex: 1;
  background: var(--cx-panel);
  border-radius: 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}

.cx-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--cx-line);
}

.cx-back {
  display: none;
  background: transparent;
  border: none;
  color: var(--cx-text);
  font-size: 18px;
  cursor: pointer;
}

.cx-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(242,201,76,0.5);
}

.cx-header-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cx-header-name {
  font-size: 16px;
  font-weight: 600;
}

.cx-header-status {
  font-size: 12px;
  color: #38bf7a;
}

.cx-header-delete {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--cx-line);
  background: rgba(255,255,255,0.06);
  color: var(--cx-text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease, color .2s ease, border .2s ease;
}

.cx-header-delete:hover {
  background: rgba(255,107,107,0.15);
  border-color: rgba(255,107,107,0.35);
  color: #ff6b6b;
}

.cx-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0));
}

.cx-date-divider {
  align-self: center;
  font-size: 12px;
  color: var(--cx-muted);
  padding: 6px 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  margin: 4px 0;
}

.cx-chat-placeholder {
  color: var(--cx-muted);
  text-align: center;
  margin-top: 40px;
}

.cx-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  position: relative;
}

.cx-msg.me {
  align-items: flex-end;
}

.cx-msg.cx-new {
  animation: cx-pop .25s ease;
}

.cx-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  max-width: 70%;
  font-size: 15px;
  line-height: 1.4;
  background: var(--cx-bubble-them);
  color: var(--cx-text);
  position: relative;
}

.cx-msg.me .cx-bubble {
  background: var(--cx-bubble-me);
  color: var(--cx-me-text);
}

.cx-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--cx-muted);
}

.cx-msg-menu-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--cx-line);
  background: rgba(0,0,0,0.35);
  color: var(--cx-text);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.cx-msg.me:hover .cx-msg-menu-btn {
  display: flex;
}

.cx-msg-menu {
  position: absolute;
  top: 22px;
  right: 0;
  display: none;
  flex-direction: column;
  min-width: 140px;
  background: var(--cx-panel);
  border: 1px solid var(--cx-line);
  border-radius: 12px;
  padding: 6px;
  z-index: 10;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
}

.cx-msg-menu.open {
  display: flex;
}

.cx-msg-menu button {
  background: transparent;
  border: none;
  color: var(--cx-text);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
}

.cx-msg-menu button:hover {
  background: rgba(255,255,255,0.06);
}

.cx-msg-menu .cx-msg-delete {
  color: #ff6b6b;
}

.cx-read.read {
  color: #38bdf8;
}

.cx-chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--cx-line);
  background: rgba(0,0,0,0.15);
}

.cx-chat-input textarea {
  flex: 1;
  resize: none;
  background: #0f0f0f;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  color: var(--cx-text);
  padding: 10px 12px;
  font-size: 14px;
  min-height: 38px;
}

.cx-chat-input button {
  background: var(--cx-panel-2);
  border: none;
  color: var(--cx-text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.cx-chat-input button:hover {
  transform: scale(1.05);
  background: rgba(242,201,76,0.2);
}

.cx-send {
  background: var(--cx-accent);
  color: #111;
}

.cx-send:hover {
  background: var(--cx-accent-2);
}

.cx-file {
  display: none;
}

.cx-attach.recording,
.cx-mic.recording {
  background: rgba(255,77,77,0.3);
  color: #ff4d4d;
}

.cx-image {
  max-width: 100%;
  border-radius: 12px;
}

.cx-audio {
  width: 240px;
  height: 34px;
}

.cx-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.cx-voice-audio {
  display: none;
}

.cx-voice-play {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
  border: none;
  cursor: pointer;
}

.cx-voice-bar {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  overflow: hidden;
}

.cx-voice-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: rgba(0,0,0,0.4);
}

.cx-msg.me .cx-voice-bar span {
  background: rgba(0,0,0,0.6);
}

.cx-voice-time {
  font-size: 12px;
}

@keyframes cx-pop {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 980px) {
  .cx-chat-app {
    flex-direction: column;
    height: auto;
    min-height: unset;
  }
  .cx-chat-sidebar {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .cx-chat-app {
    height: 100vh;
  }
  .cx-chat-app.cx-open .cx-chat-sidebar {
    display: none;
  }
  .cx-chat-app.cx-open .cx-back {
    display: inline-flex;
  }
  .cx-chat-sidebar {
    height: 40vh;
  }
  .cx-chat-main {
    height: 60vh;
  }
}

.lk .trp-floating-switcher,
.lk #trp-floater-ls,
.cx-chat-popup-page .trp-floating-switcher,
.cx-chat-popup-page #trp-floater-ls {
  display: none !important;
}
