html.jw-agent-embed,
body.jw-agent-embed {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

html.jw-agent-embed #app,
html.jw-agent-embed uni-app {
  height: 100% !important;
  display: block;
}

/* 折叠页面栈：不 display:none 整页（会把 tabbar 一起藏掉） */
html.jw-agent-embed uni-page:not(:last-of-type) {
  visibility: hidden !important;
  position: absolute !important;
  left: 0;
  right: 0;
  top: 0;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

html.jw-agent-embed uni-page:last-of-type {
  visibility: visible !important;
  position: relative !important;
  height: 100% !important;
  z-index: 1 !important;
}

html.jw-agent-embed uni-page:not(:last-of-type) .uni-tabbar,
html.jw-agent-embed uni-page:not(:last-of-type) uni-tabbar,
html.jw-agent-embed uni-page:not(:last-of-type) .uni-tabbar-bottom {
  display: none !important;
}

html.jw-agent-embed uni-page-body,
html.jw-agent-embed uni-page-wrapper {
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* 强制显示客户端底部导航 */
html.jw-agent-embed .uni-tabbar-bottom,
html.jw-agent-embed uni-tabbar-bottom {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  height: auto !important;
}

html.jw-agent-embed .uni-tabbar,
html.jw-agent-embed uni-tabbar {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  min-height: 50px !important;
  z-index: 9999 !important;
  background: #fff !important;
  border-top: 1px solid #e8e8e8 !important;
}

html.jw-agent-embed .uni-app--showtabbar uni-page-wrapper,
html.jw-agent-embed uni-page:last-of-type uni-page-wrapper {
  padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important;
}

/* 兜底自定义底栏（uni tabbar 未渲染时） */
#jw-embed-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  min-height: 50px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid #e8e8e8;
  box-sizing: border-box;
}

html.jw-agent-embed.jw-embed-fallback-tabbar #jw-embed-tabbar {
  display: flex !important;
}

html.jw-agent-embed.jw-embed-fallback-tabbar uni-page:last-of-type uni-page-wrapper {
  padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important;
}

#jw-embed-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #999;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

#jw-embed-tabbar a.active {
  color: #ff6b00;
  font-weight: 600;
}

#jw-embed-tabbar a span.ico {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}
