:root {
  --sp-bg: #fffef8;
  --sp-panel: #fffef8;
  --sp-panel-2: #faf5eb;
  --sp-text: #3d2e1a;
  --sp-muted: #9a8a72;
  --sp-line: rgba(200, 170, 120, 0.25);
  --sp-accent: #E8911A;
  --sp-accent-hover: #D07A0C;
  --sp-error: #c44;
  --sp-shadow: 0 20px 60px rgba(45, 27, 0, 0.18);
}

* { box-sizing: border-box; }

.sp-trigger {
  width: 152px;
  height: 56px;
  border: 1px solid var(--sp-line);
  border-radius: 0;
  background: var(--sp-accent);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232, 145, 26, 0.2);
}

.sp-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(45, 30, 10, 0.45);
  backdrop-filter: blur(10px);
  z-index: 999;
}

.sp-overlay.is-open { display: flex; }

.sp-modal {
  width: min(100%, 360px);
  border: 1px solid var(--sp-line);
  border-radius: 0;
  background: var(--sp-panel);
  box-shadow: var(--sp-shadow);
  padding: 28px 24px;
  position: relative;
}

.sp-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--sp-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.sp-close:hover {
  color: var(--sp-text);
}

.sp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sp-muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.sp-head svg {
  width: 18px;
  height: 18px;
  color: var(--sp-accent);
}

.sp-title {
  margin: 0 0 18px;
  color: var(--sp-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.sp-amounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.sp-amount {
  min-height: 44px;
  border: 1px solid var(--sp-line);
  border-radius: 0;
  background: var(--sp-panel-2);
  color: var(--sp-text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sp-amount:hover {
  border-color: var(--sp-accent);
}

.sp-amount.is-active {
  border-color: var(--sp-accent);
  background: rgba(232, 145, 26, 0.1);
  color: var(--sp-accent);
}

.sp-label {
  display: block;
  margin: 0 0 8px;
  color: var(--sp-muted);
  font-size: 12px;
}

.sp-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--sp-line);
  border-radius: 0;
  background: #fff;
  color: var(--sp-text);
  outline: none;
  padding: 0 14px;
  font-size: 14px;
}

.sp-input:focus {
  border-color: var(--sp-accent);
  box-shadow: 0 0 0 3px rgba(232, 145, 26, 0.1);
}

.sp-pay {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 0;
  background: var(--sp-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 14px;
  transition: background 0.15s ease;
}

.sp-pay:hover {
  background: var(--sp-accent-hover);
}

.sp-pay:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.sp-qr {
  display: none;
  margin-top: 16px;
  text-align: center;
}

.sp-qr.is-visible { display: block; }

.sp-qr-title {
  color: var(--sp-muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.sp-qr-box {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  border-radius: 0;
  background: #fff;
  border: 1px solid var(--sp-line);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sp-qr-box img {
  width: 180px;
  height: 180px;
  display: none;
}

.sp-loading {
  color: var(--sp-muted);
  font-size: 12px;
}

.sp-note {
  margin: 10px 0 0;
  color: var(--sp-muted);
  font-size: 12px;
}

.sp-message {
  min-height: 18px;
  margin-top: 10px;
  color: var(--sp-error);
  font-size: 12px;
}

.sp-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.94);
  opacity: 0;
  pointer-events: none;
  border-radius: 0;
  background: var(--sp-text);
  color: #fff;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--sp-shadow);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 1000;
  white-space: nowrap;
}

.sp-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 460px) {
  .sp-modal { padding: 22px 18px; }
  .sp-amounts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
