/* ============================================================================
   Страница входа «Калмыков Групп» — фирменный стиль Liquid Glass.
   Перенесён из дизайн-системы product_site (variables.css + компоненты входа).
   Чистый CSS, без сборки и без внешних зависимостей в рантайме.
   ========================================================================== */

/* ----- Шрифт Montserrat (self-hosted woff2, latin + cyrillic) ----- */
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/montserrat-cyrillic-400.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/montserrat-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/montserrat-cyrillic-500.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/montserrat-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/montserrat-cyrillic-600.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/montserrat-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/montserrat-cyrillic-700.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/montserrat-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* ----- Токены (подмножество дизайн-системы product_site) ----- */
:root {
  --font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, 'JetBrains Mono', monospace;

  --surface-0: #f5f4f1;
  --surface-1-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.75);
  --surface-3: rgba(255, 255, 255, 0.9);

  --ink-900: #0e0f12;
  --ink-800: #1a1b1f;
  --ink-700: #2a2c31;
  --ink-500: #6b6e78;
  --ink-400: #9094a0;
  --ink-300: #c1c4cc;
  --ink-100: #f0f1f3;

  --accent: #1a1b1f;
  --accent-hover: #2a2c31;
  --accent-contrast: #ffffff;
  --accent-tint: rgba(26, 27, 31, 0.06);
  --accent-ring: rgba(26, 27, 31, 0.25);

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;

  --border-glass: rgba(255, 255, 255, 0.62);
  --border-soft-strong: rgba(20, 20, 22, 0.14);

  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --kg-radius-sm: 0.875rem;
  --kg-radius-lg: 1.75rem;
  --radius-full: 9999px;

  --glass-shadow-strong:
    0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 -1px 0 rgba(255, 255, 255, 0.25) inset,
    0 20px 50px rgba(10, 12, 20, 0.14), 0 4px 10px rgba(10, 12, 20, 0.06);

  --t-fast: 150ms ease;
  --t-normal: 200ms ease;
}

/* ----- База ----- */
*, *::before, *::after { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-family);
  color: var(--ink-900);
  background:
    radial-gradient(1100px 700px at 50% -10%, rgba(71, 165, 250, 0.10), transparent 60%),
    var(--surface-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  gap: 16px;
}

.auth-footer {
  font-size: 12px;
  color: var(--ink-400);
}

/* ----- Карточка ----- */
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  background: var(--surface-2);
  border: 1px solid var(--border-glass);
  border-radius: 28px;
  box-shadow: var(--glass-shadow-strong);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-brand img { height: 40px; width: auto; }

.auth-step { display: flex; flex-direction: column; gap: 16px; }

.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  color: var(--ink-900);
}

.auth-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: var(--ink-700);
}

.auth-subtitle strong { color: var(--ink-900); font-weight: 600; }

/* ----- Поля ----- */
.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}

.input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--ink-900);
  background-color: var(--surface-2);
  border: 1px solid var(--border-soft-strong);
  border-radius: var(--radius-lg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.input::placeholder { color: var(--ink-500); }

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.input:disabled { background-color: var(--surface-3); cursor: not-allowed; }

.input.phone {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.5px;
}

/* поле кода — крупное, моноширинное, «сегментированное» межбуквенным интервалом */
.input.code {
  height: 60px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 14px;
  padding-left: 14px; /* компенсация letter-spacing для центровки */
}

.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap .input { padding-right: 48px; }
.password-toggle {
  position: absolute; right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-500); border-radius: var(--radius-md);
  transition: color var(--t-fast);
}
.password-toggle:hover { color: var(--ink-900); }

.field.has-error .input { border-color: var(--danger); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08); }

.field-error { font-size: 13px; color: var(--danger); }
.field-hint { font-size: 13px; color: var(--ink-500); }

/* ----- Кнопки ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-normal), color var(--t-normal),
    border-color var(--t-normal), transform var(--t-fast), box-shadow var(--t-normal);
}

.btn:focus-visible { outline: 2px solid rgba(26, 27, 31, 0.42); outline-offset: 2px; }
.btn.full { width: 100%; }

.btn-primary {
  background-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 8px 20px var(--accent-ring);
}
.btn-primary:hover:not(:disabled) { background-color: var(--accent-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }

.btn-outline {
  background-color: transparent;
  color: var(--ink-900);
  border-color: var(--border-soft-strong);
}
.btn-outline:hover:not(:disabled) { border-color: var(--ink-700); background-color: var(--accent-tint); }

.btn:disabled {
  background-color: var(--ink-100) !important;
  color: var(--ink-500) !important;
  border-color: var(--border-soft-strong) !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
}

/* индикатор загрузки htmx (показывается во время запроса) */
.btn .spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}
.htmx-request .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Ссылки и вспомогательные ----- */
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-family); font-size: 14px; font-weight: 500;
  color: var(--accent); transition: color var(--t-fast);
}
.link-btn:hover:not(:disabled) { color: var(--ink-900); }
.link-btn:disabled { color: var(--ink-500); cursor: not-allowed; }

.auth-links { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-family); font-size: 14px; font-weight: 500;
  color: var(--ink-700); transition: color var(--t-fast);
}
.back-btn:hover { color: var(--ink-900); }

.resend { text-align: center; font-size: 14px; color: var(--ink-500); }

.agreement {
  margin: 0; text-align: center;
  font-size: 12px; line-height: 1.5; color: var(--ink-500);
}
.agreement a { color: var(--accent); text-decoration: underline; }
.agreement a:hover { text-decoration: none; }

/* ----- Сообщения ----- */
.alert {
  display: flex; gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px; line-height: 1.5;
}
.alert-error {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.16);
}
.alert-notice {
  color: var(--ink-700);
  background: var(--accent-tint);
  border: 1px solid var(--border-soft-strong);
}

/* ----- Выбор режима ----- */
.mode-list { display: flex; flex-direction: column; gap: 10px; }

/* ----- Доступность ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
