@import url("fonts.css");

/* =============================================================================
   Swaymoon Passport — Apple Account 视觉体系
   度量对齐 account.apple.com：SF 字体栈、-0.022em 字距、12/18px 圆角、
   #0071e3 主色、4px 蓝色聚焦光环、44px 毛玻璃顶栏。
   ========================================================================== */

/* 作者样式里的 display:flex/block 特异性高于 UA 的 [hidden]，必须强制隐藏 */
[hidden] {
  display: none !important;
}

:root {
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --link: #0066cc;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #006edb;
  --danger: #e30000;
  --danger-bg: #fff2f2;
  --success: #008009;
  --success-bg: #f0faf1;

  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-row-hover: #fafafa;
  --surface: #ffffff;

  --hairline: #d2d2d7;
  --hairline-soft: rgba(0, 0, 0, 0.08);

  --radius-control: 12px;
  --radius-card: 18px;
  --radius-pill: 980px;

  --focus-ring: 0 0 0 4px rgba(0, 125, 250, 0.6);
  --card-shadow: 0 0 0 1px rgba(0, 0, 0, 0.055), 0 2px 6px rgba(0, 0, 0, 0.028);

  --masthead-height: 44px;
  --sidebar-width: 272px;
  --content-max: 792px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #86868b;
    --link: #2997ff;
    --accent: #0a84ff;
    --accent-hover: #339cff;
    --accent-active: #0071e3;
    --danger: #ff453a;
    --danger-bg: rgba(255, 69, 58, 0.12);
    --success: #30d158;
    --success-bg: rgba(48, 209, 88, 0.12);

    --bg: #000000;
    --bg-secondary: #1d1d1f;
    --bg-row-hover: #1a1a1c;
    --surface: #1d1d1f;

    --hairline: #424245;
    --hairline-soft: rgba(255, 255, 255, 0.12);

    --card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
}

/* ---------- 基础 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  /* 页面内容不足一屏时，把页脚压到视口底部而不是浮在半空 */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47059;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* SPA 骨架：#app-chrome 是 body 的唯一子节点，必须自己承担纵向 flex */
.app-chrome,
#app-chrome {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* 登录 / 2FA / 授权：占满顶栏与页脚之间，交给内部 .auth-page 垂直居中 */
.page-slot {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

svg {
  display: block;
}

/* 品牌字标：文字「摇月 Swaymoon」，不再使用月牙图形 */
.brand-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.022em;
  white-space: nowrap;
}

.auth-logo .brand-text {
  font-size: 22px;
  letter-spacing: -0.03em;
}

/* =============================================================================
   顶部导航（毛玻璃）
   ========================================================================== */

.masthead {
  flex: none;
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--masthead-height);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline-soft);
}

@media (prefers-color-scheme: dark) {
  .masthead {
    background: rgba(22, 22, 23, 0.72);
  }
}

.masthead-inner {
  max-width: 1160px;
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.masthead-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 15px;
  letter-spacing: -0.01em;
}

.masthead-brand:hover {
  text-decoration: none;
}

.masthead-brand .brand-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.masthead-title {
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.masthead-spacer {
  flex: 1;
}

.masthead-account {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.masthead-account-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.masthead-signout {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--link);
  cursor: pointer;
  white-space: nowrap;
}

.masthead-signout:hover {
  text-decoration: underline;
}

/* =============================================================================
   登录 / 双重认证 / 授权 —— 居中单列
   ========================================================================== */

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 22px 32px;
}

.auth-panel {
  width: 100%;
  max-width: 380px;
  animation: auth-in 0.45s cubic-bezier(0.28, 0.11, 0.32, 1) both;
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
  color: var(--text);
}

.auth-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.14286;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
}

.auth-subtitle {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.022em;
  color: var(--text-secondary);
  text-align: center;
}

.auth-body {
  margin-top: 26px;
}

.auth-links {
  margin-top: 22px;
  text-align: center;
}

.auth-links a,
.auth-links button.link {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 0;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--link);
}

/* 「其他登录方式」折叠：避免多个链接挤成一行 */
.auth-other {
  margin-top: 22px;
  text-align: center;
}

.auth-other > summary {
  list-style: none;
  cursor: pointer;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--link);
  user-select: none;
}

.auth-other > summary::-webkit-details-marker {
  display: none;
}

.auth-other > summary::after {
  content: ' ▾';
  font-size: 12px;
  opacity: 0.7;
}

.auth-other[open] > summary::after {
  content: ' ▴';
}

.auth-other-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 12px;
}

.auth-other-list button.link {
  display: block;
  width: 100%;
  padding: 8px 0;
}

.auth-divider {
  margin: 26px 0 18px;
  border-top: 1px solid var(--hairline);
}

/* 切换步骤时重新播放入场动画 */
.step {
  animation: step-in 0.32s cubic-bezier(0.28, 0.11, 0.32, 1) both;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 已识别的账号胶囊 */
.identity-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
}

.identity-chip .avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.identity-chip .value {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-chip .change {
  flex: none;
  border: 0;
  background: none;
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
  color: var(--link);
  cursor: pointer;
}

/* =============================================================================
   输入控件
   ========================================================================== */

/* 一组输入框共享一个圆角矩形，内部用发丝线分隔 —— Apple ID 登录框的标志性结构 */
.fieldgroup {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.fieldgroup > .field-float {
  margin: 0;
  border-bottom: 1px solid var(--hairline);
}

.fieldgroup > .field-float:last-child {
  border-bottom: 0;
}

.fieldgroup > .field-float input,
.fieldgroup > .field-float select,
.fieldgroup > .field-float textarea {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.fieldgroup > .field-float:first-child input,
.fieldgroup > .field-float:first-child select,
.fieldgroup > .field-float:first-child textarea {
  border-radius: var(--radius-control) var(--radius-control) 0 0;
}

.fieldgroup > .field-float:last-child input,
.fieldgroup > .field-float:last-child select,
.fieldgroup > .field-float:last-child textarea {
  border-radius: 0 0 var(--radius-control) var(--radius-control);
}

.fieldgroup > .field-float:only-child input,
.fieldgroup > .field-float:only-child select,
.fieldgroup > .field-float:only-child textarea {
  border-radius: var(--radius-control);
}

.fieldgroup:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* 悬浮标签输入框 */
.field-float {
  position: relative;
  margin-bottom: 12px;
}

.field-float input,
.field-float select {
  width: 100%;
  height: 54px;
  padding: 21px 16px 5px;
  font-family: inherit;
  font-size: 17px;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.field-float input[type="date"] {
  min-height: 54px;
  color-scheme: light dark;
}

.field-float input:disabled,
.field-float input[readonly]:disabled {
  opacity: 1;
  color: var(--text);
  background: var(--surface);
  -webkit-text-fill-color: var(--text);
  cursor: not-allowed;
}

.field-float select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2386868b' d='M1.4.6L6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.field-float textarea {
  width: 100%;
  min-height: 96px;
  padding: 28px 16px 12px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field-float input:hover,
.field-float select:hover,
.field-float textarea:hover {
  border-color: var(--text-tertiary);
}

.field-float input:focus,
.field-float select:focus,
.field-float textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.fieldgroup .field-float input:focus,
.fieldgroup .field-float input:hover,
.fieldgroup .field-float select:focus,
.fieldgroup .field-float select:hover,
.fieldgroup .field-float textarea:focus,
.fieldgroup .field-float textarea:hover {
  border-color: transparent;
  box-shadow: none;
}

.field-float label {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  letter-spacing: -0.022em;
  color: var(--text-tertiary);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.2s cubic-bezier(0.28, 0.11, 0.32, 1), font-size 0.2s cubic-bezier(0.28, 0.11, 0.32, 1),
    top 0.2s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.field-float:has(textarea) label {
  top: 18px;
  transform: none;
}

.field-float input:focus + label,
.field-float input:not(:placeholder-shown) + label,
.field-float input:disabled + label,
.field-float input[type="date"] + label,
.field-float select:focus + label,
.field-float select:valid + label,
.field-float textarea:focus + label,
.field-float textarea:not(:placeholder-shown) + label {
  top: 9px;
  transform: none;
  font-size: 12px;
  letter-spacing: -0.01em;
}

/* 浏览器自动填充默认会刷一层黄底，用内阴影盖回表面色 */
.field-float input:-webkit-autofill,
.field-float input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 60px var(--surface) inset;
  -webkit-text-fill-color: var(--text);
}

/* 输入框内的箭头继续按钮 */
.field-float .field-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.field-float .field-arrow:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.field-float .field-arrow:disabled {
  opacity: 0.42;
  cursor: default;
  background: var(--surface);
  border-color: var(--hairline);
  color: var(--text-tertiary);
}

.field-float:has(.field-arrow) input {
  padding-right: 50px;
}

/* 普通标签 + 控件 */
.field {
  margin-bottom: 12px;
}

.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.field textarea,
.field select,
textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  height: 46px;
  padding: 0 40px 0 14px;
  resize: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2386868b' d='M1.4.6L6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.field textarea:focus,
.field select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* 复选框 */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 14px;
  letter-spacing: -0.016em;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.checkbox-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}

/* 6 格验证码 —— Apple 双重认证的标志性输入 */
.otp {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 18px;
}

.otp input {
  width: 46px;
  height: 54px;
  padding: 0;
  text-align: center;
  font-family: inherit;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.otp input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.otp.invalid input {
  border-color: var(--danger);
  animation: otp-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes otp-shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}

/* =============================================================================
   按钮
   ========================================================================== */

.btn-primary,
.btn-secondary {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.23536;
  letter-spacing: -0.022em;
  text-align: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  background: var(--accent-active);
}

.btn-primary:disabled {
  opacity: 0.36;
  cursor: default;
  background: var(--accent);
}

a.btn-primary,
a.btn-secondary {
  box-sizing: border-box;
  text-decoration: none;
}

a.btn-primary:hover,
a.btn-secondary:hover {
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary:hover {
  background: rgba(0, 113, 227, 0.06);
}

.btn-secondary:disabled {
  opacity: 0.36;
  cursor: default;
  background: transparent;
}

.btn-secondary.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-secondary.danger:hover {
  background: var(--danger-bg);
}

.btn-primary.compact,
.btn-secondary.compact {
  width: auto;
  min-width: 132px;
  display: inline-block;
}

/* 内容里的行内小按钮：Apple 用胶囊灰底 */
.btn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 15px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: -0.016em;
  color: var(--text);
  background: var(--bg-secondary);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-chip:hover {
  background: #e8e8ed;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .btn-chip:hover {
    background: #2c2c2e;
  }
}

.btn-chip.brand {
  background: var(--accent);
  color: #fff;
}

.btn-chip.brand:hover {
  background: var(--accent-hover);
}

.btn-chip.danger {
  color: var(--danger);
}

.btn-chip.danger:hover {
  background: var(--danger-bg);
}

/* 纯文字按钮 */
button.link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--link);
  cursor: pointer;
}

button.link:hover {
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.actions .btn-primary,
.actions .btn-secondary {
  width: auto;
  min-width: 132px;
}

/* 绑定手机等：多按钮纵向排列，避免窄屏挤成一行显示不全 */
.actions.actions-stack {
  flex-direction: column;
  align-items: stretch;
}

.actions.actions-stack .btn-primary,
.actions.actions-stack .btn-secondary {
  width: 100%;
  min-width: 0;
}

/* =============================================================================
   提示条
   ========================================================================== */

.error-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.42859;
  letter-spacing: -0.016em;
  border-radius: var(--radius-control);
  background: var(--danger-bg);
  color: var(--danger);
}

.success-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.42859;
  letter-spacing: -0.016em;
  border-radius: var(--radius-control);
  background: var(--success-bg);
  color: var(--success);
}

.hint {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.38462;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.fine-print {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.33337;
  letter-spacing: -0.01em;
  color: var(--text-tertiary);
  text-align: center;
}

/* =============================================================================
   账户中心骨架
   ========================================================================== */

.shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 22px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--masthead-height);
  padding: 34px 0 40px;
}

.sidebar-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--hairline-soft);
}

.sidebar-identity .avatar,
.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 头像图：去掉字母占位的 flex 排版，避免 img 被当成文字容器压扁 */
img.avatar {
  display: block;
  padding: 0;
  object-fit: cover;
  background: var(--bg-secondary);
}

/* 第三方登录占位：默认折叠 */
.oauth-fold {
  margin-top: 16px;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  background: var(--surface);
  overflow: hidden;
}

.oauth-fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  padding: 16px 20px;
  user-select: none;
}

.oauth-fold > summary::-webkit-details-marker {
  display: none;
}

.oauth-fold-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.014em;
}

.oauth-fold-meta {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.oauth-fold > summary::after {
  content: "显示";
  margin-left: auto;
  font-size: 13px;
  color: var(--link);
}

.oauth-fold[open] > summary::after {
  content: "隐藏";
}

.oauth-fold .oauth-panel {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--hairline-soft);
}

.oauth-logo {
  background: var(--bg-secondary) !important;
  color: var(--text);
  overflow: hidden;
}

.oauth-logo svg {
  width: 22px;
  height: 22px;
}

.oauth-apple {
  color: #1d1d1f;
}

@media (prefers-color-scheme: dark) {
  .oauth-apple {
    color: #f5f5f7;
  }
}

.oauth-github {
  color: #24292f;
}

@media (prefers-color-scheme: dark) {
  .oauth-github {
    color: #f0f6fc;
  }
}

.sidebar-identity .name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--text);
}

.sidebar-identity .sub {
  margin-top: 1px;
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  letter-spacing: -0.016em;
  color: var(--text);
  border-radius: 10px;
  transition: background 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-secondary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--bg-secondary);
  font-weight: 600;
}

.nav-item .icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.nav-item.active .icon {
  color: var(--accent);
}

.nav-item .icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-signout {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline-soft);
}

/* 不能用 font: inherit —— 那会把 .nav-item 的 14px 重置回正文 17px */
.sidebar-signout button {
  width: 100%;
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.main {
  padding: 34px 0 96px;
  min-width: 0;
}

.main-inner {
  max-width: var(--content-max);
}

/* 未绑定邮箱等关键提示：始终放在主栏最上方 */
.page-alert {
  margin: 0 0 28px;
  padding: 16px 18px;
  border-radius: var(--radius-control);
  background: var(--danger-bg);
  color: var(--danger);
}

.page-alert[role="status"] {
  background: rgba(0, 113, 227, 0.08);
  color: var(--text);
}

.page-alert[role="status"] .page-alert-title {
  color: var(--link);
}

.page-alert-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.014em;
}

.page-alert-body {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.42859;
  letter-spacing: -0.016em;
}

.page-alert a {
  color: var(--danger);
  text-decoration: underline;
}

.page-alert[role="status"] a {
  color: var(--link);
}

.page-alert-list {
  margin: 8px 0 10px;
  padding: 0;
  list-style: none;
}

.page-alert-list li {
  position: relative;
  padding-left: 14px;
  font-size: 14px;
  line-height: 1.42859;
}

.page-alert-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

.page-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.125;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.47059;
  letter-spacing: -0.022em;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.section-title {
  margin: 44px 0 0;
  font-size: 21px;
  line-height: 1.19048;
  font-weight: 600;
  letter-spacing: 0.011em;
}

.section-desc {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.42859;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  max-width: 640px;
}

.subsection-title {
  margin: 20px 0 0;
  font-size: 17px;
  line-height: 1.23536;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--text-secondary);
}

.page-back {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.42859;
}

.page-back a {
  color: var(--link);
  text-decoration: none;
}

.page-back a:hover {
  text-decoration: underline;
}

a.row.panel-more {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.row.panel-more:hover .row-title {
  color: var(--link);
}

.panel-more-chevron {
  font-size: 22px;
  line-height: 1;
  color: var(--text-tertiary, var(--text-secondary));
  padding-right: 2px;
}

/* =============================================================================
   卡片与行
   ========================================================================== */

.panel {
  margin-top: 16px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.app-timeline > .empty-state {
  margin: 0;
  padding: 16px 18px;
}

.app-timeline-item[data-action="REVOKED"] .row-title {
  color: var(--danger, #c0392b);
}

.app-timeline-item[data-action="GRANTED"] .row-title,
.app-timeline-item[data-action="REAUTHORIZED"] .row-title {
  color: var(--text-primary);
}

/* 同一区块内紧随上一卡片的续接面板（如登录方式列表 + 添加表单） */
.panel.panel-follow {
  margin-top: 10px;
}

.inline-form .form-lead {
  margin-top: 0;
  margin-bottom: 14px;
}

.form-links {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.form-links .link {
  font-size: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  position: relative;
}

.row + .row::before,
.row + .inline-form::before,
.empty-state + .inline-form::before,
.inline-form + .row::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--hairline-soft);
}

.row-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-icon.neutral {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.row-body {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.014em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.row-meta {
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.row-action {
  flex: none;
  margin: 0;
}

.empty-state {
  margin: 0;
  padding: 22px 20px;
  font-size: 14px;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  text-align: center;
}

.inline-form {
  padding: 20px;
  position: relative;
}

.inline-form .field-float:last-of-type {
  margin-bottom: 0;
}

.inline-form .fieldgroup {
  margin-bottom: 12px;
}

.inline-form .fieldgroup:last-of-type {
  margin-bottom: 0;
}

.inline-form .btn-primary,
.inline-form .btn-secondary {
  margin-top: 14px;
}

.inline-form .actions {
  margin-top: 14px;
}

.inline-form .actions .btn-primary,
.inline-form .actions .btn-secondary {
  margin-top: 0;
}

.panel > .hint {
  padding: 16px 20px 0;
}

.panel > .btn-primary,
.panel > .btn-secondary {
  margin: 14px 20px 20px;
  width: calc(100% - 40px);
}

.panel > .fieldgroup {
  margin: 12px 20px;
}

.panel > form {
  padding: 0 20px 20px;
}

.panel > form .btn-primary,
.panel > form .btn-secondary {
  margin-top: 14px;
}

.avatar-upload {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.avatar-upload .avatar {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.avatar-upload-controls {
  flex: 1;
  min-width: 0;
}

.file-input {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 头像 1:1 裁剪层 */
.crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: auth-in 0.28s cubic-bezier(0.28, 0.11, 0.32, 1) both;
}

.crop-dialog {
  width: 100%;
  max-width: 420px;
  padding: 24px 22px 20px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  color: var(--text);
}

.crop-title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.011em;
}

.crop-hint {
  margin: 6px 0 18px;
  font-size: 13px;
  line-height: 1.38462;
  color: var(--text-secondary);
}

.crop-stage {
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: var(--bg-secondary);
  box-shadow: inset 0 0 0 1px var(--hairline-soft);
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-stage canvas {
  display: block;
  width: 100%;
  height: auto;
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.crop-zoom input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.crop-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.crop-actions .btn-primary,
.crop-actions .btn-secondary {
  width: auto;
  flex: 1;
  min-width: 0;
}

/* 开关 */
.toggle {
  display: inline-block;
  position: relative;
  width: 51px;
  height: 31px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: #e9e9eb;
  transition: background 0.24s cubic-bezier(0.28, 0.11, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  .toggle-track {
    background: #39393d;
  }
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.24s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.toggle input:checked + .toggle-track {
  background: #34c759;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-track {
  box-shadow: var(--focus-ring);
}

/* 危险操作区 */
.danger-zone {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 0 0 1px rgba(227, 0, 0, 0.24);
}

/* 密钥一次性展示 */
.secret-reveal {
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-card);
  font-size: 14px;
  line-height: 1.42859;
  letter-spacing: -0.016em;
}

.secret-reveal code {
  display: block;
  margin-top: 8px;
  padding: 9px 12px;
  background: var(--surface);
  border-radius: 8px;
  font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* =============================================================================
   授权同意页
   ========================================================================== */

.consent-app-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-panel.consent-panel {
  max-width: 720px;
}

.consent-section-label,
.consent-granted-at {
  margin: 18px 2px 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.consent-granted-at {
  margin-top: 0;
  text-align: center;
}

.scope-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 4px 0;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}

.scope-list.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
  overflow: hidden;
}

.scope-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.42859;
  letter-spacing: -0.016em;
}

.scope-item--email {
  flex-wrap: wrap;
  align-items: center;
}

.scope-item-label {
  flex: 1 1 auto;
  min-width: 0;
}

.consent-email-select {
  flex: none;
  margin-left: auto;
  max-width: 140px;
  padding: 6px 10px;
  border: 1px solid var(--hairline, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
}

.scope-grid .scope-item {
  min-width: 0;
  border-bottom: 1px solid var(--hairline-soft);
}

.scope-approved {
  color: var(--text-secondary);
}

.scope-removed {
  color: var(--text-secondary);
  text-decoration: line-through;
  opacity: 0.85;
}

.consent-scope-reason {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  font-weight: 400;
}

.scope-check {
  flex: none;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 620px) {
  .scope-list.scope-grid {
    grid-template-columns: 1fr;
  }
}

.scope-item .dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.consent-actions {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =============================================================================
   页脚
   ========================================================================== */

.page-footer {
  flex: none;
  border-top: 1px solid var(--hairline-soft);
  background: var(--bg-secondary);
}

.page-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 17px 22px 22px;
  font-size: 12px;
  line-height: 1.33337;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.page-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin-bottom: 5px;
}

.page-footer-links a {
  color: var(--text-secondary);
}

.page-footer-links .sep {
  color: var(--hairline);
}

.footer-whereami {
  margin-top: 6px;
  color: var(--text-tertiary, var(--text-secondary));
}

/* =============================================================================
   自适应
   ========================================================================== */

@media (max-width: 833px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    position: static;
    padding: 24px 0 0;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: none;
  }

  .sidebar-signout {
    display: none;
  }

  .main {
    padding-top: 24px;
  }

  .page-title {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .otp {
    gap: 6px;
  }

  .otp input {
    width: 100%;
    max-width: 46px;
    font-size: 21px;
  }

  .row {
    padding: 14px 16px;
  }

  .row + .row::before {
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
