.gold-pwa-panel,
.gold-pwa-toast {
  --gold-pwa-navy: #0c3250;
  --gold-pwa-navy-hover: #164d73;
  --gold-pwa-gold: #f3b515;
  position: fixed;
  z-index: 2147483000;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 32px));
  color: #f8fbfd;
  background: var(--gold-pwa-navy);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 4px solid var(--gold-pwa-gold);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(3, 20, 33, 0.3), 0 3px 10px rgba(3, 20, 33, 0.18);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.gold-pwa-live-region {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gold-pwa-panel {
  padding: 20px;
}

.gold-pwa-panel__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 28px;
}

.gold-pwa-panel__icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  object-fit: cover;
}

.gold-pwa-panel__heading {
  min-width: 0;
}

.gold-pwa-panel__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #dce8ef;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.gold-pwa-panel__close:hover {
  color: #ffffff;
  background: var(--gold-pwa-navy-hover);
}

.gold-pwa-panel__close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.gold-pwa-panel__eyebrow {
  margin: 0 0 6px;
  color: #ffd66d;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gold-pwa-panel__title {
  margin: 0;
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.3;
  text-wrap: balance;
}

.gold-pwa-panel__copy {
  margin: 12px 0 0;
  color: #dce8ef;
  font-size: 0.92rem;
  line-height: 1.5;
}

.gold-pwa-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.gold-pwa-panel__button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 780;
  cursor: pointer;
  touch-action: manipulation;
}

.gold-pwa-panel__button--primary {
  color: #102a3e;
  background: var(--gold-pwa-gold);
  border-color: var(--gold-pwa-gold);
}

.gold-pwa-panel__button--primary:hover {
  background: #ffd05a;
  border-color: #ffd05a;
}

.gold-pwa-panel__button--secondary {
  color: #ffffff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
}

.gold-pwa-panel__button--secondary:hover {
  background: var(--gold-pwa-navy-hover);
  border-color: rgba(255, 255, 255, 0.7);
}

.gold-pwa-panel__button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.gold-pwa-panel__button:focus-visible,
.gold-pwa-toast:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

/* ---------- Faixa fixa de instalação (portal do cliente, celular) ----------
   Mora dentro de #mu-bottombar, na linha seguinte à do perfil/estatísticas.
   Fora do celular o rodapé inteiro é display:none, então a faixa some junto. */

.gold-pwa-install-bar {
  display: none;
}

@media (max-width: 640px) {
  /* Espaço extra que o rodapé passa a ocupar: quem reserva altura para a
     barra soma esta variável (portal-cliente.css e usina-selecionada.css). */
  body.gold-pwa-has-install-bar {
    --gold-pwa-install-bar-space: 58px;
  }

  body.gold-pwa-has-install-bar .mu-bottombar {
    flex-wrap: wrap;
  }

  .mu-bottombar .gold-pwa-install-bar {
    order: 1;
    flex: 1 0 100%;
    max-width: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    margin-top: 8px;
    padding: 6px 8px 6px 6px;
    text-align: left;
    color: var(--mu-ink, #1a2c3d);
    background: var(--mu-brand-soft, #dceaf5);
    border: 0;
    border-radius: 12px;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .gold-pwa-install-bar__icon {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .gold-pwa-install-bar__text {
    display: grid;
    gap: 1px;
    min-width: 0;
  }

  .gold-pwa-install-bar__text strong {
    color: var(--mu-ink, #1a2c3d);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
  }

  .gold-pwa-install-bar__text span {
    overflow: hidden;
    color: var(--mu-muted, #62778a);
    font-size: 0.68rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .gold-pwa-install-bar__cta {
    flex: none;
    margin-left: auto;
    padding: 8px 14px;
    color: #0d3f65;
    background: var(--mu-sun, #f1b545);
    border-radius: 9px;
    font-size: 0.76rem;
    font-weight: 800;
  }

  .gold-pwa-install-bar:active {
    transform: scale(0.99);
  }

  .gold-pwa-install-bar:disabled {
    cursor: wait;
    opacity: 0.7;
  }

  .gold-pwa-install-bar:focus-visible {
    outline: 3px solid var(--mu-brand, #164f7a);
    outline-offset: 2px;
  }
}

.gold-pwa-toast {
  min-height: 64px;
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.gold-pwa-toast strong,
.gold-pwa-toast span {
  display: block;
  overflow-wrap: anywhere;
}

.gold-pwa-toast strong { color: #ffffff; font-size: 0.94rem; }
.gold-pwa-toast span { color: #dce8ef; font-size: 0.86rem; line-height: 1.4; }

@media (max-width: 560px) {
  .gold-pwa-panel,
  .gold-pwa-toast {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    width: auto;
  }

  .gold-pwa-panel__actions { display: grid; grid-template-columns: 1fr; }
  .gold-pwa-panel__button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .gold-pwa-panel,
  .gold-pwa-toast { scroll-behavior: auto; }
}
