.instpay-payment-body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, #eef2f7 0%, #f8fafc 100%);
  color: #1f2937;
}

.instpay-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.instpay-card {
  width: min(480px, 100%);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.instpay-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eef2f7;
  background: #fafbfc;
}

.instpay-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.instpay-brand-logo {
  height: 20px;
  width: auto;
}

.instpay-close-link,
.instpay-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.instpay-close-link:hover,
.instpay-modal-close:hover {
  background: #eef2f7;
  color: #111827;
}

.instpay-card-body {
  padding: 36px 28px 28px;
  text-align: center;
}

.instpay-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 22px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: instpay-spin 0.8s linear infinite;
}

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

.instpay-title {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 700;
  color: #111827;
}

.instpay-subtitle,
.instpay-status-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #6b7280;
}

.instpay-subtitle {
  margin-bottom: 14px;
}

.instpay-order-ref {
  display: inline-block;
  margin: 0 0 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.instpay-status-text {
  min-height: 24px;
}

.instpay-card-footer {
  padding: 0 28px 28px;
  text-align: center;
}

.instpay-cancel-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.instpay-cancel-link:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #111827;
}

.instpay-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.instpay-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.instpay-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, calc(100vw - 24px));
  height: min(760px, calc(100vh - 24px));
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
}

.instpay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eef2f7;
  background: #fafbfc;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

#instpay-iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
}

.instpay-iframe-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.instpay-iframe-stage #instpay-iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.instpay-iframe-loading {
  z-index: 2;
}

.instpay-iframe-stage.is-loading-iframe .instpay-iframe-loading {
  display: flex !important;
}

.instpay-modal.is-preparing .instpay-iframe-stage {
  display: none;
}

.instpay-modal.is-preparing #instpay-modal-loading {
  display: flex;
  flex: 1;
  position: relative;
  inset: auto;
}

.instpay-shell.is-hidden {
  display: none;
}

.instpay-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  z-index: 1;
  text-align: center;
  padding: 40px 20px;
  box-sizing: border-box;
}

.instpay-modal-loading .instpay-spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
  margin-bottom: 16px;
}

.instpay-modal-loading-text {
  margin: 0 0 12px;
  font-size: 15px;
  color: #6b7280;
}

.instpay-modal.is-preparing #instpay-iframe {
  display: none !important;
}

.instpay-error .instpay-spinner {
  display: none;
}

.instpay-error .instpay-status-text {
  color: #b45309;
}

@media (max-width: 520px) {
  .instpay-card-body {
    padding: 28px 20px 22px;
  }

  .instpay-card-footer {
    padding: 0 20px 20px;
  }

  .instpay-title {
    font-size: 21px;
  }
}
