:root{
  --kapo-pay-bg: rgba(15, 23, 42, .55);
  --kapo-pay-card: #ffffff;
  --kapo-pay-card-2: #ffffff;
  --kapo-pay-text: #0f172a;
  --kapo-pay-muted: rgba(15, 23, 42, .66);
  --kapo-pay-border: rgba(15, 23, 42, .12);
  --kapo-pay-primary: #22c55e;
  --kapo-pay-primary-2: #16a34a;
  --kapo-pay-shadow: 0 22px 70px rgba(15, 23, 42, .28);
}

.kapo-pay-overlay{
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: var(--kapo-pay-bg);
  display: grid;
  place-items: center;
  padding: 18px;
  backdrop-filter: blur(6px);
}

.kapo-pay-overlay[hidden]{
  display: none !important;
}

.kapo-pay-card{
  width: min(520px, 100%);
  background: linear-gradient(180deg, var(--kapo-pay-card) 0%, var(--kapo-pay-card-2) 100%);
  color: var(--kapo-pay-text);
  border: 1px solid var(--kapo-pay-border);
  border-radius: 16px;
  box-shadow: var(--kapo-pay-shadow);
  overflow: hidden;
  max-height: min(82vh, 720px);
  overflow: auto;
}

.kapo-pay-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--kapo-pay-border);
}

.kapo-pay-eyebrow{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--kapo-pay-muted);
  margin-bottom: 6px;
}

.kapo-pay-title{
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.kapo-pay-close{
  appearance: none;
  border: 1px solid var(--kapo-pay-border);
  background: rgba(15, 23, 42, .04);
  color: var(--kapo-pay-text);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  line-height: 38px;
  cursor: pointer;
}
.kapo-pay-close:hover{ background: rgba(15, 23, 42, .07); }

#kapoPayBody{ padding: 14px 18px 16px; }

.kapo-pay-loading{
  color: var(--kapo-pay-muted);
  font-size: 14px;
}

.kapo-pay-error{
  margin-top: 10px;
  color: #ffd1d1;
  background: rgba(255, 61, 61, .10);
  border: 1px solid rgba(255, 61, 61, .30);
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
}

.kapo-pay-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}

.kapo-pay-method{
  text-align: left;
  border: 1px solid var(--kapo-pay-border);
  background: rgba(15, 23, 42, .02);
  border-radius: 16px;
  padding: 14px 14px 12px;
  cursor: pointer;
  min-height: 94px;
}
.kapo-pay-method:hover{ background: rgba(15, 23, 42, .05); }
.kapo-pay-method:focus{ outline: 3px solid rgba(34, 197, 94, .32); outline-offset: 2px; }

.kapo-pay-method-label{
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 6px;
}
.kapo-pay-method-desc{
  margin: 0;
  color: var(--kapo-pay-muted);
  font-size: 13px;
  line-height: 1.35;
}

.kapo-pay-footer{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--kapo-pay-border);
}

.kapo-pay-primary,
.kapo-pay-secondary{
  appearance: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--kapo-pay-border);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.kapo-pay-whatsapp{
  border-color: rgba(34, 197, 94, .55);
  background: linear-gradient(180deg, var(--kapo-pay-primary) 0%, var(--kapo-pay-primary-2) 100%);
  color: #ffffff;
}

.kapo-pay-primary{
  border-color: rgba(34, 197, 94, .55);
  background: linear-gradient(180deg, var(--kapo-pay-primary) 0%, var(--kapo-pay-primary-2) 100%);
  color: #ffffff;
}
.kapo-pay-primary:hover{ filter: brightness(1.05); }
.kapo-pay-primary:visited{ color: #ffffff; }

.kapo-pay-secondary{
  background: rgba(15, 23, 42, .04);
  color: var(--kapo-pay-text);
}
.kapo-pay-secondary:hover{ background: rgba(15, 23, 42, .07); }

/* Some legacy checkout CSS overrides <a> colors/underline heavily. */
.kapo-pay-primary.kapo-pay-whatsapp{
  color: #ffffff !important;
  text-decoration: none !important;
}

.kapo-pay-qr-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.kapo-pay-qr-title{
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 4px;
}
.kapo-pay-qr-sub{
  color: var(--kapo-pay-muted);
  font-size: 13px;
}
.kapo-pay-qr-content{
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: center;
}
.kapo-pay-qr-img{
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: rgba(15, 23, 42, .02);
  border: 1px solid var(--kapo-pay-border);
  border-radius: 16px;
}
.kapo-pay-qr-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 760px){
  .kapo-pay-overlay{
    place-items: end center;
    padding: 10px;
  }
  .kapo-pay-card{
    width: min(520px, 100%);
    border-radius: 16px 16px 12px 12px;
    max-height: 86vh;
  }
  .kapo-pay-grid{ grid-template-columns: 1fr; }
  .kapo-pay-qr-content{ grid-template-columns: 1fr; }
  .kapo-pay-qr-img{ width: min(260px, 100%); height: auto; aspect-ratio: 1 / 1; }
}

@media (prefers-reduced-motion: reduce){
  .kapo-pay-overlay *{ scroll-behavior: auto; transition: none !important; }
}
