What is the proper way to make custom plugin UI look native?

For example, I want to create a toolbar with buttons in my modal window and I want it to fit the rest of the UI elements and reuse all the padding, alignments, sizes, etc. There is no toolbar component, but there are toolbars in Obsidian

I have two options

  1. I can find undocumented suitable CSS classes and use them (e.g. .modal-button-container). But this looks unreliable, and as soon as they change, my UI will become a mess.
  2. I can recreate the same look by nitpicking individual properties. But when the Obsidian design changes, my UI will not match anymore.

Which one is recommended?