body.auth-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top center, rgba(var(--accent-rgb), 0.12), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-family-base);
}

body.auth-page *,
body.auth-page *::before,
body.auth-page *::after {
  box-sizing: border-box;
}

.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px 48px;
}

.auth-layout__inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  min-width: 0;
}

.auth-layout__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-brand:hover,
.auth-brand:focus {
  color: var(--link-hover);
  text-decoration: none;
}

.auth-brand__image {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
}

.auth-brand__text {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
}

.auth-theme-toggle {
  display: inline-flex;
  align-items: center;
}

.auth-theme-toggle .theme-switch {
  --toggle-size: 16px;
  margin-left: 0;
}

.auth-card {
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 34px 36px 30px;
  border-radius: var(--radius-xl);
  background: var(--surface-gradient), var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-strong);
}

.auth-card--sm {
  max-width: 520px;
}

.auth-card--wide {
  max-width: 980px;
}

.auth-card__header {
  margin-bottom: 28px;
}

.auth-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.auth-subtitle {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.messages {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-xs);
}

.alert p,
.alert ul,
.alert div {
  margin: 0;
}

.alert > * + * {
  margin-top: 6px;
}

.alert-danger,
.alert-error {
  background: var(--danger-soft);
  color: var(--danger-color);
  border-color: var(--danger-soft-strong);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success-color);
  border-color: var(--success-soft-strong);
}

.alert-warning {
  background: var(--warning-soft);
  color: var(--warning-color);
  border-color: var(--warning-soft-strong);
}

.alert-info {
  background: var(--info-soft);
  color: var(--info-color);
  border-color: var(--info-soft-strong);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.auth-summary {
  margin-bottom: 0;
}

.auth-summary__title {
  font-weight: 700;
}

.register-form__layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 0;
  align-items: start;
}

.register-form__col {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  height: 100%;
}

.register-form__password-group {
  margin-top: 0;
}

.form-group {
  min-width: 0;
  min-height: 112px;
}

.register-form__password-group {
  min-height: 134px;
}

.form-group > label:not(.checkbox-text):not(.neon-checkbox):not(.password-toggle) {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.input-container {
  position: relative;
  width: 100%;
  padding-top: 18px;
}

body.auth-page .auth-form .input-container > input[type="text"],
body.auth-page .auth-form .input-container > input[type="email"],
body.auth-page .auth-form .input-container > input[type="password"],
body.auth-page .auth-form .input-container > input[type="tel"] {
  width: 100%;
  min-height: 52px !important;
  height: 52px;
  padding: 18px 0 6px !important;
  border: 0 !important;
  border-bottom: 2px solid var(--input-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--input-text) !important;
  font-size: 20px;
  line-height: 1.25;
  outline: none !important;
  box-sizing: border-box;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.25s ease, color 0.25s ease;
}

body.auth-page .auth-form .input-container > input[type="password"] {
  padding-right: 44px !important;
}

body.auth-page .auth-form .input-container > input[type="text"]:focus,
body.auth-page .auth-form .input-container > input[type="email"]:focus,
body.auth-page .auth-form .input-container > input[type="password"]:focus,
body.auth-page .auth-form .input-container > input[type="tel"]:focus {
  border: 0 !important;
  border-bottom: 2px solid var(--accent-color-strong) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.auth-page .auth-form .input-container > .label {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  justify-content: flex-start;
  align-items: flex-start;
  letter-spacing: normal;
  position: absolute;
  top: 24px;
  left: 0;
  color: var(--text-soft);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  transform-origin: left top;
  transition: transform 0.25s ease, color 0.25s ease, top 0.25s ease;
  pointer-events: none;
}

body.auth-page .auth-form .input-container > input[type="text"]:focus ~ .label,
body.auth-page .auth-form .input-container > input[type="text"]:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input[type="email"]:focus ~ .label,
body.auth-page .auth-form .input-container > input[type="email"]:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input[type="password"]:focus ~ .label,
body.auth-page .auth-form .input-container > input[type="password"]:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input[type="tel"]:focus ~ .label,
body.auth-page .auth-form .input-container > input[type="tel"]:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input:-webkit-autofill ~ .label {
  top: 2px;
  transform: scale(0.78);
  color: var(--text);
}

body.auth-page .auth-form .input-container > .underline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-color-strong);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}

body.auth-page .auth-form .input-container > input[type="text"]:focus ~ .underline,
body.auth-page .auth-form .input-container > input[type="text"]:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input[type="email"]:focus ~ .underline,
body.auth-page .auth-form .input-container > input[type="email"]:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input[type="password"]:focus ~ .underline,
body.auth-page .auth-form .input-container > input[type="password"]:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input[type="tel"]:focus ~ .underline,
body.auth-page .auth-form .input-container > input[type="tel"]:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input:-webkit-autofill ~ .underline {
  transform: scaleX(1);
}

body.auth-page .auth-form .input-container > input[type="text"]:-webkit-autofill,
body.auth-page .auth-form .input-container > input[type="email"]:-webkit-autofill,
body.auth-page .auth-form .input-container > input[type="password"]:-webkit-autofill,
body.auth-page .auth-form .input-container > input[type="tel"]:-webkit-autofill {
  -webkit-text-fill-color: var(--input-text);
  -webkit-box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 9999s ease-in-out 0s;
}

body.auth-page .auth-form .input-container > input[type="text"]:invalid:not(:placeholder-shown),
body.auth-page .auth-form .input-container > input[type="email"]:invalid:not(:placeholder-shown),
body.auth-page .auth-form .input-container > input[type="password"]:invalid:not(:placeholder-shown),
body.auth-page .auth-form .input-container > input[type="tel"]:invalid:not(:placeholder-shown) {
  border: 0 !important;
  border-bottom: 2px solid var(--danger-color) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.auth-page .auth-form .input-container > input[type="text"]:invalid:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input[type="email"]:invalid:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input[type="password"]:invalid:not(:placeholder-shown) ~ .label,
body.auth-page .auth-form .input-container > input[type="tel"]:invalid:not(:placeholder-shown) ~ .label {
  color: var(--danger-color);
}

body.auth-page .auth-form .input-container > input[type="text"]:invalid:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input[type="email"]:invalid:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input[type="password"]:invalid:not(:placeholder-shown) ~ .underline,
body.auth-page .auth-form .input-container > input[type="tel"]:invalid:not(:placeholder-shown) ~ .underline {
  background: var(--danger-color);
  transform: scaleX(1);
}

.password-toggle {
  --color: var(--text-soft);
  --size: 24px;
  position: absolute;
  top: 45px;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--size);
  fill: var(--color);
  z-index: 2;
}

.password-toggle .eye,
.password-toggle .eye-slash {
  position: absolute;
  transition: fill 0.2s ease;
}

.password-toggle .eye-slash {
  display: none;
}

.password-toggle .password-toggle__checkbox {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.password-toggle:hover,
.password-toggle:focus-within {
  --color: var(--text);
}

.password-toggle .password-toggle__checkbox:checked ~ .eye {
  display: none;
}

.password-toggle .password-toggle__checkbox:checked ~ .eye-slash {
  display: block;
}

.form-control,
.form-group input[type="date"],
.form-group select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control:focus,
.form-group input[type="date"]:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-color-strong);
  box-shadow: var(--focus-ring);
}

.field-feedback {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  min-height: 38px;
}

.form-hint,
.field-hint {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.form-error,
.field-error {
  display: block;
  color: var(--danger-color);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.form-error p,
.field-error p,
.form-error ul,
.field-error ul {
  margin: 0;
}

.form-error ul,
.field-error ul {
  padding-left: 18px;
}

.field-error--stack > * + *,
.form-error--stack > * + * {
  margin-top: 4px;
}

.form-group.checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  margin: 4px 0 0;
}

.form-group.checkbox .field-feedback {
  grid-column: 1 / -1;
}

.checkbox-text {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-text a,
.auth-link a,
.auth-footer a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.checkbox-text a:hover,
.checkbox-text a:focus,
.auth-link a:hover,
.auth-link a:focus,
.auth-footer a:hover,
.auth-footer a:focus {
  color: var(--link-hover);
  text-decoration: underline;
}

.btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.15s ease;
  box-sizing: border-box;
}

.btn:hover,
.btn:focus,
.btn-primary:hover,
.btn-primary:focus {
  background: var(--btn-bg-hover);
  color: var(--btn-text);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(var(--accent-rgb), 0.22);
}

.btn:active,
.btn-primary:active {
  background: var(--btn-bg-active);
  transform: translateY(0);
  opacity: 0.92;
}

.btn:focus-visible,
.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), 0 16px 28px rgba(var(--accent-rgb), 0.18);
}

.btn:disabled,
.btn-primary:disabled,
fieldset[disabled] .btn,
fieldset[disabled] .btn-primary {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.auth-link,
.auth-footer {
  margin: 20px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.neon-checkbox {
  --primary: #00ffaa;
  --primary-dark: #00cc88;
  --size: 30px;
  position: relative;
  width: var(--size);
  height: var(--size);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 0 0 var(--size);
  margin-top: 2px;
}

.neon-checkbox input {
  display: none;
}

.neon-checkbox__frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.neon-checkbox__box {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  border: 2px solid var(--primary-dark);
  transition: all 0.4s ease;
}

.neon-checkbox__check-container {
  position: absolute;
  inset: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.neon-checkbox__check {
  width: 80%;
  height: 80%;
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transform-origin: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.neon-checkbox__glow {
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  background: var(--primary);
  opacity: 0;
  filter: blur(8px);
  transform: scale(1.2);
  transition: all 0.4s ease;
}

.neon-checkbox__borders {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
}

.neon-checkbox__borders span {
  position: absolute;
  width: 40px;
  height: 1px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.neon-checkbox__borders span:nth-child(1) {
  top: 0;
  left: -100%;
  animation: borderFlow1 2s linear infinite;
}

.neon-checkbox__borders span:nth-child(2) {
  top: -100%;
  right: 0;
  width: 1px;
  height: 40px;
  animation: borderFlow2 2s linear infinite;
}

.neon-checkbox__borders span:nth-child(3) {
  bottom: 0;
  right: -100%;
  animation: borderFlow3 2s linear infinite;
}

.neon-checkbox__borders span:nth-child(4) {
  bottom: -100%;
  left: 0;
  width: 1px;
  height: 40px;
  animation: borderFlow4 2s linear infinite;
}

.neon-checkbox__particles span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 6px var(--primary);
  pointer-events: none;
}

.neon-checkbox__rings {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.neon-checkbox__rings .ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
}

.neon-checkbox__sparks span {
  position: absolute;
  width: 20px;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0;
}

.neon-checkbox:hover .neon-checkbox__box {
  border-color: var(--primary);
  transform: scale(1.05);
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__box {
  border-color: var(--primary);
  background: rgba(0, 255, 170, 0.1);
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__check {
  stroke-dashoffset: 0;
  transform: scale(1.1);
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__glow {
  opacity: 0.2;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__borders span {
  opacity: 1;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__particles span {
  animation: particleExplosion 0.6s ease-out forwards;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__rings .ring {
  animation: ringPulse 0.6s ease-out forwards;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__sparks span {
  animation: sparkFlash 0.6s ease-out forwards;
}

@keyframes borderFlow1 {
  0% { transform: translateX(0); }
  100% { transform: translateX(200%); }
}

@keyframes borderFlow2 {
  0% { transform: translateY(0); }
  100% { transform: translateY(200%); }
}

@keyframes borderFlow3 {
  0% { transform: translateX(0); }
  100% { transform: translateX(-200%); }
}

@keyframes borderFlow4 {
  0% { transform: translateY(0); }
  100% { transform: translateY(-200%); }
}

@keyframes particleExplosion {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--x, 20px)), calc(-50% + var(--y, 20px))) scale(0);
    opacity: 0;
  }
}

@keyframes ringPulse {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

@keyframes sparkFlash {
  0% {
    transform: rotate(var(--r, 0deg)) translateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: rotate(var(--r, 0deg)) translateX(30px) scale(0);
    opacity: 0;
  }
}

.neon-checkbox__particles span:nth-child(1) { --x: 25px; --y: -25px; }
.neon-checkbox__particles span:nth-child(2) { --x: -25px; --y: -25px; }
.neon-checkbox__particles span:nth-child(3) { --x: 25px; --y: 25px; }
.neon-checkbox__particles span:nth-child(4) { --x: -25px; --y: 25px; }
.neon-checkbox__particles span:nth-child(5) { --x: 35px; --y: 0; }
.neon-checkbox__particles span:nth-child(6) { --x: -35px; --y: 0; }
.neon-checkbox__particles span:nth-child(7) { --x: 0; --y: 35px; }
.neon-checkbox__particles span:nth-child(8) { --x: 0; --y: -35px; }
.neon-checkbox__particles span:nth-child(9) { --x: 20px; --y: -30px; }
.neon-checkbox__particles span:nth-child(10) { --x: -20px; --y: 30px; }
.neon-checkbox__particles span:nth-child(11) { --x: 30px; --y: 20px; }
.neon-checkbox__particles span:nth-child(12) { --x: -30px; --y: -20px; }

.neon-checkbox__sparks span:nth-child(1) { --r: 0deg; top: 50%; left: 50%; }
.neon-checkbox__sparks span:nth-child(2) { --r: 90deg; top: 50%; left: 50%; }
.neon-checkbox__sparks span:nth-child(3) { --r: 180deg; top: 50%; left: 50%; }
.neon-checkbox__sparks span:nth-child(4) { --r: 270deg; top: 50%; left: 50%; }

.neon-checkbox__rings .ring:nth-child(1) { animation-delay: 0s; }
.neon-checkbox__rings .ring:nth-child(2) { animation-delay: 0.1s; }
.neon-checkbox__rings .ring:nth-child(3) { animation-delay: 0.2s; }

@media (max-width: 768px) {
  .auth-layout {
    padding: 24px 16px 36px;
  }

  .auth-card {
    padding: 28px 22px 24px;
    max-width: 100%;
  }

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

  .register-form__layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .register-form__col {
    gap: 18px;
  }

  .register-form__password-group {
    margin-top: 0;
  }

  .form-group,
  .register-form__password-group,
  .field-feedback {
    min-height: 0;
  }

  .form-group.checkbox {
    grid-template-columns: 30px 1fr;
    gap: 12px;
  }

  body.auth-page .auth-form .input-container > input[type="text"],
  body.auth-page .auth-form .input-container > input[type="email"],
  body.auth-page .auth-form .input-container > input[type="password"],
  body.auth-page .auth-form .input-container > input[type="tel"],
  .form-control,
  .form-group input[type="date"],
  .form-group select,
  .btn,
  .btn-primary {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .auth-layout {
    padding: 18px 12px 28px;
  }

  .auth-layout__top {
    flex-wrap: wrap;
    align-items: center;
  }

  .auth-card {
    padding: 24px 16px 22px;
    border-radius: 18px;
  }

  .auth-brand__text {
    font-size: 20px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-brand__image {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .auth-theme-toggle .theme-switch {
    --toggle-size: 14px;
  }

  .input-container input[type="text"],
  .input-container input[type="email"],
  .input-container input[type="password"],
  .input-container input[type="tel"] {
    font-size: 18px;
  }

  .input-container .label {
    font-size: 16px;
  }

  .auth-title {
    font-size: 26px;
  }

  .checkbox-text {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 390px) {
  .auth-layout {
    padding-left: 10px;
    padding-right: 10px;
  }

  .auth-card {
    padding-left: 14px;
    padding-right: 14px;
  }

  .auth-brand {
    gap: 10px;
  }

  .auth-brand__text {
    font-size: 18px;
  }
}
