body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #111b21;
  color: #e9edef;
}

/* LOGIN */
.login-body {
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background-color: #0b141a;
}

.login-wrapper {
  background-color: #202c33;
  padding: 24px 28px;
  border-radius: 8px;
  min-width: 320px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.login-title {
  margin-top: 0;
  margin-bottom: 16px;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.login-label input {
  margin-top: 4px;
  padding: 8px;
  border-radius: 4px;
  border: none;
  background-color: #0b141a;
  color: #e9edef;
}

.login-button {
  margin-top: 8px;
  padding: 10px;
  border-radius: 4px;
  border: none;
  background-color: #00a884;
  color: #111b21;
  font-weight: 600;
  cursor: pointer;
}

.login-error {
  margin-top: 8px;
  font-size: 13px;
  color: #f15c5c;
  min-height: 16px;
}

/* TOPO */
.topbar {
  height: 50px;
  background-color: #202c33;
  color: #e9edef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-sizing: border-box;
}

.topbar h2 {
  margin: 0;
  font-size: 16px;
}

.topbar small {
  color: #8696a0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#logout-btn {
  border: none;
  background-color: #f15c5c;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* WRAPPER WHATSAPP */
.whats-wrapper {
  display: flex;
  height: calc(100vh - 50px);
}

/* Sidebar */
.whats-sidebar {
  width: 30%;
  min-width: 280px;
  background-color: #111b21;
  border-right: 1px solid #202c33;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid #202c33;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cliente-info-mini {
  font-weight: 600;
}

.cliente-status-mini {
  font-size: 12px;
  color: #8696a0;
}

.sidebar-search {
  padding: 8px;
  border-bottom: 1px solid #202c33;
}

.sidebar-search input {
  width: 100%;
  border-radius: 8px;
  border: none;
  padding: 8px 10px;
  background-color: #202c33;
  color: #e9edef;
}

/* Lista de chats */
.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.chat-item {
  display: flex;
  padding: 10px 12px;
  cursor: pointer;
  align-items: center;
}

.chat-item:hover {
  background-color: #202c33;
}

.chat-item-active {
  background-color: #202c33;
}

.chat-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #00a884;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #111b21;
  margin-right: 10px;
}

.chat-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-numero {
  font-weight: 600;
}

.chat-item-hora {
  font-size: 11px;
  color: #8696a0;
}

.chat-item-bottom {
  font-size: 13px;
  color: #8696a0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-empty {
  padding: 12px;
  font-size: 13px;
  color: #8696a0;
}

/* Área do chat */
.whats-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #0b141a;
}

.chat-header {
  height: 60px;
  border-bottom: 1px solid #202c33;
  padding: 8px 16px;
  display: flex;
  align-items: center;
}

.chat-contact {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e9edef;
  font-weight: 600;
}

.chat-contact-name {
  font-weight: 600;
}

.chat-contact-subtitle {
  font-size: 12px;
  color: #8696a0;
}

/* Mensagens */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  box-sizing: border-box;
  background-image: radial-gradient(circle at top left, #202c33 0, #0b141a 60%);
}

.message-row {
  display: flex;
  margin-bottom: 8px;
}

.message-row-sent {
  justify-content: flex-end;
}

.message-row-received {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 70%;
  padding: 8px 10px;
  border-radius: 8px;
  position: relative;
  font-size: 14px;
}

.message-row-sent .message-bubble {
  background-color: #005c4b;
  border-bottom-right-radius: 0;
}

.message-row-received .message-bubble {
  background-color: #202c33;
  border-bottom-left-radius: 0;
}

.message-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-media {
  margin-top: 4px;
}

.message-media-image {
  max-width: 220px;
  max-height: 220px;
  border-radius: 4px;
  display: block;
}

.message-media-file {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  text-decoration: underline;
  color: #e9edef;
}

.message-meta {
  text-align: right;
  font-size: 11px;
  color: #8696a0;
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  margin-top: 40px;
  color: #8696a0;
}

/* Input */
.chat-input-area {
  height: 60px;
  border-top: 1px solid #202c33;
  padding: 8px 12px;
  box-sizing: border-box;
  background-color: #202c33;
}

.chat-input-area form {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

#message-input {
  flex: 1;
  height: 100%;
  border-radius: 8px;
  border: none;
  padding: 8px 10px;
  background-color: #2a3942;
  color: #e9edef;
}

#message-send-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  background-color: #00a884;
  color: #111b21;
  font-weight: 600;
  cursor: pointer;
}

:root {
  --bg-main: #0b141a;
  --bg-sidebar: #111b21;
  --bg-header: #202c33;
  --bg-chat: #0b141a;
  --bg-input: #202c33;
  --bg-bubble-received: #202c33;
  --bg-bubble-sent: #005c4b;
  --bg-bubble-sent-hover: #046757;
  --accent: #00a884;
  --accent-soft: #0b8467;
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #8696a0;
  --border-subtle: #202c33;
  --scrollbar: #374045;
  --danger: #f15b5b;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-soft: 0 0 0 1px rgba(15, 20, 25, 0.2),
    0 4px 24px rgba(0, 0, 0, 0.45);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.app-body {
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #202c33 0, #0b141a 55%);
  color: var(--text-primary);
}

/* ===== Layout geral ===== */

.app-wrapper {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: #0a1014;
}

/* ===== Sidebar ===== */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid #202c33;
  box-shadow: var(--shadow-soft);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--bg-header);
  border-bottom: 1px solid #202c33;
}

.sidebar-title h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

.sidebar-title span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.btn-logout {
  border: none;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: #f15b5b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.07s ease;
}

.btn-logout:hover {
  background: #ff6f6f;
  transform: translateY(-1px);
}

.sidebar-user {
  padding: 12px 18px;
  border-bottom: 1px solid #202c33;
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-user p {
  margin: 2px 0;
}

.sidebar-user .label {
  color: var(--text-muted);
  margin-right: 4px;
}

/* Busca */

.sidebar-search {
  padding: 8px 10px;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 13px;
  background: #202c33;
  color: var(--text-primary);
}

.sidebar-search input::placeholder {
  color: var(--text-secondary);
}

/* Lista de chats */

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}
.chat-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 3px;
}
.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.chat-item:hover {
  background: #202c33;
}

.chat-item.active {
  background: #202c33;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.chat-meta {
  flex: 1;
  min-width: 0;
}

.chat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-number {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 8px;
  white-space: nowrap;
}

.chat-last {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Área principal ===== */

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
}

/* Header da conversa */

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-header);
  border-left: 1px solid #202c33;
  border-bottom: 1px solid #202c33;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 600;
}

.chat-header-info h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chat-header-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Mensagens */

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px 16px;
  background: radial-gradient(circle at top, #202c33 0, #0b141a 60%);
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* Linha da mensagem */

.message-row {
  display: flex;
  margin-bottom: 8px;
}

.message-row.sent {
  justify-content: flex-end;
}

.message-row.received {
  justify-content: flex-start;
}

/* Balão */

.message-bubble {
  max-width: 60%;
  background: var(--bg-bubble-received);
  border-radius: 12px;
  padding: 6px 8px 4px 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 13px;
}

.message-row.sent .message-bubble {
  background: var(--bg-bubble-sent);
}

.message-row.sent .message-bubble:hover {
  background: var(--bg-bubble-sent-hover);
}

.message-text {
  margin: 0 0 2px 0;
  color: var(--text-primary);
}

/* Mídia */

.message-media-img {
  max-width: 260px;
  max-height: 240px;
  display: block;
  border-radius: 10px;
  margin-bottom: 4px;
  cursor: pointer;
}

.message-media-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 4px;
  cursor: pointer;
}

.message-media-file:hover {
  background: rgba(0, 0, 0, 0.25);
}

.message-media-icon {
  font-size: 18px;
}

.message-media-name {
  font-size: 12px;
  color: var(--text-primary);
}

/* Rodapé da mensagem (hora/data) */

.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===== Input de mensagem ===== */

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-top: 1px solid #202c33;
}

.chat-input-area input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  background: #101a20;
  color: var(--text-primary);
}

.chat-input-area input::placeholder {
  color: var(--text-secondary);
}

.btn-send {
  border: none;
  outline: none;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.07s ease;
}

.btn-send:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* Emojis */

.emoji-container {
  position: relative;
}

.emoji-toggle {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 4px;
}

.emoji-toggle:hover {
  color: var(--text-primary);
}

.emoji-picker-wrapper {
  position: absolute;
  bottom: 46px;
  left: 0;
  z-index: 50;
  display: none;
  box-shadow: var(--shadow-soft);
}

/* Responsivo */

@media (max-width: 980px) {
  .app-wrapper {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  .app-wrapper {
    grid-template-columns: 100%;
  }

  .sidebar {
    display: none;
  }

  .sidebar.show {
    display: flex;
    position: absolute;
    z-index: 100;
    width: 100%;
    height: 100%;
  }
}





:root {
  --bg-main: #0b141a;
  --bg-sidebar: #111b21;
  --bg-header: #202c33;
  --bg-chat: #0b141a;
  --bg-input: #202c33;
  --bg-bubble-received: #202c33;
  --bg-bubble-sent: #005c4b;
  --bg-bubble-sent-hover: #046757;
  --accent: #00a884;
  --accent-soft: #0b8467;
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #8696a0;
  --border-subtle: #202c33;
  --scrollbar: #374045;
  --danger: #f15b5b;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-soft: 0 0 0 1px rgba(15, 20, 25, 0.2),
    0 4px 24px rgba(0, 0, 0, 0.45);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.app-body {
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #202c33 0, #0b141a 55%);
  color: var(--text-primary);
}

/* ===== Layout geral ===== */

.app-wrapper {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: #0a1014;
}

/* ESSENCIAL PARA O SCROLL FUNCIONAR */
.app-wrapper > .sidebar,
.app-wrapper > .chat-main {
  min-height: 0;
}

/* ===== Sidebar ===== */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid #202c33;
  box-shadow: var(--shadow-soft);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-header);
  border-bottom: 1px solid #202c33;
}

.sidebar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-title h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap; /* evita quebrar "Painel - drbetto" */
}

#cliente-nome-header {
  font-weight: 600;
}

.sidebar-title span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-logout {
  border: none;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.07s ease;
}

.btn-logout:hover {
  background: #ff6f6f;
  transform: translateY(-1px);
}

.sidebar-user {
  padding: 10px 18px 12px 18px;
  border-bottom: 1px solid #202c33;
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-user p {
  margin: 2px 0;
}

.sidebar-user .label {
  color: var(--text-muted);
  margin-right: 4px;
}

/* Busca */

.sidebar-search {
  padding: 8px 10px;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 13px;
  background: #202c33;
  color: var(--text-primary);
}

.sidebar-search input::placeholder {
  color: var(--text-secondary);
}

/* Lista de chats */

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}
.chat-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 3px;
}
.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.chat-item:hover {
  background: #202c33;
}

.chat-item.active {
  background: #202c33;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.chat-meta {
  flex: 1;
  min-width: 0;
}

.chat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-number {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 8px;
  white-space: nowrap;
}

.chat-last {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Área principal ===== */

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  min-height: 0; /* importante pro scroll interno */
}

/* Header da conversa */

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-header);
  border-left: 1px solid #202c33;
  border-bottom: 1px solid #202c33;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 600;
}

.chat-header-info h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chat-header-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Mensagens */

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px 16px;
  background: radial-gradient(circle at top, #202c33 0, #0b141a 60%);
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* Linha da mensagem */

.message-row {
  display: flex;
  margin-bottom: 8px;
}

.message-row.sent {
  justify-content: flex-end;
}

.message-row.received {
  justify-content: flex-start;
}

/* Balão */

.message-bubble {
  max-width: 60%;
  background: var(--bg-bubble-received);
  border-radius: 12px;
  padding: 6px 8px 4px 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 13px;
}

.message-row.sent .message-bubble {
  background: var(--bg-bubble-sent);
}

.message-row.sent .message-bubble:hover {
  background: var(--bg-bubble-sent-hover);
}

.message-text {
  margin: 0 0 2px 0;
  color: var(--text-primary);
}

/* Mídia */

.message-media-img {
  max-width: 260px;
  max-height: 240px;
  display: block;
  border-radius: 10px;
  margin-bottom: 4px;
  cursor: pointer;
}

.message-media-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 4px;
  cursor: pointer;
}

.message-media-file:hover {
  background: rgba(0, 0, 0, 0.25);
}

.message-media-icon {
  font-size: 18px;
}

.message-media-name {
  font-size: 12px;
  color: var(--text-primary);
}

/* Rodapé da mensagem (hora/data) */

.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===== Input de mensagem ===== */

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-top: 1px solid #202c33;
}

.chat-input-area input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  background: #101a20;
  color: var(--text-primary);
}

.chat-input-area input::placeholder {
  color: var(--text-secondary);
}

.btn-send {
  border: none;
  outline: none;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.07s ease;
}

.btn-send:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* Emojis */

.emoji-container {
  position: relative;
}

.emoji-toggle {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 4px;
}

.emoji-toggle:hover {
  color: var(--text-primary);
}

.emoji-picker-wrapper {
  position: absolute;
  bottom: 46px;
  left: 0;
  z-index: 50;
  display: none;
  box-shadow: var(--shadow-soft);
}

/* Responsivo */

@media (max-width: 980px) {
  .app-wrapper {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  .app-wrapper {
    grid-template-columns: 100%;
  }

  .sidebar {
    display: none;
  }

  .sidebar.show {
    display: flex;
    position: absolute;
    z-index: 100;
    width: 100%;
    height: 100%;
  }
}

/* Ajuste preciso para alinhar o botão Sair à direita do header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* força os elementos aos extremos */
  padding: 16px 20px;
  position: relative;
}

/* Mantém o bloco de título organizado */
.sidebar-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

/* Ajuste visual do botão */
.btn-logout {
  margin-left: auto; /* empurra totalmente para a direita */
}

/* Header da sidebar como linha única */
.sidebar-header {
  display: flex;
  align-items: flex-start; /* mantém o botão alinhado ao topo */
  justify-content: space-between;
  padding: 16px 20px;
  position: relative;
}

/* Título organizado em coluna */
.sidebar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

/* Botão "Sair" ajustado no topo e à direita */
.btn-logout {
  margin: 0;
  position: relative;
  top: 2px; /* ajuste fino opcional — pode colocar 0, 1, 2 */
}

/* ==== FIX HEADER LADO ESQUERDO + BOTÃO NA DIREITA ==== */
.sidebar-header {
  display: grid;
  grid-template-columns: 1fr auto; /* título ocupa a esquerda, botão fica à direita */
  align-items: flex-start;         /* alinha pelo topo da linha */
  padding: 16px 20px;
}

/* título alinhado à esquerda, em coluna */
.sidebar-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  align-items: flex-start;
}

/* botão "Sair" na direita, alinhado com a linha do título */
.btn-logout {
  margin: 0;
  justify-self: end;  /* joga pra direita */
  align-self: flex-start; /* alinha pelo topo, na mesma linha do "Painel" */
}


/* ===== Área principal ===== */

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
}

/* Header da conversa */

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-header);
  border-left: 1px solid #202c33;
  border-bottom: 1px solid #202c33;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #202c33;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 600;
}

.chat-header-info h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.chat-header-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Botão Apagar no header */

.chat-delete-btn {
  margin-left: auto; /* empurra o botão para o canto direito */
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid #3b454c;
  background-color: #202c33;
  color: #e9edef;
  cursor: pointer;
}

.chat-delete-btn:hover {
  background-color: #2b3840;
}

/* Mensagens */

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px 16px;
  background: radial-gradient(circle at top, #202c33 0, #0b141a 60%);
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}


