body[data-runtime="loading"] {
  background: #f4f7f9;
}

.gateway-page .login-form {
  width: min(100%, 470px);
}

.environment-ribbon {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.gateway-status {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.gateway-error {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.gateway-success {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.gateway-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: #667085;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gateway-divider::before,
.gateway-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: #e4e7ec;
}

.gateway-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: #0d4f6b;
  padding: 10px 0 0;
  font: inherit;
  font-size: 0.88rem;
  text-decoration: underline;
  cursor: pointer;
}

.gateway-loading {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  color: #16384a;
}

.gateway-loading img {
  width: 150px;
  max-height: 110px;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 18px 45px rgba(13, 79, 107, 0.14);
}

.gateway-loading h1 {
  margin: 4px 0 0;
  font-size: 1.5rem;
}

.gateway-loading p {
  margin: 0;
  color: #667085;
}

.gateway-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #dce8ed;
  border-top-color: #0d4f6b;
  border-radius: 999px;
  animation: gateway-spin 0.8s linear infinite;
}

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

body[data-runtime="homologation"] .topbar::after {
  content: 'TESTE / HOMOLOGAÇÃO';
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Na Fase 5, cadastros e gestão já persistem. Somente ações fiscais/IA ainda ficam bloqueadas. */
body[data-runtime="homologation"] [data-action="issue-invoice"],
body[data-runtime="homologation"] [data-action="send-invoice"],
body[data-runtime="homologation"] [data-action="quick-command"],
body[data-runtime="homologation"] [data-action="reset-demo"],
body[data-runtime="homologation"] form[data-form="chat"] button {
  opacity: 0.52;
  cursor: not-allowed;
}

body[data-runtime="homologation"] button[aria-busy="true"] {
  opacity: 0.68;
  cursor: wait;
}

@media (max-width: 850px) {
  body[data-runtime="homologation"] .topbar::after {
    display: none;
  }
}
