/*
  Общий стиль для страниц авторизации/регистрации
  ────────────────────────────────────────────────
  /login   /register-user   /register-angel   /register-fund

  Mobile:  full-width, без карточки, тонкий padding
  Desktop: центрированная карточка на сером фоне
*/

:root {
  --accent: #A8002C;
  --accent-dark: #8e0024;
  --accent-soft: rgba(168, 0, 44, 0.08);
  --bg: #fff;
  --bg-soft: #f4f5f7;
  --bg-card: #fafafa;
  --text: #0f0f10;
  --text-soft: #6b6b70;
  --text-muted: #a0a0a5;
  --border: #ececef;
  --border-strong: #d8d8dc;
  --danger: #ff3b30;
  --success: #34c759;
  --shadow-md: 0 6px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.10);
  --radius: 14px;
  --radius-lg: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; }

/* ─── Контейнер страницы ─────────────────────────── */
.auth-page {
  min-height: 100vh;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
}
.auth-page__inner {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.auth-page__top {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
.back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 20px;
  flex-shrink: 0;
  transition: 0.15s;
}
.back-btn:hover { background: #ebecf0; }
.page-title {
  font-size: 22px; font-weight: 700; margin: 0;
  letter-spacing: -0.01em;
}

/* ─── Заголовок секции ───────────────────────────── */
.section-hero { margin-bottom: 24px; }
.section-hero h1 {
  font-size: 28px; font-weight: 700; margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.section-hero p {
  color: var(--text-soft); margin: 0; font-size: 15px;
  line-height: 1.45;
}

/* ─── Формы ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; position: relative; }
.label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text-soft);
}
.input, .textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 16px;        /* 16px чтобы iOS не зумил */
  outline: none;
  font-family: inherit;
  color: var(--text);
  transition: 0.15s;
  -webkit-appearance: none;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .textarea:focus {
  border-color: var(--accent);
  background: #fff;
}
.input.error, .textarea.error {
  border-color: var(--danger);
  background: #fff5f5;
}
.error-msg {
  display: block;
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  min-height: 14px;
}
.field-hint {
  display: block; font-size: 12px;
  color: var(--text-muted); margin-top: 6px;
}

/* ─── File input (кастомный) ─────────────────────── */
.file-row { position: relative; }
.file-row input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.file-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 14px;
  transition: 0.15s;
}
.file-btn:hover { border-color: var(--accent); color: var(--accent); }
.file-btn .icon {
  width: 36px; height: 36px;
  background: #fff; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.file-btn.is-filled { color: var(--text); border-style: solid; border-color: var(--success); }
.file-btn .file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview {
  width: 80px; height: 80px; border-radius: 12px;
  object-fit: cover; flex-shrink: 0;
}

/* ─── Группа card-реквизитов ─────────────────────── */
.fieldset {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 6px;
  margin-bottom: 16px;
}
.fieldset__title {
  font-size: 13px; font-weight: 600;
  color: var(--text-soft); margin: 0 0 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ─── Кнопки ─────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 14px 16px;
  border-radius: 12px;
  font-size: 15px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; transition: 0.15s;
  font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { background: #e0e0e3; color: #a0a0a5; cursor: not-allowed; }
.btn-secondary { background: var(--bg-soft); color: var(--text); }
.btn-secondary:hover { background: #ebecf0; }
.btn-link {
  background: none; color: var(--text-soft);
  padding: 10px; font-weight: 500; font-size: 14px;
}
.btn-link:hover { color: var(--text); }

.form-actions { margin-top: 12px; }

/* ─── Code input ─────────────────────────────────── */
.code-input {
  width: 100%; padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 28px; letter-spacing: 12px;
  text-align: center; outline: none;
}
.code-input:focus { background: #fff; border-color: var(--accent); }

/* ─── Шаги (.step) ──────────────────────────────── */
.step { display: none; }
.step.is-active { display: block; }

/* ─── Спиннер и статус ───────────────────────────── */
.status-box {
  text-align: center; padding: 40px 16px;
}
.status-box .spinner-lg {
  width: 52px; height: 52px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-box h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.status-box p { margin: 0; color: var(--text-soft); font-size: 14px; }

/* ─── DESKTOP (≥ 769px) ─────────────────────────── */
@media (min-width: 769px) {
  body { background: var(--bg-soft); }

  .auth-page {
    padding: 60px 24px;
    align-items: center;
    justify-content: flex-start;
  }
  .auth-page__inner {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 36px;
    border: 1px solid var(--border);
    max-width: 480px;
    flex: 0 0 auto;
  }
  .auth-page__inner.wide {
    max-width: 640px;
  }

  .section-hero h1 { font-size: 32px; }
  .input, .textarea { padding: 13px 14px; font-size: 15px; }
  .file-btn { padding: 16px; }
  .btn { padding: 13px 16px; }
}

/* ─── MOBILE (≤ 768px) ──────────────────────────── */
@media (max-width: 768px) {
  .auth-page { padding: 16px 16px 40px; }
  .section-hero h1 { font-size: 24px; }
}
