guidelines – Best way to design custom applications to connect Microsoft Dynamics 365

We are a small team of 2 people who personalize Dynamics 365 for our company of about 100 people.
The use of built-in customization tools from the dynamics for forms and basic actions works (enough) well.

However, for more complex workflows, we develop custom applications published as Web resources.
The problem I face is that the more we do, the further we get from the dynamic style of the user interface.

Microsoft Dynamics does not have the most beautiful user interface, nor the best UX either. Plus, I can not feel happy when browsing an application that covers different UI styles.

We managed to create a custom css that almost mocks many UI elements. It works very well for small applications that fit into modals. But when it is a larger project, as an accounting module for example, there is always a problem of integration.

First of all, if we insert the module directly into the native UI, there is an inexplicable blank line (about 24 pixels) between the native UI and the custom module. This line interrupts any attempt to merge elements of the UI into the design because they appear to float.

The white line

If we then decide to publish our module as a stand-alone link that opens in a new tab, then we are faced with the problem that all the browsing header is missing.

I've tried to make fun of my head, but it's a little too much work. So I thought I could just make fun of the design by just inserting the navigation of my module. Yet, that still seems completely different.
I've also tried not to insert header, but this only gets worse because the application seems to come out of nowhere.

Has any of you been faced with this kind of problem? And what is the best way, or the least, to implement custom applications that look like everything?

Note:
As Dynamics 365 has no design guidelines and is not even close to the Microsoft Fabric user interface, I'm a little discouraged.