:root {
  --login-bg: #f7f7f4;
  --login-line: #e7e6e2;
  --login-ink: #141414;
  --login-muted: #686861;
  --login-field: #fbfbfa;
  --login-success: #16754a;
  --login-danger: #c9352b;
}

:root:not([data-theme="light"]) {
  --login-bg: #111211;
  --login-line: #30322f;
  --login-ink: #f4f4ef;
  --login-muted: #aaa9a1;
  --login-field: #1b1c1a;
  --login-success: #65d69b;
  --login-danger: #ff8b83;
}

body.page-app-login {
  min-height: 100dvh;
  display: block;
  background: var(--login-bg);
  color: var(--login-ink);
  -webkit-font-smoothing: antialiased;
}

body.page-app-login .app-login-topbar {
  border-bottom: 0;
  box-shadow: inset 0 -1px var(--login-line);
}

body.page-app-login .app-login-theme {
  width: 38px;
  height: 38px;
  border: 1px solid var(--login-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--login-muted);
  font: inherit;
  cursor: pointer;
}

body.page-app-login .app-login-theme:hover {
  color: var(--login-ink);
  border-color: #b9b8b2;
}

body.page-app-login .app-login-shell {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 32px 20px 64px;
}

body.page-app-login .card,
body.page-app-login .app-login-card {
  width: 100%;
  max-width: none;
  padding: 34px 32px 30px;
  border: 1px solid var(--login-line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(20, 20, 18, 0.07);
}

body.page-app-login .auth-panel {
  gap: 18px;
}

body.page-app-login .form-head h1 {
  color: var(--login-ink);
  font-size: 1.8rem;
  line-height: 1.15;
  letter-spacing: -0.06em;
}

body.page-app-login .register-step-copy {
  margin-top: 8px;
  color: var(--login-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

body.page-app-login .auth-back {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  color: var(--login-muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
}

body.page-app-login .auth-back:hover {
  color: var(--login-ink);
}

body.page-app-login .social-auth {
  gap: 10px;
}

body.page-app-login .social-btn {
  min-height: 50px;
  border-radius: 12px;
  box-shadow: none;
}

body.page-app-login .social-btn:not(.social-btn--disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 20, 18, 0.09);
}

body.page-app-login .social-btn--disabled {
  cursor: not-allowed;
  filter: saturate(0.25);
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

body.page-app-login .social-btn__state {
  position: absolute;
  right: 13px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #555;
  font-size: 0.62rem;
  font-weight: 800;
}

body.page-app-login .social-btn__icon--google svg {
  width: 18px;
  height: 18px;
  display: block;
}

body.page-app-login .social-status {
  margin: -4px 0 0;
  padding: 10px 12px;
  border: 1px solid #e7d9a7;
  border-radius: 10px;
  background: #fffaf0;
  color: #6c5620;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: keep-all;
}

:root:not([data-theme="light"]) body.page-app-login .social-status {
  border-color: #5a4d2e;
  background: #272319;
  color: #e1c77c;
}

body.page-app-login .auth-divider {
  color: var(--login-muted);
}

body.page-app-login .auth-divider::before,
body.page-app-login .auth-divider::after {
  background: var(--login-line);
}

body.page-app-login form .field {
  margin-bottom: 14px;
  gap: 7px;
}

body.page-app-login .field label {
  color: var(--login-ink);
  font-size: 0.82rem;
  font-weight: 800;
}

body.page-app-login .field input {
  min-height: 48px;
  border: 1px solid var(--login-line);
  border-radius: 12px;
  background: var(--login-field);
  color: var(--login-ink);
}

body.page-app-login .field input:focus {
  border-color: #2f77bc;
  box-shadow: 0 0 0 3px rgba(47, 119, 188, 0.11);
}

body.page-app-login .field input[aria-invalid="true"] {
  border-color: color-mix(in srgb, var(--login-danger) 72%, var(--login-line));
}

body.page-app-login .field-status {
  min-height: 18px;
  margin: -1px 2px 0;
  color: var(--login-muted);
  font-size: 0.75rem;
  font-weight: 730;
  line-height: 1.45;
}

body.page-app-login .field-status[hidden] {
  display: none;
}

body.page-app-login .field-status[data-state="checking"] {
  color: #596b7c;
}

body.page-app-login .field-status[data-state="available"] {
  color: var(--login-success);
}

body.page-app-login .field-status[data-state="error"],
body.page-app-login .field-status[data-state="unavailable"] {
  color: var(--login-danger);
}

body.page-app-login .password-requirements {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin: 1px 2px 0;
  padding: 0;
  list-style: none;
  color: var(--login-muted);
  font-size: 0.72rem;
  font-weight: 680;
  line-height: 1.45;
}

body.page-app-login .password-requirements[hidden] {
  display: none;
}

body.page-app-login .password-requirements li {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 5px;
}

body.page-app-login .password-rule__mark {
  flex: 0 0 auto;
  width: 12px;
  font-weight: 900;
  text-align: center;
}

body.page-app-login .password-requirements li[data-state="met"] {
  color: var(--login-success);
}

body.page-app-login .password-requirements--invalid li[data-state="unmet"] {
  color: var(--login-danger);
}

body.page-app-login form button[type="submit"],
body.page-app-login .auth-primary {
  min-height: 50px;
  margin-top: 4px;
  border-radius: 12px;
  background: #1675dd;
  font-size: 0.94rem;
  box-shadow: none;
}

body.page-app-login form button[type="submit"]:disabled,
body.page-app-login .auth-primary:disabled {
  cursor: wait;
  opacity: 0.64;
}

body.page-app-login .auth-method-button {
  width: 100%;
  min-height: 50px;
  border: 1px solid #b8c5d3;
  border-radius: 12px;
  background: var(--surface);
  color: var(--login-ink);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 140ms ease-out, background 140ms ease-out, transform 140ms ease-out;
}

body.page-app-login .auth-method-button:hover {
  border-color: #7b9dbc;
  background: color-mix(in srgb, var(--surface) 92%, #1675dd 8%);
  transform: translateY(-1px);
}

body.page-app-login .auth-method-button:active {
  transform: translateY(0);
}

body.page-app-login .auth-entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

body.page-app-login .auth-method-button--primary {
  border-color: #1675dd;
  background: #1675dd;
  color: #fff;
}

body.page-app-login .auth-method-button--primary:hover {
  border-color: #0d67c5;
  background: #0d67c5;
}

body.page-app-login .auth-choice-error:not(.visible) {
  display: none;
}

body.page-app-login form button[type="submit"]:hover,
body.page-app-login .auth-primary:hover {
  background: #0d67c5;
}

body.page-app-login .auth-switch,
body.page-app-login .auth-policy-links,
body.page-app-login .app-login__links {
  color: var(--login-muted);
}

body.page-app-login .auth-policy-links {
  margin-top: -5px;
  font-size: 0.74rem;
}

body.page-app-login .auth-policy-links a {
  color: var(--login-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.page-app-login :focus-visible {
  outline: 3px solid rgba(47, 119, 188, 0.28);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  body.page-app-login {
    background: var(--surface);
  }

  body.page-app-login .app-login-theme {
    width: 36px;
    height: 36px;
  }

  body.page-app-login .app-login-shell {
    padding: 0 0 34px;
  }

  body.page-app-login .card,
  body.page-app-login .app-login-card {
    padding: 24px 20px 28px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.page-app-login .auth-panel {
    gap: 17px;
  }

  body.page-app-login .form-head h1 {
    font-size: 1.65rem;
  }

  body.page-app-login .social-btn {
    min-height: 50px;
  }

  body.page-app-login .password-requirements {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}
