/* Only installed mobile apps / Feishu use an inner scroll surface.
   Do not try to disguise the address bar of an ordinary browser tab. */
html.erp-app-viewport {
  height: 100%;
  overflow: hidden;
  overscroll-behavior-y: none;
}
html.erp-app-viewport > body {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-top: calc(12px + env(safe-area-inset-top));
  scroll-padding-bottom: calc(var(--mobile-dock-height, 82px) + env(safe-area-inset-bottom));
}
html.erp-app-viewport .shell {
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
html.erp-app-viewport .auth-layout {
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
/* An explicit host exit replaces the hidden Feishu browser controls. */
html.erp-feishu > body {
  padding-top: calc(44px + env(safe-area-inset-top));
  scroll-padding-top: calc(56px + env(safe-area-inset-top));
}
html.erp-feishu .shell { padding-top: 12px; }
html.erp-feishu .auth-layout { padding-top: 0; }
html.erp-feishu .erp-feishu-return {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(44px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: #f5f7fa;
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 -1px #e3e8ef;
  color: #405474;
}
html.erp-feishu .erp-feishu-return button,
html.erp-feishu .erp-feishu-return a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #405474;
  font: 600 14px/1.4 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
html.erp-feishu .erp-feishu-return a { margin-left: auto; text-decoration: underline; }
html.erp-feishu .erp-feishu-return [hidden] { display: none; }
html.erp-feishu .erp-feishu-return :focus-visible { outline: 2px solid #526999; outline-offset: -3px; }
html.erp-feishu .erp-feishu-return button:disabled { opacity: .6; cursor: wait; }
html.erp-feishu .erp-feishu-return-status { color: #68758b; font-size: 12px; }
@media print {
  html.erp-feishu .erp-feishu-return { display: none; }
  html.erp-feishu > body { padding-top: 0; }
  html.erp-app-viewport, html.erp-app-viewport > body {
    position: static;
    height: auto;
    overflow: visible;
  }
}
