/* 应用端追加样式：相册 tab、收支/饮食总览 */

/* ---- 总览卡片 ---- */
.ov-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ov-head h2 { margin: 0; }

.ov-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 4px 0 14px;
}

.ov-table caption {
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #444;
  padding: 6px 0;
}

.ov-table th,
.ov-table td {
  padding: 7px 8px;
  text-align: right;
  border-bottom: 1px solid #eef0f3;
  white-space: nowrap;
}

.ov-table th:first-child,
.ov-table td:first-child { text-align: left; }

.ov-table th {
  color: #8a8f98;
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid #e2e5ea;
}

.ov-empty { padding: 4px 0 14px; }

.amt-in { color: #1a7f37; }
.amt-out { color: #c62828; }

/* 总览粒度切换 */
.ov-tabs {
  display: flex;
  gap: 6px;
  margin: 2px 0 10px;
}

.ov-tab {
  padding: 6px 14px;
  border: 1px solid var(--line, #d9dce1);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.ov-tab.on {
  background: linear-gradient(135deg, #2f9e8a, #3cb493);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.ov-table tbody tr:nth-child(even) { background: #f7f8fa; }

/* ---- 相册 ---- */
.album-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.album-toolbar select {
  padding: 8px 10px;
  border: 1px solid #d9dce1;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  max-width: 46vw;
}

.album-actions { display: flex; gap: 8px; }

.album-group { margin-bottom: 20px; }

.album-group:last-child { margin-bottom: 0; }

.album-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 2px 10px;
}

.album-group-head b { font-size: 15px; }
.album-group-head .muted { font-size: 12px; color: var(--muted, #8a8f98); }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 9px;
}

.album-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 11px;
  overflow: hidden;
  background: #f2f3f6 center/cover no-repeat;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-cell.file {
  background: #fff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.album-cell.file .file-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #555;
  padding: 6px;
  text-align: center;
  overflow: hidden;
}

.album-cell.file .file-badge b {
  font-size: 26px;
  line-height: 1;
}

.album-cell span.tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 7px 5px;
  font-size: 10.5px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-more { margin-top: 10px; }

/* ---- 顶栏后台入口（管理员会话可见）---- */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-entry {
  border: 1px solid #d9dce1;
  background: #fff;
  color: #444;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.admin-entry:active { background: #f2f3f6; }

/* ---- AI 聊天 / 私聊：会话列表优先 ---- */
.chat-list-view { display: flex; flex-direction: column; min-height: 0; }

.chat-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.chat-list-head h2 { margin: 0; font-size: 17px; }

.chat-list-view .session-list {
  margin: 0;
  padding: 4px 0;
}

.chat-list-view .session-list li {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #eef0f3;
  cursor: pointer;
}

.chat-list-view .session-list li:last-child { border-bottom: none; }

.chat-list-view .session-list li:active { background: #f6f7f9; }

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

.session-main b { display: block; font-size: 14.5px; }

.session-main span { font-size: 12px; color: #8a8f98; }

.dm-pick-hint { margin: 14px 2px 8px; }

.dm-picker { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }

.dm-picker .chip-btn { margin: 0; }

/* 聊天视图：撑满 topbar 与 tabbar 之间，消息区滚动、输入框固定在底部 */
/* 用 fixed 定位而不是 100dvh 减常量：顶栏 83px / tabbar 66px 会随字号缩放，固定偏移同样缩放，不会错位 */
.page-chat {
  position: fixed;
  top: calc(83px + env(safe-area-inset-top));
  bottom: calc(66px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  height: auto;
  margin: 0 auto;
  max-width: 560px;
}

#ai-chat-view,
#dm-chat-view {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#ai-chat-view > .chat-msgs,
#dm-chat-view > .chat-msgs {
  flex: 1 1 auto;
  min-height: 0;
}

#ai-chat-view > .chat-input,
#dm-chat-view > .chat-input { flex: 0 0 auto; }

/* 相册详情弹层 */
.album-detail-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
  background: #f4f5f7;
  display: block;
  margin-bottom: 10px;
}

.album-detail-meta {
  font-size: 13px;
  color: #666;
  line-height: 1.9;
  word-break: break-all;
}

/* ================= 设置页：cell 入口 / 壁纸 / 关于 ================= */

/* ---- 「我的」页设置入口（微信风格 cell 列表）---- */
.cell-card { padding: 4px 14px; }

.cell {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 2px;
  font-size: 15px;
  text-align: left;
}

.cell-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #f1f3f8;
}

.cell-text { flex: 1; font-weight: 500; }
.cell-sub { color: var(--muted, #8b909a); font-size: 12px; }
.cell-arrow { color: #c3c7cf; font-size: 20px; line-height: 1; }

/* ---- 顶栏返回按钮（设置页显示）---- */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.topbar-back {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line, #ebedf1);
  font-size: 19px;
  line-height: 0;
  color: var(--ink-2, #4a4f59);
  padding-bottom: 2px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}

/* ---- 背景壁纸层 ---- */

body.wp-aurora::before,
body.wp-sunset::before,
body.wp-ocean::before,
body.wp-sakura::before,
body.wp-forest::before,
body.wp-latte::before,
body.wp-lavender::before,
body.wp-night::before,
body.has-wp-image::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
}

body.wp-aurora::before    { background-image: linear-gradient(160deg, #9be7ff 0%, #c9b6ff 55%, #ffb7d5 100%); }
body.wp-sunset::before    { background-image: linear-gradient(160deg, #ffd9a0 0%, #ff9d80 60%, #f56b8d 100%); }
body.wp-ocean::before     { background-image: linear-gradient(160deg, #a8ecff 0%, #7fb9ff 60%, #6f9dff 100%); }
body.wp-sakura::before    { background-image: linear-gradient(160deg, #ffd9ef 0%, #e3c4ff 55%, #a9c6ff 100%); }
body.wp-forest::before    { background-image: linear-gradient(160deg, #d8f5b5 0%, #9fe0b0 60%, #7cc9a6 100%); }
body.wp-latte::before     { background-image: linear-gradient(160deg, #f7e3c8 0%, #eebaa0 60%, #e09a8a 100%); }
body.wp-lavender::before  { background-image: linear-gradient(160deg, #e6d9ff 0%, #c3c9ff 55%, #9fb8ff 100%); }
body.wp-night::before     { background-image: linear-gradient(160deg, #2f4858 0%, #3c6e91 60%, #86bbd8 100%); }
body.has-wp-image::before { background-image: var(--wp-image); }

/* 有壁纸时卡片微透，让背景透出一点 */
body[class*="wp-"] .card { background: rgba(255, 255, 255, .92); }

/* ---- 壁纸选择网格 ---- */
.wp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}

.wp-item {
  position: relative;
  border-radius: 12px;
  padding: 0;
}

.wp-item.on .wp-thumb { outline: 2px solid var(--work, #2f9e8a); outline-offset: 2px; }

.wp-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
}

.wp-default { background: var(--bg, #f4f5f7); border: 1px solid var(--line, #ebedf1); }
.wp-add { background: #f1f3f8; border: 1px dashed #c9cdd6; color: #9aa0ab; font-size: 22px; }

.wp-name {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--ink-2, #4a4f59);
  margin-top: 5px;
}

.wp-check {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--work, #2f9e8a);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(47, 158, 138, .4);
}

/* ---- 关于 ---- */
.about-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.brand-mark-sm {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 20px;
  margin: 0;
  flex: 0 0 auto;
}

.about-head-text { min-width: 0; }
.about-name { font-size: 16.5px; font-weight: 700; }
.about-intro { font-size: 12.5px; color: var(--muted, #8b909a); margin-top: 3px; line-height: 1.6; }

.about-rows { border-top: 1px solid var(--line, #ebedf1); }

.about-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #ebedf1);
  font-size: 13.5px;
}

.about-row:last-child { border-bottom: none; }
.about-row span { color: var(--muted, #8b909a); flex: 0 0 auto; }
.about-row b { font-weight: 500; text-align: right; word-break: break-all; }
.about-loading { margin-bottom: 0; }

/* 预设壁纸的缩略图用同一组渐变 */
.wp-thumb.wp-aurora    { background-image: linear-gradient(160deg, #9be7ff 0%, #c9b6ff 55%, #ffb7d5 100%); }
.wp-thumb.wp-sunset    { background-image: linear-gradient(160deg, #ffd9a0 0%, #ff9d80 60%, #f56b8d 100%); }
.wp-thumb.wp-ocean     { background-image: linear-gradient(160deg, #a8ecff 0%, #7fb9ff 60%, #6f9dff 100%); }
.wp-thumb.wp-sakura    { background-image: linear-gradient(160deg, #ffd9ef 0%, #e3c4ff 55%, #a9c6ff 100%); }
.wp-thumb.wp-forest    { background-image: linear-gradient(160deg, #d8f5b5 0%, #9fe0b0 60%, #7cc9a6 100%); }
.wp-thumb.wp-latte     { background-image: linear-gradient(160deg, #f7e3c8 0%, #eebaa0 60%, #e09a8a 100%); }
.wp-thumb.wp-lavender  { background-image: linear-gradient(160deg, #e6d9ff 0%, #c3c9ff 55%, #9fb8ff 100%); }
.wp-thumb.wp-night     { background-image: linear-gradient(160deg, #2f4858 0%, #3c6e91 60%, #86bbd8 100%); }

/* 壁纸层画在 body 背景之上：有壁纸时 body 自身背景让位（html 底色仍在壁纸层下方兜底） */
body[class*="wp-"] { background: transparent; }

/* ================= 每日体重 ================= */

.cta .btn-ghost { margin-top: 10px; }

.wt-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.wt-big {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-top: 2px;
}

.wt-big span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #8b909a);
  margin-left: 4px;
}

.wt-deltas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.wt-delta {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 9px 10px;
}

.wt-delta span {
  display: block;
  font-size: 11.5px;
  color: var(--muted, #8b909a);
  margin-bottom: 3px;
}

.wt-delta b { font-size: 14px; font-weight: 600; }

.wt-down { color: #0f9d58; }
.wt-up { color: #e2583e; }
.wt-flat { color: var(--muted, #8b909a); font-weight: 500; }

.wt-chart { margin-top: 14px; }
.wt-chart svg { width: 100%; height: 120px; display: block; }

.wt-area { fill: rgba(47, 158, 138, .14); stroke: none; }

.wt-line {
  fill: none;
  stroke: var(--work, #2f9e8a);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.wt-dot {
  fill: #fff;
  stroke: var(--work, #2f9e8a);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.wt-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted, #8b909a);
  margin-top: 4px;
}

.wt-axis-mid { color: #9aa0ab; }

.wt-count { font-size: 12px; color: var(--muted, #8b909a); }

.wt-list { margin-top: 4px; }

.wt-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line, #ebedf1);
}

.wt-item:last-child { border-bottom: none; }

.wt-date {
  flex: 0 0 52px;
  text-align: center;
  background: #f5f6f9;
  border-radius: 10px;
  padding: 5px 0;
}

.wt-date b { display: block; font-size: 13px; }
.wt-date span { font-size: 10.5px; color: var(--muted, #8b909a); }

.wt-main { flex: 1; min-width: 0; }
.wt-value { font-size: 15.5px; font-weight: 600; }

.wt-value .wt-up,
.wt-value .wt-down,
.wt-value .wt-flat {
  font-size: 12.5px;
  font-weight: 500;
  margin-left: 4px;
}

.wt-note { font-size: 12.5px; color: var(--ink-2, #4a4f59); margin-top: 3px; word-break: break-all; }

.wt-media { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

.wt-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 9px;
  background: #f2f3f6 center/cover no-repeat;
  border: 1px solid var(--line, #ebedf1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.wt-thumb.video { background: #2b303a; }

.wt-thumb-del {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(22, 24, 29, .8);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wt-attach {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 8px;
}

.wt-draft-media { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

.wt-video {
  width: 100%;
  max-height: 360px;
  border-radius: 12px;
  background: #000;
  display: block;
  margin-bottom: 12px;
}

.wt-empty { text-align: center; padding: 8px 0 2px; }

/* AI 身材分析结果 */
.body-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0 12px;
}

.body-metric {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 10px 12px;
}

.body-metric span { display: block; font-size: 11.5px; color: var(--muted, #8b909a); }
.body-metric b { font-size: 17px; }

.body-advice { border-top: 1px solid var(--line, #ebedf1); padding-top: 10px; }

.body-advice li {
  position: relative;
  padding-left: 14px;
  font-size: 13.5px;
  color: var(--ink-2, #4a4f59);
  line-height: 1.7;
}

.body-advice li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--life, #10b981);
}

.wt-last-analysis {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 12px;
}

.wt-last-analysis b { display: block; font-size: 15px; margin-top: 2px; }
.wt-last-analysis .chip-btn { margin-top: 8px; }
.wt-last-date { font-size: 11.5px; color: var(--muted, #8b909a); }

.wt-analysis-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #ebedf1);
}

.wt-analysis-list li:last-child { border-bottom: none; }

.wt-analysis-thumb {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: #f2f3f6 center/cover no-repeat;
}

.wt-analysis-main { flex: 1; min-width: 0; }
.wt-analysis-main b { display: block; font-size: 14px; }
.wt-analysis-main span { font-size: 11.5px; color: var(--muted, #8b909a); }

/* ================= 聊天头像 / 用户资料卡（微信式一对一聊天） ================= */

/* ---- 通用头像框：没有图片时显示首字母（渐变底） ---- */
.av-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #2f9e8a, #45b89e);
  color: #fff;
  font-weight: 600;
  line-height: 1;
}

.av-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.av-xs { width: 20px; height: 20px; border-radius: 7px; font-size: 11px; }
.av-sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.av-msg { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.av-session { width: 44px; height: 44px; border-radius: 14px; font-size: 16px; }
.av-friend { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.av-profile { width: 72px; height: 72px; border-radius: 24px; font-size: 26px; }

/* ---- 会话列表：最后一条消息 + 右侧时间 ---- */
.session-preview {
  display: block;
  max-width: 100%;
  font-size: 12px;
  color: #8a8f98;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.session-time { font-size: 11px; color: #a0a5ad; font-style: normal; }

/* ---- 好友快选 chip：头像 + 昵称 ---- */
.dm-chip { display: inline-flex; align-items: center; gap: 6px; padding-left: 7px; }

/* ---- 好友列表：头像 + 昵称 ---- */
.friend-avatar { padding: 0; line-height: 0; flex-shrink: 0; }
.friend-main { flex: 1; min-width: 0; }

/* ---- 用户资料卡 ---- */
.pf-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 2px; }
.pf-name { font-size: 18px; font-weight: 700; }
.pf-sub { font-size: 12.5px; color: var(--muted, #8b909a); }
.pf-bio {
  font-size: 13.5px;
  color: var(--ink-2, #4a4f59);
  line-height: 1.65;
  text-align: center;
  margin: 12px 0 16px;
  padding: 0 6px;
  word-break: break-word;
}

.pf-meta { border-top: 1px solid var(--line, #ebedf1); }

.pf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line, #ebedf1);
  font-size: 13.5px;
}

.pf-row:last-child { border-bottom: none; }
.pf-row span { color: var(--muted, #8b909a); flex-shrink: 0; }
.pf-row b { font-weight: 600; text-align: right; word-break: break-all; }

/* 未读红点浮在会话头像右上角 */
.chat-list-view .session-list li { position: relative; }
.unread-dot-av {
  position: absolute;
  left: 48px;
  top: 10px;
  margin: 0;
  box-shadow: 0 0 0 2px #fff;
}
