/* Existing compact call chrome, bounded by the mobile page that owns it. */
@media (max-width: 768px) {
  /* Home stays mounted to preserve its state; its widget must leave with it. */
  ._pageFlightPanel_7kyn7_34[data-active="false"] [data-call-widget="true"] {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Calls/Contacts: match their 24px page inset, 44px controls and 10px gap. */
  html[data-rm-call-header-route] [data-call-widget="true"][data-placement="global"] {
    top: calc(env(safe-area-inset-top, 0px) + 17px) !important;
    left: 78px !important;
    width: calc(100% - 156px) !important;
  }

  /* Settings has no flanking controls: reuse the same header chrome once. */
  [data-call-widget="true"][data-placement="settings"] {
    position: fixed;
    z-index: 2200;
    top: calc(env(safe-area-inset-top, 0px) + 17px);
    left: 24px;
    width: calc(100% - 48px);
    height: 44px;
  }
  html:has([data-call-widget="true"][data-placement="settings"])
    ._pageFlightPanel_7kyn7_34[data-active="true"] [data-mobile-page-title] {
    visibility: hidden;
    opacity: 0 !important;
    pointer-events: none;
  }

  /* Reserve space above pins/history, including when the keyboard is open. */
  ._chatSheet_12xvp_316 > [data-mobile-chat-call-widget-host] {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    height: 44px;
    flex: 0 0 44px;
    margin: 8px 14px;
  }
  [data-mobile-chat-call-widget-host]:empty { display: none; }
}

/* Preserve the original title behind the frosted search during a call. */
@media (max-width: 768px) {
  html[data-rm-call-header-search-open]
    ._pageFlightPanel_7kyn7_34[data-active="true"] [data-mobile-page-title] {
    opacity: 1 !important;
  }
}

/* Keep the original search backdrop inside its moving glass, not on the call. */
@media (max-width: 768px) {
  [data-call-search-backdrop] {
    position: absolute;
    inset: 0;
    pointer-events: none;
    clip-path: inset(0 calc(100% - 44px) 0 0 round 22px);
    transition: clip-path .36s cubic-bezier(.2, .82, .2, 1);
  }
  [data-search-open="true"] > [data-call-search-backdrop] {
    clip-path: inset(0 56px 0 0 round 22px);
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-call-search-backdrop] { transition-duration: 1ms; }
}

/* Settings pages: the last row must stop just above the floating tab bar
   (63px from the bottom: 48px bar + 15px gap) with ~15px air, not a white void.
   The pane itself gets no extra room; the content block carries one measured gap. */
@media (max-width: 768px) {
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] {
    padding-bottom: 0 !important;
  }
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] > [class*="_panelContent_"],
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] > [class*="_mainContent_"] {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* A bare button as the last item has no row padding of its own. */
  main[data-mobile-page-flight-sheet="true"] > [class*="viewPane"] > [class*="_panelContent_"]:has(> button:last-child) {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
