/* ============================================================
   Conversas (Inbox Omnichannel) — Lote 1B-1 + fix scroll definitivo
   ============================================================
   Estratégia:
   - Quando o módulo monta, .cv-app vira position:fixed cobrindo
     toda a área disponível abaixo do header do shell. Isso
     ELIMINA a dependência da cadeia height:100% dos pais.
   - .cv-app é grid 3 colunas, cada coluna gerencia seu próprio
     scroll interno via min-height:0 + overflow-y:auto.
   - Header e composer NUNCA encolhem (flex-shrink: 0).
   ============================================================ */

/* Marca aplicada ao #uz-main quando o módulo conversas tá ativo */
.uz-main.cv-fill {
  padding: 0 !important;
  overflow: hidden !important;
}

/* Em modo fill, a app vira fixed cobrindo a área disponível.
   O header do shell tem ~76px (logo+padding). Em telas pequenas
   pode variar — usamos top:auto baseado num CSS var ajustada por JS.
   Default seguro: 76px. */
.uz-main.cv-fill .cv-app {
  position: fixed;
  top: var(--cv-top, 76px);
  bottom: 0;
  left: var(--cv-left, 230px);   /* largura da sidebar do shell */
  right: 0;
  height: auto;
  z-index: 5;
}

/* Quando a sidebar do shell tá colapsada (60px), recalcula */
.uz-sidebar-collapsed .uz-main.cv-fill .cv-app {
  left: var(--cv-left-collapsed, 60px);
}

.cv-app {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--ink);
  border-top: 1px solid var(--line);
}

@media (max-width: 1280px) {
  .cv-app { grid-template-columns: 300px 1fr 280px; }
}

/* ─── Painel esquerdo (caixas + lista) ───────────────────── */

.cv-left {
  display: flex;
  flex-direction: column;
  background: var(--ink-2);
  border-right: 1px solid var(--line);
  min-width: 0;
  min-height: 0;            /* permite os filhos com overflow funcionar */
  overflow: hidden;
}

.cv-left-header {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;           /* não encolhe */
  flex-grow: 0;
}

.cv-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-title-count {
  background: var(--cyan-bg);
  color: var(--cyan);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.cv-search {
  position: relative;
}

.cv-search input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px 8px 32px;
  font-family: var(--font-display);
  font-size: 13px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
}

.cv-search input:focus {
  border-color: var(--cyan-2);
}

.cv-search::before {
  content: "⌕";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mute);
  font-size: 14px;
  pointer-events: none;
}

.cv-tabs {
  display: flex;
  gap: 4px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
  flex-shrink: 0;
  flex-grow: 0;
}

.cv-tab {
  background: transparent;
  border: none;
  color: var(--mute);
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
  transition: color .12s;
}

.cv-tab:hover { color: var(--text-2); }

.cv-tab.active {
  color: var(--cyan);
}

.cv-tab.active::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--cyan);
  border-radius: 2px 2px 0 0;
}

.cv-tab-count {
  background: var(--ink-4);
  color: var(--text-2);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

.cv-tab.active .cv-tab-count {
  background: var(--cyan-bg);
  color: var(--cyan);
}

/* ─── Filtros (status) ───────────────────────────────────── */

.cv-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  flex-grow: 0;
}
.cv-filters::-webkit-scrollbar { display: none; }

.cv-filter-pill {
  flex: 0 0 auto;
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all .15s;
}
.cv-filter-pill:hover { color: var(--text); }
.cv-filter-pill.active {
  background: var(--cyan-bg);
  border-color: var(--cyan-2);
  color: var(--cyan);
}

/* ─── Lista de conversas ─────────────────────────────────── */

.cv-list {
  flex: 1 1 auto;
  min-height: 0;            /* CRÍTICO — sem isso o overflow não dispara */
  overflow-y: auto;
}

.cv-list-empty,
.cv-list-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--mute);
  font-size: 13px;
}

.cv-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s;
  display: flex;
  gap: 12px;
  position: relative;
}

.cv-card:hover {
  background: var(--ink-3);
}

.cv-card.active {
  background: var(--ink-3);
}

.cv-card.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--cyan);
}

.cv-card.unread .cv-card-name {
  font-weight: 600;
  color: var(--text);
}

.cv-card.unread .cv-card-preview {
  color: var(--text-2);
}

.cv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-2), var(--magenta-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex: 0 0 40px;
  font-family: var(--font-mono);
  position: relative;
}

.cv-avatar-channel {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 2px solid var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.cv-card-body {
  flex: 1;
  min-width: 0;
}

.cv-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.cv-card-name {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.cv-card-time {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  flex-shrink: 0;
}

.cv-card-preview {
  font-size: 12px;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.cv-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
}

.cv-card-badge {
  background: var(--cyan);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.cv-card-channel-name {
  color: var(--mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cv-card-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.cv-card-status-dot.open      { background: var(--success); }
.cv-card-status-dot.pending   { background: var(--warn); }
.cv-card-status-dot.snoozed   { background: var(--mute); }
.cv-card-status-dot.resolved  { background: var(--cyan-2); }
.cv-card-status-dot.spam      { background: var(--danger); }

/* ─── Janela da conversa (centro) ────────────────────────── */

.cv-window {
  display: flex;
  flex-direction: column;
  background: var(--ink);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;     /* pra dropzone overlay */
}

.cv-window-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  gap: 14px;
  text-align: center;
  padding: 40px;
}

.cv-window-empty-icon {
  font-size: 56px;
  opacity: 0.4;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cv-window-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
}

.cv-window-empty-sub {
  font-size: 13px;
  max-width: 320px;
  line-height: 1.5;
}

.cv-window-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink-2);
  flex-shrink: 0;
  flex-grow: 0;
}

.cv-window-header-info {
  flex: 1;
  min-width: 0;
}

.cv-window-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-window-sub {
  font-size: 11px;
  color: var(--mute);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cv-window-actions {
  display: flex;
  gap: 6px;
}

.cv-action-btn {
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all .15s;
}
.cv-action-btn:hover {
  background: var(--ink-4);
  color: var(--text);
}
.cv-action-btn.cv-action-primary {
  background: var(--cyan-bg);
  border-color: var(--cyan-2);
  color: var(--cyan);
}
.cv-action-btn.cv-action-primary:hover {
  background: var(--cyan-bg-2);
  color: var(--cyan-glow);
}
.cv-action-btn.cv-action-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.cv-messages {
  flex: 1 1 auto;
  min-height: 0;            /* CRÍTICO — sem isso o overflow não dispara */
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cv-messages-loading,
.cv-messages-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  font-size: 13px;
}

.cv-day-divider {
  text-align: center;
  margin: 14px 0 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.cv-day-divider span {
  background: var(--ink-3);
  padding: 4px 10px;
  border-radius: 999px;
}

.cv-bubble {
  max-width: 65%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
  animation: cv-fade-up .15s ease;
}

@keyframes cv-fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cv-bubble-inbound {
  align-self: flex-start;
  background: var(--ink-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.cv-bubble-outbound {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  color: var(--ink);
  border-bottom-right-radius: 4px;
}

.cv-bubble-system {
  align-self: center;
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--mute);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  max-width: 80%;
  text-align: center;
}

.cv-bubble-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  margin-top: 4px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cv-bubble-outbound .cv-bubble-meta { color: rgba(3,6,14,0.75); }
.cv-bubble-inbound .cv-bubble-meta { color: var(--mute); }

.cv-bubble-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.9;
}

.cv-bubble-status {
  font-size: 10px;
  font-family: var(--font-mono);
}

.cv-bubble-status.pending { opacity: 0.5; }
.cv-bubble-status.sent    { opacity: 0.7; }
.cv-bubble-status.delivered { opacity: 0.9; }
.cv-bubble-status.read    { color: var(--magenta); opacity: 1; }
.cv-bubble-status.failed  { color: var(--danger); }

/* ─── Composer (textarea + enviar) ───────────────────────── */

.cv-composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  background: var(--ink-2);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.cv-composer-input {
  flex: 1;
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: var(--radius);
  min-height: 40px;
  max-height: 160px;
  resize: none;
  outline: none;
  transition: border-color .15s;
  line-height: 1.4;
}
.cv-composer-input:focus {
  border-color: var(--cyan-2);
}

.cv-composer-send {
  background: var(--cyan);
  color: var(--ink);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
  font-weight: 600;
}
.cv-composer-send:hover:not(:disabled) {
  background: var(--cyan-glow);
  box-shadow: var(--shadow-glow-cyan);
}
.cv-composer-send:disabled {
  background: var(--ink-4);
  color: var(--mute-2);
  cursor: not-allowed;
}

.cv-composer-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.06em;
  text-align: right;
  padding: 0 16px 8px;
  background: var(--ink-2);
  margin-top: -8px;
}

/* ─── Painel direito (contato) ───────────────────────────── */

.cv-panel {
  background: var(--ink-2);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.cv-panel-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--mute);
  font-size: 12px;
}

.cv-panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.cv-panel-section-title {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.16em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.cv-panel-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border-bottom: 1px solid var(--line);
}

.cv-panel-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-2), var(--magenta-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 22px;
  font-family: var(--font-mono);
}

.cv-panel-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.cv-panel-id {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.04em;
}

.cv-panel-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 6px 0;
  gap: 10px;
}

.cv-panel-field-label {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cv-panel-field-value {
  color: var(--text-2);
  text-align: right;
  font-size: 12px;
  word-break: break-word;
}

.cv-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--cyan-bg);
  color: var(--cyan);
  margin: 2px 4px 2px 0;
  letter-spacing: 0.04em;
}

/* Timeline de eventos */

.cv-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cv-timeline-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
}

.cv-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan-2);
  margin-top: 5px;
  flex-shrink: 0;
  position: relative;
}

.cv-timeline-item:not(:last-child) .cv-timeline-dot::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 1px;
  height: 32px;
  background: var(--line);
  transform: translateX(-50%);
}

.cv-timeline-body {
  flex: 1;
  min-width: 0;
}

.cv-timeline-text {
  color: var(--text-2);
  line-height: 1.4;
}

.cv-timeline-actor {
  color: var(--cyan);
  font-weight: 500;
}

.cv-timeline-time {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  margin-top: 2px;
}

/* ─── Notas ──────────────────────────────────────────────── */

.cv-note {
  background: var(--warn-bg);
  border-left: 2px solid var(--warn);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
  line-height: 1.4;
}

.cv-note-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.cv-note-input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 12px;
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 60px;
  outline: none;
}
.cv-note-input:focus {
  border-color: var(--cyan-2);
}

.cv-note-add-btn {
  background: var(--cyan-bg);
  border: 1px solid var(--cyan-2);
  color: var(--cyan);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-top: 6px;
}

/* ─── Indicador de conexão socket (canto inferior) ───────── */

.cv-ws-indicator {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0.7;
}
.cv-ws-indicator .cv-ws-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mute-2);
}
.cv-ws-indicator.connected .cv-ws-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.cv-ws-indicator.error .cv-ws-dot {
  background: var(--danger);
}

/* ─── Responsivo simples (mantém grid em telas pequenas) ──── */

@media (max-width: 1100px) {
  .cv-app { grid-template-columns: 280px 1fr 260px; }
}

@media (max-width: 900px) {
  .cv-app { grid-template-columns: 260px 1fr; }
  .cv-panel { display: none; }
}

/* ============================================================
   Mídia / Uploads — Lote 1B-2
   ============================================================ */

/* Wrapper do composer agora vira coluna pra acomodar o preview acima */
.cv-composer-wrap {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--ink-2);
  flex-shrink: 0;
  flex-grow: 0;
}

/* Preview do arquivo selecionado, acima do textarea */
.cv-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--ink-3);
  border-bottom: 1px solid var(--line);
  animation: cv-fade-up .15s ease;
}

.cv-attach-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--cyan);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.cv-attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cv-attach-info {
  flex: 1;
  min-width: 0;
}
.cv-attach-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-attach-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.cv-attach-remove {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--mute);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .12s;
}
.cv-attach-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.cv-attach-progress {
  position: absolute;
  inset: 0;
  background: rgba(3,6,14,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--cyan);
}

/* Botão de clipe + input hidden */
.cv-attach-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-2);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all .15s;
}
.cv-attach-btn:hover {
  background: var(--ink-3);
  color: var(--cyan);
  border-color: var(--cyan-2);
}
.cv-attach-btn input { display: none; }

/* Dropzone overlay (aparece quando arrasta arquivo sobre a janela) */
.cv-window {
  position: relative;   /* pra dropzone overlay */
}

.cv-dropzone {
  position: absolute;
  inset: 0;
  background: rgba(79, 211, 255, 0.06);
  border: 2px dashed var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity .12s;
}
.cv-dropzone.visible { opacity: 1; }

.cv-dropzone::before {
  content: "↓";
  display: block;
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.7;
}
.cv-dropzone-inner {
  text-align: center;
  background: var(--ink-2);
  padding: 24px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--cyan-2);
  box-shadow: var(--shadow-glow-cyan);
}
.cv-dropzone-hint {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-2);
  margin-top: 6px;
  letter-spacing: 0.06em;
}

/* ─── Bubbles de mídia ─────────────────────────────────────── */

.cv-bubble-media {
  padding: 6px;
  max-width: 320px;
}

.cv-bubble-media img,
.cv-bubble-media video {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  cursor: pointer;
  background: var(--ink-3);
}

.cv-bubble-media audio {
  display: block;
  width: 280px;
  margin: 4px 0;
}

.cv-bubble-caption {
  padding: 6px 8px 2px;
  font-size: 13.5px;
  line-height: 1.4;
}

.cv-bubble-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.18);
  padding: 8px 10px;
  border-radius: 8px;
  min-width: 200px;
  margin-bottom: 4px;
}
.cv-bubble-outbound .cv-bubble-doc {
  background: rgba(3,6,14,0.18);
}
.cv-bubble-doc-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  background: var(--cyan-bg-2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  flex-shrink: 0;
}
.cv-bubble-doc-info {
  flex: 1;
  min-width: 0;
}
.cv-bubble-doc-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-bubble-doc-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  opacity: 0.7;
  margin-top: 1px;
}
.cv-bubble-doc-dl {
  background: var(--cyan);
  color: var(--ink);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Lightbox simples pra abrir imagem em tamanho grande */
.cv-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(3,6,14,0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
  animation: uz-fade-in .2s;
}
.cv-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(79,211,255,0.18);
}
.cv-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
}

/* ============================================================
   Modal de Transferência (Lote 1E)
   ============================================================ */

.cv-modal-bg {
  position: fixed; inset: 0;
  background: rgba(3,6,14,0.78);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: uz-fade-in .15s;
}

.cv-modal {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-width: 480px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
}

.cv-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.cv-modal-sub {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.cv-field { margin-bottom: 14px; }

.cv-field-label {
  display: block;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.cv-field-input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 13px;
  outline: none;
  resize: vertical;
}
.cv-field-input:focus { border-color: var(--cyan-2); }

.cv-field-readonly {
  padding: 9px 12px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
}

.cv-modal-warn {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--warn-bg);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.cv-tf-template {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--ink-3);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}

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

.cv-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--text);
}
.cv-btn:hover { background: var(--ink-4); }
.cv-btn-primary {
  background: var(--cyan);
  color: var(--ink);
  border-color: var(--cyan);
  font-weight: 600;
}
.cv-btn-primary:hover { background: var(--cyan-glow); }
.cv-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Botão "Nova conversa" (Lote 1F)
   ============================================================ */

.cv-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cv-new-btn {
  background: var(--cyan);
  color: var(--ink);
  border: none;
  padding: 7px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  white-space: nowrap;
}
.cv-new-btn:hover {
  background: var(--cyan-glow);
  box-shadow: var(--shadow-glow-cyan);
}
