.auth-shell { background: #f8fbf8; }

.auth-shell > main { padding-bottom: calc(34px + var(--safe-bottom)); }
.auth-shell .bottom-nav { display: none; }

.auth-main {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px var(--gutter) 70px;
}

.auth-brand {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  margin: 0 0 30px;
  transform: translateY(24px);
}

.auth-brand img {
  display: block;
  width: 126px;
  height: auto;
}

.auth-panel {
  padding: 22px 20px 20px;
  border: 1px solid rgba(207, 224, 212, 0.92);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 22px rgba(52, 102, 76, 0.07);
  transform: translateY(24px);
}

.auth-panel [hidden],
.captcha-modal[hidden] { display: none !important; }

.auth-loading { display: grid; min-height: 286px; place-items: center; align-content: center; gap: 13px; color: var(--muted); text-align: center; }
.auth-loading span { width: 28px; height: 28px; border: 2px solid var(--green-200); border-top-color: var(--green-700); border-radius: 50%; animation: auth-loading-spin 700ms linear infinite; }
.auth-loading p { margin: 0; font-size: 14px; }
@keyframes auth-loading-spin { to { transform: rotate(360deg); } }

.auth-section-head { margin-bottom: 20px; }

.auth-section-head h2,
.auth-account-state h2,
.captcha-head h2 {
  margin: 0;
  color: var(--green-700);
  font-family: var(--font-title);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.4;
}

.auth-section-head p,
.auth-account-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.auth-readiness {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0 0 20px;
  padding: 12px 13px;
  border: 1px solid #d9e7dc;
  border-radius: 6px;
  color: var(--green-700);
  background: #f5faf6;
}

.auth-readiness.is-pending {
  border-color: #eadfcd;
  color: #8b6a3f;
  background: #fdfaf5;
}

.auth-readiness-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: currentColor;
}

.auth-readiness strong,
.auth-readiness small { display: block; }
.auth-readiness strong { font-size: 13px; font-weight: 600; line-height: 1.45; }
.auth-readiness small { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.auth-form { display: grid; gap: 8px; }
.auth-form label { color: var(--body); font-size: 14px; font-weight: 500; }

.auth-form input {
  width: 100%;
  height: 50px;
  margin-bottom: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-form input:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(58, 117, 88, 0.1);
}
.auth-form input[aria-invalid="true"] { border-color: #a44343; box-shadow: 0 0 0 3px rgba(164, 67, 67, 0.08); }

.auth-form input:disabled { color: var(--faint); background: #f7f9f7; }
.auth-form input::placeholder { color: var(--faint); }

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
}

.auth-code-row button {
  height: 50px;
  border: 1px solid var(--green-300, #aac9b4);
  border-radius: 6px;
  color: var(--green-700);
  background: var(--green-050, #f5faf6);
  font-size: 13px;
  font-weight: 600;
}

.auth-code-row button:disabled {
  border-color: var(--line);
  color: var(--faint);
  background: #f7f9f7;
}

.auth-message {
  min-height: 21px;
  margin: 0 0 2px;
  color: #a44343;
  font-size: 13px;
  line-height: 1.6;
}

.auth-message.is-success { color: #2f7a56; }
.auth-submit { min-height: 50px; margin-top: 2px; }
.auth-submit[disabled] { cursor: not-allowed; opacity: 0.56; }

.auth-mode-switch {
  display: block;
  margin: 15px auto 0;
  padding: 5px 8px;
  border: 0;
  color: var(--green-700);
  background: transparent;
  font-size: 14px;
  line-height: 1.5;
}

.auth-register-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-register-entry button {
  padding: 4px 6px;
  border: 0;
  color: var(--green-700);
  background: transparent;
  font: inherit;
  font-weight: 600;
}

.auth-register-entry button:disabled {
  color: var(--faint);
  cursor: not-allowed;
}

.auth-registration-state {
  padding: 0;
}

.auth-registration-state .auth-section-head { text-align: left; }
.auth-registration-state .auth-mode-switch { margin-top: 12px; }

.auth-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.auth-consent input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--green-700);
}

.auth-consent a { color: var(--green-700); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 15px;
  color: var(--faint);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-provider-list {
  display: flex;
  justify-content: center;
  min-height: 64px;
}

.auth-provider {
  display: grid;
  gap: 6px;
  min-width: 64px;
  justify-items: center;
  border: 0;
  color: var(--body);
  background: transparent;
  font-size: 12px;
}

.provider-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #cfe2d5;
  border-radius: 50%;
  color: #287749;
  background: #edf7f0;
}

.provider-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-mini-program-priority {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-bottom: 22px;
  padding: 11px 14px;
  border: 1px solid #cfe2d5;
  border-radius: 7px;
  color: var(--green-700);
  background: #f4faf6;
  text-align: left;
}

.auth-mini-program-priority strong,
.auth-mini-program-priority small { display: block; }
.auth-mini-program-priority strong { font-size: 15px; line-height: 1.45; }
.auth-mini-program-priority small { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.auth-mini-program-priority.is-pending {
  border-color: #d9e5dc;
  color: var(--green-700);
  background: #f8faf8;
}

.auth-divider-primary { margin-top: 0; }

.auth-channel-note {
  margin: 17px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.auth-account-state { padding: 14px 0 4px; text-align: center; }

.auth-success-mark {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 17px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green-700);
  font-size: 23px;
}

.auth-account-state .btn { margin-top: 22px; }

.captcha-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  align-items: end;
}

.captcha-backdrop { position: absolute; inset: 0; background: rgba(20, 43, 31, 0.42); }

.captcha-dialog {
  position: relative;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 21px var(--gutter) calc(22px + var(--safe-bottom));
  border-radius: 8px 8px 0 0;
  background: #fff;
  box-shadow: 0 -8px 30px rgba(24, 55, 38, 0.16);
}

.captcha-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.captcha-head h2 { font-size: 19px; }
.captcha-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.captcha-head > button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #f1f5f2;
  font-size: 22px;
  line-height: 1;
}

.captcha-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f4;
}

.captcha-image img { display: block; width: 100%; height: 100%; object-fit: fill; }
.captcha-image > span { position: absolute; inset: 0; pointer-events: none; }

.captcha-point {
  position: absolute;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--green-700);
  box-shadow: 0 2px 7px rgba(20, 54, 35, 0.24);
  font-size: 12px;
  font-weight: 700;
}

.captcha-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
}

.captcha-foot p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.captcha-foot button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 6px 7px;
  border: 0;
  color: var(--green-700);
  background: transparent;
  font-size: 13px;
}

.captcha-foot svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.has-captcha { overflow: hidden; }

@media (min-width: 600px) {
  .auth-main { min-height: calc(100vh - 92px); padding-top: 64px; padding-bottom: 84px; }
  .auth-panel { padding: 28px 26px 25px; }
  .captcha-dialog { bottom: 18px; border-radius: 8px; }
}

@media (max-height: 720px) {
  .auth-main { justify-content: flex-start; padding-top: 30px; padding-bottom: 36px; }
  .auth-brand { margin-bottom: 22px; }
  .auth-brand,
  .auth-panel { transform: translateY(0); }
}

@media (max-width: 359px) {
  .auth-main { padding-right: 16px; padding-left: 16px; }
  .auth-panel { padding-right: 16px; padding-left: 16px; }
  .auth-code-row { grid-template-columns: minmax(0, 1fr) 102px; gap: 8px; }
}
