/* Мгновенный boot-splash PWA — до отрисовки тяжёлого dashboard */

#btgBootSplash {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: #0b1224;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

#btgBootSplash.btg-boot-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#btgBootSplash .btg-boot-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

#btgBootSplash .btg-boot-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

#btgBootSplash .btg-boot-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

#btgBootSplash .btg-boot-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(148, 163, 184, 0.25);
  border-top-color: #4880ff;
  animation: btg-boot-spin 0.75s linear infinite;
}

@keyframes btg-boot-spin {
  to { transform: rotate(360deg); }
}

/* Баннер автообновления PWA */
#btgPwaUpdateBanner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483600;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

#btgPwaUpdateBanner.is-visible {
  display: flex;
}

#btgPwaUpdateBanner .btg-pwa-update-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

#btgPwaUpdateBanner .btg-pwa-update-btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  background: #4880ff;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#btgPwaUpdateBanner .btg-pwa-update-dismiss {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

/* ——— Подсказка: нативная кнопка в умной строке (Яндекс / Chrome) ——— */
#btgPwaSmartBarHint {
  display: none;
  position: fixed;
  z-index: 10055;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: 12px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
}

#btgPwaSmartBarHint.is-visible {
  display: flex;
}

html.standalone-app #btgPwaSmartBarHint,
html.pwa-standalone #btgPwaSmartBarHint {
  display: none !important;
}

.btg-pwa-smartbar-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btg-pwa-smartbar-title {
  font-size: 13px;
  font-weight: 700;
}

.btg-pwa-smartbar-text {
  color: #cbd5e1;
  line-height: 1.35;
  font-size: 12px;
}

.btg-pwa-smartbar-help {
  flex-shrink: 0;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  background: #4880ff;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btg-pwa-smartbar-dismiss {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

/* ——— Установка PWA (legacy banner) ——— */
#btgPwaInstallBanner {
  display: none;
  position: fixed;
  z-index: 10050;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.4);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
}

#btgPwaInstallBanner.is-visible {
  display: flex;
}

html.standalone-app #btgPwaInstallBanner,
html.pwa-standalone #btgPwaInstallBanner {
  display: none !important;
}

.btg-pwa-install-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btg-pwa-install-title {
  font-size: 14px;
  font-weight: 700;
}

.btg-pwa-install-text {
  color: #94a3b8;
  line-height: 1.35;
}

.btg-pwa-install-btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #4880ff;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btg-pwa-install-dismiss {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

#btgPwaInstallModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10060;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.55);
}

#btgPwaInstallModal.is-visible {
  display: flex;
}

.btg-pwa-install-modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  padding: 20px 18px 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.btg-pwa-install-modal-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.btg-pwa-install-modal-card ol {
  margin: 0 0 12px;
  padding-left: 20px;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
}

.btg-pwa-install-modal-card li {
  margin-bottom: 8px;
}

.btg-pwa-install-note {
  margin: 0 0 14px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.btg-pwa-install-modal-ok {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: #4880ff;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btg-pwa-install-modal-x {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
