.cs-order-popup {
  --wd-popup-width: 690px;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #f8fafc;
}

.cs-order-popup[data-cs-screen="success"] {
  --wd-popup-width: 560px;
  border-radius: 28px;
  background: transparent;
  box-shadow: none;
}

.cs-order-popup__screen {
  display: none;
}

.cs-order-popup__screen.is-active {
  display: block;
}

.cs-order-popup__screen--success.is-active {
  display: flex;
  width: 100%;
}

.cs-order-popup .mfp-close {
  top: 22px;
  right: 22px;
  opacity: 1;
  color: #475569;
}

.cs-order-popup__head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #d7e1ee;
}

.cs-order-popup__head-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #0f1b3d;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
}

.cs-order-popup__head-icon.is-email {
  background: #dbeafe;
  color: #2563eb;
}

.cs-order-popup__head-icon.is-auth {
  background: #fff7ed;
  color: #c2410c;
}

.cs-order-popup__head-icon svg {
  width: 26px;
  height: 26px;
  display: block;
}

.cs-order-popup__head-copy {
  min-width: 0;
}

.cs-order-popup__title {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.12;
  font-weight: 800;
}

.cs-order-popup__subtitle {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.3;
}

.cs-order-popup__body {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.cs-order-popup__success {
  display: flex;
  width: 100%;
  min-height: 520px;
  padding: 56px 40px 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);
  background:
    radial-gradient(circle at 50% 12%, rgba(34, 197, 94, 0.26), transparent 34%),
    linear-gradient(180deg, #f6fff8 0%, #eefaf1 100%);
}

.cs-order-popup__success-icon {
  width: 148px;
  height: 148px;
  margin-bottom: 28px;
  color: #16a34a;
}

.cs-order-popup__success-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cs-order-popup__success-title {
  margin: 0;
  color: #0f172a;
  font-size: 38px;
  line-height: 1.05;
  font-weight: 800;
}

.cs-order-popup__success-text {
  max-width: 420px;
  margin: 16px auto 0;
  color: #334155;
  font-size: 21px;
  line-height: 1.45;
}

.cs-order-popup__success-close {
  min-width: 220px;
  min-height: 54px;
  margin-top: 34px;
  border: 0;
  border-radius: 14px;
  background: #0f1b3d;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 30px rgba(15, 27, 61, 0.24);
}

.cs-order-popup__success-close:hover,
.cs-order-popup__success-close:focus {
  background: #162654;
  color: #ffffff;
}

@media (max-width: 767px) {
  .cs-order-popup[data-cs-screen="success"] {
    --wd-popup-width: calc(100vw - 28px);
    border-radius: 22px;
  }

  .cs-order-popup__success {
    min-height: 420px;
    padding: 36px 22px 32px;
    border-radius: 22px;
  }

  .cs-order-popup__success-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 22px;
  }

  .cs-order-popup__success-title {
    font-size: 30px;
  }

  .cs-order-popup__success-text {
    font-size: 17px;
  }

  .cs-order-popup__success-close {
    width: 100%;
    min-width: 0;
  }
}

.cs-order-popup__summary {
  border: 1px solid #d3deeb;
  border-radius: 14px;
  background: #f1f5f9;
  padding: 22px 22px 18px;
}

.cs-order-popup__summary.is-email-layout {
  background: #f3f4f6;
}

.cs-order-popup__summary-title {
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
  color: #1e293b;
}

.cs-order-popup__summary-items ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.cs-order-popup__summary-items li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #334155;
  font-size: 15px;
  line-height: 1.35;
}

.cs-order-popup__summary-items strong {
  color: #1e293b;
  font-weight: 800;
  white-space: nowrap;
}

.cs-order-popup__summary-empty {
  color: #64748b;
  font-size: 18px;
}

.cs-order-popup__summary-total {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #cad6e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cs-order-popup__summary-total span {
  color: #1e293b;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
}

.cs-order-popup__summary-total strong {
  color: #0f1b3d;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 900;
}

.cs-order-popup__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cs-order-popup__action-card {
  border-radius: 14px !important;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 14px;
  color: #ffffff;
  min-height: 170px;
  padding: 22px 18px;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button.cs-order-popup__action-card,
a.cs-order-popup__action-card {
  width: 100%;
}

.cs-order-popup__action-card.is-operator {
  background: linear-gradient(150deg, #16a34a 0%, #22c55e 100%);
}

.cs-order-popup__action-card.is-email {
  background: linear-gradient(150deg, #2563eb 0%, #3b82f6 100%);
}

.cs-order-popup__auth-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid #d7e1ee;
  border-radius: 16px;
  background: #ffffff;
}

.cs-order-popup__auth-card p {
  margin: 0;
  color: #334155;
  font-size: 16px;
  line-height: 1.5;
}

.cs-order-popup__auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cs-order-popup__auth-btn {
  min-height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.cs-order-popup__auth-btn.is-secondary {
  border: 1px solid #cfd8e6;
  background: #f8fafc;
  color: #1b2b4a;
}

.cs-order-popup__operator-inline {
  color: #166534;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.cs-order-popup__action-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.cs-order-popup__action-icon svg {
  width: 30px;
  height: 30px;
  display: block;
}

.cs-order-popup__action-title {
  display: block;
  width: 100%;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
  text-align: center;
}

.cs-order-popup__action-text {
  display: block;
  width: 100%;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}

.cs-order-popup__action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.cs-order-popup__email-wrap {
  border: 1px solid #d5e0ef;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
}

.cs-order-popup__form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border-top: 1px solid #d7e1ee;
  padding-top: 20px;
}

.cs-order-popup__field {
  display: grid;
  gap: 6px;
}

.cs-order-popup__field--full {
  grid-column: 1 / -1;
}

.cs-order-popup__field label {
  color: #334155;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}

.cs-order-popup__field input,
.cs-order-popup__field textarea {
  border: 1px solid #d2deed;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  min-height: 52px;
  padding: 0 16px;
}

.cs-order-popup__field textarea {
  min-height: 122px;
  padding: 14px 16px;
}

.cs-order-popup__actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.cs-order-popup__submit {
  min-height: 52px;
  width: 100%;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.cs-order-popup__status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: #64748b;
  font-size: 13px;
}

.cs-order-popup__status.is-success {
  color: #15803d;
}

.cs-order-popup__status.is-error {
  color: #b91c1c;
}

.cs-order-popup__back {
  min-height: 44px;
  border: 1px solid #d0dceb;
  border-radius: 12px;
  background: #e5e7eb;
  color: #334155;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}

.cs-order-popup__secondary-back {
  min-height: 42px;
  width: 100%;
  border: 1px solid #d0dceb;
  border-radius: 14px;
  background: #eef2f7;
  color: #475569;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  align-self: start;
}

.cart-widget-side .woocommerce-mini-cart__buttons .cs-order-popup-open {
  width: 100%;
}

@media (max-width: 767px) {
  .cs-order-popup {
    --wd-popup-width: calc(100vw - 16px);
    border-radius: 16px;
  }

  .cs-order-popup__head {
    padding: 16px;
  }

  .cs-order-popup__head-icon {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .cs-order-popup__title {
    font-size: 20px;
  }

  .cs-order-popup__subtitle {
    font-size: 14px;
  }

  .cs-order-popup__body {
    padding: 16px;
    gap: 12px;
  }

  .cs-order-popup__summary-title {
    font-size: 18px;
  }

  .cs-order-popup__summary-items li {
    font-size: 14px;
  }

  .cs-order-popup__summary-total span {
    font-size: 18px;
  }

  .cs-order-popup__summary-total strong {
    font-size: 18px;
  }

  .cs-order-popup__cards {
    grid-template-columns: 1fr;
  }

  .cs-order-popup__auth-actions {
    grid-template-columns: 1fr;
  }

  .cs-order-popup__form {
    grid-template-columns: 1fr;
  }

  .cs-order-popup__actions {
    grid-template-columns: 1fr;
  }
}
/* Match email screen actions to cart modal footer buttons */
.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) !important;
    gap: 14px !important;
    align-items: stretch !important;
    margin-top: 20px !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__submit,
.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__secondary-back {
    width: 100% !important;
    min-height: 66px !important;
    border-radius: 18px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 24px !important;
    box-shadow: none !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__secondary-back {
    background: #fff !important;
    color: #1b2b4a !important;
    border: 1px solid #cfd8e6 !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__submit {
    background: linear-gradient(135deg, #081634 0%, #31476f 100%) !important;
    color: #fff !important;
    border: 0 !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__submit:hover,
.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__submit:focus {
    background: linear-gradient(135deg, #07122b 0%, #2b4065 100%) !important;
    color: #fff !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__secondary-back:hover,
.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__secondary-back:focus {
    background: #f7faff !important;
    color: #1b2b4a !important;
    border-color: #c4cfdf !important;
}

@media (max-width: 767px) {
    .cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__actions {
        grid-template-columns: 1fr !important;
    }
}

/* Live markup keeps secondary back button outside form; align it visually with submit */
.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__form {
    position: relative !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__form .cs-order-popup__actions {
    display: block !important;
    width: calc(50% - 7px) !important;
    max-width: none !important;
    margin-top: 20px !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__form .cs-order-popup__submit {
    width: 100% !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__form .cs-order-popup__status {
    display: block !important;
    width: 100% !important;
    margin-top: 10px !important;
    position: absolute;
}

.cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__form .cs-order-popup__status:empty {
    display: none !important;
    margin: 0 !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] > .cs-order-popup__body > .cs-order-popup__secondary-back {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: calc(50% - 7px) !important;
    min-height: 66px !important;
    border-radius: 18px !important;
    padding: 0 24px !important;
    margin-top: -82px !important;
    margin-left: calc(50% + 7px) !important;
    background: #fff !important;
    color: #1b2b4a !important;
    border: 1px solid #cfd8e6 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    white-space: nowrap !important;
}

.cs-order-popup__screen[data-cs-order-screen="email"] > .cs-order-popup__body > .cs-order-popup__secondary-back:hover,
.cs-order-popup__screen[data-cs-order-screen="email"] > .cs-order-popup__body > .cs-order-popup__secondary-back:focus {
    background: #f7faff !important;
    color: #1b2b4a !important;
    border-color: #c4cfdf !important;
}

@media (max-width: 767px) {
    .cs-order-popup__screen[data-cs-order-screen="email"] .cs-order-popup__form .cs-order-popup__actions,
    .cs-order-popup__screen[data-cs-order-screen="email"] > .cs-order-popup__body > .cs-order-popup__secondary-back {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .cs-order-popup__screen[data-cs-order-screen="email"] > .cs-order-popup__body > .cs-order-popup__secondary-back {
        margin-top: 14px !important;
    }
}
