:root {
  color-scheme: dark;
  --auth-bg: #071329;
  --auth-surface: #ffffff;
  --auth-text: #111827;
  --auth-muted: #667085;
  --auth-border: #dce3ee;
  --auth-primary: #1769e0;
  --auth-primary-hover: #0d56bd;
  --auth-error: #d92d20;
  --auth-focus: rgba(23, 105, 224, 0.2);
}

* {
  box-sizing: border-box;
}

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

body.auth-page {
  min-height: 100vh;
  color: var(--auth-text);
  background:
    radial-gradient(circle at 18% 15%, rgba(27, 110, 224, 0.32), transparent 30rem),
    radial-gradient(circle at 88% 88%, rgba(255, 104, 31, 0.2), transparent 27rem),
    var(--auth-bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-card {
  width: min(100%, 440px);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  background: var(--auth-surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.4);
}

.auth-card--wide {
  width: min(100%, 620px);
}

.auth-language {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin: -8px -8px 20px;
}

.auth-language label {
  font-size: 18px;
  line-height: 1;
}

.auth-language select {
  min-height: 38px;
  max-width: 175px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  outline: 0;
  background: #f8fafc;
  color: var(--auth-text);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.auth-language select:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px var(--auth-focus);
}

.auth-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;
}

.auth-heading {
  margin-bottom: 26px;
  text-align: center;
}

.auth-heading h1 {
  margin: 0;
  color: var(--auth-text);
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.15;
}

.auth-heading p {
  margin: 9px 0 0;
  color: var(--auth-muted);
  font-size: 15px;
}

.auth-form,
.auth-field {
  display: grid;
}

.auth-form {
  gap: 17px;
}

.auth-field {
  gap: 7px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-field label {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.auth-field input,
.auth-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  outline: 0;
  background: #f8fafc;
  color: var(--auth-text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-field input:focus,
.auth-field select:focus {
  border-color: var(--auth-primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--auth-focus);
}

.auth-field input[aria-invalid="true"],
.auth-field select[aria-invalid="true"] {
  border-color: var(--auth-error);
}

.auth-password {
  position: relative;
}

.auth-password input {
  padding-inline-end: 50px;
}

.auth-password-toggle {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 3px;
  width: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.62;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  opacity: 1;
}

.auth-password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #667085;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-error {
  min-height: 0;
  margin: 0;
  color: var(--auth-error);
  font-size: 12px;
  line-height: 1.35;
}

.auth-error:empty {
  display: none;
}

.auth-error--form {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff0ee;
  font-size: 13px;
}

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.auth-terms input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--auth-primary);
  flex: 0 0 auto;
}

.auth-terms a,
.auth-switch a {
  color: var(--auth-primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-terms a:hover,
.auth-switch a:hover {
  text-decoration: underline;
}

.auth-submit,
.auth-facebook {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.auth-submit {
  position: relative;
  border: 0;
  background: linear-gradient(135deg, #1d7af0, var(--auth-primary));
  color: #fff;
  box-shadow: 0 12px 26px rgba(23, 105, 224, 0.28);
}

.auth-submit:hover:not(:disabled),
.auth-facebook:hover:not(:disabled) {
  transform: translateY(-1px);
}

.auth-submit:disabled,
.auth-facebook:disabled {
  cursor: wait;
  opacity: 0.66;
}

.auth-submit[aria-busy="true"] span {
  visibility: hidden;
}

.auth-submit[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 20px;
  height: 20px;
  margin: -10px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.auth-social[hidden],
.auth-facebook[hidden] {
  display: none;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: #98a2b3;
  font-size: 12px;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  height: 1px;
  background: #e4e7ec;
  flex: 1;
}

.auth-facebook {
  border: 1px solid #ccd5e2;
  background: #fff;
  color: #234b8c;
}

.auth-switch {
  margin: 24px 0 0;
  color: var(--auth-muted);
  font-size: 14px;
  text-align: center;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .auth-shell {
    align-items: start;
    padding: 14px 10px;
  }

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

  .auth-language {
    margin: -8px -2px 18px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
