/* All identity flows inherit the same tokens and controls as the portal. */
.auth-page { background-color: var(--bg-app); }
.auth-tools { display: flex; justify-content: flex-end; padding: 16px 24px 0; }
.auth-wrap { display: flex; align-items: flex-start; justify-content: center; min-height: calc(100dvh - 56px); padding: clamp(20px, 5vh, 56px) 24px 32px; }
.auth-stage { width: min(100%, 400px); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.auth-brand img { width: 40px; height: 40px; object-fit: contain; }
.auth-brand span { font: 700 28px/1.2 var(--font-brand); letter-spacing: .5px; }
.auth-panel { width: 100%; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.auth-heading { margin-bottom: 24px; }
.auth-heading h1 { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.4; letter-spacing: -.3px; }
.auth-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { gap: 7px; font-size: 13px; font-weight: 500; }
.auth-form input { min-height: 42px; }
.auth-code-group { display: grid; gap: 7px; }
.auth-code-field { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 8px; }
.auth-code-field input { min-width: 0; }
.auth-code-send { padding: 0 8px; white-space: nowrap; }
.auth-password-field { position: relative; display: block; }
.auth-password-field input { padding-right: 58px; }
.auth-password-field button { position: absolute; top: 50%; right: 6px; min-height: 30px; padding: 3px 8px; border: 0; background: transparent; color: var(--muted); font-size: 12px; transform: translateY(-50%); }
.auth-password-field button:hover:not(:disabled) { color: var(--brand); }
.auth-forgot { justify-self: end; }
.auth-link { min-height: auto; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--brand); font: inherit; }
.auth-link:hover:not(:disabled) { background: transparent; color: var(--brand2); text-decoration: underline; text-underline-offset: 3px; }
.auth-submit, .auth-page button.primary { min-height: 42px; font-size: 14px; font-weight: 600; }
.auth-secondary, .auth-wechat { width: 100%; min-height: 42px; font-size: 13px; }
.auth-form .message { margin: -2px 0 0; line-height: 1.6; }
.auth-alternatives { margin-top: 22px; }
.auth-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { height: 1px; background: var(--line); content: ""; }
.auth-wechat { display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-wechat img { width: 19px; height: 19px; object-fit: contain; }
.auth-account-switch { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 22px; color: var(--muted); font-size: 13px; }
.auth-back { display: block; width: fit-content; margin: 24px auto 0; font-size: 13px; }
.auth-permissions { margin-bottom: 22px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.auth-permissions h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.auth-permissions > p { margin: 12px 0 8px; color: var(--muted); font-size: 12px; }
.auth-permissions .list { gap: 6px; }
.auth-permissions .item { padding: 9px 10px; }
.auth-permissions .item p:empty { display: none; }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-actions button { min-height: 42px; }
.auth-device-actions { grid-template-columns: minmax(56px, 1fr) minmax(0, 2fr); }
.auth-flow-panel > .message { margin-top: 16px; }
.auth-page button[aria-busy="true"] { cursor: wait; opacity: .7; }
.auth-page button[aria-busy="true"]::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: auth-spin .8s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .auth-page button[aria-busy="true"]::before { animation: none; }
}
.auth-footer { text-align: center; margin-top: 24px; color: var(--muted); font-size: 12px; }
@media (max-width: 560px) {
  .auth-tools { padding: 12px 16px 0; }
  .auth-wrap { padding: 24px 16px; }
  .auth-brand { margin-bottom: 22px; }
  .auth-brand span { font-size: 26px; }
  .auth-panel { padding: 24px 20px; }
  .auth-heading { margin-bottom: 20px; }
  .auth-form input, .auth-page button.primary, .auth-secondary, .auth-wechat { min-height: 44px; }
  .auth-link { padding-block: 4px; }
}
@media (max-height: 760px) and (min-width: 561px) {
  .auth-wrap { padding-top: 16px; }
  .auth-brand { margin-bottom: 20px; }
}
.auth-form input.auth-device-code {
  text-align: center;
  font-family: monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .12em;
}
