/* Offline inventory PWA banner + states */

.st-offline-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 8px 14px;
  align-items: center;
  padding: 8px 12px;
  margin: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--accent, #388bfd) 10%, var(--surface, #161b22));
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent, #388bfd) 22%, var(--border, #30363d));
  color: var(--text, #e6edf3);
  font-size: 13px;
  line-height: 1.3;
}

.st-offline-banner__left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  align-items: stretch;
}

.st-offline-banner__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.st-offline-banner__state {
  font-weight: 600;
  white-space: nowrap;
}

.st-offline-banner__pending {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent, #388bfd) 16%, transparent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.st-offline-banner__pending[hidden] {
  display: none !important;
}

.st-offline-banner.is-offline {
  background: color-mix(in srgb, #d29922 12%, var(--surface, #161b22));
  border-bottom-color: color-mix(in srgb, #d29922 36%, var(--border, #30363d));
}

.st-offline-banner.is-offline .st-offline-banner__state {
  color: color-mix(in srgb, #e3b341 65%, var(--text, #e6edf3));
}

.st-offline-banner.is-pending .st-offline-banner__pending {
  background: color-mix(in srgb, #d29922 20%, transparent);
  color: #e3b341;
}

.st-offline-banner.is-syncing .st-offline-banner__state {
  opacity: 0.9;
}

.st-offline-banner__sync {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 4px;
  border: none;
  background: var(--accent, #388bfd);
  color: var(--on-accent, #fff);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.st-offline-banner__sync:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.st-offline-banner__sync:active {
  filter: brightness(0.9);
}

.st-offline-banner__sync:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.st-offline-banner__hint {
  margin: 0;
  padding: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted, #8b949e);
  font-weight: 400;
  min-width: 0;
}

.st-online-only-disabled {
  opacity: 0.55;
}

.offline-fallback {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse at top, #1a2332 0%, transparent 55%),
    #0d1117;
  color: #e6edf3;
  padding: 24px;
  text-align: center;
}

.offline-hub {
  width: min(100%, 420px);
}

.offline-hub__kicker {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b949e;
}

.offline-hub h1 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  line-height: 1.25;
}

.offline-hub__lead {
  margin: 0 0 20px;
  color: #c9d1d9;
  line-height: 1.45;
}

.offline-hub__nav {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}

.offline-hub__link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 10px;
  background: #388bfd;
  color: #fff !important;
  font-weight: 600;
  text-decoration: none !important;
}

.offline-hub__link:active {
  filter: brightness(0.9);
}

.offline-hub__link.is-unavailable {
  background: #30363d;
  color: #8b949e !important;
  pointer-events: none;
}

.offline-hub__audits {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: rgb(22 27 34 / 72%);
  text-align: left;
}

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

.offline-hub__audits-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 0 4px;
}

.offline-hub__audits-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
}

.offline-hub__audits-count {
  min-width: 24px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgb(56 139 253 / 16%);
  color: #79b8ff;
  font-size: 11px;
  font-weight: 700;
}

#offline-audits-list {
  max-height: 140px;
  display: grid;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: #484f58 transparent;
}

#offline-audits-list::-webkit-scrollbar {
  width: 6px;
}

#offline-audits-list::-webkit-scrollbar-track {
  background: transparent;
}

#offline-audits-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #484f58;
}

.offline-hub__audit {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 0 12px;
  border-radius: 8px;
  border: 1px solid rgb(48 54 61 / 72%);
  background: #0d1117;
  color: #e6edf3 !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 600;
}

.offline-hub__audit:hover {
  border-color: #388bfd;
  background: rgb(56 139 253 / 8%);
  text-decoration: none !important;
}

.offline-hub__audit.is-unavailable {
  border-style: dashed;
  color: #8b949e !important;
  cursor: default;
}

.offline-hub__audit.is-unavailable:hover {
  border-color: rgb(48 54 61 / 72%);
  background: #0d1117;
}

.offline-hub__audit:active {
  filter: brightness(1.08);
}

.offline-hub__audit-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-hub__audit-arrow {
  flex: 0 0 auto;
  color: #79b8ff;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.offline-hub__audit.is-unavailable .offline-hub__audit-arrow {
  color: #8b949e;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.offline-hub__hint {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
  color: #c9d1d9;
}

.offline-hub__hint--muted {
  color: #8b949e;
}

.st-offline-ready-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #3fb950 22%, transparent);
  color: #3fb950;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.st-offline-ready-badge[hidden] {
  display: none !important;
}

.btn[data-offline-prepare].is-ready {
  border-color: color-mix(in srgb, #3fb950 45%, var(--border, #30363d));
}

.pwa-install-card {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  width: min(440px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 44px 14px 14px;
  border: 1px solid color-mix(in srgb, var(--accent, #388bfd) 38%, var(--border, #30363d));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface, #161b22) 96%, var(--accent, #388bfd));
  color: var(--text, #e6edf3);
  box-shadow: 0 18px 48px rgb(0 0 0 / 28%);
}

.pwa-install-card__icon,
.pwa-install-card__icon img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.pwa-install-card__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pwa-install-card__copy strong {
  font-size: 14px;
  line-height: 1.25;
}

.pwa-install-card__copy span {
  color: var(--text-muted, #8b949e);
  font-size: 12px;
  line-height: 1.35;
}

.pwa-install-card__action {
  min-height: 44px;
}

.pwa-install-card__dismiss,
.pwa-install-guide__close {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted, #8b949e);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.pwa-install-card__dismiss:hover,
.pwa-install-guide__close:hover {
  background: color-mix(in srgb, var(--text, #e6edf3) 8%, transparent);
  color: var(--text, #e6edf3);
}

.pwa-install-card__dismiss:active,
.pwa-install-guide__close:active {
  filter: brightness(0.8);
}

.pwa-install-guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1290;
  background: rgb(0 0 0 / 58%);
  backdrop-filter: blur(2px);
}

.pwa-install-guide {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 1300;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 24px;
  border: 1px solid var(--border, #30363d);
  border-radius: 16px;
  background: var(--surface, #161b22);
  color: var(--text, #e6edf3);
  box-shadow: 0 24px 70px rgb(0 0 0 / 38%);
}

.pwa-install-guide__kicker {
  margin: 0 0 6px;
  color: var(--accent, #388bfd);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pwa-install-guide h2 {
  margin: 0 32px 16px 0;
  font-size: 20px;
  line-height: 1.25;
}

.pwa-install-guide ol {
  margin: 0 0 20px;
  padding-left: 22px;
  color: var(--text, #e6edf3);
  font-size: 14px;
  line-height: 1.55;
}

.pwa-install-guide li + li {
  margin-top: 8px;
}

.pwa-install-guide__done {
  width: 100%;
  min-height: 44px;
}

@media (max-width: 620px) {
  .pwa-install-card {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 12px 44px 12px 12px;
  }

  .pwa-install-card__icon,
  .pwa-install-card__icon img {
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }

  .pwa-install-card__action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .pwa-install-guide {
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}

