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

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #0a1014;
  color: #e9edef;
}

.app-shell {
  display: flex;
  height: 100vh;
}

.app-left-rail {
  width: 72px;
  background-color: #111b21;
  border-right: 1px solid #202c33;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.left-rail-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.left-rail-section-bottom {
  align-items: center;
}

.left-rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #aebac1;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.left-rail-btn:hover {
  background-color: #202c33;
}

.left-rail-btn.active {
  background-color: #00a884;
  color: #111b21;
}

.left-rail-profile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e9edef;
  font-weight: 600;
  background-size: cover;
  background-position: center;
}

body {
  height: 100vh;
  background: radial-gradient(circle at top left, #202c33, #111b21);
}

.sidebar {
  width: 30%;
  min-width: 320px;
  max-width: 420px;
  border-right: 1px solid #202c33;
  display: flex;
  flex-direction: column;
  background-color: #111b21;
}

.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg width='80' he...3E%3Ccircle cx='40' cy='40' r='1' fill='%23333'/%3E%3C/svg%3E");
  background-color: #0b141a;
}


.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #202c33;
}

.sidebar-header-left {
  display: none;
}

.sidebar-header-right {
  display: flex;
  gap: 8px;
  position: relative;
}

.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #25d366);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111b21;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-color: #44ff99;
  border: 2px solid #202c33;
  position: relative;
}

#current-user-online {
  position: absolute;
  bottom: -2px;
  right: -2px;
}

#chat-online-dot {
  margin-left: -10px;
  margin-right: 6px;
}

.online-dot.offline {
  background-color: #5a6a72;
}

.icon-button {
  border: none;
  background: transparent;
  color: #aebac1;
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.icon-button:hover {
  background-color: #202c33;
  color: #e9edef;
}

.icon-button.recording {
  background-color: #ff3b30;
  color: #fff;
  transform: scale(1.05);
}

.sidebar-search {
  padding: 8px 12px;
  border-bottom: 1px solid #202c33;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  outline: none;
  background-color: #202c33;
  color: #e9edef;
  font-size: 14px;
}

.sidebar-search input::placeholder {
  color: #8696a0;
}

.sidebar-tabs {
  display: flex;
  padding: 4px 8px;
  gap: 4px;
  border-bottom: 1px solid #202c33;
}

.tab-button {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background-color: transparent;
  color: #8696a0;
}

.tab-button.active {
  background-color: #202c33;
  color: #e9edef;
}

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

.chat-archive-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #202c33;
}

.chat-archive-link:hover {
  background-color: #202c33;
}

.chat-archive-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #8696a0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.chat-archive-text {
  font-size: 14px;
  color: #e9edef;
}

.chat-archive-count {
  margin-left: auto;
  font-size: 12px;
  color: #8696a0;
}

.chat-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background-color: #202c33;
  border-radius: 3px;
}

/* Chat item */

.chat-item {
  display: flex;
  padding: 10px 12px;
  cursor: pointer;
  gap: 10px;
  border-bottom: 1px solid #202c33;
  transition: background 0.15s ease;
}

.chat-item:hover {
  background-color: #202c33;
}

.chat-item.active {
  background-color: #202c33;
}

.chat-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-title {
  font-size: 15px;
  font-weight: 600;
  color: #e9edef;
}

.chat-item-time {
  font-size: 11px;
  color: #8696a0;
}

.chat-item-preview {
  font-size: 13px;
  color: #8696a0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.unread-badge {
  min-width: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  background-color: #00a884;
  color: #111b21;
  font-size: 11px;
  text-align: center;
}

/* Chat header / messages */

.chat-header {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #202c33;
  border-left: 1px solid #202c33;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-back-button {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-right: 4px;
}


.chat-header-text {
  display: flex;
  flex-direction: column;
}

.chat-title {
  font-size: 16px;
  font-weight: 600;
}

.chat-subtitle {
  font-size: 13px;
  color: #8696a0;
}

.chat-header-right {
  display: flex;
  gap: 8px;
}

/* Per-chat search panel */

.chat-search-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px;
  background-color: #202c33;
  border-left: 1px solid #202c33;
}

.chat-search-panel input {
  flex: 1;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  outline: none;
  background-color: #111b21;
  color: #e9edef;
  font-size: 13px;
}

.chat-search-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-search-controls span {
  font-size: 12px;
  color: #8696a0;
}

.chat-search-controls button {
  border: none;
  background-color: #111b21;
  color: #e9edef;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 12px;
}

.chat-search-controls button:hover {
  background-color: #00a884;
  color: #111b21;
}

/* Empty state */

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  border-left: 1px solid #202c33;
}

.chat-empty-logo {
  font-size: 32px;
  font-weight: 700;
  color: #00a884;
}

.chat-empty-title {
  font-size: 20px;
  font-weight: 600;
}

.chat-empty-text {
  font-size: 14px;
  color: #8696a0;
  max-width: 360px;
}

/* Archive view */
.archive-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #202c33;
}

.archive-view-header {
  padding: 16px 24px 12px;
  border-bottom: 1px solid #202c33;
}

.archive-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.archive-subtitle {
  font-size: 13px;
  color: #8696a0;
  max-width: 520px;
}

.archive-strong {
  font-weight: 600;
}

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

.archive-empty-text {
  padding: 16px 24px;
  font-size: 14px;
  color: #8696a0;
}

/* Messages */

.chat-messages {
  flex: 1;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  border-left: 1px solid #202c33;
}

.date-separator {
  align-self: center;
  margin: 8px 0;
  padding: 3px 10px;
  border-radius: 999px;
  background-color: #202c33;
  color: #8696a0;
  font-size: 12px;
}

.message-row {
  display: flex;
  width: 100%;
}

.message-row.me {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 70%;
  background-color: #202c33;
  padding: 6px 8px 4px;
  border-radius: 8px;
  position: relative;
  font-size: 14px;
  color: #e9edef;
  display: inline-block;
}

.message-row.me .message-bubble {
  background-color: #005c4b;
  border-bottom-right-radius: 2px;
}

.message-row.them .message-bubble {
  border-bottom-left-radius: 2px;
}

.message-row.search-hit .message-bubble {
  box-shadow: 0 0 0 1px #00a884;
}

.message-bubble.deleted {
  font-style: italic;
  color: #8696a0;
}

.message-sender {
  font-size: 11px;
  font-weight: 600;
  color: #53bdeb;
  margin-bottom: 2px;
}

.message-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-attachments {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-attachments img {
  max-width: 260px;
  border-radius: 8px;
  display: block;
}

.message-attachments video,
.message-attachments audio {
  max-width: 260px;
  border-radius: 8px;
  outline: none;
}

.attachment-file {
  font-size: 13px;
  color: #e9edef;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
  background-color: rgba(0,0,0,0.15);
}

/* Waveform */

.waveform {
  width: 200px;
  height: 28px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-bottom: 4px;
}

.waveform-bar {
  flex: 1;
  background-color: rgba(233,237,239,0.4);
  border-radius: 999px;
  height: 10px;
}

/* Meta */

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
}

.message-time {
  font-size: 11px;
  color: #8696a0;
}

.message-status {
  font-size: 11px;
}

.message-status.sent::before {
  content: "✓";
}

.message-status.delivered::before {
  content: "✓✓";
}

.message-status.read::before {
  content: "✓✓";
  color: #53bdeb;
}

/* Reply preview inside bubble */

.message-reply {
  border-left: 3px solid #53bdeb;
  padding-left: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #c4d5dd;
}

.message-reply-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.message-reply-text {
  opacity: 0.8;
}

/* Reactions */

.message-reactions {
  margin-top: 2px;
  display: inline-flex;
  gap: 4px;
  background-color: #202c33;
  border-radius: 999px;
  padding: 1px 4px;
  align-items: center;
}

.message-reaction-item {
  font-size: 12px;
}

.message-reaction-item span.count {
  font-size: 11px;
  color: #8696a0;
  margin-left: 1px;
}

/* Message actions & menu */

.message-actions {
  position: absolute;
  top: -10px;
  right: 0;
  display: none;
  gap: 4px;
}

.message-row.me .message-actions {
  right: auto;
  left: 0;
}

.message-row:hover .message-actions {
  display: flex;
}

.reaction-button {
  border: none;
  background: #202c33;
  color: #e9edef;
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 6px;
  cursor: pointer;
}

.menu-button {
  border: none;
  background: #202c33;
  color: #e9edef;
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 6px;
  cursor: pointer;
}

.message-menu {
  position: absolute;
  background-color: #202c33;
  border-radius: 8px;
  padding: 4px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 20;
}

.message-menu button {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: #e9edef;
  font-size: 13px;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
}

.message-menu button:hover {
  background-color: #111b21;
}

/* Reply preview above input */

.reply-preview {
  padding: 6px 12px;
  background-color: #202c33;
  border-left: 4px solid #53bdeb;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reply-title {
  font-size: 12px;
  font-weight: 600;
}

.reply-text {
  font-size: 12px;
  color: #c4d5dd;
  flex: 1;
}

.reply-close {
  border: none;
  background: transparent;
  color: #8696a0;
  font-size: 18px;
  cursor: pointer;
}

/* Chat input */

.chat-input {
  padding: 8px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background-color: #202c33;
  border-left: 1px solid #202c33;
}

.chat-input textarea {
  flex: 1;
  resize: none;
  border-radius: 8px;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 14px;
  background-color: #111b21;
  color: #e9edef;
  max-height: 120px;
}

.chat-input textarea::placeholder {
  color: #8696a0;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background-color: #202c33;
  padding: 20px;
  border-radius: 12px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.8);
}

.modal h2 {
  margin: 0 0 8px;
}

.modal p {
  margin: 0 0 12px;
  font-size: 14px;
  color: #8696a0;
}

.modal input,
.modal select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  outline: none;
  margin-bottom: 8px;
  background-color: #111b21;
  color: #e9edef;
}

.modal button {
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background-color: #00a884;
  color: #111b21;
  font-weight: 600;
  cursor: pointer;
}

.modal button:hover {
  background-color: #06cf9c;
}

.modal-section {
  margin: 8px 0;
  font-size: 13px;
  color: #e9edef;
}

.modal-section label {
  display: block;
  margin-bottom: 4px;
}

.modal-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions #new-chat-cancel,
.modal-actions #forward-cancel,
.modal-actions #profile-cancel {
  background-color: #111b21;
  color: #e9edef;
}

/* Profile */

.profile-avatar-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

#profile-avatar-circle {
  width: 60px;
  height: 60px;
  font-size: 24px;
}

/* Utils */

.hidden {
  display: none !important;
}


@media (max-width: 960px) {
  .app-shell {
    position: relative;
    width: 100%;
    height: 100vh;
  }

  .sidebar,
  .chat-pane {
    flex: 1;
    width: 100%;
    max-width: 100%;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .chat-pane {
    display: flex;
    flex-direction: column;
  }

  .chat-back-button {
    display: inline-flex;
  }

  
.app-shell.mobile-view-contact .sidebar {
  display: none;
}

.app-shell.mobile-view-contact .chat-pane {
  display: flex;
}

.app-shell.mobile-view-contact #chat-messages,
.app-shell.mobile-view-contact .chat-empty,
.app-shell.mobile-view-contact #reply-preview,
.app-shell.mobile-view-contact #chat-input {
  display: none;
}

.app-shell.mobile-view-contact #chat-info-panel {
  display: block;
  position: absolute;
  inset: 0;
  max-width: 100%;
}
.app-shell.mobile-view-chats .sidebar {
    display: flex;
  }

  .app-shell.mobile-view-chats .chat-pane {
    display: none;
  }

  .app-shell.mobile-view-chat .sidebar {
    display: none;
  }

  .app-shell.mobile-view-chat .chat-pane {
    display: flex;
  }
}


.chat-item-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-favorite-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #8696a0;
  padding: 0 4px;
}

.chat-favorite-btn.active {
  color: #ffd279;
}

.chat-item.has-unread .chat-item-title {
  font-weight: 700;
}

.chat-item-menu-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  color: #8696a0;
}

.chat-item-menu-arrow {
  font-size: 16px;
}

.chat-item:hover .chat-item-menu-btn {
  opacity: 1;
}

.chat-context-menu {
  position: absolute;
  min-width: 260px;
  background-color: #202c33;
  box-shadow: 0 0 0 1px rgba(11,20,26,0.15), 0 6px 18px rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 6px 0;
  z-index: 9999;
}

.chat-context-menu.hidden {
  display: none;
}

.chat-context-item {
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #e9edef;
  text-align: left;
}

.chat-context-item:hover {
  background-color: #111b21;
}

.chat-context-label {
  flex: 1;
}

.chat-context-separator {
  height: 1px;
  background-color: #3b4a54;
  margin: 4px 0;
}


.chat-item-muted-icon {
  font-size: 13px;
  color: #8696a0;
}

@media (max-width: 960px) {
  .app-left-rail {
    display: none;
  }
}


/* Chat info panel (right side, like WhatsApp Web) */
.chat-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background-color: #202c33;
  border-left: 1px solid #202c33;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.chat-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #111b21;
}

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

.chat-info-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-info-avatar {
  margin: 0 auto;
}

.chat-info-name {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.chat-info-status {
  text-align: center;
  font-size: 13px;
  color: #8696a0;
}

.chat-info-section {
  font-size: 13px;
  padding: 8px 0;
  border-top: 1px solid #111b21;
}

.chat-info-section-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.chat-info-section-value {
  color: #e9edef;
}


/* Material Icons tweaks so they look good inside icon-button */
.material-icons {
  font-size: 20px;
  line-height: 1;
}


/* Список участников/контактов в панели информации чата */
.chat-info-members-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-info-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.chat-info-member:hover {
  background-color: #111b21;
}

.chat-info-member-main {
  display: flex;
  flex-direction: column;
}

.chat-info-member-name {
  font-size: 13px;
}

.chat-info-member-status {
  font-size: 11px;
  color: #8696a0;
}

/* Аватарка в сообщениях (для групп/чатов) */
.message-row {
  display: flex;
  gap: 6px;
}

.message-row.them .message-bubble {
  margin-left: 0;
}

.message-row.me {
  justify-content: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e9edef;
  font-weight: 600;
  background-size: cover;
  background-position: center;
}

/* Имя отправителя кликабельно */
.message-sender {
  cursor: pointer;
}


.chat-info-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-info-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}

.chat-info-member-row:hover {
  background-color: #111b21;
}

.chat-info-member-text {
  display: flex;
  flex-direction: column;
}

.chat-info-member-title {
  font-size: 14px;
  font-weight: 500;
}

.chat-info-member-subtitle {
  font-size: 12px;
  color: #8696a0;
}


.chat-info-section {
  margin-top: 12px;
}

.chat-info-section-title {
  font-size: 13px;
  color: #8696a0;
  margin-bottom: 4px;
}

.chat-info-section-value {
  font-size: 14px;
}

.chat-info-link {
  border: none;
  background: none;
  padding: 0;
  color: #00a884;
  cursor: pointer;
  font-size: 14px;
}

.chat-info-link:hover {
  text-decoration: underline;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #202c33;
  border-radius: 999px;
  transition: .2s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background-color: #ccc;
  border-radius: 50%;
  transition: .2s;
}

.toggle input:checked + .toggle-slider {
  background-color: #00a884;
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(16px);
  background-color: #111b21;
}

.chat-info-section-danger {
  margin-top: 24px;
}

.chat-info-danger-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-info-danger-btn {
  border: none;
  background: none;
  color: #ff4f4f;
  text-align: left;
  padding: 4px 0;
  cursor: pointer;
  font-size: 14px;
}

.chat-info-danger-btn:hover {
  text-decoration: underline;
}


.chat-info-common-chats-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-info-common-chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}

.chat-info-common-chat-row:hover {
  background-color: #111b21;
}

.chat-info-common-chat-title {
  font-size: 14px;
}

.chat-info-common-chat-subtitle {
  font-size: 12px;
  color: #8696a0;
}

/* Оверлей для медиа / документов */

.media-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.media-panel {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background-color: #111b21;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.media-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #202c33;
}

.media-panel-title {
  font-size: 16px;
}

.media-panel-close {
  border: none;
  background: none;
  color: #8696a0;
  cursor: pointer;
  font-size: 18px;
}

.media-panel-tabs {
  display: flex;
  border-bottom: 1px solid #202c33;
}

.media-panel-tab {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
}

.media-panel-tab.active {
  border-bottom: 2px solid #00a884;
}

.media-panel-body {
  padding: 12px 16px;
  overflow: auto;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.media-grid-item {
  background-color: #202c33;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.media-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-list-item {
  padding: 8px 10px;
  border-radius: 6px;
  background-color: #202c33;
  font-size: 13px;
  cursor: pointer;
}

.media-list-item:hover {
  background-color: #18252f;
}

.media-list-item-title {
  font-size: 13px;
}

.media-list-item-subtitle {
  font-size: 12px;
  color: #8696a0;
}


.message-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}

.message-info-row:hover {
  background-color: #111b21;
}

.message-info-text {
  display: flex;
  flex-direction: column;
}

.message-info-name {
  font-size: 14px;
}

.message-info-time {
  font-size: 12px;
  color: #8696a0;
}


/* Профиль */

.profile-modal {
  max-width: 900px;
  width: 100%;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
}

.profile-modal-layout {
  display: flex;
  min-height: 480px;
}

.profile-sidebar {
  width: 320px;
  background-color: #202c33;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-main {
  flex: 1;
  background-color: #111b21;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.profile-main-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.profile-main-title {
  font-size: 20px;
  font-weight: 600;
}

.profile-cover {
  position: relative;
  border-radius: 8px;
  background-color: #111b21;
  background-size: cover;
  background-position: center;
  height: 120px;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.profile-avatar-wrapper {
  position: relative;
}

.profile-cover-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background-color: rgba(0,0,0,0.6);
  color: #e9edef;
  border-radius: 999px;
  padding: 4px;
  cursor: pointer;
}

.profile-cover-edit .material-icons {
  font-size: 18px;
}

.profile-file-input {
  display: none;
}

.profile-section label {
  font-size: 12px;
  color: #8696a0;
}

.profile-phone {
  font-size: 14px;
}

.profile-actions {
  margin-top: auto;
}

.profile-hours-list {
  margin-top: 4px;
}

.profile-hours-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.profile-hours-day {
  width: 32px;
  font-size: 13px;
  color: #8696a0;
}

.profile-hours-input {
  flex: 1;
  background-color: #111b21;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  color: #e9edef;
  font-size: 13px;
}

.profile-section textarea {
  width: 100%;
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
  background-color: #111b21;
  border-radius: 6px;
  border: none;
  padding: 6px 8px;
  color: #e9edef;
  font-size: 13px;
}


@media (max-width: 960px) {
  .profile-modal {
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
  }
  .profile-modal-layout {
    flex-direction: column;
  }
  .profile-sidebar {
    width: 100%;
    height: auto;
  }
  .profile-main {
    display: none;
  }
}


/* App menu (three dots) */
.app-menu {
  position: absolute;
  top: 40px;
  left: 0;
  background-color: #202c33;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  padding: 6px 0;
  min-width: 240px;
  z-index: 40;
}

.app-menu.hidden {
  display: none;
}

.app-menu-item {
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  border: none;
  background: transparent;
  color: #e9edef;
  font-size: 14px;
  cursor: pointer;
}

.app-menu-item:hover {
  background-color: #111b21;
}


/* Emoji picker panel (only emojis) */
.emoji-panel {
  position: absolute;
  bottom: 64px;
  left: 8px;
  max-height: 360px;
  width: 420px;
  max-width: calc(100% - 16px);
  background-color: #202c33;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.emoji-panel.hidden {
  display: none;
}

.emoji-panel-header {
  padding: 8px 12px 4px;
}

.emoji-search-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  outline: none;
  background-color: #111b21;
  color: #e9edef;
  font-size: 13px;
}

.emoji-panel-body {
  padding: 4px 12px 10px;
  overflow-y: auto;
}

.emoji-section-title {
  font-size: 12px;
  text-transform: uppercase;
  color: #8696a0;
  margin: 8px 0 4px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emoji-item {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.emoji-item:hover {
  background-color: #111b21;
}


/* Profile preview (right side, like WhatsApp Web) */
.profile-main {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 32px;
  gap: 24px;
}

.profile-preview-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-preview-avatar {
  flex-shrink: 0;
}

.profile-preview-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-preview-name {
  font-size: 18px;
  font-weight: 600;
  color: #e9edef;
}

.profile-preview-status {
  font-size: 14px;
  color: #8696a0;
}

.profile-preview-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-preview-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #8696a0;
}

.profile-preview-value {
  font-size: 14px;
  color: #e9edef;
  white-space: pre-line;
}
