/* Profile 使用 Console 设计令牌，保留账号业务组件的既有 class 契约。 */
:root {
  --bg: var(--bg-body);
  --card: var(--bg-card);
  --border: var(--border-medium);
  --text: var(--text-primary);
  --text-muted: var(--text-secondary);
  --text-sm: var(--text-tertiary);
  --accent: var(--primary);
  --accent-hover: var(--primary-hover);
  --accent-light: var(--bg-muted);
  --success: var(--success-text);
  --success-light: var(--success-bg);
  --danger: var(--error-text);
  --danger-light: var(--error-bg);
  --shadow: none;
}

body {
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font);
  min-height: 100vh;
}

.profile-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.profile-app .sidebar {
  width: 220px;
}

.profile-sidebar-support {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 0 6px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
  transition: var(--transition);
}

.profile-sidebar-support:hover {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.profile-sidebar-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-sidebar-meta {
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 48px;
}

.profile-page {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.profile-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.profile-page-head .page-desc {
  margin-top: 5px;
  font-size: 13px;
}

.profile-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--border-medium);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
}

.profile-account-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-text) 14%, transparent);
}

/* ── IG 个人主页式头部：开放式布局（无卡片框），渐变环大头像 ── */
.profile-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
  padding: 12px 4px 28px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  background: transparent;
}

.profile-identity-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 24px;
}

/* 渐变光环：外层 IG 渐变，内层留白圈出头像 */
.user-avatar-wrap {
  display: grid;
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  margin: 0;
  place-items: center;
  overflow: hidden;
  border: 4px solid var(--bg-body);
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 0 0 3px transparent;
  position: relative;
}

.profile-identity-main .avatar-ring {
  padding: 3.5px;
}

.profile-identity-copy {
  min-width: 0;
}

.user-card-name {
  overflow: hidden;
  margin: 0 0 3px;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-id {
  color: var(--text-tertiary);
  font: 12px var(--mono);
}

.profile-identity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.profile-identity-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.profile-identity-meta svg {
  width: 13px;
  height: 13px;
  color: var(--text-tertiary);
}

.profile-identity-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.btn-logout,
.btn-logout-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font: 500 12px var(--font);
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover,
.btn-logout-all:hover {
  border-color: var(--error-text);
  background: var(--error-bg);
  color: var(--error-text);
}

.btn-logout svg,
.btn-logout-all svg {
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

.panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card {
  overflow: hidden;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.panel-title svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.panel-body {
  padding: 0;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 22px;
  color: var(--text-primary);
  font-size: 14px;
  transition: background 0.15s ease;
}

.info-row:hover {
  background: var(--bg-subtle);
}

.info-row + .info-row,
.session-item + .session-item {
  border-top: 1px solid var(--border-light);
}

.info-lbl {
  width: 96px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.info-val {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  word-break: break-word;
}

.info-val.muted {
  color: var(--text-tertiary);
}

.info-actions {
  display: flex;
  flex-shrink: 0;
  gap: 7px;
}

.act-btn,
.btn-send,
.btn-cancel,
.btn-confirm {
  border-radius: 10px;
  font: 600 13px var(--font);
  transition: var(--transition);
}

/* 行内操作：文字按钮，无边框 */
.act-btn {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

.act-btn:hover {
  background: var(--bg-muted);
  color: var(--primary-hover);
}

.act-btn.danger {
  color: var(--error-text);
}

.act-btn.danger:hover {
  background: var(--error-bg);
  color: var(--error-text);
}

.act-btn:disabled,
.act-btn:disabled:hover {
  background: transparent;
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.btn-send:hover,
.btn-cancel:hover {
  border-color: var(--border-strong);
  background: var(--bg-muted);
  color: var(--text-primary);
}

.expand-title {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.xform {
  display: flex;
  max-width: 430px;
  flex-direction: column;
  gap: 12px;
}

.xform-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.xform-field label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.xform-field input {
  padding: 10px 13px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  outline: none;
  background: var(--input-bg);
  color: var(--text-primary);
  font: 14px var(--font);
}

.xform-field input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.xform-field input::placeholder {
  color: var(--text-tertiary);
}

/* 生日年/月/日三联下拉：替代原生日历弹层，观感与站内输入框一致 */
.birthday-selects {
  display: flex;
  gap: 10px;
}

.birthday-selects select {
  flex: 1;
  min-width: 0;
  padding: 10px 32px 10px 13px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  outline: none;
  background-color: var(--input-bg);
  color: var(--text-primary);
  font: 14px var(--font);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a8a8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.birthday-selects select:focus {
  border-color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.code-row,
.xform-actions {
  display: flex;
  gap: 8px;
}

.code-row input {
  flex: 1;
}

.btn-send,
.btn-cancel {
  padding: 8px 14px;
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-confirm {
  padding: 8px 18px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
  cursor: pointer;
}

.btn-confirm:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-send:disabled,
.btn-confirm:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.msg-err,
.msg-ok {
  display: none;
  padding: 8px 11px;
  border-radius: 7px;
  font-size: 12px;
}

.msg-err {
  background: var(--error-bg);
  color: var(--error-text);
}

.msg-ok {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
}

/* 状态圆点由 console.css 的 .badge-dot::before 统一绘制（currentColor），
   这里不再给元素本体上色，避免出现双点。 */
.badge-ok {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warn {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.empty-state {
  padding: 24px 18px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  font-size: 12px;
}

.session-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  place-items: center;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--bg-muted);
}

.session-icon svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-weight: 550;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 10px;
}

.session-current {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 9px;
  font-weight: 650;
}

.qr-img {
  border-color: var(--border-medium);
  background: #fff;
}

.qr-side-title {
  color: var(--text-primary);
}

.qr-side-sub,
.backup-hint {
  color: var(--text-secondary);
}

.qr-secret,
.backup-code-item {
  border-color: var(--border-medium);
  background: var(--bg-muted);
  color: var(--text-primary);
}

.unauth {
  min-height: 100vh;
  background: var(--bg-body);
}

.unauth-title {
  color: var(--text-primary);
}

.unauth-sub {
  color: var(--text-secondary);
}

.btn-go-login {
  background: var(--primary);
  color: var(--text-invert);
}

#nick-modal > div {
  border: 1px solid var(--border-medium);
  background: var(--bg-card) !important;
}

#nick-modal > div > div:first-child {
  color: var(--text-primary) !important;
}

#nick-modal > div > div:nth-child(2) {
  color: var(--text-secondary) !important;
}

#nick-modal-input {
  border-color: var(--border-medium) !important;
  background: var(--input-bg);
  color: var(--text-primary);
}

#nick-modal-error {
  color: var(--error-text) !important;
}

#nick-modal-save {
  background: var(--primary) !important;
  color: var(--text-invert) !important;
}

/* ── AI 学习进展（xueai.app）──
   必须写在本文件：本文件在 profile.html 内联样式之后加载，
   .panel-body / --accent 等都会覆盖内联定义，卡片样式若写在内联会被压掉。 */
.xueai-body {
  padding: 14px 18px 16px;
}

.xueai-stats {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.xueai-stats .xueai-done {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 650;
}

.xueai-stats .xueai-total {
  color: var(--text-tertiary);
  font-size: 12px;
}

.xueai-stats .xueai-pct {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
}

.xueai-bar {
  height: 6px;
  margin-bottom: 10px;
  border-radius: 99px;
  background: var(--bg-muted);
  overflow: hidden;
}

.xueai-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.xueai-last {
  margin-bottom: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.7;
}

.xueai-last b {
  color: var(--text-secondary);
  font-weight: 550;
}

.xueai-parts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2px 16px;
  margin: 0 -8px 12px;
}

.xueai-part {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  transition: var(--transition);
}

.xueai-part:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.xueai-part .xp-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xueai-part .xp-count {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.xueai-part.xp-done .xp-count {
  color: var(--success-text);
}

/* 薄弱考点（/profile/ai-learn 掌握度卡片）：沿用 .xueai-part 行样式，
   计数标红提示这是没答好的考点 */
.xq-weak-label {
  margin-bottom: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.xueai-part.xq-weak .xp-count {
  color: var(--danger-text, #c0392b);
}

/* 空态文案本身没有下外边距，后面紧跟 inline-flex 的按钮会贴在一起 */
.xueai-body .empty-state + .xueai-cta {
  margin-top: 14px;
}

.xueai-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.xueai-cta:hover {
  background: var(--primary-hover);
}

.xueai-cta svg {
  width: 12px;
  height: 12px;
}

/* 结业证书条：xueai 学完全部课程后颁发，数据随 progress summary 的 cert 块带回 */
.xueai-cert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(185, 138, 47, 0.35);
  background: rgba(185, 138, 47, 0.08);
  color: var(--text-secondary);
  font-size: 12.5px;
  text-decoration: none;
  transition: var(--transition);
}

.xueai-cert:hover {
  background: rgba(185, 138, 47, 0.16);
}

.xueai-cert .xc-icon {
  font-size: 18px;
  line-height: 1;
}

.xueai-cert .xc-title {
  color: #a97b1f;
  font-weight: 700;
}

.xueai-cert .xc-no {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.xueai-cert .xc-go {
  flex-shrink: 0;
  margin-left: auto;
  color: #a97b1f;
  font-weight: 600;
}

/* ── 结业证书卡片（/profile/ai-learn）──
   还没学完时也占着这块位置：灰掉的样张 + 还差多少节，让目标一直看得见。 */
.xcert-showcase {
  display: flex;
  align-items: center;
  gap: 20px;
}

.xcert-shot {
  position: relative;
  flex: 0 0 44%;
  max-width: 300px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.xcert-shot img {
  display: block;
  width: 100%;
  height: auto;
}

.xcert-locked .xcert-shot img {
  filter: grayscale(0.9) opacity(0.5);
}

.xcert-tag {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 5px 13px;
  border-radius: 99px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.xcert-tag.xcert-got {
  top: 10px;
  left: auto;
  right: 10px;
  background: linear-gradient(135deg, #c9962e, #a97b1f);
  transform: none;
}

.xcert-side {
  flex: 1;
  min-width: 0;
}

.xcert-title {
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 650;
}

.xcert-desc {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.75;
}

.xcert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 12px;
  font-size: 12px;
}

.xcert-meta span {
  color: var(--text-tertiary);
}

.xcert-meta b {
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .xcert-showcase {
    align-items: stretch;
    flex-direction: column;
  }

  .xcert-shot {
    flex: none;
    max-width: none;
  }
}

@media (max-width: 900px) {
  .profile-main {
    padding: 24px 22px 40px;
  }

  .profile-identity {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-identity-actions {
    width: 100%;
  }

  .profile-identity-actions button {
    flex: 1;
  }
}

@media (max-width: 760px) {
  .profile-app {
    height: auto;
    min-height: 100vh;
    flex-direction: column;
    overflow: visible;
  }

  .profile-app .sidebar {
    width: 100%;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border-medium);
    overflow: visible;
  }

  .profile-app .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-app .nav-section-label {
    grid-column: 1 / -1;
  }

  .profile-app .sidebar-footer {
    display: block;
    padding: 8px 16px 12px;
    border-top: 1px solid var(--border-light);
  }

  .profile-app .profile-sidebar-support {
    display: none;
  }

  .profile-main {
    overflow: visible;
    padding: 22px 16px 36px;
  }

  .profile-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-identity-main {
    align-items: flex-start;
  }

  .profile-identity-meta {
    flex-direction: column;
    gap: 6px;
  }

  .info-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .info-lbl {
    width: 100%;
  }

  .info-actions {
    width: 100%;
  }
}
