html:has(.auth-body) {
  scroll-snap-type: none;
  background: #fff;
}

.auth-modal[hidden] { display: none !important; }
.auth-modal.is-open,
.auth-modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(24, 26, 40, .45);
  cursor: pointer;
}
.auth-modal .auth-dialog {
  position: relative;
  z-index: 1;
  margin: 0;
}
.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  background: none;
  color: #8c8c8c;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.auth-modal-close:hover { color: #20243a; }
body.auth-modal-open { overflow: hidden; }

.auth-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: #20243a;
  background: linear-gradient(180deg, #fff 0%, #f8f9ff 100%);
}

.auth-top {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
}

@media (min-width: 640px) {
  .auth-top { padding: 20px 32px 0; }
}

.auth-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.auth-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-brand-name {
  color: #20243a;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.auth-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-lang {
  width: 128px;
  height: 36px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #4b5563;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.auth-home {
  color: #6b7280;
  font-size: 13px;
  text-decoration: none;
}

.auth-home:hover { color: #605ce5; }

.auth-shell {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 8px;
}

@media (min-width: 1024px) {
  .auth-shell { padding: 16px 36px 8px; }
}

.auth-dialog {
  position: relative;
  width: min(720px, 100%);
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid rgba(243, 244, 246, .8);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(96, 92, 229, .12), 0 4px 24px rgba(0, 0, 0, .06);
  animation: authSlideUp .6s ease-out;
}

.auth-dialog.is-register,
.auth-dialog.is-org { width: min(480px, 100%); }

.auth-dialog-left {
  display: none;
  width: 42%;
  flex-shrink: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 28px 40px 36px;
  text-align: left;
}

.auth-dialog-split {
  display: none;
  position: relative;
  width: 0;
  flex-shrink: 0;
}

.auth-dialog-split::before {
  content: "";
  position: absolute;
  top: 40px;
  bottom: 40px;
  left: 50%;
  width: 1px;
  background: #e5e7eb;
  transform: translateX(-50%);
}

@media (min-width: 1024px) {
  .auth-dialog-left,
  .auth-dialog-split { display: flex; }

  .auth-dialog.is-register .auth-dialog-left,
  .auth-dialog.is-org .auth-dialog-left,
  .auth-dialog.is-register .auth-dialog-split,
  .auth-dialog.is-org .auth-dialog-split { display: none; }
}

.auth-card-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  margin-bottom: 16px;
}

.auth-card-brand {
  display: block;
  margin-bottom: 10px;
  color: #605ce5;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.auth-welcome-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
}

.auth-welcome-lead {
  margin: 0;
  max-width: 14em;
  color: #666d80;
  font-size: 14px;
  line-height: 1.7;
}

.auth-dialog-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
  transition: opacity .2s ease, transform .36s cubic-bezier(.22, 1, .36, 1);
}

@media (min-width: 1024px) {
  .auth-dialog:not(.is-register):not(.is-org) .auth-dialog-right {
    width: 58%;
    padding: 40px;
  }
}

.auth-dialog.is-leaving .auth-dialog-right {
  opacity: 0;
  transform: translateX(14px);
}

.auth-dialog.is-leaving.to-login .auth-dialog-right {
  transform: translateX(-14px);
}

.auth-dialog.is-enter .auth-dialog-right {
  animation: authPanelIn .42s cubic-bezier(.22, 1, .36, 1) both;
}

.auth-dialog.is-enter.to-login .auth-dialog-right {
  animation-name: authPanelInLeft;
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: none; }
}

@keyframes authPanelIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes authPanelInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: none; }
}

.auth-mobile-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

@media (min-width: 1024px) {
  .auth-mobile-title { display: none; }
}

.auth-dialog.is-register .auth-mobile-title { display: none; }

.auth-tabs {
  position: relative;
  display: flex;
  width: 100%;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 28px;
}

.auth-tabs button {
  flex: 1;
  height: 44px;
  padding: 12px 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 16px;
  color: #8c8c8c;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .28s ease;
}

.auth-tabs button.on {
  color: #333;
}

.auth-tabs::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 50%;
  height: 3px;
  background: #605ce5;
  border-radius: 3px 3px 0 0;
  transform: translateX(100%);
  transition: transform .36s cubic-bezier(.22, 1, .36, 1), width .36s cubic-bezier(.22, 1, .36, 1);
}

.auth-dialog.is-wechat .auth-tabs::after {
  transform: translateX(0);
}

.auth-dialog.is-register .auth-tabs::after {
  width: 100%;
  transform: none;
}

.auth-method-stage {
  position: relative;
  overflow: hidden;
  transition: height .36s cubic-bezier(.22, 1, .36, 1);
}

.auth-method-pane {
  display: none;
}

.auth-method-pane.is-on {
  display: block;
}

.auth-method-stage.is-leaving .auth-method-pane.is-on,
.auth-method-stage.is-enter .auth-method-pane.is-on {
  transition: opacity .2s ease, transform .36s cubic-bezier(.22, 1, .36, 1);
}

.auth-method-stage.is-leaving.to-password .auth-method-pane.is-on {
  opacity: 0;
  transform: translateX(-14px);
}

.auth-method-stage.is-leaving.to-wechat .auth-method-pane.is-on {
  opacity: 0;
  transform: translateX(14px);
}

.auth-method-stage.is-enter.to-password .auth-method-pane.is-on {
  animation: authPanelIn .42s cubic-bezier(.22, 1, .36, 1) both;
}

.auth-method-stage.is-enter.to-wechat .auth-method-pane.is-on {
  animation: authPanelInLeft .42s cubic-bezier(.22, 1, .36, 1) both;
}

.auth-wechat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 280px;
  padding-bottom: 8px;
}

.auth-wechat-lead {
  margin: 0 0 12px;
  color: #666d80;
  font-size: 14px;
}

.auth-wechat-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.auth-wechat-qr {
  width: 230px;
  min-height: 210px;
  background: #fff;
}

.auth-wechat-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: #8c8c8c;
  font-size: 13px;
  text-align: center;
}

.auth-wechat-refresh {
  margin-top: 8px;
  border: 0;
  background: none;
  color: #605ce5;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.auth-wechat-bind {
  width: 100%;
  margin-top: 16px;
}

.auth-wechat-bind-lead {
  margin: 0 0 12px;
  color: #666d80;
  font-size: 13px;
}

.auth-field-sms {
  display: flex;
  gap: 8px;
}

.auth-field-sms input { flex: 1; }

.auth-sms {
  flex-shrink: 0;
  height: 48px;
  padding: 0 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  color: #605ce5;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.auth-dialog.is-register [data-auth-method="wechat"] { display: none; }

.auth-form { display: flex; flex-direction: column; }
.auth-form[hidden],
.auth-wechat[hidden] { display: none !important; }
.auth-wechat.auth-method-pane { display: none; }
.auth-wechat.auth-method-pane.is-on { display: flex; }

.auth-field {
  position: relative;
  margin-bottom: 16px;
}

.auth-field-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #605ce5;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

.auth-register-only .auth-field-prefix { opacity: 0; }
.auth-dialog.is-register .auth-register-only .auth-field-prefix { opacity: 1; }

.auth-field input {
  width: 100%;
  height: 40px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 0 12px 0 36px;
  font: inherit;
  font-size: 14px;
  color: #333;
  background: #fff;
}

.auth-field input::placeholder { color: #bfbfbf; }
.auth-field input:hover,
.auth-field input:focus {
  outline: none;
  border-color: #605ce5;
  box-shadow: 0 0 0 2px rgba(96, 92, 229, .08);
}

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

.auth-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  color: #bfbfbf;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 16px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}

.auth-agree input { margin-top: 2px; accent-color: #605ce5; }
.auth-agree a { color: #605ce5; text-decoration: none; }
.auth-agree a:hover { text-decoration: underline; }
.auth-agree i { font-style: normal; }

.auth-error {
  margin: 0 0 12px;
  font-size: 13px;
  color: #d0455c;
}

.auth-submit {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: #605ce5;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(96, 92, 229, .25);
  transition: background .25s ease, opacity .2s ease;
}

.auth-submit:hover:not(:disabled) { background: #4b48d4; }
.auth-submit:disabled { opacity: .65; cursor: wait; }

.auth-switch-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  color: #4b5563;
  font-size: 14px;
}

.auth-switch-line i { font-style: normal; }

.auth-switch {
  border: 0;
  background: none;
  color: #605ce5;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

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

.auth-org { display: none; padding-top: 8px; }
.auth-dialog.is-org .auth-org { display: block; }
.auth-dialog.is-org .auth-mobile-title,
.auth-dialog.is-org .auth-tabs,
.auth-dialog.is-org .auth-method-stage,
.auth-dialog.is-org .auth-form,
.auth-dialog.is-org .auth-wechat,
.auth-dialog.is-org .auth-switch-line { display: none; }

.auth-org-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.auth-org-lead {
  margin: 0 0 16px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.auth-org-list {
  list-style: none;
  max-height: 320px;
  overflow: auto;
  padding: 0;
  margin: 0 0 16px;
}

.auth-org-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  background: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.auth-org-item:hover {
  border-color: #605ce5;
  box-shadow: 0 0 0 2px rgba(96, 92, 229, .08);
}

.auth-org-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ecebff;
  color: #605ce5;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 700;
}

.auth-org-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-org-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-org-meta strong { font-size: 14px; }
.auth-org-meta em {
  font-style: normal;
  color: #8c8c8c;
  font-size: 12px;
}

.auth-org-back {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #20243a;
  font: inherit;
  cursor: pointer;
}

.auth-footnote {
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 8px 16px 24px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
}

.auth-footnote-meta { margin-top: 4px; }
.auth-footnote a { color: inherit; text-decoration: none; }
.auth-footnote a:hover { text-decoration: underline; }

.auth-register-only {
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transition:
    max-height .42s cubic-bezier(.22, 1, .36, 1),
    margin-bottom .42s cubic-bezier(.22, 1, .36, 1),
    opacity .28s ease,
    transform .42s cubic-bezier(.22, 1, .36, 1);
}

.auth-dialog.is-register .auth-register-only {
  max-height: 56px;
  margin-bottom: 16px;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (max-width: 1023px) {
  .auth-brand-name { font-size: 18px; }
  .auth-brand img { width: 36px; height: 36px; }
  .auth-dialog-right { padding: 32px 24px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-dialog,
  .auth-dialog-right,
  .auth-register-only,
  .auth-submit,
  .auth-tabs button,
  .auth-tabs::after,
  .auth-method-stage,
  .auth-method-pane {
    transition: none;
    animation: none;
  }

}
