:root {
  --bg-subtle: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #c8c8cc;
  --text: #18181b;
  --text-muted: #52525b;
  --text-light: #a1a1aa;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eef2ff;
  --accent-border: #c7d2fe;
  --accent-2: #0d9488;
  --accent-2-light: #f0fdfa;
  --accent-2-border: #99f6e4;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #991b1b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-lg: 0 20px 40px -12px rgba(79,70,229,.16);
  --ease: 0.15s ease;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Space Grotesk", var(--font);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background:
    radial-gradient(560px circle at 12% 8%, var(--accent-light) 0%, transparent 60%),
    radial-gradient(560px circle at 88% 92%, var(--accent-2-light) 0%, transparent 60%),
    var(--bg-subtle);
}

main { width: 100%; max-width: 420px; }

/* ---------- лёгкая анимация появления (не «грузящая») ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.logo,
.card,
.trust-badge {
  animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.card { animation-delay: 0.05s; }
.trust-badge { animation-delay: 0.15s; }

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
  margin-bottom: 1.75rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }
.logo-mark { flex-shrink: 0; display: block; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.card-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.banner-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input-wrapper { position: relative; }

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.25rem;
  font-family: inherit;
}
.password-toggle:hover { color: var(--accent); }

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
}
input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: var(--accent);
}
.checkbox-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  font-weight: 400;
}

button[type="submit"] {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
button[type="submit"]:hover { background: var(--accent-hover); }
button[type="submit"]:active { transform: translateY(1px); }
button[type="submit"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
button[type="submit"]:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
  transform: none;
}
button[type="submit"]:disabled:hover { background: var(--border-strong); }

.btn-link {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  text-decoration: none;
}
.btn-link:hover { background: var(--accent-hover); }
.btn-link:active { transform: translateY(1px); }

.secondary-links {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.8125rem;
}
.secondary-links a,
.back-link a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--ease);
}
.secondary-links a:hover,
.back-link a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.back-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
}

/* ---------- АНИМАЦИЯ «ВЕДУТСЯ РАБОТЫ» ---------- */

.spinner {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
}
.spinner::before,
.spinner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 4px solid transparent;
}
.spinner::before {
  inset: 0;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  animation: spinCW 1s linear infinite;
}
.spinner::after {
  inset: 10px;
  border-bottom-color: var(--accent-2);
  border-left-color: var(--accent-2);
  animation: spinCCW 1.4s linear infinite;
}
@keyframes spinCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes spinCCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

.status-badge {
  display: flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  background: var(--accent-2-light);
  border: 1px solid var(--accent-2-border);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin: 0 auto 1rem;
}
.status-badge--static .pulse-dot { animation: none; opacity: 1; transform: none; }
.status-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.dot-pulse {
  display: inline-flex;
  gap: 8px;
  margin: 0.75rem 0 0.5rem;
}
.dot-pulse span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.2s ease-in-out infinite;
}
.dot-pulse span:nth-child(2) {
  animation-delay: 0.15s;
  background: var(--accent-2);
}
.dot-pulse span:nth-child(3) {
  animation-delay: 0.30s;
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.25); }
}

.progress {
  position: relative;
  height: 6px;
  width: 100%;
  background: var(--accent-light);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 1.25rem;
}
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: slideBar 1.6s linear infinite;
}
@keyframes slideBar {
  from { transform: translateX(-100%); }
  to   { transform: translateX(250%); }
}

/* ---------- 404 ---------- */

.error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 14px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
}

.error-code {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
  border: 0;
}

.note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.trust-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
}
.trust-badge .flag {
  width: 20px;
  height: 15px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ---------- модальное окно «ведутся работы» (без анимации загрузки) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(24, 24, 27, 0.5);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.is-open { opacity: 1; }

.modal {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  text-align: center;
  transform: translateY(6px) scale(0.98);
  transition: transform 0.18s ease;
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); }

.modal .card-header { margin-bottom: 1.5rem; }

button.btn-link {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

@media (max-width: 480px) {
  .card { padding: 1.5rem; }
  .secondary-links { flex-direction: column; gap: 0.5rem; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  /* глушим только бесконечные «загрузочные» анимации, разовое появление карточки не трогаем */
  .spinner::before,
  .spinner::after,
  .status-badge .pulse-dot,
  .dot-pulse span,
  .progress-bar {
    animation: none !important;
  }
}