* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #041024;
  color: #eaf1fd;
  width: 100%;
}
.hidden { display: none !important; }

/* Auth */
.auth-screen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #0b3270 0%, #041024 60%);
}
.auth-card {
  width: 340px;
  background: #071e43;
  border: 1px solid #1a3a6e;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.brand { margin: 0; font-size: 28px; text-align: center; color: #8fb4f0; }
.brand-sub { margin: 4px 0 24px; text-align: center; color: #8fa4c9; font-size: 13px; }

/* Pareamento WhatsApp */
.pairing-card { width: 320px; text-align: center; }
.pairing-status { display: flex; flex-direction: column; align-items: center; gap: 16px; }
#pairing-qr-img {
  width: 240px; height: 240px; border-radius: 12px; background: #fff; padding: 10px;
}
.auth-tabs { display: flex; margin-bottom: 20px; border-radius: 10px; overflow: hidden; border: 1px solid #1a3a6e; }
.tab-btn {
  flex: 1; padding: 10px; background: transparent; border: none; color: #8fa4c9;
  cursor: pointer; font-size: 14px;
}
.tab-btn.active { background: #2a62cf; color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid #1d417c; background: #04132a;
  color: #eaf1fd; font-size: 16px;
}
.auth-form input:focus { outline: none; border-color: #2a62cf; }
.auth-form button {
  padding: 12px; border-radius: 10px; border: none; background: #2a62cf; color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 6px;
}
.auth-form button:hover { background: #4a80e4; }
.auth-error { color: #ff6b6b; font-size: 13px; min-height: 16px; margin: 0; }

/* App layout */
.app-screen { display: flex; height: 100vh; height: 100dvh; }
.sidebar {
  width: 300px; background: #051733; border-right: 1px solid #0c387d;
  display: flex; flex-direction: column;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid #0c387d;
}
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-info { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; }
.my-number { font-size: 11px; color: #8fa4c9; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.icon-btn {
  background: none; border: none; color: #8fa4c9; font-size: 16px; cursor: pointer; padding: 6px;
}
.icon-btn:hover { color: #fff; }
.sidebar-actions { display: flex; gap: 8px; padding: 12px 16px; }
.action-btn {
  flex: 1; padding: 9px; border-radius: 8px; border: 1px solid #1d417c; background: #0a2b62;
  color: #d3e0f7; font-size: 13px; cursor: pointer;
}
.action-btn:hover { background: #1a3a6e; }
.conversation-list { list-style: none; margin: 0; padding: 4px 8px; overflow-y: auto; flex: 1; }
.conversation-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer;
}
.conversation-item:hover { background: #0a2b62; }
.conversation-item.active { background: #0c387d; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 14px; font-weight: 600; display: flex; justify-content: flex-end; min-height: 18px; }
.conv-preview { font-size: 12px; color: #8fa4c9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-badge {
  background: #2a62cf; color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; min-width: 18px;
  text-align: center;
}
.conv-delete-btn {
  background: none; border: none; color: #8fa4c9; opacity: 0; cursor: pointer; font-size: 14px;
  padding: 4px; flex-shrink: 0; transition: opacity 0.15s;
}
.conversation-item:hover .conv-delete-btn { opacity: 0.7; }
.conv-delete-btn:hover { opacity: 1 !important; color: #ff6b6b; }

.chat-main { flex: 1; display: flex; flex-direction: column; background: #041024; }
.empty-state { flex: 1; display: flex; align-items: center; justify-content: center; color: #667da8; }
.chat-view { display: flex; flex-direction: column; height: 100%; }
.chat-header {
  padding: 16px 20px; border-bottom: 1px solid #0c387d; display: flex; align-items: center; gap: 12px;
}
.chat-header-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.back-btn { display: none; font-size: 20px; }
#chat-title { font-weight: 700; font-size: 15px; }
.chat-subtitle { font-size: 12px; color: #8fa4c9; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble {
  max-width: 60%; padding: 9px 13px; border-radius: 14px; background: #0a2b62; font-size: 14px;
  line-height: 1.4; word-wrap: break-word;
}
.msg-row.mine .msg-bubble { background: #2a62cf; color: #fff; }
.msg-time { font-size: 10px; opacity: 0.6; margin-top: 4px; display: flex; align-items: center; gap: 3px; justify-content: flex-end; }
.msg-ticks { font-size: 12px; letter-spacing: -2px; }
.typing-indicator { padding: 0 20px 6px; font-size: 12px; color: #8fa4c9; }
/* Responder mensagem */
.reply-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 20px; background: #071e43; border-top: 1px solid #0c387d;
}
.reply-preview-info { min-width: 0; display: flex; flex-direction: column; }
.reply-preview-name { font-size: 12px; font-weight: 700; color: #8fb4f0; }
.reply-preview-text { font-size: 12px; color: #8fa4c9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-reply-quote {
  border-left: 3px solid rgba(255,255,255,0.4); padding: 4px 8px; margin-bottom: 6px;
  border-radius: 6px; background: rgba(0,0,0,0.15); font-size: 12px; cursor: pointer;
}
.msg-row.mine .msg-reply-quote { background: rgba(0,0,0,0.2); }
.msg-reply-quote .reply-preview-name { display: block; }
.msg-menu-btn {
  background: none; border: none; color: inherit; opacity: 0.5; cursor: pointer; font-size: 16px;
  padding: 2px 6px; flex-shrink: 0; align-self: flex-start;
}
.msg-menu-btn:hover { opacity: 1; }
.msg-row { display: flex; gap: 4px; align-items: flex-start; }
.msg-row.mine { justify-content: flex-end; }

/* Gravação de áudio */
.recording-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid #0c387d;
}
.recording-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; flex-shrink: 0;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.recording-hint { color: #8fa4c9; font-size: 13px; flex: 1; }
#recording-time { font-variant-numeric: tabular-nums; font-size: 13px; }

/* Anexos nas mensagens */
.msg-image { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; cursor: pointer; }
.msg-audio-wrap { display: flex; flex-direction: column; gap: 6px; }
.msg-audio { width: 240px; }
.transcribe-btn {
  align-self: flex-start; background: rgba(255,255,255,0.08); border: none; color: inherit;
  font-size: 12px; padding: 5px 10px; border-radius: 20px; cursor: pointer; opacity: 0.85;
}
.transcribe-btn:hover { opacity: 1; }
.transcribe-btn:disabled { cursor: default; opacity: 0.6; }
.msg-transcript {
  font-size: 12.5px; line-height: 1.4; background: rgba(255,255,255,0.06); border-radius: 8px;
  padding: 6px 9px; max-width: 240px; opacity: 0.9;
}
.msg-file {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  background: rgba(255,255,255,0.06); padding: 8px 10px; border-radius: 8px; min-width: 180px;
}
.msg-file-icon { font-size: 22px; }
.msg-file-info { min-width: 0; display: flex; flex-direction: column; }
.msg-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.msg-file-size { font-size: 11px; opacity: 0.7; }
.msg-bubble a { color: inherit; text-decoration: underline; }

/* Modal de GIF */

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; z-index: 10;
}
.modal {
  width: 380px; max-height: 80vh; background: #071e43; border: 1px solid #1a3a6e; border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal input {
  padding: 11px 13px; border-radius: 9px; border: 1px solid #1d417c; background: #04132a;
  color: #eaf1fd; font-size: 16px;
}
#new-chat-form { display: flex; flex-direction: column; gap: 10px; }
.user-search-results { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 240px; }
.user-search-results li {
  display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 8px; cursor: pointer;
}
.user-search-results li:hover { background: #0a2b62; }
.group-selected { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: #0c387d; padding: 4px 10px; border-radius: 20px; font-size: 12px; display: flex; gap: 6px; align-items: center;
}
.chip button { background: none; border: none; color: #8fa4c9; cursor: pointer; }

/* Mobile: sidebar e chat ocupam a tela inteira, alternando por navegação */
@media (max-width: 768px) {
  .app-screen { position: relative; overflow: hidden; }
  .sidebar { width: 100%; border-right: none; }
  .chat-main { position: absolute; inset: 0; transform: translateX(100%); transition: transform 0.2s ease; }
  .app-screen.show-chat .sidebar { display: none; }
  .app-screen.show-chat .chat-main { transform: translateX(0); }
  .back-btn { display: inline-flex; }
  .modal { width: 92vw; }
  .msg-bubble { max-width: 80%; }
  .msg-image { max-width: 200px; max-height: 200px; }
  .msg-audio { width: 200px; }
  .conv-delete-btn { opacity: 0.5; }
}

.message-actions-modal { width: 280px; }

@supports (padding: max(0px)) {
  .sidebar-header, .modal-overlay, .reply-preview, .recording-bar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* Visualizador de imagem em tela cheia */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; cursor: default; }
.lightbox-close {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 16px;
  background: rgba(255, 255, 255, 0.12); border: none; color: #fff; font-size: 20px;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60;
  background: #0c387d; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* ===== Compositor (layout estilo WhatsApp) ===== */
.composer { position: relative; border-top: 1px solid #0c387d; }
.message-form { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.composer-icon {
  background: none; border: none; color: #8fa4c9; cursor: pointer; width: 40px; height: 40px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 13px; font-weight: 600; padding: 0;
}
.composer-icon:hover, .composer-icon.active { color: #eaf1fd; background: #0c387d; }
.composer-icon:disabled { opacity: 0.7; cursor: default; }
.composer-field {
  flex: 1; min-width: 0; display: flex; align-items: center; background: #071e43;
  border: 1px solid #1d417c; border-radius: 22px; padding: 0 4px 0 16px;
}
.composer-field:focus-within { border-color: #2a62cf; }
.composer-field input {
  flex: 1; min-width: 0; background: none; border: none; color: #eaf1fd; font-size: 16px; padding: 11px 0;
}
.composer-field input:focus { outline: none; }
.composer-icon.in-field { width: 36px; height: 36px; }
.composer-send {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: #2a62cf; color: #fff;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0;
}
.composer-send:hover { background: #4a80e4; }
.composer-send .icon-send { display: none; margin-left: 2px; }
.composer-send[data-mode="send"] .icon-send { display: block; }
.composer-send[data-mode="send"] .icon-mic { display: none; }

/* Menus e painel que abrem acima do compositor */
.popup-menu {
  position: absolute; z-index: 20; background: #071e43; border: 1px solid #1a3a6e; border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45); padding: 6px;
}
.plus-menu { left: 14px; bottom: calc(100% + 8px); min-width: 210px; }
.plus-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none; color: #eaf1fd;
  font-size: 15px; padding: 11px 12px; border-radius: 10px; cursor: pointer; text-align: left;
}
.plus-menu button svg { color: #8fb4f0; flex-shrink: 0; }
.plus-menu button:hover { background: #0c387d; }

.picker-panel {
  position: absolute; z-index: 20; right: 14px; bottom: calc(100% + 8px); width: min(400px, calc(100% - 28px));
  height: min(440px, 62vh); display: flex; flex-direction: column; background: #071e43;
  border: 1px solid #1a3a6e; border-radius: 16px; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45); overflow: hidden;
}
.picker-search-wrap { padding: 12px 12px 8px; }
.picker-search-wrap input {
  width: 100%; background: #04132a; border: 1px solid #1d417c; border-radius: 10px; color: #eaf1fd;
  font-size: 16px; padding: 9px 12px;
}
.picker-search-wrap input:focus { outline: none; border-color: #2a62cf; }
.picker-search-wrap input:disabled { opacity: 0.5; }
.picker-tabs { display: flex; gap: 4px; margin: 0 12px 6px; padding: 3px; background: #04132a; border-radius: 10px; }
.picker-tabs button {
  flex: 1; background: none; border: none; color: #8fa4c9; font-size: 14px; padding: 7px 0; border-radius: 8px; cursor: pointer;
}
.picker-tabs button.active { background: #0c387d; color: #fff; font-weight: 600; }
.picker-body { position: relative; flex: 1; overflow-y: auto; padding: 4px 12px 10px; }
.picker-body h4 { margin: 10px 0 6px; font-size: 13px; color: #8fa4c9; font-weight: 600; }
.picker-empty { color: #8fa4c9; font-size: 14px; line-height: 1.5; margin: 14px 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-cell {
  background: none; border: none; font-size: 26px; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer;
}
.emoji-cell:hover { background: #0c387d; }
.picker-cats { display: flex; justify-content: space-between; padding: 6px 8px; border-top: 1px solid #0c387d; }
.picker-cats.hidden { display: none; }
.picker-cats button {
  background: none; border: none; font-size: 18px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  filter: grayscale(1); opacity: 0.65;
}
.picker-cats button:hover { background: #0c387d; filter: none; opacity: 1; }

.media-grid { display: grid; gap: 8px; }
.media-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.media-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.saved-tile { position: relative; cursor: pointer; }
.saved-tile img, .saved-tile video {
  width: 100%; border-radius: 8px; background: #04132a; display: block; object-fit: contain; height: 110px;
}
.media-grid.cols-4 .saved-tile img, .media-grid.cols-4 .saved-tile video { height: 74px; }
.saved-remove {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 11px; cursor: pointer; opacity: 0;
}
.saved-tile:hover .saved-remove { opacity: 1; }
.saved-remove:hover { background: #e63946; }
@media (pointer: coarse) { .saved-remove { opacity: 0.85; } }

/* Câmera */
.camera-modal { width: min(520px, 94vw); }
.camera-stage { background: #000; border-radius: 10px; overflow: hidden; display: flex; justify-content: center; }
.camera-stage video, .camera-stage canvas { width: 100%; max-height: 60vh; object-fit: contain; display: block; }
.camera-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .message-form { padding: 8px 10px; gap: 6px; }
  .picker-panel { right: 8px; left: 8px; width: auto; height: min(420px, 58vh); }
  .plus-menu { left: 10px; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
}

/* Rolagem das mensagens: botão "ir para o fim" e destaque da mensagem citada */
.messages-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.jump-bottom {
  position: absolute; right: 18px; bottom: 14px; z-index: 5; width: 42px; height: 42px; border-radius: 50%;
  background: #0c387d; border: 1px solid #1d417c; color: #eaf1fd; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.jump-bottom:hover { background: #1c3e76; }
.jump-badge {
  position: absolute; top: -7px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #2a62cf; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.msg-row.msg-highlight .msg-bubble { animation: msgFlash 2s ease-out; }
@keyframes msgFlash {
  0%, 35% { box-shadow: 0 0 0 3px rgba(255, 213, 74, 0.85); }
  100% { box-shadow: 0 0 0 3px rgba(255, 213, 74, 0); }
}

/* Reações */
.msg-react-btn {
  background: #0c387d; border: none; color: #8fa4c9; cursor: pointer; width: 26px; height: 26px; padding: 0;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  align-self: center; opacity: 0; transition: opacity 0.12s;
}
.msg-react-btn:hover { color: #fff; background: #1c3f78; }
.msg-row:hover .msg-react-btn { opacity: 1; }
@media (hover: none) { .msg-react-btn { display: none; } }
.msg-bubble.has-reactions { position: relative; margin-bottom: 14px; }
.msg-reactions {
  position: absolute; bottom: -13px; right: 8px; display: flex; gap: 2px; padding: 1px 6px;
  background: #0c387d; border: 2px solid #041024; border-radius: 12px; font-size: 13px; line-height: 1.3; color: #fff;
}
.msg-row:not(.mine) .msg-reactions { right: auto; left: 8px; }
.msg-reactions small { font-size: 10px; margin-left: 2px; opacity: 0.8; }
.reaction-popover, .quick-reactions { display: flex; gap: 2px; }
.reaction-popover {
  position: fixed; z-index: 60; padding: 4px 6px; background: #0a2b62; border: 1px solid #1d417c;
  border-radius: 24px; box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.reaction-popover.hidden { display: none; }
.reaction-popover button, .quick-reactions button {
  background: none; border: none; font-size: 22px; padding: 4px 6px; border-radius: 50%; cursor: pointer; line-height: 1;
}
.reaction-popover button:hover, .quick-reactions button:hover { background: #1c3f78; }
.reaction-popover button.active, .quick-reactions button.active { background: #17407f; }
.quick-reactions { justify-content: center; padding-bottom: 6px; }
.more-btn { color: #8fa4c9; font-size: 22px !important; width: 34px; background: #1c3f78 !important; border-radius: 50% !important; align-self: center; }
.reaction-popover.expanded, .quick-reactions.expanded {
  flex-direction: column; width: min(340px, calc(100vw - 16px)); border-radius: 14px; padding: 8px;
}
.quick-reactions.expanded { width: 100%; padding: 0 0 8px; }
.rp-search {
  width: 100%; box-sizing: border-box; padding: 7px 10px; border-radius: 8px; border: 1px solid #1d417c;
  background: #041024; color: #fff; font-size: 16px; margin-bottom: 6px;
}
.rp-body { max-height: 260px; overflow-y: auto; }
.rp-cat { font-size: 11px; color: #8fa4c9; text-transform: uppercase; margin: 6px 2px 2px; }
.rp-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.rp-grid button { font-size: 22px !important; padding: 4px 0 !important; }

/* ===== Tema violeta neon (#2a62cf) ===== */
:root { --neon: #2a62cf; --neon-soft: #8fb4f0; --neon-glow: rgba(42, 98, 207, 0.55); }
body { background: #041024; }
.auth-screen { background: radial-gradient(circle at top, #0c387d 0%, #041024 62%); }
.auth-card { border-color: rgba(42, 98, 207,0.5); box-shadow: 0 0 0 1px rgba(42, 98, 207,0.15), 0 0 40px rgba(42, 98, 207,0.28), 0 20px 60px rgba(0,0,0,0.5); }
.brand { color: #b5cdf6; text-shadow: 0 0 8px var(--neon-glow), 0 0 22px var(--neon-glow); letter-spacing: 1px; }
.auth-form input:focus, .composer-field:focus-within, .picker-search-wrap input:focus, .modal input:focus {
  border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon), 0 0 14px var(--neon-glow); outline: none;
}
.auth-form button, .composer-send, .tab-btn.active {
  background: linear-gradient(135deg, #2a62cf, #5b8fe8); box-shadow: 0 0 14px var(--neon-glow);
}
.auth-form button:hover, .composer-send:hover { box-shadow: 0 0 22px var(--neon-glow); filter: brightness(1.12); background: linear-gradient(135deg, #3b72da, #78a3ee); }
.sidebar { background: linear-gradient(180deg, #061b3c, #04132a); border-right-color: rgba(42, 98, 207,0.35); box-shadow: 1px 0 18px rgba(42, 98, 207,0.15); }
.sidebar-header, .chat-header, .composer, .recording-bar, .reply-preview { border-color: rgba(42, 98, 207,0.25); }
.chat-header { background: rgba(8,26,63,0.7); box-shadow: 0 1px 14px rgba(42, 98, 207,0.1); }
.action-btn { border-color: rgba(42, 98, 207,0.4); color: #dbe8ff; }
.action-btn:hover { background: rgba(42, 98, 207,0.2); box-shadow: 0 0 12px var(--neon-glow); border-color: var(--neon); }
.conversation-item { border: 1px solid transparent; transition: background 0.15s, box-shadow 0.15s; }
.conversation-item:hover { background: rgba(42, 98, 207,0.1); }
.conversation-item.active { background: rgba(42, 98, 207,0.2); border-color: rgba(42, 98, 207,0.6); box-shadow: 0 0 14px rgba(42, 98, 207,0.35), inset 0 0 12px rgba(42, 98, 207,0.15); }
.unread-badge, .jump-badge { background: var(--neon); box-shadow: 0 0 10px var(--neon-glow); }
.msg-bubble { background: #0a2b62; border: 1px solid rgba(42, 98, 207,0.2); }
.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, #1e4fb3, #3f7be0); border-color: rgba(143, 180, 240,0.55);
  box-shadow: 0 0 14px rgba(42, 98, 207,0.45);
}
.msg-reactions { box-shadow: 0 0 8px rgba(42, 98, 207,0.45); border-color: #041024; }
.icon-btn:hover, .composer-icon:hover { text-shadow: 0 0 8px var(--neon-glow); }
.picker-panel, .popup-menu, .reaction-popover, .modal { border-color: rgba(42, 98, 207,0.45); box-shadow: 0 0 26px rgba(42, 98, 207,0.3), 0 12px 36px rgba(0,0,0,0.55); }
.modal-overlay { background: rgba(2, 6, 18, 0.72); backdrop-filter: blur(3px); }
.jump-bottom { border-color: rgba(42, 98, 207,0.6); box-shadow: 0 0 14px var(--neon-glow); }
.toast { background: #0c387d; border: 1px solid var(--neon); box-shadow: 0 0 18px var(--neon-glow); }
.avatar { box-shadow: 0 0 10px var(--neon-glow); }
.plus-menu button svg { color: var(--neon-soft); }
.picker-tabs button.active { box-shadow: 0 0 10px rgba(42, 98, 207,0.4); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(42, 98, 207,0.45); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* Botões de ícone da barra lateral */
.sidebar-tools { display: flex; align-items: center; gap: 2px; }
.icon-btn svg { display: block; }
.new-chat-ico { font-size: 16px; line-height: 1; margin-right: 6px; }
.action-btn#new-chat-btn { display: flex; align-items: center; justify-content: center; }
.conv-delete-btn { display: inline-flex; align-items: center; justify-content: center; }
.conv-delete-btn:hover { color: #ff4d8d; filter: drop-shadow(0 0 6px rgba(255,77,141,0.8)); }

/* Menu lateral recolhível (desktop) */
.sidebar { transition: width 0.2s ease; }
.conversation-item { position: relative; }
@media (min-width: 769px) {
  .app-screen.sidebar-collapsed .sidebar { width: 76px; }
  .app-screen.sidebar-collapsed .sidebar-header { flex-direction: column; gap: 8px; padding: 12px 8px; }
  .app-screen.sidebar-collapsed .me-info,
  .app-screen.sidebar-collapsed .new-chat-lbl,
  .app-screen.sidebar-collapsed .conv-preview,
  .app-screen.sidebar-collapsed .conv-delete-btn { display: none; }
  .app-screen.sidebar-collapsed .sidebar-tools { flex-direction: column; }
  .app-screen.sidebar-collapsed .sidebar-actions { padding: 10px 12px; }
  .app-screen.sidebar-collapsed .new-chat-ico { margin: 0; font-size: 20px; }
  .app-screen.sidebar-collapsed .conversation-item { justify-content: center; padding: 8px 0; }
  .app-screen.sidebar-collapsed .conv-info { position: absolute; top: 2px; right: 6px; flex: none; }
  .app-screen.sidebar-collapsed .conv-name { min-height: 0; }
  .app-screen.sidebar-collapsed #sidebar-toggle svg { transform: rotate(180deg); }
}
@media (max-width: 768px) { #sidebar-toggle { display: none; } }

/* Diálogo de confirmação futurista */
.confirm-modal { width: 340px; align-items: center; text-align: center; gap: 12px; padding: 28px 24px 22px; }
.confirm-icon {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #ff4d8d; background: radial-gradient(circle, rgba(255,77,141,0.2), rgba(255,77,141,0.04) 70%);
  border: 1px solid rgba(255,77,141,0.7); box-shadow: 0 0 22px rgba(255,77,141,0.45), inset 0 0 14px rgba(255,77,141,0.25);
  animation: confirmPulse 2.4s ease-in-out infinite;
}
.confirm-icon svg { filter: drop-shadow(0 0 5px rgba(255,77,141,0.9)); }
@keyframes confirmPulse { 50% { box-shadow: 0 0 32px rgba(255,77,141,0.7), inset 0 0 18px rgba(255,77,141,0.35); } }
.confirm-title { margin: 4px 0 0; font-size: 18px; letter-spacing: 0.3px; text-shadow: 0 0 10px var(--neon-glow); }
.confirm-text { margin: 0; font-size: 13.5px; line-height: 1.5; color: #8fa4c9; }
.confirm-actions { display: flex; gap: 10px; width: 100%; margin-top: 10px; }
.confirm-actions .action-btn { padding: 11px; font-size: 14px; border-radius: 10px; }
.confirm-actions .danger {
  background: linear-gradient(135deg, #d4145a, #ff4d8d); border-color: #ff4d8d; color: #fff; font-weight: 600;
  box-shadow: 0 0 16px rgba(255,77,141,0.5);
}
.confirm-actions .danger:hover { box-shadow: 0 0 26px rgba(255,77,141,0.8); background: linear-gradient(135deg, #e01a66, #ff6aa2); border-color: #ff6aa2; }

/* Foto e número do contato na lista */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.conversation-item .avatar { width: 42px; height: 42px; }
.conv-name { justify-content: space-between; align-items: center; gap: 8px; }
.conv-number { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 769px) {
  .app-screen.sidebar-collapsed .conv-number { display: none; }
}

/* Foto no cabeçalho da conversa */
.chat-avatar-btn { background: none; border: none; padding: 0; cursor: default; flex-shrink: 0; display: inline-flex; }
.chat-avatar-btn.has-photo { cursor: zoom-in; }
.chat-avatar-btn.has-photo:hover .avatar { box-shadow: 0 0 16px var(--neon); }
.chat-avatar-btn .avatar { width: 40px; height: 40px; }

/* Pré-visualização antes de enviar */
.send-preview {
  position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column;
  background: radial-gradient(circle at top, #0a2c63 0%, #030d1e 70%);
}
.sp-top { display: flex; align-items: center; justify-content: center; padding: 14px 16px; position: relative; min-height: 64px; }
.sp-close {
  position: absolute; left: 16px; top: max(12px, env(safe-area-inset-top)); width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(42, 98, 207,0.5); background: rgba(42, 98, 207,0.15); color: #fff; font-size: 18px; cursor: pointer;
}
.sp-close:hover { box-shadow: 0 0 14px var(--neon-glow); }
.sp-title { font-weight: 600; font-size: 15px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 0 10px var(--neon-glow); }
.sp-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 16px; }
.sp-stage img, .sp-stage video {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px;
  box-shadow: 0 0 30px rgba(42, 98, 207,0.35), 0 0 0 1px rgba(42, 98, 207,0.4);
}
.sp-stage iframe { width: min(900px, 100%); height: 100%; border: 1px solid rgba(42, 98, 207,0.5); border-radius: 10px; background: #fff; }
.sp-file {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 40px; text-align: center;
  border: 1px solid rgba(42, 98, 207,0.5); border-radius: 16px; background: rgba(42, 98, 207,0.1); box-shadow: 0 0 26px rgba(42, 98, 207,0.3);
  max-width: 90%; word-break: break-all;
}
.sp-file-icon { font-size: 54px; }
.sp-file small { color: #8fa4c9; }
.sp-thumbs { display: flex; gap: 8px; justify-content: center; padding: 8px 16px; overflow-x: auto; }
.sp-thumbs.hidden { display: none; }
.sp-thumb {
  position: relative; width: 56px; height: 56px; flex-shrink: 0; border-radius: 8px; padding: 0; cursor: pointer;
  border: 2px solid transparent; background: #0a2b62; overflow: hidden; font-size: 22px; color: #fff;
}
.sp-thumb.active { border-color: var(--neon); box-shadow: 0 0 12px var(--neon-glow); }
.sp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-thumb-x {
  position: absolute; top: 1px; right: 1px; width: 18px; height: 18px; border-radius: 50%; font-style: normal;
  background: rgba(0,0,0,0.7); font-size: 10px; display: flex; align-items: center; justify-content: center;
}
.sp-thumb-x:hover { background: #e63946; }
.sp-bottom {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  max-width: 760px; width: 100%; margin: 0 auto;
}

/* Corretor ortográfico no campo de mensagem */
.input-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.input-wrap input { flex: 1; width: 100%; font: inherit; font-size: 16px; position: relative; z-index: 1; }
.spell-mirror {
  position: absolute; inset: 0; padding: 11px 0; font-size: 16px; font-family: inherit; line-height: normal;
  white-space: pre; overflow: hidden; color: transparent; pointer-events: none;
}
.sp-err { text-decoration: underline wavy #ff4d6d; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.spell-tip {
  position: fixed; z-index: 70; display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; padding: 6px;
  background: #071e43; border: 1px solid rgba(42, 98, 207,0.6); border-radius: 12px;
  box-shadow: 0 0 20px rgba(42, 98, 207,0.4), 0 8px 24px rgba(0,0,0,0.5);
}
.spell-tip.hidden { display: none; }
.spell-tip button {
  background: rgba(42, 98, 207,0.2); border: 1px solid rgba(42, 98, 207,0.5); color: #eaf1fd; font-size: 14px;
  padding: 5px 10px; border-radius: 16px; cursor: pointer;
}
.spell-tip button:hover { background: var(--neon); box-shadow: 0 0 10px var(--neon-glow); }
.spell-tip .none { color: #8fa4c9; font-size: 13px; padding: 5px 8px; }

/* Menu suspenso da mensagem (seta "V") */
.msg-menu-btn { display: inline-flex; align-items: center; justify-content: center; padding: 4px; border-radius: 50%; opacity: 0.45; }
.msg-menu-btn:hover { background: rgba(42, 98, 207,0.25); box-shadow: 0 0 10px var(--neon-glow); }
.message-menu {
  position: fixed; z-index: 65; min-width: 230px; display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: #071e43; border: 1px solid rgba(42, 98, 207,0.55); border-radius: 14px;
  box-shadow: 0 0 22px rgba(42, 98, 207,0.35), 0 12px 32px rgba(0,0,0,0.55);
}
.message-menu.hidden { display: none; }
.message-menu > button {
  background: none; border: none; color: #eaf1fd; font-size: 14px; text-align: left; padding: 10px 12px;
  border-radius: 9px; cursor: pointer;
}
.message-menu > button:hover { background: rgba(42, 98, 207,0.22); }
.message-menu > #msg-action-delete-me, .message-menu > #msg-action-delete-everyone { color: #ff7aa8; }
.message-menu .quick-reactions { padding: 2px 0 6px; border-bottom: 1px solid rgba(42, 98, 207,0.3); margin-bottom: 4px; }

/* No computador a reação fica na carinha ao lado da mensagem; a fileira no menu é só para toque. */
@media (hover: hover) { .message-menu .quick-reactions { display: none; } }
