/* ==========================================================================
   上岸日记 · 设计系统 v2
   Token 架构对齐《ClauseOS UI/UX 设计规范》v2.0：浅色为默认轨道（对齐参考图），暗色为备选。
   品牌组合取规范 §2.3 的 Blue Charcoal + Harmony Green（负债人群需要克制、不刺眼），
   不用 §2.1 的 #0A0B0F + #00FF9D 高对比霓虹，避免长时间盯看的视觉疲劳。
   颜色只通过 token 引用；红色仅用于「已起诉 / 已催收」（AGENTS.md §4 / §6）。
   ========================================================================== */

:root {
  /* 默认轨道 = 浅色（对齐参考图）。结构性 token 只写在这里。 */
  color-scheme: light;
  /* logo 底 = 品牌绿渐变，直接复用 --g / --g-strong，两轨道各自翻转：
     浅轨深绿底 + 白字，暗轨亮绿底 + 深字，字色一律走 --on-accent（§4：渐变底上别写死白色）。
     原来是黄底黑字——那是全站唯一一处黄，跟绿色界面各说各话，收成同色系后 logo 不再像一枚贴纸。
     顺序不能反：两轨都必须「底暗字亮 / 底亮字暗」，反了字就糊。 */
  --brand-fill: linear-gradient(160deg, var(--g), var(--g-strong));
  --brand-glow: rgba(4, 120, 87, .28);
  --g: #047857;
  --g-strong: #065F46;
  --g-deep: #064E3B;
  --g-soft: #D1FAE5;
  --g-tint: #ECFDF5;
  --amber: #D97706;
  --amber-strong: #B45309;
  --amber-soft: #FEF3C7;
  --amber-tint: #FFFBEB;
  --amber-ink: #92400E;
  --red: #DC2626;
  --red-strong: #B91C1C;
  --red-soft: #FEE2E2;
  --red-tint: #FEF2F2;
  --red-ink: #991B1B;
  --blue: #2563EB;
  --blue-strong: #1D4ED8;
  --blue-soft: #DBEAFE;
  --blue-tint: #EFF6FF;
  --blue-ink: #1E40AF;
  /* 参考图的图标 pastel 需要一档紫，仅用于图表与图标底，不做语义状态色。 */
  --violet: #7C3AED;
  --violet-strong: #6D28D9;
  --violet-soft: #EDE9FE;
  --violet-tint: #F5F3FF;
  --violet-ink: #5B21B6;
  /* 债务头像的六档 pastel（app.js 的 avatarHue 按债权方名称稳定取档）。
     §4 只允许 token 引用颜色，所以档位色在这里给全，组件里只写 var()。
     不含 amber/red：那两档是「逾期 / 起诉」的语义色，不能拿来当装饰随机发。 */
  --av-1-bg: #D1FAE5; --av-1-ink: #064E3B;
  --av-2-bg: #DBEAFE; --av-2-ink: #1E40AF;
  --av-3-bg: #EDE9FE; --av-3-ink: #5B21B6;
  --av-4-bg: #CCFBF1; --av-4-ink: #115E59;
  --av-5-bg: #CFFAFE; --av-5-ink: #155E75;
  --av-6-bg: #ECFCCB; --av-6-ink: #3F6212;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #4B5563;
  --faint: #6B7280;
  --on-accent: #FFFFFF;
  /* 实心主按钮上的分隔线，随 on-accent 走，别在组件里写死白色 */
  --on-accent-line: rgba(255, 255, 255, 0.30);
  --paper: #EEF1F6;
  --content: #FFFFFF;
  --content-2: #FFFFFF;
  --glass-thin-bg: rgba(255, 255, 255, 0.45);
  --glass-regular-bg: rgba(255, 255, 255, 0.55);
  --glass-clear-bg: rgba(255, 255, 255, 0.25);
  --glass-thick-bg: rgba(255, 255, 255, 0.72);
  --glass-thin-bd: rgba(0, 0, 0, 0.04);
  --glass-regular-bd: rgba(0, 0, 0, 0.06);
  --glass-clear-bd: rgba(0, 0, 0, 0.03);
  --glass-thick-bd: rgba(0, 0, 0, 0.08);
  --blur-thin: blur(10px) saturate(130%);
  --blur-regular: blur(16px) saturate(140%);
  --blur-clear: blur(12px) saturate(120%);
  --blur-thick: blur(20px) saturate(150%);
  --surface: var(--glass-regular-bg);
  --surface-strong: var(--content);
  --surface-soft: rgba(255, 255, 255, 0.62);
  --field: #FFFFFF;
  --glass-border: rgba(255, 255, 255, 0.82);
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.15);
  --overlay: rgba(17, 24, 39, 0.38);
  --focus: rgba(4, 120, 87, 0.22);
  --neutral-soft: rgba(17, 24, 39, 0.06);
  --toast-bg: #0B1F17;
  --toast-fg: #FFFFFF;
  --toast-accent: #A7F3D0;
  --toast-warn-bg: #92400E;
  --glow-green: rgba(4, 120, 87, 0.11);
  --glow-blue: rgba(37, 99, 235, 0.06);
  --glow-amber: rgba(245, 158, 11, 0.08);
  --glow-violet: rgba(124, 58, 237, 0.07);
  --chart-grid: rgba(17, 24, 39, 0.08);
  --chart-1: #047857;
  --chart-2: #0D9488;
  --chart-3: #2563EB;
  --chart-4: #7C3AED;
  --chart-5: #0891B2;
  --chart-6: #65A30D;
  --chart-7: #94A3B8;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 14px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 12px 34px rgba(17, 24, 39, 0.07);
  --shadow-lg: 0 28px 70px rgba(17, 24, 39, 0.18);
  --shadow-green: 0 8px 20px rgba(4, 120, 87, 0.22);
  /* 参考图的卡片阴影更贴面、更散，单独一条 token，别去改 §6.2 的三级阴影。 */
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 26px rgba(16, 24, 40, 0.06);
  /* 驾驶舱玻璃卡片扇（参考图插画位）。pane 是半透明白玻璃 + 左缘高光，floor 是地面倒影。 */
  --pane-fill: linear-gradient(158deg, rgba(255, 255, 255, 0.82), rgba(205, 220, 244, 0.5));
  --pane-edge: rgba(255, 255, 255, 0.98);
  --pane-glyph: rgba(71, 85, 105, 0.34);
  --pane-ink: #475569;
  --pane-deep: #1e293b;
  --pane-shadow: 0 26px 34px -24px rgba(15, 23, 42, 0.45);
  --pane-hot-fill: linear-gradient(164deg, #34D399, #047857);
  --pane-hot-glow: 0 18px 36px -18px rgba(4, 120, 87, 0.5);
  --floor-fill: radial-gradient(58% 42% at 52% 50%, rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0) 72%);
  --lead-fill: linear-gradient(150deg, rgba(255, 255, 255, 0.72), rgba(240, 245, 252, 0.46));
  --lead-shadow: 0 30px 60px -24px rgba(15, 23, 42, 0.42), 0 2px 0 rgba(255, 255, 255, 0.9) inset;
  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 6px;
  --r-xs: 4px;
  --r-full: 9999px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --s-6: 48px;
  --font-brand: "Urbanist", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --dur-fast: 150ms;
  --dur-normal: 250ms;
  --dur-slow: 400ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* --------------------------------------------------------------------------
   暗色轨道
   -------------------------------------------------------------------------- */

[data-theme="dark"] {
  color-scheme: dark;

  /* 参考图是浅色默认；暗色轨道整体保留，顶栏月亮按钮切回，
     只覆盖颜色类 token，圆角/间距/字体/动效继承 :root。 */
  --g: #00C897;
  --g-strong: #2BE0AD;
  --g-deep: #7FF0CE;
  --g-soft: rgba(0, 200, 151, 0.16);
  --g-tint: rgba(0, 200, 151, 0.09);
  --amber: #F59E0B;
  --amber-strong: #FBBF24;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --amber-tint: rgba(245, 158, 11, 0.10);
  --amber-ink: #FCD34D;
  --red: #EF4444;
  --red-strong: #F87171;
  --red-soft: rgba(239, 68, 68, 0.16);
  --red-tint: rgba(239, 68, 68, 0.10);
  --red-ink: #FCA5A5;
  --blue: #3B82F6;
  --blue-strong: #60A5FA;
  --blue-soft: rgba(59, 130, 246, 0.18);
  --blue-tint: rgba(59, 130, 246, 0.10);
  --blue-ink: #93C5FD;
  --violet: #A78BFA;
  --violet-strong: #C4B5FD;
  --violet-soft: rgba(167, 139, 250, 0.18);
  --violet-tint: rgba(167, 139, 250, 0.10);
  --violet-ink: #DDD6FE;
  /* 暗轨同六档：底改半透明贴面，字提到亮档，保证 12px 粗字仍读得清。 */
  --av-1-bg: rgba(0, 200, 151, 0.16); --av-1-ink: #7FF0CE;
  --av-2-bg: rgba(59, 130, 246, 0.18); --av-2-ink: #93C5FD;
  --av-3-bg: rgba(167, 139, 250, 0.18); --av-3-ink: #DDD6FE;
  --av-4-bg: rgba(13, 148, 136, 0.20); --av-4-ink: #5EEAD4;
  --av-5-bg: rgba(8, 145, 178, 0.20); --av-5-ink: #67E8F9;
  --av-6-bg: rgba(101, 163, 13, 0.20); --av-6-ink: #BEF264;
  --ink: #E5E7EB;
  --ink-2: #C6CCD6;
  --muted: #A6ADBA;
  --faint: #8C96A6;
  --on-accent: #05201A;
  --on-accent-line: rgba(5, 32, 26, 0.24);
  --paper: #1A1D23;
  --content: #14171D;
  --content-2: #1C2028;
  --glass-thin-bg: rgba(255, 255, 255, 0.05);
  --glass-regular-bg: rgba(255, 255, 255, 0.08);
  --glass-clear-bg: rgba(255, 255, 255, 0.04);
  --glass-thick-bg: rgba(255, 255, 255, 0.13);
  --glass-thin-bd: rgba(255, 255, 255, 0.06);
  --glass-regular-bd: rgba(255, 255, 255, 0.10);
  --glass-clear-bd: rgba(255, 255, 255, 0.05);
  --glass-thick-bd: rgba(255, 255, 255, 0.18);
  --blur-thin: blur(12px) saturate(120%);
  --blur-regular: blur(20px) saturate(140%);
  --blur-clear: blur(16px) saturate(110%);
  --blur-thick: blur(24px) saturate(160%);
  --surface: var(--glass-regular-bg);
  --surface-strong: var(--content-2);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --field: rgba(255, 255, 255, 0.04);
  --glass-border: var(--glass-regular-bd);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --overlay: rgba(0, 0, 0, 0.60);
  --focus: rgba(0, 200, 151, 0.30);
  /* --brand-fill 里的 var(--g) 在同一元素上求值，data-theme 挂在 <html>，所以渐变自动跟轨道走；
     只有这枚阴影的 rgba 没法从 token 推出来，暗轨得单独给一档。 */
  --brand-glow: rgba(0, 200, 151, .26);
  --neutral-soft: rgba(255, 255, 255, 0.07);
  --toast-bg: #262C38;
  --toast-fg: #E5E7EB;
  --toast-accent: #2BE0AD;
  --toast-warn-bg: #3A2E14;
  --glow-green: rgba(0, 200, 151, 0.10);
  --glow-blue: rgba(59, 130, 246, 0.07);
  --glow-amber: rgba(245, 158, 11, 0.06);
  --glow-violet: rgba(167, 139, 250, 0.10);
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-1: #00C897;
  --chart-2: #2DD4BF;
  --chart-3: #60A5FA;
  --chart-4: #A78BFA;
  --chart-5: #22D3EE;
  --chart-6: #A3E635;
  --chart-7: #94A3B8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-green: 0 0 20px rgba(0, 200, 151, 0.18), 0 4px 16px rgba(0, 0, 0, 0.30);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.28), 0 10px 26px rgba(0, 0, 0, 0.22);
  /* 暗色轨道下 pane 是深色玻璃，靠左缘那道高光把每张卡分开，不靠底色对比。 */
  --pane-fill: linear-gradient(158deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03));
  --pane-edge: rgba(255, 255, 255, 0.34);
  --pane-glyph: rgba(226, 232, 240, 0.26);
  --pane-ink: #C7D0DC;
  --pane-deep: #000000;
  --pane-shadow: 0 26px 34px -20px rgba(0, 0, 0, 0.72);
  --pane-hot-fill: linear-gradient(164deg, #2BE0AD, #00C897);
  --pane-hot-glow: 0 18px 40px -16px rgba(0, 200, 151, 0.42);
  --floor-fill: radial-gradient(58% 42% at 52% 50%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 72%);
  --lead-fill: linear-gradient(150deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  --lead-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.72), 0 2px 0 rgba(255, 255, 255, 0.10) inset;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(900px 620px at 6% -8%, var(--glow-green), transparent 62%),
    radial-gradient(760px 520px at 102% 2%, var(--glow-blue), transparent 58%),
    radial-gradient(680px 520px at 82% 108%, var(--glow-amber), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  transition: background-color var(--dur-normal) var(--ease-out), color var(--dur-normal) var(--ease-out);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
::selection { background: var(--g-soft); color: var(--g-deep); }

/* §12 焦点指示：2px 强调色外环 */
:focus-visible {
  outline: 2px solid var(--g);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.ic {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -3px;
}
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.green { color: var(--g-strong); }
.amber { color: var(--amber-strong); }
.blue { color: var(--blue); }
.desktop-only { display: initial; }
.mobile-only { display: none; }

/* --------------------------------------------------------------------------
   布局
   -------------------------------------------------------------------------- */

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  position: fixed;
  top: 16px;
  bottom: 16px;
  left: 16px;
  width: 280px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  border-radius: var(--r-xl);
  background: var(--surface-soft);
  border: 1px solid var(--glass-thin-bd);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--blur-regular);
  -webkit-backdrop-filter: var(--blur-regular);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
}
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; border-radius: var(--r-lg); display: grid; place-items: center;
  background: var(--brand-fill); color: var(--on-accent);
  box-shadow: 0 6px 16px var(--brand-glow); }
.brand-mark svg { width: 40px; height: 40px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--font-brand); font-size: 18px; font-weight: 700; letter-spacing: 0.01em; }
.brand-text small { font-size: 11px; color: var(--muted); letter-spacing: 0.16em; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: var(--s-1); }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px 0 16px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav a:hover { background: var(--glass-thin-bg); color: var(--ink); }
.nav a.active {
  background: var(--content);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--glass-thin-bd);
}
.nav a.active .nav-icon { color: var(--g); opacity: 1; }
/* 参考图选中项右侧的 > 用 currentColor 画，避免写死色值 */
.nav a.active::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-right: 1.8px solid var(--faint);
  border-top: 1.8px solid var(--faint);
  transform: rotate(45deg);
}
.nav-icon { width: 24px; height: 24px; flex: 0 0 auto; opacity: 0.9; }

.side-group { margin-top: auto; padding: 14px 4px 0; }
.side-group-head {
  margin: 0 0 7px;
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.side-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-md);
  background: var(--content);
  border: 1px solid var(--glass-thin-bd);
  box-shadow: var(--shadow-card);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
}
.side-switch:hover { border-color: var(--line-strong); }
.side-caret { margin-left: auto; opacity: 0.6; }

.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 8px 2px;
  border-top: 1px solid var(--line);
}
/* 本机模式下这一整行是「登录」入口，链到设置页的账号卡。
   窄图标轨里 .user-meta 会被隐藏，只剩头像，所以这里不能依赖 meta 撑高度。 */
.side-user-in {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer; border-radius: var(--r-md);
}
.side-user-in:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.side-user-in:hover .user-meta b { text-decoration: underline; text-underline-offset: 2px; }
.user-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
}
.user-avatar .ua-in { grid-area: 1 / 1; line-height: 1; }
.user-avatar i {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--g);
  border: 2px solid var(--content);
}
/* 头像预设：颜色只走 token 组合（§4），字色统一 --on-accent，两轨道各自翻转。 */
.av-sea    { background: linear-gradient(135deg, var(--blue), var(--g)); }
.av-brand  { background: linear-gradient(160deg, var(--g), var(--g-strong)); }
.av-azure  { background: linear-gradient(135deg, var(--blue), var(--blue-strong)); }
.av-iris   { background: linear-gradient(135deg, var(--blue-strong), var(--violet)); }
.av-violet { background: linear-gradient(135deg, var(--violet), var(--violet-strong)); }
.av-amber  { background: linear-gradient(135deg, var(--amber), var(--amber-strong)); }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-meta b { font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-wrap {
  flex: 1;
  min-width: 0;
  margin-left: 312px;
  padding: 28px 40px 44px;
}
.topbar {
  max-width: 1320px;
  margin: 0 auto var(--s-4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px) minmax(0, 1fr);
  align-items: start;
  gap: var(--s-4);
}
.topbar-title { min-width: 0; }
.top-actions { justify-content: flex-end; }

/* 参考图的搜索胶囊：纯白、圆角 14、贴面阴影，右侧一个键帽 */
.top-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px 0 16px;
  border-radius: 14px;
  background: var(--content);
  border: 1px solid var(--glass-thin-bd);
  box-shadow: var(--shadow-card);
  color: var(--faint);
}
.top-search:focus-within { border-color: var(--g); box-shadow: 0 0 0 3px var(--focus); }
.top-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.top-search input:focus { outline: none; }
.top-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: var(--r-sm);
  background: var(--neutral-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
}

/* 主按钮 + 右侧 ⌄ 分段：两个按钮拼成一颗胶囊 */
.split-btn { display: inline-flex; align-items: stretch; }
.split-btn .btn.primary { border-radius: var(--r-full) 0 0 var(--r-full); }
.split-btn .btn.primary.caret {
  border-radius: 0 var(--r-full) var(--r-full) 0;
  padding: 0 12px;
  border-left: 1px solid var(--on-accent-line);
}
.top-actions .btn.icon {
  position: relative;
  width: 40px;
  min-height: 40px;
  border-radius: 50%;
  background: var(--content);
  border: 1px solid var(--glass-thin-bd);
  box-shadow: var(--shadow-card);
  color: var(--ink-2);
}
.dot-alert {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g);
  border: 1.5px solid var(--content);
}
.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--faint);
}
.topbar h1 {
  margin: 2px 0 3px;
  font-family: var(--font-brand);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.page-sub { margin: 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sub-dot { color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-full);
  background: var(--glass-clear-bg);
  border: 1px solid var(--glass-clear-bd);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
/* §7.3 状态指示器：10px 实心圆 + 外环 */
.local-badge i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--g);
  box-shadow: 0 0 0 3px var(--g-tint);
}

.view { max-width: 1320px; margin: 0 auto; min-height: 400px; }
.site-foot {
  max-width: 1320px;
  margin: 34px auto 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 10.5px;
  color: var(--faint);
}

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr); gap: var(--s-4); align-items: start; }
.grid-2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.page-enter { animation: pageIn var(--dur-slow) var(--ease-out) both; }

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

/* --------------------------------------------------------------------------
   基础组件
   -------------------------------------------------------------------------- */

/* §3.3 玻璃只用于导航层 / 控件层；面板=thin，密集数据行用不透明 content 底 */
.panel {
  position: relative;
  background: var(--glass-thin-bg);
  border: 1px solid var(--glass-thin-bd);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-4);
  backdrop-filter: var(--blur-thin);
  -webkit-backdrop-filter: var(--blur-thin);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.panel:hover { background: var(--glass-regular-bg); border-color: var(--glass-regular-bd); }
.panel.solid { background: var(--content); backdrop-filter: none; -webkit-backdrop-filter: none; }
.panel.flat { box-shadow: none; }
.panel.tint-green { background: linear-gradient(145deg, var(--g-tint), var(--glass-thin-bg)); }
.panel.tint-amber { background: linear-gradient(145deg, var(--amber-tint), var(--glass-thin-bg)); }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: var(--s-3);
}
.panel-title { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.005em; }
.panel-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.panel-actions { display: flex; align-items: center; gap: var(--s-2); flex: 0 0 auto; }
.panel-body-bleed { margin: 0 -6px; }

/* §9.3 主按钮：胶囊 44px + 辉光；§9.4 次按钮：glass-clear 胶囊 */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--r-full);
  border: 1px solid var(--glass-regular-bd);
  background: var(--glass-clear-bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--glass-regular-bg); border-color: var(--glass-thick-bd); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary {
  background: var(--g);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: var(--shadow-green);
}
.btn.primary:hover { background: var(--g); filter: brightness(1.1); box-shadow: 0 0 30px var(--focus), var(--shadow-md); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { background: var(--glass-thin-bg); color: var(--ink); }
.btn.soft { background: var(--g-tint); border-color: var(--g-soft); color: var(--g-strong); }
/* 危险操作用 amber 而非 red：AGENTS.md §4 把 red 限定给「已起诉 / 已催收」，
   删除安全由二次确认勾选兜底（§6.5），不靠红色制造焦虑。 */
.btn.danger { background: var(--amber-tint); border-color: var(--amber-soft); color: var(--amber-ink); }
.btn.danger:hover { background: var(--amber-soft); border-color: var(--amber); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 12px; gap: 5px; }
.btn.icon { width: 44px; min-height: 44px; padding: 0; }
.btn.icon.small { width: 32px; min-height: 32px; }
.btn.block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }

/* 主题切换按钮：暗色轨道显示月亮，亮色显示太阳 */
[data-theme="dark"] .ic-sun,
[data-theme="light"] .ic-moon { display: none; }

/* §9.8 状态标签：胶囊 + 11px Medium */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-height: 22px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--g-soft);
  color: var(--g-deep);
}
.badge.green { background: var(--g-soft); color: var(--g-deep); }
.badge.amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge.red { background: var(--red-soft); color: var(--red-ink); }
.badge.blue { background: var(--blue-soft); color: var(--blue-ink); }
.badge.gray { background: var(--neutral-soft); color: var(--muted); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  background: var(--content-2);
  border: 1px solid var(--glass-thin-bd);
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-2);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--glass-clear-bg);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--line-strong); background: var(--glass-regular-bg); }
.chip.active { background: var(--g-soft); border-color: var(--g); color: var(--g-deep); font-weight: 600; }
.chip-count { font-size: 10.5px; color: var(--faint); }
.chip.active .chip-count { color: inherit; }

.progress { display: block; height: 7px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.progress > i {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--g-strong), var(--g));
  transition: width var(--dur-slow) var(--ease-out);
}
.progress.amber > i { background: linear-gradient(90deg, var(--amber-strong), var(--amber)); }
.progress.red > i { background: linear-gradient(90deg, var(--red-strong), var(--red)); }
.progress.blue > i { background: linear-gradient(90deg, var(--blue-strong), var(--blue)); }
.progress.thin { height: 5px; }

.notice {
  display: flex;
  gap: var(--s-3);
  padding: 14px var(--s-3);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--content);
}
.notice.info { background: var(--blue-tint); border-color: var(--blue-soft); }
.notice.warn { background: var(--amber-tint); border-color: var(--amber-soft); }
.notice.good { background: var(--g-tint); border-color: var(--g-soft); }
.notice-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--content-2);
  color: var(--ink-2);
}
.notice.info .notice-icon { color: var(--blue-strong); background: var(--blue-soft); }
.notice.warn .notice-icon { color: var(--amber-strong); background: var(--amber-soft); }
.notice.good .notice-icon { color: var(--g-strong); background: var(--g-soft); }
.notice-body { min-width: 0; flex: 1; }
.notice-title { font-size: 13.5px; font-weight: 600; }
.notice-text { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.65; }
.notice-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: 10px; }
.notice.compact { padding: 11px 13px; }

.empty { padding: 34px 20px; text-align: center; }
.empty-art { width: 68px; height: 68px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: var(--r-xl); background: var(--g-tint); color: var(--g-strong); border: 1px solid var(--g-soft); }
.empty-art svg { width: 30px; height: 30px; }
.empty-title { margin: 0; font-size: 15px; font-weight: 600; }
.empty-text { margin: 5px auto 0; max-width: 420px; font-size: 12.5px; color: var(--muted); }
.empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s-2); margin-top: 14px; }

/* --------------------------------------------------------------------------
   驾驶舱
   -------------------------------------------------------------------------- */

/* §9.2 统计卡片：120px / glass-thin / 标题 12px + 图标 20px + 大字 28px */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--glass-thin-bg);
  border: 1px solid var(--glass-thin-bd);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur-thin);
  -webkit-backdrop-filter: var(--blur-thin);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.kpi:hover { background: var(--glass-regular-bg); border-color: var(--glass-regular-bd); transform: translateY(-2px); }
.kpi::after {
  content: "";
  position: absolute;
  right: -42px;
  top: -50px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-green), transparent 68%);
  pointer-events: none;
}
.kpi.amber::after { background: radial-gradient(circle, var(--glow-amber), transparent 68%); }
.kpi.blue::after { background: radial-gradient(circle, var(--glow-blue), transparent 68%); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-icon { width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--g-soft); color: var(--g-deep); }
.kpi-icon .ic { width: 20px; height: 20px; }
.kpi.amber .kpi-icon { background: var(--amber-soft); color: var(--amber-ink); }
.kpi.blue .kpi-icon { background: var(--blue-soft); color: var(--blue-ink); }
.kpi-value {
  margin: 10px 0 4px;
  /* 1.35vw 而不是 1.6vw：1440 下四张卡各 170px，23px 的「¥239,800」要 143px，
     .kpi 是 overflow:hidden，多出来的 9px 会被直接裁掉。 */
  font-size: clamp(18px, 1.35vw, 23px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 12px; color: var(--muted); line-height: 1.55; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kpi-note { margin-top: 10px; }
/* 参考图的卡片 anatomy：大数右侧跟单位，底部一行「说明 + 加粗数值」。
   图标底色由 iconTone 单独控制（卡片 tone 只管色条与光晕），
   .kpi-top 前缀是为了盖过 .kpi.amber .kpi-icon 这类按 tone 上色的旧规则。 */
.kpi-unit { margin-left: 4px; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-dash { margin: 0 4px; color: var(--faint); font-weight: 500; }
.kpi-soft { color: var(--faint); font-weight: 500; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 2px var(--s-2); margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 11px; }
.kpi-foot-label { color: var(--muted); flex: 0 0 auto; }
.kpi-foot-val { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }
.kpi.violet::after { background: radial-gradient(circle, var(--glow-violet), transparent 68%); }
.kpi-top .kpi-icon.green { background: var(--g-soft); color: var(--g-deep); }
.kpi-top .kpi-icon.blue { background: var(--blue-soft); color: var(--blue-ink); }
.kpi-top .kpi-icon.amber { background: var(--amber-soft); color: var(--amber-ink); }
.kpi-top .kpi-icon.violet { background: var(--violet-soft); color: var(--violet-ink); }
.kpi-tab.violet[aria-selected="true"]::before { background: var(--violet); }

/* 三格并排是宽面板的排法；驾驶舱里面板会被压到 300px 左右，让它自己折。 */
/* 每格自带边框而不是靠容器底色拼 1px 缝：驾驶舱窄栏里 auto-fit 会留出空格，
   用底色缝的话空格会是一块裸灰。 */
/* 104px 是「¥239,800」在 15px 字号下不折行的下限；带二左栏够宽时正好 3 格，窄了自己退成 2+1。 */
.metric-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: var(--s-2); }
.metric-cell { background: var(--content); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 11px; }
.metric-label { font-size: 10.5px; color: var(--muted); }
.metric-value { margin-top: 3px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* §9.2 + §3.1 卡片即切换器：tab 用 glass-thick 抬起，未选中保持 glass-thin。
   选中态同时给顶部色条 + 边框 + 字重三重线索，不只靠颜色（§12 可访问性）。 */
.kpi-tabs { gap: var(--s-2); }
.kpi-tab {
  display: block;
  width: 100%;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.kpi-tab::-moz-focus-inner { padding: 0; border: 0; }
/* button 的内容模型只收 phrasing content，tab 卡里的子节点全是 <span>，
   这里补回 div/p 原本自带的块级排版，卡片高度才不会被压扁。 */
.kpi-tab .kpi-value,
.kpi-tab .kpi-note { display: block; }
.kpi-tab[aria-selected="true"] {
  background: var(--glass-thick-bg);
  border-color: var(--glass-thick-bd);
  backdrop-filter: var(--blur-thick);
  -webkit-backdrop-filter: var(--blur-thick);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
/* muted 在 glass-thick 上只有 4.46:1，选中态把说明文字一并提一档到 AA 以上。 */
.kpi-tab[aria-selected="true"] .kpi-label,
.kpi-tab[aria-selected="true"] .kpi-sub { color: var(--ink-2); }
.kpi-tab[aria-selected="true"]::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 3px;
  border-radius: 0 0 var(--r-xs) var(--r-xs);
  background: var(--g);
}
.kpi-tab.amber[aria-selected="true"]::before { background: var(--amber); }
.kpi-tab.blue[aria-selected="true"]::before { background: var(--blue); }
.kpi-tab[aria-selected="false"]:hover { border-color: var(--glass-regular-bd); }

.dash-panel { animation: panelIn var(--dur-normal) var(--ease-out) both; }
.dash-panel:focus-visible { outline-offset: 4px; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dist-bar { display: flex; height: 12px; border-radius: var(--r-full); overflow: hidden; background: var(--line); }
.dist-bar .seg { display: block; height: 100%; transition: filter var(--dur-fast) var(--ease-out); }
.dist-bar .seg:hover { filter: brightness(1.15); }
.dist-dot { width: 9px; height: 9px; border-radius: var(--r-xs); flex: 0 0 auto; }
.seg-1 { background: var(--chart-1); } .seg-2 { background: var(--chart-2); }
.seg-3 { background: var(--chart-3); } .seg-4 { background: var(--chart-4); }
.seg-5 { background: var(--chart-5); } .seg-6 { background: var(--chart-6); }
.seg-7 { background: var(--chart-7); }

.chart-wrap { width: 100%; overflow: hidden; }
.chart { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--faint); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: url(#balanceFill); }
.chart .line { fill: none; stroke: var(--g); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { stroke: var(--content); stroke-width: 1.5; }
.chart .end-dot { fill: var(--g); stroke: var(--content); stroke-width: 2; }
.chart .bar { opacity: 0.92; }
.chart-empty {
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  border-radius: var(--r-md);
  background: var(--content);
  color: var(--muted);
  font-size: 12.5px;
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: var(--r-xs); background: var(--g); flex: 0 0 auto; }
.dot-1 { background: var(--chart-1); } .dot-2 { background: var(--chart-2); } .dot-3 { background: var(--chart-3); }
.dot-4 { background: var(--chart-4); } .dot-5 { background: var(--chart-5); } .dot-6 { background: var(--chart-6); } .dot-7 { background: var(--chart-7); }
.fill-1 { fill: var(--chart-1); } .fill-2 { fill: var(--chart-2); } .fill-3 { fill: var(--chart-3); }
.fill-4 { fill: var(--chart-4); } .fill-5 { fill: var(--chart-5); } .fill-6 { fill: var(--chart-6); } .fill-7 { fill: var(--chart-7); }

.smart-list { display: flex; flex-direction: column; gap: 11px; }
.smart-item { display: flex; gap: 11px; padding: 12px; border-radius: var(--r-md); background: var(--content); border: 1px solid var(--line); }
.smart-icon { width: 26px; height: 26px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--g-soft); color: var(--g-deep); }
.smart-icon .ic { width: 14px; height: 14px; }
.smart-item.warn .smart-icon { background: var(--amber-soft); color: var(--amber-ink); }
.smart-item.info .smart-icon { background: var(--blue-soft); color: var(--blue-ink); }
.smart-title { font-size: 12.5px; font-weight: 600; }
.smart-text { margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }

.risk-list { display: flex; flex-direction: column; }
.risk-item { padding: 12px 0; border-top: 1px solid var(--line); }
.risk-item:first-child { border-top: 0; padding-top: 0; }
.risk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.risk-name { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; font-weight: 600; }
.risk-score { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.risk-score small { font-size: 9.5px; color: var(--faint); font-weight: 500; }
.risk-meter { margin: 7px 0 6px; }
.risk-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 10.5px; color: var(--muted); }

.row-list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 600; }
.row-sub { margin-top: 2px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.row-metric { text-align: right; flex: 0 0 auto; }
.row-metric b { display: block; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.row-metric span { font-size: 10.5px; color: var(--muted); }
.row-actions { display: flex; gap: 5px; flex: 0 0 auto; }

/* 心愿清单：把「这笔钱从哪来」画成一条本月资金桌，图例把每段数字摊开给读者核对。 */
.wish-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 11px; }
.legend-row { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.legend-row i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 3px; }
.legend-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row b { margin-left: auto; font-size: 12px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.wish-pressure { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--g-tint); border: 1px solid var(--g-soft);
  font-size: 12px; line-height: 1.65; color: var(--ink-2); }
.wish-pressure.bad { background: var(--amber-tint); border-color: var(--amber-soft); }
.wish-done-head { margin: 16px 0 8px; font-size: 11px; }
.wish-done .row { opacity: .62; }
.wish-done .row-title { text-decoration: line-through; text-decoration-color: var(--faint); }

/* 心愿攒钱进度：已攒 / 目标价，攒满变实心绿。 */
.wish-progress { margin-top: 8px; max-width: 340px; }
.wish-progress-track { height: 6px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.wish-progress-fill { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--g), var(--g-strong)); transition: width var(--dur-normal) var(--ease-out); }
.wish-progress-fill.full { background: var(--g-strong); }
.wish-progress-note { margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.wish-progress-note b { font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wish-done .wish-progress-note b { color: var(--muted); }

.reminder-list { display: flex; flex-direction: column; }
.reminder-item { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 10px 0; border-top: 1px solid var(--line); }
.reminder-item:first-child { border-top: 0; padding-top: 0; }
/* 到期还本那一期金额是平时的好几倍，列表里必须一眼分出来，不然用户会以为提醒出错了。 */
.reminder-item.is-bullet { padding: 10px; margin: 0 -10px; background: var(--amber-tint); border-radius: var(--r-sm); }
.due-board .cal-toolbar { margin-bottom: var(--s-3); }
.due-summary {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  margin: 0 0 var(--s-3); padding: 10px var(--s-3); border-radius: var(--r-md);
  background: var(--content); border: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.due-summary b { color: var(--ink); font-weight: 600; }
.reminder-date {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--g-tint); color: var(--g-strong); line-height: 1.1;
  border: 1px solid var(--g-soft);
}
.reminder-date b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reminder-date span { font-size: 9px; }
.reminder-info { flex: 1; min-width: 0; }
.reminder-name { font-size: 12.5px; font-weight: 600; }
.reminder-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.reminder-amount { text-align: right; flex: 0 0 auto; }
.reminder-amount b { display: block; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.reminder-amount span { font-size: 10px; color: var(--faint); }

/* --------------------------------------------------------------------------
   台账
   -------------------------------------------------------------------------- */

/* 标题只在顶栏出现一次，这里是「数据 + 动作」条；没有左邻时把动作推到右侧，各页主按钮才上下对齐。 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: var(--s-3); }
.page-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.page-head > .inline-actions:only-child { margin-left: auto; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-note { font-size: 11.5px; color: var(--muted); }

.debt-list { display: flex; flex-direction: column; gap: var(--s-2); }
.debt-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--content);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.debt-row:hover { border-color: var(--glass-thick-bd); background: var(--content-2); box-shadow: var(--shadow-sm); }
.debt-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--av-bg, var(--g-soft)); color: var(--av-ink, var(--g-deep));
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid var(--glass-thin-bd);
}
/* 头像档位只换自定义属性，不改 background：
   这样 .gray（已结清）这条双类规则仍然压得过它，不用靠声明顺序。 */
.debt-icon.av-1 { --av-bg: var(--av-1-bg); --av-ink: var(--av-1-ink); }
.debt-icon.av-2 { --av-bg: var(--av-2-bg); --av-ink: var(--av-2-ink); }
.debt-icon.av-3 { --av-bg: var(--av-3-bg); --av-ink: var(--av-3-ink); }
.debt-icon.av-4 { --av-bg: var(--av-4-bg); --av-ink: var(--av-4-ink); }
.debt-icon.av-5 { --av-bg: var(--av-5-bg); --av-ink: var(--av-5-ink); }
.debt-icon.av-6 { --av-bg: var(--av-6-bg); --av-ink: var(--av-6-ink); }
.debt-icon.av-lg { width: 52px; height: 52px; font-size: 15px; }
.debt-icon.av-sm { width: 30px; height: 30px; font-size: 10.5px; }
.debt-icon.av-xs { width: 22px; height: 22px; font-size: 9px; letter-spacing: 0; }
/* 逾期不再把头像整块染黄（底色已经归债权方），只描一圈 amber。 */
.debt-icon.ring-overdue { border-color: var(--amber); }
.debt-icon.amber { background: var(--amber-soft); color: var(--amber-ink); }
.debt-icon.blue { background: var(--blue-soft); color: var(--blue-ink); }
.debt-icon.gray { background: var(--neutral-soft); color: var(--muted); }
.debt-main { min-width: 0; }
.debt-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13.5px; font-weight: 600; }
.debt-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.debt-metrics { display: flex; align-items: center; gap: 22px; }
.debt-metric { text-align: right; min-width: 62px; }
.debt-metric b { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.debt-metric span { font-size: 9.5px; color: var(--faint); }
.debt-arrow { color: var(--faint); }
.debt-arrow .ic { width: 15px; height: 15px; }
.debt-row.settled { opacity: 0.6; }
.debt-paid { display: flex; align-items: center; gap: 9px; margin-top: 7px; max-width: 420px; }
.debt-paid .progress { flex: 1; }
.debt-paid-label { flex: 0 0 auto; font-size: 10.5px; color: var(--muted); }

.recycle-list { display: flex; flex-direction: column; gap: var(--s-2); }
.recycle-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--content); border: 1px solid var(--line); }
.recycle-main { flex: 1; min-width: 0; }
.recycle-name { font-size: 12.5px; font-weight: 600; }
.recycle-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

/* --------------------------------------------------------------------------
   策略
   -------------------------------------------------------------------------- */

.choice-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-2); }
.choice-card {
  position: relative;
  display: flex;
  gap: 11px;
  padding: 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--content);
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.choice-card:hover { border-color: var(--line-strong); background: var(--content-2); }
.choice-card.active { border-color: var(--g); background: var(--g-tint); box-shadow: 0 0 0 1px var(--g), 0 0 20px var(--focus); }
.choice-icon { width: 32px; height: 32px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--neutral-soft); color: var(--ink-2); }
.choice-card.active .choice-icon { background: var(--g-soft); color: var(--g-deep); }
.choice-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.choice-text { margin-top: 2px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.choice-check { position: absolute; right: 12px; top: 13px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--content); }
.choice-card.active .choice-check { border-color: var(--g); background: var(--g); }
.choice-card.active .choice-check::after { content: ""; position: absolute; left: 5.5px; top: 2.5px; width: 4px; height: 8px; border: solid var(--on-accent); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }

.budget-panel .budget-display {
  display: flex;
  align-items: baseline;
  gap: var(--s-1);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--content);
  border: 1px solid var(--line-strong);
}
.budget-display span { font-size: 16px; color: var(--muted); }
.budget-input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  outline: none;
  padding: 0;
  min-width: 0;
}
.range { width: 100%; margin: 13px 0 8px; accent-color: var(--g); cursor: pointer; }
.range:disabled { cursor: not-allowed; opacity: 0.5; }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: var(--s-2); margin-top: 12px; }
.scenario { padding: 9px 10px; border-radius: var(--r-sm); background: var(--content); border: 1px solid var(--line); }
.scenario > span { display: block; font-size: 9.5px; color: var(--muted); }
.scenario b { display: block; margin-top: 2px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.scenario.base { background: var(--g-tint); border-color: var(--g-soft); }
.budget-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 10.5px; color: var(--muted); }

.plan-range {
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.plan-range small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* §9.6 表格：表头 12px tertiary，行高 48px，悬停 / 选中态 */
.schedule { width: 100%; border-collapse: collapse; font-size: 13px; }
.schedule th {
  padding: 0 16px; height: 40px; text-align: left; font-size: 12px; font-weight: 500;
  color: var(--faint); background: var(--glass-thin-bg);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.schedule td { padding: 0 16px; height: 48px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.schedule tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.schedule tbody tr:hover { background: var(--glass-thin-bg); }
.schedule tr:last-child td { border-bottom: 0; }
.schedule td.num, .schedule th.num { text-align: right; }
.schedule .dest { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.schedule .dest span { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: var(--r-full); background: var(--neutral-soft); font-size: 10px; color: var(--muted); }
/* 摊销预览固定露出最后一期：先息后本只有这一行见得到本金，得让它跳出来。 */
.schedule tr.schedule-last td { background: var(--amber-tint); font-weight: 600; }
.schedule tr.schedule-gap td { height: 30px; text-align: center; font-size: 10.5px; color: var(--faint); background: var(--glass-thin-bg); }

/* §9.9 时间轴节点：12px 圆 + 2px 外环 */
.timeline { position: relative; margin-left: 6px; padding-left: 20px; border-left: 1px solid var(--line); }
.tl-item { position: relative; padding-bottom: var(--s-4); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -27px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--amber-soft);
}
.tl-head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.tl-month { font-size: 13px; font-weight: 600; }
.tl-items { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.tl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--content); font-size: 11.5px; }
.tl-row b { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--amber-ink); }

.stop-list { display: flex; flex-direction: column; gap: var(--s-2); counter-reset: stop; }
.stop-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 11px; border-radius: var(--r-md); background: var(--content); border: 1px solid var(--line); }
.stop-num { width: 21px; height: 21px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--amber-soft); color: var(--amber-ink); font-size: 10.5px; font-weight: 700; }
.stop-text { font-size: 11.5px; line-height: 1.6; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   收支 / 行动
   -------------------------------------------------------------------------- */

.flow-list { display: flex; flex-direction: column; }
.flow-item { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 11px 0; border-top: 1px solid var(--line); }
.flow-item:first-child { border-top: 0; padding-top: 0; }
.flow-item:last-child { padding-bottom: 0; }
.flow-icon { width: 34px; height: 34px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--g-soft); color: var(--g-deep); }
.flow-icon.out { background: var(--amber-soft); color: var(--amber-ink); }
.flow-icon .ic { width: 16px; height: 16px; }
.flow-main { flex: 1; min-width: 0; }
.flow-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; font-weight: 600; }
.flow-meta { margin-top: 1px; font-size: 10.5px; color: var(--muted); }
.flow-amount { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; flex: 0 0 auto; }
.flow-actions { display: flex; gap: 3px; flex: 0 0 auto; opacity: 0.55; transition: opacity var(--dur-fast) var(--ease-out); }
.flow-item:hover .flow-actions, .flow-actions:focus-within { opacity: 1; }
.flow-total { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: 12px; color: var(--muted); }
.flow-total b { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   日历
   -------------------------------------------------------------------------- */

.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cal-title { font-family: var(--font-brand); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.cal-weekdays span { padding: 4px 0; text-align: center; font-size: 11px; color: var(--faint); font-weight: 500; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-cell {
  min-height: 82px;
  padding: 7px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--content);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.cal-cell:hover { border-color: var(--line-strong); }
.cal-cell.blank { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--g); background: var(--g-tint); box-shadow: 0 0 0 1px var(--g), 0 0 20px var(--focus); }
.cal-cell.out { opacity: 0.45; }
.cal-day { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-today-tag { font-size: 8.5px; font-weight: 600; color: var(--g-strong); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--g); }
.cal-dot.amber { background: var(--amber); }
.cal-dot.red { background: var(--red); }
.cal-names { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.cal-names span { display: flex; align-items: center; gap: 3px; min-width: 0; font-size: 8.5px; line-height: 1.35; color: var(--muted); }
.cal-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; }
.cal-bullet { flex: 0 0 auto; padding: 0 3px; border-radius: 3px; background: var(--amber-soft); color: var(--amber-ink); font-weight: 650; font-size: 8px; }
.cal-more { margin-top: 3px; font-size: 8.5px; color: var(--faint); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 10.5px; color: var(--muted); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--g); margin-right: 4px; }
.cal-legend i.amber { background: var(--amber); }
.cal-legend i.red { background: var(--red); }

/* --------------------------------------------------------------------------
   征信
   -------------------------------------------------------------------------- */

.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line-strong);
  background: var(--content);
  text-align: center;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.upload-zone:hover { border-color: var(--g); background: var(--g-tint); }
.upload-zone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { width: 54px; height: 54px; border-radius: var(--r-xl); display: grid; place-items: center; background: var(--g-soft); color: var(--g-deep); margin-bottom: 12px; }
.upload-icon .ic { width: 24px; height: 24px; }
.upload-title { font-size: 14px; font-weight: 600; }
.upload-sub { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); max-width: 400px; line-height: 1.7; }
.upload-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: 14px; }
.upload-note { margin-top: 12px; font-size: 10px; color: var(--faint); }

.confidence { display: flex; align-items: center; gap: 10px; }
.confidence-bar { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.confidence-bar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--g); }
.confidence-bar.low > i { background: var(--amber); }
.confidence-value { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

.candidate-list { display: flex; flex-direction: column; gap: var(--s-2); }
.candidate-item { padding: 12px; border-radius: var(--r-md); background: var(--content); border: 1px solid var(--line); }
.candidate-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.candidate-name { font-size: 12.5px; font-weight: 600; }
.candidate-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 5px; font-size: 10.5px; color: var(--muted); }

.manual-steps { display: flex; flex-direction: column; gap: 9px; }
.step-item { display: flex; gap: 10px; align-items: flex-start; }
.step-num { width: 22px; height: 22px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-ink); font-size: 10.5px; font-weight: 700; }
.step-text { font-size: 11.5px; line-height: 1.65; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   设置
   -------------------------------------------------------------------------- */

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.settings-card { display: flex; flex-direction: column; }
.settings-card.span-2 { grid-column: 1 / -1; }
/* 提醒占满左列两行，右列才是 测算口径 → 数据处置 的上下顺序；关于与边界单独长条。 */
.settings-card.span-rows { grid-row: 1 / span 2; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 48px; padding: 12px 0; border-top: 1px solid var(--line); }
.settings-row:first-child { border-top: 0; padding-top: 0; }
.settings-row:last-child { padding-bottom: 0; }
.settings-main { min-width: 0; }
.settings-label { font-size: 13px; font-weight: 500; }
.settings-desc { margin-top: 2px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.settings-side { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.settings-side .input { height: 36px; width: 118px; font-size: 12.5px; }
.settings-side .input.time { width: 102px; }

/* --------------------------------------------------------------------------
   账号与安全弹层（侧栏头像入口）
   -------------------------------------------------------------------------- */

.account-id { display: flex; align-items: center; gap: 14px; }
.user-avatar.av-lg { width: 56px; height: 56px; font-size: 22px; }
.account-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-who strong { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-note { margin: 13px 0 0; font-size: 11.5px; color: var(--ink-2); line-height: 1.7; }
.account-label { margin: 15px 0 0; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.av-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.av-dot {
  width: 38px; height: 38px; flex: 0 0 auto; padding: 0;
  border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--on-accent); font-weight: 700; font-size: 13px;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.av-dot .ua-in { grid-area: 1 / 1; line-height: 1; }
.av-dot:hover { transform: translateY(-1px); }
.av-dot.active { border-color: var(--g); box-shadow: 0 0 0 3px var(--focus); }
.account-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.account-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; text-align: left;
  padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--content); cursor: pointer; color: inherit; font: inherit;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.account-row:hover { border-color: var(--g); }
.account-row:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.account-row-ic { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; background: var(--g-tint); color: var(--g); }
.account-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.account-row-main b { font-size: 13px; font-weight: 600; }
.account-row-main small { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.account-row-arrow { color: var(--faint); flex: 0 0 auto; }

.danger-zone { padding: 2px 0 0; }
.danger-text { margin: 0 0 10px; font-size: 10.5px; color: var(--muted); line-height: 1.65; }

/* --------------------------------------------------------------------------
   表单 / 弹层
   -------------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 500; color: var(--ink-2); }
.field label em { font-style: normal; color: var(--amber-strong); font-weight: 500; margin-left: 2px; }
/* §9.5 输入框：40px / 6px 圆角 / 聚焦辉光 */
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-regular-bd);
  background: var(--field);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  min-width: 0;
}
.input:focus { border-color: var(--g); box-shadow: 0 0 0 3px var(--focus); }
.input::placeholder { color: var(--faint); font-size: 13px; }
select.input { appearance: none; -webkit-appearance: none; background-image: none; padding-right: 30px; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.65; resize: vertical; }
.input-group { display: flex; align-items: center; gap: 6px; }
.input-group .input { flex: 1; }
.input-suffix { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.hint { font-size: 10.5px; color: var(--faint); line-height: 1.55; }
.form-error { display: none; padding: 9px 11px; border-radius: var(--r-sm); background: var(--amber-tint); border: 1px solid var(--amber-soft); color: var(--amber-ink); font-size: 11.5px; line-height: 1.6; }
.form-error.show { display: block; }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 11.5px; color: var(--ink-2); line-height: 1.55; }
.check-row input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--g); flex: 0 0 auto; }
.form-section { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.form-section:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.form-section-title { font-size: 12px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
/* 表单里的选填折叠组（协商与逾期）：内容层用不透明 --content，靠描边分层 */
.form-details { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--content); grid-column: 1 / -1; }
.form-details > summary { display: flex; align-items: center; gap: 8px; padding: 11px 12px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form-details > summary::-webkit-details-marker { display: none; }
.form-details > summary::before { content: ''; flex: 0 0 auto; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform var(--dur-fast) var(--ease-out); }
.form-details[open] > summary::before { transform: rotate(90deg); }
.form-details > summary:hover { color: var(--ink); }
.form-details-note { font-weight: 400; font-size: 10.5px; color: var(--faint); }
/* 「到期时间」是必填项之一，所以直接摊开而不是折叠；标题样式与折叠组的 summary 对齐。 */
.form-details-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form-details-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }

.inline-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.spacer { flex: 1; }

/* §9.7 弹窗：遮罩 blur(2px) + glass-thick + 20px 圆角 + scale 入场 */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 18px 24px;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  overflow-y: auto;
  animation: overlayIn var(--dur-fast) var(--ease-out) both;
}
.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 10vh);
  overflow-y: auto;
  border-radius: var(--r-xl);
  background: var(--glass-thick-bg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-thick-bd);
  backdrop-filter: var(--blur-thick);
  -webkit-backdrop-filter: var(--blur-thick);
  padding: var(--s-4);
  animation: modalIn var(--dur-normal) var(--ease-out) both;
}
.modal.wide { width: min(800px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: var(--s-3); }
.modal-title { margin: 0; font-family: var(--font-brand); font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.modal-sub { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.modal-close {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: var(--r-full);
  border: 1px solid var(--glass-clear-bd); background: var(--glass-clear-bg);
  display: grid; place-items: center; color: var(--muted); padding: 0;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.modal-close:hover { background: var(--glass-regular-bg); color: var(--ink); }
.modal-body { min-width: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--s-2); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.modal-note { margin: 10px 0 0; font-size: 10.5px; color: var(--faint); line-height: 1.6; }
.modal-section-title { font-size: 12px; font-weight: 600; margin: 16px 0 8px; }

.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.detail-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.detail-name { font-family: var(--font-brand); font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.detail-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.detail-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; margin: 14px 0; }
/* 债务详情首行有四项（本金 / 余额 / 期数 / 最后一期），三列会留一个空格子。 */
.detail-metrics.quad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-metric { background: var(--content); padding: 11px 12px; }
.detail-metric span { display: block; font-size: 9.5px; color: var(--muted); }
.detail-metric b { display: block; margin-top: 3px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-note { padding: 10px 12px; border-radius: var(--r-md); background: var(--content); font-size: 11.5px; color: var(--muted); line-height: 1.65; }
/* 先息后本 / 气球贷的本金悬崖公告：用 warn 那套 amber，与「这不是月供」的语义一致。 */
.detail-note.bullet-note { background: var(--amber-tint); color: var(--ink-2); border: 1px solid var(--amber-soft); }

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* --------------------------------------------------------------------------
   Toast / 底部导航
   -------------------------------------------------------------------------- */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  width: min(92vw, 460px);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 11px 16px;
  border-radius: var(--r-lg);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid var(--glass-thin-bd);
  box-shadow: var(--shadow-lg);
  animation: toastIn var(--dur-normal) var(--ease-out) both;
}
.toast .ic { color: var(--toast-accent); }
.toast.warn { background: var(--toast-warn-bg); }
.toast.warn .ic { color: var(--amber-strong); }
.toast.out { animation: toastOut var(--dur-fast) var(--ease-in) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }

.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px;
  border-radius: var(--r-xl);
  background: var(--glass-regular-bg);
  border: 1px solid var(--glass-regular-bd);
  box-shadow: var(--shadow-md);
  backdrop-filter: var(--blur-regular);
  -webkit-backdrop-filter: var(--blur-regular);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.bottom-nav a.active { background: var(--glass-thick-bg); color: var(--g-strong); font-weight: 600; }
.bottom-nav .nav-icon { width: 22px; height: 22px; }

/* --------------------------------------------------------------------------
   驾驶舱三带 + 右侧通栏（参考图版式）
   -------------------------------------------------------------------------- */

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: var(--s-3); align-items: start; }
.dash-main { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
/* 带二（各 tab 主面板）和带三（结清进度插画）各占整行。
   插画以前挤在带二右列，1600px 下只有 452px：主卡只能浮在栅栏上面，
   卡名和「已结清 1/7 笔」直接糊成一团。放整行之后栅栏拿到 ~660px，
   主卡和栅栏并排、互不遮挡，卡片也宽到能写下债权方和余额。 */
.dash-lead, .dash-fan { min-width: 0; }
.dash-lead > * { min-width: 0; }

/* ---- 带三：结清进度插画（参考图那块栅栏玻璃卡） ----
   纯 CSS 3D：.fan-stage 给 perspective，.fan-row 用 preserve-3d + 正 rotateY
   把整排卡放在同一个平面上（正角度把右端推远，于是从左到右自然变小、往上收）。
   平面内的 .pane 一律不加 backdrop-filter：Chrome 下 preserve-3d + 子级
   backdrop-filter 会让整组卡直接不合成，插画变空白。磨砂感全部用渐变假造。 */
.fan { display: flex; align-items: center; gap: var(--s-5); min-width: 0; }
.fan-solo { display: block; }
.fan-solo .fan-lead { width: 232px; }

.fan-lead {
  position: relative; flex: 0 0 196px; z-index: 2;
  display: flex; flex-direction: column; padding: 22px 20px 20px;
  border-radius: 24px;
  border: 1px solid var(--pane-edge);
  background: var(--lead-fill);
  box-shadow: var(--lead-shadow);
  transform: rotateY(7deg);
  transform-origin: 100% 50%;
}
.lead-go { position: absolute; top: 17px; right: 14px; display: grid; place-items: center;
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--ink-2); cursor: pointer; }
.lead-go:hover { background: var(--neutral-soft); }
.lead-go:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.lead-title { font-size: 15.5px; font-weight: 650; color: var(--ink); }
.lead-sub { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.lead-num { margin-top: 30px; font-size: 56px; font-weight: 350; line-height: .92;
  letter-spacing: -0.045em; color: var(--ink); }
.lead-num i { margin-left: 4px; font-size: 18px; font-style: normal; font-weight: 500; color: var(--faint); }
.lead-cap { margin-top: 13px; font-size: 11.5px; color: var(--faint); }
/* 栅栏没有滚动条、也没有箭头线索，第一次用不知道能点，这里把操作直接写出来。 */
.lead-hint { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--faint); }

/* perspective 越小，右端缩得越狠。参考图那排末端只有首端的 ~72%，
   1500px 时只到 79%，看着像一排等高卡片贴在平面上，没有纵深。
   margin-left 把排首收到主卡背后一点（约 1/4 张卡），构图连成一块；
   主卡 z-index:2 且不透明，卡名不会被栅栏的字压住。
   overflow:hidden 裁掉超出舞台的卡尾，行宽 112% 补上 rotateY 的横向压缩。 */
.fan-stage { position: relative; flex: 1 1 0; min-width: 0; height: 226px; margin-left: -26px;
  perspective: 1050px; perspective-origin: 0% 50%; overflow: hidden; }
.fan-floor { position: absolute; left: 0; right: -2%; bottom: -6px; height: 34px;
  background: var(--floor-fill); filter: blur(13px); opacity: .95; }
/* --n 由 JS 写成卡片数。齿距固定是卡宽的 86%（参考图那排约叠掉 1/4），
   所以卡宽 = 100% / (0.86n + 0.14)，卡片数变了不用回来改 CSS。
   --fan-tilt 是整排的倾斜角，悬停卡用 rotateY(calc(-1*--fan-tilt)) 转正面对用户。 */
.fan-row {
  --bw: calc(100% / (0.86 * var(--n) + 0.14));
  --fan-tilt: 24deg;
  position: absolute; left: 0; top: 50%; width: 112%; height: 190px;
  display: flex; align-items: flex-end;
  transform: translateY(-50%) rotateY(var(--fan-tilt));
  transform-style: preserve-3d;
}
/* 每张卡就是一笔债的按钮：.pane 用 <button>，靠这里把浏览器默认样式抹平。 */
.pane {
  position: relative; display: flex; flex-direction: column;
  flex: 0 0 var(--bw); height: 100%; margin-right: calc(-0.14 * var(--bw));
  padding: 15px 12px 12px;
  border-radius: 15px;
  border: 1px solid var(--pane-edge);
  background: var(--pane-fill);
  box-shadow: var(--pane-shadow), inset 3px 0 0 var(--pane-edge);
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: transform var(--dur-normal) var(--ease-out), height var(--dur-normal) var(--ease-out),
    background var(--dur-fast) linear, box-shadow var(--dur-normal) var(--ease-out);
}
/* --i 是这张卡在排里的序号（JS 写入）。参考图的纵深不只是尺寸变小，末端还更暗，
   所以叠一层随序号加深的色罩；用 ::before 而不是 filter，filter 会把
   preserve-3d 的子树压平。绿卡不吃这层罩（下面 .pane.hot::before 归零）。 */
.pane::before { content: ''; position: absolute; inset: -1px; z-index: 1; border-radius: inherit;
  background: var(--pane-deep); opacity: calc(0.055 * var(--i)); pointer-events: none; }
/* 悬停 / 键盘聚焦 / 点选 = 同一种「亮起」：整卡转正面对用户（抵消排的倾斜角，
   这就是「转动」——卡从斜立面旋到正面）+ 染绿 + 冒出一截。
   支点必须在左缘（transform-origin: left center）：转正后亮卡是与屏幕平行的
   恒定深度平面，而排面深度沿 X 递减——若以中心为支点，恒定深度 = 排面在卡中心的
   深度，必然输给左邻卡右缘（那里更深），亮卡左上角就会被压出缺口。
   以左缘为支点时恒定深度 = 排面在卡左缘的深度，是亮卡足迹内所有竞争点里最靠前的，
   任何一张卡在任何位置都天然盖住两侧邻卡，无需按位置调 translateZ。 */
.pane:hover, .pane:focus-visible, .pane.hot {
  height: 108%;
  border-color: var(--on-accent-line);
  background: var(--pane-hot-fill);
  box-shadow: var(--pane-hot-glow), inset 3px 0 0 var(--on-accent-line);
  transform: rotateY(calc(-1 * var(--fan-tilt)));
  transform-origin: left center;
}
/* 键盘走卡时的可见焦点环：绿底上用亮线，跟随卡的圆角。 */
.pane:focus-visible { outline: 2px solid var(--on-accent-line); outline-offset: 2px; }
.pane:hover::before, .pane:focus-visible::before, .pane.hot::before { opacity: 0; }
.pane.done:hover, .pane.done:focus-visible, .pane.done.hot { opacity: .8; }
.pane-doc { display: block; }
.pane-doc b { display: block; width: 52%; height: 7px; border-radius: 3px; background: var(--pane-glyph); }
.pane-doc i { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--pane-glyph); }
.pane-doc i:nth-child(2) { width: 92%; }
.pane-doc i:nth-child(3) { width: 68%; }
.pane-ico { display: block; margin-top: auto; color: var(--pane-glyph); }
.pane-ico .ic { width: 15px; height: 15px; }
.pane-tag { margin-top: 9px; font-size: 11px; font-weight: 600; color: var(--pane-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-val { margin-top: 2px; font-size: 10.5px; color: var(--pane-glyph); }
.pane.done { opacity: .5; }
/* 亮起态的文字换色：选择器与上面的亮起块保持同组（hover/focus/hot 三态）。 */
.pane.hot::after, .pane:hover::after { content: ''; position: absolute; left: 4%; right: 4%; bottom: -16px; height: 22px;
  border-radius: 50%; background: var(--pane-hot-glow); filter: blur(12px); }
.pane-doc b, .pane-doc i { transition: background var(--dur-fast) linear; }
.pane:hover .pane-doc b, .pane:hover .pane-doc i,
.pane:focus-visible .pane-doc b, .pane:focus-visible .pane-doc i,
.pane.hot .pane-doc b, .pane.hot .pane-doc i { background: var(--on-accent-line); }
.pane:hover .pane-ico, .pane:focus-visible .pane-ico, .pane.hot .pane-ico { color: var(--on-accent); opacity: .9; }
.pane:hover .pane-tag, .pane:focus-visible .pane-tag, .pane.hot .pane-tag { color: var(--on-accent); font-weight: 700; }
.pane:hover .pane-val, .pane:focus-visible .pane-val, .pane.hot .pane-val { color: var(--on-accent-line); }

/* ---- 底段左列：还款时间线（月份尺 + 每笔债一根条） ---- */
.tl { display: flex; flex-direction: column; gap: 7px; }
.tl-ruler, .tl-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 54px;
  align-items: center;
  gap: var(--s-2);
}
.tl-ruler { padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.tl-scale { display: flex; }
.tl-tick { flex: 1 1 0; min-width: 0; font-size: 10.5px; color: var(--muted); text-align: left;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-tick.now { color: var(--g-strong); font-weight: 600; }
.tl-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tl-track { position: relative; height: 14px; border-radius: var(--r-full); background: var(--line); }
.tl-bar { position: absolute; top: 0; bottom: 0; border-radius: var(--r-full); opacity: .92;
  transition: width var(--dur-normal) var(--ease-out), opacity var(--dur-fast) var(--ease-out); }
.tl-row:hover .tl-bar { opacity: 1; }
/* 超出可视尺度的那截不给假长度，用斜纹收尾表示「还在窗口外」。 */
.tl-bar.cut { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.tl-bar.cut::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 9px;
  border-radius: 0 2px 2px 0;
  background: repeating-linear-gradient(115deg, var(--line-strong) 0 2px, transparent 2px 5px); }
.tl-end { font-size: 10.5px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.tl-note { margin: var(--s-3) 0 0; font-size: 11px; color: var(--muted); line-height: 1.6; }

/* ---- 右侧通栏：智能详情 + 优先处理 + 建议 + 动作对 ---- */
.rail { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; position: sticky; top: var(--s-4); }
.rail-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-thin-bd);
  background: var(--glass-thin-bg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur-thin);
  -webkit-backdrop-filter: var(--blur-thin);
  padding: var(--s-3);
}
.rail-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: 10px; }
.rail-head h2 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; flex: 1; min-width: 0; }
.rail-head-icon { width: 24px; height: 24px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--violet-soft); color: var(--violet-ink); flex: 0 0 auto; }
.rail-head-icon .ic { width: 15px; height: 15px; }
.rail-head .btn.icon { margin-left: auto; }
.rail-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rail-code { margin: 0; font-size: 10.5px; color: var(--faint); letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-name { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.rail-name-text { min-width: 0; }
.rail-pri { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: var(--r-full);
  background: var(--g-soft); color: var(--g-deep); }
.rail-pri.high { background: var(--red-soft); color: var(--red-ink); }
.rail-desc { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.rail-dl { margin: 0; display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.rail-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: 7px 10px; background: var(--content); }
.rail-row dt { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.rail-row dt .ic { width: 13px; height: 13px; color: var(--faint); }
.rail-row dd { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink); }
/* 先息后本的当期应付只有利息，这一行小字是必要的限定，不是装饰。 */
.rail-row-note { display: block; font-size: 9.5px; font-weight: 500; color: var(--faint); text-align: right; }
.rail-tags { margin: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.rail-mini { display: flex; flex-direction: column; gap: 5px; }
.rail-mini-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  width: 100%; margin: 0; padding: 8px 10px; font: inherit; color: inherit; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--content); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.rail-mini-row:hover { border-color: var(--g); background: var(--g-tint); }
.rail-mini-name { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.rail-mini-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-mini-val { font-size: 11.5px; font-weight: 650; color: var(--ink-2); flex: 0 0 auto; }
.rail-advice { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rail-advice li { position: relative; padding-left: 14px; font-size: 11.5px; line-height: 1.65; color: var(--muted); }
.rail-advice li::before { content: ""; position: absolute; left: 0; top: 7px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--g); }
.rail-advice li.warn::before { background: var(--amber); }
.rail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.rail-actions .btn { justify-content: center; }
.rail-empty { font-size: 11.5px; color: var(--muted); line-height: 1.65; }

/* --------------------------------------------------------------------------
   响应式（§5.3 / §11.1）
   -------------------------------------------------------------------------- */

/* 1024-1439px：导航栏收为 64px 图标模式 */
@media (max-width: 1439px) and (min-width: 1024px) {
  .sidebar { width: 64px; padding: 20px 10px; align-items: center; }
  .brand { padding: 4px 0 18px; justify-content: center; }
  .brand-text, .nav a span, .nav a.active::after,
  .side-group-head, .side-switch span, .side-caret, .user-meta { display: none; }
  .nav { width: 100%; }
  .nav a { justify-content: center; padding: 0; }
  .side-group { padding: 10px 0 0; }
  .side-switch { width: 40px; padding: 0; margin: 0 auto; justify-content: center; }
  /* 图标轨里档案行改成竖排：头像在上、锁定在下，两个都要留着，锁定是唯一入口。 */
  .side-user { flex-direction: column; gap: 6px; padding: 10px 0 2px; }
  .main-wrap { margin-left: 96px; }
}

@media (max-width: 1180px) {
  .main-wrap { padding: 26px 28px 40px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  /* 主区不够宽时右侧通栏落到最下面；插画带在 DOM 里本来就排在数据带之后。 */
  .dash { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; }
}

@media (max-width: 1023px) {
  .sidebar { width: 208px; padding: 20px 14px; align-items: stretch; }
  .brand { padding: 4px 8px 20px; justify-content: flex-start; }
  .brand-text, .nav a span, .side-group-head, .side-switch span, .side-caret, .user-meta { display: flex; }
  .brand-text { display: flex; }
  .nav a { justify-content: flex-start; padding: 0 12px 0 16px; }
  .nav a.active::after { display: block; }
  .side-group { padding: 14px 4px 0; }
  .side-switch { width: 100%; padding: 0 12px; margin: 0; justify-content: flex-start; }
  .side-user { flex-direction: row; gap: 10px; padding: 10px 8px 2px; }
  .main-wrap { margin-left: 240px; }
  .debt-metrics { gap: 15px; }
}

@media (max-width: 900px) {
  /* 顶栏是 grid，flex-wrap 对它无效。三列一直撑到 767px，中间搜索占掉 460px，
     标题列被挤成一字一行、右侧主按钮顶出边界；这里让搜索自己占一整行。 */
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title actions" "search search";
    row-gap: 14px;
  }
  .topbar-title { grid-area: title; }
  .top-actions { grid-area: actions; }
  .top-search { grid-area: search; }
  /* 栅栏宽度是 % 算的，列一变窄卡就跟着变扁，所以这里连行高一起收，
     保持参考图「卡宽 ≈ 卡高一半」的比例。 */
  .fan { gap: var(--s-4); }
  .fan-lead { flex-basis: 172px; padding: 18px 16px 16px; border-radius: 20px; }
  .lead-num { margin-top: 20px; font-size: 44px; }
  .fan-stage { height: 168px; margin-left: -18px; }
  .fan-row { height: 144px; }
  .pane { padding: 11px 9px 9px; border-radius: 13px; }
  .pane-tag { margin-top: 7px; font-size: 10px; }
  .pane-val { font-size: 9.5px; }
  .tl-ruler, .tl-row { grid-template-columns: 92px minmax(0, 1fr) 46px; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  /* 单列时跨行会在卡片之间留出一条空行，这里取消跨行，恢复成自上而下一列。 */
  .settings-card.span-rows { grid-row: auto; }
  .grid-2.even { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
  body { font-size: 13px; }
  .sidebar { display: none; }
  /* 手机上栅栏排不进 345px 的一整行宽：主卡横铺在上、栅栏在下，两层各占整行。
     以前把主卡压成 124px 塞在栅栏左边，两边互相叠字，糊成一片。 */
  .fan { flex-direction: column; align-items: stretch; gap: var(--s-4); }
  .fan-solo .fan-lead { width: auto; }
  .fan-lead { flex: none; width: auto; padding: 15px 16px 16px; border-radius: 20px; transform: none; }
  .lead-go { top: 13px; right: 11px; width: 24px; height: 24px; }
  .lead-title { font-size: 13.5px; }
  .lead-sub { margin-top: 3px; font-size: 10px; }
  .lead-num { margin-top: 16px; font-size: 40px; }
  .lead-num i { font-size: 14px; }
  .lead-cap { margin-top: 9px; font-size: 10.5px; }
  /* 触屏没有方向键，这行提示在手机上只会占位。 */
  .lead-hint { display: none; }
  /* .fan 转纵向后主轴是高度，基础规则的 flex:1 1 0 会把舞台压成 0——
     这里必须解掉 flex 才能让 height:128px 生效。 */
  .fan-stage { flex: none; height: 128px; margin-left: 0; }
  /* 窄屏下大角度会把末端三张压到看不清，收一点角度换可读性；
     悬停/选中的转正角度由 --fan-tilt 统一驱动，这里只改变量。 */
  .fan-row { height: 108px; --fan-tilt: 16deg; }
  .pane { padding: 9px 7px 8px; border-radius: 12px; }
  .pane-doc b { height: 5px; }
  .pane-doc i { height: 3px; margin-top: 4px; }
  .pane-ico .ic { width: 11px; height: 11px; }
  .pane-tag { margin-top: 6px; font-size: 9px; }
  .pane-val { display: none; }
  .fan-floor { left: 0; right: 0; bottom: -4px; height: 26px; }
  .main-wrap { margin-left: 0; padding: 18px 15px calc(94px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav { display: grid; }
  .topbar { margin-bottom: var(--s-3); gap: 12px; row-gap: 10px;
            grid-template-columns: minmax(0, 1fr) auto;
            grid-template-areas: "title actions" "sub sub" "search search"; }
  /* 359px 下标题列被按钮挤到只剩 120px，副标题排成六行。把 .topbar-title 拆成两个栅格项：
     h1 继续和按钮同排（它本来就短），副标题自己占一整行。 */
  .topbar-title { display: contents; }
  .topbar h1 { grid-area: title; font-size: 20px; }
  .page-sub { font-size: 11.5px; }
  .topbar .page-sub { grid-area: sub; }
  /* 明暗切换在「我的 → 设置」里也有；窄屏留着它，标题列就只放得下两个字，
     「心愿清单」会被折成两行。提醒铃不能收——上面的红点是唯一的逾期信号。 */
  .top-actions [data-act="toggle-theme"] { display: none; }
  .top-actions { gap: 7px; }
  .local-badge { display: none; }
  .top-actions .btn.primary { min-height: 40px; padding: 0 16px; font-size: 13px; }
  .kpi-value { font-size: 20px; }
  .kpi-foot { font-size: 10px; }
  .tl-ruler, .tl-row { grid-template-columns: 78px minmax(0, 1fr) 40px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid.cols-3 .kpi:last-child { grid-column: 1 / -1; }
  .kpi { min-height: 104px; padding: 14px; }
  .kpi-value { margin-top: 7px; }
  .kpi-icon { width: 25px; height: 25px; }
  .kpi-icon .ic { width: 16px; height: 16px; }
  .kpi-sub { font-size: 10px; }
  .panel { padding: var(--s-3); }
  .panel-head { margin-bottom: 12px; }
  .panel-title { font-size: 15px; }
  .grid-2, .grid-3 { gap: var(--s-3); }
  .stack { gap: var(--s-3); }
  .site-foot { display: none; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip .metric-cell:last-child { grid-column: 1 / -1; }
  .debt-row { grid-template-columns: 38px minmax(0, 1fr) 14px; padding: 12px; gap: 10px; }
  .debt-icon { width: 38px; height: 38px; }
  .debt-metrics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 9px; margin-top: -1px; }
  .debt-metric { text-align: left; min-width: 0; }
  .debt-metric b { font-size: 12.5px; }
  .debt-arrow { grid-row: 1; grid-column: 3; }
  /* 心愿清单一行里同时有标题、金额和四个图标按钮，按钮组自己就 249px，
     窄屏容器才 285px，三个不换行的 flex 子项相加直接撑出横向滚动。
     让按钮组独占第二行并右对齐，标题与金额留在第一行。 */
  .row { flex-wrap: wrap; }
  .row-actions { flex: 1 1 100%; justify-content: flex-end; margin-top: 2px; }
  .settings-grid { gap: var(--s-3); }
  .form-grid, .form-row-2 { grid-template-columns: minmax(0, 1fr); }
  .choice-grid { gap: 7px; }
  .scenario-grid { grid-template-columns: 1fr; }
  .scenario { display: flex; align-items: center; justify-content: space-between; }
  .scenario b { margin-top: 0; }
  .schedule { display: block; overflow-x: auto; white-space: nowrap; }
  .schedule th:nth-child(4), .schedule td:nth-child(4) { display: none; }
  .cal-cell { min-height: 58px; padding: 5px; }
  .cal-names { display: none; }
  .cal-dot { width: 5px; height: 5px; }
  .cal-grid, .cal-weekdays { gap: 4px; }
  .modal-overlay { padding: 3vh 10px 12px; align-items: flex-end; }
  .modal { max-height: 92vh; padding: var(--s-3); }
  .detail-metrics, .detail-metrics.quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-actions { opacity: 1; }
  .toast-root { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .page-head { align-items: flex-start; }
  .upload-zone { min-height: 170px; padding: 20px 14px; }
  /* 手机上工具栏只留图标，但用 display:none 会把按钮的可访问名一起抹掉，
     读屏只剩一个没有名字的圆点。改成视觉隐藏、语义保留。 */
  .cal-toolbar .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap; }
  .risk-meta { font-size: 10px; }
}

@media (max-width: 420px) {
  .topbar h1 { font-size: 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 10.5px; }
  .debt-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .debt-metric:nth-child(3) { grid-column: 1 / -1; }
  .detail-metrics, .detail-metrics.quad { grid-template-columns: 1fr 1fr; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .cal-cell { min-height: 50px; }
}

/* --------------------------------------------------------------------------
   本机档案门：锁屏 / 选择 / 新建（数据按档案分区存于 localStorage）
   -------------------------------------------------------------------------- */
body.locked .app-shell,
body.locked .bottom-nav { display: none; }

.gate-root {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
}
.gate-root[hidden] { display: none; }
.gate-wrap { width: 100%; max-width: 420px; }
.gate-card {
  background: var(--glass-thick-bg);
  border: 1px solid var(--glass-thick-bd);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-5);
  backdrop-filter: var(--blur-thick);
  -webkit-backdrop-filter: var(--blur-thick);
}
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.gate-brand strong { display: block; font-family: var(--font-brand); font-size: 18px; font-weight: 700; }
.gate-brand small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
/* 底和圆角归 CSS（同 .brand-mark 一处来源）；SVG 里只画字，不然 JS 模板就得写死色值。 */
.gate-mark { width: 40px; height: 40px; flex: 0 0 auto; display: inline-flex; border-radius: var(--r-lg);
  background: var(--brand-fill); color: var(--on-accent); }
.gate-mark svg { width: 40px; height: 40px; }
.gate-card .field { margin-bottom: 14px; }
.gate-card .field label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.gate-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.gate-actions .spacer { flex: 1; }
.gate-err { margin: 0 0 12px; font-size: 12px; color: var(--amber-ink); }
.gate-note { margin: 16px 0 0; font-size: 10.5px; line-height: 1.6; color: var(--faint); }

.profile-list { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-1); }
.profile-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 48px; padding: 12px; border-radius: var(--r-md);
  background: var(--content); border: 1px solid var(--line);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.profile-item:hover { border-color: var(--g); background: var(--g-tint); }
.profile-avatar {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--g); color: var(--on-accent); font-weight: 600; font-size: 15px;
}
.profile-meta { flex: 1; min-width: 0; }
.profile-meta b { display: block; font-size: 14px; font-weight: 600; }
.profile-meta small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.profile-lock { color: var(--muted); display: inline-flex; }

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