/* Conversas: mensagens e ficha do contato. Escopo próprio para preservar os outros chats do painel. */
.chat-history,
.chat-insights-card {
  --chat-ink: var(--aia-ink,#27324b);
  --chat-muted: var(--aia-muted,#6c7891);
  --chat-line: var(--aia-line,#e9edf5);
  --chat-soft: var(--aia-soft,#f7f9fd);
  --chat-surface: var(--aia-surface,#fff);
  --chat-accent: var(--aia-accent,#066fd1);
}

.chat-history { color: var(--chat-ink); }
.chat-history .chat-bubbles { display: flex; flex-direction: column; gap: 9px; }
.chat-history .chat-item { display: flex; margin: 0; padding: 0; }
.chat-history .chat-item[data-sender="ia"],
.chat-history .chat-item[data-sender="studio"] { justify-content: flex-end; }
.chat-history .chat-message { flex: 0 1 auto; min-width: 0; max-width: min(78%,560px); width: fit-content; }
.chat-history .chat-message:has(.chat-midia) { width: 340px; }
.chat-history .chat-bubble {
  position: relative;
  margin: 0;
  padding: 8px 11px 9px;
  border-radius: 12px 12px 12px 4px;
  border: 1px solid transparent;
  font-size: calc(13px * var(--aia-text-scale, 1));
  font-weight: 400;
  line-height: 1.5;
  box-shadow: 0 2px 5px rgb(38 47 74 / 3%);
  transform: none;
}
.chat-history .chat-bubble-me { border-radius: 12px 12px 4px 12px; }
.chat-history .chat-item[data-sender="cliente"] .chat-bubble {
  color: #2c4438;
  background: linear-gradient(120deg, #effbf2, #e6f8eb);
  border-color: #d8f0e0;
}
.chat-history .chat-item[data-sender="ia"] .chat-bubble {
  color: #fff;
  background: linear-gradient(118deg, #7b38f1, #5039ed);
  box-shadow: 0 3px 9px rgb(103 58 215 / 10%);
}
.chat-history .chat-item[data-sender="studio"] .chat-bubble {
  color: #fff;
  background: linear-gradient(118deg, #1676e4, #0862d4);
  box-shadow: 0 3px 9px rgb(28 104 211 / 8%);
}
.chat-history .chat-bubble-title { display: flex; align-items: center; gap: 6px; margin: 0 0 3px; min-height: 14px; }
.chat-history .chat-bubble-author { font-size: calc(10.5px * var(--aia-text-scale, 1)); line-height: 1; font-weight: 650; color: inherit; }
.chat-history .chat-bubble-date { margin-left: 4px; font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1; font-weight: 400; color: inherit; opacity: .65; white-space: nowrap; }
.chat-sender-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; width: 16px; height: 16px; border-radius: 50%; background: rgb(255 255 255 / 19%); }
.chat-sender-icon svg { width: 11px; height: 11px; stroke-width: 1.8; }
[data-sender="cliente"] .chat-sender-icon { color: #0db85d; background: rgb(255 255 255 / 65%); }
.chat-history .chat-texto { margin: 0; font-size: inherit; font-weight: 400; line-height: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-history .chat-bubble-body > * + .chat-texto { margin-top: 7px; }
.chat-bubble-footer { position: absolute; right: 9px; bottom: 7px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; height: 12px; }
.chat-history .chat-bubble:has(.chat-bubble-footer):not(:has(.chat-midia)) .chat-bubble-body > .chat-texto:last-child::after { content: ''; display: inline-block; width: 24px; }
.chat-history .chat-bubble:has(.chat-editada):not(:has(.chat-midia)) .chat-bubble-body > .chat-texto:last-child::after { width: 60px; }
.chat-history .chat-bubble:has(.chat-midia) .chat-bubble-footer { position: static; margin-top: 3px; }
.chat-editada { color: inherit; opacity: .6; font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1; }
.chat-status { display: inline-flex; align-items: center; color: currentColor; opacity: .65; }
.chat-status svg { width: 17px; height: 12px; }
.chat-status-lida { color: #c7eaff; opacity: 1; }
.chat-status-falhou { color: #ffe0a5; opacity: 1; }
.chat-day-separator { display: flex; justify-content: center; margin: 9px 0 6px; }
.chat-day-separator span { padding: 4px 13px; border-radius: 20px; color: #6c7790; background: #edf0f7; font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.35; font-weight: 500; }
.chat-day-separator:first-child { margin-top: 0; }
.chat-history .chat-citada { margin: 0 0 7px; padding: 7px 9px; border-left: 2px solid currentColor; border-radius: 3px 7px 7px 3px; background: rgb(255 255 255 / 12%); font-size: calc(11px * var(--aia-text-scale, 1)); line-height: 1.45; }
.chat-history .chat-citada > span { font-size: calc(9px * var(--aia-text-scale, 1)); opacity: .72; margin-bottom: 2px; }
.chat-history [data-sender="cliente"] .chat-citada { background: rgb(31 112 64 / 5%); border-color: #8cbaa1; }
.chat-history .chat-item:has(.chat-reacoes) { margin-bottom: 8px; }
.chat-history .chat-reacoes { position: absolute; left: 10px; bottom: -10px; display: flex; gap: 3px; margin: 0; }
.chat-history .chat-reacoes > span { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 6px; border: 1px solid #e8ecf3; border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgb(30 45 70 / 5%); font-size: calc(12px * var(--aia-text-scale, 1)); line-height: 1; }

/* A mídia faz parte do próprio balão; não há um segundo cartão ao redor dela. */
.chat-history .chat-bubble-midia { padding: 4px; }
.chat-history .chat-bubble-midia .chat-bubble-title { margin: 2px 5px 5px; min-height: 12px; }
.chat-history .chat-bubble-midia .chat-bubble-author { font-size: calc(10px * var(--aia-text-scale, 1)); opacity: .83; }
.chat-history .chat-bubble-midia .chat-bubble-footer { margin: 5px 5px 2px; }
.chat-history .chat-bubble-midia .chat-bubble-date { margin: 0; font-size: calc(9px * var(--aia-text-scale, 1)); }
.chat-history .chat-bubble-midia .chat-bubble-body > .chat-texto { margin: 6px 5px 2px; }
.chat-history .chat-midia { position: relative; width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.chat-midia-duracao { margin-left: auto; font-size: calc(10px * var(--aia-text-scale, 1)); font-variant-numeric: tabular-nums; opacity: .7; }
.chat-midia-stage { min-width: 0; }
.chat-history .chat-midia-carregar { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: inherit; font: inherit; font-size: calc(12px * var(--aia-text-scale, 1)); font-weight: 500; cursor: pointer; transition: background .15s; text-align: left; }
.chat-midia-carregar svg { width: 22px; height: 22px; flex-shrink: 0; }
.chat-midia-carregar > span { overflow-wrap: anywhere; }
.chat-history .chat-midia-carregar:hover { color: inherit; background: rgb(255 255 255 / 10%); }
.chat-history [data-sender="cliente"] .chat-midia-carregar:hover { background: rgb(31 112 64 / 6%); }
.chat-history .chat-midia[data-tipo="imagem"] .chat-midia-carregar,
.chat-history .chat-midia[data-tipo="figurinha"] .chat-midia-carregar,
.chat-history .chat-midia[data-tipo="video"] .chat-midia-carregar { justify-content: center; min-height: 150px; }
.chat-history .chat-midia-preview { display: block; width: 100%; max-width: 100%; border-radius: 8px; }
.chat-history img.chat-midia-preview { max-height: 320px; width: 100%; object-fit: contain; background: transparent; }
.chat-history video.chat-midia-preview { max-height: 320px; background: #172034; }
.chat-history audio.chat-midia-preview { height: 40px; border-radius: 0; }
.chat-history .chat-midia[data-tipo="audio"] .chat-midia-stage { padding-right: 29px; }
.chat-midia-actions { min-width: 0; }
.chat-history .chat-midia-download { position: absolute; top: 7px; right: 6px; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: 0; border-radius: 50%; background: rgb(20 31 47 / 48%); color: #fff; opacity: .85; text-decoration: none; }
.chat-history .chat-midia[data-tipo="audio"] .chat-midia-download { background: transparent; color: inherit; }
.chat-midia-download svg { width: 15px; height: 15px; }
.chat-history .chat-midia-download:hover { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .chat-history .chat-midia[data-tipo="imagem"] .chat-midia-download,
  .chat-history .chat-midia[data-tipo="video"] .chat-midia-download,
  .chat-history .chat-midia[data-tipo="figurinha"] .chat-midia-download { opacity: 0; }
  .chat-history .chat-midia:hover .chat-midia-download,
  .chat-history .chat-midia:focus-within .chat-midia-download { opacity: 1; }
}
.chat-history .chat-midia-estado { display: block; margin: 5px; font-size: calc(10px * var(--aia-text-scale, 1)); opacity: .7; }
.chat-midia-estado:empty { display: none; }
.chat-history .chat-midia-indisponivel { display: flex; align-items: center; gap: 5px; padding: 6px 5px; margin: 0; font-size: calc(10.5px * var(--aia-text-scale, 1)); opacity: .7; }
.chat-midia-indisponivel svg { flex: 0 0 13px; width: 13px; height: 13px; }
.chat-history .chat-transcricao { padding: 0; margin: 7px 5px 0; border: 0; }
.chat-history .chat-transcricao > summary { width: fit-content; padding: 2px 0; font-size: calc(10px * var(--aia-text-scale, 1)); font-weight: 400; opacity: .75; cursor: pointer; }
.chat-history .chat-transcricao > summary:hover { opacity: 1; }
.chat-history .chat-transcricao .chat-texto { margin-top: 5px; font-size: calc(12px * var(--aia-text-scale, 1)); line-height: 1.5; }
.chat-history .chat-message:has([data-tipo="figurinha"]) { width: 190px; }
.chat-history .chat-item .chat-bubble:has([data-tipo="figurinha"]) { color: var(--chat-muted); background: transparent; border: 0; box-shadow: none; }
.chat-history [data-tipo="figurinha"] img.chat-midia-preview { max-height: 180px; }
.chat-history .chat-bubble:has([data-tipo="figurinha"]) .chat-status-lida { color: #44a4ce; }
.chat-history .chat-bubble-midia .chat-citada { margin: 3px 3px 6px; }
.chat-history .chat-transcricao > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.chat-history button:focus-visible, .chat-history a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Ficha lateral */
.chat-info-header { padding: 0 13px !important; min-height: 49px; border-color: var(--chat-line); }
.chat-info-tabs { display: flex; align-items: stretch; align-self: stretch; gap: 12px; }
.chat-info-tabs button { position: relative; padding: 14px 4px 12px; border: 0; background: transparent; color: var(--chat-muted); font-size: calc(11px * var(--aia-text-scale, 1)); font-weight: 500; line-height: 1.2; }
.chat-info-tabs button[aria-selected="true"] { color: #2c71b5; font-weight: 650; }
.chat-info-tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 3px; background: #52a7fb; }
.chat-info-tabs button:focus-visible { outline: 2px solid #97c9fa; outline-offset: -3px; }
.chat-insights-card .chat-insights-scroll { padding: 12px; color: var(--chat-ink); }
.chat-insights-card .ins-painel { gap: 0; }
.ins-painel [hidden] { display: none !important; }
.ins-identidade { padding: 12px; border: 1px solid var(--chat-line); border-radius: 10px; background: var(--chat-soft); }
.ins-contato-topo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ins-contato-avatar { position: relative; display: flex; align-items: center; justify-content: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; color: #538ec8; background: #e1eefb; font-size: calc(13px * var(--aia-text-scale, 1)); font-weight: 650; }
.ins-contato-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.ins-contato-avatar img[hidden] { display: none; }
.ins-contato-avatar i { position: absolute; bottom: -2px; right: -3px; display: flex; align-items: center; justify-content: center; width: 17px; height: 17px; border: 2px solid var(--chat-soft); border-radius: 50%; color: #fff; background: #10bd65; }
.ins-contato-avatar i svg { width: 11px; height: 11px; stroke-width: 1.8; }
.ins-contato-nome { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ins-contato-nome strong { font-size: calc(12px * var(--aia-text-scale, 1)); font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.ins-contato-nome > span { font-size: calc(10px * var(--aia-text-scale, 1)); color: var(--chat-muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ins-contato-selos { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.ins-contato-selos > span { display: inline-block; padding: 3px 7px; border-radius: 5px; font-size: calc(9px * var(--aia-text-scale, 1)); font-weight: 550; line-height: 1.3; }
.ins-selo-etapa { color: #256ad4; background: #e0edff; text-transform: capitalize; }
.ins-selo-temp { color: #32905a; background: #dff5e7; }
.ins-selo-temp.hot { color: #bd5545; background: #ffede5; }
.ins-selo-temp.warm { color: #9e721b; background: #fff1d7; }
.ins-selo-temp.cool { color: #4a79af; background: #e5eef9; }
.ins-contato-dados { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 13px 0 0; }
.ins-contato-dados li { display: flex; align-items: flex-start; gap: 7px; color: var(--chat-muted); font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.4; }
.ins-contato-dados svg { width: 13px; height: 13px; flex: 0 0 13px; color: #687596; margin-top: .5px; }
.ins-bloco { padding: 15px 0; border-bottom: 1px solid var(--chat-line); }
.ins-bloco h4, .ins-detalhes > h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; color: var(--chat-ink); font-size: calc(11px * var(--aia-text-scale, 1)); font-weight: 650; line-height: 1.3; }
.ins-bloco h4 > span { min-width: 20px; padding: 2px 6px; border-radius: 7px; background: #eaf3fd; color: #58a0e8; text-align: center; font-size: calc(9px * var(--aia-text-scale, 1)); }
.ins-acao-card { display: flex; align-items: flex-start; gap: 8px; padding: 10px; margin-top: 6px; border: 1px solid #e6f0fa; border-left: 2px solid #76b9fb; border-radius: 7px; background: linear-gradient(110deg, #f5fafe, #f8fcff); }
.ins-acao-card > svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; color: #5ea3e8; }
.ins-acao-card > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.ins-acao-card strong { font-size: calc(10px * var(--aia-text-scale, 1)); font-weight: 550; line-height: 1.4; color: #3d6083; }
.ins-acao-card span { font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1.45; color: #8493a2; }
.chat-insights-card .ins-chips { gap: 5px; }
.chat-insights-card .ins-chip { padding: 4px 8px; border: 0; border-radius: 8px; font-size: calc(9px * var(--aia-text-scale, 1)); font-weight: 500; line-height: 1.2; }
.chat-insights-card .ins-chip.purple { color: #5192d3; background: #e6f3ff; }
.ins-resumo-contato { margin: 0 0 13px; padding: 13px; border: 1px solid #e1ebf5; border-radius: 10px; background: linear-gradient(135deg,#f4faff,#fbfdff); }
.ins-resumo-contato > header { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; }
.ins-resumo-contato > header svg { flex: 0 0 15px; width: 15px; height: 15px; color: #619fdc; }
.ins-resumo-contato h4 { margin: 0; font-size: calc(11px * var(--aia-text-scale, 1)); font-weight: 650; line-height: 1.3; color: #45729f; }
.ins-resumo-contato .ins-resumo-frase { margin: 0; font-size: calc(12px * var(--aia-text-scale, 1)); line-height: 1.65; color: #424e67; overflow-wrap: anywhere; }
.ins-resumo-contato ul { margin: 10px 0 0; padding: 0 0 0 13px; font-size: calc(10.5px * var(--aia-text-scale, 1)); line-height: 1.6; color: #66718a; }
.ins-resumo-contato li { padding-left: 1px; overflow-wrap: anywhere; }
.ins-resumo-contato li + li { margin-top: 6px; }
.ins-resumo-contato li::marker { color: #8db0d2; }
.ins-resumo-mais { margin-top: 10px; }
.ins-resumo-mais > summary { width: fit-content; font-size: calc(10px * var(--aia-text-scale, 1)); color: #5887b5; cursor: pointer; }
.ins-resumo-mais > summary:hover { color: #3a6895; }
.ins-resumo-mais > summary:focus-visible { outline: 2px solid #76a4d3; outline-offset: 3px; }
.ins-resumo-contato > footer { margin-top: 11px; padding-top: 8px; border-top: 1px solid #e2ebf4; color: #7b8d9f; font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1.4; }
.ins-detalhes { padding-top: 15px; }
.chat-insights-card .ins-sec { border-color: var(--chat-line); }
.chat-insights-card .ins-sec-h { padding: 11px 0; }
.chat-insights-card .ins-sec-t { text-transform: none; letter-spacing: 0; color: #73809a; font-size: calc(10px * var(--aia-text-scale, 1)); font-weight: 550; }
.chat-insights-card .ins-sec-n { color: #87a2bd; background: #f0f5fb; font-size: calc(9px * var(--aia-text-scale, 1)); min-width: 17px; line-height: 17px; }
.chat-insights-card .ins-sec-seta { width: 4px; height: 4px; border-color: #abb3c4; margin: 0 3px 1px 1px; }
.chat-insights-card .ins-sec-b { padding-bottom: 12px; font-size: calc(11px * var(--aia-text-scale, 1)); line-height: 1.5; }
.chat-insights-card .ins-k { font-size: calc(9px * var(--aia-text-scale, 1)); color: #929ab0; }
.chat-insights-card .ins-v, .chat-insights-card .ins-v-longo { font-size: calc(11px * var(--aia-text-scale, 1)); color: #64718b; line-height: 1.45; }
.chat-insights-card .ins-vazio, .chat-insights-card .ins-v3-aviso { padding: 10px; margin-top: 12px; font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.5; border-radius: 7px; }
.ins-historico-lista { padding: 8px 3px; }
.ins-historico-lista article { position: relative; padding: 0 0 22px 19px; border-left: 1px solid var(--chat-line); margin-left: 4px; }
.ins-historico-lista article:last-child { border-left-color: transparent; }
.ins-historico-ponto { position: absolute; top: 2px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: #a1ccf6; box-shadow: 0 0 0 3px var(--chat-surface); }
.ins-historico-lista time { display: block; margin-bottom: 5px; color: #90a0b0; font-size: calc(9px * var(--aia-text-scale, 1)); }
.ins-historico-lista strong { display: block; font-size: calc(11px * var(--aia-text-scale, 1)); font-weight: 550; }
.ins-historico-lista p { margin: 5px 0 0; color: var(--chat-muted); font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.5; }
.ins-historico-unificado > header h4 { margin: 1px 0 5px; color: var(--chat-ink); font-size: calc(12px * var(--aia-text-scale, 1)); font-weight: 650; }
.ins-historico-unificado > header p { margin: 0 0 12px; color: var(--chat-muted); font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.5; }
.ins-historico-resumo { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 17px; }
.ins-historico-resumo span { padding: 4px 7px; border: 1px solid var(--chat-line); border-radius: 7px; color: var(--chat-muted); background: var(--chat-soft); font-size: calc(9px * var(--aia-text-scale, 1)); }
.ins-historico-agendadas { margin-bottom: 20px; }
.ins-historico-agendadas > h4 { display: flex; align-items: center; gap: 6px; color: var(--chat-ink); font-size: calc(10px * var(--aia-text-scale, 1)); font-weight: 600; margin: 0 0 9px; }
.ins-historico-agendadas > h4 svg { width: 13px; height: 13px; color: #70a6dc; }
.ins-historico-agendadas > h4 > span { margin-left: auto; padding: 2px 6px; color: #70a0cf; background: #ecf5fd; border-radius: 6px; font-size: calc(9px * var(--aia-text-scale, 1)); }
.ins-historico-unificado .ins-evento-agenda { position: relative; padding: 11px; margin: 0 0 7px; border: 1px solid #deecf9; border-left: 2px solid #76b5f4; border-radius: 8px; background: #f7fbff; }
.ins-evento-agenda > .ins-historico-ponto { display: none; }
.ins-evento strong { display: block; color: var(--chat-ink); font-size: calc(11px * var(--aia-text-scale, 1)); font-weight: 550; line-height: 1.4; }
.ins-evento p { margin: 4px 0 0; color: var(--chat-muted); font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.5; overflow-wrap: anywhere; }
.ins-historico-lista .ins-evento { padding-bottom: 20px; }
.ins-evento-meta { display: flex; align-items: baseline; gap: 6px; justify-content: space-between; margin-bottom: 5px; }
.ins-historico-lista .ins-evento-meta time, .ins-evento-meta time { margin: 0; font-size: calc(9px * var(--aia-text-scale, 1)); color: var(--chat-muted); }
.ins-evento-fonte { font-size: calc(8px * var(--aia-text-scale, 1)); color: var(--chat-muted); opacity: .75; white-space: nowrap; }
.ins-evento-status, .ins-evento-parceiro { display: inline-block; margin: 7px 3px 0 0; padding: 3px 6px; border-radius: 5px; font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1.2; }
.ins-evento-status.agendada { color: #548fca; background: #e4f0fb; }
.ins-evento-status.realizada { color: #398661; background: #e6f4eb; }
.ins-evento-status.faltou { color: #bd615e; background: #fcebe9; }
.ins-evento-status.justificada, .ins-evento-status.cancelada { color: #a17b42; background: #faf0df; }
.ins-evento-parceiro { color: var(--chat-muted); background: var(--chat-soft); }
.ins-evento-observacao { margin-top: 6px; color: var(--chat-muted); font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1.5; }
.ins-evento-faltou .ins-historico-ponto { background: #e49a96; }
.ins-evento-justificada .ins-historico-ponto, .ins-evento-cancelada .ins-historico-ponto { background: #d9b379; }
.ins-evento-realizada .ins-historico-ponto, .ins-evento-conversao .ins-historico-ponto { background: #91bfa3; }
.ins-historico-rotulo { margin: 0 0 12px; color: var(--chat-ink); font-size: calc(10px * var(--aia-text-scale, 1)); font-weight: 600; }
.ins-historico-cobertura { margin: 7px 0 0; padding-top: 10px; border-top: 1px solid var(--chat-line); font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1.5; color: var(--chat-muted); }
.ins-historico-aviso { display: flex; gap: 6px; margin-bottom: 14px; padding: 9px; background: var(--chat-soft); border: 1px solid var(--chat-line); border-radius: 7px; color: var(--chat-muted); font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.5; }
.ins-historico-aviso svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; }

/* Integração com a tela existente */
.chat-window-card #chatWindow { padding: 18px 20px; background: linear-gradient(120deg,#fbfcff,#f7faff); }
.chat-window-card > .card-header { padding: 12px 15px; min-height: 64px; border-color: #edf0f6; }
.chat-window-card #chatTitle { font-size: calc(13px * var(--aia-text-scale, 1)); color: #3d4961; }
.chat-window-card #chatSub,
.chat-drawer .cd-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.4; white-space: normal; overflow: visible; }
.chat-window-card #chatSub:empty { display: none; }
.chat-header-selos { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.chat-header-tipo,
.chat-header-fu { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 5px; background: #edf3f8; color: #56799c; font-size: calc(9px * var(--aia-text-scale, 1)); line-height: 1.3; font-weight: 500; }
.chat-header-tipo[data-tipo-contato="cliente"] { background: #e5f5ef; color: #348064; }
.chat-header-tipo[data-tipo-contato="corporativo"] { background: #e8f0fe; color: #5379b4; }
.chat-header-tipo[data-tipo-contato="outro"],
.chat-header-tipo[data-tipo-contato="candidato"],
.chat-header-tipo[data-tipo-contato="nao-classificado"] { background: #f0f2f6; color: #788296; }
.chat-header-fu { color: #8992a3; background: #f5f6f9; }
.chat-header-fu-enviado { color: #568977; background: #edf7f2; }
.chat-header-fu svg { width: 11px; height: 11px; }
.chat-header-campanha { display: flex; gap: 4px; flex: 0 1 100%; min-width: 0; color: #8d97aa; }
.chat-header-campanha > span:first-child { flex-shrink: 0; }
.chat-header-campanha-nome { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #647189; }
.chat-window-card #chatSub .chat-ctx-sep { margin: 0; }
.chat-header-selos + .chat-ctx-sep,
.chat-ctx-sep:has(+ .chat-header-campanha) { display: none; }
.chat-window-card .btn-ai-analysis { background: #ecf5fd; color: #549adf !important; font-size: calc(10px * var(--aia-text-scale, 1)); box-shadow: none; padding: 6px 9px; }
.chat-window-card .btn-ai-analysis:hover { background: #dfeefd; transform: none; box-shadow: none; }
.chat-window-card #chatActionBar { padding: 10px 14px; border-color: #edf0f6; background: #fff; }
.chat-window-card #chatActionBar .btn { font-size: calc(10px * var(--aia-text-scale, 1)); padding: 6px 9px; }
.chat-window-card #chatActionHint { font-size: calc(9px * var(--aia-text-scale, 1)); }
.chat-window-card .chat-tarefa-lead { padding: 9px 15px; background: #f9fcff; border-color: #eaf2f9; font-size: calc(11px * var(--aia-text-scale, 1)); }
#tab-leads .chat-pane-contacts { --contact-ink: var(--aia-ink,#27324b); --contact-muted: var(--aia-muted,#6c7891); --contact-line: var(--aia-line,#e9edf5); --contact-surface: var(--aia-surface,#fff); --contact-soft: var(--aia-soft,#f7f9fd); --contact-blue: var(--aia-accent,#066fd1); }
#tab-leads .chat-pane-contacts > .card-body.border-bottom { padding: 12px; border-color: var(--contact-line) !important; background: var(--contact-surface); }
#tab-leads .chat-pane-contacts #chatSearch { min-height: 36px; padding: 8px 11px; border: 1px solid var(--contact-line); border-radius: 8px; background: var(--contact-soft); color: var(--contact-ink); font-size: calc(11px * var(--aia-text-scale, 1)); box-shadow: none; }
#tab-leads .chat-pane-contacts #chatSearch::placeholder { color: #8d98ad; opacity: 1; }
#tab-leads .chat-pane-contacts #chatSearch:focus { border-color: #9bbcdd; background: var(--contact-surface); box-shadow: 0 0 0 3px rgb(6 111 209 / 7%); }
#tab-leads .chat-pane-contacts .chat-filtros { gap: 5px; }
#tab-leads .chat-filtro-chip { min-height: 25px; padding: 3px 8px; border-color: var(--contact-line); border-radius: 7px; background: var(--contact-surface); color: var(--contact-muted); font-size: calc(10px * var(--aia-text-scale, 1)); line-height: 1.2; }
#tab-leads .chat-filtro-chip:hover { border-color: #c5d9ed; background: var(--contact-soft); color: var(--contact-blue); }
#tab-leads .chat-filtro-chip.active { border-color: #d6e7f7; background: #eaf3fc; color: #066fd1; }
#tab-leads .chat-filtro-count { min-width: 18px; padding: 1px 5px; border-radius: 5px; background: #f1f4f8; color: #77849b; font-size: calc(9px * var(--aia-text-scale, 1)); font-variant-numeric: tabular-nums; text-align: center; }
#tab-leads .chat-filtro-chip.active .chat-filtro-count { background: #dcebf9; color: #1769b2; }
#tab-leads #chatList { gap: 2px; padding: 7px; }
#tab-leads #chatList > a.chat-contact-link { display: block; min-width: 0; width: 100%; max-width: 100%; overflow: hidden; box-sizing: border-box; padding: 10px 9px !important; border: 1px solid transparent; border-radius: 9px; color: var(--contact-ink); text-decoration: none; transition: background-color .14s ease, border-color .14s ease; }
#tab-leads #chatList > a.chat-contact-link:hover { background: #f7fafd; }
#tab-leads #chatList > a.chat-contact-link.active { border-color: #e1edf8; background: #eef6fe; color: #344b63; box-shadow: inset 2px 0 #76aee0; }
#tab-leads #chatList > a.chat-contact-link:focus-visible { outline: 2px solid #95bde5; outline-offset: -2px; }
#tab-leads .chat-contact-layout { display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; }
#tab-leads .chat-contact-avatar-wrap { flex: 0 0 38px; width: 38px; height: 38px; }
#tab-leads .chat-contact-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; min-width: 38px; height: 38px; overflow: hidden; border: 1px solid #deebf7; border-radius: 10px; color: #668db4; background: #edf4fb; font-size: calc(10px * var(--aia-text-scale, 1)); font-weight: 550; }
#tab-leads .chat-contact-avatar img, #tab-leads .chat-contact-avatar-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
#tab-leads .chat-contact-avatar-fallback { align-items: center; justify-content: center; }
#tab-leads .chat-contact-content { flex: 1 1 auto; min-width: 0; overflow: hidden; }
#tab-leads .chat-contact-heading { display: flex; align-items: center; gap: 6px; min-width: 0; width: 100%; margin-bottom: 4px; }
#tab-leads .chat-nome-linha { flex: 1 1 auto; min-width: 0; overflow: hidden; color: inherit; font-size: calc(11px * var(--aia-text-scale, 1)); font-weight: 550; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
#tab-leads .chat-contact-meta { flex: 0 0 auto; color: #8995aa !important; font-size: calc(9px * var(--aia-text-scale, 1)) !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
#tab-leads .chat-sinais { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
#tab-leads .chat-snippet { width: 100%; overflow: hidden; color: #7c899f !important; font-size: calc(10px * var(--aia-text-scale, 1)) !important; line-height: 1.4 !important; text-overflow: ellipsis; white-space: nowrap; }
#tab-leads .chat-remetente { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: #8190a6; }
#tab-leads .chat-remetente svg { width: 12px; height: 12px; stroke-width: 1.7; }
#tab-leads .chat-remetente.ia { color: #438dc8; }
#tab-leads .chat-remetente.studio { color: #718097; }
#tab-leads .chat-grupo-dia { position: sticky; top: 0; z-index: 1; padding: 8px 10px 6px; margin: 0 0 2px; border-bottom: 1px solid var(--contact-line); background: var(--contact-surface); color: var(--contact-muted); font-size: calc(9px * var(--aia-text-scale, 1)); font-weight: 550; letter-spacing: .045em; }

@media (min-width: 992px) {
  #tab-leads { --chat-view-height: calc(100dvh - var(--topbar-height,56px) - var(--chat-preview-offset,0px)); }
  body.view-bleed #tab-leads, body.view-bleed #tab-leads > .card { flex: 0 0 auto; height: var(--chat-view-height); min-height: 0; max-height: var(--chat-view-height); }
  #tab-leads > .card > .row { display: grid; grid-template-columns: minmax(200px,.9fr) minmax(0,2.1fr) minmax(240px,1fr); grid-template-rows: minmax(0,1fr); gap: 10px; padding: 12px; height: var(--chat-view-height); min-height: 0; background: #f3f6fb; }
  #tab-leads .chat-pane-contacts, #tab-leads .chat-pane-messages, #tab-leads .chat-pane-insights { width: auto; max-width: none; min-width: 0; border: 1px solid #e6ebf4 !important; border-radius: 12px; overflow: hidden; background: #fff; }
  body.view-bleed #tab-leads > .card > .row > .chat-pane-contacts,
  body.view-bleed #tab-leads > .card > .row > .chat-pane-messages,
  body.view-bleed #tab-leads > .card > .row > .chat-pane-insights { height: 100%; max-height: 100%; min-height: 0; }
  #tab-leads .chat-pane-contacts > .card-body.border-bottom { padding: 13px; border-color: #edf0f6 !important; }
  #tab-leads .chat-pane-contacts #chatSearch { border-radius: 7px; background: #f8fafd; border-color: #e9edf5; font-size: calc(11px * var(--aia-text-scale, 1)); }
}
@media (max-width: 1199.98px) and (min-width: 992px) {
  #tab-leads > .card > .row { grid-template-columns: minmax(190px,.9fr) minmax(0,2fr); grid-template-rows: calc(var(--chat-view-height) - 24px) 420px; }
  #tab-leads .chat-pane-insights { grid-column: 1 / -1; max-height: 420px !important; height: 420px !important; }
  body.view-bleed #tab-leads > .card > .row > .chat-pane-contacts,
  body.view-bleed #tab-leads > .card > .row > .chat-pane-messages { height: calc(var(--chat-view-height) - 24px); }
  #tab-leads > .card > .row { overflow-y: auto; align-content: start; }
}
@media (max-width: 575.98px) {
  .chat-history .chat-message { max-width: 91%; }
  .chat-history .chat-bubble { font-size: calc(12px * var(--aia-text-scale, 1)); padding: 8px 10px; }
  .chat-history .chat-bubble-midia { padding: 4px; }
  .chat-window-card #chatWindow { padding: 14px 12px; }
  .chat-window-card .chat-header-search-wrap { gap: 0 !important; }
  .chat-window-card .btn-ai-analysis { padding: 5px; }
  .chat-window-card #chatActionHint { display: none; }
  body:has(#tab-leads.active) .tb-period #mesLabel { display: block; max-width: 88px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  body:has(#tab-leads.active) .tb-period #btnMesAtual > svg { display: none; }
}

[data-bs-theme="dark"] .chat-history,
[data-bs-theme="dark"] .chat-insights-card { --chat-ink:#dce2ef; --chat-muted:#a2adc5; --chat-line:#333d52; --chat-soft:#252e41; --chat-surface:#20293b; }
[data-bs-theme="dark"] .chat-history .chat-item[data-sender="cliente"] .chat-bubble { background: #243e34; color: #d6ecdf; border-color: #355649; }
[data-bs-theme="dark"] .chat-day-separator span { color: #b7bfd2; background: #2e374b; }
[data-bs-theme="dark"] .chat-window-card #chatWindow { background: #1d2637; }
[data-bs-theme="dark"] .chat-window-card #chatTitle { color: #dce2ef; }
[data-bs-theme="dark"] .chat-header-tipo { background: #303f4e; color: #b5d2ef; }
[data-bs-theme="dark"] .chat-header-tipo[data-tipo-contato="cliente"],
[data-bs-theme="dark"] .chat-header-fu-enviado { background: #2a423a; color: #a0d1bd; }
[data-bs-theme="dark"] .chat-header-tipo[data-tipo-contato="corporativo"] { background: #2d3d57; color: #acc4eb; }
[data-bs-theme="dark"] .chat-header-tipo[data-tipo-contato="outro"],
[data-bs-theme="dark"] .chat-header-tipo[data-tipo-contato="candidato"],
[data-bs-theme="dark"] .chat-header-tipo[data-tipo-contato="nao-classificado"],
[data-bs-theme="dark"] .chat-header-fu:not(.chat-header-fu-enviado) { background: #2b3445; color: #a8b2c5; }
[data-bs-theme="dark"] .chat-header-campanha { color: #8f9ab1; }
[data-bs-theme="dark"] .chat-header-campanha-nome { color: #b2bdd3; }
[data-bs-theme="dark"] .chat-window-card > .card-header,
[data-bs-theme="dark"] .chat-window-card #chatActionBar { background: #20293b; border-color: #333d52; }
[data-bs-theme="dark"] .chat-window-card .chat-tarefa-lead { background: #2a3744; border-color: #374450; }
[data-bs-theme="dark"] #tab-leads > .card > .row { background: #192232; }
[data-bs-theme="dark"] #tab-leads .chat-pane-contacts,
[data-bs-theme="dark"] #tab-leads .chat-pane-messages,
[data-bs-theme="dark"] #tab-leads .chat-pane-insights { background: #20293b; border-color: #333d52 !important; }
[data-bs-theme="dark"] .ins-acao-card { background: #2b3a48; border-color: #384858; border-left-color: #76b9fb; }
[data-bs-theme="dark"] .ins-acao-card strong { color: #c3def9; }
[data-bs-theme="dark"] .chat-insights-card .ins-v, [data-bs-theme="dark"] .chat-insights-card .ins-v-longo { color: #b6c0d6; }
[data-bs-theme="dark"] .ins-resumo-contato { background: linear-gradient(135deg,#28343f,#28323b); border-color: #3b4e60; }
[data-bs-theme="dark"] .ins-resumo-contato h4 { color: #b5d5f4; }
[data-bs-theme="dark"] .ins-resumo-contato > header svg { color: #88bdf1; }
[data-bs-theme="dark"] .ins-resumo-contato .ins-resumo-frase { color: #d7e1eb; }
[data-bs-theme="dark"] .ins-resumo-contato ul { color: #b3bfcb; }
[data-bs-theme="dark"] .ins-resumo-mais > summary { color: #a0c6ec; }
[data-bs-theme="dark"] .ins-resumo-contato > footer { border-color: #3b4e60; color: #a0aebc; }
[data-bs-theme="dark"] .ins-contato-avatar { background: #33495f; color: #bbddff; }
[data-bs-theme="dark"] .chat-info-tabs button[aria-selected="true"] { color: #b1d8ff; }
[data-bs-theme="dark"] .ins-historico-unificado .ins-evento-agenda { background: #2a3744; border-color: #3a4f64; border-left-color: #76b5f4; }
[data-bs-theme="dark"] .chat-history .chat-reacoes > span { background: #334055; border-color: #46516a; }
[data-bs-theme="dark"] .chat-history [data-sender="cliente"] .chat-midia-carregar:hover { background: rgb(255 255 255 / 6%); }
[data-bs-theme="dark"] .chat-history audio { color-scheme: dark; }
[data-bs-theme="dark"] #tab-leads .chat-pane-contacts #chatSearch { border-color: var(--contact-line); background: var(--contact-soft); }
[data-bs-theme="dark"] #tab-leads .chat-filtro-chip { background: var(--contact-surface); }
[data-bs-theme="dark"] #tab-leads .chat-filtro-chip.active { border-color: #405265; background: #293e55; color: #a9cff3; }
[data-bs-theme="dark"] #tab-leads .chat-filtro-count { background: #2a3447; color: #a2adc5; }
[data-bs-theme="dark"] #tab-leads .chat-filtro-chip.active .chat-filtro-count { background: #354a60; color: #b6d8fa; }
[data-bs-theme="dark"] #tab-leads #chatList > a.chat-contact-link:hover { background: #252f41; }
[data-bs-theme="dark"] #tab-leads #chatList > a.chat-contact-link.active { border-color: #3a5067; background: #293e55; color: #dce8f5; box-shadow: inset 2px 0 #83b8e8; }
[data-bs-theme="dark"] #tab-leads .chat-contact-avatar { border-color: #3a4f63; color: #b0cfed; background: #2e4051; }
[data-bs-theme="dark"] #tab-leads .chat-contact-meta { color: #98a5bc !important; }
[data-bs-theme="dark"] #tab-leads .chat-snippet { color: #a2adc5 !important; }
[data-bs-theme="dark"] #tab-leads .chat-grupo-dia { background: var(--contact-surface); }
[data-bs-theme="dark"] .ins-contato-dados svg,
[data-bs-theme="dark"] .chat-insights-card .ins-sec-t { color: var(--chat-muted); }
@media (prefers-reduced-motion: reduce) { .chat-history * { transition: none !important; } }
