/* ============ ЧАТ ============ */
.chat-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 260px);
  min-height: 520px;
  max-height: 820px;
  position: relative;
  overflow: hidden;
}

:root {
  --msg-own-bg: linear-gradient(135deg, #00c8d4, #00a4b0);
  --msg-own-color: #001417;
  --msg-other-bg: #212b37;
  --msg-other-color: #e6edf3;
}

body[data-chat-theme-residents="vk-classic"],
body[data-chat-theme-allies="vk-classic"] {
  --msg-own-bg: linear-gradient(135deg, #3b82f6, #2563eb);
  --msg-own-color: #fff;
  --msg-other-bg: #ffffff;
  --msg-other-color: #000;
}

body[data-chat-theme-residents="dark"],
body[data-chat-theme-allies="dark"] {
  --msg-own-bg: linear-gradient(135deg, #2a3543, #1a222c);
  --msg-own-color: #fff;
  --msg-other-bg: #0f1419;
  --msg-other-color: #a4b1c0;
}

.chat-pinned {
  background: linear-gradient(90deg, rgba(0, 200, 212, 0.08), var(--panel-2));
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  flex-shrink: 0;
}
.chat-pinned .pin-icon { color: var(--cyan); font-size: 14px; }
.chat-pinned .pin-text { color: var(--text-2); flex: 1; }

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.chat-date-sep { text-align: center; margin: 20px 0 12px; position: relative; }
.chat-date-sep::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--border);
}
.chat-date-sep span {
  position: relative; background: var(--panel); padding: 0 16px;
  color: var(--muted); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; font-weight: 600;
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 75%;
  position: relative;
  animation: msgSlideIn 0.25s ease;
}

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

.msg-other { align-self: flex-start; }
.msg-own { align-self: flex-end; flex-direction: row-reverse; }

.msg-highlight {
  animation: msgHighlight 1.5s ease;
}

@keyframes msgHighlight {
  0%, 100% { background: transparent; }
  30% { background: rgba(0, 200, 212, 0.25); border-radius: 12px; }
}

.msg-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0;
  align-self: flex-end;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
}

.msg-avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px var(--cyan), 0 0 15px var(--cyan-glow);
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.msg-avatar.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); box-shadow: 0 0 0 1px #fbbf24; }
.msg-avatar.red { background: linear-gradient(135deg, #ef4444, #991b1b); box-shadow: 0 0 0 1px #ef4444; }
.msg-avatar.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 0 0 1px #3b82f6; }
.msg-avatar.rainbow {
  background: linear-gradient(135deg, #ff0000, #ff7f00, #ffff00, #00ff00, #00c8d4, #0000ff, #4b0082, #9400d3);
  background-size: 300% 300%;
  animation: rainbowShift 4s linear infinite;
  box-shadow: 0 0 0 1px #ff7f00, 0 0 15px rgba(255, 127, 0, 0.4);
}

.msg-body {
  padding: 10px 14px;
  border-radius: 14px;
  position: relative;
  min-width: 0;
}

.msg-other .msg-body {
  background: var(--msg-other-bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--msg-other-color);
}

.msg-own .msg-body {
  background: var(--msg-own-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 4px;
  color: var(--msg-own-color);
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.msg-author {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.msg-author:hover {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.msg-author.gold { color: var(--gold); }
.msg-author.red { color: var(--red); }
.msg-author.blue { color: var(--blue); }
.msg-author.rainbow {
  background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #00c8d4, #0000ff, #4b0082, #9400d3);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbowShift 4s linear infinite;
}

.msg-role-badge {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 700;
  background: rgba(0, 200, 212, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(0, 200, 212, 0.3);
}
.msg-role-badge.gold { background: rgba(251, 191, 36, 0.15); border-color: rgba(251, 191, 36, 0.3); color: var(--gold); }
.msg-role-badge.red { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); color: var(--red); }
.msg-role-badge.blue { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.3); color: var(--blue); }
.msg-role-badge.rainbow {
  background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #00c8d4, #0000ff, #4b0082, #9400d3);
  background-size: 300% 100%;
  color: #fff;
  border: none;
  animation: rainbowShift 4s linear infinite;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.msg-text {
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg-text-big-emoji {
  font-size: 42px;
  line-height: 1.1;
}

.msg-time {
  font-size: 10.5px;
  margin-top: 4px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.msg-own .msg-time { color: rgba(0, 20, 23, 0.6); }

.msg-edited {
  font-style: italic;
  opacity: 0.7;
}

.msg-checks {
  font-size: 11px;
  margin-left: 4px;
  letter-spacing: -1px;
  transition: color 0.2s;
}

.msg-reply {
  border-left: 3px solid var(--cyan);
  background: rgba(0, 200, 212, 0.08);
  padding: 6px 10px;
  margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: background 0.15s;
}
.msg-reply:hover { background: rgba(0, 200, 212, 0.15); }
.msg-reply .reply-author { color: var(--cyan); font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.msg-reply .reply-text { color: var(--text-2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-link {
  color: #00c8d4;
  text-decoration: underline;
  text-decoration-color: rgba(0, 200, 212, 0.4);
  transition: all 0.15s;
  word-break: break-all;
}
.chat-link:hover {
  color: #fff;
  text-decoration-color: #fff;
}
.msg-own .chat-link { color: #001417; text-decoration-color: rgba(0, 20, 23, 0.4); }

.chat-mention {
  background: rgba(0, 200, 212, 0.2);
  color: #00c8d4;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-mention:hover { background: rgba(0, 200, 212, 0.35); }

.msg-reactions { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }

.reaction {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
}
.reaction:hover { border-color: var(--cyan); background: rgba(0, 200, 212, 0.12); transform: scale(1.05); }
.reaction.mine { background: rgba(0, 200, 212, 0.2); border-color: var(--cyan); color: var(--cyan); }
.reaction .count { font-size: 11px; font-weight: 700; }

.msg-actions {
  position: absolute;
  top: -34px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  display: none;
  gap: 2px;
  z-index: 10;
  box-shadow: var(--shadow);
}
.msg-other .msg-actions { left: 0; }
.msg-own .msg-actions { right: 0; }
.msg:hover .msg-actions { display: flex; }

.msg-actions button {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  padding: 5px 9px;
  border-radius: 5px;
  transition: all 0.15s;
}
.msg-actions button:hover { background: rgba(0, 200, 212, 0.15); color: var(--cyan); }
.msg-actions button:last-child:hover { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.msg-actions button[title="Закрепить"]:hover { background: rgba(255, 191, 0, 0.15) !important; color: #ffbf00 !important; }

.chat-typing {
  padding: 8px 22px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  min-height: 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.chat-typing .dots::after { content: ''; animation: dots 1.4s infinite; }
@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.chat-input-wrap {
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  flex-shrink: 0;
}

.chat-reply-bar {
  display: none;
  background: rgba(0, 200, 212, 0.06);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  font-size: 12px;
  align-items: center;
  gap: 12px;
}
.chat-reply-bar.active { display: flex; }
.chat-reply-bar .reply-line { border-left: 2px solid var(--cyan); padding-left: 12px; flex: 1; }
.chat-reply-bar .reply-to { color: var(--cyan); font-weight: 600; font-size: 11.5px; margin-bottom: 2px; }
.chat-reply-bar .reply-text { color: var(--muted); font-size: 11.5px; }
.chat-reply-bar .close-reply {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 4px;
}
.chat-reply-bar .close-reply:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }

.chat-input {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  gap: 10px;
  height: 66px;
  min-height: 66px;
  max-height: 66px;
}

.chat-input .emoji-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-input .emoji-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 200, 212, 0.08);
}

.chat-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 18px;
  font-family: inherit;
  font-size: 13.5px;
  border-radius: 22px;
  height: 44px;
}
.chat-input input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}
.chat-input input::placeholder { color: var(--muted); }

.chat-input .send-btn {
  background: var(--cyan);
  border: none;
  color: #001417;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-input .send-btn:hover {
  background: #00e0ee;
  box-shadow: 0 0 20px var(--cyan-glow);
  transform: scale(1.05);
}

/* ============ ЭМОДЗИ-ПИКЕР ============ */
.emoji-picker {
  display: none;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 12px;
  max-height: 180px;
  overflow-y: auto;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px;
}

.emoji-picker.active {
  display: grid;
}

.emoji-picker button {
  background: transparent;
  border: none;
  font-size: 20px;
  padding: 0;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.emoji-picker button:hover {
  background: rgba(0, 200, 212, 0.2);
  transform: scale(1.15);
}

.emoji-picker::-webkit-scrollbar { width: 8px; }
.emoji-picker::-webkit-scrollbar-track { background: var(--panel); }
.emoji-picker::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 4px; }
.emoji-picker::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

.chat-theme-picker {
  position: absolute;
  top: 12px;
  right: 20px;
  z-index: 5;
  display: flex;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px;
}
.chat-theme-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-theme-btn:hover { transform: scale(1.15); }
.chat-theme-btn.active { border-color: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }

.chat-theme-btn[data-theme="default"] { background: linear-gradient(135deg, #00c8d4, #00a4b0); }
.chat-theme-btn[data-theme="vk-classic"] { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.chat-theme-btn[data-theme="dark"] { background: linear-gradient(135deg, #2a3543, #1a222c); }

nav button .badge {
  background: #ff3040;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  min-width: 20px;
  text-align: center;
  display: inline-block;
  animation: badgePulse 2s infinite;
  box-shadow: 0 0 10px rgba(255, 48, 64, 0.6);
  line-height: 1.4;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 48, 64, 0.6); }
  50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 48, 64, 0.9); }
}

.chat-new-btn {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cyan);
  color: #001417;
  border: none;
  padding: 9px 20px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--cyan-glow);
  z-index: 5;
  display: none;
}
.chat-new-btn.show { display: block; animation: fadeIn 0.2s; }
.chat-new-btn:hover { background: #00e0ee; }

/* ============ PIN ============ */
.chat-pin-bar {
  background: linear-gradient(90deg, rgba(255, 191, 0, 0.1), var(--panel-2));
  border-bottom: 1px solid rgba(255, 191, 0, 0.3);
  padding: 8px 16px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  flex-shrink: 0;
}
.chat-pin-bar.active { display: flex; }
.chat-pin-bar:hover { background: linear-gradient(90deg, rgba(255, 191, 0, 0.2), var(--panel-2)); }
.chat-pin-bar .pin-icon { color: #ffbf00; font-size: 14px; flex-shrink: 0; }
.chat-pin-bar .pin-body { flex: 1; min-width: 0; }
.chat-pin-bar .pin-author {
  color: #ffbf00;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
}
.chat-pin-bar .pin-text {
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-pin-bar .pin-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-pin-bar .pin-close:hover { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* ============ DELETE MODAL ============ */
.delete-modal-options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.delete-option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  width: 100%;
}
.delete-option:hover {
  background: rgba(0, 200, 212, 0.08);
  border-color: var(--cyan);
  transform: translateX(4px);
}
.delete-option.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--red);
}
.delete-option .delete-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.delete-option .delete-body { flex: 1; }
.delete-option .delete-title { color: #fff; font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.delete-option .delete-desc { color: var(--muted); font-size: 11.5px; }
.msg-hidden { display: none !important; }

@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.h2-rainbow {
  background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #00c8d4, #0000ff, #4b0082, #9400d3);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbowShift 4s linear infinite;
  font-weight: 700;
}

.chat-pinned-rainbow {
  background: linear-gradient(90deg, rgba(255, 0, 0, 0.08), rgba(255, 127, 0, 0.08), rgba(255, 255, 0, 0.08), rgba(0, 255, 0, 0.08), rgba(0, 200, 212, 0.08), rgba(0, 0, 255, 0.08), rgba(75, 0, 130, 0.08), rgba(148, 0, 211, 0.08));
  border-bottom-color: rgba(255, 127, 0, 0.4);
}

nav button[data-tab="chat-allies"] {
  color: #fff;
  font-weight: 600;
}

nav button[data-tab="chat-allies"]::after {
  background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #00c8d4, #0000ff, #4b0082, #9400d3);
  background-size: 300% 100%;
  animation: rainbowShift 4s linear infinite;
}

nav button[data-tab="chat-allies"].active {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 0, 0, 0.1), rgba(255, 127, 0, 0.1), rgba(255, 255, 0, 0.1), rgba(0, 255, 0, 0.1), rgba(0, 200, 212, 0.1), rgba(0, 0, 255, 0.1), rgba(75, 0, 130, 0.1), rgba(148, 0, 211, 0.1));
}

@media (max-width: 640px) {
  .msg { max-width: 88%; }
  .chat-wrap { height: calc(100vh - 220px); border-radius: 0; }
}

/* ============ ГОЛОСОВЫЕ СООБЩЕНИЯ ============ */
.voice-btn.recording {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: #fff !important;
  animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.voice-preview {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), var(--panel-2));
  border-top: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 12.5px;
  color: var(--text-2);
  transition: background 0.2s;
}
.voice-preview.cancel {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.3), var(--panel-2));
  color: var(--red);
}
.voice-preview .vp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  animation: voicePulse 1s infinite;
}
.voice-preview.cancel .vp-dot { animation: none; opacity: 0.4; }
.voice-preview .vp-time {
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}
.voice-preview .vp-hint { flex: 1; color: var(--muted); font-size: 11.5px; }
.voice-preview .vp-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.voice-preview .vp-cancel:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.voice-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  padding: 4px 0;
}

.voice-play {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 200, 212, 0.15);
  color: var(--cyan);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.voice-play:hover {
  background: var(--cyan);
  color: #001417;
  transform: scale(1.05);
}

.msg-own .voice-play {
  background: rgba(0, 20, 23, 0.2);
  color: #001417;
}
.msg-own .voice-play:hover {
  background: #001417;
  color: var(--cyan);
}

.voice-bars {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  cursor: pointer;
  min-width: 120px;
}
.voice-bars span {
  flex: 1;
  min-width: 2px;
  border-radius: 1px;
  background: rgba(164, 177, 192, 0.3);
  transition: background 0.15s, height 0.2s;
}
.voice-bars span.played {
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan-glow);
}
.msg-own .voice-bars span { background: rgba(0, 20, 23, 0.25); }
.msg-own .voice-bars span.played { background: #001417; }

.voice-time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}
.msg-own .voice-time { color: rgba(0, 20, 23, 0.7); }

.voice-msg audio { display: none; }

/* ============ ФАЙЛЫ В ЧАТЕ ============ */
.msg-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  max-width: 320px;
}

.attachments-grid img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}
.attachments-grid img:hover {
  transform: scale(1.02);
}

.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
  max-width: 320px;
}
.attachment-card:hover {
  border-color: var(--cyan);
  background: rgba(0, 200, 212, 0.08);
}

.attachment-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.attachment-info {
  flex: 1;
  min-width: 0;
}
.attachment-name {
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-size {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

/* ============ ОПРОСЫ ============ */
.msg-poll {
  min-width: 260px;
  max-width: 380px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 4px;
}

.msg-own .msg-poll {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
}

.poll-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.poll-question {
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
}

.poll-closed {
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 6px;
  border: 1px solid var(--red);
  border-radius: 4px;
  flex-shrink: 0;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s;
}
.poll-option:hover {
  border-color: var(--cyan);
  background: rgba(0, 200, 212, 0.05);
}
.poll-option.voted {
  border-color: var(--cyan);
}
.poll-option.closed {
  cursor: default;
  opacity: 0.8;
}
.poll-option.closed:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.04);
}

.poll-option-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(0, 200, 212, 0.2), rgba(0, 200, 212, 0.08));
  transition: width 0.4s ease;
  z-index: 0;
}
.poll-option.voted .poll-option-bar {
  background: linear-gradient(90deg, rgba(0, 200, 212, 0.35), rgba(0, 200, 212, 0.15));
}

.poll-option-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  gap: 8px;
  min-width: 0;
}

.poll-option-label {
  color: #fff;
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poll-option-count {
  color: var(--text-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.poll-check {
  position: relative;
  z-index: 1;
  color: var(--cyan);
  font-weight: 700;
  margin-left: 6px;
}

.poll-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.poll-close-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.poll-close-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}

/* ============ УПОМИНАНИЯ ============ */
.msg-mentioned {
  border-left: 3px solid var(--gold) !important;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), transparent);
  animation: mentionPulse 2s ease;
}
@keyframes mentionPulse {
  0% { background: rgba(251, 191, 36, 0.3); }
  100% { background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), transparent); }
}
