@font-face {
  font-family: 'Inter';
  src: url('inter-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Деловая тема: плоский тёмный фон, без цветных свечений и градиентов.
   Переменные переопределяются в body.theme-*; переключатель — ?themes=1. */
:root {
  --bg: #0a0d12;
  --surface: #10161d;
  --surface-2: #151d26;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e6ebf1;
  --text-secondary: #98a6b5;
  --text-muted: #6b7887;
  --danger: #e5484d;
  --danger-bg: rgba(229, 72, 77, 0.08);

  --accent: #60a5fa;
  --accent-rgb: 96, 165, 250;
  --btn-bg: #2563eb;
  --btn-bg-hover: #1d4ed8;
  --btn-ink: #ffffff;
}

body.theme-blue {
  --accent: #60a5fa;
  --accent-rgb: 96, 165, 250;
  --btn-bg: #2563eb;
  --btn-bg-hover: #1d4ed8;
  --btn-ink: #ffffff;
}

body.theme-sand {
  --accent: #d6c3a1;
  --accent-rgb: 214, 195, 161;
  --btn-bg: #d6c3a1;
  --btn-bg-hover: #e4d4b8;
  --btn-ink: #17130c;
}

body.theme-graphite {
  --accent: #cbd5e1;
  --accent-rgb: 203, 213, 225;
  --btn-bg: #475569;
  --btn-bg-hover: #334155;
  --btn-ink: #f8fafc;
}

body.theme-pine {
  --accent: #9bbf8a;
  --accent-rgb: 155, 191, 138;
  --btn-bg: #3f6212;
  --btn-bg-hover: #365314;
  --btn-ink: #f7fee7;
}

body.theme-burgundy {
  --accent: #d4a3a3;
  --accent-rgb: 212, 163, 163;
  --btn-bg: #7f1d1d;
  --btn-bg-hover: #6b1717;
  --btn-ink: #fff5f5;
}

body.theme-mocha {
  --accent: #c9ab8f;
  --accent-rgb: 201, 171, 143;
  --btn-bg: #6b4f3a;
  --btn-bg-hover: #5a4231;
  --btn-ink: #fdf6f0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(var(--accent-rgb), 0.24);
  color: #f8fafc;
}

button,
input {
  font: inherit;
}

.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-box {
  width: 100%;
  max-width: 440px;
}

/* ── Карточка ─────────────────────────────────────────────────────────── */

.card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: fade-up 0.25s ease both;
}

.brand {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.auth-head h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.auth-head p {
  margin: 0 auto;
  max-width: 340px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ── Форма ────────────────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s;
}

.input-wrap:focus-within .input-icon {
  color: var(--accent);
}

.input-wrap input {
  width: 100%;
  height: 46px;
  padding: 0 13px 0 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1117;
  color: var(--text);
  font-size: 14px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.input-wrap input::placeholder {
  color: var(--text-muted);
}

.input-wrap input:hover {
  border-color: var(--border-strong);
}

.input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.22);
}

.input-wrap input.has-error {
  border-color: var(--danger);
}

.input-wrap input.has-error:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(229, 72, 77, 0.2);
}

.field-error {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--danger);
}

/* ── Кнопки ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25rem;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s,
    transform 0.1s;
}

.btn:active {
  transform: scale(0.99);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.3);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-primary:hover {
  background: var(--btn-bg-hover);
}

.btn-primary:disabled {
  box-shadow: none;
}

.btn-secondary {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--text-secondary);
}

.btn-lg {
  min-height: 48px;
  font-size: 15px;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.soon {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Разделитель и подпись ────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0 16px;
}

.divider-line {
  height: 1px;
  flex: 1;
  background: var(--border);
}

.divider-text {
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.auth-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ── Ввод кода ────────────────────────────────────────────────────────── */

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.back:hover {
  color: var(--accent);
}

.verify-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  margin-top: 20px;
}

.verify-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.verify-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.email-pill {
  display: inline-block;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  word-break: break-all;
}

.code-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 26px;
}

.code-input {
  width: 100%;
  min-width: 0;
  height: 56px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b1117;
  color: var(--text);
  text-align: center;
  font-size: 21px;
  font-weight: 600;
  caret-color: var(--accent);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.code-input:hover {
  border-color: var(--border-strong);
}

.code-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.22);
}

.code-input:disabled {
  opacity: 0.5;
}

.code-row.is-error .code-input {
  border-color: var(--danger);
  animation: shake 0.4s ease;
}

.code-row.is-error .code-input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(229, 72, 77, 0.2);
}

.form-error {
  margin-top: 10px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.5;
}

.banner {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(229, 72, 77, 0.22);
  border-radius: 10px;
  background: var(--danger-bg);
  text-align: center;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--danger);
}

.resend {
  margin-top: 18px;
  text-align: center;
}

.cabinet-note {
  margin: 22px 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ── Выбор расцветки (?themes=1) ──────────────────────────────────────── */

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.theme-picker-label {
  margin-right: 3px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.theme-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  transition:
    border-color 0.15s,
    background-color 0.15s,
    color 0.15s;
}

.theme-swatch::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.theme-swatch:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-swatch.is-active {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text);
}

/* ── Анимации ─────────────────────────────────────────────────────────── */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(3px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}

@media (max-width: 420px) {
  .auth-page {
    padding: 20px 14px;
  }

  .card {
    padding: 22px;
    border-radius: 12px;
  }

  .auth-head h1 {
    font-size: 20px;
  }

  .code-row {
    gap: 8px;
    margin-top: 22px;
  }

  .code-input {
    height: 52px;
    border-radius: 8px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }

  .code-row.is-error .code-input {
    animation: none;
  }

  .btn:active {
    transform: none;
  }
}
