@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700&family=Source+Sans+3:wght@400;500;600;700&display=swap");
:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #1f2a1f;
  --ink-soft: #5a6a5a;
  --line: #e2ddd0;
  --brand: #3f6b3f;
  --brand-dark: #2b4a2b;
  --brand-soft: #e9f0e4;
  --accent: #a9722c;
  --danger: #b23b3b;
  --brand-menu: #20381f;
  --accent-soft: #f4ebdd;
  --side-w: 248px;
  --topbar-h: 58px;
  --f-titulo: "Bricolage Grotesque", "Segoe UI", Roboto, Arial, sans-serif;
  --f-texto: "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
  --sombra: 0 1px 2px rgba(32, 56, 31, 0.06), 0 4px 14px rgba(32, 56, 31, 0.05);
}
html.menu-recolhido { --side-w: 78px; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-texto);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}
main { flex: 1; max-width: 100%; width: 100%; padding: 24px 28px; box-sizing: border-box; overflow-x: hidden; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi .label { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-size: 0.72rem; text-transform: uppercase; }
form.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
form.inline .full { grid-column: 1 / -1; }
label { font-size: 0.72rem; color: var(--ink-soft); display: block; margin-bottom: 3px; }
input, select, textarea { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.88rem; font-family: inherit; }
textarea { min-height: 60px; resize: vertical; }
button {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}
button.danger { background: var(--danger); padding: 4px 8px; font-size: 0.75rem; }
.pos { color: #2e7d4f; }
.neg { color: var(--danger); }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kanban-column {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 250px;
  max-width: 250px;
  padding: 10px;
  flex-shrink: 0;
}
.kanban-column.drag-over { border-color: var(--brand); background: var(--brand-soft); }
.kanban-column h4 {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--brand-dark);
  display: flex;
  justify-content: space-between;
}
.kanban-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  cursor: grab;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card .valor { font-weight: 700; color: var(--brand-dark); margin: 4px 0; }
.kanban-card .acoes { display: flex; gap: 4px; margin-top: 6px; }
.kanban-card .acoes form { flex: 1; }
.kanban-card .acoes button { width: 100%; padding: 4px 0; font-size: 0.7rem; }
.kanban-card .mover-etapa { width: 100%; margin-top: 6px; font-size: 0.72rem; padding: 4px; }
.kanban-add-column {
  min-width: 200px;
  max-width: 200px;
  flex-shrink: 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
}
.kanban-add-column input { margin-bottom: 6px; }
.login-box {
  max-width: 340px;
  margin: 80px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.erro { color: var(--danger); font-size: 0.85rem; margin-bottom: 10px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-dark); }
.pill.accent { background: #f6ead9; color: var(--accent); }
.note { font-size: 0.8rem; color: var(--ink-soft); background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.note.warn { background: #f6ead9; color: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.table-wrap table { margin: 0; }
.table-wrap thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.table-wrap tbody tr:nth-child(even) { background: #fbfaf7; }
.table-wrap tbody tr:hover { background: var(--brand-soft); }
.table-scroll { max-height: 520px; overflow-y: auto; }
.empty { color: var(--ink-soft); font-size: 0.85rem; padding: 14px; text-align: center; }

/* ---- Paginas com cabecalho + acoes (padrao de pagina "app-like") ---- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h2 { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
button.ghost:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
button.small, a.small { padding: 5px 10px; font-size: 0.76rem; border-radius: 7px; }

/* ---- Abas (tabs) para dividir conteudo denso em paineis ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; flex-wrap: wrap; }
.tab-btn {
  background: transparent; border: none; color: var(--ink-soft); padding: 10px 14px;
  font-size: 0.86rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent;
  border-radius: 0; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--brand-dark); background: transparent; }
.tab-btn.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Barra de filtros compacta ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.toolbar .field { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.toolbar .field label { margin: 0; }
.toolbar .field-grow { flex: 1; min-width: 200px; }

/* ---- Tiles de estatistica (cotacao, indicadores) ---- */
.stat-row { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-tile .stat-label { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; }
.stat-tile .stat-value { font-size: 1.35rem; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.stat-tile .stat-meta { font-size: 0.74rem; color: var(--ink-soft); margin-top: 2px; }

/* ---- Badges de status (mais legivel que texto colorido solto) ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: #e3f3e8; color: #2e7d4f; }
.badge.alert { background: #fbe8e6; color: var(--danger); }
.badge.neutral { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }

/* ---- Colunas avancadas que podem ser escondidas por padrao (toggle "Mostrar detalhes") ---- */
.col-extra { display: none; }
.show-extra .col-extra { display: table-cell; }

/* ---- Linha de edicao inline em tabelas (toggle "editar" por registro) ---- */
.edit-row { display: none; }
.edit-row.active { display: table-row; }
.edit-row .inline { background: var(--brand-soft); padding: 10px; border-radius: 8px; }

/* ---- Linha de confirmacao de "marcar como pago" na aba Contas (mesmo padrao do edit-row) ---- */
.marcar-pago-row { display: none; }
.marcar-pago-row.active { display: table-row; }
.marcar-pago-row .inline { background: var(--accent-soft, var(--brand-soft)); padding: 10px; border-radius: 8px; }

/* ---- DRE: linhas de subtotal/total em destaque ---- */
.dre-destaque td { font-weight: 600; background: var(--brand-soft); }
.dre-total td { font-weight: 700; background: var(--brand-soft); border-top: 2px solid var(--brand); }

/* ---- Barra de progresso do cadastro em etapas ---- */
.wizard-progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 4px 0 14px; }
.wizard-progress-bar { height: 100%; background: var(--brand); transition: width .2s ease; }

/* ---- Financeiro: natureza do gasto (badge + barra de composicao) ---- */
.badge.nat-operacional { background: var(--brand-soft); color: var(--brand-dark); }
.badge.nat-aquisicao { background: #f6ead9; color: var(--accent); }
.badge.nat-administrativo { background: #eceae4; color: var(--ink-soft); }
.badge.nat-investimento { background: #e3eaf3; color: #2d4e78; }
.badge.nat-entrada { background: #e3f3e8; color: #2e7d4f; }
.badge.nat-imposto { background: #f3e3e3; color: #a33f3f; }

.split-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.split-bar > div { height: 100%; }
.split-bar .seg-operacional { background: var(--brand); }
.split-bar .seg-aquisicao { background: var(--accent); }
.split-bar .seg-administrativo { background: var(--ink-soft); }
.split-bar .seg-investimento { background: #2d4e78; }

.split-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 0.78rem; color: var(--ink-soft); }
.split-legend span.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.split-legend .dot.seg-operacional { background: var(--brand); }
.split-legend .dot.seg-aquisicao { background: var(--accent); }
.split-legend .dot.seg-administrativo { background: var(--ink-soft); }
.split-legend .dot.seg-investimento { background: #2d4e78; }
.split-legend .legend-value { font-weight: 700; color: var(--ink); }

.kpi-hero { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; border: none; }
.kpi-hero .label { color: rgba(255,255,255,0.78); }
.kpi-hero .value { color: #fff; }
.kpi-hero .stat-meta { color: rgba(255,255,255,0.72); }

.card-section-title { font-size: 0.78rem; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; letter-spacing: 0.03em; margin: 0 0 10px; }

/* ---- Widget flutuante do consultor de IA (disponivel em qualquer tela) ---- */
.ia-fab {
  position: fixed; right: 24px; bottom: 24px; width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; border: none;
  box-shadow: 0 6px 20px rgba(43, 74, 43, 0.35); cursor: pointer; z-index: 1000;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ia-fab:hover { transform: scale(1.06); box-shadow: 0 8px 24px rgba(43, 74, 43, 0.45); }
.ia-painel {
  position: fixed; right: 24px; bottom: 94px; width: 380px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 140px); background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,0.22); z-index: 1000;
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(0.98); pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.ia-painel.aberto { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.ia-painel-header {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; padding: 14px 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-shrink: 0;
}
.ia-painel-titulo { font-weight: 700; font-size: 0.95rem; }
.ia-painel-subtitulo { font-size: 0.72rem; color: rgba(255,255,255,0.8); margin-top: 2px; }
.ia-painel-fechar { background: transparent; border: none; color: #fff; font-size: 1rem; cursor: pointer; line-height: 1; padding: 2px 4px; }
.ia-mensagens { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ia-msg { font-size: 0.86rem; line-height: 1.45; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; max-width: 92%; }
.ia-msg-assistente { background: var(--brand-soft); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 2px; }
.ia-msg-usuario { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.ia-msg-carregando { opacity: 0.65; font-style: italic; }
.ia-msg-assistente { white-space: normal; }
.ia-msg-assistente p { margin: 0 0 6px; }
.ia-msg-assistente h4 { margin: 8px 0 4px; font-size: 0.9rem; }
.ia-msg-assistente ul, .ia-msg-assistente ol { margin: 4px 0 6px; padding-left: 20px; }
.ia-msg-assistente li { margin-bottom: 3px; }
.ia-erro { font-size: 0.78rem; color: var(--danger); padding: 0 16px 8px; }
.ia-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); flex-shrink: 0; }
.ia-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-family: inherit; font-size: 0.85rem; }
.ia-form button { align-self: flex-end; background: var(--brand); color: #fff; border: none; border-radius: 10px; padding: 9px 16px; font-size: 0.85rem; cursor: pointer; }
.ia-form button:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 480px) {
  .ia-painel { right: 16px; left: 16px; width: auto; bottom: 88px; }
  .ia-fab { right: 16px; bottom: 16px; }
}

/* ---- Painel geral (dashboard) - secoes Operacao / Comercial / Financeiro ---- */
.dash-filtro-periodo { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.dash-filtro-periodo > div { min-width: 140px; }
.dash-filtro-periodo label { margin-bottom: 3px; }
.dash-filtro-periodo button { padding: 8px 18px; white-space: nowrap; }
.dash-limpar-periodo { font-size: 0.8rem; color: var(--ink-soft); text-decoration: underline; white-space: nowrap; align-self: center; }
.dash-limpar-periodo:hover { color: var(--brand-dark); }
.dash-periodo-indicador { font-size: 0.8rem; color: var(--ink-soft); margin: -4px 0 14px; }

.dash-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}
.dash-section-header:first-of-type { margin-top: 8px; }
.dash-section-icon {
  font-size: 1.6rem;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--brand-soft);
}
.dash-section-title { font-size: 1.1rem; font-weight: 700; color: var(--brand-dark); line-height: 1.3; }
.dash-section-sub { font-size: 0.78rem; color: var(--ink-soft); margin-top: 1px; }

/* Cotacoes (boi gordo / novilha) lado a lado, com o mesmo protagonismo visual. */
.dash-grid-cotacoes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 700px) {
  .dash-grid-cotacoes { grid-template-columns: 1fr; }
}
.dash-card-cotacao { display: flex; flex-direction: column; justify-content: space-between; }
.dash-card-cotacao .value { font-size: 1.9rem; }

/* Grid da Operacao: quadrante do rebanho ganha um pouco mais de largura, os demais indicadores
   ficam menores ao lado. */
.dash-grid-operacao {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.9fr 0.9fr;
  gap: 12px;
}
@media (max-width: 1100px) {
  .dash-grid-operacao { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

.dash-card-quadrante { display: flex; flex-direction: column; }
.dash-quadrante {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  align-items: center;
  margin-top: 6px;
}
.dash-quadrante-3 { grid-template-columns: 1fr 1fr 1fr; }
.dash-quadrante > div {
  text-align: center;
  padding: 12px 6px;
  border-radius: 10px;
  background: var(--brand-soft);
}
.kpi-mini-label { font-size: 0.68rem; text-transform: uppercase; color: var(--ink-soft); letter-spacing: 0.02em; }
.kpi-mini-value { font-size: 1.4rem; font-weight: 700; color: var(--brand-dark); margin-top: 4px; }

/* Grid do Comercial */
.dash-grid-comercial {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.dash-card-comercial { display: flex; flex-direction: column; }

/* Destaques financeiros */
.dash-destaque-custo { border-left: 4px solid var(--danger); background: #fdf3f2; }
.dash-destaque-receita { border-left: 4px solid var(--brand); background: var(--brand-soft); }

/* Alerta de atividades vencidas - fechado por padrao, so mostra a lista completa ao clicar,
   pra nao poluir o painel. */
.dash-alerta-atividades { border-left: 4px solid var(--danger); margin-bottom: 20px; }
.dash-alerta-resumo {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--danger);
  list-style: none;
}
.dash-alerta-resumo::-webkit-details-marker { display: none; }
.dash-alerta-resumo:hover { text-decoration: underline; }

/* Graficos */
.dash-grid-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.ia-acoes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ia-acoes button { font-size: 0.82rem; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.ia-acoes .ia-acao-secundaria { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.ia-fab { padding: 0; overflow: hidden; }
.ia-fab-img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.ia-titulo-img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* ---- Calendario de pagamentos (Financeiro > Contas) ---- */
.cal-topo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-titulo { font-weight: 700; font-size: 1.05rem; min-width: 150px; text-align: center; }
.cal-nav { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.cal-resumo { margin-left: auto; font-size: 0.85rem; color: var(--ink-soft); }
.cal-legenda { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-cab { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; padding: 4px 0; }
.cal-dia { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; cursor: pointer; background: var(--card); overflow: hidden; }
.cal-dia:hover { border-color: var(--brand); }
.cal-vazio { border: none; background: transparent; cursor: default; }
.cal-hoje { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-num { font-size: 0.75rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.cal-chip { font-size: 0.68rem; line-height: 1.25; padding: 2px 5px; border-radius: 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-legenda .cal-chip { display: inline-block; }
.cal-atrasado { background: #f6d5d1; color: #8c2a20; }
.cal-avencer { background: #f7e7c2; color: #7a5410; }
.cal-pago { background: #d4ead6; color: #1f5a2b; }
.cal-entrada { background: #d6e4f5; color: #1f4a7a; }
.cal-mais { font-size: 0.66rem; color: var(--ink-soft); }
.cal-detalhe { display: none; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.cal-detalhe.active { display: block; }
.pagar-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0; }
.pagar-form input, .pagar-form select { padding: 5px 7px; font-size: 0.8rem; width: auto; max-width: 140px; }
@media (max-width: 700px) {
  .cal-dia { min-height: 64px; }
  .cal-chip { font-size: 0.6rem; }
}

/* ---- Tiao agente: cartoes de confirmacao de acao ---- */
.ia-acao { align-self: flex-start; max-width: 92%; background: var(--card); border: 1px solid var(--brand); border-radius: 12px; padding: 10px 12px; font-size: 0.84rem; }
.ia-acao-erro { border-color: #c0392b; color: #8c2a20; }
.ia-acao-titulo { font-weight: 700; margin-bottom: 4px; }
.ia-acao ul { margin: 4px 0 6px; padding-left: 18px; }
.ia-acao-status { margin-top: 6px; font-size: 0.82rem; }
.ia-painel-caderno { text-decoration: none; margin-left: auto; margin-right: 8px; font-size: 1.1rem; }

/* ---- Financeiro: barra de ações, janela "Novo lançamento" e calendário sob demanda ---- */
.acoes-barra { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.acoes-barra button { padding: 9px 16px; font-size: 0.88rem; border-radius: 9px; }
button.ghost.ativo { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.modal-fundo { display: none; position: fixed; inset: 0; background: rgba(20,30,20,0.45); z-index: 900; align-items: flex-start; justify-content: center; padding: 4vh 14px; overflow-y: auto; }
.modal-fundo.aberto { display: flex; }
body.modal-aberto { overflow: hidden; }
.modal-caixa { background: var(--card); border-radius: 14px; width: 100%; max-width: 620px; box-shadow: 0 18px 50px rgba(0,0,0,0.25); padding: 20px 22px 18px; }
.modal-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.modal-topo h3 { margin: 0; font-size: 1.1rem; color: var(--brand-dark); }
.modal-x { background: transparent; border: none; color: var(--ink-soft); font-size: 1.1rem; padding: 4px 8px; cursor: pointer; }
.modal-x:hover { color: var(--ink); background: var(--brand-soft); }
.form-novo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-novo .full { grid-column: 1 / -1; }
.form-novo .fl label { margin-bottom: 4px; }
.form-novo input, .form-novo select { width: 100%; }
.form-novo .campo-socio { background: var(--brand-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.fl-mais { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.fl-mais summary { cursor: pointer; font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; }
.fl-mais-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 10px; }
.fl-dica { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.4; }
.modal-rodape { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 2px; }
.modal-rodape button { padding: 9px 18px; }
.pagar-form .pg-socio { max-width: 150px; }
@media (max-width: 560px) {
  .form-novo, .fl-mais-grid { grid-template-columns: 1fr; }
  .modal-caixa { padding: 16px 14px; }
}

/* =====================================================================
   RESPONSIVO - celular (Android / iPhone) e tablet
   ===================================================================== */
.topbar-mobile, .menu-fundo { display: none; }
.tabela-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
img { max-width: 100%; }

@media (max-width: 900px) {
  body { display: block; -webkit-text-size-adjust: 100%; }
  main { padding: calc(70px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 700px) {
  /* iOS dá zoom automático em campo com fonte menor que 16px */
  input, select, textarea { font-size: 16px; padding: 10px; }
  button, a.small, button.small { min-height: 40px; }
  button.small, a.small { padding: 8px 12px; }
  h2 { font-size: 1.25rem; }
  .card { padding: 14px; border-radius: 12px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .kpi .value { font-size: 1.2rem; word-break: break-word; }
  .kpi-hero .value { font-size: 1.5rem; }
  form.inline { grid-template-columns: 1fr 1fr; }
  form.inline > div { min-width: 0; }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions > * { flex: 1; text-align: center; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; padding: 12px 12px; }
  .toolbar { padding: 12px; }
  .toolbar .field, .toolbar .field-grow { min-width: calc(50% - 8px); flex: 1; }
  .toolbar button, .toolbar > div { flex: 1; }
  table { font-size: 0.82rem; }
  th, td { padding: 8px 7px; }
  .tabela-rolagem > table, .table-scroll > table, .table-wrap > table { min-width: 560px; }
  .table-scroll { max-height: none; }
  .cal-topo { gap: 6px; }
  .cal-titulo { min-width: 0; flex: 1; }
  .cal-resumo { margin-left: 0; width: 100%; }
  .cal-grid { gap: 3px; }
  .cal-dia { min-height: 52px; padding: 3px; }
  .cal-dia .cal-chip { display: inline-block; font-size: 0; width: 8px; height: 8px; padding: 0; margin: 1px 2px 0 0; border-radius: 50%; }
  .cal-mais { display: none; }
  .cal-detalhe { overflow-x: auto; }
  .pagar-form input, .pagar-form select { max-width: none; flex: 1 1 130px; }
  .pagar-form button { flex: 1 1 100%; }
  .acoes-barra button { flex: 1; }
  .modal-fundo { padding: 0; align-items: stretch; }
  .modal-caixa { border-radius: 0; max-width: none; min-height: 100%; padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); }
  .dash-section-header { margin: 22px 0 12px; }
  .dash-quadrante-3 { grid-template-columns: 1fr 1fr 1fr; }
  .login-box { width: auto; max-width: 92vw; margin: 6vh auto; }
}

@media (max-width: 480px) {
  form.inline { grid-template-columns: 1fr; }
  .toolbar .field, .toolbar .field-grow { min-width: 100%; }
  .grid { grid-template-columns: 1fr 1fr; }
  /* Tiao: painel em tela cheia no celular */
  .ia-painel { left: 0; right: 0; bottom: 0; top: 0; width: auto; max-width: none; height: auto; max-height: none; border-radius: 0; border: none; padding-top: env(safe-area-inset-top); }
  .ia-painel-header { padding-top: 14px; }
  .ia-form { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .ia-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 54px; height: 54px; }
  .ia-acao { max-width: 100%; }
}
.modal-fundo { z-index: 1100; }
@media (max-width: 700px) {
  #form-saldo-periodo input[type=date] { min-width: 130px; }
  #form-saldo-periodo button { flex: 1; }
}

/* ---- Tiao: anexos ---- */
.ia-anexos { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 0; flex-shrink: 0; }
.ia-anexos:empty { display: none; }
.ia-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 0.78rem; max-width: 100%; }
.ia-chip button { background: transparent; color: var(--ink-soft); border: none; padding: 0 4px; min-height: 0; font-size: 0.8rem; cursor: pointer; }
.ia-chip-erro { background: #f6d5d1; color: #8c2a20; }
.ia-form .ia-clip { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 1.05rem; }
.ia-msg-usuario { white-space: pre-wrap; }

/* Cartao de arquivos gerados pelo Tiao (relatorios) */
.ia-arquivos-lista { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ia-arquivo-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; background: var(--brand); color: #fff; text-decoration: none; font-weight: 600; font-size: 0.84rem; }
.ia-arquivo-link:hover { filter: brightness(1.1); }

.ia-atalhos { padding: 4px 10px 0; display: flex; gap: 6px; }
.ia-atalhos button { background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; cursor: pointer; }
.ia-atalhos button:hover { border-color: var(--brand); }
.ia-msg-assistente a { color: var(--brand); text-decoration: underline; }


/* =====================================================================
   Identidade visual (sistema de design): menu escuro de mata, conteudo em palha,
   couro como destaque. Titulos e numeros em Bricolage Grotesque, texto em Source Sans 3.
   ===================================================================== */
h1, h2, h3, h4 { font-family: var(--f-titulo); color: var(--brand-dark); letter-spacing: -0.012em; line-height: 1.2; }
h2 { font-size: 1.6rem; font-weight: 700; margin: 0 0 14px; }
h3 { font-size: 1.15rem; font-weight: 600; }
.secao-titulo { font-size: 1.15rem; margin: 26px 0 4px; }
.secao-sub { margin: 0 0 12px; font-size: 0.9rem; color: var(--ink-soft); max-width: 62ch; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.kpi .label, .stat-tile .stat-label, th, .card-section-title { text-transform: none; letter-spacing: 0; }
.kpi .label, .stat-tile .stat-label { font-size: 0.82rem; font-weight: 600; }
th { font-size: 0.82rem; font-weight: 600; }
.card-section-title { font-size: 0.92rem; }
.kpi .value, .stat-tile .stat-value, .kpi-hero .value { font-family: var(--f-titulo); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
td, .kpi .value, .stat-value, .valor { font-variant-numeric: tabular-nums; }

/* superficies */
.card, .toolbar, .table-wrap, .modal-caixa { box-shadow: var(--sombra); }
.card { border-radius: 14px; }
.table-wrap { border-radius: 14px; }
.table-wrap thead th { background: #faf8f3; }
.table-wrap tbody tr:nth-child(even) { background: transparent; }
.table-wrap tbody tr:hover, tbody tr:hover td { background-color: rgba(233, 240, 228, 0.55); }
.table-wrap tbody tr { transition: background-color .12s ease; }

/* botoes e campos */
button { font-family: inherit; font-weight: 600; border-radius: 10px; transition: background-color .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease; }
button:hover { background: var(--brand-dark); }
button:active { transform: translateY(1px); }
button.ghost:hover { background: var(--brand-soft); }
button.danger:hover { background: #8f2d2d; }
input, select, textarea { border-radius: 10px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
label { font-size: 0.8rem; font-weight: 600; }
.cor-input { width: 64px; height: 38px; padding: 3px; cursor: pointer; }
.check-linha { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; color: var(--ink); margin: 6px 0; cursor: pointer; }
.marca-form { display: grid; gap: 16px; }
.marca-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
.marca-campos .full { grid-column: 1 / -1; }
.modulos-grupo { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); column-gap: 18px; }
.modulos-grupo legend { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); padding: 0 6px; }
.pill, .badge { font-weight: 600; }
.tab-btn { font-family: var(--f-titulo); }

/* ---------- Menu lateral ---------- */
.sidebar {
  width: var(--side-w); flex-shrink: 0; background: var(--brand-menu); color: #dfe9dc;
  height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; z-index: 900;
  transition: width .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 16px 14px 18px; position: relative; }
.sidebar-logo { width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(255,255,255,0.14); }
.sidebar-brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-brand-txt strong { font-family: var(--f-titulo); font-size: 1.12rem; color: #fff; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-txt span { font-size: 0.78rem; color: rgba(223, 233, 220, 0.62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-recolher {
  position: absolute; right: -13px; top: 30px; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  background: var(--card); color: var(--brand-dark); border: 1px solid var(--line); box-shadow: var(--sombra);
  display: grid; place-items: center; z-index: 2;
}
.sidebar-recolher:hover { background: var(--brand-soft); }
.sidebar-recolher .ic { width: 15px; height: 15px; transition: transform .2s ease; }
.menu-recolhido .sidebar-recolher .ic { transform: rotate(180deg); }
.ic { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-busca {
  margin: 0 14px 10px 18px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.07);
  color: rgba(223,233,220,0.78); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 8px 10px; font-size: 0.88rem; font-weight: 500;
}
.sidebar-busca:hover { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar-busca span { flex: 1; text-align: left; }
kbd { font-family: inherit; font-size: 0.7rem; padding: 1px 6px; border-radius: 5px; border: 1px solid rgba(128,128,128,0.35); background: rgba(255,255,255,0.08); }
.sidebar-rolagem { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }
.menu-grupo { margin-bottom: 4px; }
.menu-grupo-titulo { font-size: 0.78rem; font-weight: 600; color: rgba(223,233,220,0.5); padding: 8px 14px 3px 12px; white-space: nowrap; }
.menu-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 12px; margin: 1px 0;
  color: rgba(223,233,220,0.86); text-decoration: none; font-size: 0.96rem; font-weight: 500; border-radius: 12px 0 0 12px;
  transition: background-color .15s ease, color .15s ease;
}
.menu-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.menu-item.ativo { background: var(--bg); color: var(--brand-dark); font-weight: 700; }
.menu-item.ativo .ic { color: var(--accent); }
.menu-rotulo { flex: 1; white-space: nowrap; }
.menu-contador { background: var(--danger); color: #fff; font-size: 0.72rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; margin-right: 6px; }
.menu-filhos { margin: 0 0 6px 31px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.16); display: flex; flex-direction: column; }
.menu-filho { padding: 6px 10px; font-size: 0.88rem; color: rgba(223,233,220,0.7); text-decoration: none; border-radius: 8px; margin-right: 12px; transition: background-color .15s ease, color .15s ease; }
.menu-filho:hover { color: #fff; background: rgba(255,255,255,0.07); }
.menu-filho.ativo { color: #fff; font-weight: 700; background: rgba(255,255,255,0.1); }
.sidebar-rodape { padding: 8px 0 14px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px 0 12px; }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--f-titulo); font-weight: 700; flex-shrink: 0; }
.sidebar-user-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user-txt strong { font-size: 0.88rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-txt a { font-size: 0.78rem; color: rgba(223,233,220,0.62); text-decoration: none; }
.sidebar-user-txt a:hover { color: #fff; text-decoration: underline; }
.sidebar-user form { margin: 0; }
.sidebar-logout { margin: 0; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; background: transparent; border: 1px solid rgba(255,255,255,0.14); color: rgba(223,233,220,0.8); border-radius: 10px; }
.sidebar-logout:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* menu recolhido (so icones) */
.menu-recolhido .sidebar-brand { padding-left: 18px; }
.menu-recolhido .sidebar-brand-txt, .menu-recolhido .menu-rotulo, .menu-recolhido .menu-grupo-titulo, .menu-recolhido .menu-filhos,
.menu-recolhido .sidebar-busca span, .menu-recolhido .sidebar-busca kbd, .menu-recolhido .sidebar-user-txt, .menu-recolhido .sidebar-user form { display: none; }
.menu-recolhido .sidebar-busca { justify-content: center; margin-left: 12px; }
.menu-recolhido .menu-item { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
.menu-recolhido .menu-contador { position: absolute; top: 2px; right: 10px; margin: 0; min-width: 16px; height: 16px; font-size: 0.62rem; padding: 0 4px; }
.menu-recolhido .menu-grupo + .menu-grupo { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 6px; padding-top: 6px; margin-right: 14px; }
.menu-recolhido .sidebar-user { justify-content: center; padding-right: 12px; }

/* ---------- Barra superior (desktop) ---------- */
.topbar {
  position: fixed; top: 0; left: var(--side-w); right: 0; height: var(--topbar-h); z-index: 800; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 28px; background: rgba(245, 243, 238, 0.88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  transition: left .2s ease;
}
.topbar-titulo { font-family: var(--f-titulo); font-weight: 600; font-size: 1.02rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-acoes { display: flex; align-items: center; gap: 10px; }
.topbar-busca, .topbar-tiao { display: inline-flex; align-items: center; gap: 8px; background: var(--card); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 0.88rem; font-weight: 500; box-shadow: var(--sombra); }
.topbar-busca { min-width: 250px; }
.topbar-busca span { flex: 1; text-align: left; }
.topbar-busca kbd { color: var(--ink-soft); background: var(--bg); }
.topbar-busca:hover, .topbar-tiao:hover { background: var(--card); border-color: var(--brand); color: var(--brand-dark); }
.topbar-tiao { color: var(--brand-dark); font-weight: 700; }
.topbar-tiao img { border-radius: 50%; }
main { padding-top: calc(var(--topbar-h) + 24px); transition: none; animation: pagina-entra .22s ease-out backwards; }
@keyframes pagina-entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bottom-bar { display: none; }

/* ---------- Busca rapida (Ctrl+K) ---------- */
.paleta[hidden] { display: none; }
.paleta { position: fixed; inset: 0; z-index: 1300; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; }
.paleta-fundo { position: absolute; inset: 0; background: rgba(20, 32, 20, 0.5); backdrop-filter: blur(2px); }
.paleta-caixa { position: relative; width: min(560px, 100%); background: var(--card); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); overflow: hidden; animation: pagina-entra .15s ease-out both; }
.paleta-campo { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.paleta-campo input { border: none; box-shadow: none !important; padding: 16px 0; font-size: 1.05rem; background: transparent; border-radius: 0; }
.paleta-lista { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.paleta-lista a { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.paleta-lista a span { font-size: 0.82rem; color: var(--ink-soft); }
.paleta-lista a.sel, .paleta-lista a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.paleta-vazio { padding: 18px; text-align: center; color: var(--ink-soft); font-size: 0.9rem; }
.paleta-dica { display: flex; gap: 6px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 0.76rem; color: var(--ink-soft); }
.paleta-dica kbd { color: var(--ink-soft); background: var(--bg); }

/* ---------- Celular e tablet ---------- */
@media (max-width: 900px) {
  :root, html.menu-recolhido { --side-w: 0px; }
  .topbar, .sidebar-recolher { display: none; }
  .topbar-mobile {
    display: flex; align-items: center; gap: 10px; position: fixed; top: 0; left: 0; right: 0; z-index: 950;
    height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; background: var(--brand-menu); color: #fff;
  }
  .topbar-logo { width: 30px; height: 30px; border-radius: 8px; }
  .topbar-nome { font-family: var(--f-titulo); font-weight: 600; font-size: 1.08rem; flex: 1; }
  .topbar-icone { background: transparent; color: #fff; border: none; padding: 8px; width: 40px; height: 40px; display: grid; place-items: center; }
  .topbar-icone:hover { background: rgba(255,255,255,0.1); }
  .menu-fundo { display: block; position: fixed; inset: 0; background: rgba(20,30,20,0.5); z-index: 960; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.menu-aberto { overflow: hidden; }
  body.menu-aberto .ia-fab { display: none; }
  body.menu-aberto .menu-fundo { opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: 290px; max-width: 86vw; z-index: 970; transform: translateX(-102%);
    transition: transform .22s ease; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); box-shadow: 8px 0 30px rgba(0,0,0,0.3);
  }
  body.menu-aberto .sidebar { transform: translateX(0); }
  html.menu-recolhido .sidebar-brand-txt, html.menu-recolhido .menu-rotulo, html.menu-recolhido .menu-grupo-titulo, html.menu-recolhido .sidebar-busca span, html.menu-recolhido .sidebar-user-txt { display: revert; }
  html.menu-recolhido .menu-filhos { display: flex; }
  html.menu-recolhido .sidebar-user form { display: block; }
  html.menu-recolhido .menu-item { justify-content: flex-start; padding-left: 12px; gap: 12px; }
  .sidebar-busca kbd { display: none; }
  .menu-item { padding: 13px 14px 13px 12px; font-size: 1rem; border-radius: 12px; margin-right: 12px; }
  .menu-item.ativo { background: rgba(255,255,255,0.14); color: #fff; }
  .menu-item.ativo .ic { color: #f0c98a; }
  .sidebar-rolagem { padding-right: 0; }
  main { padding: calc(70px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 940; background: var(--card); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(32,56,31,0.08);
  }
  .bb-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: var(--ink-soft); text-decoration: none; font-size: 0.7rem; font-weight: 600; background: transparent; border: none; position: relative; min-height: 52px; }
  .bb-item:hover { background: transparent; color: var(--brand-dark); }
  .bb-item.ativo { color: var(--brand-dark); }
  .bb-item.ativo .ic { color: var(--accent); }
  .bb-item.ativo::before { content: ""; position: absolute; top: -5px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .bb-ponto { position: absolute; top: 6px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--card); box-sizing: content-box; }
  .ia-fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .ia-painel { bottom: calc(144px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .ia-fab { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .ia-painel { bottom: 0; }
}

/* ---------- Login ---------- */
.login-pagina { min-height: 100vh; width: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.login-lado { background: var(--brand-menu); color: #e3ecdf; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-lado::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 460px; height: 460px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 0 0 46px rgba(255,255,255,0.025), 0 0 0 92px rgba(255,255,255,0.02); }
.login-marca { display: flex; align-items: center; gap: 14px; }
.login-marca img { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 0 0 1px rgba(255,255,255,0.16); }
.login-marca strong { font-family: var(--f-titulo); font-size: 1.4rem; color: #fff; }
.login-frase { font-family: var(--f-titulo); font-size: clamp(1.7rem, 3.2vw, 2.6rem); line-height: 1.12; font-weight: 600; color: #fff; max-width: 20ch; letter-spacing: -0.02em; }
.login-frase-sub { margin-top: 14px; color: rgba(227,236,223,0.72); max-width: 38ch; font-size: 1.02rem; }
.login-form-lado { display: grid; place-items: center; padding: 32px 20px; }
.login-box { max-width: 380px; width: 100%; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px 28px; box-shadow: var(--sombra); }
.login-box h2 { margin-bottom: 4px; }
.login-box .login-sub { margin: 0 0 18px; color: var(--ink-soft); font-size: 0.92rem; }
.login-box button[type=submit] { padding: 12px; font-size: 1rem; }
@media (max-width: 800px) {
  body.login-corpo { display: block; }
  .login-pagina { grid-template-columns: 1fr; }
  .login-lado { padding: 26px 22px 30px; gap: 22px; }
  .login-frase { font-size: 1.6rem; max-width: none; }
  .login-lado::after { display: none; }
  .login-form-lado { padding: 20px 16px 36px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
.marca-form > button { justify-self: start; }

/* icones em linha (substituem emojis) */
.ic-txt { width: 1.12em; height: 1.12em; vertical-align: -0.2em; margin-right: 0.15em; }
button .ic-txt, a .ic-txt { margin-right: 0.2em; }
.ponto { display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--brand); margin-right: 0.4em; vertical-align: 0.04em; }
.ponto.alert { background: var(--danger); }
.ponto.info { background: #4f86b5; }

/* =====================================================================
   Acabamento: ritmo, hierarquia e estados (vale para todas as telas)
   ===================================================================== */
main { max-width: 1440px; margin-inline: auto; }
main > h2:first-child, .page-head { margin-top: 4px; }
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 1.75rem; }
.grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: stretch; gap: 14px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.card { padding: 18px 20px; }
.card > h3:first-child, .card > h4:first-child { margin-top: 0; }
.kpi { display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; }
.kpi .label { color: var(--ink-soft); }
.kpi .value { font-size: clamp(1.3rem, 1.6vw, 1.7rem); line-height: 1.15; margin-top: 8px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.kpi .value.pos { color: #2e7d4f; } .kpi .value.neg { color: var(--danger); }
.kpi .value a { text-decoration: none; color: var(--brand-dark); }
.kpi .value a:hover { text-decoration: underline; }
.stat-meta, .kpi .stat-meta { font-size: 0.82rem; line-height: 1.4; margin-top: 6px; color: var(--ink-soft); }
.kpi-hero {
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,0.12) 0, transparent 55%), linear-gradient(145deg, var(--brand-menu), var(--brand-dark) 60%, var(--brand));
  border: none; box-shadow: 0 10px 28px rgba(32, 56, 31, 0.22);
}
.kpi-hero .value { color: #fff; }
.kpi-hero .label, .kpi-hero .stat-meta, .kpi-hero .stat-label { color: rgba(255,255,255,0.78); }

/* tabelas */
table { font-size: 0.92rem; }
th, td { padding: 11px 12px; }
th { color: var(--ink-soft); background: transparent; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid #efeade; }
tbody tr:last-child td { border-bottom: none; }
td a, .table-wrap a { font-weight: 600; text-decoration: none; }
td a:hover, .table-wrap a:hover { text-decoration: underline; }
.table-wrap { padding: 6px 10px; }
.empty { border: 1px dashed var(--line); border-radius: 12px; background: rgba(255,255,255,0.5); padding: 26px 16px; color: var(--ink-soft); }

/* botoes */
button.danger { background: #fbe8e6; color: var(--danger); border: 1px solid #f1cfcb; padding: 5px 10px; }
button.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
button.ghost { border-radius: 10px; font-weight: 600; background: var(--card); }
button.small, a.small { font-weight: 600; }
a.small, a.ghost { text-decoration: none; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* detalhes e abas */
details > summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); list-style: none; display: flex; align-items: center; gap: 8px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; flex-shrink: 0; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
.tabs { gap: 2px; margin: 8px 0 18px; }
.tab-btn { padding: 11px 16px; font-size: 0.92rem; }
.tab-btn.active { color: var(--brand-dark); border-bottom-width: 3px; }
.toolbar { border-radius: 14px; padding: 14px 16px; }

/* secoes do painel */
.dash-section-header { margin: 34px 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dash-section-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-size: 1rem; flex-shrink: 0; }
.dash-section-icon .ic-txt { width: 24px; height: 24px; margin: 0; }
.dash-section-title { font-family: var(--f-titulo); font-size: 1.3rem; font-weight: 700; color: var(--brand-dark); }
.dash-section-sub { font-size: 0.88rem; color: var(--ink-soft); }

/* funil */
.kanban { gap: 14px; padding-bottom: 14px; }
.kanban-column { background: #efece3; border: none; border-radius: 14px; padding: 12px; min-width: 272px; max-width: 272px; }
.kanban-column h4 { font-size: 0.95rem; align-items: center; gap: 8px; margin: 0 0 12px; }
.kanban-column h4 input { border: none !important; border-radius: 8px !important; background: transparent; font-family: var(--f-titulo); font-size: 0.98rem !important; padding: 4px 6px !important; }
.kanban-column h4 input:hover { background: rgba(255,255,255,0.7) !important; }
.kanban-column h4 input:focus { background: #fff !important; box-shadow: 0 0 0 3px var(--brand-soft); }
.kanban-column h4 > span, .kanban-column h4 .contagem { background: var(--card); border-radius: 999px; padding: 1px 9px; font-size: 0.78rem; color: var(--ink-soft); }
.kanban-card { border: none; border-radius: 12px; padding: 12px; box-shadow: 0 1px 2px rgba(32,56,31,.08), 0 3px 10px rgba(32,56,31,.05); transition: box-shadow .15s ease, transform .15s ease; }
.kanban-card:hover { box-shadow: 0 2px 4px rgba(32,56,31,.1), 0 8px 18px rgba(32,56,31,.1); transform: translateY(-1px); }
.kanban-card .acoes button.danger { background: transparent; border: 1px solid #ecd0cd; }
.kanban-card .acoes button.danger:hover { background: var(--danger); color: #fff; }
.kanban-add-column { border-radius: 14px; border-color: #d9d3c3; min-width: 220px; }

/* barra de rolagem discreta */
* { scrollbar-width: thin; scrollbar-color: #cfc9b8 transparent; }
.sidebar-rolagem { scrollbar-color: rgba(255,255,255,0.18) transparent; }

/* Tiao */
.ia-painel { border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(20, 36, 20, 0.28); overflow: hidden; }
.ia-painel-header { background: linear-gradient(145deg, var(--brand-menu), var(--brand-dark)); color: #fff; }
.ia-painel-header .ia-painel-titulo, .ia-painel-header .ia-painel-subtitulo { color: #fff; }
.ia-painel-header .ia-painel-subtitulo { opacity: 0.75; }
.ia-painel-fechar, .ia-painel-caderno { color: #fff; }
.ia-fab { background: var(--brand-menu); box-shadow: 0 8px 24px rgba(20, 36, 20, 0.35); }

/* formularios dentro de janelas (modal) */
.modal-caixa { border-radius: 18px; box-shadow: 0 28px 70px rgba(20, 36, 20, 0.35); animation: pagina-entra .18s ease-out both; }
.modal-caixa form.inline { grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-caixa form.inline .full { grid-column: 1 / -1; }
.modal-caixa form.inline .full button[type=submit], .modal-caixa form.inline > div:last-child > button[type=submit] { padding: 11px 20px; }
.modal-topo h3 { font-family: var(--f-titulo); font-size: 1.2rem; }
@media (max-width: 700px) { .modal-caixa form.inline { grid-template-columns: 1fr; } }

/* detalhes: voltar, subtitulos de secao */
main > p:first-child > a:only-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 600; text-decoration: none; font-size: 0.88rem; padding: 4px 10px 4px 6px; margin-left: -6px; border-radius: 8px; }
main > p:first-child > a:only-child:hover { background: var(--brand-soft); color: var(--brand-dark); }
main > :is(.card, .grid, .table-wrap, form, details, .toolbar) ~ h2 { font-size: 1.3rem; margin: 30px 0 12px; }
main > p { max-width: 70ch; }
@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid > .kpi-hero, .grid > .card.full { grid-column: 1 / -1; }
  .kpi .value { font-size: 1.25rem; }
  .page-head h2 { font-size: 1.45rem; }
}

/* =====================================================================
   Chat do Tiao no novo layout (com voz)
   ===================================================================== */
.ia-fab { width: 62px; height: 62px; border-radius: 19px; background: #0d150d; border: 2px solid rgba(255,255,255,0.14); }
.ia-fab-img { border-radius: 17px; }
.ia-painel { width: 420px; height: min(690px, calc(100vh - 120px)); max-height: none; background: var(--bg); display: flex; flex-direction: column; }
.ia-painel-header { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; flex-shrink: 0; }
.ia-titulo-img { width: 46px; height: 46px; border-radius: 13px; margin: 0; box-shadow: 0 0 0 1px rgba(255,255,255,0.18); flex-shrink: 0; }
.ia-head-txt { flex: 1; min-width: 0; }
.ia-painel-titulo { font-family: var(--f-titulo); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.ia-painel-subtitulo { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; margin: 2px 0 0; }
.ia-online { width: 8px; height: 8px; border-radius: 50%; background: #6fd08c; box-shadow: 0 0 0 3px rgba(111, 208, 140, 0.25); flex-shrink: 0; }
.ia-painel-caderno, .ia-painel-fechar { margin: 0; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: transparent; border: none; color: #fff; text-decoration: none; }
.ia-painel-caderno:hover, .ia-painel-fechar:hover { background: rgba(255,255,255,0.14); color: #fff; }
.ia-painel-caderno .ic, .ia-painel-fechar .ic { width: 20px; height: 20px; }
.ia-mensagens { padding: 18px 16px 10px; gap: 14px; background: var(--bg); }
.ia-msg { font-size: 0.94rem; line-height: 1.5; padding: 11px 14px; max-width: 88%; }
.ia-msg-assistente { background: var(--card); border: 1px solid var(--line); border-radius: 5px 16px 16px 16px; box-shadow: var(--sombra); margin-left: 40px; position: relative; max-width: calc(100% - 40px); }
.ia-msg-assistente::before { content: ""; position: absolute; left: -40px; top: 0; width: 30px; height: 30px; border-radius: 9px; background: #0d150d url(/img/tiao.svg) center / cover; }
.ia-msg-usuario { background: linear-gradient(145deg, var(--brand-dark), var(--brand)); border-radius: 16px 5px 16px 16px; box-shadow: 0 2px 8px rgba(32, 56, 31, 0.18); }
.ia-msg-carregando { font-style: normal; opacity: 1; color: var(--ink-soft); animation: ia-respira 1.4s ease-in-out infinite; }
@keyframes ia-respira { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.ia-msg-assistente h4 { font-family: var(--f-titulo); font-size: 1rem; color: var(--brand-dark); }
.ia-msg-assistente table { font-size: 0.84rem; }
.ia-msg-assistente th, .ia-msg-assistente td { padding: 6px 8px; }
.ia-acoes { gap: 8px; }
.ia-acoes button { border-radius: 999px; font-size: 0.86rem; font-weight: 600; padding: 8px 14px; }
.ia-acao { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 14px; padding: 12px 14px; margin-left: 40px; max-width: calc(100% - 40px); box-shadow: var(--sombra); }
.ia-acao-erro { border-left-color: var(--danger); }
.ia-erro { padding: 6px 18px 10px; font-size: 0.86rem; }
.ia-atalhos { display: flex; flex-wrap: nowrap; gap: 8px; padding: 8px 14px 10px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.ia-atalhos::-webkit-scrollbar { display: none; }
.ia-atalhos button { flex-shrink: 0; white-space: nowrap; background: var(--card); border: 1px solid var(--line); color: var(--brand-dark); border-radius: 999px; padding: 7px 13px; font-size: 0.84rem; font-weight: 600; }
.ia-atalhos button:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.ia-ouvindo { display: flex; align-items: center; gap: 12px; margin: 0 12px 8px; padding: 10px 12px 10px 14px; border-radius: 14px; background: #fdeeec; color: #8c2a20; font-size: 0.9rem; font-weight: 600; flex-shrink: 0; }
.ia-ouvindo[hidden] { display: none; }
.ia-ouvindo > span:nth-child(2) { flex: 1; }
.ia-ouvindo-parar { background: var(--danger); color: #fff; border-radius: 999px; padding: 6px 14px; font-size: 0.84rem; }
.ia-ouvindo-parar:hover { background: #8f2d2d; }
.ia-onda { display: inline-flex; align-items: center; gap: 3px; height: 22px; }
.ia-onda i { width: 3px; height: 100%; border-radius: 3px; background: var(--danger); transform: scaleY(0.3); animation: ia-onda 0.9s ease-in-out infinite; }
.ia-onda i:nth-child(2) { animation-delay: .12s; } .ia-onda i:nth-child(3) { animation-delay: .24s; } .ia-onda i:nth-child(4) { animation-delay: .36s; } .ia-onda i:nth-child(5) { animation-delay: .48s; }
@keyframes ia-onda { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
.ia-form { align-items: flex-end; gap: 10px; padding: 10px 12px 14px; background: var(--card); border-top: 1px solid var(--line); }
.ia-campo { flex: 1; display: flex; align-items: flex-end; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 24px; padding: 4px 6px; transition: border-color .15s ease, box-shadow .15s ease; min-width: 0; }
.ia-campo:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.ia-form .ia-campo textarea { flex: 1; border: none; background: transparent; box-shadow: none; padding: 9px 4px; min-height: 38px; max-height: 130px; resize: none; font-size: 0.96rem; line-height: 1.4; border-radius: 0; }
.ia-form .ia-campo textarea:focus { box-shadow: none; }
.ia-form .ia-clip, .ia-form .ia-mic { flex-shrink: 0; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: transparent; border: none; color: var(--ink-soft); }
.ia-form .ia-clip:hover, .ia-form .ia-mic:hover { background: var(--brand-soft); color: var(--brand-dark); }
.ia-form .ia-mic { color: var(--brand-dark); }
.ia-form .ic { width: 21px; height: 21px; margin: 0; }
.ia-form.gravando .ia-mic { background: var(--danger); color: #fff; animation: ia-pulso 1.3s ease-out infinite; }
@keyframes ia-pulso { 0% { box-shadow: 0 0 0 0 rgba(178, 59, 59, 0.45); } 100% { box-shadow: 0 0 0 12px rgba(178, 59, 59, 0); } }
.ia-form .ia-enviar { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; flex-shrink: 0; box-shadow: 0 4px 12px rgba(32, 56, 31, 0.25); }
.ia-form .ia-enviar:hover { background: var(--brand-dark); }
.ia-form .ia-enviar .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.ia-anexos { padding: 6px 14px 4px; background: var(--card); }
@media (max-width: 900px) {
  .ia-fab { width: 58px; height: 58px; }
  .ia-painel { width: auto; height: auto; left: 12px; right: 12px; top: calc(66px + env(safe-area-inset-top)); bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .ia-painel { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; border: none; }
  .ia-painel-header { padding-top: calc(14px + env(safe-area-inset-top)); }
  .ia-form { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .ia-form .ia-campo textarea { font-size: 16px; }
}

/* =====================================================================
   WhatsApp
   ===================================================================== */
.wa-link, .wa-botao { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-dark); text-decoration: none; font-weight: 600; }
.wa-botao { background: var(--brand-soft); border: 1px solid transparent; padding: 9px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 0.95rem; }
.wa-botao:hover { background: var(--brand); color: #fff; }
.wa-abrir { display: flex; flex-direction: column; justify-content: flex-end; }
.wa-tel { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.wa-tel-btn { width: 30px; height: 30px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); border: 0; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.wa-tel-btn .ic { width: 16px; height: 16px; }
.wa-tel-btn:hover { background: #2e9e57; color: #fff; transform: scale(1.08); }
.wa-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.wa-topo h2 { margin: 0; }
.wa-estado { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.92rem; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 14px; }
.wa-ponto { width: 9px; height: 9px; border-radius: 50%; background: #b8b3a3; display: inline-block; }
.wa-ponto.ok { background: #2e9e57; box-shadow: 0 0 0 3px rgba(46, 158, 87, 0.2); }
.wa-conectar { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; padding: 24px 28px; margin-bottom: 16px; }
.wa-conectar[hidden], .wa-app[hidden] { display: none; }
.wa-conectar h3 { margin: 0 0 10px; font-size: 1.3rem; }
.wa-passos { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; color: var(--ink); }
.wa-aviso { font-size: 0.84rem; color: var(--ink-soft); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; max-width: 56ch; }
.wa-erro { font-size: 0.88rem; color: var(--danger); background: #fbe8e6; border-radius: 10px; padding: 9px 12px; margin: 0 0 12px; }
.wa-erro[hidden] { display: none; }
.wa-qr-caixa { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wa-qr { width: 244px; height: 244px; background: #fff; border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; padding: 12px; box-shadow: var(--sombra); }
.wa-qr img, .wa-qr canvas { max-width: 100%; height: auto; }
.wa-qr-legenda { font-size: 0.82rem; color: var(--ink-soft); text-align: center; max-width: 244px; }

/* painel de conversas */
.wa-app { display: grid; grid-template-columns: 372px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 140px); min-height: 480px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--sombra); }
.wa-lista { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--card); }
.wa-lista-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 6px; }
.wa-lista-topo h3 { margin: 0; font-size: 1.25rem; }
.wa-nova { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px 7px 10px; border-radius: 999px; font-size: 0.86rem; }
.wa-nova .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.wa-busca { display: flex; align-items: center; gap: 8px; margin: 8px 14px 6px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); }
.wa-busca:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.wa-busca input { border: none; box-shadow: none !important; padding: 9px 2px; background: transparent; }
.wa-filtros { display: flex; gap: 6px; padding: 6px 14px 10px; overflow-x: auto; }
.wa-filtros button { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.wa-filtros button:hover { background: var(--bg); color: var(--ink); }
.wa-filtros button.ativo { background: var(--brand-menu); border-color: var(--brand-menu); color: #fff; }
.wa-lista-itens { overflow-y: auto; flex: 1; padding: 0 8px 8px; }
.wa-item { display: flex; gap: 12px; width: 100%; text-align: left; background: transparent; color: var(--ink); border-radius: 14px; padding: 10px 10px; border: 0; align-items: center; font-weight: 400; transition: background .12s; }
.wa-item:hover { background: var(--bg); }
.wa-item.ativo { background: var(--brand-soft); }
.wa-item.nova .wa-item-linha strong { color: var(--ink); }
.wa-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-menu); color: #fff; display: grid; place-items: center; font-family: var(--f-titulo); font-weight: 700; font-size: 1.05rem; flex-shrink: 0; }
.wa-item-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wa-item-linha { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.wa-item-linha strong { font-size: 0.96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item-linha time { font-size: 0.74rem; color: var(--ink-soft); flex-shrink: 0; }
.wa-item.nova time { color: #1f8a4a; font-weight: 700; }
.wa-prev { font-size: 0.86rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-novas { background: #2e9e57; color: #fff; font-size: 0.72rem; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; flex-shrink: 0; }
.wa-item-etq { display: flex; }
.wa-item-etq:empty { display: none; }
.wa-etq { font-style: normal; font-size: 0.7rem; font-weight: 700; color: var(--brand-dark); background: var(--brand-soft); border-radius: 6px; padding: 1px 7px; margin-top: 2px; }
.wa-etq.sem { color: #8a5a14; background: var(--accent-soft); }
.wa-lista-vazia { padding: 28px 20px; text-align: center; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }

/* conversa */
.wa-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.wa-vazio { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ink-soft); text-align: center; padding: 24px; }
.wa-vazio[hidden], #wa-chat[hidden] { display: none; }
.wa-vazio-ico { width: 72px; height: 72px; border-radius: 24px; background: var(--brand-soft); display: grid; place-items: center; margin-bottom: 6px; }
.wa-vazio .ic { width: 34px; height: 34px; color: var(--brand-dark); }
.wa-vazio strong { font-family: var(--f-titulo); font-size: 1.25rem; color: var(--ink); }
.wa-vazio button { margin-top: 8px; }
#wa-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wa-conversa { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.wa-cab { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.wa-cab-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.wa-cab-txt strong { font-family: var(--f-titulo); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-cab-txt span { font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-cab-acoes { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.wa-icone { width: 36px; height: 36px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; background: transparent; color: var(--ink-soft); border: 0; cursor: pointer; text-decoration: none; }
.wa-icone:hover { background: var(--bg); color: var(--ink); }
.wa-icone[hidden] { display: none; }
.wa-voltar { display: none; }
.wa-tipo-chip { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; font-size: 0.8rem; font-weight: 700; cursor: pointer; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.wa-tipo-chip:hover { border-color: var(--brand); }
.wa-tipo-chip.novo { background: var(--accent-soft); color: #7a4f10; }
.wa-tipo-chip:empty { display: none; }
.wa-tiao { display: inline-flex; align-items: center; gap: 8px; background: #0d150d; color: #fff; border-radius: 999px; padding: 6px 14px 6px 6px; font-size: 0.86rem; border: 0; cursor: pointer; }
.wa-tiao img { border-radius: 50%; }
.wa-tiao:hover { background: #20381f; }
.wa-aviso-cad { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--accent-soft); color: #6b4510; font-size: 0.88rem; flex-shrink: 0; }
.wa-aviso-cad[hidden], .wa-offline[hidden] { display: none; }
.wa-offline { padding: 8px 16px; background: #fbe8e6; color: var(--danger); font-size: 0.86rem; flex-shrink: 0; }
.wa-offline a { color: inherit; font-weight: 700; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 3px; min-height: 0; background-image: radial-gradient(var(--line) 1px, transparent 1.2px); background-size: 22px 22px; }
.wa-dia { align-self: center; margin: 12px 0 8px; }
.wa-dia span { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; font-size: 0.76rem; color: var(--ink-soft); font-weight: 600; }
.wa-msg { display: flex; }
.wa-msg.saida { justify-content: flex-end; }
.wa-balao { max-width: min(70%, 540px); padding: 8px 13px 6px; border-radius: 18px; font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(32, 56, 31, 0.1); }
.wa-msg.entrada .wa-balao { background: var(--card); border-bottom-left-radius: 5px; }
.wa-msg.saida .wa-balao { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.wa-hora { display: block; text-align: right; font-size: 0.68rem; opacity: 0.65; margin-top: 2px; }
.wa-form { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px 14px; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; }
.wa-form textarea { flex: 1; resize: none; border-radius: 22px; padding: 11px 18px; min-height: 44px; max-height: 130px; background: var(--bg); line-height: 1.4; }
.wa-enviar { width: 44px; height: 44px; border-radius: 50%; padding: 0; display: grid; place-items: center; flex-shrink: 0; }
.wa-enviar .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.wa-erro-envio { margin: 0 16px 12px; }

/* janela de salvar contato */
.wa-modal { max-width: 520px; }
.wa-modal-form { display: grid; gap: 14px; }
.wa-campo { display: grid; gap: 5px; }
.wa-campo label { font-size: 0.84rem; font-weight: 700; color: var(--ink-soft); }
.wa-campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wa-tipos { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-tipo { cursor: pointer; }
.wa-tipo input { position: absolute; opacity: 0; pointer-events: none; }
.wa-tipo span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.88rem; font-weight: 600; color: var(--ink); background: var(--card); transition: all .12s; }
.wa-tipo:hover span { border-color: var(--brand); }
.wa-tipo input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.wa-tipo input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.wa-salvar-op { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.wa-salvar-op input { width: auto; }
.wa-modal-acoes { display: flex; justify-content: flex-end; gap: 10px; }

/* painel lateral (dentro de Contatos) */
.wa-gaveta-fundo { position: fixed; inset: 0; z-index: 1050; background: rgba(13, 21, 13, 0); display: flex; justify-content: flex-end; transition: background .22s; }
.wa-gaveta-fundo[hidden] { display: none; }
.wa-gaveta-fundo.aberta { background: rgba(13, 21, 13, 0.45); }
.wa-gaveta { width: min(460px, 100%); height: 100%; background: var(--bg); box-shadow: -18px 0 40px rgba(13, 21, 13, 0.25); transform: translateX(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.wa-gaveta-fundo.aberta .wa-gaveta { transform: none; }
#wa-gaveta-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wa-gaveta .wa-tiao span, .wa-gaveta .wa-tipo-chip { max-width: 110px; }
.wa-gaveta .wa-cab-acoes { gap: 4px; }
body.wa-gaveta-aberta { overflow: hidden; }


@media (max-width: 900px) {
  .wa-conectar { grid-template-columns: 1fr; padding: 18px; }
  .wa-qr-caixa { order: -1; }
  .wa-app { grid-template-columns: 1fr; height: calc(100vh - 54px - 96px - 150px); min-height: 420px; border-radius: 16px; }
  .wa-app .wa-thread { display: none; }
  .wa-app.com-conversa .wa-lista { display: none; }
  .wa-app.com-conversa .wa-thread { display: flex; }
  .wa-voltar { display: inline-grid; }
  .wa-balao { max-width: 86%; }
  .wa-tiao span { display: none; }
  .wa-tiao { padding: 4px; }
  .wa-cab-acoes a { display: none; }
  .wa-form textarea { font-size: 16px; }
  .wa-campo-duplo { grid-template-columns: 1fr; }
  .wa-nova span { display: none; }
  .wa-nova { padding: 8px; }
  .wa-gaveta { width: 100%; }
}
.pagina-whatsapp .ia-fab { display: none; }
.wa-gaveta { width: min(500px, 100%); }
.wa-gaveta .wa-tiao span { display: none; }
.wa-gaveta .wa-tiao { padding: 4px; }
.wa-tiao { flex-shrink: 0; min-width: 36px; height: 36px; justify-content: center; }
.wa-tiao img { flex-shrink: 0; }
@media (max-width: 900px) {
  .wa-tipo-chip { max-width: 104px; padding: 5px 10px; }
  .wa-cab { gap: 8px; padding: 10px 12px; }
}
@media (max-width: 900px) { .wa-tipo-chip.novo { display: none; } }

/* sugestao de resposta do Tiao */
.wa-sug-barra { display: flex; padding: 8px 16px 0; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; }
.wa-sug-barra[hidden], .wa-sug[hidden] { display: none; }
.wa-sugerir { display: inline-flex; align-items: center; gap: 8px; background: #0d150d; color: #fff; border: 0; border-radius: 999px; padding: 6px 14px 6px 6px; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.wa-sugerir img { border-radius: 50%; }
.wa-sugerir:hover { background: #20381f; }
.wa-sugerir:disabled { opacity: .7; cursor: progress; }
.wa-sug { background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px 0; flex-shrink: 0; display: grid; gap: 8px; }
.wa-sug-topo { display: flex; align-items: center; gap: 8px; }
.wa-sug-topo img { border-radius: 50%; }
.wa-sug-topo strong { flex: 1; font-family: var(--f-titulo); font-size: 0.95rem; }
.wa-sug-porque { margin: 0; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.4; }
.wa-sug-atencao { margin: 0; font-size: 0.84rem; color: #7a4f10; background: var(--accent-soft); border-radius: 10px; padding: 7px 10px; line-height: 1.4; }
.wa-sug-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-sug-chips button { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.wa-sug-chips button:hover { border-color: var(--brand); color: var(--brand-dark); }
.wa-sug-chips button[hidden] { display: none; }
.wa-sug-aj { display: flex; gap: 8px; }
.wa-sug-aj input { flex: 1; border-radius: 999px; padding: 7px 14px; font-size: 0.88rem; }
.wa-sug.pensando .wa-sug-porque { animation: waPulsa 1.1s ease-in-out infinite; }
.wa-sug.pensando .wa-sug-chips, .wa-sug.pensando .wa-sug-aj { opacity: .5; pointer-events: none; }
@keyframes waPulsa { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .wa-sug.pensando .wa-sug-porque { animation: none; } }
.wa-sug { max-height: 46%; overflow-y: auto; gap: 6px; padding-bottom: 2px; }
.wa-sug-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.wa-sug-chips::-webkit-scrollbar { display: none; }
.wa-sug-chips button { white-space: nowrap; flex-shrink: 0; }
.wa-sug-topo .wa-icone { width: 30px; height: 30px; }
@media (max-width: 900px) { .wa-sug-porque { display: none; } .wa-sug { padding-top: 6px; } .wa-sug-topo strong { font-size: 0.88rem; } }

/* ficha do contato e tom de voz */
.wa-sug-barra { gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.wa-sug-barra::-webkit-scrollbar { display: none; }
.wa-sec { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.wa-sec .ic { width: 15px; height: 15px; }
.wa-sec:hover { border-color: var(--brand); color: var(--brand-dark); }
.wa-sugerir { flex-shrink: 0; white-space: nowrap; }
.wa-sug-dica { margin: 0; font-size: 0.78rem; color: var(--ink-soft); }
.wa-sug-dica[hidden] { display: none; }
.wa-modal-intro { margin: 0 0 12px; font-size: 0.9rem; color: var(--ink-soft); line-height: 1.45; }
.wa-ficha-status { font-size: 0.84rem; font-weight: 600; color: var(--brand-dark); background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; }
.wa-campo textarea { resize: vertical; min-height: 54px; line-height: 1.4; }
.wa-exemplos { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.86rem; color: var(--ink-soft); }
.wa-modal-nota { font-size: 0.8rem; color: var(--ink-soft); }
.wa-modal { max-height: 92vh; overflow-y: auto; }
@media (max-width: 900px) { .wa-sug-dica { display: none; } }

/* historico de e-mails e parecer do contato */
.conf { display: inline-block; font-size: 0.78rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; text-decoration: none; white-space: nowrap; border: 1px solid transparent; }
.conf-confiavel { background: #e1f1e3; color: #1f6b32; }
.conf-ressalvas { background: var(--accent-soft); color: #7a4f10; }
.conf-cautela { background: #fbe3df; color: #9b2c24; }
.conf-sem_dados, .conf-nada { background: var(--bg); color: var(--ink-soft); border-color: var(--line); }
.conf-nada:hover { border-color: var(--brand); color: var(--brand-dark); }
.hist { margin-top: 18px; display: grid; gap: 14px; }
.hist-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.hist-topo h3 { margin: 0 0 2px; }
.hist-sub, .hist-nota { margin: 0; font-size: 0.86rem; color: var(--ink-soft); }
.hist-nota { font-size: 0.8rem; border-top: 1px solid var(--line); padding-top: 10px; }
.hist-aviso { background: var(--accent-soft); color: #7a4f10; border-radius: 10px; padding: 9px 12px; font-size: 0.86rem; }
.hist-aviso[hidden] { display: none; }
.hist-h { margin: 6px 0 0; font-family: var(--f-titulo); font-size: 1.05rem; }
.hist-sem { display: grid; gap: 4px; padding: 18px; background: var(--bg); border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-soft); }
.hist-sem strong { color: var(--ink); font-family: var(--f-titulo); }
.hist-veredito { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: 14px; padding: 12px 16px; }
.hist-selo { font-family: var(--f-titulo); font-weight: 700; font-size: 1.25rem; }
.hist-quando { font-size: 0.8rem; opacity: .8; }
.hist-resumo { margin: 0; font-size: 1rem; line-height: 1.5; }
.hist-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hist-colunas h5 { margin: 0 0 6px; font-size: 0.9rem; font-family: var(--f-titulo); }
.hist-pontos { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 0.9rem; line-height: 1.4; }
.hist-pontos li { display: flex; gap: 8px; align-items: flex-start; border-radius: 10px; padding: 8px 10px; }
.hist-pontos li span { font-weight: 800; flex-shrink: 0; width: 18px; text-align: center; }
.hist-pontos.favor li { background: #eef7ef; } .hist-pontos.favor li span { color: #1f6b32; }
.hist-pontos.atencao li { background: #fdf0ee; } .hist-pontos.atencao li span { color: #b23b3b; }
.hist-vazio { margin: 0; color: var(--ink-soft); font-size: 0.88rem; }
.hist-reco { margin: 0; background: var(--brand-soft); border-radius: 12px; padding: 10px 14px; font-size: 0.92rem; line-height: 1.45; }
.hist-lista { display: grid; gap: 10px; }
.hist-email { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 10px 14px; display: grid; gap: 4px; background: var(--card); }
.hist-email.entrada { border-left-color: #4f86b5; }
.hist-email.saida { border-left-color: var(--brand); }
.hist-email header { display: flex; gap: 10px; align-items: center; font-size: 0.78rem; color: var(--ink-soft); }
.hist-email header a { margin-left: auto; font-weight: 600; }
.hist-dir { font-weight: 700; color: var(--ink); }
.hist-email p { margin: 0; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.4; }
.hist-coment { display: flex; gap: 8px; align-items: flex-start; border-radius: 10px; padding: 7px 10px; font-size: 0.86rem; line-height: 1.4; margin-top: 2px; }
.hist-coment img { border-radius: 50%; flex-shrink: 0; margin-top: 1px; }
.hist-coment.sinal-positivo { background: #eef7ef; }
.hist-coment.sinal-negativo { background: #fdf0ee; }
.hist-coment.sinal-neutro { background: var(--bg); }
@media (max-width: 700px) { .hist-colunas { grid-template-columns: 1fr; } }
.wa-botao { white-space: nowrap; }
.hist > * { margin: 0; }

/* login: paisagem em marca d'agua */
.login-lado { justify-content: flex-start; gap: 44px; min-height: 100vh; }
.login-lado::after { display: none; }
.login-campo { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; color: #0b130b; pointer-events: none; }
.login-marca, .login-texto { position: relative; z-index: 1; }
.login-texto .login-frase { max-width: 30ch; font-size: clamp(1.9rem, 3.1vw, 2.7rem); }
.login-texto .login-frase-sub { max-width: 34ch; }
@media (max-width: 900px) {
  .login-lado { min-height: 0; padding: 22px 22px 250px; gap: 20px; }
  .login-texto .login-frase { font-size: 1.7rem; max-width: none; }
}
.login-frase { text-wrap: balance; }
