/* ============================================================
   Domo v4 — Airbnb 风格设计系统
   ------------------------------------------------------------
   设计原则（DESIGN.md）：
   - 纯白底，Rausch Red (#ff385c) 单一主色
   - Near-black (#222222) 暖黑，不用纯黑
   - 三层卡片阴影
   - 大圆角：8px 按钮 / 20px 卡片 / 50% 圆形
   - 字重 500-700，无 thin
   ============================================================ */

:root {
  /* 调色板 */
  --rausch: #ff385c;
  --rausch-deep: #e00b41;
  --ink: #222222;
  --ink-2: #3f3f3f;
  --muted: #6a6a6a;
  --muted-2: #929292;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: #c1c1c1;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #f2f2f2;
  --green: #008a05;
  --green-soft: #e7f5e8;
  --red: #c13515;
  --red-soft: #fceeea;
  --amber: #b67b2c;
  --amber-soft: #fbf0d8;
  --blue: #428bff;

  /* 三层卡片阴影（Airbnb 招牌） */
  --shadow-card:
    rgba(0, 0, 0, 0.02) 0 0 0 1px,
    rgba(0, 0, 0, 0.04) 0 2px 6px,
    rgba(0, 0, 0, 0.1) 0 4px 8px;
  --shadow-hover: rgba(0, 0, 0, 0.12) 0 6px 16px;
  --shadow-pop: rgba(0, 0, 0, 0.18) 0 12px 28px;

  /* 圆角阶梯 */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Modal 内边距：desktop 24px / mobile 18px（保持 head/body/foot 三段对齐） */
  --modal-pad-x: 24px;

  /* 字体 */
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
}

/* PWA standalone（添加到主屏后）：补 iOS 刘海 / Android 状态栏的安全区 */
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(72px + env(safe-area-inset-top));
  }
  body {
    /* 防止 iOS 主屏 PWA 双击放大 */
    touch-action: manipulation;
  }
}
@supports (-webkit-touch-callout: none) {
  /* iOS Safari：避免输入框聚焦时整屏被缩放 */
  input, select, textarea {
    font-size: 16px;
  }
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   Topbar — Airbnb 风顶部条
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  height: 72px;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rausch);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.brand-mark {
  font-size: 24px;
  line-height: 1;
}

.brand-name {
  letter-spacing: -0.3px;
}

.topnav {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.topnav button {
  height: 42px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.18s, color 0.18s;
}

.topnav button:hover {
  background: var(--surface-3);
}

.topnav button.active {
  color: var(--ink);
  background: var(--surface-3);
  font-weight: 600;
}

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

.couple-chip {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  gap: 6px;
  transition: box-shadow 0.18s;
}

.couple-chip:hover {
  box-shadow: var(--shadow-hover);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 16px;
  overflow: hidden;
}

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-3);
  transition: box-shadow 0.18s, transform 0.18s;
}

.icon-btn:hover {
  box-shadow: var(--shadow-hover);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================================
   Page shell
   ============================================================ */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px;
}

.view {
  display: grid;
  gap: 24px;
}

/* ============================================================
   Mobile tabbar
   ============================================================ */
.mobile-tabbar {
  display: none;
}

@media (max-width: 720px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .topbar {
    height: 60px;
    padding: 0 16px;
    gap: 12px;
  }

  .topnav {
    display: none;
  }

  .page {
    padding: 16px;
  }

  .mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }

  .mobile-tabbar button {
    display: grid;
    place-items: center;
    gap: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }

  .mobile-tabbar button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-linecap: round;
  }

  .mobile-tabbar button.active {
    color: var(--ink);
    font-weight: 600;
  }

  .mobile-tabbar button.active svg {
    fill: var(--ink);
    fill-opacity: 0.08;
    stroke: var(--ink);
  }
}

/* ============================================================
   Hero card — 主页大主角卡
   ============================================================ */
.hero-card {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--surface);
}

.hero-photo {
  position: relative;
  aspect-ratio: 16 / 7;
  background: linear-gradient(135deg, #fde7ec, #ffe4d4 60%, #fff8ed);
  overflow: hidden;
}

/* 窄屏：把 16:7 → 16:5 让 hero 高度从 ~172px → ~124px，留出更多空间显示
   下面的净资产 / 目标 / 健康度卡，首屏信息密度提升 */
@media (max-width: 480px) {
  .hero-photo { aspect-ratio: 16 / 5; }
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(40px) saturate(1.3);
  transform: scale(1.15);
  z-index: 0;
}

.hero-photo img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  z-index: 1;
}

.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

.hero-overlay {
  position: absolute;
  left: 24px;
  bottom: 20px;
  right: 24px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.hero-overlay .eyebrow {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  margin-bottom: 4px;
}

.hero-overlay h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.hero-body {
  padding: 24px 28px 28px;
}

.hero-net {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-net .number {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.hero-net .trend {
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

.hero-net .trend.up {
  color: var(--green);
  background: var(--green-soft);
}

.hero-net .trend.down {
  color: var(--red);
  background: var(--red-soft);
}

.hero-net .label {
  margin-right: auto;
  color: var(--muted);
  font-size: 14px;
}

.hero-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hero-spark {
  margin-top: 16px;
  width: 100%;
  height: 64px;
  display: block;
}

/* ============================================================
   Cards (通用)
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
}

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

.card-title h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.card-title .more {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}

.card-title .more:hover {
  background: var(--surface-3);
  color: var(--ink);
}

/* 进度卡 */
.goal-card .goal-headline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.goal-card .goal-pct {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.goal-card .goal-pct .unit {
  font-size: 16px;
  color: var(--muted);
  margin-left: 2px;
  font-weight: 500;
}

.goal-card .goal-status {
  font-size: 13px;
  color: var(--muted);
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--rausch), #ff7a8e);
  border-radius: inherit;
  transition: width 0.4s ease;
}

.goal-numbers {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.goal-numbers strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* 三联状态卡（健康/备用金/月节余） */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-emoji {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 22px;
  opacity: 0.85;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--muted);
}

.stat-card.ok .stat-value { color: var(--green); }
.stat-card.warn .stat-value { color: var(--amber); }
.stat-card.danger .stat-value { color: var(--red); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  white-space: nowrap;
}

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

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

.btn-primary:active {
  transform: scale(0.97);
}

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

.btn-dark:hover {
  background: #000;
}

.btn-soft {
  background: var(--surface-3);
  color: var(--ink);
}

.btn-soft:hover {
  background: #e8e8e8;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn-ghost:hover {
  background: var(--surface-3);
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* FAB — 浮动操作按钮 */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--rausch);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 56, 92, 0.4);
  transition: transform 0.18s, box-shadow 0.18s;
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 28px rgba(255, 56, 92, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

.fab svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

@media (max-width: 720px) {
  .fab {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   Lists & rows
   ============================================================ */
.list {
  display: grid;
  gap: 4px;
}

.row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-radius: var(--r-md);
  transition: background 0.14s;
}

.row:hover {
  background: var(--surface-2);
}

.row-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.row-main strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.1px;
}

.row-main span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.row-amount {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-amount.in {
  color: var(--green);
}

.row-amount.out {
  color: var(--ink);
}

/* Account list — 资产视图的账户卡 */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.account-card {
  display: grid;
  gap: 4px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s, transform 0.18s;
  cursor: pointer;
}

.account-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.account-card .account-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.account-card .account-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.account-card .account-amount {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  margin-top: 4px;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
}

.tier-pill.instant { color: var(--green); background: var(--green-soft); }
.tier-pill.short { color: #305d95; background: #e3edf8; }
.tier-pill.medium { color: #4d6ba0; background: #eef1f8; }
.tier-pill.pending { color: var(--amber); background: var(--amber-soft); }
.tier-pill.usage { color: var(--muted); background: var(--surface-3); }
/* 旧 tier 名向后兼容 */
.tier-pill.high { color: #305d95; background: #e3edf8; }
.tier-pill.low { color: var(--muted); background: var(--surface-3); }

/* ============================================================
   Market card — 市场价（汇率/金价）
   ============================================================ */
.market-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 10px;
}

.market-cell {
  display: grid;
  gap: 2px;
}

.market-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.market-cell strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.market-sub {
  font-size: 11px;
  color: var(--muted-2);
}

.market-foot {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .market-row { grid-template-columns: repeat(2, 1fr); }
}

/* Account-sub 行（"≈ ¥X · 现价 Y"） */
.account-sub {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* 外币 / 黄金账户的 CNY 等值（次主字号，比 sub 大比 primary 小） */
.account-cny-eqv {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  opacity: 0.85;
}

/* income tab: 概览 stat 卡 3 列 */
.income-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 480px) {
  .income-stat-grid { grid-template-columns: 1fr; }
}
.income-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.income-stat-label { font-size: 12px; color: var(--muted); }
.income-stat-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.income-stat-sub { font-size: 11px; color: var(--muted); }
.income-stat-delta { font-size: 11px; font-weight: 500; }
.income-stat-delta.in { color: var(--green, #10b981); }
.income-stat-delta.out { color: var(--rausch, #e11d48); }

/* income 近 6 月柱状图 */
.income-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.income-bar-row {
  display: grid;
  grid-template-columns: 36px 1fr 80px;
  align-items: center;
  gap: 8px;
}
.income-bar-label { font-size: 12px; color: var(--muted); }
.income-bar-track {
  height: 12px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}
/* 共享 progress fill 基类：height 100% + transition，子类只覆盖 background + border-radius */
.income-bar-fill,
.income-source-fill,
.sub-goal-fill {
  height: 100%;
  transition: width 0.3s ease;
}
.income-bar-fill {
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 6px;
}
.income-bar-value {
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* 对账 modal：手记 vs 账单导入并排对比，每对二选一删除或都保留 */
.reconcile-list { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.reconcile-pair {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2);
}
.reconcile-pair-head {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.reconcile-pair-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}
@media (max-width: 480px) {
  .reconcile-pair-grid { grid-template-columns: 1fr; }
  .reconcile-vs { transform: rotate(90deg); justify-self: center; }
}
.reconcile-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
}
.reconcile-side-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.reconcile-side-cat { font-weight: 600; }
.reconcile-side-amount { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reconcile-side-meta { font-size: 11px; color: var(--muted); }
.reconcile-side-note { font-size: 11px; color: var(--muted); font-style: italic; }
.reconcile-side .btn { margin-top: 6px; padding: 6px 10px; font-size: 12px; }
.reconcile-vs {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* 行内置 inactive 态：暗淡 + 删除线，让用户一眼看出哪条暂停了 */
.row.row-inactive { opacity: 0.45; }
.row.row-inactive .row-main strong,
.row.row-inactive .row-amount { text-decoration: line-through; text-decoration-thickness: 1px; }

/* recurring rule 行：4 列 grid（icon + main + amount + toggle）*/
.row.recurring-rule-row {
  grid-template-columns: 40px 1fr auto auto;
}

/* 循环规则启用 / 暂停 switch（仿 iOS） */
.rule-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}
.rule-toggle input { opacity: 0; width: 0; height: 0; }
.rule-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 22px;
  transition: background 0.2s;
}
.rule-toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.rule-toggle input:checked + .rule-toggle-slider {
  background: var(--rausch, #e11d48);
}
.rule-toggle input:checked + .rule-toggle-slider::before {
  transform: translateX(16px);
}

/* 子目标卡：主 goal 下方专项储蓄目标列表 */
.sub-goals-card .card-title h3 { font-weight: 600; }
.sub-goal-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.sub-goal-row {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.sub-goal-row:hover { background: var(--surface-3, #f0f0f0); }
.sub-goal-row.done { opacity: 0.7; }
.sub-goal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.sub-goal-icon { font-size: 16px; }
.sub-goal-name { flex: 1; font-size: 14px; }
.sub-goal-pct {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sub-goal-row.done .sub-goal-pct { color: var(--green, #10b981); font-weight: 500; }
.sub-goal-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.sub-goal-fill {
  background: linear-gradient(90deg, var(--rausch, #e11d48), #f59e0b);
  border-radius: 3px;
}
.sub-goal-row.done .sub-goal-fill {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}
.sub-goal-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* income 来源分布 */
.income-source-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.income-source-row { display: flex; flex-direction: column; gap: 4px; }
.income-source-head { display: flex; justify-content: space-between; font-size: 13px; }
.income-source-amt { color: var(--muted); font-variant-numeric: tabular-nums; }
.income-source-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.income-source-fill {
  background: linear-gradient(90deg, #10b981, #84cc16);
  border-radius: 3px;
}

/* + 新增账户 瓦片 */
.add-account-tile {
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  box-shadow: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  min-height: 130px;
  padding: 18px 20px;
}

.add-account-tile:hover {
  background: #fff5f7;
  border-color: var(--rausch);
  transform: none;
}

.add-account-tile .add-icon {
  font-size: 28px;
  font-weight: 300;
  color: var(--rausch);
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff5f7;
  display: grid;
  place-items: center;
}

.add-account-tile .add-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.add-account-tile .add-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
   Allocation horizontal bar
   ============================================================ */
.alloc-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--surface-3);
  margin: 6px 0 16px;
}

.alloc-bar-seg {
  height: 100%;
}

.alloc-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.alloc-legend-item {
  display: grid;
  gap: 2px;
}

.alloc-legend-item .alloc-key {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.alloc-legend-item .alloc-key i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.alloc-legend-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Insights view: tab switcher
   ============================================================ */
.insight-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.insight-tabs button {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.insight-tabs button.active {
  background: var(--ink);
  color: #fff;
}

/* 大图表容器 */
.chart-card {
  padding: 24px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-svg .axis-label {
  font-size: 11px;
  fill: var(--ink);
  opacity: 0.7;
}

.chart-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.chart-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
}

.chart-pill.up { color: var(--green); background: var(--green-soft); }
.chart-pill.down { color: var(--red); background: var(--red-soft); }

/* Forecast list */
.forecast-list {
  display: grid;
  gap: 8px;
}

.forecast-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.forecast-row.warn { background: var(--amber-soft); }
.forecast-row.danger { background: var(--red-soft); }

.forecast-month {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.forecast-row .net {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.forecast-row .net.in { color: var(--green); }
.forecast-row .net.out { color: var(--red); }

.forecast-row .cash {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* FIRE 三档 */
.fire-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.fire-card {
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.fire-card .fire-rate {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.fire-card .fire-years {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 4px 0;
}

.fire-card .fire-detail {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Health 5 维 */
.health-grid {
  display: grid;
  gap: 12px;
}

.health-row {
  display: grid;
  gap: 6px;
}

.health-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.health-row-head .label {
  font-weight: 500;
}

.health-row-head .value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeIn 0.18s;
  cursor: pointer; /* 视觉提示：点空白处可关闭 */
}
.modal-backdrop > .modal {
  cursor: auto; /* 但 modal 内部恢复默认 */
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  width: min(440px, 100%);
  max-height: 92vh;
  /* dvh 在支持的浏览器上更准确（避开 iOS 动态地址栏导致的视口跳变）*/
  max-height: 92dvh;
  /* flex column：head 顶 / body 滚 / foot 底 —— foot 永远贴底 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.22s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px var(--modal-pad-x);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.modal-body {
  padding: 22px var(--modal-pad-x) 18px;
  display: grid;
  gap: 14px;
  flex: 1 1 auto;
  overflow-y: auto;
  /* iOS 上的惯性滚动 */
  -webkit-overflow-scrolling: touch;
}

/* foot 永远贴在 modal 底部；renderModal 把它从 form body 里 hoist 出来，作为 .modal 的直接子节点 */
.modal-foot {
  padding: 12px var(--modal-pad-x);
  /* iOS PWA 主屏模式下避开 home indicator */
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface);
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}

/* 编辑账户 modal：左侧 🗑 删除 + 右侧保存 */
.modal-foot--split {
  justify-content: space-between;
}

/* confirm/info modal 的正文 —— 和 .field 字号一致，pre-wrap 保留换行 */
.modal-prompt-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.1px;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  /* 16px 是 iOS Safari 的最小不缩放阈值 — 全平台统一 */
  font-size: 16px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field textarea {
  height: auto;
  min-height: 80px;
  padding: 12px 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.08);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Type chips for transaction modal */
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-row button {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.14s, color 0.14s;
}

.chip-row button.active {
  background: var(--ink);
  color: #fff;
}

/* ============================================================
   Settings drawer — 用 modal 的容器，内容是 sections
   ============================================================ */
.settings-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

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

.settings-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* details/summary 折叠节：h4 跟 sub stats 一行，点击 summary 展开收起 */
details.settings-collapse summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  user-select: none;
}
details.settings-collapse summary::-webkit-details-marker { display: none; }
details.settings-collapse summary h4 { margin: 0; }
details.settings-collapse summary::after {
  content: "▸";
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.15s ease;
}
details.settings-collapse[open] summary::after { transform: rotate(90deg); }
.settings-collapse-sub {
  margin-left: auto;
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  display: grid;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state .pet {
  font-size: 56px;
  margin-bottom: 4px;
}

.empty-state strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.empty-state-cta {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.section-head-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.ask-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 16px;
  border: 1px solid var(--border, #e5e5e5);
  background: var(--surface, #fff);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.ask-ai-btn:hover {
  background: var(--surface-2, #f7f7f7);
  border-color: var(--ink);
}

.date-chip-row,
.ledger-date-chips,
.ledger-owner-chips {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ledger-date-chips,
.ledger-owner-chips { margin-top: 0; margin-bottom: 12px; }

/* active 态 chip：用户当前选中的归属 */
.ledger-owner-chips .date-chip.active {
  background: var(--ink);
  color: var(--surface, #fff);
  border-color: var(--ink);
  opacity: 1;
}
.date-chip {
  padding: 4px 10px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--muted, #888);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.date-chip:hover {
  background: var(--surface-2, #f7f7f7);
  color: var(--ink);
  border-color: var(--ink);
}

/* ============================================================
   Section spacing & headers
   ============================================================ */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 4px 4px 0;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.section-head .section-sub {
  color: var(--muted);
  font-size: 13px;
}

/* Tag */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink-2);
}

.tag.green { color: var(--green); background: var(--green-soft); }
.tag.red { color: var(--red); background: var(--red-soft); }
.tag.amber { color: var(--amber); background: var(--amber-soft); }
.tag.rausch { color: var(--rausch); background: #ffe6eb; }

/* ============================================================
   Hero switcher — 🐱 / 🐶 切换按钮（情绪价值小按钮）
   ============================================================ */
.hero-switcher {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  animation: heroSwitcherIn 0.5s ease-out;
}

@keyframes heroSwitcherIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-pet-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 18px;
  background: transparent;
  transition: transform 0.18s, background 0.18s;
}

.hero-pet-btn:hover {
  background: var(--surface-3);
  transform: scale(1.1);
}

.hero-pet-btn:active {
  transform: scale(0.85) rotate(-12deg);
}

.hero-pet-btn.active {
  background: var(--ink);
  color: #fff;
  animation: petBtnPop 0.35s;
}

@keyframes petBtnPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18) rotate(-8deg); }
  100% { transform: scale(1); }
}

/* Hero photo 自动平滑过渡 */
.hero-photo img {
  animation: heroPhotoFade 0.45s ease-out;
}

@keyframes heroPhotoFade {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: scale(1); }
}

.hero-card:hover .hero-photo img {
  transform: scale(1.02);
  transition: transform 0.6s ease;
}

/* Hero 文字进场动画 */
.hero-overlay h1 {
  animation: heroTextRise 0.5s ease-out 0.1s backwards;
}

.hero-overlay .eyebrow {
  animation: heroTextRise 0.5s ease-out backwards;
}

@keyframes heroTextRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 大数字进场 */
.hero-net .number {
  animation: heroNumberRise 0.55s ease-out 0.15s backwards;
}

@keyframes heroNumberRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 卡片整体出场 */
.card,
.hero-card {
  animation: cardRise 0.4s ease-out backwards;
}

@keyframes cardRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 卡片悬停轻微提升 */
.card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

/* 进度条填充动画 */
.progress-fill {
  animation: progressFill 0.8s ease-out;
}

@keyframes progressFill {
  from { width: 0 !important; }
}

/* Couple chip 头像 hover */
.avatar {
  transition: transform 0.2s;
}

.couple-chip:hover .avatar {
  transform: scale(1.08);
}

/* FAB 呼吸效果 */
.fab {
  animation: fabPulse 2.5s ease-in-out infinite;
}

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(255, 56, 92, 0.4); }
  50% { box-shadow: 0 8px 28px rgba(255, 56, 92, 0.55), 0 0 0 6px rgba(255, 56, 92, 0.08); }
}

.fab:hover {
  animation: none;
}

/* 数字 hover 微效（金额 cell） */
.account-card .account-amount,
.hero-net .number {
  transition: transform 0.18s;
}

.account-card:hover .account-amount {
  transform: translateX(2px);
}

/* ============================================================
   Pet polaroid — 装饰性贴图
   ============================================================ */
.pet-polaroid {
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card), 0 4px 12px rgba(0, 0, 0, 0.12);
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 30px;
}

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

.pet-polaroid.tilt-r { transform: rotate(6deg); }
.pet-polaroid.tilt-l { transform: rotate(-5deg); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .stat-row {
    grid-template-columns: 1fr;
  }

  .fire-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero-overlay h1 {
    font-size: 22px;
  }

  .hero-net .number {
    font-size: 34px;
  }

  .goal-card .goal-pct {
    font-size: 24px;
  }

  .stat-card .stat-value {
    font-size: 22px;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .section-head h2 {
    font-size: 19px;
  }

  .card {
    padding: 18px;
  }

  /* 移动端 modal 内边距统一收窄到 18px，head/body/foot 三段对齐 */
  .modal {
    --modal-pad-x: 18px;
  }

  .bills-summary-row {
    grid-template-columns: 1fr 1fr;
  }

  .bills-filter-bar {
    padding: 14px;
  }

  .donut-row {
    flex-direction: column;
    align-items: center;
  }

  .time-grid {
    grid-template-columns: 1fr;
  }

  .bills-table {
    font-size: 12px;
  }

  .bills-table th,
  .bills-table td {
    padding: 8px 6px;
  }

  .merchant-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .merchant-amount {
    text-align: left;
  }

  .bill-preview-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================================
   账单模块（独立分析层）
   ============================================================ */
.bills-view {
  position: relative;
}

.bills-empty {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 56, 92, 0.08), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(66, 139, 255, 0.08), transparent 60%),
    var(--surface);
}

.bills-empty-inner {
  text-align: center;
  padding: 40px 20px 20px;
}

.bills-empty-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.bills-empty h2 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.4px;
}

.bills-empty p {
  margin: 0 auto 8px;
  max-width: 480px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.bills-empty-meta {
  font-size: 12px !important;
  color: var(--muted-2) !important;
}

.bills-empty-actions {
  margin: 20px 0 12px;
}

.bills-empty-hint {
  font-size: 12px !important;
  color: var(--muted-2) !important;
}

.bills-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
  padding: 16px 20px;
}

.bills-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bills-filter-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.bill-toggle {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface);
  transition: all .15s;
}

.bill-toggle.on {
  border-color: var(--rausch);
  color: var(--rausch);
  background: rgba(255, 56, 92, 0.08);
}

.bills-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.bill-stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  animation: cardRise .35s ease-out both;
}

.bill-stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.bill-stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.bill-stat-sub {
  color: var(--muted-2);
  font-size: 12px;
}

.donut-row {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-top: 8px;
}

.donut {
  flex-shrink: 0;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.donut-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.donut-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.donut-label {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-meta {
  color: var(--muted);
  font-size: 12px;
}

.donut-foot {
  margin: 12px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

.merchant-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.merchant-row {
  display: grid;
  grid-template-columns: 140px 1fr 130px;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid transparent;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.merchant-row:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.merchant-name {
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-bar-wrap {
  height: 8px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.merchant-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--rausch) 0%, var(--rausch-deep) 100%);
  border-radius: var(--r-pill);
  transition: width .4s ease-out;
}

.merchant-amount {
  text-align: right;
  display: flex;
  flex-direction: column;
}

.merchant-amount strong {
  font-size: 14px;
  color: var(--ink);
}

.merchant-amount span {
  color: var(--muted);
  font-size: 11px;
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  padding-top: 8px;
}

.time-block h4 {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.dow-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  height: 160px;
}

.dow-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.dow-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  overflow: hidden;
  min-height: 8px;
}

.dow-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--rausch) 0%, var(--rausch-deep) 100%);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: height .4s ease-out;
  min-height: 2px;
}

.dow-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.dow-meta {
  font-size: 10px;
  color: var(--muted-2);
}

.month-trend-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.month-trend-svg {
  width: 100%;
  height: auto;
  max-height: 160px;
}

.month-trend-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.month-trend-tick {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--muted-2);
  text-align: center;
}

.month-trend-tick strong {
  color: var(--ink);
  font-size: 12px;
}

.month-trend-single {
  display: flex;
  gap: 14px;
  align-items: end;
  height: 160px;
}

.month-trend-bar-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.month-trend-bar {
  width: 60%;
  background: linear-gradient(180deg, var(--rausch) 0%, var(--rausch-deep) 100%);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  margin-top: auto;
}

.month-trend-label {
  font-size: 12px;
  color: var(--muted);
}

.month-trend-amount {
  font-size: 11px;
  color: var(--ink);
  font-weight: 600;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-row {
  display: grid;
  grid-template-columns: 200px 1fr 100px;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
}

.channel-meta strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-meta span {
  font-size: 11px;
  color: var(--muted);
}

.channel-bar-wrap {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.channel-bar {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width .4s ease-out;
}

.channel-amount {
  text-align: right;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

.anomaly-block {
  margin-top: 8px;
}

.anomaly-block:first-child {
  margin-top: 0;
}

.anomaly-block h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.list.compact .row {
  padding: 8px 12px;
}

.bills-table-wrap {
  overflow-x: auto;
  margin: 0 -8px;
  padding: 0 8px;
}

.bills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bills-table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
}

.bills-table th.amt,
.bills-table td.amt {
  text-align: right;
  white-space: nowrap;
}

.bills-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}

.bills-table tbody tr:hover {
  background: var(--surface-2);
}

.bills-table tbody tr.expense td.amt {
  color: var(--red);
}

.bills-table tbody tr.income td.amt {
  color: var(--green);
}

.bills-table td {
  padding: 10px 8px;
  vertical-align: top;
}

.bill-time {
  color: var(--muted-2);
  font-size: 11px;
}

.bill-desc {
  display: block;
  color: var(--muted);
  font-size: 11px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  margin-right: 4px;
}

.bill-tag.mapped {
  background: var(--green-soft);
  color: var(--green);
}

.bill-source {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
}

.bill-source.wechat {
  background: var(--green-soft);
  color: var(--green);
}

.bill-source.alipay {
  background: rgba(66, 139, 255, 0.12);
  color: var(--blue);
}

/* Upload modal */
.bill-upload {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bill-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}

.bill-drop:hover,
.bill-drop.dragging {
  border-color: var(--rausch);
  background: rgba(255, 56, 92, 0.04);
}

.bill-drop-icon {
  font-size: 36px;
}

.bill-drop strong {
  color: var(--ink);
  font-size: 14px;
}

.bill-drop span {
  color: var(--muted);
  font-size: 12px;
}

.bill-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.bill-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.bill-preview.error {
  background: var(--red-soft);
  color: var(--red);
}

.bill-preview-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bill-preview-head strong {
  font-size: 14px;
  color: var(--ink);
}

.bill-preview-head span {
  font-size: 12px;
  color: var(--muted);
}

.bill-preview-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.bill-preview-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border-radius: var(--r-sm);
}

.bill-preview-stats strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.bill-preview-stats strong.in {
  color: var(--rausch);
}

.bill-preview-stats strong.warn {
  color: var(--amber);
}

.bill-preview-stats strong.ok {
  color: var(--green);
}

.bill-preview-stats span {
  font-size: 11px;
  color: var(--muted);
}

.bill-preview-table-wrap {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.bill-push-section {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--surface);
  transition: all .15s;
}

.bill-push-section.expanded {
  border-color: var(--rausch);
  border-style: solid;
  background: rgba(255, 56, 92, 0.03);
}

.bill-push-toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}

.bill-push-toggle input {
  margin-top: 2px;
}

.bill-push-toggle strong {
  font-weight: 600;
}

.bill-push-toggle span {
  color: var(--muted);
  font-size: 12px;
}

.bill-push-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.bill-push-count {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.bill-push-count strong {
  color: var(--rausch);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   记账批量模式
   ============================================================ */
.ledger-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.ledger-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ledger-bulk-toggle,
.ledger-import-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.ledger-bulk-toggle:hover,
.ledger-import-btn:hover {
  border-color: var(--rausch);
  color: var(--rausch);
}

.ledger-bulk-toggle.active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.ledger-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.ledger-search-input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 14px;
  color: var(--ink);
}
.ledger-date-input {
  padding: 7px 10px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 13px;
  color: var(--ink);
  min-width: 0;
}
.ledger-date-sep {
  color: var(--muted, #999);
  font-size: 13px;
}
.ledger-search-clear {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--muted, #999);
  cursor: pointer;
  font-size: 14px;
}
.ledger-search-clear:hover { background: var(--surface-2, #f7f7f7); color: var(--ink); }
.ledger-result-count {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted, #999);
  background: var(--surface-2, #f7f7f7);
  border-bottom: 1px solid var(--border, #e5e5e5);
}
@media (max-width: 480px) {
  .ledger-search-row { gap: 6px; }
  /* 真机 393：search 独占一行更直观，否则 search + date_from 同行视觉混乱 */
  .ledger-search-input { flex-basis: 100%; }
  /* 两个 date input + clear 按钮共享第二行；flex:1 让 from/to 等分 */
  .ledger-date-input { font-size: 12px; padding: 7px 8px; flex: 1 1 calc(50% - 24px); min-width: 0; }
  .ledger-date-sep { display: none; }
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  border-left: 3px solid var(--rausch);
  flex-wrap: wrap;
}

.bulk-bar.empty {
  border-left-color: var(--line-strong);
  color: var(--muted);
  font-size: 13px;
}

.bulk-bar strong {
  font-size: 14px;
  color: var(--ink);
}

.row.selectable {
  cursor: pointer;
  grid-template-columns: 22px 40px 1fr auto;
  padding-left: 8px;
}

.row-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--rausch);
  margin: 0;
}

.row.selected {
  background: rgba(255, 56, 92, 0.06);
}

.bulk-sample {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

/* ============================================================
   FIRE baseline 编辑
   ============================================================ */
.fire-baseline {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.fire-baseline label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fire-baseline-input {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  height: 40px;
  transition: border-color .15s;
}

.fire-baseline-input:focus-within {
  border-color: var(--rausch);
}

.fire-baseline-input input {
  border: none;
  outline: none;
  width: 110px;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: transparent;
}

.fire-currency {
  color: var(--muted);
  font-size: 15px;
}

.fire-suffix {
  color: var(--muted);
  font-size: 13px;
}

.fire-suggestion {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}

.fire-suggestion.highlight {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(0, 138, 5, 0.3);
  font-weight: 500;
}

.fire-suggestion:hover {
  border-color: var(--rausch);
  color: var(--rausch);
}

.fire-suggestion-empty {
  color: var(--muted-2);
  font-size: 12px;
}

/* ============================================================
   AI 顾问
   ============================================================ */
.advisor-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.advisor-privacy {
  background: var(--surface-2);
  padding: 14px 18px;
}

.advisor-privacy strong {
  font-size: 13px;
  color: var(--ink);
}

.advisor-privacy p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.advisor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
}

.advisor-empty {
  text-align: center;
  padding: 40px 24px;
}

.advisor-empty-icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.advisor-empty h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.advisor-empty p {
  margin: 0 auto;
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.advisor-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 20px;
}

.advisor-loading strong {
  color: var(--ink);
  font-size: 14px;
}

.advisor-loading span {
  color: var(--muted);
  font-size: 12px;
}

.advisor-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--rausch);
  animation: spin 0.8s linear infinite;
}

.advisor-spinner-small {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--rausch);
  animation: spin 0.8s linear infinite;
  margin-left: auto;
}

.advisor-streaming {
  padding: 22px 24px;
}

.advisor-streaming-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.advisor-streaming-head strong {
  font-size: 14px;
  color: var(--ink);
}

.ai-think-badge {
  display: none;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
}

.advisor-stream-text {
  min-height: 80px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.advisor-stream-text::after {
  content: "▋";
  display: inline-block;
  margin-left: 2px;
  color: var(--rausch);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { to { opacity: 0; } }

.advisor-streaming-hint {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

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

.advisor-error {
  background: var(--red-soft);
  color: var(--red);
}

.advisor-error strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.advisor-error p {
  margin: 0;
  font-size: 13px;
  word-break: break-word;
}

.advisor-response {
  padding: 24px 28px;
}

.advisor-response-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.advisor-response-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.advisor-response-head span {
  color: var(--muted);
  font-size: 12px;
}

.ai-md {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.ai-md h3,
.ai-md h4,
.ai-md h5 {
  margin: 8px 0 0;
  color: var(--ink);
  font-weight: 600;
}

.ai-md h3 { font-size: 16px; }
.ai-md h4 { font-size: 15px; }
.ai-md h5 { font-size: 14px; color: var(--muted); }

.ai-md p {
  margin: 0;
}

.ai-md strong {
  color: var(--ink);
  font-weight: 600;
}

.ai-md code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.ai-md ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-md-hr {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 4px 0;
}

.ai-md li {
  list-style: disc;
}

.advisor-disclaimer {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}

.advisor-snapshot-pre {
  max-height: 360px;
  overflow: auto;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .advisor-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .advisor-response {
    padding: 18px 20px;
  }
}

/* ============================================================
   Sync Indicator + Auth Menu
   ============================================================ */
.mg-sync-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.mg-sync-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 12px;
  color: var(--ink-2);
  transition: box-shadow 0.18s, background 0.18s;
}
.mg-sync-trigger:hover { background: var(--surface-3); }

.mg-sync-dot {
  font-size: 12px;
  line-height: 1;
  width: 14px;
  text-align: center;
}
.mg-sync-label {
  font-size: 12px;
  font-weight: 500;
}
.mg-sync-avatar {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--rausch);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

.mg-sync-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px;
  z-index: 80;
}
.mg-sync-menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mg-sync-menu-head strong { font-size: 13px; }
.mg-sync-menu-head span { font-size: 11px; color: var(--muted); }
.mg-sync-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.mg-sync-menu-item:hover { background: var(--surface-3); }
.mg-sync-menu-item.primary { color: var(--rausch); font-weight: 600; }
.mg-sync-menu-item.danger { color: #dc2626; }

@media (max-width: 720px) {
  .mg-sync-label { display: none; }
  .mg-sync-trigger { padding: 0 8px; }
}

/* Auth Modal */
.mg-auth-modal { max-width: 420px; }
.mg-auth-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.mg-auth-hint-small {
  margin-top: 8px;
  font-size: 12px;
}
.mg-auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: 10px;
  margin-bottom: 14px;
}
.mg-auth-tabs button {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  background: transparent;
}
.mg-auth-tabs button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.mg-auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mg-auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.mg-auth-form label span { color: var(--ink-2); font-weight: 500; }
.mg-auth-form input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.mg-auth-form input:focus {
  outline: 2px solid var(--rausch);
  outline-offset: -1px;
  border-color: var(--rausch);
}
.mg-auth-form .btn {
  height: 42px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}
.mg-auth-form .btn-primary {
  background: var(--rausch);
  color: #fff;
}
.mg-auth-form .btn-primary:hover { background: var(--rausch-deep); }
.mg-auth-form .btn-primary:disabled { opacity: 0.6; cursor: progress; }
.mg-auth-form .btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
}
.mg-auth-form .mg-auth-secondary { font-weight: 500; }
.mg-auth-err {
  min-height: 16px;
  font-size: 12px;
  color: #dc2626;
}

/* ============================================================
   学习视图（知识库 / 体检 / 检查清单）
   ============================================================ */
.learn-view { padding-bottom: 40px; }

/* 知识库列表 */
.kb-retry-row {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.kb-progress {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kb-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.kb-progress-sub { font-size: 12px; color: var(--muted); }
.kb-progress-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.kb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rausch), #ff7a8e);
  transition: width 0.3s;
}

.kb-category { padding: 18px 22px; }
.kb-cat-title {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--ink);
}
.kb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.kb-card {
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.06s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-card:hover {
  border-color: var(--rausch);
  box-shadow: 0 4px 12px rgba(255, 56, 92, 0.08);
}
.kb-card:active { transform: translateY(1px); }
.kb-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.kb-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}
.kb-card-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #d1fae5;
  color: #047857;
  flex-shrink: 0;
}
.kb-card-summary {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.kb-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: auto;
}

/* 课程：大纲 + 索引 */
.kb-courses { padding: 18px 22px; }
.kb-courses-title {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--ink);
}
.kb-courses-sub {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--muted);
}
.kb-course-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  margin-bottom: 12px;
}
.kb-course-card:last-child { margin-bottom: 0; }
.kb-course-head { margin-bottom: 12px; }
.kb-course-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kb-course-icon { font-size: 22px; line-height: 1; }
.kb-course-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kb-course-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}
.kb-course-level {
  font-size: 11px;
  color: var(--muted);
}
.kb-course-progress {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  flex-shrink: 0;
}
.kb-course-summary {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.kb-course-chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kb-course-chapter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  transition: background 0.15s, transform 0.06s;
}
.kb-course-chapter:hover:not(:disabled) { background: var(--surface-3); }
.kb-course-chapter:active:not(:disabled) { transform: translateY(1px); }
.kb-course-chapter:disabled,
.kb-course-chapter.is-pending {
  cursor: default;
  opacity: 0.55;
}
.kb-course-chapter.is-read {
  background: #ecfdf5;
}
.kb-course-chapter.is-read:hover { background: #d1fae5; }
.kb-course-chapter-title {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
}
.kb-course-chapter-meta {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .kb-course-title { font-size: 14px; }
  .kb-course-chapter { font-size: 12px; padding: 8px 10px; }
  .kb-course-chapter-meta { font-size: 10px; }
}

/* 文章详情 */
.kb-article-wrap { display: flex; flex-direction: column; gap: 14px; }
.kb-article-toolbar {
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.kb-reading-prefs {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.kb-reading-prefs-label { white-space: nowrap; }
.kb-reading-pref-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}
.kb-reading-pref-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
/* 字号挡位（基于 .kb-md 的 15px 基准 ±2px）*/
.kb-article-fs-S .kb-md { font-size: 13px; }
.kb-article-fs-M .kb-md { font-size: 15px; }
.kb-article-fs-L .kb-md { font-size: 17px; line-height: 1.85; }
.kb-article {
  padding: 28px 32px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.kb-article-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* Markdown 渲染 */
.kb-md { color: var(--ink); line-height: 1.7; font-size: 15px; }
.kb-md-h1 { font-size: 24px; margin: 0 0 16px; font-weight: 700; }
.kb-md-h2 { font-size: 20px; margin: 28px 0 12px; font-weight: 700; color: var(--ink); }
.kb-md-h3 { font-size: 17px; margin: 22px 0 10px; font-weight: 600; }
.kb-md-h4 { font-size: 15px; margin: 16px 0 8px; font-weight: 600; }
.kb-md-p { margin: 0 0 14px; }
.kb-md-list { margin: 0 0 14px; padding-left: 22px; }
.kb-md-list li { margin-bottom: 6px; }
.kb-md-quote {
  margin: 14px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--rausch);
  background: #fff5f7;
  color: var(--ink-2);
  font-style: italic;
  border-radius: 0 8px 8px 0;
}
.kb-md-table-wrap {
  margin: 14px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Lea Verou 滚动阴影：白色遮罩 background-attachment:local 跟随内容滚动，
     阴影 scroll 固定在视口；端点处遮罩盖住阴影 → 自动消失。
     提示宽表格右侧还有内容，无需 JS 探测 overflow。 */
  background:
    linear-gradient(to right, var(--surface, #fff) 30%, transparent) left center / 28px 100% no-repeat,
    linear-gradient(to left, var(--surface, #fff) 30%, transparent) right center / 28px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)) left center / 24px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)) right center / 24px 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.kb-md-table {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 13px;
}
.kb-md-table th,
.kb-md-table td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.kb-md-table th {
  background: var(--surface-3);
  font-weight: 600;
}
.kb-md-table tr:nth-child(even) td { background: #fafafa; }
.kb-md-hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px dashed var(--line);
}
.kb-md-code {
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--rausch-deep);
}
.kb-md-link {
  color: var(--rausch);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.kb-md-link:hover { color: var(--rausch-deep); }
.kb-md-link-internal { font-weight: 500; }

/* 体检 */
.checkup-wrap { display: flex; flex-direction: column; gap: 14px; }
.checkup-intro { padding: 18px 22px; }
.checkup-intro h3 { margin: 0 0 8px; }
.checkup-intro p { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
.checkup-disclaimer { font-size: 12px; color: var(--muted); }
.checkup-card {
  padding: 16px 20px;
  border-left: 4px solid var(--line);
}
.checkup-card.checkup-ok { border-left-color: #16a34a; }
.checkup-card.checkup-warn { border-left-color: #d97706; }
.checkup-card.checkup-bad { border-left-color: #dc2626; }
.checkup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.checkup-head h4 { margin: 0; font-size: 15px; }
.checkup-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.checkup-badge-ok { background: #d1fae5; color: #047857; }
.checkup-badge-warn { background: #fef3c7; color: #92400e; }
.checkup-badge-bad { background: #fee2e2; color: #991b1b; }
.checkup-current { font-size: 14px; margin: 0 0 6px; }
.checkup-current strong { font-weight: 600; }
.checkup-sep { color: var(--muted); font-size: 12px; }
.checkup-target { color: var(--ink-2); font-size: 13px; }
.checkup-detail {
  margin: 8px 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.checkup-action { margin-top: 8px; }

/* 情境检查 */
.checklist-wrap { display: flex; flex-direction: column; gap: 14px; }
.checklist-intro { padding: 18px 22px; }
.checklist-intro h3 { margin: 0 0 8px; }
.checklist-intro p { margin: 0; color: var(--ink-2); font-size: 14px; }
.checklist-card { padding: 18px 22px; }
.checklist-card h4 { margin: 0 0 10px; font-size: 15px; }
.checklist-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
}
.checklist-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}
.checklist-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.checklist-result {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.checklist-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.checklist-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--surface-3);
  border-radius: 8px;
  flex: 1;
  min-width: 140px;
}
.checklist-stats strong { font-size: 12px; color: var(--muted); font-weight: 500; }
.checklist-stats span { font-size: 16px; font-weight: 600; color: var(--ink); }
.checklist-verdict {
  padding: 12px 16px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.checklist-verdict.checklist-ok { background: #ecfdf5; color: #047857; }
.checklist-verdict.checklist-warn { background: #fffbeb; color: #92400e; }
.checklist-verdict.checklist-bad { background: #fef2f2; color: #991b1b; }
.checklist-verdict strong { font-size: 14px; }
.checklist-verdict span { font-size: 12px; opacity: 0.85; }
.checklist-note {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
  line-height: 1.6;
}
.checklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0 14px;
}
.checklist-table th,
.checklist-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
}
.checklist-table th {
  background: var(--surface-3);
  font-weight: 600;
}
.checklist-cell-ok {
  background: #ecfdf5;
}
.checklist-tier-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.checklist-flags {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}
.checklist-flag {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  color: var(--ink-2);
}
.checklist-flag:hover { background: var(--surface-3); }
.checklist-flag input { margin-top: 2px; }

@media (max-width: 720px) {
  .kb-list { grid-template-columns: 1fr; }
  .kb-article { padding: 18px 20px; }
  .kb-md-h1 { font-size: 20px; }
  .kb-md-h2 { font-size: 17px; }
  .kb-md-table { font-size: 12px; }
  .kb-md-table th, .kb-md-table td { padding: 6px 8px; }
  .checkup-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .checklist-table { font-size: 11px; }
  .checklist-table th, .checklist-table td { padding: 6px; }
}

/* ============================================================
   AI 顾问聊天界面
   ============================================================ */
.chat-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.chat-header-left {
  display: flex;
  gap: 12px;
  align-items: center;
}
.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde7ec, #ffe4d4);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.chat-header-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.chat-header-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-privacy {
  margin: 0;
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
}

.chat-stream {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 65vh;
  /* dvh：iOS 地址栏切换时高度更准；vh 仍作 fallback */
  max-height: 65dvh;
  overflow-y: auto;
}

.chat-welcome {
  text-align: center;
  padding: 20px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.chat-welcome-icon { font-size: 36px; }
.chat-welcome h3 { margin: 0; font-size: 17px; }
.chat-welcome p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  max-width: 520px;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.chat-suggestion {
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chat-suggestion:hover {
  border-color: var(--rausch);
  background: #fff5f7;
  color: var(--rausch);
}

.chat-bubble-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-bubble-row.is-user {
  flex-direction: row-reverse;
}
.chat-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-mini-avatar-user {
  background: linear-gradient(135deg, #fde7ec, #ffe4d4);
}

.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  position: relative;
  word-break: break-word;
}
.chat-bubble-user {
  background: var(--rausch);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-user .ai-md {
  color: #fff;
}
.chat-bubble-user code,
.chat-bubble-user .kb-md-code { color: #fff; background: rgba(255,255,255,0.2); }
.chat-bubble-assistant {
  background: var(--surface-3);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.chat-bubble .ai-md p:first-child { margin-top: 0; }
.chat-bubble .ai-md p:last-child { margin-bottom: 0; }
.chat-bubble-ts {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.55;
  text-align: right;
}
.chat-bubble-user .chat-bubble-ts { color: #fff; }

.chat-streaming-text {
  white-space: pre-wrap;
  min-height: 1.6em;
}
.chat-pending-dots {
  font-size: 18px;
  letter-spacing: 4px;
  opacity: 0.5;
}

/* typing indicator: 3 个跳动小点，inside chat bubble 替代静态 "…" */
.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  min-height: 1em;
}
.chat-typing-dots > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: chat-dot-bounce 1.4s ease-in-out infinite;
}
.chat-typing-dots > span:nth-child(2) { animation-delay: 0.16s; }
.chat-typing-dots > span:nth-child(3) { animation-delay: 0.32s; }
@keyframes chat-dot-bounce {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-streaming-hint {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0 0 36px;
}
.chat-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--rausch);
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
}
@keyframes chat-spin {
  to { transform: rotate(360deg); }
}

.chat-error {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  padding: 6px 4px;
  font-family: inherit;
  color: var(--ink);
  max-height: 120px;
}
.chat-input::placeholder { color: var(--muted); }
.chat-input:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-send {
  flex-shrink: 0;
  height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--rausch);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border: 0;
}
.chat-send:hover:not(:disabled) { background: var(--rausch-deep); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 720px) {
  .chat-header { flex-direction: column; align-items: flex-start; }
  .chat-header-actions { width: 100%; justify-content: flex-start; }
  .chat-bubble { max-width: 88%; font-size: 13px; }
  .chat-stream { max-height: 60vh; max-height: 60dvh; padding: 14px; }
  .chat-suggestion { font-size: 12px; padding: 6px 10px; }
}

/* ============================================================
   主题：Chiikawa-vibe（仅自用，参见 docs/PERSONAL_THEME_NOTES.md）
   通过 <html data-theme="chiikawa"> 激活
   ============================================================ */
:root[data-theme="chiikawa"] {
  --rausch: #ffaa9b;
  --rausch-deep: #ff8a73;
  --bg: #fff9f0;
  --surface: #fffdf7;
  --surface-3: #ffeed8;
  --line: #fce5d4;
  --line-strong: #f4cba9;
  --ink: #6b4f3a;
  --ink-2: #8b6e58;
  --muted: #c2a48a;
  --amber: #c98a3a;
  --amber-soft: #fbe7c8;
  --shadow-card: 0 2px 6px rgba(255, 170, 155, 0.12);
  --shadow-hover: 0 6px 20px rgba(255, 170, 155, 0.22);
  --r-card: 18px;
  --r-pill: 999px;
}
:root[data-theme="chiikawa"] body,
:root[data-theme="chiikawa"] button,
:root[data-theme="chiikawa"] input,
:root[data-theme="chiikawa"] textarea,
:root[data-theme="chiikawa"] select {
  font-family: "Zen Maru Gothic", "M PLUS Rounded 1c", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
}
:root[data-theme="chiikawa"] .card,
:root[data-theme="chiikawa"] .modal {
  border-radius: 22px;
}
:root[data-theme="chiikawa"] .topbar {
  background: var(--surface);
  border-bottom-color: var(--line);
}
:root[data-theme="chiikawa"] .brand-name {
  color: #d97a6c;
  letter-spacing: 0;
}
:root[data-theme="chiikawa"] .topnav button.active {
  background: #ffe0d0;
  color: #b65040;
}
:root[data-theme="chiikawa"] .btn-primary,
:root[data-theme="chiikawa"] .btn-dark {
  background: linear-gradient(135deg, #ffaa9b, #ff8aa3);
  box-shadow: 0 2px 6px rgba(255, 138, 163, 0.3);
}
:root[data-theme="chiikawa"] .chat-bubble-assistant {
  background: #fff5e8;
}
:root[data-theme="chiikawa"] .chat-bubble-user {
  background: linear-gradient(135deg, #ffaa9b, #ff8aa3);
}
:root[data-theme="chiikawa"] .kb-md-quote {
  background: #fff0d8;
  border-left-color: #ffaa9b;
}

/* 角色 SVG */
.mg-char-wrap {
  display: inline-block;
  width: 100%;
  max-width: 140px;
}
.mg-char {
  width: 100%;
  height: auto;
  display: block;
}

/* 4 格漫画 */
.mg-comic {
  padding: 14px 18px;
  background: linear-gradient(135deg, #fffaf0, #fff5e6);
  border: 2px solid var(--line-strong);
  border-radius: 18px;
  margin-top: 12px;
}
.mg-comic-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}
.mg-comic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mg-comic-panel {
  background: #fff;
  border: 2px solid #e8d5be;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 180px;
  position: relative;
}
.mg-comic-panel .mg-char-wrap {
  max-width: 110px;
}
.mg-comic-narrator {
  background: #fffbeb;
  border: 1px dashed #d9b482;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-2);
  align-self: stretch;
  text-align: center;
  font-style: italic;
}
.mg-comic-speech {
  position: relative;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  background: #fff;
  border: 1.5px solid var(--ink-2);
  max-width: 95%;
  color: var(--ink);
}
.mg-comic-speech::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 7px solid var(--ink-2);
}
.mg-comic-speech::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 23px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid #fff;
}

@media (max-width: 720px) {
  .mg-comic-grid { grid-template-columns: 1fr; }
  .mg-comic-panel { min-height: 160px; }
}

/* AI 顾问 · 漫画生成按钮 */
.chat-comic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff0d8, #ffe0d0);
  border: 1.5px solid #f4cba9;
  color: #b65040;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.chat-comic-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(255, 170, 155, 0.3);
}
.chat-comic-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* 主题选择 UI */
.theme-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s;
}
.theme-option:hover { border-color: var(--rausch); background: var(--surface-3); }
.theme-option.active {
  border-color: var(--rausch);
  background: linear-gradient(135deg, #fff5f7, #ffe8d6);
}
.theme-option-emoji {
  font-size: 24px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}
.theme-option-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.theme-option-text strong { font-size: 13px; color: var(--ink); }
.theme-option-text span { font-size: 11px; color: var(--muted); line-height: 1.5; }
.theme-option-check {
  color: var(--rausch);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

/* ===== 账单分析新卡片：金额分布 / 必要弹性 / 类目趋势 / 订阅 ===== */
.card-sub {
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.card-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* 金额分布 */
.amt-buckets { display: flex; flex-direction: column; gap: 12px; }
.amt-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
}
.amt-label { font-size: 13px; color: var(--ink); font-weight: 600; }
.amt-bars { display: flex; flex-direction: column; gap: 6px; }
.amt-bar {
  position: relative;
  height: 22px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.amt-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width .4s ease-out;
  position: absolute;
  left: 0;
  top: 0;
}
.amt-bar-fill.cnt { background: linear-gradient(90deg, #428bff, #5a9bff); }
.amt-bar-fill.amt { background: linear-gradient(90deg, #ff385c, #ff7a90); }
.amt-bar-text {
  position: relative;
  z-index: 1;
  padding: 0 10px;
  font-size: 11px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.amt-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}
.amt-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.amt-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.amt-legend-dot.cnt { background: #428bff; }
.amt-legend-dot.amt { background: #ff385c; }

/* 必要 vs 弹性 */
.ess-bar-stack {
  display: flex;
  height: 22px;
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 6px 0 16px;
  background: var(--surface-3);
}
.ess-bar-seg { height: 100%; transition: width .4s ease-out; }
.ess-rows { display: flex; flex-direction: column; gap: 10px; }
.ess-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 12px;
  align-items: center;
}
.ess-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.ess-meta strong { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.ess-meta span { font-size: 11px; color: var(--muted); }
.ess-amt { text-align: right; }
.ess-amt strong { display: block; font-size: 14px; color: var(--ink); font-weight: 700; }
.ess-amt span { font-size: 11px; color: var(--muted); }

/* 类目月度趋势 */
.cat-trend-wrap { margin-top: 8px; }
.cat-trend-svg {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface-3);
  border-radius: 12px;
  padding: 8px 0;
}
.cat-trend-months {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 16px 0;
}
.cat-trend-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.cat-trend-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr 80px 70px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.cat-trend-dot { width: 10px; height: 10px; border-radius: 2px; }
.cat-trend-name { color: var(--ink); font-weight: 600; }
.cat-trend-last { color: var(--muted); text-align: right; }
.cat-trend-arrow { font-size: 11px; font-weight: 600; text-align: right; }
.cat-trend-arrow.up { color: #c13515; }
.cat-trend-arrow.down { color: #008a05; }
.cat-trend-arrow.flat { color: var(--muted); }

/* 订阅识别 */
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-3);
  border-radius: 10px;
}
.sub-icon { font-size: 18px; text-align: center; }
.sub-main strong { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.sub-main span { font-size: 11px; color: var(--muted); }
.sub-amount { text-align: right; }
.sub-amount strong { display: block; font-size: 14px; color: var(--ink); font-weight: 700; }
.sub-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: #ecfdf5;
  color: #008a05;
  margin-top: 2px;
}

@media (max-width: 480px) {
  .amt-row { grid-template-columns: 86px 1fr; gap: 8px; }
  .amt-bar-text { font-size: 10px; padding: 0 8px; }
  .cat-trend-legend-row { grid-template-columns: 10px 1fr 70px 60px; gap: 8px; font-size: 11px; }
  .ess-row { grid-template-columns: 10px 1fr auto; gap: 8px; }
}

/* ===== 课程工具条 + 章末小测 ===== */
.kb-course-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.kb-course-tool {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--surface-3);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  transition: all .18s;
}
.kb-course-tool:hover:not(:disabled) { border-color: var(--rausch); background: var(--surface-3); }
.kb-course-tool:disabled { opacity: 0.55; cursor: not-allowed; }
.kb-course-tool.primary {
  background: var(--rausch);
  color: #fff;
  border-color: var(--rausch);
}
.kb-course-tool.primary:hover:not(:disabled) {
  background: var(--rausch);
  filter: brightness(1.05);
}
.kb-course-tool.done {
  background: #ecfdf5;
  border-color: #d1fae5;
  color: #008a05;
}

/* 文章末尾页脚 */
.kb-article-footer {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kb-article-footer-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kb-article-footer-tag {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.kb-article-footer-ch {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.kb-article-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quiz / Survey 表单 */
.quiz-form { display: flex; flex-direction: column; gap: 18px; }
.quiz-hint {
  margin: 0;
  padding: 10px 14px;
  background: var(--surface-3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}
.quiz-q { display: flex; flex-direction: column; gap: 10px; }
.quiz-q-title {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--surface-3);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  transition: all .15s;
}
.quiz-option:hover:not(:disabled) { border-color: var(--rausch); background: var(--surface-3); }
.quiz-option.selected {
  border-color: var(--rausch);
  background: #fff5f7;
}
.quiz-option.correct {
  border-color: #008a05;
  background: #ecfdf5;
  color: #008a05;
}
.quiz-option.wrong {
  border-color: #c13515;
  background: #fef2f2;
  color: #c13515;
}
.quiz-option:disabled { cursor: default; }
.quiz-option-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.quiz-option.selected .quiz-option-letter { background: var(--rausch); color: #fff; }
.quiz-option.correct .quiz-option-letter { background: #008a05; color: #fff; }
.quiz-option.wrong .quiz-option-letter { background: #c13515; color: #fff; }
.quiz-option-text { flex: 1; line-height: 1.4; }
.quiz-explain {
  margin: 4px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  background: var(--surface-3);
}
.quiz-explain.ok { background: #ecfdf5; color: #006400; }
.quiz-explain.no { background: #fef2f2; color: #8a2020; }

.quiz-result-block {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff5f7, #ffe8d6);
  border: 1px solid var(--surface-3);
}
.quiz-result-block h4 { margin: 0 0 6px; font-size: 14px; color: var(--ink); }
.quiz-result-block p { margin: 0 0 4px; font-size: 13px; color: var(--ink); line-height: 1.5; }
.quiz-result-block p:last-child { margin-bottom: 0; }
.quiz-recommend { margin-top: 6px; }

@media (max-width: 480px) {
  .quiz-option { padding: 9px 12px; font-size: 12px; }
  .quiz-q-title { font-size: 13px; }
  .kb-article-footer { padding: 16px 18px; }
}

/* ===== AI 学习教练：问 AI / 报告 ===== */
.askai-form { display: flex; flex-direction: column; gap: 14px; }
.askai-context {
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff5f7, #ffe8d6);
  border: 1px solid var(--surface-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.askai-ctx-tag { font-size: 11px; color: var(--muted); font-weight: 600; }
.askai-ctx-ch { font-size: 14px; color: var(--ink); font-weight: 700; }
.askai-ctx-hint { margin: 4px 0 0; font-size: 11px; color: var(--muted); }

.askai-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.askai-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
}
.askai-msg.user {
  background: var(--rausch);
  color: #fff;
  align-self: flex-end;
  max-width: 85%;
}
.askai-msg.assistant {
  background: var(--surface-3);
  color: var(--ink);
  align-self: flex-start;
  max-width: 95%;
}
.askai-msg.assistant .ai-md p,
.askai-msg.assistant .ai-md ul,
.askai-msg.assistant .ai-md h3,
.askai-msg.assistant .ai-md h4 { margin: 6px 0; }
.askai-msg.assistant .ai-md ul { padding-left: 18px; }
.askai-msg.streaming { background: var(--surface-3); }
.askai-thinking { color: var(--muted); font-size: 12px; }
.askai-error {
  padding: 10px 14px;
  background: #fef2f2;
  color: #c13515;
  border-radius: 8px;
  font-size: 12px;
}
.askai-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.askai-suggestion {
  text-align: left;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--surface-3);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.askai-suggestion:hover { border-color: var(--rausch); background: var(--surface-3); }
.askai-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.askai-input-row textarea {
  flex: 1;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--surface-3);
  border-radius: 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  min-height: 56px;
}
.askai-input-row textarea:focus { outline: none; border-color: var(--rausch); }

.aireport-form { display: flex; flex-direction: column; gap: 14px; }
.aireport-context {
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff5f7, #ffe8d6);
  border: 1px solid var(--surface-3);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.aireport-tag { font-size: 13px; color: var(--ink); font-weight: 700; }
.aireport-kind {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--rausch);
  color: #fff;
  font-weight: 600;
}
.aireport-body {
  padding: 16px 18px;
  background: var(--surface-3);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  max-height: 480px;
  overflow-y: auto;
}
.aireport-body .ai-md h3,
.aireport-body .ai-md h4 { margin: 14px 0 6px; color: var(--ink); }
.aireport-body .ai-md h3:first-child,
.aireport-body .ai-md h4:first-child { margin-top: 0; }
.aireport-body .ai-md p { margin: 6px 0; }
.aireport-body .ai-md ul { margin: 6px 0; padding-left: 20px; }
.aireport-body .ai-md li { margin: 3px 0; }

/* ---------------- AI tool indicator + proposals (PR-1) ---------------- */
.ai-tool-events {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.ai-tool-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border, rgba(0,0,0,0.06));
}
.ai-tool-badge-running {
  background: rgba(255, 180, 60, 0.12);
  border-color: rgba(255, 180, 60, 0.35);
  color: #b86e00;
  animation: ai-tool-pulse 1.4s ease-in-out infinite;
}
.ai-tool-badge-done {
  background: rgba(45, 175, 110, 0.10);
  border-color: rgba(45, 175, 110, 0.32);
  color: #1d7a4c;
}
@keyframes ai-tool-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.ai-proposals-wrap {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 12px;
}
.ai-proposal {
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: var(--r-md, 12px);
  padding: 12px 14px;
  background: var(--surface-2);
}
.ai-proposal-applied {
  background: rgba(45, 175, 110, 0.08);
  border-color: rgba(45, 175, 110, 0.32);
}
.ai-proposal-dismissed {
  opacity: 0.55;
  background: transparent;
}
.ai-proposal-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 8px;
}
.ai-proposal-head strong { font-size: 14px; color: var(--ink); }
.ai-proposal-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.ai-proposal-tag.applied { background: rgba(45, 175, 110, 0.18); color: #1d7a4c; }
.ai-proposal-tag.dismissed { background: var(--surface-2); color: var(--muted); }
.ai-proposal-rows {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 8px;
  font-size: 13px;
}
.ai-proposal-row {
  display: flex; justify-content: space-between; gap: 8px;
}
.ai-proposal-row-label { color: var(--muted); }
.ai-proposal-row-value { color: var(--ink); font-variant-numeric: tabular-nums; }
.ai-proposal-reason {
  margin: 4px 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.ai-proposal-actions {
  display: flex; gap: 8px;
  margin-top: 4px;
}
.ai-proposal-actions .btn { padding: 6px 14px; font-size: 13px; }

/* ---------------- AI Nudge bubble (PR-2) ---------------- */
.ai-nudge-list {
  display: flex; flex-direction: column;
  gap: 10px; margin: 0 0 4px;
}
.ai-nudge {
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: var(--r-md, 12px);
  padding: 12px 14px;
  background: var(--surface);
}
.ai-nudge-collapsed.ai-nudge-warn {
  border-color: rgba(255, 90, 90, 0.32);
  background: rgba(255, 90, 90, 0.06);
}
.ai-nudge-collapsed.ai-nudge-info {
  border-color: rgba(40, 130, 220, 0.28);
  background: rgba(40, 130, 220, 0.05);
}
.ai-nudge-expanded {
  border-color: rgba(255, 56, 92, 0.28);
  background: var(--surface);
}
.ai-nudge-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 8px;
}
.ai-nudge-icon {
  font-size: 18px;
  margin-right: 6px;
  vertical-align: middle;
}
.ai-nudge-title {
  font-size: 14px;
  color: var(--ink);
  vertical-align: middle;
}
.ai-nudge-head strong {
  font-size: 14px;
  color: var(--ink);
  vertical-align: middle;
}
.ai-nudge-x, .ai-nudge-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 6px;
}
.ai-nudge-x:hover, .ai-nudge-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.ai-nudge-actions {
  display: flex; gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ai-nudge-actions .btn { padding: 6px 14px; font-size: 13px; }
.ai-nudge-expand {
  font-weight: 500;
}
.ai-nudge-expanded .ai-md {
  margin-top: 4px;
}
.ai-nudge-expanded .ai-md p:first-child { margin-top: 0; }

/* ---------------- 今日简报 banner / modal (PR-3) ---------------- */
.brief-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md, 12px);
  background: linear-gradient(135deg, rgba(255, 56, 92, 0.06) 0%, rgba(255, 180, 60, 0.05) 100%);
  border: 1px solid rgba(255, 56, 92, 0.14);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.brief-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 56, 92, 0.10);
}
.brief-banner-loading {
  cursor: default;
  opacity: 0.75;
}
.brief-banner-loading:hover { transform: none; box-shadow: none; }

/* stale brief：用浅黄色 amber 提示用户在看的不是今天的简报 */
.brief-banner-stale {
  background: linear-gradient(135deg, #fff8e1 0%, #fef3c7 100%);
  border-color: #fbbf24;
}
.brief-stale-badge {
  margin-left: 6px;
  color: #b45309;
  font-weight: 500;
  font-size: 12px;
}
.brief-banner-left {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1;
}
.brief-icon { font-size: 18px; }
.brief-banner-text {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.brief-banner-text strong {
  font-size: 13px;
  color: var(--ink);
}
.brief-banner-hook {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brief-banner-arrow {
  font-size: 12px;
  color: var(--accent, #ff385c);
  white-space: nowrap;
  font-weight: 500;
}
.brief-modal .ai-md { max-height: 60vh; max-height: 60dvh; overflow-y: auto; }
.brief-modal .ai-md h3,
.brief-modal .ai-md h4 { margin: 14px 0 6px; color: var(--ink); }
.brief-modal .ai-md h3:first-child,
.brief-modal .ai-md h4:first-child { margin-top: 0; }
.brief-meta {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border, rgba(0,0,0,0.06));
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
 * Demo 模式横幅
 * ============================================================ */
.demo-banner {
  /* normal flow，避免和 topbar 都 sticky 造成层级冲突；首屏即可见，滚动时让位 */
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(90deg, #fff8e3 0%, #ffe9c4 100%);
  border-bottom: 1px solid #f5d28e;
  color: #7a5b1a;
  font-size: 13px;
}
.demo-banner-icon { font-size: 18px; }
.demo-banner-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.demo-banner-text strong { color: #5e4515; }
.demo-banner-text span { font-size: 11px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-banner-cta {
  flex-shrink: 0;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.7); color: #7a5b1a;
  font-size: 12px; text-decoration: none;
  border: 1px solid rgba(122,91,26,0.2);
}
.demo-banner-cta:hover { background: rgba(255,255,255,0.95); }

/* 登录抽屉的 demo 入口 */
.mg-auth-demo {
  margin-top: 10px;
  width: 100%;
  border: 1px dashed var(--border, rgba(0,0,0,0.15));
  background: rgba(255, 234, 200, 0.4);
  color: #7a5b1a;
}
.mg-auth-demo:hover { background: rgba(255, 234, 200, 0.7); }

/* ============================================================
 * Duolingo 化：学习 streak / XP / 困困状态卡
 * ============================================================ */
.learn-streak-card {
  background: linear-gradient(135deg, #fff7ee 0%, #fff 100%);
  border: 1px solid var(--border, rgba(0,0,0,0.06));
  display: flex; flex-direction: column; gap: 14px;
}
.learn-streak-main {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
.learn-streak-kunkun {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0; flex: 1;
}
.learn-streak-kunkun-emoji {
  font-size: 38px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(255, 130, 60, 0.2));
}
.learn-streak-kunkun-line {
  font-size: 13px; color: var(--muted);
  font-weight: 500;
}
.learn-streak-stats {
  display: flex; gap: 16px;
  align-items: center;
}
.learn-streak-stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 56px;
}
.learn-streak-stat-value {
  font-size: 22px; font-weight: 700;
  color: var(--ink, #222);
  line-height: 1.1;
}
.learn-streak-stat-label {
  font-size: 11px; color: var(--muted);
  margin-top: 2px;
}
/* 今日目标进度环（CSS conic-gradient） */
.learn-streak-goal-ring {
  --p: 0;
  --size: 56px;
  --thickness: 6px;
  position: relative;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: conic-gradient(
    var(--accent, #ff385c) calc(var(--p) * 1%),
    rgba(0,0,0,0.06) 0
  );
  display: grid; place-items: center;
}
.learn-streak-goal-ring::before {
  content: ""; position: absolute;
  inset: var(--thickness);
  border-radius: 50%;
  background: var(--card, #fff);
}
.learn-streak-goal-num {
  position: relative;
  font-size: 11px; font-weight: 600;
  color: var(--ink, #222);
  z-index: 1;
}

/* 伴侣进度行：每个伴侣一条 */
.learn-streak-partner {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: rgba(28, 176, 246, 0.06);
  border-radius: 10px;
}
.learn-streak-partner-icon { font-size: 20px; line-height: 1; }
.learn-streak-partner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.learn-streak-partner-text strong { font-size: 13px; color: var(--ink, #222); }
.learn-streak-partner-text span { font-size: 11px; color: var(--muted); }

/* 家庭连胜横条 */
.learn-streak-household {
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(255,200,0,0.15) 0%, rgba(88,204,2,0.12) 100%);
  border: 1px solid rgba(255,200,0,0.25);
  border-radius: 10px;
  font-size: 12px; font-weight: 500;
  color: #7a5b1a;
  text-align: center;
}

.learn-streak-pk {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.02);
  border-radius: 12px;
}
.learn-streak-pk-label {
  font-size: 11px; color: var(--muted);
  font-weight: 600;
}
.learn-streak-pk-bars { display: flex; flex-direction: column; gap: 4px; }
.learn-streak-pk-row {
  display: grid; grid-template-columns: 50px 1fr 40px;
  align-items: center; gap: 8px;
  font-size: 12px;
}
.learn-streak-pk-name { color: var(--ink, #222); font-weight: 500; }
.learn-streak-pk-bar {
  height: 8px; background: rgba(0,0,0,0.05);
  border-radius: 999px; overflow: hidden;
}
.learn-streak-pk-fill {
  height: 100%;
  background: linear-gradient(90deg, #58cc02, #a4e057);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.learn-streak-pk-fill.partner {
  background: linear-gradient(90deg, #1cb0f6, #58c8f6);
}
.learn-streak-pk-val { color: var(--ink, #222); font-weight: 600; text-align: right; }
.learn-streak-pk-status { font-size: 11px; color: var(--accent, #ff385c); align-self: flex-end; font-weight: 500; }

/* askAI 新对话按钮 + AI 出题等待态 */
.askai-new-chat {
  margin-top: 8px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  align-self: flex-start;
}
.askai-new-chat:hover { border-color: var(--ink); color: var(--ink); }
.ai-quiz-form { display: flex; flex-direction: column; gap: 14px; }
.ai-quiz-loading {
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
}

/* inline quiz —— 阅读时插一个 1-2 题快测，仅 UI 反馈，不计 XP / SRS */
.kb-inline-quiz {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--blue);
  background: linear-gradient(135deg, #f1f6ff, #fff);
}
.kb-inline-quiz-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  margin-bottom: 8px;
}
.kb-inline-quiz-tag { font-size: 16px; }
.kb-inline-quiz-q {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.kb-inline-quiz-options {
  display: flex; flex-direction: column; gap: 8px;
}
.kb-inline-quiz-option {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  font: inherit; color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.kb-inline-quiz-option:not(:disabled):hover {
  border-color: var(--blue);
  background: #f1f6ff;
}
.kb-inline-quiz-option:disabled { cursor: default; }
.kb-inline-quiz-option.correct {
  border-color: var(--green);
  background: var(--green-soft);
}
.kb-inline-quiz-option.wrong {
  border-color: var(--red);
  background: var(--red-soft);
  text-decoration: line-through;
  opacity: 0.7;
}
.kb-inline-quiz-letter {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--surface-3);
  border-radius: 50%;
  font-size: 12px; font-weight: 700;
  flex: 0 0 auto;
}
.kb-inline-quiz-option.correct .kb-inline-quiz-letter { background: var(--green); color: #fff; }
.kb-inline-quiz-option.wrong .kb-inline-quiz-letter { background: var(--red); color: #fff; }
.kb-inline-quiz-explain {
  margin: 12px 0 0;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  line-height: 1.55;
}
.kb-inline-quiz-explain.ok { background: var(--green-soft); color: var(--ink-2); }
.kb-inline-quiz-explain.no { background: var(--red-soft); color: var(--ink-2); }

/* 课程结业证书 modal */
.course-cert {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 8px 0;
  text-align: center;
}
.course-cert-icon {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(255,200,0,0.3));
  animation: cert-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes cert-bounce {
  0% { opacity: 0; transform: scale(0.5) rotate(-20deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.course-cert-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff385c, #ffc800);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.course-cert-course { margin: 0; font-size: 15px; color: var(--ink); font-weight: 600; }
.course-cert-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.course-cert-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.course-cert-stat strong { font-size: 18px; color: var(--ink); }
.course-cert-stat span { font-size: 11px; color: var(--muted); }
.course-cert-chapters {
  width: 100%;
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px;
}
.course-cert-chapter {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.course-cert-chapter:last-child { border-bottom: 0; }
.course-cert-chapter-title { text-align: left; color: var(--ink-2); }
.course-cert-chapter-score { font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }

/* 「今天就做这件事」daily action card */
.daily-action-card {
  background: linear-gradient(135deg, #fff, #f0f9ff);
  border: 1px solid var(--blue);
  display: flex; flex-direction: column; gap: 8px;
}
.daily-action-head { font-size: 13px; color: var(--muted); }
.daily-action-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.18s;
}
.daily-action-btn:hover { border-color: var(--blue); }
.daily-action-icon { font-size: 28px; line-height: 1; flex: 0 0 auto; }
.daily-action-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.daily-action-text strong { font-size: 15px; color: var(--ink); }
.daily-action-text span { font-size: 12px; color: var(--muted); }
.daily-action-arrow { font-size: 20px; color: var(--blue); flex: 0 0 auto; }

/* 断签警告 */
.streak-warning-card {
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  border: 1px solid #ffc800;
  display: flex; align-items: center; gap: 12px;
  animation: streak-warning-pulse 2.5s ease-in-out infinite;
}
.streak-warning-icon { font-size: 28px; line-height: 1; }
.streak-warning-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.streak-warning-text strong { font-size: 15px; color: var(--ink); }
.streak-warning-text span { font-size: 12px; color: var(--muted); }
@keyframes streak-warning-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 0, 0); }
  50% { box-shadow: 0 0 0 6px rgba(255, 200, 0, 0.18); }
}

/* 学习热力图 —— 12 周 × 7 天，绿色越深 XP 越多 */
.xp-heatmap-card {
  display: flex; flex-direction: column; gap: 10px;
}
.xp-heatmap-head {
  display: flex; justify-content: space-between; align-items: baseline;
}
.xp-heatmap-sub { font-size: 12px; color: var(--muted); }
.xp-heat-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  /* 7 行 */
}
.xp-heat-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.xp-heat-cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--surface-3);
  min-width: 8px;
  min-height: 8px;
}
.xp-heat-l-1 { background: transparent; } /* 未来日 */
.xp-heat-l0 { background: var(--surface-3); }
.xp-heat-l1 { background: #cdebd0; }
.xp-heat-l2 { background: #88d39b; }
.xp-heat-l3 { background: #4caf6f; }
.xp-heat-l4 { background: var(--green); }
.xp-heat-legend {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted);
  justify-content: flex-end;
}
.xp-heat-legend .xp-heat-cell {
  width: 10px; height: 10px; min-width: 10px; min-height: 10px; aspect-ratio: 1;
}

.learn-streak-footer {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.learn-streak-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.04);
  border: none; cursor: pointer;
  font-size: 12px; color: var(--ink, #222);
  display: inline-flex; align-items: center; gap: 4px;
}
.learn-streak-chip:hover { background: rgba(0,0,0,0.08); }
.learn-streak-chip.review {
  background: rgba(255, 200, 100, 0.2);
  color: #b87b00;
}
.learn-streak-chip.review:hover { background: rgba(255, 200, 100, 0.35); }
.learn-streak-chip.freeze {
  background: rgba(28, 176, 246, 0.12);
  color: #1273a8;
  cursor: default;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .learn-streak-main { gap: 10px; }
  .learn-streak-kunkun-emoji { font-size: 30px; }
  .learn-streak-stats { gap: 10px; width: 100%; justify-content: space-around; }
  .learn-streak-goal-ring { --size: 48px; }
}

/* ============================================================
 * 课程 path（Duolingo 风格竖向路径）
 * ============================================================ */
.course-path {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 14px;
  padding: 8px 0;
  position: relative;
}
.course-path-node {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.06));
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  position: relative;
  font: inherit;
  color: inherit;
}
/* 节点之间的连接线 */
.course-path-node + .course-path-node::before {
  content: "";
  position: absolute;
  left: 40px; top: -14px;
  width: 2px; height: 14px;
  background: rgba(0,0,0,0.1);
}
.course-path-node:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.course-path-node:disabled { cursor: not-allowed; opacity: 0.55; }
.course-path-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, #f5f5f7, #e8e8ec);
  color: #888;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), inset 0 -3px 0 rgba(0,0,0,0.06);
}
.course-path-node-text {
  display: flex; flex-direction: column;
  min-width: 0; gap: 2px;
}
.course-path-node-text strong {
  font-size: 14px; color: var(--ink, #222);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.course-path-node-text span {
  font-size: 12px; color: var(--muted);
}
.course-path-xp {
  font-size: 11px; font-weight: 700;
  color: #58cc02;
  background: rgba(88, 204, 2, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 节点状态颜色 */
.course-path-node.state-done .course-path-circle {
  background: linear-gradient(135deg, #58cc02, #4ab800);
  color: #fff;
  box-shadow: 0 2px 6px rgba(88,204,2,0.3), inset 0 -3px 0 rgba(0,0,0,0.15);
}
.course-path-node.state-current .course-path-circle {
  background: linear-gradient(135deg, var(--accent, #ff385c), #e02b50);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255,56,92,0.3), inset 0 -3px 0 rgba(0,0,0,0.15);
  animation: pulse-current 2s ease-in-out infinite;
}
@keyframes pulse-current {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.course-path-node.state-quiz-pending .course-path-circle {
  background: linear-gradient(135deg, #ffc800, #f0a800);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255,200,0,0.3), inset 0 -3px 0 rgba(0,0,0,0.15);
}
.course-path-node.state-locked .course-path-circle {
  background: linear-gradient(135deg, #d8d8dc, #c0c0c4);
  color: #888;
}
.course-path-node.state-pending .course-path-circle {
  background: rgba(0,0,0,0.04);
  color: #aaa;
  border-style: dashed;
}

/* ============================================================
 * +XP toast 飘动 + 成就解锁
 * ============================================================ */
#xp-toast-host {
  position: fixed;
  top: 20%; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.xp-toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fff, #f7fff0);
  border: 2px solid #58cc02;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(88,204,2,0.25);
  animation: xp-toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  min-width: 200px;
  max-width: 90vw;
}
.xp-toast.achievement-toast {
  background: linear-gradient(135deg, #fff, #fff7e3);
  border-color: #ffc800;
  box-shadow: 0 8px 24px rgba(255,200,0,0.25);
}
.xp-toast.error {
  background: linear-gradient(135deg, #fff, #fdeeec);
  border-color: var(--red);
  box-shadow: 0 8px 24px rgba(193,53,21,0.18);
}
.xp-toast.success {
  background: linear-gradient(135deg, #fff, #ecf8ed);
  border-color: var(--green);
  box-shadow: 0 8px 24px rgba(0,138,5,0.18);
}
.xp-toast.info {
  background: linear-gradient(135deg, #fff, #f1f6ff);
  border-color: var(--blue);
  box-shadow: 0 8px 24px rgba(66,139,255,0.18);
}
.xp-toast-emoji { font-size: 32px; line-height: 1; }
.xp-toast-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.xp-toast-body strong { font-size: 15px; color: var(--ink, #222); }
.xp-toast-body span { font-size: 12px; color: var(--muted); }
.xp-toast-out { animation: xp-toast-out 0.5s ease-in both; }
@keyframes xp-toast-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes xp-toast-out {
  to { opacity: 0; transform: translateY(-30px) scale(0.92); }
}

/* ============================================================
 * 主页今日学习 widget
 * ============================================================ */
.today-learn-card {
  background: linear-gradient(135deg, #f0f9ff, #fff);
  border: 1px solid rgba(28, 176, 246, 0.15);
}
.today-learn-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.today-learn-title {
  display: flex; align-items: center; gap: 10px;
}
.today-learn-mood { font-size: 24px; }
.today-learn-title h3 { margin: 0; font-size: 15px; color: var(--ink, #222); }
.today-learn-xp {
  font-size: 14px; color: var(--ink, #222);
  font-weight: 600;
}
.today-learn-xp-sep { color: var(--muted); margin: 0 2px; }
.today-learn-xp-goal { color: var(--muted); font-weight: 400; font-size: 12px; }
.today-learn-bar {
  height: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.today-learn-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1cb0f6, #58c8f6);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.today-learn-go {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(28, 176, 246, 0.08);
  border: none; border-radius: 12px;
  cursor: pointer;
  font: inherit; color: inherit;
  text-align: left;
  transition: background 0.15s ease;
}
.today-learn-go:hover { background: rgba(28, 176, 246, 0.16); }
.today-learn-go-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.today-learn-go-text strong { font-size: 14px; color: var(--ink, #222); }
.today-learn-go-text span { font-size: 12px; color: var(--muted); }
.today-learn-go-arrow { font-size: 16px; color: #1cb0f6; font-weight: 600; }
.today-learn-cheer {
  margin: 4px 0 0; font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ============================================================
 * 成就 / 复习队列 modal
 * ============================================================ */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 60vh;
  max-height: 60dvh;
  overflow-y: auto;
}
.achievement-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px;
  border-radius: 14px;
  border: 1px solid var(--border, rgba(0,0,0,0.06));
  text-align: center;
}
.achievement-cell.got {
  background: linear-gradient(135deg, #fff7e3, #fff);
  border-color: #ffc800;
}
.achievement-cell.locked {
  opacity: 0.5;
  background: rgba(0,0,0,0.02);
}
.achievement-icon { font-size: 32px; line-height: 1; }
.achievement-title { font-size: 13px; color: var(--ink, #222); }
.achievement-desc { font-size: 11px; color: var(--muted); }
.achievement-date { font-size: 10px; color: #4ab800; font-weight: 600; margin-top: 2px; }

.review-queue-list {
  display: flex; flex-direction: column; gap: 8px;
}
.review-queue-hint {
  margin: 0 0 6px; font-size: 12px; color: var(--muted);
}
.review-queue-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(0,0,0,0.06));
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit; color: inherit;
}
.review-queue-item:hover { background: rgba(0,0,0,0.02); }
.review-queue-item strong { font-size: 13px; color: var(--ink, #222); }
.review-queue-item span { font-size: 11px; color: var(--muted); }
.review-queue-empty { padding: 20px 0; }

/* ============================================================
   Mobile P0：modal 打开时锁定 body 滚动 + 触屏 hover 守卫
   ============================================================ */
/* JS 保存/恢复 scrollY；移除 class 时 scrollTo(0, savedY) */
body.mg-modal-open {
  position: fixed;
  inset: 0 0 auto 0;
  width: 100%;
  overflow: hidden;
}
/* modal 打开时隐藏 mobile tabbar 和 FAB —— 键盘弹起时不会再压在 modal 之上 */
body.mg-modal-open .mobile-tabbar,
body.mg-modal-open .fab {
  display: none;
}

/* 触屏设备杀掉所有 transform: translateY(-1px) 之类的 hover 效果 —— 避免点击后
   状态卡在 1px 位移上（iOS 手指离开后 :hover 不会立刻消失）*/
@media (hover: none) and (pointer: coarse) {
  .account-card:hover,
  .card:hover,
  .fab:hover,
  .row:hover,
  .add-account-tile:hover,
  .hero-pet-btn:hover,
  .merchant-row:hover,
  .ledger-import-btn:hover,
  .fire-suggestion:hover,
  .chat-suggestion:hover,
  .chat-comic-btn:hover,
  .askai-suggestion:hover,
  .kb-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }

  /* 44x44 是 Apple HIG / WCAG 推荐的最小触控目标。除了显式标记的小元素（表头、
     checkbox、链接 inline），所有 button 至少 44px 高，避免误触相邻按钮 */
  button:not(.row-check):not(.kb-md-link):not(.brand):not(.bills-table th button):not(.kb-md-link-internal) {
    min-height: 44px;
  }
  /* nudge 关闭按钮原来 ~22px，太小 */
  .ai-nudge-x, .ai-nudge-close {
    min-width: 44px;
    min-height: 44px;
    /* 视觉上仍是小图标，靠 padding 撑大点击区 */
    padding: 12px;
  }
  /* 表格 row-check 是 input[type=checkbox]，加大命中区但不改外观 */
  .row-check {
    min-width: 28px;
    min-height: 28px;
  }
}
