:root {
  --fundo: #f3f1ed;        /* creme claro */
  --branco: #ffffff;
  --suave: #ebe5dc;        /* blocos suaves */
  --borda: #e8e0d8;
  --dourado: #bd8c90;
  --dourado-escuro: #96626a;
  --texto: #2d2825;        /* quase preto — máxima leitura */
  --texto2: #6b5d57;
  --verde: #1d9e55;
  --verde-wa: #25d366;
  --vermelho: #cc3b3b;
  --azul: #2b7fd4;
  /* paleta Danifisio (rosé + sálvia da marca) */
  --dani-amarelo: #bd8c90;
  --dani-azul: #577971;
  --dani-vermelho: #e04148;
  --dani-verde: #577971;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  height: 100vh;
  overflow: hidden;
}
h1, h2, h3, .logo { font-family: 'Cormorant Garamond', serif; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; background: var(--branco); border: 1px solid var(--borda);
  color: var(--texto); border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none;
}
input::placeholder, textarea::placeholder { color: #a29288; }
input:focus, select:focus, textarea:focus { border-color: var(--dourado); box-shadow: 0 0 0 3px rgba(189,140,144,.15); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8cfc6; border-radius: 4px; }

/* Visão geral: 2 linhas de 4 cards no desktop (visual equilibrado) */
#cards-dash { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { #cards-dash { grid-template-columns: repeat(2, 1fr); } }

/* logo em medalhão branco (o PNG tem fundo transparente) */
.logo-img { background: var(--branco); padding: 8px; }

/* ---------- Login ---------- */
#tela-login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #faf8f4 0%, var(--fundo) 70%);
  z-index: 100;
}
.login-box {
  width: 350px; padding: 40px 34px; background: var(--branco);
  border: 1px solid var(--borda); border-radius: 16px; text-align: center;
  box-shadow: 0 12px 40px rgba(87,121,113,.10);
}
.login-box .logo-img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; }
.login-box .sub { color: var(--texto2); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; margin: 12px 0 28px; font-weight: 600; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box .erro { color: var(--vermelho); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---------- Layout ---------- */
#app { display: none; height: 100vh; }
#app.logado { display: flex; }
.sidebar {
  width: 225px; min-width: 225px; background: #f7f3ec; border-right: 1px solid #e8e0d8;
  display: flex; flex-direction: column; padding: 20px 0 0;
}
.sidebar .logo-img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto; box-shadow: 0 4px 14px rgba(87,121,113,.18); }
.sidebar .sub { color: var(--texto2); font-size: 10px; letter-spacing: 3px; text-transform: uppercase; text-align: center; margin: 10px 0 22px; font-weight: 700; }
.menu { flex: 1; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 12px 22px; color: var(--texto2);
  text-decoration: none; font-size: 14px; font-weight: 600; border-left: 3px solid transparent;
}
.menu a:hover { color: var(--texto); background: rgba(189,140,144,.07); }
.menu a.ativo { color: var(--texto); font-weight: 700; }
/* cada menu com uma cor da marca */
.menu a[data-pag="dashboard"] { border-left-color: var(--dani-amarelo); }
.menu a[data-pag="inbox"] { border-left-color: var(--dani-verde); }
.menu a[data-pag="contatos"] { border-left-color: var(--dani-azul); }
.menu a[data-pag="disparos"] { border-left-color: var(--dani-vermelho); }
.menu a[data-pag="conectar"] { border-left-color: var(--verde-wa); }
.menu a[data-pag="conectar"].ativo { background: rgba(37,211,102,.12); }
.menu a[data-pag="config"] { border-left-color: #8d8574; }
.menu a[data-pag="funil"] { border-left-color: var(--dani-amarelo); }
.menu a[data-pag="funil"].ativo { background: rgba(189,140,144,.14); }
.menu a[data-pag="insights"] { border-left-color: var(--dani-azul); }
.menu a[data-pag="agente"] { border-left-color: var(--dourado); }
.menu a[data-pag="insights"].ativo { background: rgba(87,121,113,.12); }
.menu a[data-pag="agente"].ativo { background: rgba(189,140,144,.14); }
/* Insights e Agente: só admin/gerente enxergam */
.menu .so-gestor { display: none; }
.menu .so-gestor.visivel { display: flex; }
.menu a[data-pag="dashboard"].ativo { background: rgba(189,140,144,.14); }
.menu a[data-pag="inbox"].ativo { background: rgba(87,121,113,.12); }
.menu a[data-pag="contatos"].ativo { background: rgba(87,121,113,.12); }
.menu a[data-pag="disparos"].ativo { background: rgba(224,65,72,.10); }
.menu a[data-pag="config"].ativo { background: rgba(141,133,116,.12); }
.menu .badge { margin-left: auto; background: var(--vermelho); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.rodape-user { padding: 14px 22px; border-top: 1px solid var(--borda); font-size: 13px; color: var(--texto2); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.rodape-user a { color: var(--texto2); cursor: pointer; }

.conteudo { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.pagina { display: none; flex: 1; overflow-y: auto; padding: 26px 30px; }
.pagina.ativa { display: block; }
.pagina.sem-scroll { overflow: hidden; padding: 0; }
.pagina h2 { font-size: 32px; color: var(--texto); margin-bottom: 4px; font-weight: 700; }
.pagina .desc { color: var(--texto2); font-size: 13px; margin-bottom: 22px; }

/* ---------- Componentes ---------- */
.btn {
  background: var(--dourado); color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-weight: 700; font-size: 13px;
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}
.btn:hover { background: var(--dourado-escuro); }
.btn.sec { background: var(--branco); color: var(--dourado-escuro); border: 1px solid var(--dourado); text-shadow: none; }
.btn.sec:hover { background: rgba(189,140,144,.08); }
.btn.perigo { background: var(--branco); color: var(--vermelho); border: 1px solid var(--vermelho); text-shadow: none; }
.btn.mini { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card { background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 18px; box-shadow: 0 2px 8px rgba(87,121,113,.04); }
.card .num { font-size: 32px; font-weight: 700; color: var(--dourado-escuro); }
/* alerta piscante: cliente aguardando resposta */
@keyframes pisca-alerta {
  0%, 100% { background: var(--branco); border-color: var(--borda); }
  50% { background: rgba(224,65,72,.22); border-color: var(--dani-vermelho); }
}
.card.alerta { animation: pisca-alerta 1.1s ease-in-out infinite; }
.card.alerta .num { color: var(--dani-vermelho); }
.item-conv.alerta, .item-conv.alerta.ativo { animation: pisca-alerta 1.1s ease-in-out infinite, pisca-sombra 1.1s ease-in-out infinite; border-left: 4px solid var(--dani-vermelho); }
@keyframes pisca-sombra {
  0%, 100% { box-shadow: inset 0 0 0 rgba(224,65,72,0); }
  50% { box-shadow: inset 0 0 14px rgba(224,65,72,.55), 0 0 8px rgba(224,65,72,.35); }
}
@keyframes pisca-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(1.15); }
}
.menu .badge.alerta { animation: pisca-badge 1.1s ease-in-out infinite; }
.card .rot { color: var(--texto2); font-size: 12px; margin-top: 4px; font-weight: 600; }
.card b { color: var(--texto); }

table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; }
th { text-align: left; color: var(--texto2); font-weight: 700; padding: 11px 12px; border-bottom: 1px solid var(--borda); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; background: var(--suave); }
td { padding: 10px 12px; border-bottom: 1px solid #ece4dc; }
tr:hover td { background: #f8f4f0; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill.ok { background: rgba(29,158,85,.12); color: var(--verde); }
.pill.warn { background: rgba(189,140,144,.16); color: var(--dourado-escuro); }
.pill.off { background: rgba(204,59,59,.10); color: var(--vermelho); }
.pill.info { background: rgba(43,127,212,.10); color: var(--azul); }
.pill.neutro { background: var(--suave); color: var(--texto2); }

.modal-fundo { position: fixed; inset: 0; background: rgba(40,30,15,.45); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-fundo.aberto { display: flex; }
.modal { background: var(--branco); border: 1px solid var(--borda); border-radius: 14px; padding: 26px; width: 480px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: 0 18px 60px rgba(87,121,113,.25); }
.modal h3 { color: var(--texto); font-size: 26px; margin-bottom: 16px; }
.modal label { display: block; font-size: 11px; color: var(--texto2); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.modal input, .modal select, .modal textarea { width: 100%; }
.modal .acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* Chips de tags (nicho Danifisio) */
.gt-titulo { font-size: 10px; color: var(--texto2); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin: 10px 0 5px; }
.gt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--suave); border: 1px solid var(--borda); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; font-weight: 700; color: var(--texto2);
  cursor: pointer; user-select: none; transition: all .12s;
}
.chip:hover { border-color: var(--dourado); }
.chip.sel { background: rgba(189,140,144,.16); border-color: var(--dourado); color: var(--dourado-escuro); }
.pasta-select {
  background: var(--branco); border: 1px solid #dfd2d4; color: var(--texto2);
  border-radius: 20px; padding: 4px 11px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.pasta-select.ativo { border-color: var(--dourado); color: var(--dourado-escuro); background: rgba(189,140,144,.12); }
.chip-x { margin-left: 6px; color: var(--vermelho); font-weight: 800; cursor: pointer; font-size: 11px; }
.chip-x:hover { color: #8f1f1f; }

.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="text"] { flex: 1; min-width: 180px; }

/* ---------- Inbox ---------- */
.inbox { display: flex; height: 100%; }
.lista-conversas { width: 400px; min-width: 400px; border-right: 1px solid #eadfe0; display: flex; flex-direction: column; background: #f7f1f0; }
.lista-conversas .topo { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lista-conversas .topo h2 { font-size: 26px; }
.filtros-canal { display: flex; gap: 6px; padding: 0 14px 12px; flex-wrap: wrap; }
.filtros-canal button {
  background: var(--branco); border: 1px solid #dfd2d4; color: var(--texto2);
  border-radius: 20px; padding: 4px 11px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
}
.filtros-canal button svg { width: 14px; height: 14px; }
.filtros-canal button.ativo { border-color: var(--dourado); color: var(--dourado-escuro); background: rgba(189,140,144,.12); }
.itens-conversa { flex: 1; overflow-y: auto; }
/* altura FIXA: todos os cards do mesmo tamanho (nome longo quebra em até 2 linhas dentro do espaço) */
.item-conv { padding: 10px 14px; height: 78px; box-sizing: border-box; border-bottom: 1px solid #efe6e7; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.item-conv:hover { background: #f0e7e8; }
.item-conv.ativo { background: #e8d5d7; }
.avatar {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--branco); border: 1px solid #dfd2d4;
}
.avatar svg { width: 22px; height: 22px; }
/* Avatar com foto do contato + selo do canal */
.av-wrap {
  position: relative; width: 44px; height: 44px; min-width: 44px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--branco); border: 1px solid #dfd2d4;
}
.av-wrap .av-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.av-wrap .av-fb {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: var(--texto2);
  background: linear-gradient(135deg, #f4ebe9, #e3d2d4);
}
.av-wrap .ch-badge {
  position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #dfd2d4; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.av-wrap .ch-badge svg { width: 12px; height: 12px; }
/* WhatsApp: bolinha verde preenchida com o telefone branco (padrão igual Messenger) */
.av-wrap .ch-badge.ch-wa { background: #25d366; border-color: #fff; }
.av-wrap .ch-badge.ch-wa svg path { fill: #fff; }
.canal-info .canal-selo { display: inline-flex; vertical-align: middle; margin-right: 3px; }
.canal-info .canal-selo svg { width: 13px; height: 13px; vertical-align: middle; }
.item-conv .info { flex: 1; min-width: 0; }
/* nome pode quebrar em 2 linhas; passou disso, corta com … (altura do card não muda) */
.item-conv .nome { font-size: 14px; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.item-conv .nome .tag-num { margin-left: 4px; vertical-align: 1px; white-space: nowrap; }
.tag-num {
  font-size: 10px; font-weight: 800; color: #0e7c3f; background: rgba(37,211,102,.14);
  border-radius: 8px; padding: 1px 7px; letter-spacing: .5px;
}
.tag-num.site { color: var(--dourado-escuro); background: rgba(189,140,144,.16); }
.item-conv .previa { font-size: 12px; color: var(--texto2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
/* coluna direita FIXA do card: tag da vendedora (cima) / data-hora (meio) / não lidas (baixo) */
.item-conv .meta { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px; min-width: 64px; text-align: right; font-size: 11px; color: var(--texto2); }
.item-conv .meta .m-tag { height: 16px; display: flex; align-items: center; }
.item-conv .meta .m-badge { height: 18px; }
.item-conv .meta .tag-fila { margin-left: 0; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.item-conv .nao-lidas { background: var(--verde-wa); color: #fff; border-radius: 10px; padding: 1px 7px; font-weight: 700; font-size: 11px; display: inline-block; }

.chat { flex: 1; display: flex; flex-direction: column; background: #efe9e2; }
.mensagens, .chat-vazio { background: #efe9e2 url('wallpaper-dani.svg'); background-size: 620px auto; }
.chat .cabecalho { padding: 12px 20px; border-bottom: 1px solid var(--borda); display: flex; align-items: center; gap: 12px; background: var(--branco); }
.chat .cabecalho .nome { font-weight: 700; font-size: 15px; }
.chat .cabecalho .canal-info { font-size: 12px; color: var(--texto2); font-weight: 600; }
.chat .cabecalho .acoes-chat { margin-left: auto; display: flex; gap: 8px; }
.tags-chat-wrap { position: relative; margin-left: 10px; }
.tags-pop {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 30;
  background: var(--branco); border: 1px solid var(--borda); border-radius: 12px;
  padding: 12px 14px; min-width: 230px; max-width: 320px;
  box-shadow: 0 10px 30px rgba(87,121,113,.18);
  flex-wrap: wrap; gap: 6px;
}
.tags-pop.aberto { display: flex; }
.chat-vazio { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--texto2); flex-direction: column; gap: 14px; font-weight: 600; }
.chat-vazio .logo-img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; opacity: .45; }
.mensagens { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.balao { max-width: 62%; width: fit-content; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; word-wrap: break-word; box-shadow: 0 1px 2px rgba(87,121,113,.08); }
.balao .corpo { white-space: pre-wrap; display: block; }
.balao audio + .corpo, .balao video + .corpo, .balao img + .corpo { margin-top: 6px; }
.balao.in { background: var(--branco); align-self: flex-start; border-bottom-left-radius: 3px; }
.balao.out { background: #d9fdd3; align-self: flex-end; border-bottom-right-radius: 3px; }
.balao .hora { display: block; font-size: 10px; color: #7d766c; margin-top: 4px; text-align: right; }
.balao img, .balao video { display: block; width: 100%; height: auto; border-radius: 8px; margin-bottom: 4px; }
/* balão de mídia acompanha a imagem (sem vão verde ao redor) */
.balao:has(img), .balao:has(video) { max-width: 300px; }

/* Menu de contexto (botão direito na lista de conversas) */
.menu-contexto { position: fixed; z-index: 9999; background: var(--branco); border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 6px 24px rgba(30,20,10,.18); overflow: hidden; min-width: 220px; }
.menu-contexto button { display: block; width: 100%; text-align: left; padding: 11px 16px; background: none; border: none; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--texto); cursor: pointer; }
.menu-contexto button:hover { background: #f1ece6; }
.menu-contexto button.perigo { color: var(--dani-vermelho); border-top: 1px solid var(--borda); }
.menu-contexto button.perigo:hover { background: rgba(224,65,72,.1); }
.caixa-envio { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--borda); background: var(--branco); }
.caixa-envio textarea { flex: 1; resize: none; height: 44px; }

/* ---------- Responsivo (celular) ---------- */
.so-mobile { display: none; }
/* Foto de perfil do próprio operador (avatar redondo tipo WhatsApp) */
.perfil-user { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding: 12px 16px; background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; }
.perfil-user .av { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--dani-azul); color: #fff; font-weight: 700; font-size: 22px; flex-shrink: 0; }
.perfil-user .av img { width: 100%; height: 100%; object-fit: cover; }
.perfil-info { flex: 1; min-width: 0; }
.perfil-nome { font-weight: 700; font-size: 16px; color: var(--texto); }
.perfil-sub { font-size: 12px; color: var(--texto2); }
.btn-foto { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--dourado); color: var(--dourado-escuro); background: var(--branco); border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.btn-foto:hover { background: rgba(189,140,144,.08); }
.user-avatar-mini { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--dani-azul); color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.user-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

/* Fila de rodízio: tag de sugestão na lista de conversas + tela de configuração */
.tag-fila { display: inline-block; vertical-align: 1px; margin-left: 4px; padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.fila-lista { display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.fila-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--branco); border: 1px solid var(--borda); border-radius: 10px; }
.fila-cor { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.fila-pos { font-size: 12px; color: var(--texto2); font-weight: 700; width: 24px; }
.fila-nome { flex: 1; font-weight: 600; font-size: 14px; }
.fila-acoes { display: flex; gap: 4px; }
.fila-row.pausada { opacity: 0.55; background: #f1ece6; }
.fila-row.pausada .fila-acoes { opacity: 1; }
.fila-badge-pausa { font-size: 11px; font-weight: 700; color: #b0741c; background: #fbf0d7; border: 1px solid #ecd9a8; border-radius: 10px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }

/* Cabeçalho mobile (nome + sair) — no desktop o logout fica na barra lateral */
.topbar-mobile { display: none; }

@media (max-width: 820px) {
  body { height: 100svh; }
  /* cabeçalho mobile: nome do usuário + botão de sair, no topo da página — rola JUNTO com o conteúdo */
  .topbar-mobile {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 0 10px;
  }
  .user-nome-mobile { font-weight: 700; font-size: 13px; color: var(--texto); white-space: nowrap; }
  .btn-sair-mobile {
    display: flex; align-items: center; justify-content: center; flex: none;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--branco); border: 1px solid var(--borda); color: var(--texto2);
    font-size: 17px; line-height: 1;
  }
  .btn-sair-mobile:active { background: var(--suave); }
  #app.logado { flex-direction: column; height: 100svh; }

  /* no mobile, esconder Configurações da barra inferior (Conectar fica — equipe conecta da loja) */
  .menu a[data-pag="config"] { display: none; }
  /* atendente (não-admin) no mobile: menu reduzido — só Visão geral, Atendimento, Insights e Agente */
  #app.nao-admin .menu a[data-pag="contatos"],
  #app.nao-admin .menu a[data-pag="disparos"] { display: none; }
  /* Visão geral no mobile: esconder cards de base/promoções/campanhas (display mais limpo) */
  .card.oculto-mobile { display: none; }

  /* menu vira barra inferior com ícones */
  .conteudo { order: 1; min-height: 0; }
  .sidebar {
    order: 2; width: 100%; min-width: 0; flex-direction: row; align-items: stretch;
    padding: 0; border-right: none; border-top: 2px solid #e8e0d8;
  }
  .sidebar .logo-img, .sidebar .sub, .rodape-user { display: none; }
  .menu { display: flex; width: 100%; }
  .menu a {
    position: relative; flex: 1; flex-direction: column; gap: 2px; align-items: center;
    padding: 8px 2px 10px; font-size: 9px; border-left: none;
    border-top: 3px solid transparent; text-align: center;
  }
  .menu .mi { font-size: 19px; }
  .menu .mt { font-size: 9px; line-height: 1.1; }
  .menu a[data-pag="dashboard"] { border-top-color: var(--dani-amarelo); }
  .menu a[data-pag="inbox"] { border-top-color: var(--dani-verde); }
  .menu a[data-pag="contatos"] { border-top-color: var(--dani-azul); }
  .menu a[data-pag="disparos"] { border-top-color: var(--dani-vermelho); }
  .menu a[data-pag="conectar"] { border-top-color: var(--verde-wa); }
  .menu a[data-pag="config"] { border-top-color: #8d8574; }
  .menu a[data-pag="insights"] { border-top-color: var(--dani-azul); }
  .menu a[data-pag="agente"] { border-top-color: var(--dourado); }
  .menu .so-gestor.visivel { display: flex; }
  .menu .badge { position: absolute; top: 2px; right: 12%; margin: 0; }

  .pagina { padding: 16px 12px; }
  .pagina h2 { font-size: 24px; }
  .pagina table { display: block; overflow-x: auto; }
  .pagina th, .pagina td { white-space: nowrap; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 13px; }
  .card .num { font-size: 24px; }
  .toolbar .btn { flex: 1; }
  .login-box { max-width: 92vw; }

  /* inbox: lista em tela cheia; abrir conversa = chat em tela cheia com botão voltar */
  .lista-conversas { width: 100%; min-width: 0; }
  .chat { display: none; }
  .inbox.mostra-chat .lista-conversas { display: none; }
  .inbox.mostra-chat .chat { display: flex; }
  .so-mobile { display: inline-flex; }
  .txt-fin { display: none; }
  .caixa-envio { padding: 8px 10px; gap: 6px; }
  .caixa-envio .btn { padding: 10px 12px; }
  .balao { max-width: 84%; }
  .chat .cabecalho { padding: 10px 12px; gap: 8px; }
  .chat .cabecalho .canal-info { font-size: 11px; }
}

/* ---------- Disparos ---------- */
.progresso { height: 8px; background: var(--suave); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progresso .barra { height: 100%; background: var(--dourado); transition: width .4s; }
.camp-linha { background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 18px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(87,121,113,.04); }
.camp-linha .titulo { display: flex; justify-content: space-between; align-items: center; }
.camp-linha .nome { font-weight: 700; font-size: 16px; }
.camp-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--texto2); font-weight: 600; }
.camp-stats b { color: var(--texto); }
.aviso-custo { background: #fdf6e3; border: 1px solid #ecd9a0; border-radius: 10px; padding: 12px 16px; font-size: 13px; color: #7a5c10; margin-bottom: 18px; font-weight: 600; }
.aviso-dry { background: #e9f2fb; border: 1px solid #bcd6ef; border-radius: 10px; padding: 10px 16px; font-size: 13px; color: #1f5c99; margin-bottom: 18px; font-weight: 600; display: none; }

/* ---------- Insights ---------- */
.ins-t { font-size: 21px; margin: 26px 0 12px; color: var(--texto); display: flex; align-items: center; gap: 10px; }
/* Dropdown do playbook (Agente Dani) — summary é o título clicável */
.pb-dropdown > summary { cursor: pointer; list-style: none; user-select: none; }
.pb-dropdown > summary::-webkit-details-marker { display: none; }
.pb-dropdown > summary:hover { color: var(--dourado-escuro); }
.pb-dropdown .pb-seta { font-size: 15px; color: var(--texto2); transition: transform 0.15s; }
.pb-dropdown[open] .pb-seta { transform: rotate(180deg); }
.barras { display: flex; align-items: flex-end; gap: 6px; background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 16px 14px 8px; overflow-x: auto; }
.barra-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 26px; }
.barra-v { width: 18px; background: linear-gradient(to top, var(--dani-amarelo), var(--dourado)); border-radius: 4px 4px 0 0; }
.barra-col span { font-size: 9px; color: var(--texto2); font-weight: 700; white-space: nowrap; }
.barra-num { font-size: 11px; color: var(--dourado-escuro); font-weight: 800; }
.heat-wrap { overflow-x: auto; }
table.heat { border-radius: 12px; }
table.heat th { padding: 6px 4px; font-size: 10px; text-align: center; }
table.heat td { padding: 5px 4px; }
.heat-c { text-align: center; font-size: 10px; font-weight: 700; min-width: 26px; border-radius: 4px; }
.ia-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.ia-grid .card b { display: block; margin-bottom: 8px; font-size: 13px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed #ece4dc; color: var(--texto2); font-weight: 600; }
.kv b { color: var(--dourado-escuro); }
.gargalo { font-size: 13px; color: var(--texto2); padding: 4px 0; font-weight: 600; }
.perda-linha { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; font-weight: 600; }
.perda-rot { min-width: 175px; color: var(--texto2); }
.perda-barra { flex: 1; height: 10px; background: var(--suave); border-radius: 5px; overflow: hidden; }
.perda-barra div { height: 100%; background: linear-gradient(to right, var(--dani-vermelho), #f07a80); border-radius: 5px; }
.perda-pct { color: var(--texto2); font-size: 11px; }

/* ---------- Agente Dani: cena do robô observando (visão da vendedora) ---------- */
.cena-agente {
  max-width: 620px; margin: 30px auto; text-align: center;
  background: var(--branco); border: 1px solid var(--borda); border-radius: 18px;
  padding: 40px 26px 32px; box-shadow: 0 6px 24px rgba(87,121,113,.08); overflow: hidden;
}
.robo-wrap { position: relative; display: inline-block; margin-bottom: 26px; }
.robo { font-size: 74px; display: inline-block; animation: robo-flutua 3s ease-in-out infinite; }
.robo-olhos {
  position: absolute; top: -6px; right: -26px; font-size: 26px;
  animation: olhos-espiam 4.5s ease-in-out infinite;
}
@keyframes robo-flutua {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}
@keyframes olhos-espiam {
  0%, 100% { transform: translateX(0); opacity: 1; }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(6px); opacity: .75; }
  75% { transform: translateX(-4px); }
}
.mesas { display: flex; justify-content: center; gap: 46px; margin-bottom: 26px; }
.mesa { position: relative; display: inline-block; }
.pessoa { font-size: 46px; display: inline-block; animation: pessoa-digita 1.6s ease-in-out infinite; }
.p2 { animation-delay: .4s; }
.p3 { animation-delay: .9s; }
@keyframes pessoa-digita {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.fone { position: absolute; bottom: -4px; right: -12px; font-size: 20px; animation: fone-toca 2.2s ease-in-out infinite; }
@keyframes fone-toca {
  0%, 80%, 100% { transform: rotate(0); }
  85% { transform: rotate(-14deg); }
  90% { transform: rotate(12deg); }
  95% { transform: rotate(-8deg); }
}
.cena-balao {
  position: absolute; top: -22px; left: 50%; font-size: 20px; opacity: 0;
  animation: chat-pop 3.6s ease-in-out infinite;
}
.cena-balao.c2 { animation-delay: 1.2s; }
.cena-balao.c3 { animation-delay: 2.4s; }
@keyframes chat-pop {
  0%, 55%, 100% { opacity: 0; transform: translate(-50%, 6px) scale(.4); }
  12%, 40% { opacity: 1; transform: translate(-50%, -6px) scale(1); }
}
.cena-titulo { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.cena-info { font-size: 14px; color: var(--texto2); line-height: 1.7; font-weight: 600; }
.cena-info b { color: var(--dourado-escuro); font-size: 16px; }

/* ---------- Agente Dani ---------- */
.pb-item { background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(87,121,113,.04); }
.pb-item.aprovada { border-left: 4px solid var(--dani-verde); }
.pb-item.pendente { border-left: 4px solid var(--dani-amarelo); }
.pb-perg { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-resp { font-size: 13px; color: var(--texto2); margin-top: 6px; line-height: 1.5; background: var(--suave); border-radius: 8px; padding: 8px 12px; }

/* ---------- Card de origem (story/anúncio/publicação que originou o contato) ---------- */
.ref-origem { display: inline-flex; flex-direction: column; gap: 7px; background: rgba(0,0,0,.05); border: 1px solid var(--borda); border-radius: 12px; padding: 8px; margin-bottom: 8px; max-width: 210px; }
.ref-origem .ref-img { width: 194px; max-width: 100%; height: auto; max-height: 280px; object-fit: cover; border-radius: 9px; display: block; border: 1px solid var(--borda); }
.ref-origem .ref-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ref-origem .ref-tag { font-size: 11px; font-weight: 800; color: var(--dourado-escuro); text-transform: uppercase; letter-spacing: .3px; }
.ref-origem .ref-titulo { font-size: 12.5px; color: var(--texto2); line-height: 1.35; }
.ref-origem .ref-link { font-size: 12px; font-weight: 700; color: var(--dourado-escuro); text-decoration: underline; width: fit-content; }

/* ---------- Funil (Kanban de leads) ---------- */
.funil-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; min-height: 60vh; }
.funil-col {
  min-width: 250px; width: 250px; flex-shrink: 0; background: var(--suave);
  border: 1px solid var(--borda); border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 200px);
}
.funil-col .fc-titulo {
  display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px;
  padding: 4px 6px 8px; color: var(--texto); border-bottom: 3px solid var(--fc-cor, var(--dani-amarelo));
}
.funil-col .fc-n { margin-left: auto; background: var(--branco); border: 1px solid var(--borda); border-radius: 10px; padding: 1px 8px; font-size: 11px; font-weight: 800; color: var(--texto2); }
.funil-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; padding-top: 4px; }
.funil-col.drag-over { outline: 2px dashed var(--fc-cor, var(--dani-amarelo)); outline-offset: -4px; background: rgba(189,140,144,.08); }
.funil-card {
  background: var(--branco); border: 1px solid var(--borda); border-left: 4px solid var(--fc-cor, var(--dani-amarelo));
  border-radius: 10px; padding: 9px 10px; cursor: grab; box-shadow: 0 2px 6px rgba(87,121,113,.06);
  display: flex; flex-direction: column; gap: 5px; user-select: none;
}
.funil-card:active { cursor: grabbing; }
.funil-card.arrastando { opacity: .45; }
.funil-card.alerta { animation: pisca-alerta 1.1s ease-in-out infinite; }
.funil-card .fk-topo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.funil-card .fk-topo .av-wrap { width: 34px; height: 34px; min-width: 34px; }
.funil-card .fk-topo .av-fb { font-size: 12px; }
.funil-card .fk-nome { font-weight: 700; font-size: 13px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; flex: 1; }
.funil-card .fk-previa { font-size: 11.5px; color: var(--texto2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funil-card .fk-rodape { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--texto2); }
.funil-card .fk-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.funil-card .fk-tag { background: rgba(189,140,144,.14); color: var(--dourado-escuro); border-radius: 8px; padding: 1px 7px; font-size: 10px; font-weight: 700; }
.funil-card .fk-hora { margin-left: auto; white-space: nowrap; }
.funil-card .fk-mover { background: none; border: none; color: var(--texto2); font-size: 16px; padding: 0 2px; cursor: pointer; line-height: 1; }
.funil-card .fk-mover:hover { color: var(--dourado-escuro); }
@media (max-width: 820px) {
  .funil-board { min-height: 0; }
  .funil-col { min-width: 82vw; width: 82vw; max-height: none; }
}
