:root {
  --auth-bg: #f5f5f7;
  --auth-bg-soft: #fbfbfd;
  --auth-surface: rgba(255, 255, 255, 0.84);
  --auth-surface-strong: #ffffff;
  --auth-border: rgba(29, 29, 31, 0.08);
  --auth-border-strong: rgba(29, 29, 31, 0.12);
  --auth-text: #1d1d1f;
  --auth-text-soft: #424245;
  --auth-text-muted: #6e6e73;
  --auth-blue: #0071e3;
  --auth-blue-hover: #0077ed;
  --auth-blue-active: #0068d1;
  --auth-danger: #b42318;
  --auth-danger-bg: #fff5f5;
  --auth-danger-border: rgba(180, 35, 24, 0.14);
  --auth-success: #0a7a3f;
  --auth-success-bg: #f2fbf6;
  --auth-success-border: rgba(10, 122, 63, 0.14);
  --auth-shadow-lg: 0 36px 90px rgba(17, 17, 17, 0.12), 0 8px 30px rgba(17, 17, 17, 0.05);
  --auth-shadow-md: 0 22px 54px rgba(17, 17, 17, 0.08), 0 6px 18px rgba(17, 17, 17, 0.04);
  --auth-shadow-sm: 0 12px 28px rgba(17, 17, 17, 0.06);
  --auth-radius-panel: 30px;
  --auth-radius-card: 24px;
  --auth-radius-control: 18px;
  --auth-transition: 180ms ease;
}

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

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

body.auth-page {
  margin: 0;
  color: var(--auth-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 113, 227, 0.08), transparent 30%),
    radial-gradient(circle at 100% 12%, rgba(0, 113, 227, 0.05), transparent 24%),
    linear-gradient(180deg, var(--auth-bg) 0%, var(--auth-bg-soft) 100%);
}

body.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.36), transparent 78%);
  pointer-events: none;
  opacity: 0.28;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.auth-shell {
  position: relative;
  width: min(100%, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
  gap: 22px;
}

.auth-brand-wrap {
  display: flex;
  justify-content: center;
}

.auth-brand__logo {
  width: 148px;
  height: auto;
}

.auth-panel {
  position: relative;
  width: min(100%, 460px);
  border-radius: var(--auth-radius-panel);
  background: var(--auth-surface);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--auth-shadow-lg);
  backdrop-filter: blur(24px);
  overflow: hidden;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.24));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.auth-panel__header,
.auth-panel__body,
.auth-panel__footer {
  position: relative;
  z-index: 1;
}

.auth-panel__header {
  padding: 28px 28px 0;
  text-align: center;
}

.auth-panel__badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.07);
  color: var(--auth-text-muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 auto;
}

.auth-panel__title {
  margin: 14px 0 8px;
  font-size: 32px;
  line-height: 1.02;
  letter-spacing: -0.05em;
  font-weight: 600;
}

.auth-panel__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--auth-text-muted);
}

.auth-panel__body {
  padding: 24px 28px 18px;
}

.auth-panel__footer {
  padding: 0 28px 24px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--auth-text-muted);
}

.auth-panel__footer-copy {
  padding-top: 18px;
  border-top: 1px solid rgba(29, 29, 31, 0.06);
  text-align: center;
}

.alert {
  border-radius: 20px;
  border: 1px solid transparent;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.alert--error {
  background: var(--auth-danger-bg);
  border-color: var(--auth-danger-border);
  color: var(--auth-danger);
}

.alert--success {
  background: var(--auth-success-bg);
  border-color: var(--auth-success-border);
  color: var(--auth-success);
}

.is-hidden {
  display: none !important;
}

.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.form-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--auth-text-soft);
}

.form-link,
.inline-link {
  color: var(--auth-blue);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  transition: color var(--auth-transition), opacity var(--auth-transition);
}

.form-link:hover,
.inline-link:hover {
  color: var(--auth-blue-hover);
}

.input-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-control);
  background: rgba(255, 255, 255, 0.92);
  padding: 0 18px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--auth-text);
  outline: none;
  transition:
    border-color var(--auth-transition),
    box-shadow var(--auth-transition),
    background var(--auth-transition),
    transform var(--auth-transition);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

textarea.form-input {
  min-height: 124px;
  padding: 16px 18px;
  resize: vertical;
}

.form-input::placeholder {
  color: #8e8e93;
  font-weight: 450;
}

.form-input:hover {
  border-color: rgba(0, 113, 227, 0.18);
  background: #ffffff;
}

.form-input:focus {
  border-color: rgba(0, 113, 227, 0.54);
  background: #ffffff;
  box-shadow:
    0 0 0 4px rgba(0, 113, 227, 0.12),
    0 16px 36px rgba(0, 113, 227, 0.08);
}

.form-input--code {
  text-align: center;
  letter-spacing: 0.26em;
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.form-hint,
.input-hint,
.form-note,
.resend-note,
.subtle-copy {
  font-size: 13px;
  line-height: 1.6;
  color: var(--auth-text-muted);
}

.form-hint,
.input-hint {
  margin-top: 8px;
}

.form-note,
.subtle-copy {
  margin-top: 14px;
}

.resend-note {
  margin-top: 10px;
  text-align: center;
}

.input-wrap--password .form-input {
  padding-right: 60px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #86868b;
  cursor: pointer;
  transition:
    background var(--auth-transition),
    color var(--auth-transition),
    transform var(--auth-transition);
}

.password-toggle:hover {
  background: rgba(0, 113, 227, 0.08);
  color: var(--auth-blue);
}

.password-toggle:focus-visible,
.form-link:focus-visible,
.inline-link:focus-visible,
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  margin: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 18px;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform var(--auth-transition),
    box-shadow var(--auth-transition),
    background var(--auth-transition),
    border-color var(--auth-transition),
    color var(--auth-transition),
    opacity var(--auth-transition);
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.button--primary {
  background: linear-gradient(180deg, #1482f0 0%, var(--auth-blue) 100%);
  color: #ffffff;
  box-shadow:
    0 18px 36px rgba(0, 113, 227, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button--primary:hover {
  background: linear-gradient(180deg, #1d89f6 0%, var(--auth-blue-hover) 100%);
}

.button--primary:active {
  background: linear-gradient(180deg, #107be8 0%, var(--auth-blue-active) 100%);
}

.button--secondary {
  background: rgba(255, 255, 255, 0.84);
  border-color: var(--auth-border);
  color: var(--auth-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.button--secondary:hover {
  color: var(--auth-blue);
  border-color: rgba(0, 113, 227, 0.18);
}

.button-stack,
.code-actions {
  display: grid;
  gap: 12px;
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--auth-text-muted);
}

.status-card {
  display: grid;
  gap: 12px;
  text-align: center;
}

.status-card__title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.status-card__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--auth-text-muted);
}

.recaptcha-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 18px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.is-valid {
  border-color: #24a148 !important;
  box-shadow: 0 0 0 4px rgba(36, 161, 72, 0.12) !important;
}

.is-invalid {
  border-color: #d82c3e !important;
  box-shadow: 0 0 0 4px rgba(216, 44, 62, 0.12) !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 920px) {
  .auth-shell {
    width: min(100%, calc(100% - 28px));
    padding-top: 18px;
  }

  .auth-panel {
    width: 100%;
  }
}

@media (max-width: 640px) {
  body.auth-page::before {
    background-size: 56px 56px;
  }

  .auth-shell {
    width: min(100%, calc(100% - 18px));
    padding-bottom: 24px;
  }

  .auth-panel__badge {
    font-size: 12px;
  }

  .auth-panel {
    border-radius: 24px;
  }

  .auth-panel__header {
    padding: 22px 20px 0;
  }

  .auth-panel__body {
    padding: 20px 20px 16px;
  }

  .auth-panel__footer {
    padding: 0 20px 20px;
  }

  .auth-panel__title {
    font-size: 28px;
  }

  .auth-panel__text {
    font-size: 13px;
  }

  .form-input,
  .button {
    min-height: 54px;
    border-radius: 16px;
  }

  .form-input--code {
    font-size: 24px;
    letter-spacing: 0.2em;
  }

  .password-toggle {
    width: 38px;
    height: 38px;
    right: 8px;
  }
}
