@font-face {
  font-family: Montserrat-Regular;
  src: url('../fonts/montserrat/Montserrat-Regular.ttf'); 
}
@font-face {
  font-family: Montserrat-ExtraBold;
  src: url('../fonts/montserrat/Montserrat-ExtraBold.ttf'); 
}
@font-face {
  font-family: Montserrat-Bold;
  src: url('../fonts/montserrat/Montserrat-Bold.ttf'); 
}
* {
	margin: 0px; 
	padding: 0px; 
	box-sizing: border-box;
}
body, html {
	height: 100%;
	font-family: Montserrat-Regular, sans-serif;
}
a {
	font-family: Montserrat-Regular;
	font-size: 14px;
	line-height: 1.7;
	color: #666666;
	margin: 0px;
	transition: all 0.4s;
	-webkit-transition: all 0.4s;
  -o-transition: all 0.4s;
  -moz-transition: all 0.4s;
}
a:focus {
	outline: none !important;
}
a:hover {
	text-decoration: none;
  color: #fff;
}
input {
	outline: none;
	border: none;
}

input:focus::-webkit-input-placeholder { color:transparent; }
input:focus:-moz-placeholder { color:transparent; }
input:focus::-moz-placeholder { color:transparent; }
input:focus:-ms-input-placeholder { color:transparent; }

input::-webkit-input-placeholder { color: #999999; }
input:-moz-placeholder { color: #999999; }
input::-moz-placeholder { color: #999999; }
input:-ms-input-placeholder { color: #999999; }

button {
	outline: none !important;
	border: none;
	background: transparent;
}
button:hover {
	cursor: pointer;
}
.limiter {
  width: 100%;
  margin: 0 auto;
}
.container-login {
  width: 100%;  
  min-height: 100vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 15px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  position: relative;
  z-index: 1;
}
.container-login::before {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: #0055ea;
  background: -webkit-linear-gradient(bottom, #0055ea, #00c6eb);
  background: -o-linear-gradient(bottom, #0055ea, #00c6eb);
  background: -moz-linear-gradient(bottom, #0055ea, #00c6eb);
  background: linear-gradient(bottom, #0055ea, #00c6eb);
  opacity: 0.8;
}
.wrap-login {
  width: 390px;
  background: transparent;
  padding-top: 50px;
  padding-bottom: 30px;
}
.login-form {
  width: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.login {
  font-family: Montserrat-ExtraBold;
  font-size: 24px;
  color: #fff;
  line-height: 1.2;
  text-align: center;
  width: 100%;
  display: block;
  padding-top: 20px;
  padding-bottom: 45px;
}
.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto;
}
.avatar img {
  width: 100%;
}
.input-field {
  position: relative;
  width: 100%;
  z-index: 1;
  margin-bottom: 10px;
}
.input-login {
  font-family: Montserrat-Bold;
  font-size: 15px;
  line-height: 1.2;
  color: #333333;
  display: block;
  width: 100%;
  background: #fff;
  height: 50px;
  border-radius: 25px;
  padding: 0 30px 0 53px;
}
/*[ Focus ]*/
.focus-login {
  display: block;
  position: absolute;
  border-radius: 25px;
  bottom: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  box-shadow: 0px 0px 0px 0px;
  color: rgba(0,91,234, 0.6);
}
.input-login:focus + .focus-login {
  -webkit-animation: anim-shadow 0.5s ease-in-out forwards;
  animation: anim-shadow 0.5s ease-in-out forwards;
}
@-webkit-keyframes anim-shadow {
  to {
    box-shadow: 0px 0px 80px 30px;
    opacity: 0;
  }
}
@keyframes anim-shadow {
  to {
    box-shadow: 0px 0px 80px 30px;
    opacity: 0;
  }
}
.symbol-login {
  font-size: 15px;
  color: #999999;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  position: absolute;
  border-radius: 25px;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding-left: 30px;
  pointer-events: none;
  -webkit-transition: all 0.4s;
  -o-transition: all 0.4s;
  -moz-transition: all 0.4s;
  transition: all 0.4s;
}
.input-login:focus + .focus-login + .symbol-login {
  color: #00c6fb;
  padding-left: 23px;
}
.fa-user {
	background: url(../images/user.png) no-repeat;
	background-size: 100%;
	width: 15px;
	height: 15px;
}
.fa-lock {
	background: url(../images/padlock.png) no-repeat;
	background-size: 100%;
	width: 15px;
	height: 15px;
}
/*[ Button ]*/
.container-btn {
  width: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 10px;
}
.login-form-btn {
  font-family: Montserrat-Bold;
  font-size: 15px;
  line-height: 1.5;
  color: #e0e0e0;
  width: 100%;
  height: 50px;
  border-radius: 25px;
  background: #333333;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 25px;
  -webkit-transition: all 0.4s;
  -o-transition: all 0.4s;
  -moz-transition: all 0.4s;
  transition: all 0.4s;
  position: relative;
  z-index: 1;
}
.login-form-btn::before {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  width: 100%;
  height: 100%;
  border-radius: 25px;
  top: 0;
  left: 0;
  background: #005bea;
  background: -webkit-linear-gradient(left, #005bea, #00c6fb);
  background: -o-linear-gradient(left, #005bea, #00c6fb);
  background: -moz-linear-gradient(left, #005bea, #00c6fb);
  background: linear-gradient(left, #005bea, #00c6fb);
  -webkit-transition: all 0.4s;
  -o-transition: all 0.4s;
  -moz-transition: all 0.4s;
  transition: all 0.4s;
  opacity: 0;
}
.login-form-btn:hover {
  background: transparent;
  color: #fff;
}
.login-form-btn:hover:before {
  opacity: 1;
}
.text-center {
  text-align: center;
  width: 100%;
  padding-top: 25px;
  padding-bottom: 25px; /* Было 230px — это и создавало прокрутку! */
}

.text-center-new {
  text-align: center;
  width: 100%;
  padding-bottom: 20px; /* Добавим небольшой отступ снизу для красоты */
}
.txt1 {
  font-family: Montserrat-Regular;
  font-size: 16px;
  color: #cccccc;
  line-height: 1.4;
}
@media (max-width: 576px) {
  .wrap-login {
    padding-top: 80px;
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* ==========================================================================
   ГЛОБАЛЬНАЯ ШАПКА И МАКЕТ ЧАТА (Объединенная темная тема)
   ========================================================================== */
.container-app {
    width: 100%;
    height: 100vh;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
}

.app-header {
    width: 100%;
    height: 55px;
    background: #222;
    border-bottom: 1px solid #444;
    color: #fff;
    display: flex;
    justify-content: space-between; /* Распределяет элементы по краям */
    align-items: center;
    padding: 0 20px;
    position: relative; /* Важно для абсолютного центрирования логотипа */
    z-index: 100;
}

.app-header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    box-shadow: none;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

/* Индикатор соединения с сервером — зелёная рамка на аватаре */
.app-header-user img.avatar-online {
    border: 3px solid #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

/* Онлайн/оффлайн текстовый статус собеседника в шапке чата */
#chat-status.online,
.chat-status.online,
#header-status.online,
#user-status.online,
.chat-header .status.online,
.chat-header-status.online {
    color: #2ecc71 !important;
}

#chat-status.offline,
.chat-status.offline,
#header-status.offline,
#user-status.offline,
.chat-header .status.offline,
.chat-header-status.offline {
    color: #888 !important;
}

/* Нейтральные состояния статуса (группа / переходное «Обновление...») —
   раньше цвет для этих состояний ставился инлайново через JS (chatStatus.style.color),
   что мешало единообразию с .online/.offline и было источником путаницы при отладке цвета. */
#chat-status.neutral,
.chat-status.neutral,
#header-status.neutral,
#user-status.neutral,
.chat-header .status.neutral,
.chat-header-status.neutral {
    color: #888 !important;
}

/* Статус «Это вы» — открыт свой собственный контакт */
#chat-status.self,
.chat-status.self,
#header-status.self,
#user-status.self,
.chat-header .status.self,
.chat-header-status.self {
    color: #005bea !important;
}

#header-username {
    font-family: Montserrat-Bold;
    font-size: 14px;
}

.app-logo {
    font-family: Montserrat-Bold;
    font-size: 18px;
    position: absolute; /* Отрываем от flexbox */
    left: 50%; /* Сдвигаем на середину экрана */
    transform: translateX(-50%); /* Идеально центрируем относительно самого текста */
}

.app-header-actions {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-layout {
    display: flex;
    flex: 1;
    height: calc(100vh - 55px);
    overflow: hidden;
    position: relative;
}

/* --- ЛЕВАЯ ПАНЕЛЬ (Список чатов) --- */
.sidebar {
    width: 320px;
    min-width: 320px; /* Запрет сжатия */
    flex-shrink: 0;   /* Жесткая фиксация в flexbox */
    background: #222;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px 20px;
    color: #fff;
    font-family: Montserrat-Bold;
    font-size: 16px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: center;
}

.contact-list {
    flex: 1;
    overflow-y: auto;
}

.contact {
    display: flex;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.3s;
}

.contact:hover, .contact.active {
    background: #005bea;
}

.contact img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.contact-name {
    color: #fff;
    font-family: Montserrat-Bold;
    font-size: 14px;
}

.contact-msg {
    color: #aaa;
    font-size: 12px;
    margin-top: 5px;
}

.contact-msg.has-unread {
    color: #3ea6ff;
    font-family: Montserrat-Bold;
    font-weight: bold;
}

/* --- ПРАВАЯ ПАНЕЛЬ (Окно переписки) --- */
.chat-window {
    flex: 1;
    min-width: 0; /* Обязательно для растягивания на оставшуюся ширину */
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
}

.chat-header {
    padding: 15px 20px;
    background: #222;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #444;
}

.back-to-chats-btn {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #005bea;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px 15px 5px 0;
    transition: color 0.2s;
    outline: none;
}

.chat-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
}

.chat-title {
    color: #fff;
    font-family: Montserrat-Bold;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 70%;
    margin-bottom: 15px;
    padding: 12px 18px;
    border-radius: 15px;
    color: #fff;
    position: relative; /* якорь для меню "⋮" (см. .msg-menu-btn/.msg-menu ниже) */
}

.message.incoming {
    align-self: flex-start;
    background: #333;
    border-bottom-left-radius: 0;
}

.message.outgoing {
    align-self: flex-end;
    background: #005bea;
    border-bottom-right-radius: 0;
}

/* Голосовые/фото/файловые сообщения — намеренно БЕЗ цветного "пузыря" текстового сообщения,
   плоская карточка (не декоративный градиент/тень — "без лишних наворотов"). Цвет различается
   по направлению (согласовано 05.09.2026): исходящие — тот же синий, что и у исходящих
   текстовых сообщений (#005bea), входящие — нейтральный тёмный, как у входящих текстовых.
   .media-msg — общий крючок для фона/рамки (при добавлении фото 05.09.2026 вынесен из
   .audio-msg, чтобы не дублировать цвета под каждый новый тип файла); .audio-msg/.image-msg —
   отступы и скругления, специфичные для конкретного типа. */
.message.incoming.media-msg {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.message.outgoing.media-msg {
    background: #005bea;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.message.audio-msg {
    border-radius: 12px;
    padding: 10px 34px 10px 12px; /* справа запас под кнопку "⋮" */
}
.message.image-msg {
    border-radius: 12px;
    padding: 4px; /* минимальный отступ — превью почти во всю карточку */
}

.chat-input-area {
    padding: 15px 20px;
    background: #222;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background: #333;
    color: #fff;
    border-radius: 25px;
    padding: 0 20px;
}

.send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #005bea;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.attach-btn, .voice-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #333;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    align-self: center;
}
.voice-btn.recording {
    background: #e74c3c; /* идёт запись — явный красный, чтобы не отпустить случайно не заметив */
}

/* --- ГОЛОСОВЫЕ СООБЩЕНИЯ: плеер (переработан 05.09.2026 — старт/пауза + полоса прогресса,
   вместо разового "play" без возможности остановить длинную запись) --- */
.audio-message {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}
.audio-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.audio-play-btn:disabled { opacity: 0.5; cursor: default; }
.audio-track {
    flex: 1;
    cursor: pointer;
    padding: 10px 0; /* увеличивает область клика для перемотки, не раздувая видимую полосу */
}
.audio-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}
.audio-progress-fill {
    height: 100%;
    width: 0%;
    background: #4db8ff;
    border-radius: 2px;
}
.audio-time {
    font-size: 12px;
    opacity: 0.75;
    flex-shrink: 0;
    min-width: 34px;
    text-align: right;
}

/* --- ФОТО/ВИДЕО-СООБЩЕНИЯ (согласовано 05.09.2026): превью в теле сообщения (уже расшифровано
   вместе с метаданными — показывается сразу, без сети), полный размер/воспроизведение по клику --- */
.image-message { display: flex; position: relative; }
.image-thumbnail {
    max-width: 240px;
    max-height: 240px;
    border-radius: 10px;
    cursor: pointer;
    display: block;
}
.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* клик всё равно должен попадать на .image-thumbnail под иконкой */
}
.image-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.image-lightbox-img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 4px;
}
.image-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

/* --- МЕНЮ СООБЩЕНИЯ "⋮" (копировать текст / сохранить файл) — согласовано 05.09.2026 --- */
.msg-menu-btn {
    position: absolute;
    top: 2px;
    right: 4px;
    z-index: 5; /* БАГ (найден 05.09.2026): без явного z-index кнопка "⋮" (позиционирована, но
    z-index:auto) проигрывала стекинг .image-message (тоже position:relative, z-index:auto,
    но идёт позже в DOM) — по спецификации CSS среди элементов без z-index побеждает тот, кто
    позже в разметке, поэтому превью фото/видео визуально перекрывало кнопку. Явный z-index
    гарантированно ставит кнопку выше независимо от порядка в DOM. */
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
}
.msg-menu-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.msg-menu {
    position: absolute;
    top: 26px;
    right: 4px;
    background: #2a2a2a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    z-index: 20;
    overflow: hidden;
    display: none;
    min-width: 130px;
}
.msg-menu.show { display: block; }
.msg-menu-item {
    display: block;
    width: 100%;
    padding: 9px 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.msg-menu-item:hover { background: rgba(255, 255, 255, 0.1); }
/* "Отправить снова" / "Удалить" (задача 24.09.2026) — пункты ЕСТЬ в разметке у любого своего
   сообщения (см. failedOnlyHtml в renderMessage), но видны только пока карточка помечена
   status-failed — тот же класс, что красит ⚠️ у .status-icon чуть ниже, уже обновляется при
   каждом renderMessage() без дополнительного JS. */
.msg-menu-item-failed-only { display: none; }
.status-failed .msg-menu-item-failed-only { display: block; }
.msg-menu-item-danger { color: #ff6b6b; }
.msg-menu-item-danger:hover { background: rgba(255, 107, 107, 0.12); }

/* --- СТАТУСЫ СООБЩЕНИЙ --- */
.msg-content { display: flex; flex-direction: column; }
.msg-text { padding-right: 18px; } /* запас под кнопку "⋮" в углу, чтобы не наезжала на короткие сообщения */
.msg-info { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-top: 4px; }

/* Полоса прогресса передачи файлового сообщения — общая для ОБОИХ направлений (расширено
   24.09.2026: раньше существовала только на отправке, задача "нужен прогресс-бар и на входящих"
   добавила скачивание). Растягивается (flex:1), заполняя место слева от времени/статуса.
   Для исходящих видна с момента создания карточки (status='sending' в renderMessage) и
   скрывается через display:none из JS сразу после успешной/неудачной отправки; для входящих
   скрыта по умолчанию и показывается/скрывается динамически из loadFileBlob() на время
   реального скачивания по клику (плеер/превью/лайтбокс/"Сохранить"). */
.msg-file-progress {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
    align-self: center;
}
.msg-file-progress-fill {
    height: 100%;
    width: 0%;
    background: #4db8ff;
    transition: width 0.15s linear;
}
.status-icon { font-size: 12px; }
.status-sending .status-icon::after { content: "🕒"; }
.status-sent .status-icon::after { content: "✓"; }
.status-delivered .status-icon::after { content: "✓✓"; }
.status-read .status-icon::after { content: "👁"; color: #4db8ff; }
.status-failed .status-icon::after { content: "⚠️"; }

#btn-add-contact:hover { transform: scale(1.2); }

/* --- МЕНЮ НАСТРОЕК В ШАПКЕ --- */
/* Базовый стиль кнопки */
.btn-settings {
    background: transparent;
    border: none;
    color: #fff; /* Цвет контура (stroke) берет этот цвет */
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

/* Настройки самой SVG-иконки */
.settings-icon {
    width: 24px;
    height: 24px;
    /* Плавная анимация изменения заливки и цвета */
    transition: fill 0.2s ease, color 0.2s ease;
}

/* ПРИ НАВЕДЕНИИ: Заливаем саму форму */
.btn-settings:hover .settings-icon path {
    fill: currentColor;
}

/* ПРИ НАВЕДЕНИИ: Оставляем "дырку" в центре цвета фона шапки (#222) */
.btn-settings:hover .settings-icon circle {
    fill: #222;
}

/* Опционально: Если хочешь, чтобы при наведении иконка становилась фирменного синего цвета */
.btn-settings:hover {
    color: #005bea;
}

/* Красная точка уведомления (добавляется через класс .has-update) */
.btn-settings.has-update::after {
    content: '';
    position: absolute;
    top: 0px;
    right: 0px;
    width: 10px;
    height: 10px;
    background-color: #e74c3c;
    border-radius: 50%;
    border: 2px solid #222; /* Цвет фона шапки, чтобы точка визуально отделялась от шестеренки */
}

/* Стили для зеленой кнопки обновления в меню */
.dropdown-item.text-success { color: #2ecc71; font-family: Montserrat-Bold; }
.dropdown-item.text-success:hover { background: #eafaf1; }

.settings-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: block; width: 100%; padding: 12px 20px; background: none; border: none; text-align: left; cursor: pointer; font-family: Montserrat-Medium; font-size: 14px; color: #333; transition: background 0.2s; }
.dropdown-item:hover { background: #f5f5f5; }
.dropdown-item.text-danger { color: #e74c3c; font-family: Montserrat-Bold; }
.dropdown-item.text-danger:hover { background: #fee; }

/* ==========================================================================
   АДАПТИВНОСТЬ ДЛЯ СМАРТФОНОВ (Ширина экрана < 768px)
   Обязательно находится в самом конце файла!
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
    }
    
    .chat-window {
        display: none;
        width: 100%;
    }

    .back-to-chats-btn {
        display: block;
    }

    .chat-layout.mobile-chat-active .sidebar {
        display: none;
    }
    
    .chat-layout.mobile-chat-active .chat-window {
        display: flex;
    }
}

/* ==========================================================================
   УНИВЕРСАЛЬНЫЕ МОДАЛЬНЫЕ ОКНА (JS Class ModalManager)
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}

.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-box {
    background: #fff; width: 90%; max-width: 400px;
    border-radius: 15px; padding: 30px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateY(20px); transition: transform 0.3s ease;
}

.modal-overlay.show .modal-box { transform: translateY(0); }

.modal-title { font-family: Montserrat-Bold; font-size: 20px; color: #333; margin-bottom: 10px; }
.modal-text { font-size: 14px; color: #666; margin-bottom: 20px; line-height: 1.5; }
.modal-custom-html { margin-bottom: 20px; }
.modal-buttons { display: flex; flex-direction: column; gap: 10px; }

.recovery-key-box {
    background: #f5f5f5; border: 2px dashed #005bea; padding: 15px; border-radius: 10px;
    font-family: monospace; font-size: 22px; font-weight: bold; color: #333; letter-spacing: 2px;
}

.btn-confirm {
    background: #005bea; color: #fff; padding: 12px 20px; border-radius: 25px;
    font-family: Montserrat-Bold; font-size: 14px; width: 100%; border: none; cursor: pointer; transition: opacity 0.2s;
}
.btn-confirm:hover { opacity: 0.9; }

.btn-copy {
    background: #e0e0e0; color: #333; padding: 12px 20px; border-radius: 25px;
    font-family: Montserrat-Bold; font-size: 14px; width: 100%; border: none; cursor: pointer; transition: background 0.2s;
}
.btn-copy:hover { background: #ccc; }

.btn-cancel {
    background: transparent; color: #666; padding: 10px 20px; border-radius: 25px;
    font-family: Montserrat-Bold; font-size: 14px; width: 100%; border: 1px solid #ccc; cursor: pointer; transition: background 0.2s;
}
.btn-cancel:hover { background: #f5f5f5; }

.btn-danger {
    background: #e74c3c; color: #fff; padding: 12px 20px; border-radius: 25px;
    font-family: Montserrat-Bold; font-size: 14px; width: 100%; border: none; cursor: pointer; transition: opacity 0.2s;
}
.btn-danger:hover { opacity: 0.9; }

/* ==========================================================================
   УВЕДОМЛЕНИЯ АВТОРИЗАЦИИ (ОШИБКИ И УСПЕХ)
   ========================================================================== */
.auth-message {
    width: 100%;
    text-align: center;
    font-family: Montserrat-Medium;
    font-size: 14px;
    min-height: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.msg-error { color: #e74c3c; font-family: Montserrat-Bold; }
.msg-success { color: #2ecc71; font-family: Montserrat-Bold; }
.msg-neutral { color: #333333; }

/* Подсветка полей с ошибкой */
.input-field.has-error .input-login {
    color: #e74c3c;
    box-shadow: 0 0 0 1px #e74c3c; /* Аккуратная красная рамка */
}

/* Красим иконку в красный при ошибке */
.input-field.has-error .symbol-login {
    color: #e74c3c;
}

/* ==========================================================================
   МЕНЮ НАСТРОЕК (ПРИВЕДЕНО В ПОРЯДОК)
   ========================================================================== */

/* 1. Контейнер меню */
.settings-dropdown {
    display: none; /* Скрыто по умолчанию */
    position: fixed; 
    top: 60px;       
    right: 20px;     
    background-color: #2a2a2a;
    min-width: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 99999; 
    border: 1px solid #444;
    overflow: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* 2. Класс для JS-переключения */
.settings-dropdown.active {
    display: block; 
}

/* 3. Элементы списка */
.dropdown-item {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    text-align: left;
    color: #ffffff;
    font-family: Montserrat-Bold, sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #3d3d3d;
}

/* Цвета для кнопок */
.text-danger { color: #ff4757; }
.text-success { color: #2ed573; }

/* Иконка группы вместо аватарки */
.avatar-group-icon {
    width: 40px;
    height: 40px;
    background: #5f27cd; /* Фиолетовый цвет для групп */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
}

/* Отступ для инфо о чате */
.contact-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
}
.contact-info {
    margin-left: 15px;
    display: flex;
    flex-direction: column;
}