<!doctype html>
<html lang="de">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>
      <%= typeof title !== "undefined" ? title : "Privatarzt Software" %>
    </title>

    <!-- ✅ Bootstrap -->
    <link rel="stylesheet" href="/css/bootstrap.min.css" />

    <!-- ✅ Icons -->
    <link rel="stylesheet" href="/bootstrap-icons/bootstrap-icons.min.css" />

    <!-- ✅ Dein CSS -->
    <link rel="stylesheet" href="/css/style.css" />
  </head>

  <body>
    <div class="layout">
      <!-- ✅ Sidebar dynamisch -->
      <% if (typeof sidebarPartial !== "undefined" && sidebarPartial) { %>
        <%- include(sidebarPartial, {
          user,
          active,
          lang,
          t,
          patient: (typeof patient !== "undefined" ? patient : null),
          backUrl: (typeof backUrl !== "undefined" ? backUrl : null)
        }) %>
      <% } %>

      <!-- ✅ Main -->
      <div class="main">
        <%- body %>
      </div>

    </div>

    <!-- ✅ Bootstrap JS (Pflicht für Modals, Toasts usw.) -->
    <script src="/js/bootstrap.bundle.min.js"></script>

    <!-- ✅ externes JS (CSP safe) -->
    <script src="/js/datetime.js"></script>
    <script src="/js/patient-select.js" defer></script>
    <!-- <script src="/js/patient_sidebar.js" defer></script> -->

    <!-- ✅ Sidebar: gesperrte Menüpunkte abfangen -->
    <script src="/js/sidebar-lock.js" defer></script>
  </body>
</html>
