CREATE POLICY "Board members can insert invoices for their associations"
ON public.invoices FOR INSERT TO authenticated
WITH CHECK (
  EXISTS (
    SELECT 1 FROM public.board_members bm
    WHERE bm.user_id = auth.uid()
      AND bm.association_id = invoices.association_id
  )
);

CREATE POLICY "Board members can insert bills for their associations"
ON public.bills FOR INSERT TO authenticated
WITH CHECK (
  EXISTS (
    SELECT 1 FROM public.board_members bm
    WHERE bm.user_id = auth.uid()
      AND bm.association_id = bills.association_id
  )
);