Did using Retool's custom CSS matching not work?
If so, there might be some more specific CSS that you could to target your elements. Instead of relying on generated class names, you could look for something more stable.
Like this for example, I matched on aria-label
since I figure they probably are not going to change that ever.
Another idea would be to look for a parent with a stable data-testid
and then use that and decedent selectors to find your element.