:root {
  --bg-base: #2f4156;
  --bg-deep: #1f2d40;
  --bg-accent: #3f5979;
  --card: rgba(248, 251, 255, 0.96);
  --line: #c9d6e6;
  --text: #13263b;
  --muted: #5f728a;
  --brand: #1c5e95;
  --brand-2: #3a86d1;
  --ok: #12804a;
  --ok-2: #1fa863;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg-base);
  background-image:
    radial-gradient(560px 300px at 10% -10%, rgba(111, 174, 244, 0.22) 0%, transparent 70%),
    radial-gradient(520px 320px at 100% 0%, rgba(106, 164, 230, 0.2) 0%, transparent 65%),
    linear-gradient(165deg, var(--bg-base) 0%, var(--bg-deep) 100%);
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 14px 44px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #edf4ff;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #80b8f1, #2f79c7 60%, #1b5ea2);
  box-shadow: 0 10px 28px rgba(14, 55, 95, 0.48);
}

.lang-select-form {
  margin: 0;
}

.lang-switch {
  width: 74px;
  height: 40px;
  border: 1px solid rgba(226, 236, 248, 0.46);
  border-radius: 11px;
  padding: 0 26px 0 10px;
  color: #f4f8ff;
  font-size: 20px;
  line-height: 1;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(8px);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f4f8ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  cursor: pointer;
}

.lang-switch:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(130, 186, 245, 0.24);
}

.lang-switch option {
  color: #1e2f44;
  background: #ffffff;
  font-size: 18px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(201, 214, 230, 0.72);
  border-radius: 22px;
  padding: 22px;
  box-shadow:
    0 22px 56px rgba(8, 22, 38, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.title {
  margin: 0 0 12px;
  font-size: 31px;
  line-height: 1.14;
  letter-spacing: -0.4px;
  text-align: center;
  color: #2f4156;
}

.progress {
  margin: 22px 0 26px;
}

.progress-track {
  height: 10px;
  background: #d9e4f2;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 33.33%;
  background: linear-gradient(95deg, #2a6ca5, #5ca1e7);
  box-shadow: 0 0 20px rgba(68, 134, 204, 0.42);
  transition: width 0.45s ease;
}

.progress-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  gap: 8px;
}

.progress-labels span {
  color: #576c87;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

.step {
  display: none;
  animation: fadeIn 0.35s ease;
}

.step.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.step1-flow {
  display: grid;
  gap: 12px;
}

.flow-stage {
  opacity: 0;
  transform: translateY(10px);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    max-height 0.36s ease;
}

.flow-stage.is-visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 230px;
  pointer-events: auto;
}

label {
  display: block;
  font-size: 13px;
  color: #405671;
  margin-bottom: 7px;
  font-weight: 700;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bacbdd;
  border-radius: 13px;
  padding: 12px 13px;
  font-size: 15px;
  line-height: 1.2;
  color: #173049;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8ba0b8;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #4b8fd2;
  box-shadow: 0 0 0 4px rgba(75, 143, 210, 0.18);
}

select {
  height: 50px;
  padding-right: 42px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23557595' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 14px;
}

textarea {
  min-height: 88px;
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 17px;
  background: linear-gradient(118deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(36, 92, 146, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.2);
  transform: none;
}

.btn.secondary {
  background: #e9f0f8;
  color: #243a53;
  box-shadow: none;
}

.btn.success {
  background: linear-gradient(118deg, var(--ok), var(--ok-2));
}

.note {
  background: #f3f8ff;
  border: 1px dashed #b9cde6;
  border-radius: 12px;
  padding: 10px;
  color: #44607e;
  font-size: 13px;
}

.loading-wrap {
  text-align: center;
  padding: 12px 0 22px;
}

.spinner {
  width: 78px;
  height: 78px;
  margin: 10px auto 14px;
  border: 5px solid #d8e6f6;
  border-top-color: #2f79c7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: relative;
  transition: border-color 0.28s ease, background-color 0.28s ease, box-shadow 0.28s ease;
}

.spinner::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60, 168, 106, 0.24) 0%, rgba(60, 168, 106, 0) 70%);
  opacity: 0;
  transform: scale(0.7);
}

.spinner::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 47%;
  width: 24px;
  height: 12px;
  border-left: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: translate(-50%, -50%) rotate(-45deg) scale(0.45);
  transform-origin: center;
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.spinner.is-complete {
  animation: none;
  border-color: #9fdcbb;
  background: linear-gradient(145deg, #1f9f61, #25b169);
  box-shadow: 0 10px 24px rgba(27, 146, 84, 0.34);
}

.spinner.is-complete::before {
  opacity: 1;
  transform: scale(1);
  animation: successPulse 0.75s ease-out;
}

.spinner.is-complete::after {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(-45deg) scale(1);
}

.loading-text {
  color: #2e4d6f;
  font-weight: 800;
  min-height: 20px;
}

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

.kpi {
  background: #f5f9ff;
  border: 1px solid #d3e0f0;
  border-radius: 14px;
  padding: 12px;
}

.kpi .label {
  font-size: 12px;
  color: #58708d;
  margin-bottom: 4px;
}

.kpi .value {
  font-weight: 800;
  font-size: 20px;
  word-break: break-word;
}

.kpi .value.small {
  font-size: 14px;
  font-weight: 700;
}

.wallet-box {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.wallet-logo,
.wallet-qr {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  border: 1px solid #ccd8e7;
  object-fit: contain;
  background: #fff;
}

.address-box {
  background: #f4f9ff;
  border: 1px solid #d3e1f2;
  border-radius: 12px;
  padding: 11px;
  font-size: 14px;
  color: #173049;
  word-break: break-all;
}

.final-summary {
  display: grid;
  gap: 14px;
}

.final-qr-wrap {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  border-radius: 16px;
  border: 1px solid #d1deef;
  background: linear-gradient(165deg, #f8fbff, #edf4fb);
}

.final-qr {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #c8d7eb;
  background: #fff;
  box-shadow: 0 9px 24px rgba(35, 81, 129, 0.17);
}

.final-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 1px solid #c8d7eb;
  background: #fff;
  object-fit: contain;
  padding: 6px;
}

.final-address-section {
  border: 1px solid #d2deee;
  border-radius: 14px;
  background: #f6faff;
  padding: 14px;
}

.final-address-box {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
  background: #fff;
}

.final-copy-row {
  margin-top: 10px;
}

.final-amount-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.final-kpi-lg .value {
  font-size: 23px;
}

.final-meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.final-offer-expiry {
  margin: 0;
  font-size: 14px;
}

.final-offer-expiry strong {
  color: #1d4e7f;
  font-weight: 800;
}

.alert {
  padding: 11px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.alert.ok {
  background: #dcfce7;
  color: #166534;
}

.success-screen {
  text-align: center;
  padding: 30px 12px 16px;
}

.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  background: linear-gradient(120deg, var(--ok), var(--ok-2));
  position: relative;
}

.success-icon::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 16px;
  border-left: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: rotate(-45deg);
  top: 23px;
  left: 20px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

@keyframes successPulse {
  0% {
    opacity: 0;
    transform: scale(0.65);
  }
  55% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 0.65;
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .title {
    font-size: 24px;
  }

  .grid.two,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .wallet-box {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .brand {
    font-size: 16px;
  }

  .lang-switch {
    width: 68px;
    height: 36px;
    font-size: 18px;
    padding-right: 24px;
  }

  .final-qr {
    width: 150px;
    height: 150px;
  }

  .final-amount-row,
  .final-meta-grid {
    grid-template-columns: 1fr;
  }
}
