/* Capacitor-only layout helpers */
html.is-cap {
  /* Safe area + keyboard variables */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --kb: 0px; /* updated by JS when keyboard opens */
}

/* Top bars shouldn’t hide under the status bar */
html.is-cap .topbar,
html.is-cap header.sticky,
html.is-cap .app-header {
  padding-top: max(12px, var(--sat));
}

/* Any fixed bottom element (menus, FABs, CTA buttons) should float above system nav + keyboard */
html.is-cap .bottom-menu,
html.is-cap .fixed-bottom,
html.is-cap .fab-container,
html.is-cap .avoid-system-ui {
  position: fixed; /* if not already */
  /* keep your existing left/right/width */
  bottom: max(16px, var(--sab), var(--kb)); /* push above Android gesture bar/keyboard */
}

/* Pages with a bottom bar need extra content padding so scrollable content isn’t obscured */
html.is-cap .page-with-bottom-bar,
html.is-cap body.has-bottom-bar {
  padding-bottom: max(72px, var(--sab), var(--kb));
}

/* Android sometimes reports 0 safe-area; give it a minimum lift anyway */
html.is-cap.is-android .bottom-menu,
html.is-cap.is-android .fixed-bottom,
html.is-cap.is-android .fab-container,
html.is-cap.is-android .avoid-system-ui {
  bottom: max(20px, var(--kb));
}

/* Optional utility: lift any single button that’s too close to the edge */
html.is-cap .lift-bottom {
  margin-bottom: max(16px, var(--sab), var(--kb)) !important;
}
