Your HTML template is injected into the app UI which is also HTML document. You need to rewrite your HTML template so it doesn’t leak.
For example, I’ve noticed you have tags like <html> or <head> in your HTML template. Those must be removed. Also you have global CSS styles. You need to remove those too.
With recent version upgrade, I find the custom templates have changed automatically with regard to “Notes”. Was using custom templates so far and the placing of ‘Notes’, was perfect. (Image below)