:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  --page: #fff;
  --surface: #f8f8f8;
  --border: #e2e2e5;
  --text: #202024;
  --muted: #71717a;
  --footer: #929299;
  --accent: #4d6bfe;
  --accent-hover: #3d5deb;
  --error: #f45155;
  --toast: #f0f0f2;
  --shadow: 0 8px 24px #00000012;
  --captcha-background: #f1f2f7;
  --captcha-ink: #263c70;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #141414;
    --surface: #1c1c1c;
    --border: #343434;
    --text: #f2f2f3;
    --muted: #adb1b7;
    --footer: #77777c;
    --accent: #5683ff;
    --accent-hover: #6a91ff;
    --toast: #43464b;
    --shadow: 0 8px 24px #00000026;
    --captcha-background: #232832;
    --captcha-ink: #ccd7fa;
  }
}

* {

  box-sizing: border-box;

}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input {
  font: inherit;
}

button, a, input {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.auth-main {

  flex: 1;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 64px 24px 48px;

}

.auth-shell {
  width: 336px;
  max-width: 100%;
  margin-top: -30px;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  width: fit-content;
  margin: 0 auto 50px;
  color: var(--accent);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.2;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  flex-shrink: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field {
  position: relative;
}

.field input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 28px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input::placeholder {
  color: #85858d;
  opacity: 1;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

.field-error {
  margin: 4px 2px -12px;
  color: var(--error);
  font-size: 12px;
  line-height: 1.5;
}

.password-field input {
  padding-right: 48px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.eye-slash {
  display: none;
}

.password-toggle[aria-pressed="true"] .eye-slash {
  display: block;
}

.consent {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.consent a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  font-size: 13px;
}

.primary-button {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 26px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.15s;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.auth-links + .primary-button {
  margin-top: -9px;
}

.social-logins {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
  font-size: 13px;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--text);
}

.social-divider {
  height: 12px;
  width: 1px;
  background: var(--border);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 16px 22px;
  color: var(--footer);
  font-size: 12px;
}

.site-footer a {
  color: inherit;
}

.toast {

  position: fixed;

  z-index: 10;

  top: 24px;

  left: 50%;

  transform: translateX(-50%);

  display: flex;

  align-items: flex-start;

  gap: 12px;

  width: min(480px, calc(100% - 32px));

  padding: 15px 18px;

  border: 1px solid #ffffff12;

  border-radius: 12px;

  background: var(--toast);

  color: var(--text);

  box-shadow: var(--shadow);

  font-size: 14px;

  line-height: 1.55;

}

.toast-icon {
  color: #efaa16;
  flex-shrink: 0;
  margin-top: 1px;
}

#notification-message {
  flex: 1;
  white-space: pre-line;
}

.toast-close {
  width: 18px;
  height: 20px;
  flex-shrink: 0;
  font-size: 19px;
  color: var(--muted);
}

.captcha-dialog {

  width: min(360px, calc(100% - 32px));

  max-height: calc(100svh - 40px);

  overflow-y: auto;

  padding: 24px;

  border: 1px solid var(--border);

  border-radius: 20px;

  background: var(--page);

  color: var(--text);

  box-shadow: var(--shadow);

}

.captcha-dialog::backdrop {
  background: #0008;
}

body:has(dialog[open]) {
  overflow: hidden;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.dialog-close {
  width: 26px;
  height: 26px;
  font-size: 25px;
}

.dialog-description {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 18px;
}

.captcha-image {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--captcha-background);
}

.captcha-image canvas {
  display: block;
  width: 100%;
  height: 90px;
}

.text-challenge {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.captcha-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 20px;
  font-size: 12px;
}

.captcha-dialog .primary-button {
  margin-top: 20px;
}

.dialog-brand {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--footer);
}

.inline-message {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.error-message {
  color: #e17a6c;
}

.recovery-shell .brand {

  margin-bottom: 30px;

}

.recovery-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
}

.recovery-description {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.back-link {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  font-size: 13px;
}

.recovery-help {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.document-header {

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 24px;

  width: min(800px, 100%);

  margin: 0 auto;

  padding: 30px 24px;

}

.document-header .brand {
  margin: 0;
  font-size: 21px;
  gap: 9px;
}

.document-header .brand-mark {
  width: 27px;
  height: 27px;
}

.document-back {
  font-size: 13px;
  white-space: nowrap;
}

.document-main {
  flex: 1;
  width: min(752px, 100%);
  margin: 0 auto;
  padding: 32px 24px 72px;
  font-size: 15px;
  line-height: 1.8;
}

.document-main h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.7px;
  line-height: 1.25;
}

.document-updated {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 13px;
}

.document-main h2 {
  margin: 28px 0 8px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
}

.document-main p {
  margin: 0 0 16px;
}

.document-main a {
  text-underline-offset: 3px;
  white-space: nowrap;
}

.document-main li {
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  .auth-main {
    padding: 100px 24px 48px;
  }

  .auth-shell {
    margin-top: 0;
  }

  .field input {
    font-size: 16px;
  }

  .brand {
    margin-bottom: 42px;
  }

  .toast {
    top: 16px;
    font-size: 13px;
  }

  .document-header {
    padding: 24px 20px;
  }

  .document-main {
    padding: 24px 20px 48px;
  }

  .document-main h1 {
    font-size: 28px;
  }

}

@media (max-height: 620px) and (min-width: 481px) {
  .auth-main {
    padding-top: 96px;
    padding-bottom: 32px;
  }

  .auth-shell {
    margin-top: 0;
  }

  .brand {
    margin-bottom: 32px;
  }

}

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

}
