:root {
  --bg: #ffffff;
  --surface: #f3f4f6;
  --text: #111418;
  --muted: #6b7280;
  --line: #d9dde3;
  --accent: #2b6cf6;
  --accent-text: #ffffff;
  --danger: #d93838;
  --ok: #1f9d55;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c;
    --surface: #23262b;
    --text: #eef0f3;
    --muted: #9aa1ab;
    --line: #353a41;
    --accent: #4d86ff;
    --danger: #ff6b6b;
    --ok: #3ccf7f;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app { max-width: 480px; margin: 0 auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); }

.top { margin-bottom: 20px; }
.progress { height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.top__step { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.step { display: none; }
.step.is-active { display: block; }

h1 { font-size: 24px; line-height: 1.2; margin: 0 0 8px; }
.lead { margin: 0 0 20px; color: var(--muted); }
.lead b { color: var(--text); font-weight: 600; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; margin-bottom: 6px; }
.field i { color: var(--muted); font-style: normal; }
.field input, .field select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  outline: none;
  appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field__error { display: block; min-height: 0; margin-top: 4px; font-size: 13px; color: var(--danger); }
.field__error:empty { display: none; }

.code-input { font-size: 24px !important; letter-spacing: .5em; text-align: center; }

.btn {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 8px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.is-loading { opacity: .7; pointer-events: none; }
.btn--ghost { color: var(--accent); background: transparent; }
.btn--ghost:disabled { color: var(--muted); }

.link { padding: 0; font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; }

.debug {
  margin: -8px 0 16px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.summary { margin: 0 0 20px; display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; word-break: break-word; }

.form-error { margin: 0 0 12px; color: var(--danger); }

.step--done { text-align: center; padding-top: 40px; }
.done-mark {
  width: 64px; height: 64px; margin: 0 auto 20px;
  display: grid; place-items: center;
  font-size: 32px; color: #fff; background: var(--ok); border-radius: 50%;
}

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 448px; margin: 0 auto; padding: 12px 14px;
  color: #fff; background: #2a2e34; border-radius: 10px; font-size: 14px;
}
