/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --terra:   #C2552E;
  --safran:  #D4870B;
  --nuit:    #1A1A2E;
  --creme:   #F8F3EE;
  --creme-light: #EDE4D8;
  --border:  #DDD0C4;
  --muted:   #8A7A6E;
  --white:   #FFFFFF;
  --error:   #D32F2F;
  --success: #2E7D32;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

html, body {
  min-height: 100%;
  background: var(--creme);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--nuit);
  -webkit-font-smoothing: antialiased;
}

/* ─── Screens ───────────────────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 40px; }

/* ─── Loader ────────────────────────────────────────────────────────────────── */
.loader-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.loader-ring {
  width: 48px; height: 48px;
  border: 4px solid var(--creme-light);
  border-top-color: var(--terra);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { color: var(--muted); font-size: 14px; }

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.card {
  width: 100%; max-width: 480px;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  width: 100%; max-width: 480px;
  display: flex; justify-content: center;
  margin-bottom: 12px;
}
.logo-pill {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--terra);
  letter-spacing: 0.3px;
}

/* ─── Profile block ─────────────────────────────────────────────────────────── */
.profile-block {
  display: flex; align-items: center; gap: 14px;
}
.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--terra), var(--safran));
  color: var(--white);
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-info h1 {
  font-size: 20px; font-weight: 700; color: var(--nuit);
}
.subtitle {
  font-size: 13px; color: var(--muted); margin-top: 2px;
}

/* ─── Intro text ────────────────────────────────────────────────────────────── */
.intro-text {
  font-size: 14px; color: var(--muted); line-height: 1.6;
  background: var(--creme);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

/* ─── Fields ────────────────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px;
}
.optional { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }

.input-wrap {
  position: relative; display: flex; align-items: center;
}
.input-wrap input {
  flex: 1;
  padding-right: 60px;
}
.input-suffix {
  position: absolute; right: 14px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  pointer-events: none;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  background: var(--creme);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  font-size: 16px;
  color: var(--nuit);
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input:focus { border-color: var(--terra); }
input::placeholder { color: var(--creme-light); }

.hint { font-size: 12px; color: var(--error); padding: 0 4px; }
.hidden { display: none; }

/* ─── Pay button ────────────────────────────────────────────────────────────── */
.btn-pay {
  width: 100%;
  padding: 16px;
  border: none; border-radius: var(--radius-xl);
  background: linear-gradient(90deg, var(--terra), var(--safran));
  color: var(--white);
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-pay:disabled {
  background: linear-gradient(90deg, #B0A09A, #B0A09A);
  cursor: default;
  opacity: 0.6;
}
.btn-pay:not(:disabled):active { transform: scale(0.98); }

.btn-loader {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ─── Result screens ────────────────────────────────────────────────────────── */
.icon-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  align-self: center;
}
.icon-error  { background: #FDECEA; }
.icon-success { background: #E8F5E9; }

.card h2 {
  text-align: center;
  font-size: 20px; font-weight: 700; color: var(--nuit);
}
.card p {
  text-align: center;
  font-size: 14px; color: var(--muted); line-height: 1.6;
}
.success-note {
  font-size: 13px; color: var(--muted);
}
