SELECT
  l.id,
  l.sessao_id,
  s.numero AS sessao_numero,
  s.tipo AS sessao_tipo,
  s.data_sessao,
  l.usuario_id,
  u.nome AS usuario_nome,
  l.modo,
  l.created_at
FROM ata_ia_logs l
LEFT JOIN sessoes s ON s.id = l.sessao_id
LEFT JOIN usuarios u ON u.id = l.usuario_id
WHERE DATE(l.created_at) BETWEEN :data_ini AND :data_fim
ORDER BY l.created_at DESC, l.id DESC