/* Layout */
* { margin: 0; padding: 0; box-sizing: border-box; }

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  min-height: 100vh;
  overflow: hidden;
  background: #f6f7fb;
  color: #111;
}

body.conversas-page .navbar-simple.hidden {
  transform: translate(-50%, 0) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 340px;
  min-width: 340px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(-110deg, black 30%, #01454f 80%);
  color: #fff;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.1rem;
}

.sidebar-header .btn-icon {
  display: none;
}

.search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
}

.search-bar i {
  color: #6b7280;
  font-size: 0.9rem;
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
  color: #333;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Conversation card */
.conv-card {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conv-card:hover { background: #f3f4f6; }
.conv-card.active { background: #eef2ff; border-left: 3px solid #014651; }

.conv-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.conv-card-time {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.conv-card-preview {
  font-size: 0.82rem;
  color: #6b7280;
  min-width: 0;
  overflow: hidden;
}

.conv-preview-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.conv-preview-ico {
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: #6b7280;
  opacity: 0.9;
}

.conv-preview-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-preview-ack {
  flex: 0 0 auto;
  font-size: 0.82rem;
  line-height: 1;
  margin-left: 2px;
}

.conv-preview-ack.wa-ack--read {
  color: #53bdeb;
}

.conv-preview-ack.wa-ack--delivered-grey {
  color: #9ca3af;
}

.conv-preview-ack.wa-ack--sent {
  color: #9ca3af;
}

.conv-card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.badge-status {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.badge-closed { background: #fee2e2; color: #991b1b; }

/* Linha do preview + badge de não-lidas */
.conv-card-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.conv-card-preview-row .conv-card-preview {
  flex: 1;
  min-width: 0;
}

.conv-unread-badge {
  flex: 0 0 auto;
  background: #014651;
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

.conv-card.has-unread .conv-card-name {
  font-weight: 700;
}

.conv-card.has-unread .conv-card-preview {
  color: #111;
  font-weight: 500;
}

/* Indicador de status do realtime (sidebar header) */
.rt-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 6px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.rt-status--open {
  background: #22c55e;
}

.rt-status--connecting {
  background: #f59e0b;
  animation: rt-status-pulse 1s ease-in-out infinite;
}

.rt-status--closed {
  background: #ef4444;
}

@keyframes rt-status-pulse {
  0% { opacity: 0.55; }
  50% { opacity: 1; }
  100% { opacity: 0.55; }
}

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f8fafc;
  position: relative;
  /* Evita largura 100% em telas estreitas (empurraria o chat a zero); alinha com o painel */
  --chat-search-width: min(420px, 92%);
}

.chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, min(520px, 48vw)) minmax(0, auto);
  align-items: center;
  gap: 6px 10px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  min-height: 46px;
  position: relative;
  z-index: 2;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header-info {
  min-width: 0;
}

.chat-header-info h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  font-size: 0.78rem;
  color: #6b7280;
}

.chat-header-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.chat-header-actions {
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  justify-self: end;
  align-items: center;
}

/* Grupo ligar + pesquisar (pill) */
.chat-header-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.chat-header-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.chat-header-tool i {
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.chat-header-tool:hover:not(:disabled) i {
  transform: scale(1.06);
}

.chat-header-tool:active:not(:disabled) {
  transform: scale(0.94);
}

.chat-header-tool:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(1, 70, 81, 0.35);
}

.chat-header-tool:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.chat-header-tool--call:not(:disabled) {
  color: #014651;
  background: linear-gradient(160deg, rgba(1, 70, 81, 0.14) 0%, rgba(1, 70, 81, 0.06) 100%);
}

.chat-header-tool--call:hover:not(:disabled) {
  color: #fff;
  background: linear-gradient(160deg, #016b78 0%, #014651 100%);
  box-shadow: 0 2px 10px rgba(1, 70, 81, 0.28);
}

.chat-header-tool--search:hover:not(:disabled) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.chat-header-tool--search.is-active {
  color: #014651;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(1, 70, 81, 0.22),
    0 2px 6px rgba(1, 70, 81, 0.12);
}

.chat-header-left .btn-icon {
  padding: 4px;
  font-size: 1rem;
}

.chat-search-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--chat-search-width);
  max-height: none;
  border: 1px solid #d1d5db;
  border-right: none;
  border-radius: 12px 0 0 12px;
  background: #fff;
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.12);
  z-index: 40;
  display: none;
  overflow: hidden;
  flex-direction: column;
}

.chat-search-drawer.open {
  display: flex;
}

.chat-search-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.chat-search-head > i {
  font-size: 14px;
  color: #6b7280;
}

.chat-search-head input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}

.chat-search-results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}

.chat-search-empty {
  padding: 12px;
  font-size: 13px;
  color: #6b7280;
}

.chat-search-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
}

.chat-search-item:hover {
  background: #f3f4f6;
}

.chat-search-item-date {
  font-size: 11px;
  color: #6b7280;
}

.chat-search-item-text {
  font-size: 13px;
  color: #111827;
  line-height: 1.3;
  word-break: break-word;
}

.chat-search-item mark {
  background: #d9f99d;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* Com pesquisa aberta, empurra lista + compositor para a esquerda (não sobrepõe o texto) */
.chat-messages,
.chat-composer,
.forward-select-bar,
.forward-target-strip {
  transition: margin-right 0.22s ease;
}

.chat-area.chat-area--search-open .chat-messages,
.chat-area.chat-area--search-open .chat-composer,
.chat-area.chat-area--search-open .forward-select-bar,
.chat-area.chat-area--search-open .forward-target-strip {
  margin-right: var(--chat-search-width);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: inherit;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-icon:hover { background: rgba(0,0,0,0.08); }
.sidebar-header .btn-icon { color: #fff; }
.sidebar-header .btn-icon:hover { background: rgba(255,255,255,0.15); }

/* Messages container */
.chat-messages {
  --msg-gap: 3px;
  --msg-gap-with-reaction: 20px;
  --chat-pad-x: 12px;
  /* Altura do box cinza (áudio / documento) — padding 12px + coluna lateral ~50px */
  --wa-attach-box-height: 62px;
  /* Moldura branca ao redor do box cinza (áudio e documento iguais) */
  --wa-attach-bubble-pad: 4px 5px;
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 12px var(--chat-pad-x);
  /* Fundo gelo "sujo" com malha de quadrados diagonais conectados */
  background-color: #edf1f3;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(233, 238, 241, 0.62)),
    linear-gradient(to right, rgba(154, 167, 178, 0.24) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(154, 167, 178, 0.24) 1px, transparent 1px),
    linear-gradient(to right, rgba(154, 167, 178, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(154, 167, 178, 0.14) 1px, transparent 1px);
  background-size:
    100% 100%,
    16px 16px,
    16px 16px,
    16px 16px,
    16px 16px;
  background-position:
    0 0,
    0 0,
    0 0,
    8px 8px,
    0 0;
  min-height: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #9ca3af;
  text-align: center;
  flex: 1;
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; }

/* Message bubbles — matching dashboard */
.bubble-wrap {
  display: flex;
  margin-bottom: var(--msg-gap);
  width: 100%;
  position: relative;
}

.bubble-wrap.in { justify-content: flex-start; }
.bubble-wrap.out { justify-content: flex-end; }
.bubble-wrap.system { justify-content: center; }

.bubble {
  max-width: 72%;
  border-radius: 12px;
  padding: 7px 9px;
  background: #fff;
  border: 1px solid #e5e7eb;
  word-wrap: break-word;
  position: relative;
  overflow: visible;
}

/* Espaço para a pílula de reação: só abaixo do box (margin no wrap), sem faixa vazia dentro da bolha */
.bubble-wrap:has(.bubble--has-reactions) {
  margin-bottom: var(--msg-gap-with-reaction);
}

/* Bolha enviada: verde anterior + coluna (horário/ticks à direita, reação à esquerda) */
.bubble-wrap.out .bubble {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: #dce3fc;
  border: 1px solid #ccd5f9;
}

.bubble-wrap.out .bubble > .bubble-content,
.bubble-wrap.out .bubble > .wa-text-line,
.bubble-wrap.out .bubble > .contact-card,
.bubble-wrap.out .bubble > .location-card,
.bubble-wrap.out .bubble > .catalog-order-card,
.bubble-wrap.out .bubble > .wa-template-preview,
.bubble-wrap.out .bubble > .wa-media-msg,
.bubble-wrap.out .bubble > .wa-media-box,
.bubble-wrap.out .bubble > .wa-doc-card,
.bubble-wrap.out .bubble > .wa-audio-player,
.bubble-wrap.out .bubble > .wa-meta-row,
.bubble-wrap.out .bubble > .media-fallback,
.bubble-wrap.out .bubble > .forwarded-hint,
.bubble-wrap.out .bubble > .reply-hint-wrap,
.bubble-wrap.out .bubble > .msg-caption {
  align-self: stretch;
  max-width: 100%;
}

.bubble-wrap.in .bubble {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bubble-wrap.in .bubble > .bubble-content,
.bubble-wrap.in .bubble > .wa-text-line,
.bubble-wrap.in .bubble > .contact-card,
.bubble-wrap.in .bubble > .location-card,
.bubble-wrap.in .bubble > .catalog-order-card,
.bubble-wrap.in .bubble > .wa-template-preview,
.bubble-wrap.in .bubble > .wa-media-msg,
.bubble-wrap.in .bubble > .wa-media-box,
.bubble-wrap.in .bubble > .wa-doc-card,
.bubble-wrap.in .bubble > .wa-audio-player,
.bubble-wrap.in .bubble > .media-fallback,
.bubble-wrap.in .bubble > .forwarded-hint,
.bubble-wrap.in .bubble > .reply-hint-wrap,
.bubble-wrap.in .bubble > .msg-caption {
  align-self: stretch;
  max-width: 100%;
}

/*
 * Linha da mensagem estilo WhatsApp Web:
 * - Enviadas: [ações] [bolha]  (ações à esquerda)
 * - Recebidas: [bolha] [ações] (ações à direita)
 * - Ações aparecem no hover, centralizadas verticalmente.
 */
.wa-msg-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  position: relative;
}

.wa-msg-row--out {
  justify-content: flex-end;
}

.wa-msg-row--in {
  justify-content: flex-start;
}

.wa-side-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  align-self: center;
}

.wa-side-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.07);
  color: #54656f;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background 0.15s ease, color 0.15s ease;
}

.wa-msg-row:hover .wa-side-btn {
  opacity: 1;
  pointer-events: auto;
}

.wa-side-btn:hover {
  background: rgba(11, 20, 26, 0.12);
  color: #111b21;
}

/* Horário + ticks na mesma linha (sempre visível; horário à esquerda dos checks) */
.wa-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  padding: 0 2px 2px 0;
  line-height: 1.15;
  width: 100%;
  flex-shrink: 0;
}

.wa-meta-row .wa-clock {
  font-size: 11px;
  color: #667781;
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: right;
}

.bubble-wrap.out .wa-meta-row .wa-clock {
  color: #4b5563;
}

/* Layout estilo WhatsApp: texto com área reservada + meta fixo no canto inferior direito. */
.wa-text-line {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  line-height: 1.4;
  text-align: left;
}

.wa-text-line__text.bubble-content {
  display: block;
  margin-bottom: 0;
  padding-right: 54px;
  white-space: pre-wrap;
  word-break: break-word;
}

.wa-meta-inline {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  line-height: 1;
}

.wa-meta-inline .wa-clock {
  font-size: 11px;
  color: #667781;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: inline-block;
}

.bubble-wrap.out .wa-meta-inline .wa-clock {
  color: #4b5563;
}

.wa-ack {
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.wa-ack i {
  display: inline-block;
  line-height: 1;
}

/* Button response styling */
.button-response-wrapper {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  line-height: 1.4;
  text-align: left;
  padding-bottom: 4px;
}

.button-response {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.9), rgba(226, 232, 240, 0.9));
  border: 1px solid rgba(71, 85, 105, 0.2);
  border-radius: 12px;
  max-width: fit-content;
  font-size: 0.95rem;
  color: #1e293b;
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.button-response:hover {
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.95), rgba(203, 213, 225, 0.95));
  border-color: rgba(71, 85, 105, 0.4);
}

.button-response i {
  font-size: 1.1rem;
  color: #014651;
  flex-shrink: 0;
}

.button-response-text {
  flex: 1;
  word-break: break-word;
}

.bubble-wrap.out .button-response {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(22, 163, 74, 0.08));
  border-color: rgba(34, 197, 94, 0.3);
  color: #15803d;
}

.bubble-wrap.out .button-response i {
  color: #16a34a;
}

.bubble-wrap.out .button-response:hover {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.15), rgba(20, 184, 166, 0.08));
  border-color: rgba(34, 197, 94, 0.5);
}

.wa-ack--sent {
  color: #8696a0;
}

.wa-ack--delivered-grey {
  color: #8696a0;
}

.wa-ack--read {
  color: #1daa61;
}

/* Documento anexo (enviado e recebido — mesmo visual que áudio) */
.wa-doc-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: var(--wa-attach-box-height);
  height: var(--wa-attach-box-height);
  padding: 6px 8px 6px 6px;
  margin-top: 2px;
  border-radius: 14px;
  text-decoration: none;
  color: #111b21;
  min-width: 240px;
  max-width: min(320px, 100%);
  cursor: pointer;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.wa-doc-card:hover {
  filter: brightness(0.97);
}

.wa-doc-card-body {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.wa-doc-footer {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: 0;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
}

.wa-doc-footer .wa-clock {
  font-size: 11px;
  color: #667781;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wa-doc-footer .wa-ack {
  font-size: 14px;
  line-height: 1;
}

.wa-doc-icon-wrap {
  position: relative;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-doc-file-ico {
  font-size: 28px;
  color: #8696a0;
}

.wa-doc-badge {
  position: absolute;
  bottom: 0;
  right: -2px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: #fff;
  padding: 1px 3px;
  border-radius: 2px;
  color: #25d366;
  border: none;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  line-height: 1.2;
  max-width: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-doc-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
  gap: 2px;
  overflow: hidden;
}

.wa-doc-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-doc-sub {
  font-size: 11px;
  color: #667781;
  margin-top: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Imagem/vídeo: bolha branca; legenda quebra linha com horário no canto (igual texto) */
.wa-media-msg {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  max-width: min(624px, 100%);
  vertical-align: top;
}

.wa-media-box {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
  border: none;
}

.wa-media-caption-line {
  margin-top: 2px;
  width: 100%;
  max-width: 100%;
}

.wa-media-caption.wa-text-line__text {
  font-size: 14px;
  line-height: 1.4;
  color: #111b21;
}

/* Só imagem/vídeo (sem legenda): horário colado abaixo da mídia, à direita */
.wa-media-tail {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  width: 100%;
  padding: 0 1px 1px 0;
  line-height: 1;
  min-height: 14px;
}

.wa-sticker-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 4px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #d8dee4;
  box-shadow: none;
  line-height: 1.15;
  flex-shrink: 0;
}

.bubble-wrap.out .wa-sticker-meta {
  background: #eef2f6;
  border-color: #d1d9e0;
}

.wa-sticker-meta .wa-clock {
  font-size: 11px;
  color: #667781;
  font-variant-numeric: tabular-nums;
}

.bubble-wrap.out .wa-sticker-meta .wa-clock {
  color: #4b5563;
}

.wa-media-box .thumb {
  display: block;
  max-width: 100%;
  margin: 0;
  border-radius: 0;
}

.wa-media-visual {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}

.wa-media-visual .thumb,
.wa-media-visual .reply-quote-thumb,
.wa-media-visual video.reply-quote-thumb {
  display: block;
  max-width: 100%;
}

.wa-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.52);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.wa-video-play .bi-play-fill {
  font-size: 2.25rem;
  margin-left: 4px;
  line-height: 1;
}

.wa-media-box--video:hover .wa-video-play,
.wa-media-visual--video:hover .wa-video-play {
  background: rgba(11, 20, 26, 0.62);
  transform: translate(-50%, -50%) scale(1.06);
}

.wa-media-box--video:hover .thumb {
  opacity: 0.92;
}

.wa-media-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 22px 8px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}

/* Figurinha na conversa: ~metade da mídia grande, sempre quadrada; horário em balão separado */
:root {
  --wa-sticker-size: min(214px, 42vw);
}

.wa-sticker-msg {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: var(--wa-sticker-size);
  vertical-align: top;
}

.bubble-wrap.in .bubble > .wa-sticker-msg {
  align-items: flex-start;
}

.wa-sticker-box {
  width: var(--wa-sticker-size);
  height: var(--wa-sticker-size);
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  background: transparent;
}

.wa-sticker-box .thumb--sticker {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
  margin: 0;
  cursor: pointer;
}

.bubble:has(> .wa-sticker-msg) {
  border: none;
  box-shadow: none;
}

.bubble-wrap.in .bubble:has(> .wa-sticker-msg),
.bubble-wrap.out .bubble:has(> .wa-sticker-msg) {
  background: transparent;
  padding: 0 2px 4px;
}

.bubble-wrap.in .bubble:has(> .forwarded-hint):has(> .wa-sticker-msg),
.bubble-wrap.out .bubble:has(> .forwarded-hint):has(> .wa-sticker-msg) {
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  box-shadow: none;
}


.wa-media-footer .wa-clock {
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-variant-numeric: tabular-nums;
}

.wa-media-footer .wa-ack--sent {
  color: rgba(255, 255, 255, 0.88);
}

.wa-media-footer .wa-ack--delivered-grey {
  color: rgba(255, 255, 255, 0.88);
}

.wa-media-footer .wa-ack--read {
  color: #8ef5be;
}

.bubble-wrap.system .bubble {
  background: rgba(0,0,0,0.06);
  border: none;
  font-size: 12px;
  color: #6b7280;
  padding: 4px 12px;
  border-radius: 6px;
  max-width: 80%;
}

/* Meta line: #id • tipoRemetente • direcao • tipoMensagem */
.meta {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}

/* Citação (resposta): barra clicável + preview igual ao tipo da mensagem */
.reply-hint-wrap {
  font-size: 12px;
  color: #4b5563;
  background: rgba(0, 0, 0, 0.04);
  border-left: 3px solid #014651;
  border-radius: 0 8px 8px 0;
  margin-bottom: 6px;
  cursor: pointer;
  overflow: hidden;
  max-width: 100%;
}

.reply-hint-wrap:hover {
  background: rgba(1, 70, 81, 0.06);
}

.reply-hint-wrap:focus-visible {
  outline: 2px solid #014651;
  outline-offset: 1px;
}

.reply-hint-bar {
  padding: 4px 8px;
  font-weight: 500;
}

.reply-hint-bar span {
  font-weight: 600;
}

.reply-hint-preview {
  padding: 0 6px 6px 8px;
  pointer-events: auto;
}

.reply-hint-preview .reply-quote-card {
  margin-bottom: 0;
}

.reply-hint-preview .contact-card,
.reply-hint-preview .location-card,
.reply-hint-preview .media-fallback {
  font-size: 12px;
  padding: 6px 8px;
  margin-top: 0;
}

.reply-hint-preview .media-fallback {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  gap: 6px;
  line-height: 1.35;
}

.reply-hint-preview .media-fallback .media-open {
  color: #075e54;
  text-decoration: none;
}

.reply-hint-preview .media-fallback .media-open:hover {
  text-decoration: underline;
}

.reply-hint-preview .contact-card-header {
  padding-bottom: 4px;
}

.reply-hint-preview .contact-row {
  padding: 4px 0;
}

.reply-hint-preview .contact-icon-btn {
  padding: 2px 6px;
  font-size: 12px;
}

.reply-hint-preview .location-card-action {
  font-size: 11px;
  padding: 4px 8px;
  margin-top: 4px;
}

.reply-quote-thumb {
  display: block;
  max-width: 200px;
  max-height: 120px;
  width: auto;
  height: auto;
  border-radius: 6px;
  object-fit: cover;
}

.reply-quote-thumb--video {
  background: #111;
}

.reply-quote-thumb--sticker {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
  border-radius: 6px;
}

.reply-hint-preview .reply-quote-caption {
  font-size: 11px;
  margin-top: 4px;
  padding: 0;
  color: #4b5563;
}

.reply-hint-preview .reply-quote-text {
  font-size: 12px;
  line-height: 1.4;
  max-height: 4.2em;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 2px 0;
}

.reply-hint-preview .reply-quote-audio {
  max-width: 220px;
  padding: 6px 8px;
  margin-top: 0;
}

.reply-hint-preview .reply-quote-audio .wa-audio-seek {
  min-width: 0;
}

.reply-hint-preview .reply-quote-doc {
  max-width: 240px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.reply-hint-preview .reply-quote-doc .wa-doc-icon-wrap {
  width: 34px;
  height: 38px;
}

.reply-hint-preview .reply-quote-doc .wa-doc-file-ico {
  font-size: 30px;
}

.reply-hint-preview .reply-quote-doc .wa-doc-name {
  font-size: 12px;
}

.reply-hint-preview .reply-quote-doc .wa-doc-sub {
  font-size: 10px;
}

/* Destaque ao ir à mensagem citada (estilo WhatsApp): faixa horizontal verde breve */
.bubble-wrap.msg-anchor-flash {
  z-index: 0;
}

.bubble-wrap.msg-anchor-flash::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  /* Um tom abaixo do verde das mensagens enviadas (#dcfce7 → #bbf7d0) */
  background: #bbf7d0;
  border-radius: 10px;
  opacity: 0;
  animation: msg-anchor-wa-highlight 1.05s ease-out forwards;
  pointer-events: none;
  z-index: 0;
}

.bubble-wrap.msg-anchor-flash > .bubble,
.bubble-wrap.msg-anchor-flash > .wa-msg-row > .bubble {
  position: relative;
  z-index: 1;
}

@keyframes msg-anchor-wa-highlight {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 0.58;
  }
  100% {
    opacity: 0;
  }
}

/* Forwarded hint */
.forwarded-hint {
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
  margin-bottom: 4px;
}

.forwarded-hint i {
  font-size: 10px;
}

/* Bubble content (text messages) */
.bubble-content {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.wa-template-preview {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  min-width: 240px;
}

.bubble-wrap.out .wa-template-preview {
  background: rgba(255, 255, 255, 0.7);
}

.wa-template-header {
  padding: 10px 12px 7px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.wa-template-body {
  padding: 10px 12px 8px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.wa-template-header + .wa-template-body {
  padding-top: 0;
}

.wa-template-buttons {
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.wa-template-btn {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  color: #1d4ed8;
  background: rgba(255, 255, 255, 0.85);
  user-select: none;
  cursor: default;
}

.wa-template-btn:first-child {
  border-top: none;
}

.wa-template-btn-text {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
}

.carousel-context-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff 0%, #f7f7ff 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.carousel-context-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.carousel-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.carousel-context-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.carousel-context-catalog-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.carousel-context-template-name {
  font-size: 12px;
  color: #64748b;
  word-break: break-word;
}

.carousel-context-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.carousel-context-product {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.carousel-context-product-media {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
  color: #94a3b8;
}

.carousel-context-product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-context-product-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.carousel-context-product-name {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
  word-break: break-word;
}

.carousel-context-product-meta {
  font-size: 11px;
  color: #64748b;
  word-break: break-word;
}

.carousel-context-product-price {
  font-size: 11px;
  font-weight: 700;
  color: #0f766e;
}

.wa-meta-row.wa-template-meta {
  margin-top: 4px;
}

/* Imagem/vídeo, áudio e documento: bolha branca (enviado e recebido) */
.bubble-wrap.in .bubble:has(> .wa-media-msg),
.bubble-wrap.out .bubble:has(> .wa-media-msg),
.bubble-wrap.in .bubble:has(> .wa-doc-card),
.bubble-wrap.out .bubble:has(> .wa-doc-card),
.bubble-wrap.in .bubble:has(> .wa-audio-player),
.bubble-wrap.out .bubble:has(> .wa-audio-player) {
  background: #fff;
  border: 1px solid #e5e7eb;
  align-items: flex-start;
  padding: var(--wa-attach-bubble-pad);
  box-shadow: none;
}

.bubble-wrap.out .bubble:has(> .wa-media-msg) .wa-meta-inline .wa-ack,
.bubble-wrap.out .bubble:has(> .wa-sticker-msg) .wa-sticker-meta .wa-ack,
.bubble-wrap.out .wa-doc-footer .wa-ack,
.bubble-wrap.out .bubble > .wa-meta-row .wa-ack,
.bubble-wrap.out .wa-audio-msg-meta .wa-ack {
  display: inline-flex;
  visibility: visible;
  opacity: 1;
}

/* Thumbnail image in bubble */
.thumb {
  max-width: 429px;
  max-height: 429px;
  border-radius: 10px;
  margin-top: 0;
  cursor: pointer;
  display: block;
  border: none;
}

.thumb:hover {
  opacity: 0.85;
}

/* Vídeo usa miniatura; clique abre no player (overlay) */
img.thumb.thumb--video {
  cursor: pointer;
}

.reply-hint-preview .wa-media-visual--video {
  max-width: 100%;
}

.reply-hint-preview .wa-media-visual--video .wa-video-play {
  width: 44px;
  height: 44px;
}

.reply-hint-preview .wa-media-visual--video .wa-video-play .bi-play-fill {
  font-size: 1.35rem;
  margin-left: 2px;
}

.media-fallback .media-open {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.media-fallback .media-open:hover {
  color: #111827;
}

.media-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.media-overlay-dialog {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-overlay-content {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.media-overlay-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* Caption below media */
.msg-caption {
  margin-top: 6px;
  font-size: 14px;
  word-break: break-word;
}

/* Media fallback (when no thumbnail available) */
.media-fallback {
  padding: 13px 16px;
  color: #6b7280;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(585px, 100%);
  border-radius: 12px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
}

.bubble-wrap.out .media-fallback {
  background: rgba(0, 0, 0, 0.06);
}

.media-fallback i {
  font-size: 27px;
}

/* Contact card bubble ([contacts]) */
.contact-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  min-width: 240px;
}

.bubble-wrap.out .contact-card {
  background: rgba(255, 255, 255, 0.5);
}

.contact-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 12px;
}

.contact-card-name {
  font-weight: 700;
  color: #1f2937;
}

.contact-card-list {
  display: flex;
  flex-direction: column;
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.contact-row:first-child {
  border-top: none;
}

.contact-number {
  font-size: 13px;
  color: #0f172a;
}

.contact-row-actions {
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.contact-row:hover .contact-row-actions {
  opacity: 1;
  pointer-events: auto;
}

.contact-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.contact-icon-btn:hover {
  transform: translateY(-1px);
  background: #f3f4f6;
}

.location-card {
  width: 100%;
  min-width: 240px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: #fff;
  color: #111827;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  cursor: default;
  text-align: left;
  user-select: text;
}

.bubble-wrap.out .location-card {
  background: rgba(255, 255, 255, 0.68);
}

.location-card:hover {
  background: #f9fafb;
}

.location-card-head {
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.location-card-coords {
  font-size: 12px;
  color: #475569;
}

.location-card-address {
  font-size: 12px;
  color: #334155;
  line-height: 1.35;
}

.location-card-action {
  border: none;
  background: none;
  padding: 0;
  margin-top: 2px;
  font-size: 12px;
  color: #0f766e;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.location-card-action:hover {
  color: #0f5f59;
  text-decoration: underline;
}

.reply-quote-sys {
  font-size: 12px;
  color: #6b7280;
}

/* WhatsApp-style audio player (Chrome, Firefox, Safari, Edge — HTML5 + range) */
.wa-audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 320px;
  min-height: var(--wa-attach-box-height);
  padding: 6px 8px 6px 6px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.06);
  margin-top: 2px;
  box-sizing: border-box;
}

.wa-audio-player audio {
  display: none;
}

.wa-audio-play {
  flex-shrink: 0;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  color: #fff;
  background: #54656f;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.wa-audio-play:hover {
  opacity: 0.92;
  transform: scale(1.04);
}

.wa-audio-play:active {
  transform: scale(0.96);
}

.wa-audio-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wa-audio-seek {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  cursor: pointer;
  accent-color: #54656f;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

/* WebKit (Safari): track + thumb */
.wa-audio-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.12);
}

.wa-audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #54656f;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wa-audio-seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.12);
}

.wa-audio-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #54656f;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Áudio recebido ainda não ouvido — play e timeline verdes (estilo WhatsApp) */
.bubble-wrap.in .wa-audio-player.wa-audio-player--unheard .wa-audio-play {
  background: #25d366;
}

.bubble-wrap.in .wa-audio-player.wa-audio-player--unheard .wa-audio-seek {
  accent-color: #25d366;
}

.bubble-wrap.in .wa-audio-player.wa-audio-player--unheard .wa-audio-seek::-webkit-slider-thumb {
  background: #25d366;
}

.bubble-wrap.in .wa-audio-player.wa-audio-player--unheard .wa-audio-seek::-moz-range-thumb {
  background: #25d366;
}

.bubble-wrap.in .wa-audio-player.wa-audio-player--unheard .wa-audio-seek::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    #25d366 0%,
    #25d366 var(--audio-seek-pct, 0%),
    rgba(0, 0, 0, 0.12) var(--audio-seek-pct, 0%),
    rgba(0, 0, 0, 0.12) 100%
  );
}

.bubble-wrap.in .wa-audio-player.wa-audio-player--unheard [data-audio-elapsed] {
  color: #1b8f4a;
  font-weight: 600;
}

.wa-audio-times {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #667781;
  line-height: 1.2;
  padding: 0 2px;
  font-variant-numeric: tabular-nums;
}

.wa-audio-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  align-self: flex-start;
  margin-top: 2px;
}

.wa-audio-msg-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.1;
}

.wa-audio-msg-meta .wa-clock {
  font-size: 11px;
  color: #667781;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wa-audio-msg-meta .wa-ack {
  font-size: 14px;
}

.wa-audio-speed {
  flex-shrink: 0;
  min-width: 2rem;
  padding: 3px 5px;
  border-radius: 6px;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  font-size: 10px;
  font-weight: 600;
  color: #41525d;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.wa-audio-speed:hover {
  background: rgba(0, 0, 0, 0.12);
}

.reply-hint-preview .wa-audio-side .wa-audio-speed {
  padding: 2px 4px;
  font-size: 9px;
  min-width: 1.75rem;
}

/* Reações: bolha pill colada embaixo da mensagem (estilo WA) */
.reactions {
  font-size: 14px;
  letter-spacing: 0.5px;
  line-height: 1;
}

.reactions--wa {
  position: absolute;
  left: 4px;
  bottom: -17px;
  z-index: 2;
  padding: 3px 10px 5px;
  background: #fff;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.bubble-wrap.out .reactions--wa {
  left: auto;
  right: 4px;
}

/* Bubble footer with timestamp */
.bubble-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.bubble-timestamp {
  font-size: 11px;
  color: #6b7280;
}

.bubble-wrap.out .bubble-timestamp {
  color: #4b7a52;
}

/* ── Chevron trigger (opens context menu) ── */
.msg-menu-trigger {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: #3b4a54;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
  z-index: 3;
}

.bubble:hover .msg-menu-trigger,
.bubble-wrap.system .bubble:hover .msg-menu-trigger,
.msg-menu-trigger.active {
  opacity: 1;
  pointer-events: auto;
}

.msg-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.96);
  color: #1f2c33;
}

.bubble-wrap.out .msg-menu-trigger {
  background: rgba(255, 255, 255, 0.88);
}

/* WhatsApp-like: mídia usa sobreposição escura com ícone branco */
.bubble:has(.wa-media-msg) .msg-menu-trigger,
.bubble:has(.wa-media-box) .msg-menu-trigger {
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
}

.bubble:has(.wa-media-msg) .msg-menu-trigger:hover,
.bubble:has(.wa-media-box) .msg-menu-trigger:hover {
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
}

/* Áudio: menu (drop) mais alto e cinza escuro — não cobre o botão de velocidade */
.bubble:has(.wa-audio-player) .msg-menu-trigger {
  top: 0;
  right: 4px;
  width: 22px;
  height: 18px;
  background: rgba(55, 65, 81, 0.14);
  color: #374151;
}

.bubble:has(.wa-audio-player):hover .msg-menu-trigger,
.bubble:has(.wa-audio-player) .msg-menu-trigger.active {
  opacity: 1;
  pointer-events: auto;
  background: rgba(55, 65, 81, 0.22);
  color: #1f2937;
}

.bubble:has(.wa-audio-player) .msg-menu-trigger:hover {
  background: rgba(55, 65, 81, 0.3);
  color: #111827;
}

/* ── Context menu ── */
.msg-ctx-menu {
  display: none;
  position: absolute;
  top: 0;
  right: calc(100% + 6px);
  z-index: 10;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  animation: ctxMenuIn 0.12s ease-out;
}

.bubble-wrap.in .msg-ctx-menu {
  right: auto;
  left: calc(100% + 6px);
}

.msg-ctx-menu.open {
  display: block;
}

@keyframes ctxMenuIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Quick emoji bar */
.msg-ctx-emojis {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #f0f0f0;
}

.msg-ctx-emojis button {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.1s;
}

.msg-ctx-emojis button:hover {
  transform: scale(1.25);
  background: rgba(0, 0, 0, 0.06);
}

.msg-ctx-emoji-plus {
  color: #6b7280 !important;
  font-size: 14px !important;
}

/* Menu items list */
.msg-ctx-items {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.msg-ctx-items button,
.msg-ctx-items .msg-ctx-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-family: inherit;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.1s;
}

.msg-ctx-items button:hover,
.msg-ctx-items .msg-ctx-item-link:hover {
  background: #f3f4f6;
}

.msg-ctx-items button i,
.msg-ctx-items .msg-ctx-item-link i {
  font-size: 15px;
  color: #6b7280;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Reaction box (emoji text input fallback) */
.reaction-box {
  display: none;
  margin-top: 6px;
}

.reaction-box.active {
  display: flex;
  gap: 6px;
  align-items: center;
}

.reaction-box input {
  width: 80px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 14px;
  outline: none;
}

.reaction-box input:focus {
  border-color: #014651;
}

.reaction-box button {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: #111;
  color: #fff;
  border-color: #111;
  border-radius: 8px;
  cursor: pointer;
}

/* ── Emoji picker overlay ── */
.ep-overlay {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ep-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.ep-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 380px);
  max-height: 460px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ctxMenuIn 0.15s ease-out;
}

.ep-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ep-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 10px 4px;
  border-bottom: 1px solid #f0f0f0;
  overflow-x: auto;
  flex-shrink: 0;
}

.ep-tab {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  flex-shrink: 0;
}

.ep-tab:hover {
  background: rgba(0, 0, 0, 0.06);
}

.ep-tab.active {
  background: #e0f2fe;
}

.ep-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.ep-search i {
  color: #9ca3af;
  font-size: 13px;
  flex-shrink: 0;
}

.ep-search-input {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
  outline: none;
  font-family: inherit;
  background: #f9fafb;
}

.ep-search-input:focus {
  border-color: #014651;
  background: #fff;
}

.ep-label {
  padding: 6px 14px 2px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  flex-shrink: 0;
}

.ep-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 4px 10px 10px;
  overflow-y: auto;
  max-height: 300px;
  flex: 1;
}

.ep-emoji {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, background 0.08s;
}

.ep-emoji:hover {
  transform: scale(1.2);
  background: rgba(0, 0, 0, 0.06);
}

.ep-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 24px 0;
}

/* Date separator */
.date-separator {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.date-separator span {
  background: rgba(0,0,0,0.06);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
}

.forward-select-bar {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.forward-select-actions {
  display: flex;
  gap: 8px;
}

.forward-target-strip {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.forward-target-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.forward-target-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bubble-wrap.forward-select-mode {
  cursor: pointer;
  position: relative;
}

.bubble-wrap.forward-selected {
  background: rgba(37, 211, 102, 0.14);
}

.bubble-wrap.forward-selected .wa-msg-row,
.bubble-wrap.forward-selected .bubble {
  background: transparent;
}

.forward-check {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #9ca3af;
  background: #fff;
  z-index: 3;
}

.bubble-wrap.forward-selected .forward-check {
  background: #25d366;
  border-color: #25d366;
}

/* Composer */
.chat-composer {
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.chat-composer .input-group {
  align-items: flex-end;
}

.composer-row--recording .attach-wrap,
.composer-row--recording #messageInput,
.composer-row--recording .btn-voice-note,
.composer-row--voice-preview .attach-wrap,
.composer-row--voice-preview #messageInput,
.composer-row--voice-preview .btn-voice-note {
  display: none !important;
}

.composer-row--recording .voice-recording-bar,
.composer-row--voice-preview .voice-recording-bar {
  display: flex;
}

.composer-row--recording .btn-send,
.composer-row--voice-preview .btn-send {
  opacity: 1;
  pointer-events: auto;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: #25d366;
  color: #fff;
  flex-shrink: 0;
}

.composer-row--recording .btn-send:hover,
.composer-row--voice-preview .btn-send:hover {
  background: #20bd5a;
  color: #fff;
}

/* Barra de gravação / prévia no composer (estilo WhatsApp) */
.voice-recording-bar {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  height: 40px;
  margin: 0 2px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.voice-recording-bar.is-active {
  display: flex;
  width: 100%;
}

/* Metade esquerda vazia — lixeira, play e onda começam no centro da barra */
.voice-recording-lead {
  flex: 0 0 50%;
  width: 50%;
  max-width: 50%;
  min-width: 50%;
  pointer-events: none;
}

.voice-recording-cluster {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
}

.voice-recording-left,
.voice-recording-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.voice-recording-mid {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 0;
}

.btn-voice-discard {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #3b4a54;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.btn-voice-discard:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #111b21;
}

.btn-voice-discard i {
  font-size: 1.15rem;
}

.voice-recording-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-record-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ea0038;
  flex-shrink: 0;
}

.voice-recording-bar.is-active:not(.is-paused) .voice-record-live-dot {
  animation: voiceDotBlink 1s step-end infinite;
}

.voice-recording-bar.is-preview .voice-record-live-dot {
  background: #8696a0;
  animation: none;
}

.voice-recording-bar.is-recording:not(.is-record-paused) .btn-voice-play {
  display: none !important;
}

.voice-recording-bar.is-recording.is-record-paused .btn-voice-play {
  display: inline-flex !important;
}

.voice-recording-bar.is-preview .btn-voice-bar-mic {
  display: none !important;
}

.voice-recording-bar.is-preview:not(.is-playing-audio) .voice-pause-bars {
  display: none !important;
}

.voice-recording-bar.is-recording:not(.is-record-paused) .btn-voice-pause {
  display: inline-flex !important;
}

.voice-recording-bar.is-recording.is-record-paused .btn-voice-pause {
  display: none !important;
}

.voice-recording-bar.is-recording.is-record-paused .btn-voice-bar-mic {
  display: inline-flex !important;
}

.voice-recording-bar.is-recording:not(.is-record-paused) .btn-voice-bar-mic {
  display: none !important;
}

.voice-recording-bar.is-recording:not(.is-record-paused) .btn-voice-pause .voice-pause-bars {
  display: flex;
}

.voice-recording-bar.is-record-paused .voice-record-live-dot {
  background: #8696a0;
  animation: none;
}

.voice-recording-right {
  position: relative;
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.voice-recording-right .btn-voice-pause,
.voice-recording-right .btn-voice-bar-mic {
  position: absolute;
  inset: 0;
  margin: 0;
}

.voice-recording-bar.is-preview.is-playing-audio .btn-voice-play {
  display: none !important;
}

.voice-recording-bar.is-preview:not(.is-playing-audio) .btn-voice-pause {
  display: none !important;
}

.voice-recording-bar.is-preview.is-playing-audio .btn-voice-pause {
  display: inline-flex !important;
}

.voice-recording-bar.is-preview.is-playing-audio .voice-pause-bars {
  display: flex !important;
}

.btn-voice-play {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #ea0038;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 1.35rem;
}

.voice-recording-bar.is-preview .btn-voice-play {
  display: inline-flex;
}

.btn-voice-play:hover,
.btn-voice-pause:hover {
  background: rgba(0, 0, 0, 0.05);
}

@keyframes voiceDotBlink {
  50% { opacity: 0.4; }
}

.voice-record-timer {
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #3b4a54;
  line-height: 1;
  min-width: 2.4em;
}

.voice-recording-wave-wrap {
  flex: 1 1 auto;
  min-width: 48px;
  height: 32px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

#voiceWaveCanvas {
  width: 100%;
  height: 32px;
  display: block;
}

.btn-voice-pause {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.voice-recording-bar.is-preview.is-playing-audio .btn-voice-pause {
  display: inline-flex;
}

.btn-voice-bar-mic {
  display: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #ea0038;
  color: #fff;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-voice-bar-mic i {
  font-size: 1rem;
}

.btn-voice-bar-mic:hover {
  background: #d10030;
  color: #fff;
}

.voice-pause-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 14px;
  height: 16px;
}

.voice-pause-bars::before,
.voice-pause-bars::after {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: #ea0038;
}

.composer-row--recording.input-group,
.composer-row--voice-preview.input-group {
  align-items: center;
  flex-wrap: nowrap;
}

.btn-voice-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid #d1d5db;
  border-left: none;
  background: #f9fafb;
  color: #014651;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-voice-note:hover {
  background: #ecfdf5;
}

.btn-voice-note.is-recording {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
  animation: voiceMicPulse 0.9s ease-in-out infinite;
}

@keyframes voiceMicPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.btn-voice-note i {
  font-size: 1.05rem;
}

#btnPickFile {
  border-radius: 10px 0 0 10px;
  min-height: 38px;
}

.attach-wrap {
  position: relative;
}

.attach-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: none;
}

.attach-menu.open {
  display: block;
}

.attach-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #111827;
}

.attach-menu-item:hover {
  background: #f3f4f6;
}

.sticker-preview img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

.chat-composer textarea {
  resize: none;
  border-radius: 0;
  max-height: 120px;
  min-height: 38px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #d1d5db;
  padding: 8px;
}

.chat-composer .btn-send {
  border-radius: 0 10px 10px 0;
  border-left: none;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-left: none;
  background: #f9fafb;
  color: #9ca3af;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chat-composer .btn-send:hover {
  background: #f3f4f6;
  color: #6b7280;
}

.chat-composer .btn-send.is-ready {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.chat-composer .btn-send.is-ready:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.chat-composer .btn-send.is-uploading {
  opacity: 0.72;
  cursor: default;
}

.chat-composer .btn-send.is-uploading.is-ready {
  cursor: pointer;
}

/* Reply bar */
.reply-bar {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #f3f4f6;
  border-radius: 8px;
  border-left: 3px solid #014651;
  font-size: 12px;
  display: none;
}

.reply-bar.active {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.reply-bar button {
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.reply-bar button:hover {
  background: #e5e7eb;
  color: #111;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-msg {
  padding: 10px 16px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transition: opacity 0.3s;
  background: #343a40;
}

.toast-msg.show { opacity: 1; }
.toast-msg.error { background: #dc3545; }
.toast-msg.success { background: #198754; }

/* Loading spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #6b7280;
  font-size: 13px;
}

.loading-spinner::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top-color: #014651;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 100;
    width: 85%;
    max-width: 340px;
    transition: left 0.25s ease;
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }

  .sidebar-header .btn-icon { display: flex; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    display: none;
  }

  .sidebar-overlay.show { display: block; }

  .chat-area { width: 100%; }

  .bubble { max-width: 75%; }

  /* No mobile, não reservar espaço lateral nas mensagens (recebidas/enviadas) */
  .wa-msg-row .wa-side-actions {
    display: none;
  }
}

/* Viewport dinâmico para mobile (barras do navegador topo/rodapé) */
@supports (height: 100dvh) {
  body,
  .app-layout,
  .sidebar {
    min-height: 94dvh;
    height: 94dvh;
  }
}

@media (max-width: 480px) {
  .chat-messages {
    --chat-pad-x: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .bubble { max-width: 75%; }
  .conv-card { padding: 10px 12px; }
  .bubble-content {
    font-size: 15px;
    font-weight: 450;
  }
  .meta { font-size: 10px; }
}

/* Barra de chamada — centralizada no header (mesmo lugar inbound/outbound) */
.call-incoming-backdrop {
  display: none;
}

.call-bar {
  width: 100%;
  max-width: min(520px, 100%);
  display: none;
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.call-bar.is-visible.is-docked {
  display: block;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.call-bar.is-incoming-ring.is-docked .call-bar-inner {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28), 0 8px 28px rgba(0, 0, 0, 0.12);
  animation: callBarRingPulse 1.4s ease-in-out infinite;
}
.call-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
@keyframes callBarRingPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22), 0 8px 28px rgba(0, 0, 0, 0.1); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.35), 0 12px 36px rgba(0, 0, 0, 0.14); }
}
.call-bar-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.call-bar-icon {
  font-size: 1rem;
  color: var(--bs-success);
  flex-shrink: 0;
}
.call-bar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.call-bar-title {
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-bar-sub {
  font-size: 0.68rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.call-bar-controls .btn {
  padding: 0.15rem 0.35rem;
  font-size: 0.7rem;
  line-height: 1;
}
.call-bar-controls .btn i {
  font-size: 0.85rem;
}
.call-bar-controls #btnCallMute.btn-call-mute-active {
  background: var(--bs-danger);
  border-color: var(--bs-danger);
  color: #fff;
}
.call-bar-controls #btnCallMute.btn-call-mute-active:hover {
  background: #bb2d3b;
  border-color: #b02a37;
  color: #fff;
}
.call-volume-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}
.call-volume-label input[type="range"] {
  width: 72px;
  cursor: pointer;
}
@media (max-width: 576px) {
  .call-volume-label .bi-volume-up { display: none; }
  .call-volume-label input[type="range"] { width: 56px; }
}

@media (max-width: 900px) {
  .chat-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    min-height: 40px;
    padding: calc(4px + env(safe-area-inset-top, 0px)) 8px 4px;
    gap: 4px 6px;
  }
  .chat-header-info h5 {
    font-size: 0.88rem;
  }
  .chat-subtitle {
    font-size: 0.7rem;
  }
  .chat-header-left {
    grid-column: 1;
    grid-row: 1;
    gap: 6px;
  }
  .chat-header-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 3px;
  }
  .chat-header-tools {
    padding: 2px;
  }
  .chat-header-tool {
    width: 28px;
    height: 28px;
  }
  .chat-header-tool i {
    font-size: 0.88rem;
  }
  .chat-header-center {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 0;
  }
  .chat-header-center:not(:has(.call-bar.is-visible.is-docked)) {
    display: none;
  }
  .call-bar-inner {
    padding: 0.3rem 0.45rem;
    gap: 0.35rem;
    border-radius: 6px;
  }
  .call-bar-title { font-size: 0.75rem; }
  .call-bar-sub { font-size: 0.65rem; }
  .call-bar-controls .btn {
    padding: 0.1rem 0.28rem;
  }
  .call-volume-label {
    font-size: 0.72rem;
  }
  .call-volume-label input[type="range"] {
    width: 48px;
  }
}

/* Pré-visualização de envio de mídia (estilo WhatsApp) */
.composer-send-preview {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: none;
  align-items: stretch;
  justify-content: center;
}

.composer-send-preview.is-open {
  display: flex;
}

.composer-send-preview__backdrop {
  position: absolute;
  inset: 0;
  background: #0b141a;
}

.composer-send-preview__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  min-height: 0;
  color: #e9edef;
}

.composer-send-preview__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #202c33;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.composer-send-preview__header-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #aebac1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.composer-send-preview__header-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.composer-send-preview__title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #e9edef;
}

.composer-send-preview__counter {
  font-size: 12px;
  color: #8696a0;
  min-width: 2.5rem;
  text-align: center;
}

.composer-send-preview__send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  background: #00a884;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.composer-send-preview__send:hover {
  background: #06cf9c;
}

.composer-send-preview__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: 12px 4px;
}

.composer-send-preview__nav {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #e9edef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.35rem;
}

.composer-send-preview__nav:hover {
  background: rgba(255, 255, 255, 0.14);
}

.composer-send-preview__stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: min(62vh, 520px);
}

.composer-send-preview__stage-media {
  display: block;
  max-width: 100%;
  max-height: min(62vh, 520px);
  object-fit: contain;
  border-radius: 6px;
}

.composer-send-preview__stage-media--sticker {
  width: min(280px, 70vw);
  height: min(280px, 70vw);
  object-fit: contain;
  background: transparent;
}

.composer-send-preview__stage-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  max-width: 90%;
  text-align: center;
}

.composer-send-preview__stage-doc .bi {
  font-size: 3.5rem;
  color: #8696a0;
}

.composer-send-preview__stage-audio .composer-send-preview__stage-audio-el {
  width: min(360px, 90vw);
  margin-top: 4px;
}

.composer-send-preview__stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  padding: 0 10px;
  border-radius: 8px;
  background: #00a884;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.composer-send-preview__stage-name {
  font-size: 15px;
  font-weight: 500;
  color: #e9edef;
  word-break: break-word;
}

.composer-send-preview__stage-size {
  font-size: 13px;
  color: #8696a0;
}

.composer-send-preview__thumbs {
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
}

.composer-send-preview__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #2a3942;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.composer-send-preview__thumb.is-active {
  border-color: #00a884;
}

.composer-send-preview__thumb-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.composer-send-preview__thumb-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  color: #aebac1;
  font-size: 1.5rem;
  padding: 4px;
}

.composer-send-preview__thumb-name {
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  color: #e9edef;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-send-preview__thumb-remove {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.72);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.composer-send-preview__thumb-remove:hover {
  background: #ea0038;
}

.composer-send-preview__footer {
  flex-shrink: 0;
  padding: 10px 12px 14px;
  background: #202c33;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.composer-send-preview__caption {
  width: 100%;
  resize: none;
  border-radius: 8px;
  border: 1px solid #3b4a54;
  background: #2a3942;
  color: #e9edef;
  font-size: 15px;
  line-height: 1.4;
  padding: 10px 12px;
  min-height: 44px;
  max-height: 120px;
}

.composer-send-preview__caption::placeholder {
  color: #8696a0;
}

.composer-send-preview__caption:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.composer-send-preview__hints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 8px 0 0;
  font-size: 11px;
  color: #8696a0;
}

.composer-send-preview__hints span::before {
  content: "· ";
  opacity: 0.6;
}

.composer-send-preview__hints span:first-child::before {
  content: "";
}

/* Catalog order card ([order]) */
.catalog-order-card {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  overflow: hidden;
  min-width: 280px;
  max-width: 350px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.bubble-wrap.out .catalog-order-card {
  background: linear-gradient(135deg, #ffffff 0%, #f3f7ff 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.order-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(90deg, rgba(1, 69, 79, 0.06) 0%, rgba(1, 69, 79, 0.02) 100%);
}

.order-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.order-header-title i {
  font-size: 16px;
  color: #01454f;
}

.order-title {
  font-weight: 700;
  font-size: 13px;
  color: #1f2937;
}

.order-catalog-id {
  font-size: 10px;
  color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: monospace;
}

.order-items {
  display: flex;
  flex-direction: column;
  max-height: 180px;
  overflow-y: auto;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 12px;
}

.order-item:first-child {
  border-top: none;
  padding-top: 12px;
}

.order-item:last-child {
  padding-bottom: 12px;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.item-id {
  font-weight: 600;
  color: #1f2937;
  word-break: break-word;
  font-size: 12px;
}

.item-qty {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

.item-price {
  font-weight: 700;
  color: #01454f;
  white-space: nowrap;
  font-size: 12px;
}

.item-thumbnail {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(1, 69, 79, 0.12) 0%, rgba(0, 196, 212, 0.08) 100%);
  border: 1.5px solid rgba(1, 69, 79, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #01454f;
  flex-shrink: 0;
}

.order-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(1, 69, 79, 0.08) 0%, rgba(1, 69, 79, 0.04) 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.total-label {
  font-weight: 700;
  font-size: 12px;
  color: #374151;
}

.total-amount {
  font-weight: 700;
  font-size: 14px;
  color: #01454f;
}

.order-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  font-size: 11px;
  color: #4b5563;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.02) 0%, rgba(1, 69, 79, 0.02) 100%);
  line-height: 1.4;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.order-note i {
  font-size: 11px;
  color: #01454f;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.7;
}

.order-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px 8px 14px;
  font-size: 11px;
}

@media (max-width: 576px) {
  .chat-header {
    min-height: 36px;
    padding: calc(3px + env(safe-area-inset-top, 0px)) 6px 3px;
  }
  .chat-header-tools {
    gap: 1px;
  }
  .chat-header-tool {
    width: 26px;
    height: 26px;
  }
  .chat-header-tool i {
    font-size: 0.84rem;
  }
  .chat-header-left .btn-icon {
    padding: 3px;
    font-size: 0.92rem;
  }
}
