create index if not exists idx_reports_tenant_created
  on public.reports(tenant_id, created_at desc);

create index if not exists idx_reports_tenant_handled
  on public.reports(tenant_id, handled_at desc, handled_by)
  where handled_at is not null;

create index if not exists idx_score_events_tenant_feedback_reward
  on public.user_score_events(tenant_id, created_at desc, source_id)
  where event_type = 'feedback_reward' and source_type = 'reports';
