/* assistente.css — widget flutuante do assistente de IA (somente leitura).
   Usa as variáveis de tema do painel quando existem, com fallback para as
   páginas que não declaram :root (crm.html, custos.html, resumo.html). */

#ia-bolha {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 26px;
  line-height: 1;
  color: #fff;
  background: var(--sage, #5E7A56);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  transition: transform .15s ease, box-shadow .15s ease;
}
#ia-bolha img { display: block; pointer-events: none; }
#ia-bolha:hover { transform: scale(1.06); box-shadow: 0 6px 18px rgba(0, 0, 0, .34); }
#ia-bolha:active { transform: scale(.97); }

#ia-painel {
  position: fixed;
  left: 18px;
  bottom: 84px;
  z-index: 9001;
  width: 380px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 110px);
  display: none;
  flex-direction: column;
  background: var(--card, #fff);
  border: 1px solid var(--line, #D8C9AC);
  border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .26);
  overflow: hidden;
  font-family: inherit;
}
#ia-painel.aberto { display: flex; }

#ia-cabecalho {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--sage, #5E7A56);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
#ia-cabecalho small { font-weight: 400; opacity: .85; font-size: 11px; display: block; }
#ia-fechar {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

#ia-mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper, #EFE5D0);
}

.ia-msg {
  max-width: 88%;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ia-msg.usuario {
  align-self: flex-end;
  background: var(--clay, #C1622D);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.ia-msg.assistente {
  align-self: flex-start;
  background: var(--card, #fff);
  color: var(--ink, #2B2420);
  border: 1px solid var(--line, #D8C9AC);
  border-bottom-left-radius: 3px;
}
.ia-msg.erro {
  align-self: center;
  background: #FBE9E9;
  color: #8C2B2B;
  border: 1px solid #E5B5B5;
  font-size: 13px;
}
.ia-consultas {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed var(--line, #D8C9AC);
  font-size: 11px;
  color: var(--ink-soft, #6B6256);
}
.ia-dica {
  align-self: center;
  text-align: center;
  color: var(--ink-soft, #6B6256);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 6px 10px;
}

#ia-form {
  display: flex;
  gap: 6px;
  padding: 9px;
  border-top: 1px solid var(--line, #D8C9AC);
  background: var(--card, #fff);
}
#ia-texto {
  flex: 1;
  resize: none;
  border: 1px solid var(--line, #D8C9AC);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  max-height: 96px;
  color: var(--ink, #2B2420);
  background: #fff;
}
#ia-texto:focus { outline: 2px solid var(--sage, #5E7A56); outline-offset: -1px; }
#ia-enviar {
  border: none;
  border-radius: 9px;
  padding: 0 15px;
  background: var(--sage, #5E7A56);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
#ia-enviar:disabled { opacity: .55; cursor: default; }

@media (max-width: 560px) {
  #ia-painel {
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  #ia-bolha { left: 14px; bottom: 14px; width: 52px; height: 52px; font-size: 24px; }
}
