/* RitWise native Android compact layout fix.
   The native activity reserves the Android navigation-bar inset. The web app
   only needs to reserve space for its own compact navigation. */

:root {
  --ritwise-native-nav-height: 60px;
  --ritwise-native-content-bottom: 62px;
}

html.ritwise-native,
html.ritwise-native body {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}


/* Native WebView starts below the Android status bar. Do not add the web safe-area
   inset again; keep only a compact visual gap above the cloud status bar. */
html.ritwise-native body {
  padding-top: 0 !important;
}

html.ritwise-native .ritwise-app-content {
  padding-top: 28px !important;
}

html.ritwise-native * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Exactly one page container scrolls. The body itself never scrolls. */
html.ritwise-native .ritwise-native-scroll-root,
html.ritwise-native .ritwise-native-scroll-unlocked {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}

html.ritwise-native .ritwise-native-scroll-root {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding-bottom: var(--ritwise-native-content-bottom) !important;
}

/* Stop the Home page from moving when its real content fits in the viewport. */
html.ritwise-native .ritwise-native-scroll-root.ritwise-native-no-scroll {
  overflow-y: hidden !important;
  overscroll-behavior-y: none !important;
  touch-action: manipulation !important;
}

html.ritwise-native .ritwise-native-remove-top-gap {
  padding-top: 8px !important;
  margin-top: 0 !important;
}

html.ritwise-native .ritwise-native-remove-child-top-gap {
  margin-top: 0 !important;
}

/* Compact app navigation. The Android system navigation inset is handled by
   MainActivity and therefore must not be added again in CSS. */
html.ritwise-native .ritwise-native-bottom-nav {
  box-sizing: border-box !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: var(--ritwise-native-nav-height) !important;
  min-height: var(--ritwise-native-nav-height) !important;
  max-height: var(--ritwise-native-nav-height) !important;
  padding: 2px 6px !important;
  margin: 0 !important;
  gap: 0 !important;
  align-items: stretch !important;
  overflow: hidden !important;
  z-index: 10000 !important;
}

html.ritwise-native .ritwise-native-bottom-nav > * {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 56px !important;
  margin: 0 !important;
  padding: 0 !important;
}

html.ritwise-native .ritwise-native-bottom-nav a,
html.ritwise-native .ritwise-native-bottom-nav button,
html.ritwise-native .ritwise-native-bottom-nav [role="button"] {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 56px !important;
  padding: 1px 3px !important;
  margin: 0 !important;
  line-height: 1 !important;
}

html.ritwise-native .ritwise-native-bottom-nav img,
html.ritwise-native .ritwise-native-bottom-nav svg {
  max-height: 25px !important;
  width: auto !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Keep text labels compact without clipping them. */
html.ritwise-native .ritwise-native-bottom-nav span,
html.ritwise-native .ritwise-native-bottom-nav small,
html.ritwise-native .ritwise-native-bottom-nav p {
  line-height: 1 !important;
  margin-top: 1px !important;
  margin-bottom: 0 !important;
}

html.ritwise-native [role="dialog"],
html.ritwise-native .bottom-sheet,
html.ritwise-native .bottomSheet,
html.ritwise-native .sheet,
html.ritwise-native .modal-content,
html.ritwise-native .drawer-content {
  max-height: calc(100% - var(--ritwise-native-nav-height)) !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}
