/* ==========================================================================
   健康减脂 3.0 纯线上版 · 全局样式
   设计方向 A「清爽健康绿」：绿主色 + 米白底 + 大圆角卡片；浅色 / 深色双套。
   token 与 Design/tokens.json、HealthFatLoss/Views/Theme.swift 对齐。
   本文件只放全局布局与通用组件；视图专属样式见 views-a.css / views-b.css。
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg: #f4f7f2;
  --bg-soft: #eef4ec;
  --card: #ffffff;
  --text: #1c2a1e;
  --text-2: #6b7a6e;
  --text-3: #9aa89d;
  --sep: #e2ebe3;
  --accent: #2fbf63;
  --accent-strong: #23a852;
  --accent-soft: rgba(47, 191, 99, 0.14);
  --intake: #f08a24;
  --intake-soft: rgba(240, 138, 36, 0.14);
  --steps: #2f7de1;
  --steps-soft: rgba(47, 125, 225, 0.14);
  --base-burn: #e84b6a;
  --base-burn-soft: rgba(232, 75, 106, 0.14);
  --warning: #f08a24;
  --danger: #e84b6a;
  --success: #2fbf63;
  --inset: #eaf3ea;
  --ring-track: rgba(47, 191, 99, 0.14);
  --shadow: 0 4px 12px rgba(16, 32, 20, 0.06);
  --shadow-strong: 0 12px 32px rgba(16, 32, 20, 0.14);
  --radius-card: 18px;
  --radius-large: 22px;
  --radius-chip: 10px;
  --nav-height: 60px;
  --topbar-height: 56px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, var(--font);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f0c;
    --bg-soft: #111711;
    --card: #1a221c;
    --text: #f2f5f0;
    --text-2: #8e9a90;
    --text-3: #66736a;
    --sep: #2c382f;
    --accent: #3ddb78;
    --accent-strong: #4be987;
    --accent-soft: rgba(61, 219, 120, 0.18);
    --intake: #ffb340;
    --intake-soft: rgba(255, 179, 64, 0.16);
    --steps: #5ab0ff;
    --steps-soft: rgba(90, 176, 255, 0.16);
    --base-burn: #ff6b8a;
    --base-burn-soft: rgba(255, 107, 138, 0.16);
    --warning: #ffb340;
    --danger: #ff6b8a;
    --success: #3ddb78;
    --inset: #243028;
    --ring-track: rgba(61, 219, 120, 0.18);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-strong: 0 14px 36px rgba(0, 0, 0, 0.55);
  }
}

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

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body.has-sheet {
  overflow: hidden;
}

h1, h2, h3, h4, p {
  margin: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

.app-root {
  min-height: 100dvh;
}

.noscript {
  padding: 24px;
  text-align: center;
  color: var(--text-2);
}

.boot {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
}

/* ---------- App 外壳 ---------- */

.app-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--topbar-height) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
}

.topbar__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--sep);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1;
}

.sync-status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}

.sync-status.is-ok .sync-status__dot {
  background: var(--success);
}

.sync-status.is-busy .sync-status__dot {
  background: var(--warning);
  animation: pulse 1s ease-in-out infinite;
}

.sync-status.is-error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--sep));
}

.sync-status.is-error .sync-status__dot {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.content {
  flex: 1;
  width: 100%;
  padding: 8px 16px calc(var(--nav-height) + var(--safe-bottom) + 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--sep);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--text-3);
  border-radius: 12px;
  transition: color 0.15s ease;
}

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

.nav-item__label {
  font-size: 11px;
  font-weight: 600;
}

/* ---------- 卡片 / 布局工具 ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card--flat {
  box-shadow: none;
  border: 1px solid var(--sep);
}

.card__title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

.stack--tight {
  gap: 8px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline--between {
  justify-content: space-between;
}

.inline--wrap {
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  margin: 4px 2px 0;
}

.muted {
  color: var(--text-2);
}

.tiny {
  font-size: 12px;
}

.divider {
  height: 1px;
  background: var(--sep);
  border: 0;
  margin: 10px 0;
}

.spacer {
  flex: 1;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--inset);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent);
}

@media (prefers-color-scheme: dark) {
  .btn--primary {
    color: #08130c;
  }
}

.btn--ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

.btn--soft {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 11px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
}

.icon-btn:active {
  background: var(--inset);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon {
  display: block;
}

/* ---------- 表单 ---------- */

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

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field__hint {
  font-size: 12px;
  color: var(--text-3);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--sep);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* iOS 聚焦不缩放 */
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 420px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 分段控件 / chips ---------- */

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--inset);
}

.segmented__item {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.segmented__item.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--sep);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

.chip-btn:active {
  background: var(--inset);
}

.chip-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- 状态芯片 ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip--ok {
  color: var(--success);
  background: var(--accent-soft);
}

.chip--bad {
  color: var(--danger);
  background: var(--base-burn-soft);
}

.chip--pending {
  color: var(--text-2);
  background: var(--inset);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
}

/* ---------- 缺口环 / 指标 ---------- */

.ring {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 4px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ring__track {
  stroke: var(--ring-track);
}

.ring__progress {
  stroke: var(--accent);
  transition: stroke-dasharray 0.4s ease;
}

.ring--ok .ring__progress {
  stroke: var(--success);
}

.ring--bad .ring__progress {
  stroke: var(--intake);
}

.ring--pending .ring__progress {
  stroke: var(--text-3);
}

.ring__center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ring__value {
  font-family: var(--font-num);
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring__unit {
  font-size: 12px;
  color: var(--text-2);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--inset);
}

.metric__label {
  font-size: 12px;
  color: var(--text-2);
}

.metric__value {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric__unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.metric--intake .metric__value { color: var(--intake); }
.metric--steps .metric__value { color: var(--steps); }
.metric--burn .metric__value { color: var(--base-burn); }
.metric--exercise .metric__value { color: var(--success); }

/* ---------- 列表 ---------- */

.list {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--sep);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-item__title {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__sub {
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.list-item__value {
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 图表 ---------- */

.chart {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.chart__svg {
  width: 100%;
  height: auto;
  max-height: 200px;
  display: block;
  overflow: visible;
}

.chart__grid {
  stroke: var(--sep);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart__bar {
  fill: color-mix(in srgb, var(--steps) 70%, transparent);
}

.chart__line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__line--intake { stroke: var(--intake); }
.chart__line--deficit { stroke: var(--accent); }
.chart__line--weight { stroke: var(--steps); }
.chart__line--intake.chart__line + circle,
circle.chart__line--intake { fill: var(--intake); }

circle.chart__line--intake { fill: var(--intake); }
circle.chart__line--deficit { fill: var(--accent); }

.chart__dot { stroke: var(--card); stroke-width: 1.5; }
.chart__dot--weight { fill: var(--steps); }

.chart__label {
  font-family: var(--font);
  font-size: 10px;
  fill: var(--text-3);
}

.chart__label--end {
  text-anchor: end;
}

.chart__legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-2);
}

.chart__legend-item::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: 0;
}

.chart__legend-item--steps::before { background: var(--steps); }
.chart__legend-item--intake::before { background: var(--intake); }
.chart__legend-item--deficit::before { background: var(--accent); }

/* ---------- 提示 / 空状态 / 加载 ---------- */

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.45;
}

.notice--warn {
  background: var(--intake-soft);
  color: var(--warning);
}

.notice--error {
  background: var(--base-burn-soft);
  color: var(--danger);
}

.notice--success {
  background: var(--accent-soft);
  color: var(--accent);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  text-align: center;
}

.empty__fish {
  font-size: 42px;
  line-height: 1;
  filter: saturate(1.1);
}

.empty__title {
  font-size: 15px;
  font-weight: 700;
}

.empty__hint {
  font-size: 13px;
  color: var(--text-2);
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 12px;
  color: var(--text-2);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--sep);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 全屏错误 ---------- */

.fatal {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 24px;
  text-align: center;
}

.fatal--inline {
  min-height: 320px;
}

.fatal__emoji {
  font-size: 52px;
}

.fatal__title {
  font-size: 20px;
  font-weight: 700;
}

.fatal__message {
  color: var(--text-2);
  font-size: 14px;
  max-width: 320px;
}

.fatal__hint {
  color: var(--text-3);
  font-size: 12px;
  max-width: 320px;
}

/* ---------- Toast ---------- */

.toast-host {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  padding: 0 16px;
}

.toast {
  max-width: 92%;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-strong);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success { background: var(--success); color: #fff; }
.toast--error { background: var(--danger); color: #fff; }

@media (prefers-color-scheme: dark) {
  .toast--success { color: #08130c; }
}

/* ---------- Sheet / 对话框 ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 16, 10, 0.42);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.sheet-backdrop.is-open {
  opacity: 1;
}

.sheet {
  width: 100%;
  max-width: 720px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-strong);
  transform: translateY(14px);
  transition: transform 0.2s ease;
  padding-bottom: var(--safe-bottom);
}

.sheet-backdrop.is-open .sheet {
  transform: translateY(0);
}

@media (min-width: 721px) {
  .sheet-backdrop {
    align-items: center;
  }

  .sheet {
    border-radius: 22px;
    max-width: 560px;
    padding-bottom: 0;
  }

  .sheet--wide {
    max-width: 680px;
  }
}

.sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
}

.sheet__title {
  font-size: 17px;
  font-weight: 700;
}

.sheet__body {
  padding: 4px 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet__actions {
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--sep);
}

.sheet__actions .btn {
  flex: 1;
}

.confirm-message {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ---------- 登录页 ---------- */

.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 20px calc(32px + var(--safe-bottom));
  background:
    radial-gradient(120% 70% at 50% 0%, var(--accent-soft), transparent 62%),
    var(--bg);
}

.auth__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.auth__logo {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 44px;
  line-height: 1;
}

.auth__title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.auth__subtitle {
  font-size: 13px;
  color: var(--text-2);
}

.auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius-large);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth__tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--inset);
}

.auth__tab {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
}

.auth__tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.auth__form {
  display: flex;
  flex-direction: column;
}

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

.auth__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.auth__hint {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.auth__error {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--base-burn-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.auth__footnote {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

/* ---------- 对话 ---------- */

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100dvh - var(--topbar-height) - var(--safe-top) - var(--nav-height) - var(--safe-bottom) - 40px);
}

.chat__list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 4px 2px 8px;
}

.chat__row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 100%;
}

.chat__row--user {
  justify-content: flex-end;
}

.chat__avatar {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 18px;
  flex: none;
}

.chat__bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat__bubble--assistant {
  background: var(--card);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow);
}

.chat__bubble--user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 6px;
}

@media (prefers-color-scheme: dark) {
  .chat__bubble--user {
    color: #08130c;
  }
}

.chat__bubble--error {
  background: var(--base-burn-soft);
  color: var(--danger);
}

.chat__bubble-image {
  border-radius: 10px;
  margin-bottom: 6px;
  max-height: 220px;
  object-fit: cover;
}

.chat__text {
  white-space: pre-wrap;
}

.chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.chat__input {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  outline: none;
}

.chat__send {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 12px;
}

.chat__attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.chat__preview {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
}

.chat__attachment-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-2);
}

/* ---------- 通用行 / KV ---------- */

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
}

.kv__label {
  color: var(--text-2);
}

.kv__value {
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--sep);
  background: none;
  text-align: left;
  color: var(--text);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row__icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.settings-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.settings-row__title {
  font-size: 15px;
  font-weight: 600;
}

.settings-row__sub {
  font-size: 12px;
  color: var(--text-2);
}

.settings-row__chevron {
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
}

.mono {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
