/* Shared iOS / standalone PWA shell styles for admin pages */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Strip reserved for the two floating corner buttons on phones (Team-Chat
     bottom-left, notification bell top-right). pwa-shell.js raises this to 48px
     once they are actually mounted; it stays 0 in the Kundenportal and while
     logged out. --sc-nav-offset already contains it on the shell pages, so this
     default only matters for pages that read the variable directly. */
  --sc-top-chrome: 0px;
}

html.sc-mobile-nav {
  overscroll-behavior-y: none;
}

html.sc-mobile-nav body {
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

html.sc-standalone {
  /* Standalone web app: avoid rubber-band on outer shell */
  overscroll-behavior-y: none;
}

/* Base iframe shell layout (desktop + mobile) — grows with content via JS */
.sc-pwa-iframe {
  display: block;
  width: 100%;
  min-height: 1000px;
  border: none;
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 600px) {
  /* Top bar is removed on phones — reserve only the notch on top, and the
     fixed bottom tab bar on the bottom (offset var already includes the
     home-indicator safe area). */
  html.sc-mobile-nav body {
    padding-top: var(--sc-nav-offset, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: var(--sc-bottom-nav-offset, calc(56px + env(safe-area-inset-bottom, 0px)));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  html.sc-mobile-nav .sc-pwa-iframe {
    border-radius: 0;
    min-height: calc(100dvh - var(--sc-nav-offset, env(safe-area-inset-top, 0px)) - var(--sc-bottom-nav-offset, calc(56px + env(safe-area-inset-bottom, 0px))));
  }

}

/* Keep the shell chrome clear of a locked overlay (signature pad, notifications).
   These rules live OUTSIDE the phone media query on purpose: the top bar is hidden
   by `@media (max-width: 600px)` in navbar.html, and a phone turned sideways is
   ~844px wide — so the moment someone rotated while signing, that query stopped
   matching, the navbar reappeared over the pad, and the iframe pin (computed for
   portrait) no longer lined up. An overlay is fullscreen at EVERY width. */
body.sc-notif-overlay-lock #global-navbar,
body.notif-overlay-lock #global-navbar {
  display: none !important;
}

/* Die Bodenleiste des Telefons sitzt in der Chrome-Ebene, und die haengt an
   <html>, nicht an <body> (navbar.html: `document.documentElement.appendChild`).
   Hier stand deshalb jahrelang `body.sc-notif-overlay-lock #global-bottom-nav` —
   ein Selektor, der die Leiste gar nicht treffen KANN. Wirkung auf dem Telefon:
   die Ebene (position:fixed, z-index 1000) lag ueber jedem gepinnten Widget-
   Overlay, also ueber den Knoepfen am unteren Rand jedes Dialogs.
   Die Klasse setzt pwa-shell.js seit 2026-08-14 auf beide Wurzeln. */
html.sc-notif-overlay-lock #sc-chrome-layer,
html.notif-overlay-lock #sc-chrome-layer {
  display: none !important;
}

/* Kein `touch-action: none` hier. Die effektive touch-action ist der SCHNITT
   entlang der Vorfahrenkette, und die reicht ueber die iframe-Grenze hinweg —
   ein `none` auf dem Shell-Body macht damit jeden Scroller INNERHALB des
   gepinnten Widgets unbedienbar (`none ∩ pan-y = none`). Genau das braucht die
   Lead-Detailansicht aber: gepinnt, mit scrollendem Inhalt.
   Fuer die Sperre selbst ist es ohnehin entbehrlich — `position: fixed` +
   `overflow: hidden` halten die Shell-Seite fest, und die beiden
   Unterschriften-Flaechen setzen `touch-action: none` auf ihrem eigenen
   <canvas>, wo es hingehoert. */
body.sc-notif-overlay-lock,
body.notif-overlay-lock {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Push banner safe-area is applied inline via JS */
