/*
 * 新用户流程（js/v2/onboarding.js）。全屏，没有导航，一屏一件事。层次靠字号和留白，不靠框。
 * 账本里的「让 AI 整理」「公司股票」带 from=onboarding 时也用这里的顶栏和进度条（body[data-v2-focus]）。
 */

body[data-v2-focus] .v2-sidebar,
body[data-v2-focus] .v2-topbar,
body[data-v2-focus] .v2-tabbar,
body[data-v2-focus] .v2-footer { display: none; }
body[data-v2-focus] .v2-app { display: block; }
body[data-v2-focus] .v2-main { padding-top: 0; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
/* 手机上外壳藏了返回链接（有底部导航）。流程里没有底部导航，要留着 */
body[data-v2-focus] .v2-flow__head > .v2-backlink { display: inline-flex; margin-top: 32px; margin-bottom: 12px; }
body[data-v2-focus] .v2-pagehead { max-width: 1240px; margin-left: auto; margin-right: auto; }
/* 让 AI 整理、公司股票和流程的其他屏同一条内容列，换屏时标题不跳 */
.v2-flow__head,
body[data-v2-focus] #v2-page-host { max-width: 640px; margin-left: auto; margin-right: auto; }

.v2-flow__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.v2-flow__mark { display: inline-flex; align-items: center; min-width: var(--hit, 44px); min-height: var(--hit, 44px); margin: 0; padding: 0; }
/* 流程里账本页签是空的，不留分隔线 */
body[data-v2-focus] .v2-ledger-tabs { display: none; }
/* 离开的入口要找得到，但不抢眼：灰字，不用表示「主要操作」的蓝 */
.v2-flow__leave .v2-btn--text { color: var(--text-3); }
.v2-flow__leave .v2-btn--text:hover { color: var(--text-1); }

/* 进度条：四段，走过和正在走的填满；紧跟标题，流程每一屏和两个收起导航的页面都一样 */
.v2-flow__steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.v2-flow__step { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: var(--t-xs, 12px); line-height: 1.3; color: var(--text-3); }
.v2-flow__fill { position: relative; display: block; height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.v2-flow__fill::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--accent); transform: scaleX(0); transform-origin: left center; }
.v2-flow__step.is-past .v2-flow__fill::after,
.v2-flow__step.is-on .v2-flow__fill::after { transform: scaleX(1); }
.v2-flow__step.is-growing .v2-flow__fill::after { animation: v2-flow-grow 420ms var(--ease) both; }
@keyframes v2-flow-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .v2-flow__step.is-growing .v2-flow__fill::after { animation: none; } }
.v2-flow__step.is-past { color: var(--text-2); }
.v2-flow__step.is-on { color: var(--text-1); font-weight: 600; }
.v2-flow__label { overflow-wrap: anywhere; }
.v2-flow__steps + .v2-onb__lead { margin-top: 20px; }
/* 让 AI 整理、公司股票：标题行自带下边距，进度条贴着标题，再和内容隔开 */
.v2-flow__head > .v2-pagehead__row { margin-bottom: 0; }
.v2-flow__head { margin-bottom: var(--gap-section); }

.v2-onb__notice { max-width: 1240px; margin: 0 auto; }

.v2-onb__main { margin: 32px auto 0; }
.v2-onb__back {
  position: relative;
  display: inline-flex; align-items: center; gap: 2px;
  margin: 0 0 12px -4px; padding: 0;
  border: 0; background: none; cursor: pointer;
  font-size: var(--t-sm); color: var(--accent);
}
/* 外壳的返回链接手机上隐藏（有底部导航），这里是一段流程，手机也要能回到上一步 */
.v2-onb__main .v2-onb__back { display: inline-flex; }
.v2-onb__back::after { content: ""; position: absolute; inset: calc((1.6em - max(var(--hit), 1.6em)) / 2) 0; }
/* 试用账本的「填入示例」放在标题右边 */
.v2-onb__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.v2-onb__head > .v2-btn { flex: none; margin-right: -8px; }
.v2-onb__title { font-size: var(--t-title); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; outline: 0; text-wrap: balance; }
.v2-onb__lead { margin-top: 12px; font-size: var(--t-lg); line-height: var(--lh-text); color: var(--text-2); text-wrap: pretty; }
.v2-onb__note { margin-top: 16px; font-size: var(--t-sm); line-height: var(--lh-text); color: var(--text-3); text-wrap: pretty; }
.v2-onb__error { margin-top: 16px; font-size: var(--t-sm); color: var(--danger); }
.v2-onb__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px; }
/* 每一屏的主按钮是这一屏要做的事：比表单里的按钮大，电脑上也要一眼看到 */
.v2-onb__actions .v2-btn:not(.v2-btn--text) { height: 48px; padding: 0 24px; font-size: var(--t-lg, 16px); }
@media (min-width: 700px) { .v2-onb__actions .v2-btn--primary { min-width: 240px; } }

/* 账本组成示意：几行账户合成一行，不放数字 */
.v2-onb-demo { list-style: none; margin: 24px 0 0; padding: 4px var(--card-pad); background: var(--surface); border-radius: var(--r-card); }
.v2-onb-demo__row, .v2-onb-demo__sum { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: var(--t-md); }
.v2-onb-demo__row + .v2-onb-demo__row { border-top: 1px solid var(--line); }
.v2-onb-demo__name { font-weight: 500; white-space: nowrap; }
.v2-onb-demo__what { color: var(--text-3); text-align: right; text-wrap: balance; }
.v2-onb-demo__sum { border-top: 1px solid var(--line-strong); font-weight: 600; }
/* 右边是一句话的列表（第一屏的四步、最后一屏的「之后怎么用」）：窄屏上放不下一行时上下排，左对齐，不让两三行字靠右 */
@media (max-width: 699px) {
  .v2-onb-demo.is-stack .v2-onb-demo__row { flex-direction: column; gap: 2px; }
  .v2-onb-demo.is-stack .v2-onb-demo__what { text-align: left; text-wrap: pretty; }
}
.v2-onb-demo__sum span:last-child { text-align: right; }

/* 单选卡片。is-row 是点了就走或选一个的长条 */
.v2-onb-choices { display: grid; gap: 12px; margin-top: 24px; }
.v2-onb-choices.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v2-onb-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; padding: 16px var(--card-pad);
  border: 0; border-radius: var(--r-card); background: var(--surface);
  box-shadow: inset 0 0 0 1px transparent;
  text-align: left; cursor: pointer; color: inherit;
  transition: box-shadow var(--motion) var(--ease), background var(--motion) var(--ease);
}
.v2-onb-choice:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.v2-onb-choice.is-on { box-shadow: inset 0 0 0 2px var(--accent); }
.v2-onb-choice.is-on:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.v2-onb-choice:focus-visible, .v2-onb-choice:has(.v2-onb-choice__radio:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 涨跌颜色的两张卡是原生 radio：方向键能切，整张卡能点 */
label.v2-onb-choice { position: relative; }
.v2-onb-choice__radio { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
/* 点了就走的一行：文字在左，箭头在右 */
.v2-onb-choice.is-go { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.v2-onb-choice.is-go > svg { flex: none; color: var(--text-3); }
.v2-onb-choice__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v2-onb-choice__title { display: flex; align-items: center; gap: 8px; font-size: var(--t-lg); font-weight: 500; }
.v2-onb-choice__sub { font-size: var(--t-sm); line-height: var(--lh-text); color: var(--text-3); text-wrap: pretty; }
/* 色块用固定的绿红，不随当前涨跌设置翻转，让用户直接看到效果 */
.v2-onb-sample { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 4px; font-size: var(--t-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.v2-onb-sample .is-green { color: #1d7f46; }
.v2-onb-sample .is-red { color: #cf2b3f; }

/* 账户与持仓表单 */
.v2-onb-sec { margin-top: 24px; }
.v2-onb-sec__title + .v2-onb-choices { margin-top: 0; }
/* 目标日期基金选中后就地问的两个数：紧跟在几档下面，和选项同一种底 */
.v2-onb-sec.v2-onb-tdf { margin-top: 12px; padding: 16px var(--card-pad); background: var(--surface); border-radius: var(--r-card); }
.v2-onb-sec__title { font-size: var(--t-section); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -0.01em; margin-bottom: var(--gap-title); }
.v2-onb-sec__fields { display: grid; gap: 16px; padding: var(--card-pad); background: var(--surface); border-radius: var(--r-card); container-type: inline-size; }
.v2-onb-items { display: grid; background: var(--surface); border-radius: var(--r-card); }
.v2-onb-item { padding: var(--card-pad); container-type: inline-size; }
.v2-onb-item + .v2-onb-item { border-top: 1px solid var(--line); }
.v2-onb-item__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; margin-bottom: 8px; }
.v2-onb-item__kind { font-size: var(--t-md); font-weight: 500; color: var(--text-2); }
/* 字段按行排（onboarding.js 的 fieldRows），每行填满，不留空格子 */
.v2-onb-item__fields { display: grid; gap: 12px; }
.v2-onb-row { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; align-items: start; }
.v2-onb-row[data-n="2"] { --n: 2; }
.v2-onb-row[data-n="1"] { --n: 3; }
.v2-onb-hint { margin: -4px 0 12px; font-size: var(--t-sm); line-height: var(--lh-text); color: var(--text-3); text-wrap: pretty; }
.v2-onb-item__readout { font-size: var(--t-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
.v2-onb-item__status { margin-top: 8px; font-size: var(--t-sm); color: var(--text-3); }
.v2-onb-item__status.is-error { color: var(--danger); }
.v2-onb-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.v2-onb-add { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; margin-left: -8px; }
.v2-onb-inline {
  position: relative; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--accent);
}
.v2-onb-inline::after { content: ""; position: absolute; inset: calc((1.6em - max(var(--hit), 1.6em)) / 2) 0; }
.v2-onb-inline:hover { text-decoration: underline; text-underline-offset: 2px; }
.v2-onb-buy { grid-column: 1 / -1; }
.v2-onb-buy .v2-field__hint { margin-top: 2px; }
.v2-onb-more { display: block; margin-top: 16px; font-size: var(--t-sm); }
.v2-onb-sum { margin-top: 12px; font-size: var(--t-sm); color: var(--text-3); }
.v2-onb-habits { margin-top: 32px; }
.v2-onb-demo__n { display: inline-block; width: 1.4em; color: var(--text-3); font-weight: 400; }
.v2-onb-demo__row.is-off .v2-onb-demo__name { color: var(--text-3); padding-left: 18px; }
.v2-onb-demo__name { display: inline-flex; align-items: center; gap: 4px; }
/* 已加的账户 */
.v2-onb-accts { list-style: none; margin: 24px 0 0; padding: 4px var(--card-pad); background: var(--surface); border-radius: var(--r-card); }
.v2-onb-acct { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: var(--t-md); }
.v2-onb-acct + .v2-onb-acct { border-top: 1px solid var(--line); }
.v2-onb-acct__name { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.v2-onb-acct__sub { margin-left: 8px; font-size: var(--t-sm); font-weight: 400; color: var(--text-3); }
.v2-onb-acct .v2-btn--text { color: var(--text-3); }
.v2-onb-acct .v2-btn--text:hover { color: var(--danger); }
/* 删除：电脑上行尾直接写「删除」；手机上收进「⋯」（6.1「一行的更多操作」：破坏性的操作不常驻在每一行） */
.v2-onb-acct__del, .v2-onb-acct__more { display: contents; }
.v2-onb-acct__more { display: none; }
@media (max-width: 699px) {
  .v2-onb-acct__del { display: none; }
  .v2-onb-acct__more { display: contents; }
  .v2-onb-acct .v2-iconbtn { margin-right: -6px; }
}
.v2-onb-acct.is-sum { border-top: 1px solid var(--line-strong); font-weight: 600; }
.v2-onb-acct.is-sum .v2-onb-acct__name { font-weight: 600; }
/* 手机：一栏一行（开发指南 6.1「表单」）。分类和市场是两个下拉、币种和余额读法不同，并排时选项文字被截断。
   只有本来就成对读的短数字并排：出生年份和打算几岁退休 */
@container (max-width: 560px) {
  .v2-onb-row { grid-template-columns: minmax(0, 1fr); }
  .v2-onb-tdf .v2-onb-row[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 260px) {
  .v2-onb-row { grid-template-columns: minmax(0, 1fr); }
}

/* 总览顶部的「继续建账」 */
.v2-onb-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  margin-bottom: var(--gap-section); padding: 12px var(--card-pad);
  background: var(--surface); border-radius: var(--r-card);
}
.v2-onb-strip__text { flex: 1 1 320px; min-width: 0; font-size: var(--t-sm); line-height: var(--lh-text); color: var(--text-2); text-wrap: pretty; }
.v2-onb-strip__text strong { font-weight: 600; color: var(--text-1); }
.v2-onb-strip__actions { display: flex; align-items: center; gap: 8px; }

@media (max-width: 699px) {
  .v2-onb__main { margin-top: 16px; }
  body[data-v2-focus] .v2-flow__head > .v2-backlink { margin-top: 16px; }
  .v2-onb__actions .v2-btn--primary { flex: 1 1 auto; }

  /* 屏幕本身就是容器（开发指南 6.1「页面的容器」）：只包着一张表单的白卡去掉（账户名称那一组、目标日期基金的两个数）。
     每一项持仓（.v2-onb-items）能单独删掉，是可以整块关掉的一段，留着 */
  .v2-onb-sec__fields, .v2-onb-sec.v2-onb-tdf { padding: 0; background: none; border-radius: 0; }

  /* 几个并列的选项（添加方式、目标比例的几档、对比指数）是一组并列的行：合成一张卡、行间细线，
     不是每个选项一张卡（每张卡之间的空隙和圆角让一屏只放得下三四个选项）。选中的一行蓝底蓝字。
     涨跌颜色的两块（is-two）是两张样张，并排对比，不在此列 */
  .v2-onb-choices:not(.is-two) { gap: 0; background: var(--surface); border-radius: var(--r-card); overflow: hidden; }
  .v2-onb-choices:not(.is-two) > .v2-onb-choice { position: relative; border-radius: 0; background: none; box-shadow: none; }
  .v2-onb-choices:not(.is-two) > .v2-onb-choice + .v2-onb-choice::before { content: ""; position: absolute; top: 0; left: var(--card-pad); right: 0; border-top: 0.5px solid var(--line); }
  .v2-onb-choices:not(.is-two) > .v2-onb-choice:hover { box-shadow: none; background: var(--fill-1); }
  .v2-onb-choices:not(.is-two) > .v2-onb-choice.is-on, .v2-onb-choices:not(.is-two) > .v2-onb-choice.is-on:hover { box-shadow: none; background: var(--accent-lt); }
  .v2-onb-choices:not(.is-two) > .v2-onb-choice.is-on .v2-onb-choice__title { color: var(--accent); }
  .v2-onb-choices:not(.is-two) > .v2-onb-choice:focus-visible { outline-offset: -2px; }
}

/* 开始记账第一屏：要做什么、要准备什么各一段 */
.v2-onb__main > .v2-onb-sec__title { margin-top: 24px; margin-bottom: 8px; }
.v2-onb__main > .v2-onb-sec__title + .v2-onb-demo { margin-top: 0; }
.v2-onb__main > .v2-onb-sec__title + .v2-onb__note { margin-top: 0; }
