:root {
  --pwa-safe-top: env(safe-area-inset-top, 0px);
  --pwa-safe-right: env(safe-area-inset-right, 0px);
  --pwa-safe-bottom: env(safe-area-inset-bottom, 0px);
  --pwa-safe-left: env(safe-area-inset-left, 0px);
}

html {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: #f8fafc;
}

body {
  width: 100%;
  max-width: 100%;
}

body.pwa-standalone {
  width: 100%;
  max-width: 100vw;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

body.pwa-standalone #dashboardApp,
body.pwa-standalone .app-layout,
body.pwa-standalone .app-content,
body.pwa-standalone .dashboard-page,
body.pwa-standalone .dashboard-section {
  min-width: 0;
  max-width: 100%;
}

body.pwa-standalone .app-topbar {
  padding-left: max(14px, var(--pwa-safe-left));
  padding-right: max(14px, var(--pwa-safe-right));
}

.pwa-status-card {
  position: fixed;
  right: max(14px, var(--pwa-safe-right));
  bottom: max(14px, var(--pwa-safe-bottom));
  z-index: 5000;
  display: grid;
  width: min(430px, calc(100vw - 28px - var(--pwa-safe-left) - var(--pwa-safe-right)));
  gap: 9px;
  padding: 15px;
  border: 1px solid #99f6e4;
  border-radius: 16px;
  background: rgba(255, 255, 255, .98);
  color: #0f172a;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
  backdrop-filter: blur(16px);
}

.pwa-install-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4999;
  display: grid;
  place-items: center;
  padding: max(18px, var(--pwa-safe-top)) max(18px, var(--pwa-safe-right)) max(18px, var(--pwa-safe-bottom)) max(18px, var(--pwa-safe-left));
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(8px);
}

.pwa-install-backdrop .pwa-install-card-ios {
  position: static;
  width: min(460px, 100%);
  max-height: calc(100dvh - var(--pwa-safe-top) - var(--pwa-safe-bottom) - 36px);
  overflow-y: auto;
  gap: 16px;
  padding: 22px;
  border-color: #5eead4;
  border-top: 5px solid #0f766e;
  border-radius: 22px;
}

.pwa-install-brand {
  display: flex;
  justify-content: center;
}

.pwa-install-brand img {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}

.pwa-install-kicker {
  margin-bottom: 5px !important;
  color: #0f766e !important;
  font-size: 11px !important;
  font-weight: 900;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
}

.pwa-install-card-ios h2,
.pwa-install-card-ios #pwaInstallDescription {
  text-align: center;
}

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

.pwa-install-steps li {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 11px 13px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.4;
}

.pwa-install-step-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 900;
}

.pwa-share-symbol {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #93c5fd;
  border-radius: 7px;
  color: #2563eb;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.pwa-install-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.pwa-status-card[hidden] {
  display: none !important;
}

.pwa-status-card h2,
.pwa-status-card p {
  margin: 0;
}

.pwa-status-card h2 {
  font-size: 18px;
  line-height: 1.2;
}

.pwa-status-card p {
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.pwa-status-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.pwa-status-actions button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: #f1f5f9;
  color: #0f172a;
  box-shadow: none;
  font-weight: 850;
}

.pwa-status-actions button[data-primary="true"] {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.pwa-offline-strip {
  position: fixed;
  top: var(--pwa-safe-top);
  right: var(--pwa-safe-right);
  left: var(--pwa-safe-left);
  z-index: 4900;
  padding: 7px 12px;
  background: #7c2d12;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.pwa-offline-strip[hidden] {
  display: none !important;
}

body.pwa-offline .app-topbar {
  margin-top: 32px;
}

@media (max-width: 820px) {
  .pwa-status-card {
    right: max(10px, var(--pwa-safe-right));
    bottom: calc(78px + var(--pwa-safe-bottom));
    left: max(10px, var(--pwa-safe-left));
    width: auto;
  }

  .pwa-status-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pwa-status-actions button {
    width: 100%;
  }

  .pwa-install-backdrop .pwa-install-card-ios {
    width: 100%;
    padding: 20px 17px;
  }

  body.pwa-standalone .mobile-bottom-nav {
    padding-right: max(5px, var(--pwa-safe-right));
    padding-bottom: calc(5px + var(--pwa-safe-bottom));
    padding-left: max(5px, var(--pwa-safe-left));
  }
}

@media (display-mode: standalone) {
  html,
  body {
    min-height: 100dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-status-card {
    scroll-behavior: auto;
  }
}
