.pwaAppControls,
.pwaInstallBar,
.pwaInstallButton,
.pwaInstallHelp,
.pwaStatusBarBg {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pwaAppControls,
.pwaInstallBar,
.pwaStatusBarBg {
  display: none;
}

html.pwa-standalone,
html.pwa-standalone body {
  background-color: #0f1723;
}

html.pwa-standalone body {
  box-sizing: border-box;
  /* The status spacer below reserves the top safe area in normal flow. */
  padding-top: 0 !important;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  overscroll-behavior-y: none;
}

/* Keep the existing sticky site header below the iPhone status/notch area.
   Without this offset it sticks at top:0 behind pwaStatusBarBg and looks cut. */
html.pwa-standalone header.pckGlobalHeader {
  top: env(safe-area-inset-top, 0px) !important;
}

/* Secondary sticky navigation must stack below the global app header. */
html.pwa-standalone .reportSubNav {
  top: calc(env(safe-area-inset-top, 0px) + 66px) !important;
}

/* The advanced-search dialog is its own app layer. Keep it above the bottom
   controls and inside the iPhone safe viewport so no fields/actions are hidden. */
html.pwa-standalone .filterModalBackdrop {
  z-index: 2147483500 !important;
  align-items: center !important;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px calc(env(safe-area-inset-bottom, 0px) + 10px) !important;
}

html.pwa-standalone .filterModalDialog {
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px) !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-top: 18px;
  scroll-padding-bottom: 18px;
}

html.pwa-standalone .filterModalHeader {
  position: sticky;
  z-index: 30;
  top: -24px;
  margin: -24px -24px 16px !important;
  padding: 20px 24px 14px !important;
  background: #ffffff;
}

html.pwa-standalone .drawerActionsRow {
  position: sticky;
  z-index: 25;
  bottom: -24px;
  margin-right: -24px !important;
  margin-left: -24px !important;
  padding: 16px 24px 20px !important;
  background: #ffffff;
  box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.08);
}

html.pwa-standalone .pwaStatusBarBg {
  /* Sticky instead of fixed: it remains behind the iPhone status icons while
     also reserving exactly one safe-area row before the sticky site header. */
  position: sticky;
  z-index: 2147483640;
  top: 0;
  right: 0;
  left: 0;
  display: block;
  height: env(safe-area-inset-top, 0px);
  background: #0f1723;
  pointer-events: none;
}

html.pwa-standalone .pwaAppControls {
  position: fixed;
  z-index: 2147483000;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-height: 64px;
  padding: 7px max(12px, env(safe-area-inset-right, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(10, 15, 24, 0.96);
  box-shadow: 0 -8px 30px rgba(2, 6, 23, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.pwaControlButton {
  display: flex;
  min-width: 0;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #f8fafc;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pwaControlButton > span {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.pwaControlButton > small {
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.pwaControlButton:active,
.pwaControlButton:focus-visible,
.pwaControlHome {
  background: rgba(249, 115, 22, 0.16);
  color: #fb923c;
}

.pwaInstallBar[hidden] {
  display: none !important;
}

.pwaInstallBar {
  position: fixed;
  z-index: 2147482000;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 3px solid #f97316;
  border-radius: 14px;
  background: rgba(15, 23, 35, 0.98);
  color: #fff;
  box-shadow: 0 14px 38px rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.pwaInstallBar > img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.pwaInstallButton {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pwaInstallCopy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.2;
}

.pwaInstallCopy strong {
  font-size: 13px;
  font-weight: 850;
}

.pwaInstallCopy small {
  overflow: hidden;
  margin-top: 2px;
  color: #aeb9c9;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwaInstallAction {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 9px;
  background: #f97316;
  color: #fff;
  box-shadow: 0 5px 16px rgba(249, 115, 22, 0.3);
  font-size: 12px;
  font-weight: 850;
}

.pwaInstallDismiss {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

html.pwa-standalone .pwaInstallBar {
  display: none !important;
}

.pwaInstallHelp[hidden] {
  display: none;
}

.pwaInstallHelp {
  position: fixed;
  z-index: 2147483600;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: rgba(2, 6, 23, 0.66);
}

.pwaInstallHelpCard {
  position: relative;
  width: min(100%, 440px);
  padding: 22px 48px 22px 22px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.42);
}

.pwaInstallHelpCard strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.pwaInstallHelpCard p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
}

.pwaInstallIntro {
  margin-bottom: 14px !important;
}

.pwaInstallSteps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pwaInstallSteps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: #334155;
  font-size: 14px;
  line-height: 1.4;
}

.pwaInstallStepIcon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #fff7ed;
  color: #ea580c;
  font-size: 13px;
  font-weight: 900;
}

.pwaShareIcon {
  color: #2563eb;
  font-size: 18px;
  font-weight: 900;
}

.pwaInstallUnderstood {
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px;
  border: 0;
  border-radius: 11px;
  background: #ea580c;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.pwaInstallHelpClose {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 900px) {
  .pwaInstallBar {
    right: 24px;
    bottom: 24px;
    left: auto;
    width: 420px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwaAppControls,
  .pwaInstallBar,
  .pwaInstallButton,
  .pwaInstallHelp {
    scroll-behavior: auto;
  }
}
