.pwa-connectivity {
  position: fixed;
  z-index: 5000;
  top: 50%;
  left: 50%;
  width: min(320px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(15, 18, 22, .14);
  border-radius: 18px;
  background: rgba(250, 250, 250, .84);
  color: #111318;
  box-shadow: 0 18px 55px rgba(15, 18, 22, .2);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: pwa-connectivity-in .24s cubic-bezier(.2, .8, .2, 1) both;
}

.push-permission-card {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 10050;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 14px;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--border-strong, #d9dde5) 84%, transparent);
  border-radius: 18px;
  color: var(--text, #171b24);
  background: color-mix(in srgb, var(--surface-solid, #fff) 95%, transparent);
  box-shadow: 0 18px 48px rgba(7, 13, 25, .2), 0 5px 14px rgba(7, 13, 25, .08);
  backdrop-filter: blur(20px) saturate(1.14);
  -webkit-backdrop-filter: blur(20px) saturate(1.14);
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}

.push-permission-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.push-permission-card.is-leaving {
  opacity: 0;
  transform: translateY(10px) scale(.985);
}

.push-permission-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 13px;
  background: linear-gradient(145deg, #222934, #0f141c);
  box-shadow: inset 0 1px rgba(255, 255, 255, .14), 0 7px 18px rgba(5, 10, 18, .18);
}

.push-permission-mark img {
  width: 21px;
  height: 21px;
  filter: invert(1);
}

.push-permission-copy {
  min-width: 0;
}

.push-permission-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted, #687080);
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.push-permission-card h2 {
  margin: 0;
  color: inherit;
  font-size: 16px;
  line-height: 1.25;
}

.push-permission-card p {
  margin: 5px 0 0;
  color: var(--text-muted, #687080);
  font-size: 12.5px;
  line-height: 1.42;
}

.push-permission-card .push-permission-error {
  color: #b42318;
}

.push-permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.push-permission-actions button {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 720;
  cursor: pointer;
}

.push-permission-actions button:focus-visible {
  outline: 3px solid rgba(74, 125, 255, .34);
  outline-offset: 2px;
}

.push-permission-actions button:disabled {
  cursor: wait;
  opacity: .68;
}

.push-permission-primary {
  color: #fff;
  background: #171d27;
  box-shadow: 0 7px 18px rgba(10, 15, 24, .18);
}

.push-permission-secondary {
  color: var(--text, #222833);
  background: color-mix(in srgb, var(--panel-2, #eef1f5) 88%, transparent);
}

html[data-theme="dark"] .push-permission-card {
  border-color: rgba(255, 255, 255, .11);
  color: #f4f6fa;
  background: linear-gradient(145deg, rgba(24, 26, 32, .98), rgba(14, 15, 19, .98));
  box-shadow: 0 20px 56px rgba(0, 0, 0, .5), 0 5px 16px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .push-permission-eyebrow,
html[data-theme="dark"] .push-permission-card p {
  color: #aeb6c5;
}

html[data-theme="dark"] .push-permission-card .push-permission-error {
  color: #fca5a5;
}

html[data-theme="dark"] .push-permission-mark {
  border-color: rgba(255, 255, 255, .12);
  background: linear-gradient(145deg, #343a46, #1b2029);
  box-shadow: inset 0 1px rgba(255, 255, 255, .12), 0 7px 18px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .push-permission-primary {
  color: #f4f6fa;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 7px 18px rgba(0, 0, 0, .24);
}

html[data-theme="dark"] .push-permission-secondary {
  color: #dbe0e8;
  background: rgba(255, 255, 255, .07);
}

@media (max-width: 640px) {
  .push-permission-card {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 12px;
    border-radius: 16px;
  }

  .push-permission-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .push-permission-mark img {
    width: 19px;
    height: 19px;
  }

  .push-permission-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .push-permission-actions button {
    min-height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .push-permission-card {
    transition: none;
  }
}

.pwa-connectivity.is-leaving {
  animation: pwa-connectivity-out .2s ease both;
}

/* Keep connectivity feedback in the navigation status area so it never
   covers the workspace. The fixed rule above remains as a safe fallback on
   pages that do not render the application sidebar. */
.app-sidebar .sidebar-footer-note .pwa-connectivity.is-sidebar-notice {
  position: relative;
  z-index: 2;
  inset: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 7px;
  min-height: 36px;
  margin: 0;
  padding: 5px 7px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(15, 18, 22, .1);
  transform: none;
  animation: pwa-connectivity-sidebar-in .2s cubic-bezier(.2, .8, .2, 1) both;
}

.app-sidebar .sidebar-footer-note .pwa-connectivity.is-sidebar-notice.is-leaving {
  animation: pwa-connectivity-sidebar-out .18s ease both;
}

.app-sidebar .sidebar-footer-note:has(.pwa-connectivity)::before {
  opacity: 0;
}

.app-sidebar .sidebar-footer-note:has(.pwa-connectivity) {
  padding-top: 6px;
  padding-bottom: 6px;
}

.app-sidebar .sidebar-footer-note:has(.pwa-connectivity) .sidebar-footer-note-copy {
  display: none;
}

.app-sidebar .sidebar-footer-note .pwa-connectivity-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.app-sidebar .sidebar-footer-note .pwa-connectivity-icon img {
  width: 14px;
  height: 14px;
}

.app-sidebar .sidebar-footer-note .pwa-connectivity-copy strong {
  font-size: 10.5px;
  line-height: 1.15;
}

.app-sidebar .sidebar-footer-note .pwa-connectivity-copy span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 860px) {
  body.dashboard-body.chat-docked .app-sidebar .sidebar-footer-note:has(.pwa-connectivity) {
    display: grid;
    place-items: center;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.dashboard-body.chat-docked .app-sidebar .sidebar-footer-note-copy {
    display: none;
  }

  body.dashboard-body.chat-docked .app-sidebar .sidebar-footer-note .pwa-connectivity.is-sidebar-notice {
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    grid-template-columns: 1fr;
    place-items: center;
    gap: 0;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(15, 18, 22, .12);
  }

  body.dashboard-body.chat-docked .app-sidebar .sidebar-footer-note .pwa-connectivity-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
  }

  body.dashboard-body.chat-docked .app-sidebar .sidebar-footer-note .pwa-connectivity-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.pwa-connectivity-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #111318;
  color: #fff;
}

.pwa-connectivity-icon img {
  width: 19px;
  height: 19px;
  filter: brightness(0) invert(1);
}

.pwa-connectivity-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.pwa-connectivity-copy strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.2;
}

.pwa-connectivity-copy span {
  color: #68707c;
  font-size: 12px;
  line-height: 1.35;
}

.pwa-connectivity.is-online .pwa-connectivity-icon {
  background: #f5f5f5;
  color: #111318;
  box-shadow: inset 0 0 0 1px rgba(15, 18, 22, .12);
}

.pwa-connectivity.is-online .pwa-connectivity-icon img {
  filter: none;
}

.pwa-connectivity.is-offline .pwa-connectivity-icon {
  background: #dc2626;
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .18),
    0 4px 12px rgba(220, 38, 38, .3);
}

.pwa-connectivity.is-offline .pwa-connectivity-icon img,
html[data-theme="dark"] .pwa-connectivity.is-offline .pwa-connectivity-icon img {
  filter: brightness(0) invert(1);
}

html[data-theme="dark"] .pwa-connectivity {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(27, 28, 31, .86);
  color: #f5f5f5;
  box-shadow: 0 22px 65px rgba(0, 0, 0, .42);
}

html[data-theme="dark"] .pwa-connectivity-copy span {
  color: #a8adb5;
}

html[data-theme="dark"] .pwa-connectivity-icon {
  background: #f5f5f5;
}

html[data-theme="dark"] .pwa-connectivity-icon img {
  filter: none;
}

html[data-theme="dark"] .pwa-connectivity.is-online .pwa-connectivity-icon {
  background: #232529;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

html[data-theme="dark"] .pwa-connectivity.is-online .pwa-connectivity-icon img {
  filter: brightness(0) invert(1);
}

@keyframes pwa-connectivity-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes pwa-connectivity-out {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, calc(-50% - 8px)) scale(.98); }
}

@keyframes pwa-connectivity-sidebar-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pwa-connectivity-sidebar-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-4px) scale(.98); }
}

@keyframes pwa-connectivity-mobile-in {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pwa-connectivity-mobile-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-4px) scale(.98); }
}

@media (max-width: 859px) {
  body.dashboard-body > .pwa-connectivity {
    top: auto;
    right: auto;
    bottom: calc(var(--nav-height, 68px) + env(safe-area-inset-bottom, 0px) + 10px);
    left: max(10px, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    grid-template-columns: 28px minmax(0, auto);
    gap: 7px;
    min-height: 38px;
    padding: 5px 9px 5px 5px;
    border-radius: 12px;
    transform: none;
    animation: pwa-connectivity-mobile-in .2s cubic-bezier(.2, .8, .2, 1) both;
  }

  body.dashboard-body > .pwa-connectivity.is-leaving {
    animation: pwa-connectivity-mobile-out .18s ease both;
  }

  body.dashboard-body > .pwa-connectivity .pwa-connectivity-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
  }

  body.dashboard-body > .pwa-connectivity .pwa-connectivity-icon img {
    width: 15px;
    height: 15px;
  }

  body.dashboard-body > .pwa-connectivity .pwa-connectivity-copy {
    gap: 0;
  }

  body.dashboard-body > .pwa-connectivity .pwa-connectivity-copy strong {
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
  }

  body.dashboard-body > .pwa-connectivity .pwa-connectivity-copy span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .pwa-connectivity {
    top: 46%;
    padding: 12px 13px;
    border-radius: 16px;
  }

  .app-sidebar .sidebar-footer-note .pwa-connectivity.is-sidebar-notice {
    gap: 8px;
    margin-bottom: 0;
    padding: 8px;
    border-radius: 12px;
  }
}

@media (max-width: 380px) {
  body.dashboard-body > .pwa-connectivity {
    grid-template-columns: 28px;
    padding: 5px;
  }

  body.dashboard-body > .pwa-connectivity .pwa-connectivity-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-connectivity,
  .pwa-connectivity.is-leaving {
    animation-duration: .01ms;
  }
}
