.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 34, 0.52);
  backdrop-filter: blur(4px);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}

.auth-modal-overlay.open {
  display: flex;
}

.auth-modal {
  width: min(920px, 96vw);
  max-height: min(760px, 92vh);
  overflow: auto;
  background: #fdfefe;
  border: 1px solid #ccd8ec;
  border-radius: 18px;
  box-shadow: 0 22px 44px rgba(7, 16, 31, 0.24);
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
}

.auth-modal-main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.auth-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid #d4dfef;
  background: #ffffff;
  padding: 0.7rem 0.86rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.auth-modal-header h3 {
  margin: 0;
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: 1rem;
  color: #1f3253;
}

.auth-modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid #d4dfef;
  border-radius: 9px;
  background: #fff;
  color: #365780;
  font-weight: 700;
  cursor: pointer;
}

.auth-modal-body {
  padding: 0.82rem 0.86rem 0.95rem;
}

.auth-step {
  display: none;
  gap: 0.44rem;
}

.auth-step.active {
  display: grid;
}

.auth-note {
  border: 1px dashed #ccdaef;
  background: #f7fbff;
  color: #2f4e7d;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.38rem 0.5rem;
}

.auth-field {
  display: grid;
  gap: 0.16rem;
}

.auth-field label {
  font-size: 0.76rem;
  color: #4f668a;
}

.auth-field input {
  width: 100%;
  border: 1px solid #cdd9ec;
  border-radius: 10px;
  padding: 0.44rem 0.5rem;
  font-size: 0.84rem;
  color: #233a5e;
}

.auth-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.34rem;
}

.auth-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.34rem;
}

.auth-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.34rem 0.66rem;
  cursor: pointer;
  font-family: "Noto Sans SC", sans-serif;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.auth-btn.primary {
  color: #fff;
  background: #2636af;
  border-color: #1f2e94;
}

.auth-btn.secondary {
  color: #294c7a;
  background: #fff;
  border-color: #cddaea;
}

.auth-btn:disabled {
  opacity: 0.76;
  cursor: not-allowed;
}

.auth-btn.loading {
  position: relative;
  padding-left: 1.5rem;
}

.auth-btn.loading::before {
  content: "";
  position: absolute;
  left: 0.56rem;
  top: 50%;
  width: 0.66rem;
  height: 0.66rem;
  margin-top: -0.33rem;
  border-radius: 50%;
  border: 2px solid rgba(42, 75, 122, 0.24);
  border-top-color: #2d5b98;
  animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

.auth-switch {
  font-size: 0.78rem;
  color: #5b7091;
}

.auth-switch a {
  color: #8f2333;
  font-weight: 700;
  text-decoration: none;
}

.auth-result {
  min-height: 30px;
  border: 1px dashed #cdd9ec;
  border-radius: 10px;
  background: #f8fbff;
  color: #375986;
  font-size: 0.76rem;
  padding: 0.32rem 0.44rem;
}

.auth-side {
  border-left: 1px solid #d7e2f2;
  background: #f7fafd;
  padding: 0.86rem;
  display: grid;
  align-content: start;
  gap: 0.62rem;
}

.auth-side h4 {
  margin: 0;
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  color: #20395e;
  font-size: 0.98rem;
}

.auth-side p {
  margin: 0;
  font-size: 0.8rem;
  color: #4f678a;
}

.auth-qr {
  border: 1px solid #d3deee;
  border-radius: 12px;
  background: #fff;
  padding: 0.48rem;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
}

.auth-qr img {
  width: min(180px, 100%);
  height: auto;
  border-radius: 8px;
  border: 1px solid #e1e8f3;
  display: block;
}

.auth-qr figcaption {
  text-align: center;
  color: #516a8c;
  font-size: 0.74rem;
  line-height: 1.45;
}

.auth-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1250;
  border: 1px solid #cddbee;
  border-radius: 12px;
  background: #ffffff;
  color: #264a77;
  font-size: 0.8rem;
  padding: 0.38rem 0.56rem;
  box-shadow: 0 14px 28px rgba(8, 17, 36, 0.18);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.auth-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.auth-entry-btn {
  appearance: none;
  border: 1px solid #1f3f72;
  border-radius: 999px;
  background: #ffffff;
  color: #1f3f72;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: "Noto Sans SC", sans-serif;
  line-height: 1;
  padding: 0.3rem 0.66rem;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(23, 45, 86, 0.08);
  transition: box-shadow 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.auth-entry-btn:hover {
  border-color: #8f2333;
  color: #8f2333;
  box-shadow: 0 9px 18px rgba(30, 53, 93, 0.14);
}

.user-menu {
  position: relative;
}

.user-menu[hidden] {
  display: none !important;
}

.pay-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1260;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 16, 34, 0.56);
  backdrop-filter: blur(3px);
  padding: 1rem;
}

.pay-modal-overlay.open {
  display: flex;
}

.pay-modal {
  width: min(460px, 96vw);
  border: 1px solid #d2deef;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(8, 17, 36, 0.24);
}

.pay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d6e0ef;
  padding: 0.66rem 0.78rem;
}

.pay-modal-header h3 {
  margin: 0;
  color: #1f3352;
  font-size: 0.95rem;
}

.pay-modal-body {
  display: grid;
  gap: 0.56rem;
  padding: 0.76rem;
}

.pay-order-meta p {
  margin: 0.12rem 0;
  font-size: 0.78rem;
  color: #4a6488;
}

.pay-order-meta p strong {
  font-size: 0.9rem;
  color: #1d3760;
}

.pay-order-meta .pay-amount {
  color: #a12539;
  font-size: 1rem;
  font-weight: 800;
}

.pay-discount-hint {
  color: #5a4ca0;
}

.pay-open-panel {
  border: 1px solid #d6deec;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.66rem;
  display: grid;
  gap: 0.34rem;
}

.pay-open-hint {
  color: #5a7090;
  font-size: 0.74rem;
  line-height: 1.45;
}

.pay-actions {
  display: flex;
  gap: 0.46rem;
  flex-wrap: wrap;
}

.user-trigger {
  appearance: none;
  border: 1px solid #d4deee;
  border-radius: 999px;
  background: #f8fbff;
  color: #2a456b;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: "Noto Sans SC", sans-serif;
  line-height: 1;
  padding: 0.2rem 0.34rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2a2fbc;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
}

.user-phone {
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 140;
  min-width: 170px;
  border: 1px solid #d4deee;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(8, 17, 36, 0.16);
  padding: 0.28rem;
  display: none;
}

.user-menu.open .user-dropdown {
  display: grid;
}

.user-dropdown a,
.user-dropdown button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #2b476e;
  text-decoration: none;
  text-align: left;
  font-size: 0.78rem;
  font-family: "Noto Sans SC", sans-serif;
  border-radius: 8px;
  padding: 0.3rem 0.42rem;
  cursor: pointer;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: #f3f7ff;
}

body.auth-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .auth-modal {
    grid-template-columns: 1fr;
  }

  .auth-side {
    border-left: 0;
    border-top: 1px solid #d7e2f2;
  }
}
