/* Intranet Primebid: identidade sobre o Metronic 8.2.9 (demo38).
   Carregado DEPOIS de style.bundle.css. Nunca editar os bundles em wwwroot/assets. */

/* No demo38 o primary é verde e o success é azul: primary vira o vermelho da marca e o success volta a ser verde. */
:root, [data-bs-theme=light] {
  --bs-primary: #E80514; --bs-primary-rgb: 232,5,20; --bs-primary-active: #C20411; --bs-primary-light: #FFECEE;
  --bs-primary-clarity: rgba(232,5,20,.2); --bs-primary-inverse: #fff; --bs-text-primary: #E80514;
  --bs-link-color: #E80514; --bs-link-color-rgb: 232,5,20; --bs-link-hover-color: #C20411; --bs-link-hover-color-rgb: 194,4,17;
  --bs-focus-ring-color: rgba(232,5,20,.25);
  --bs-component-active-bg: #E80514; --bs-component-hover-color: #E80514; --bs-component-checked-bg: #E80514;
  --bs-menu-link-color-hover: #E80514; --bs-menu-link-color-show: #E80514; --bs-menu-link-color-here: #E80514; --bs-menu-link-color-active: #E80514;
  --bs-success: #17C653; --bs-success-rgb: 23,198,83; --bs-success-active: #04B440; --bs-success-light: #DFFFEA;
  --bs-success-clarity: rgba(23,198,83,.2); --bs-text-success: #17C653;
}
[data-bs-theme=dark] { /* depois do bloco claro: os dois seletores casam no <html> */
  --bs-primary: #E80514; --bs-primary-rgb: 232,5,20; --bs-primary-active: #FF2E3B; --bs-text-primary: #FF2E3B;
  --bs-primary-clarity: rgba(232,5,20,.2); --bs-primary-light: #2A1215;
  --bs-link-color: #FF2E3B; --bs-link-color-rgb: 255,46,59; --bs-link-hover-color: #FF5A64; --bs-link-hover-color-rgb: 255,90,100;
  --bs-component-active-bg: #E80514; --bs-component-hover-color: #FF2E3B; --bs-component-checked-bg: #E80514;
  --bs-menu-link-color-hover: #FF2E3B; --bs-menu-link-color-show: #FF2E3B; --bs-menu-link-color-here: #FF2E3B; --bs-menu-link-color-active: #FF2E3B;
  --bs-success: #00A261; --bs-success-rgb: 0,162,97; --bs-success-active: #01BF73; --bs-success-light: #1F212A;
  --bs-success-clarity: rgba(0,162,97,.2); --bs-text-success: #00A261;
}

/* Verde escrito direto no bundle (Bootstrap compilado), que não lê variável */
.form-check-input:checked, .form-check-input[type=checkbox]:indeterminate { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.progress { --bs-progress-bar-bg: var(--bs-primary); }

/* Validação do servidor: a mensagem sai no toastr; o campo com erro fica com a borda vermelha (classe gerada pelo tag helper) */
.input-validation-error { border-color: var(--bs-danger) !important; }

/* Barra de meta com o marcador "esperado hoje" (o Metronic não tem) */
.meta-barra { position: relative; height: 8px; border-radius: 4px; background: var(--bs-gray-200); }
.meta-barra > .meta-feito { height: 8px; border-radius: 4px; max-width: 100%; }
.meta-barra > .meta-esperado { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--bs-gray-800); }

/* Foto do Google por cima das iniciais (Views/Shared/_Avatar.cshtml) */
.avatar-foto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Componentes que vieram do antigo explorador de documentos e seguem em uso no chat: botões, menu ⋯ e estado vazio.
   As variáveis --exp-borda e --exp-lado são definidas em .chat. */
.exp-mini { width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--bs-gray-600); }
.exp-mini i { font-size: 15px; color: inherit; }
.exp-mini:hover, .exp-mini.show { background: var(--exp-lado); box-shadow: 0 0 0 1px var(--exp-borda); color: var(--bs-gray-900); }
.exp-nada { margin: 0; padding: 1rem .8rem; font-size: 13.5px; color: var(--bs-gray-500); }
.exp-menu.menu-sub-dropdown { min-width: 210px; padding: 5px; border: 1px solid var(--exp-borda); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .12); }
.exp-menu .menu-item { padding: 0; }
.exp-menu .menu-link { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 8px; color: var(--bs-gray-800); font-size: 13.5px; font-weight: 500; }
.exp-menu .menu-link i { font-size: 16px; color: var(--bs-gray-600); }
.exp-menu .menu-link:hover { background: var(--exp-lado) !important; color: var(--bs-gray-900) !important; }
.exp-menu .exp-perigo-item, .exp-menu .exp-perigo-item i, .exp-menu .exp-perigo-item:hover { color: var(--bs-danger) !important; }
.exp-perigo:hover { background: var(--bs-danger-light); color: var(--bs-danger); }
.exp-btn { display: inline-flex; align-items: center; gap: .45rem; height: 34px; padding: 0 .9rem; border: 1px solid var(--bs-gray-300); border-radius: 10px; background: var(--bs-body-bg); color: var(--bs-gray-900); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.exp-btn i { font-size: 15px; color: inherit; }
.exp-btn:hover { border-color: var(--bs-gray-400); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); color: var(--bs-gray-900); }
.exp-centro { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; padding: 2rem; text-align: center; }
.exp-centro h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--bs-gray-900); }
.exp-centro p { max-width: 320px; margin: 0 0 .9rem; font-size: 14px; line-height: 1.5; color: var(--bs-gray-600); }

/* O Metronic não tem min-w-0: sem ele, item flex com text-truncate não encolhe e empurra o resto para fora do card */
.min-w-0 { min-width: 0 !important; }

/* Cartões de opção (radio .btn-check + .btn): o foco do Bootstrap some com o tema; sem isto, quem usa teclado não vê onde está */
.btn-check:focus-visible + .btn { outline: 2px solid var(--bs-primary); outline-offset: 2px; }

/* Organograma: árvore horizontal com ul/li (o Metronic não tem) */
.org { overflow-x: auto; padding-bottom: 2rem; }
.org ul { display: flex; justify-content: center; position: relative; margin: 0; padding: 1.25rem 0 0; }
.org > ul { padding-top: 0; width: max-content; min-width: 100%; } /* sem isso o lado esquerdo da árvore larga fica cortado e sem rolagem */
.org li { list-style: none; position: relative; padding: 1.25rem .4rem 0; text-align: center; }
.org li::before, .org li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 1.25rem; border-top: 1px solid var(--bs-gray-400); }
.org li::after { right: auto; left: 50%; border-left: 1px solid var(--bs-gray-400); }
.org li:only-child { padding-top: 0; }
.org li:only-child::before, .org li:only-child::after, .org > ul > li::before, .org > ul > li::after { display: none; }
.org > ul > li { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0; }
.org li:last-child::before { border-right: 1px solid var(--bs-gray-400); }
.org ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 1.25rem; border-left: 1px solid var(--bs-gray-400); }
.org .pessoa { display: inline-block; min-width: 11rem; max-width: 15rem; }

/* Cadastro de indicador: sem teste, o resultado não ocupa linha */
#resultadoTeste:empty { display: none; }

/* Confirmação (#modalConfirmar no _Layout, aberto pelo app.js): pode abrir com outro modal já aberto (a memória do chat).
   Fica acima dele, e o segundo fundo escuro cobre o modal de baixo. */
#modalConfirmar { z-index: 1065; }
.modal-backdrop ~ .modal-backdrop { z-index: 1060; }

/* Tela cheia (ViewData["Cheia"] no _Layout, usada pelo chat): sem o título da página e sem as margens do conteúdo. */
.tela-cheia #kt_app_toolbar { display: none; }
.tela-cheia #kt_app_content { padding: 0; }
.tela-cheia #kt_app_content_container { max-width: none; padding: 0 !important; } /* o tema põe a margem lateral com !important */

/* Chat (Views/Chat): as conversas à esquerda e a conversa em coluna central; o agente é escolhido no campo de pergunta.
   Regra da tela: cada informação aparece uma vez, sem rótulo nem fio em cada seção, e o que é secundário (data da conversa,
   menu ⋯, copiar, horário da mensagem) só aparece ao passar o mouse; sem mouse (celular), fica à vista.
   --chat-fora é a altura do que fica acima do chat: nada no computador, a barra do menu no celular. */
.chat { --exp-borda: var(--bs-gray-200); --exp-lado: var(--bs-gray-100); /* o menu ⋯ das conversas usa as classes exp-* */
  --chat-fora: 0px; display: grid; grid-template-columns: 272px minmax(0, 1fr); height: calc(100dvh - var(--chat-fora)); min-height: 420px; background: var(--bs-body-bg); }
.chat-sem-agente { grid-template-columns: 1fr; }
.chat-lado { display: flex; flex-direction: column; min-height: 0; background: var(--bs-gray-100); border-right: 1px solid var(--bs-gray-200); }
.chat-lado-topo { display: flex; flex-direction: column; gap: .25rem; padding: .85rem .5rem .25rem; }
.chat-fechar-lado, .chat-abrir-lado { display: none; } /* só no celular */
.chat-fechar-lado { justify-content: center; height: 38px; margin-bottom: .35rem; }
/* "Nova conversa" e a busca são linhas da lista, sem caixa em volta */
.chat-nova { display: flex; align-items: center; gap: .6rem; height: 36px; padding: 0 .6rem; border-radius: 8px; color: var(--bs-gray-900); font-size: 14px; font-weight: 600; transition: background .12s; }
.chat-nova:hover, .chat-nova:focus-visible { background: var(--bs-gray-200); color: var(--bs-gray-900); }
.chat-nova i { font-size: 16px; color: inherit; }
.chat-busca { display: flex; align-items: center; gap: .6rem; height: 36px; margin: 0; padding: 0 .6rem; border-radius: 8px; background: var(--bs-gray-200); color: var(--bs-gray-700); cursor: text; }
.chat-busca:focus-within { box-shadow: inset 0 0 0 1px var(--bs-gray-500); }
.chat-busca i { font-size: 16px; color: inherit; }
.chat-busca input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--bs-gray-900); font-size: 14px; }
/* a barra de rolagem da lista só aparece com o mouse em cima dela */
.chat-conversas { flex: 1; min-height: 0; padding: 0 .5rem .75rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.chat-conversas:hover, .chat-conversas:focus-within { scrollbar-color: var(--bs-gray-300) transparent; }
.chat-grupo-nome { padding: .9rem .6rem .3rem; color: var(--bs-gray-700); font-size: 12px; font-weight: 500; }
.chat-grupo[hidden], .chat-conversa[hidden] { display: none; } /* a busca esconde o que não combina com o texto (app.js) */
/* Cada conversa é uma linha: o ícone do agente e o título. A data e o ⋯ só ao passar o mouse (ou com o foco, ou com o menu
   aberto); sem mouse (celular), sempre à vista. */
.chat-conversa { display: flex; align-items: center; gap: .35rem; height: 34px; margin-bottom: 1px; padding: 0 .3rem 0 .6rem; border-radius: 8px; color: var(--bs-gray-800); transition: background .12s; }
.chat-conversa:hover, .chat-conversa:focus-within, .chat-conversa:has(.show), .chat-conversa.ativa { background: var(--bs-gray-200); color: var(--bs-gray-900); }
.chat-conversa-link { display: flex; flex: 1; align-items: center; gap: .55rem; min-width: 0; height: 100%; color: inherit; }
.chat-conversa-link:hover { color: inherit; }
.chat-conversa-link i { flex-shrink: 0; font-size: 15px; color: var(--bs-gray-600); }
.chat-conversa-titulo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; }
.chat-conversa.ativa .chat-conversa-titulo { font-weight: 600; }
.chat-conversa-data { display: none; flex-shrink: 0; color: var(--bs-gray-700); font-size: 12px; }
.chat-conversa-acoes { display: none; flex-shrink: 0; }
.chat-conversa:hover :is(.chat-conversa-data, .chat-conversa-acoes), .chat-conversa:focus-within :is(.chat-conversa-data, .chat-conversa-acoes), .chat-conversa:has(.show) :is(.chat-conversa-data, .chat-conversa-acoes) { display: inline-flex; }
@media (hover: none) { .chat-conversa-data, .chat-conversa-acoes { display: inline-flex; } }

/* Painel. Sem mensagem é a tela inicial: saudação, campo de pergunta e sugestões, nessa ordem, o topo mostra só "Memória"
   e o painel rola inteiro. Com a primeira mensagem, a saudação e as sugestões somem, o título aparece no topo e o campo
   fica no rodapé (:has, sem script). */
.chat-painel { --chat-margem: max(1.5rem, calc((100% - 760px) / 2)); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-painel:not(:has(.chat-msg)) { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--bs-gray-300) transparent; }
.chat-painel:not(:has(.chat-msg)) .chat-lista, .chat-painel:has(.chat-msg) .chat-ola, .chat-painel:has(.chat-msg) .chat-inicio { display: none; }
.chat-topo { position: sticky; top: 0; z-index: 1; display: flex; flex-shrink: 0; align-items: center; gap: .75rem; min-height: 54px; padding: .5rem 1.1rem .5rem 1.75rem; border-bottom: 1px solid var(--bs-gray-200); background: var(--bs-body-bg); }
.chat-titulo { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bs-gray-900); font-size: 15px; font-weight: 600; }
/* na tela inicial o título ("Nova conversa") fica só para o leitor de tela, e o topo perde o fio */
.chat-painel:not(:has(.chat-msg)) .chat-topo { border-bottom-color: transparent; }
.chat-painel:not(:has(.chat-msg)) .chat-titulo { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
.chat-memoria { display: inline-flex; flex-shrink: 0; align-items: center; gap: .45rem; height: 34px; margin-left: auto; padding: 0 .65rem; border: 0; border-radius: 8px; background: none; color: var(--bs-gray-700); font-size: 13.5px; font-weight: 500; transition: background .12s; }
.chat-memoria:hover, .chat-memoria:focus-visible { background: var(--bs-gray-200); color: var(--bs-gray-900); }
.chat-memoria i { font-size: 16px; color: inherit; }
.chat-ola { padding: clamp(1.5rem, 13dvh, 7.5rem) var(--chat-margem) 1.75rem; }
.chat-ola h2 { margin: 0; color: var(--bs-gray-900); font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.chat-lista { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 1.1rem; padding: 1.75rem var(--chat-margem) 1.25rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--bs-gray-300) transparent; }
.chat-lista > * { flex-shrink: 0; } /* sem isto, numa conversa mais alta que a tela as mensagens encolhem e o rodapé cai em cima do texto */
/* A pergunta é um balão claro à direita; a resposta não tem balão: é texto, com a marca à esquerda. */
.chat-msg { color: var(--bs-gray-900); font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg-user { align-self: flex-end; max-width: 78%; padding: .6rem .9rem; border-radius: 14px 14px 4px 14px; background: var(--bs-gray-200); }
.chat-msg-assistant { position: relative; min-height: 28px; padding-left: 40px; color: var(--bs-gray-800); }
.chat-msg-assistant::before { content: ""; position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 8px; background: var(--bs-body-bg) url(../img/favicon.png) center / 17px no-repeat; box-shadow: 0 0 0 1px var(--bs-gray-200); }
.chat-msg-erro { align-self: flex-start; margin-left: 40px; padding: .6rem .9rem; border-radius: 12px; background: var(--bs-danger-light); color: var(--bs-danger); }
/* Rodapé de cada mensagem. Na resposta, a fonte dos dados ("Fonte: Pipedrive") fica sempre à vista; copiar, exportar a
   tabela (só na resposta que tem tabela), "Como foi calculado", a avaliação e o horário ("Há 8 minutos", atualizado pelo
   app.js) só aparecem com o mouse na mensagem ou no rodapé, ou com o foco do teclado; sem mouse (celular), ficam à
   vista. O rodapé some inteiro enquanto a resposta ainda está sendo escrita na tela. */
.chat-msg-rodape { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; margin: -.8rem 0 -.45rem; color: var(--bs-gray-700); font-size: 12px; }
.chat-msg-rodape > * { opacity: 0; transition: opacity .12s; }
.chat-msg-rodape > .chat-fonte, .chat-msg:hover + .chat-msg-rodape > *, .chat-msg-rodape:hover > *, .chat-msg-rodape:focus-within > * { opacity: 1; }
@media (hover: none) { .chat-msg-rodape > * { opacity: 1; } }
.chat-fonte { margin-right: .35rem; padding-left: 7px; font-size: 12.5px; } /* 7px: o respiro dos botões vizinhos, para alinhar com o texto da resposta */
.chat-avaliar { display: inline-flex; }
.chat-copiar.ativo, .chat-copiar.ativo:hover { color: var(--bs-text-primary); }
/* "Continuar no Financeiro", sob a resposta que mandou a pessoa para outro agente: sempre à vista, é o próximo passo */
.chat-continuar { display: inline-flex; align-self: flex-start; align-items: center; gap: .5rem; height: 36px; margin: -.5rem 0 0 40px; padding: 0 .9rem 0 .8rem; border: 1px solid var(--bs-gray-300); border-radius: 10px; background: var(--bs-body-bg); color: var(--bs-gray-900); font-size: 13.5px; font-weight: 600; transition: border-color .12s, box-shadow .12s; }
.chat-continuar:hover, .chat-continuar:focus-visible { border-color: var(--bs-gray-400); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); color: var(--bs-gray-900); }
.chat-continuar i { font-size: 17px; color: var(--bs-primary); }
.chat-continuar i:last-child { font-size: 13px; color: var(--bs-gray-700); }
.chat-msg-rodape-user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-rodape-assistant { margin-left: 33px; }
.chat-msg-rodape time { margin: 0 .4rem; }
.chat-copiar { display: inline-flex; align-items: center; gap: .35rem; padding: 4px 7px; border: 0; border-radius: 7px; background: none; color: inherit; font-size: 12.5px; font-weight: 500; }
.chat-copiar:hover, .chat-copiar:focus-visible { background: var(--bs-gray-200); color: var(--bs-gray-900); }
.chat-copiar i { font-size: 15px; color: inherit; }
.chat-md:not(:has(table)) + .chat-msg-rodape [data-exportar] { display: none; }
.chat-escrevendo + .chat-msg-rodape { visibility: hidden; }
/* resposta formatada (Chat/Formatacao.cs): parágrafo, lista, tabela, negrito e link */
.chat-md { white-space: normal; }
.chat-md > :first-child { margin-top: 0; }
.chat-md > :last-child { margin-bottom: 0; }
.chat-md p, .chat-md ul, .chat-md ol, .chat-md table, .chat-md pre, .chat-md blockquote { margin: 0 0 .7rem; }
.chat-md ul, .chat-md ol { padding-left: 1.3rem; }
.chat-md li + li { margin-top: .15rem; }
.chat-md h1, .chat-md h2, .chat-md h3, .chat-md h4 { margin: .5rem 0; color: var(--bs-gray-900); font-size: 15px; font-weight: 600; }
.chat-md strong { color: var(--bs-gray-900); font-weight: 600; }
.chat-md a { color: var(--bs-text-primary); text-decoration: underline; }
/* tabela só com fios entre as linhas, sem caixa em cada célula */
.chat-md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.chat-md th, .chat-md td { padding: .5rem 1.1rem .5rem 0; border: 0; border-bottom: 1px solid var(--bs-gray-200); text-align: left; overflow-wrap: normal; }
.chat-md th { border-bottom-color: var(--bs-gray-300); color: var(--bs-gray-700); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chat-md code { padding: .1rem .3rem; border-radius: 4px; background: var(--bs-gray-200); color: inherit; font-size: 13px; }
.chat-md pre { padding: .6rem .8rem; border-radius: 8px; background: var(--bs-gray-200); white-space: pre-wrap; }
.chat-md pre code { padding: 0; background: none; }
.chat-md blockquote { padding-left: .8rem; border-left: 3px solid var(--bs-gray-300); color: var(--bs-gray-700); }
.chat-digitando { display: flex; align-items: center; gap: .7rem; }
.chat-pontos { display: inline-flex; gap: 4px; }
.chat-pontos i { width: 6px; height: 6px; border-radius: 50%; background: var(--bs-primary); animation: chat-ponto 1.2s infinite ease-in-out; }
.chat-pontos i:nth-child(2) { animation-delay: .15s; }
.chat-pontos i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-ponto { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
/* efeito da resposta: a mensagem entra suave, a marca pulsa enquanto espera, o status brilha e o texto aparece com cursor */
.chat-msg { animation: chat-entrada .28s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes chat-entrada { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.chat-digitando::before { animation: chat-aura 1.6s infinite ease-out; }
@keyframes chat-aura { from { box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), .45); } to { box-shadow: 0 0 0 10px rgba(var(--bs-primary-rgb), 0); } }
.chat-status { background: linear-gradient(90deg, var(--bs-gray-500) 35%, var(--bs-gray-900) 50%, var(--bs-gray-500) 65%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 500; animation: chat-brilho 1.8s linear infinite; }
@keyframes chat-brilho { from { background-position: 125% 0; } to { background-position: -125% 0; } }
.chat-escrevendo::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -.15em; background: var(--bs-primary); animation: chat-cursor .8s steps(1) infinite; }
@keyframes chat-cursor { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chat-msg, .chat-pontos i, .chat-status, .chat-digitando::before, .chat-escrevendo::after { animation: none; }
  .chat-status { background: none; color: var(--bs-gray-700); }
}

/* Campo de pergunta: uma caixa com o texto em cima e, embaixo, à esquerda os conectores, o agente e o escopo e, à direita,
   o clipe e o botão de enviar. O formulário é "display: contents": os filhos dele entram no flex da caixa, ao lado dos
   conectores (formulário próprio). As miniaturas das imagens anexadas ficam acima do texto (app.js). */
.chat-barra { display: flex; flex-shrink: 0; flex-direction: column; padding: .25rem var(--chat-margem) 1.4rem; }
.chat-caixa { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .25rem; padding: .85rem .7rem .55rem .5rem; border: 1px solid var(--bs-gray-300); border-radius: 18px; background: var(--bs-body-bg); box-shadow: 0 1px 2px rgba(7, 20, 55, .04), 0 8px 24px rgba(7, 20, 55, .05); transition: border-color .15s, background .15s; }
.chat-caixa:focus-within { border-color: var(--bs-gray-400); }
.chat-painel.arrastando .chat-caixa { border-color: var(--bs-primary); background: var(--bs-primary-light); }
.chat-envio { display: contents; }
/* a caixa tem menos respiro à esquerda do que o texto: é o respiro interno da pílula, para o nome do agente alinhar com a pergunta */
.chat-campo { position: relative; display: flex; flex: 0 0 100%; flex-direction: column; min-width: 0; padding-left: .55rem; }
/* Próxima pergunta sugerida pelo agente: é o placeholder do campo (cinza, some ao digitar). O selo "Tab" só existe enquanto
   a sugestão está à vista, e o clique nele faz o mesmo que a tecla; em tela de toque ele diz "Usar". */
.chat-tab { position: absolute; top: .1rem; right: 0; display: none; padding: 0; border: 0; background: none; }
.chat-campo.com-proxima:has(textarea:placeholder-shown) .chat-tab { display: inline-flex; }
.chat-campo.com-proxima textarea, .chat-campo.com-proxima textarea:focus { padding-right: 3.25rem; }
.chat-tab kbd { padding: 1px 6px; border: 1px solid var(--bs-gray-300); border-radius: 6px; background: none; box-shadow: none; color: var(--bs-gray-700); font-family: inherit; font-size: 11px; font-weight: 600; }
.chat-tab kbd::before { content: "Tab"; }
@media (hover: none) { .chat-tab kbd::before { content: "Usar"; } }
.chat-campo textarea, .chat-campo textarea:focus { min-height: 0; max-height: 160px; padding: .15rem 0; border: 0; background: transparent; box-shadow: none; color: var(--bs-gray-900); font-size: 15px; line-height: 1.5; field-sizing: content; resize: none; }
.chat-painel:not(:has(.chat-msg)) .chat-campo textarea { min-height: 3rem; } /* na tela inicial o campo nasce com duas linhas */
.chat-conectores { order: 1; }
.chat-ferramentas { order: 2; display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: .25rem; min-width: 0; }
.chat-ferramentas [data-anexar] { margin-left: auto; } /* o clipe vai para a direita, ao lado do botão de enviar */
/* align-self: em tela estreita as ferramentas quebram em duas linhas, e o botão de enviar fica na de baixo, ao lado do clipe */
.chat-enviar { order: 3; display: inline-grid; flex-shrink: 0; align-self: flex-end; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--bs-primary); color: var(--bs-primary-inverse); transition: background .12s; }
.chat-enviar:hover { background: var(--bs-primary-active); }
.chat-enviar:disabled { opacity: .45; }
.chat-enviar i { font-size: 18px; color: inherit; }
.chat-anexos { display: flex; flex-wrap: wrap; gap: .75rem; padding: .15rem 0 .6rem; }
.chat-anexos[hidden] { display: none; }
.chat-anexo { position: relative; width: 84px; }
.chat-anexo img { display: block; width: 84px; height: 60px; border: 1px solid var(--bs-gray-300); border-radius: 8px; background: var(--bs-gray-100); object-fit: cover; }
.chat-anexo-nome { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bs-gray-700); font-size: 11px; }
.chat-anexo-remover { position: absolute; top: -7px; right: -7px; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--bs-gray-300); border-radius: 50%; background: var(--bs-body-bg); color: var(--bs-gray-700); }
.chat-anexo-remover:hover, .chat-anexo-remover:focus-visible { border-color: var(--bs-gray-500); color: var(--bs-gray-900); }
.chat-anexo-remover i { font-size: 11px; color: inherit; }
/* Imagens dentro do balão da pergunta: as miniaturas da que acabou de sair e, numa conversa reaberta, só a contagem. */
.chat-msg-imagens { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-msg-imagens.com-texto { margin-bottom: .5rem; }
.chat-msg-imagens img { display: block; max-width: 180px; max-height: 120px; border-radius: 8px; background: #fff; object-fit: cover; }
.chat-msg-anexo { display: flex; align-items: center; gap: .35rem; width: fit-content; padding: .2rem .55rem; border-radius: 8px; background: var(--bs-body-bg); font-size: 12.5px; }
.chat-msg-anexo.com-texto { margin-bottom: .4rem; }
.chat-msg-anexo i { font-size: 15px; color: inherit; }
/* Ferramentas do campo, sem caixa em volta. A pílula mostra o agente e abre o menu de troca (com um agente só, é só o
   nome); o escopo é uma chave, "Somente os meus negócios", e só existe no agente que recebe o e-mail da pessoa. */
.chat-pilula { display: inline-flex; align-items: center; gap: .45rem; height: 34px; padding: 0 .55rem; border: 0; border-radius: 9px; background: none; color: var(--bs-gray-900); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .12s; }
.chat-pilula i { font-size: 17px; color: var(--bs-primary); }
.chat-pilula .chat-pilula-seta { font-size: 11px; color: var(--bs-gray-700); }
button.chat-pilula:hover, button.chat-pilula.show { background: var(--bs-gray-200); }
.chat-agentes-menu.menu-sub-dropdown { min-width: 260px; }
.exp-menu .chat-agente-opcao { align-items: flex-start; padding: .5rem .6rem; }
.exp-menu .chat-agente-opcao i { margin-top: 1px; font-size: 19px; }
.exp-menu .chat-agente-opcao.ativo { background: var(--bs-primary-light); }
.exp-menu .chat-agente-opcao.ativo i, .exp-menu .chat-agente-opcao.ativo .chat-agente-nome { color: var(--bs-primary-active); }
.chat-agente-nome { display: block; color: var(--bs-gray-900); font-size: 14px; font-weight: 600; line-height: 1.35; }
.chat-agente-desc { display: block; color: var(--bs-gray-700); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.chat-escopo { display: inline-flex; align-items: center; gap: .5rem; height: 34px; margin: 0; padding: 0 .55rem; border-radius: 9px; color: var(--bs-gray-700); font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .12s; }
.chat-escopo:hover { background: var(--bs-gray-200); color: var(--bs-gray-900); }
.chat-escopo input { position: relative; flex-shrink: 0; width: 28px; height: 16px; margin: 0; border-radius: 8px; background: var(--bs-gray-500); appearance: none; cursor: pointer; transition: background .15s; }
.chat-escopo input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; }
.chat-escopo input:checked { background: var(--bs-primary); }
.chat-escopo input:checked::before { transform: translateX(12px); }
.chat-escopo input:checked + span { color: var(--bs-gray-900); }
.chat-escopo input:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.chat-clipe { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--bs-gray-700); }
.chat-clipe:hover, .chat-clipe.show { background: var(--bs-gray-200); color: var(--bs-gray-900); }
.chat-clipe i { font-size: 19px; color: inherit; }
/* Conectores do agente por pessoa (Financeiro), à esquerda das ferramentas. O ponto do botão diz se a conta está ligada
   (verde) ou falta ligar (âmbar, a cor do Feed). O menu usa o estilo exp-menu, com uma chave por conector. */
.chat-conectores-ponto { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--bs-warning); box-shadow: 0 0 0 2px var(--bs-body-bg); }
.chat-conectores-ponto.ligado { background: var(--bs-success); }
.chat-conectores-menu.menu-sub-dropdown { min-width: 290px; }
.chat-conectores-titulo { padding: .45rem .7rem .15rem; color: var(--bs-gray-700); font-size: 12px; }
.chat-conector { display: flex; align-items: center; gap: .7rem; margin: 0; padding: .5rem .7rem; }
.chat-conector > i { font-size: 20px; color: var(--bs-gray-600); }
.chat-conector-texto { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.chat-conector-nome { color: var(--bs-gray-900); font-size: 14px; font-weight: 500; }
.chat-conector-situacao { color: var(--bs-gray-700); font-size: 12px; }
/* Tela inicial, abaixo do campo: as sugestões do agente, uma por linha, só o texto (sem rótulo, fio nem seta). A margem
   lateral é menor no tanto do respiro do botão, para o texto delas alinhar com a borda do campo. */
.chat-inicio { display: flex; flex-direction: column; gap: 2px; padding: 0 calc(var(--chat-margem) - .75rem) 2.5rem; }
.chat-inicio button { min-height: 40px; padding: .5rem .75rem; border: 0; border-radius: 10px; background: none; color: var(--bs-gray-700); font-size: 14.5px; font-weight: 500; text-align: left; transition: background .12s; }
.chat-inicio button:hover, .chat-inicio button:focus-visible { background: var(--bs-gray-200); color: var(--bs-gray-900); }
@media (max-width: 991.98px) { /* celular: a conversa ocupa a tela; as conversas abrem no lugar dela, pelo botão do topo */
  .chat { --chat-fora: var(--bs-app-header-height, 60px); grid-template-columns: minmax(0, 1fr); }
  .chat-lado { display: none; border-right: 0; }
  .chat.lado-aberto .chat-lado { display: flex; }
  .chat.lado-aberto .chat-painel { display: none; }
  .chat-fechar-lado { display: inline-flex; }
  .chat-abrir-lado { display: inline-grid; }
  .chat-topo { padding: .5rem .6rem .5rem 1rem; }
  .chat-msg-user { max-width: 88%; }
}

/* Feed: publicações da empresa (Views/Feed). Coluna central; a publicação fixada vira faixa âmbar no topo. */
:root { --ambar-fundo: #FAEEDA; --ambar-forte: #854F0B; --ambar-titulo: #412402; --ambar-texto: #633806; }
[data-bs-theme=dark] { --ambar-fundo: #2E2414; --ambar-forte: #F0B45C; --ambar-titulo: #FBE7C6; --ambar-texto: #E3CBA4; }
.feed { display: flex; flex-direction: column; gap: 1.25rem; max-width: 760px; margin: 0 auto; }
.feed-filtro { padding: .45rem 1.1rem; border: 1px solid var(--bs-gray-300); border-radius: 999px; background: var(--bs-body-bg); color: var(--bs-gray-700); font-size: 13px; font-weight: 600; transition: border-color .12s, color .12s; }
.feed-filtro:hover { border-color: var(--bs-gray-400); color: var(--bs-gray-900); }
.feed-filtro.ativo { border-color: var(--bs-primary); background: var(--bs-primary); color: var(--bs-primary-inverse); }
.feed-post { overflow: hidden; border: 1px solid var(--bs-gray-200); border-radius: 14px; background: var(--bs-body-bg); }
/* capa sempre inteira, na proporção original, até 640px de altura; imagem vertical ou estreita ganha fundo desfocado nas laterais.
   O img é bloco com max-width/max-height (sem flex nem grid): assim o navegador reduz mantendo a proporção, sem distorcer. */
.feed-capa { position: relative; overflow: hidden; background: var(--bs-gray-100); }
.feed-capa-fundo, .pub-upload-fundo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(28px); transform: scale(1.2); opacity: .6; }
.feed-capa-img { position: relative; display: block; max-width: 100%; max-height: min(640px, 70vh); margin: 0 auto; }
.feed-corpo { padding: 1.25rem 1.5rem; }
.feed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .6rem; font-size: 12px; color: var(--bs-gray-500); }
.feed-fixada { display: inline-flex; align-items: center; gap: .25rem; font-size: 12px; font-weight: 600; color: var(--bs-gray-600); }
.feed-fixada i { font-size: 14px; color: inherit; }
.feed-titulo { margin: 0 0 .5rem; font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--bs-gray-900); }
/* texto longo fica em 5 linhas; o "Ler mais" (app.js) só aparece quando houve corte */
.feed-texto { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; font-size: 14px; line-height: 1.65; color: var(--bs-gray-700); white-space: pre-line; overflow-wrap: anywhere; }
.feed-texto.aberto { display: block; }
.feed-rodape { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.feed-autor { display: flex; align-items: center; gap: .5rem; font-size: 12.5px; color: var(--bs-gray-600); }
.feed-ler-mais { padding: 0; border: 0; background: none; color: var(--bs-primary); font-size: 13px; font-weight: 600; }
.feed-ler-mais:hover { text-decoration: underline; }
.feed-post.destaque { border-color: transparent; background: var(--ambar-fundo); }
.feed-post.destaque .feed-meta, .feed-post.destaque .feed-fixada, .feed-post.destaque .feed-ler-mais { color: var(--ambar-forte); }
.feed-post.destaque .feed-titulo { color: var(--ambar-titulo); }
.feed-post.destaque .feed-texto, .feed-post.destaque .feed-autor { color: var(--ambar-texto); }
.feed-vazio { padding: 3.5rem 1.5rem; border: 1px dashed var(--bs-gray-300); border-radius: 14px; text-align: center; }
.feed-vazio h2 { margin: 0 0 .3rem; font-size: 17px; font-weight: 600; color: var(--bs-gray-900); }
.feed-vazio p { margin: 0; font-size: 14px; color: var(--bs-gray-600); }

/* Imagem de capa no Admin (Publicacoes/Editar): o input invisível cobre a área, então clicar e soltar o arquivo são nativos */
.pub-upload { position: relative; display: grid; place-items: center; height: 240px; overflow: hidden; border: 1.5px dashed var(--bs-gray-300); border-radius: 12px; background: var(--bs-gray-100); transition: border-color .15s, background .15s; }
.pub-upload:hover, .pub-upload.arrastando { border-color: var(--bs-primary); background: var(--bs-primary-light); }
.pub-upload:has(input:focus-visible) { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.pub-upload input { position: absolute; inset: 0; z-index: 1; opacity: 0; cursor: pointer; }
.pub-upload-previa { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; } /* inteira, como no Feed */
.pub-upload-texto { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1rem; color: var(--bs-gray-700); font-size: 14px; font-weight: 500; text-align: center; }
.pub-upload-texto i { font-size: 32px; color: var(--bs-gray-500); }
.pub-upload-texto small { font-size: 12px; font-weight: 400; color: var(--bs-gray-500); }
.pub-upload-acoes { position: absolute; right: .75rem; bottom: .75rem; display: flex; gap: .4rem; }
.pub-upload-acoes > * { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12.5px; font-weight: 600; }
.pub-upload-acoes i { font-size: 14px; color: inherit; }
.pub-upload-ajustar { position: relative; z-index: 2; } /* acima do input invisível: clicar aqui não abre o seletor de arquivo */
.pub-upload-ajustar:hover { background: rgba(0, 0, 0, .8); }
/* "Ajustar" só depois de um recorte nesta tela: a imagem já salva fica no Blob, e o navegador não deixa recortar arquivo de outro domínio */
.pub-upload:not(.com-imagem) img, .pub-upload:not(.com-imagem) .pub-upload-acoes, .pub-upload.com-imagem .pub-upload-texto, .pub-upload:not(.recortada) .pub-upload-ajustar { display: none; }
/* Modal de recorte (Cropper.js do Metronic). O palco tem altura fixa porque o Cropper mede o elemento pai. */
.recorte-palco { height: min(60vh, 520px); background: #1E1E2D; }
.recorte-palco img { display: block; max-width: 100%; }
.recorte-palco .cropper-line, .recorte-palco .cropper-point { background-color: #fff; }
.recorte-palco .cropper-view-box { outline-color: rgba(255, 255, 255, .85); }
.recorte-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.5rem 0; }
.recorte-grupo { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.recorte-dica { margin: .75rem 1.5rem 0; font-size: 12px; color: var(--bs-gray-500); }
.pub-miniatura { width: 72px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--bs-gray-100); object-fit: cover; }
.pub-miniatura i { font-size: 18px; color: var(--bs-gray-400); }

/* Painéis (Views/Paineis): tabela larga, uma coluna por período. A 1ª coluna e a de resumo ficam paradas ao rolar para
   o lado; o fio do resumo é sombra, porque borda de célula fixa some ao rolar. As linhas seguem a organização do painel do
   CEO, nas cores da intranet: entrada em faixa verde, saída em faixa vermelha, percentual em itálico, período em andamento
   em itálico. */
.painel-tabela th, .painel-tabela td { padding-left: .5rem; padding-right: .5rem; }
.painel-tabela td { color: var(--bs-gray-800); font-variant-numeric: tabular-nums; }
.painel-tabela th:first-child, .painel-tabela td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bs-card-bg); }
.painel-tabela td:first-child { color: var(--bs-gray-700); }
.painel-tabela .painel-resumo { position: sticky; right: 0; z-index: 1; background: var(--bs-card-bg); box-shadow: inset 1px 0 0 var(--bs-border-color); padding-left: 1rem; }
.painel-tabela .painel-parcial { font-style: italic; }
.painel-tabela .painel-ano { background: var(--bs-gray-100); font-weight: 700; } /* coluna de ano do Forecast: soma dos quatro trimestres */
.painel-formula { margin-left: .2rem; color: var(--bs-gray-500); font-weight: 400; font-size: .9em; }
.painel-tabela .painel-forte td, .painel-tabela tfoot td { font-weight: 700; color: var(--bs-gray-900); }
.painel-tabela .painel-secundaria td { color: var(--bs-gray-600); }
.painel-tabela .painel-taxa td { font-style: italic; color: var(--bs-gray-600); }
.painel-tabela .painel-entrada td { background: var(--bs-success-light); color: var(--bs-success); font-weight: 700; }
.painel-tabela .painel-saida td { background: var(--bs-danger-light); color: var(--bs-danger); font-weight: 700; }
.painel-tabela tfoot { font-weight: 700; } /* no tr/tfoot: o Metronic faz a célula herdar o peso da linha */
.painel-tabela tfoot td { border-top: 1px dashed var(--bs-border-color); }
.painel-abrir { text-decoration: underline dotted; text-underline-offset: 3px; } /* número que abre a lista de clientes */

/* Operacional: linha principal em negrito leve; linha que abre (botão com seta, que gira quando aberta); linhas de abertura
   recuadas por nível, em tom mais claro; faixa com o nome da alocação filtrada. */
.painel-tabela .painel-principal td { color: var(--bs-gray-900); }
.painel-tabela .painel-sub td { color: var(--bs-gray-600); font-weight: 400; }
.painel-tabela .painel-sub td:first-child { padding-left: 1.9rem; }
.painel-tabela .painel-sub.painel-nivel-1 td:first-child { padding-left: 3.1rem; }
.painel-tabela .painel-sub.painel-nivel-2 td:first-child { padding-left: 4.3rem; }
.painel-tabela .painel-grupo td { color: var(--bs-gray-600); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.painel-abre { display: inline-flex; align-items: center; gap: .4rem; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.painel-abre i { color: var(--bs-gray-500); transition: transform .15s; }
.painel-abre[aria-expanded="true"] i { transform: rotate(90deg); }
.painel-dim { display: inline-block; width: auto; margin-left: .4rem; padding: .1rem 2rem .1rem .4rem; background-position: right .5rem center; font-size: .8rem; color: var(--bs-gray-600); }

/* Cohort: cada célula tem a cor da retenção, do vermelho (0%) ao verde (100%), pela variável --p (0 a 1) que a tela escreve.
   No tema escuro a mesma escala fica mais fechada, para o texto continuar legível. */
.painel-tabela td.painel-calor { background: hsl(calc(var(--p) * 120), 62%, 86%); color: var(--bs-gray-900); } /* com a tabela na frente: ganha do fundo de célula do Bootstrap */
[data-bs-theme=dark] .painel-tabela td.painel-calor { background: hsl(calc(var(--p) * 120), 45%, 24%); }
.table.painel-tabela:has(.painel-calor) th:last-child, .table.painel-tabela:has(.painel-calor) td:last-child { padding-right: .5rem; } /* a última coluna também tem cor: o número não encosta na borda */

/* Ordenar pelo título da coluna (table[data-ordenavel], app.js): seta na coluna ativa, como no painel do CEO. */
.painel-tabela th[data-ordenar] { cursor: pointer; user-select: none; }
.painel-tabela th[data-ordenar]:hover, .painel-tabela th.ordem-ativa { color: var(--bs-gray-900) !important; }
.painel-tabela th.ordem-ativa::after { content: " \25B4"; }
.painel-tabela th.ordem-ativa.ordem-desc::after { content: " \25BE"; }
