/* Fase 6 (revisão visual e funcional, 13/11/2026): acertos de desenho por cima de styles.css e tema-sistema.css (carrega depois dos dois).
   Não mexe em cores da marca nem no logotipo: só alinhamento, quebra de linha, tamanho e ordem. */

/* ===== Automações: aviso honesto no topo e cartão arrumado ===== */
.aviso-honesto { margin: 0 0 14px; padding: 10px 14px; border: 1px solid #c58a00; background: #fff8e6; color: #5a4300; border-radius: 6px; font-size: 13px; line-height: 1.45; }
.workspace:not(:has(.wx-app)) > .aviso-honesto { margin-left: 24px; margin-right: 24px; }
.automation-card { gap: 6px; min-width: 0; }
.automation-card .automation-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.automation-card .automation-topo strong { min-width: 0; overflow-wrap: anywhere; }
.automation-card .automation-topo .kebab { flex: none; }
.automation-card span, .automation-card small { overflow-wrap: anywhere; }
.automation-card label.automation-ativa { display: inline-flex; align-items: center; gap: 8px; width: fit-content; margin: 4px 0 0; cursor: pointer; color: var(--muted); font-weight: 500; }
.automation-card label.automation-ativa input { width: 16px; height: 16px; flex: none; margin: 0; padding: 0; }

/* ===== Relatórios comerciais ===== */
.report-grid { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); align-items: start; }
.report-card { display: grid; gap: 10px; align-content: start; min-width: 0; }
.report-card h2 { margin: 0; }
.report-card .report-resumo { margin: 0; padding: 0; font-size: 13px; }
.report-card .table-wrap { max-height: 340px; overflow: auto; }
.report-tabela { width: 100%; }
.report-tabela th.num, .report-tabela td.num { text-align: right; white-space: nowrap; }
.report-tabela td { overflow-wrap: anywhere; }
.report-acoes { display: flex; justify-content: flex-end; }

/* ===== Configurações: chave de integração mascarada ===== */
.chave-integracao { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.chave-integracao .endpoint { margin: 0; flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.chave-integracao button { flex: none; }

/* ===== Seção recolhida (Fidelidade, Mensagens em massa) ===== */
.secao-config { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 6px; margin: 16px 0 0; }
.secao-config > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
.secao-config > summary::-webkit-details-marker { display: none; }
.secao-config > summary::before { content: "›"; display: inline-block; font-size: 18px; line-height: 1; transition: transform .12s ease; }
.secao-config[open] > summary::before { transform: rotate(90deg); }
.secao-config-corpo { padding: 4px 14px 14px; display: grid; gap: 10px; }
.secao-config-corpo .form-grid { margin: 0; }
.secao-config-corpo > button { justify-self: start; }
.workspace:not(:has(.wx-app)) > .secao-config { margin-left: 24px; margin-right: 24px; }
.fid-resumo-programa { margin: 0 0 10px; padding: 0; }

/* ===== Linha de lista (Fidelidade, destinatários do envio em massa): nome à esquerda com a largura que sobra ===== */
.customer-card.linha-lista { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; cursor: default; padding: 10px 14px; }
.linha-lista .linha-nome { flex: 1 1 200px; min-width: 0; display: grid; gap: 2px; cursor: pointer; }
.linha-lista .linha-nome strong, .linha-lista .linha-nome small { overflow-wrap: anywhere; }
.linha-lista > div:not(.linha-nome) { min-width: 0; }
.linha-lista .fid-pontos { display: grid; justify-items: end; text-align: right; min-width: 72px; }
.linha-lista .fid-pontos strong { font-size: 18px; }
.fid-linha .fid-situacao { flex: 0 1 190px; font-size: 13px; color: var(--muted); }
.fid-linha .fid-situacao strong, .fid-pode { color: var(--success, #1b7448); }
.fid-linha button { flex: none; width: auto; }
.linha-lista:not(.fid-linha) > div:not(.linha-nome) { flex: 1 1 200px; }

/* ===== Mensagens em massa: o cartão do envio e os botões em linha (nada de barra da largura da tela) ===== */
.emm-envio-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.emm-envio-info { flex: 1 1 320px; min-width: 0; }
.emm-envio-info h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.emm-envio-info p { margin: 2px 0; padding: 0; }
.acoes-linha { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.acoes-linha button { width: auto; flex: none; }

/* ===== Clientes: os dois filtros com o mesmo desenho (rótulo ao lado do campo) ===== */
.filtros-lista { align-items: center; gap: 12px; }
.filtro-campo { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); white-space: nowrap; font-weight: 500; font-size: 13px; }
.filtro-campo select { width: auto; min-width: 150px; }
.workspace:not(:has(.wx-app)) .filtro-campo select { height: 32px; font-size: 13px; }

/* ===== Insumos: "Mostrar inativos" alinhado; cartões em alerta sem contorno pesado (etiqueta de situação + faixa lateral) ===== */
.ins-inativos { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin: 0; white-space: nowrap; cursor: pointer; }
.ins-inativos input { width: 18px; height: 18px; flex: none; margin: 0; padding: 0; }
.ins-card { border: 1px solid var(--line); }
.ins-card.ins-alerta { border-color: var(--line); border-left-color: var(--danger); background: #fff; }
.ins-card.ins-atencao { border-color: var(--line); border-left-color: var(--gold); }
.ins-compra.ins-alerta { border-color: var(--danger); }

/* ===== Comandas: o botão do balcão fica junto da fila (barra larga só no celular) ===== */
.cmd-balcao-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cmd-balcao-topo h3 { margin: 0; }
@media (min-width: 761px) {
  .cmd-nova-balcao { width: auto; min-height: 36px; padding: 6px 16px; font-size: 14px; border-radius: 6px; font-weight: 500; background: #3d5870; border: 1px solid #3d5870; color: #fff; }
  .cmd-nova-balcao:hover { background: #35506a; }
}
@media (max-width: 760px) {
  .cmd-balcao-topo { flex-direction: column; align-items: stretch; }
  .cmd-nova-balcao { width: 100%; }
}

/* ===== Pipeline: o cartão quebra linha em qualquer largura de coluna (a parte do computador está em tema-sistema.css) ===== */
.kanban-card > * { min-width: 0; overflow-wrap: anywhere; }
.kanban-card .kc-meio, .kanban-card .kc-rodape { flex-wrap: wrap; align-items: center; }
.kanban-card .kc-meio p { flex: 1 1 80px; }
.kanban-card .score { white-space: normal; max-width: 100%; }

/* ===== Central WhatsApp (computador): o nome da conversa ganha a largura, a etiqueta da instância fica pequena ===== */
@media (min-width: 761px) {
  .wx-item-linha strong { flex: 1 1 auto; min-width: 0; font-size: 15.5px; }
  .wx-inst { margin-left: 0; margin-right: 0; font-size: 9.5px; padding: 1px 4px; letter-spacing: 0; }
}

/* ===== Coerência: botões de ação do cabeçalho do mesmo tamanho em todas as telas (computador e tablet) ===== */
@media (min-width: 761px) {
  .workspace:not(:has(.wx-app)) .title-actions button { height: 32px; min-height: 32px; padding: 0 14px; font-size: 13px; line-height: 1; border-radius: 6px; font-weight: 500; white-space: nowrap; }
}

/* ===== Coerência: abas no mesmo estilo (Encomendas, Comandas, Insumos) ===== */
.cmd-abas, .ins-abas, .enc-abas { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 0; margin: 0 0 12px; }
.cmd-aba, .ins-aba, .enc-aba { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; min-height: 0; padding: 8px 14px; font-size: 14px; font-weight: 500; box-shadow: none; margin-bottom: -1px; }
.cmd-aba:hover, .ins-aba:hover, .enc-aba:hover { background: transparent; color: var(--brown); box-shadow: none; transform: none; }
.cmd-aba.ativa, .ins-aba.ativa, .enc-aba.ativa { background: transparent; color: var(--brown); border-color: transparent; border-bottom-color: #3d5870; font-weight: 600; }
@media (max-width: 760px) { .cmd-aba, .ins-aba, .enc-aba { padding: 10px 12px; min-height: 44px; } }

/* ===== Prospecção no celular: as tabelas viram cartões (nenhuma coluna cortada) ===== */
@media (max-width: 760px) {
  .table-wrap:has(> .tabela-cartoes) { overflow: visible; border: 0; background: none; }
  .tabela-cartoes, .tabela-cartoes tbody, .tabela-cartoes tr, .tabela-cartoes td { display: block; width: 100%; }
  .tabela-cartoes thead { display: none; }
  .tabela-cartoes tr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  .tabela-cartoes td { position: relative; padding: 4px 0 4px 118px; min-height: 22px; border: 0; text-align: left; overflow-wrap: anywhere; }
  .tabela-cartoes td::before { position: absolute; left: 0; top: 4px; width: 108px; font-size: 12px; color: var(--muted); font-weight: 600; content: ""; }
  .tabela-cartoes td:first-child { padding-left: 0; font-size: 15px; padding-bottom: 6px; }
  .tabela-cartoes td:first-child::before { content: none; }
  .tabela-cartoes td.row-actions { padding-left: 0; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
  .tabela-cartoes td.row-actions::before { content: none; }
  .tabela-cartoes td.row-actions button { width: auto; flex: none; }
  .tc-listas td:nth-child(2)::before { content: "Origem"; }
  .tc-listas td:nth-child(3)::before { content: "Prospects"; }
  .tc-listas td:nth-child(4)::before { content: "Situação"; }
  .tc-listas td:nth-child(5)::before { content: "Criada em"; }
  .tc-chips td:nth-child(2)::before { content: "Papel"; }
  .tc-chips td:nth-child(3)::before { content: "Telefone"; }
  .tc-chips td:nth-child(4)::before { content: "Estado"; }
  .tc-chips td:nth-child(5)::before { content: "Aquecimento"; }
  .tc-chips td:nth-child(6)::before { content: "Hoje"; }
  .tc-chips td:nth-child(7)::before { content: "Chave"; }
  .tc-campanhas td:nth-child(2)::before { content: "Lista e chip"; }
  .tc-campanhas td:nth-child(3)::before { content: "Estado"; }
  .tc-campanhas td:nth-child(4)::before { content: "Destinatários"; }
  .tc-campanhas td:nth-child(5)::before { content: "Enviadas"; }
  .tc-campanhas td:nth-child(6)::before { content: "Falhas"; }
  .tc-campanhas td:nth-child(7)::before { content: "Respostas"; }
  .tc-campanhas td:nth-child(8)::before { content: "Pendentes"; }
  .tc-campanhas td:nth-child(9)::before { content: "Criada em"; }
  .tc-aquecimento td:nth-child(2)::before { content: "Chip"; }
  .tc-aquecimento td:nth-child(3)::before { content: "Estado"; }
  .tc-aquecimento td:nth-child(4)::before { content: "Dia"; }
  .tc-aquecimento td:nth-child(5)::before { content: "Hoje / limite"; }
  .tc-aquecimento td:nth-child(6)::before { content: "Próxima janela"; }
  .tc-aquecimento td:nth-child(7)::before { content: "Criada em"; }
}
