.payment-modal {
  z-index: 1200;
  padding: 18px;
  overflow-y: auto;
}

.link-creation-overlay {
  position: fixed;
  z-index: 1400;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(50, 25, 35, .34);
  backdrop-filter: blur(4px);
}
.link-creation-overlay[hidden] { display: none !important; }
.link-creation-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 310px);
  padding: 28px 24px;
  border: 1px solid #f1d6de;
  border-radius: 22px;
  background: #fffdfd;
  color: #49343b;
  text-align: center;
  box-shadow: 0 18px 55px rgba(60, 25, 39, .2);
}
.link-creation-card strong { color: var(--primary-color); font-size: 1.15rem; }
.link-creation-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #f4dce3;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: link-creation-spin .8s linear infinite;
}
@keyframes link-creation-spin { to { transform: rotate(360deg); } }

.payment-card {
  width: min(100%, 560px);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  padding: clamp(20px, 5vw, 34px);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  background: #fffdfd;
  box-shadow: 0 24px 80px rgba(99, 35, 53, .24);
}

.payment-kicker {
  margin: 0 0 5px;
  color: var(--primary-color);
  font-size: .85rem;
  font-weight: 700;
}

.payment-description { color: #57434a; line-height: 1.55; }
.payment-price {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--accent-light);
  color: #49343b;
}
.payment-price strong { color: var(--primary-color); font-size: 1.55rem; }
.payment-mode-warning { padding: 12px 14px; border: 1px solid #c4871a; border-radius: 10px; background: #fff6df; color: #68480d; font-weight: 800; line-height: 1.45; }
.payment-mode-warning[hidden] { display: none !important; }
.payment-open-link { display: inline-flex; justify-content: center; grid-column: 1 / -1; padding: 12px 18px; text-decoration: none; }

.payment-status {
  margin: 14px 0;
  padding: 13px 15px;
  border-left: 4px solid var(--primary-color);
  border-radius: 8px;
  background: var(--accent-light);
  color: #4b2933;
  line-height: 1.5;
}
.payment-status[data-state="success"] { border-color: #248354; background: #edf8f1; }
.payment-status[data-state="error"] { border-color: #ba3547; background: #fff0f1; }
.payment-status[data-state="pending"] { border-color: #ca8a22; background: #fff8e9; }

.payment-details {
  display: grid;
  grid-template-columns: minmax(150px, 210px) 1fr;
  gap: 16px;
  align-items: center;
  margin: 18px 0;
}
.payment-qr-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid #eadfe2;
  border-radius: 12px;
  background: white;
}
.payment-details dl { margin: 0; }
.payment-details dl > div { padding: 8px 0; border-bottom: 1px solid #f0e5e8; }
.payment-details dt { color: #765f67; font-size: .78rem; }
.payment-details dd { margin: 3px 0 0; color: #35262c; font-weight: 700; overflow-wrap: anywhere; }
.payment-details .payment-reference { color: var(--primary-color); letter-spacing: .04em; }
.payment-hint, .payment-snapshot-warning { grid-column: 1 / -1; margin: 0; color: #705c63; font-size: .86rem; line-height: 1.5; }
.payment-snapshot-warning { margin: 14px 0; padding: 10px 12px; border-radius: 9px; background: #fff8e9; color: #745414; }
.payment-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.payment-history { margin-top: 18px; border-top: 1px solid #f0e5e8; padding-top: 12px; color: #57434a; }
.payment-history summary { cursor: pointer; font-weight: 700; }
.payment-history #payment-history-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0e5e8; }
.payment-history button { flex: 0 0 auto; }
.payment-actions [hidden], .payment-details[hidden], .payment-snapshot-warning[hidden] { display: none !important; }

.share-qr-area { margin-top: 18px; text-align: center; }
.share-qr-area h4 { margin: 0 0 10px; color: #49343b; }
.share-story-qr { display: flex; justify-content: center; min-height: 210px; margin-bottom: 10px; }
.share-story-qr canvas, .share-story-qr svg, .share-story-qr img { display: block; max-width: min(100%, 240px); height: auto; }
.share-story-qr p { align-self: center; color: #705c63; }

#payment-modal :focus-visible, #share-link-modal :focus-visible { outline: 3px solid var(--primary-hover); outline-offset: 3px; }
@media (max-width: 520px) {
  .payment-details { grid-template-columns: 1fr; }
  .payment-qr-image { width: min(100%, 250px); margin: auto; }
  .payment-card { border-radius: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .payment-modal *, #share-link-modal *, .link-creation-overlay * { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
