/* overview 页面样式。类名用 v2-overview- 前缀，只放本页特有的规则。 */

/* ── 版面 ────────────────────────────────────────────────────────────
 * 宽 ≥ 900：两栏（约 2:1），左栏总资产、要做的事、走势、账户，右栏退休、今年。两栏各按内容高度，不互相撑开；
 * 600–899：主列之下右栏内容两列；更窄单列。
 * 手机顺序：总资产、要做的事、走势、账户，再是退休和今年。两栏的盒子在手机上拆开（display: contents），靠 order 排。
 * 没有「最近一天涨跌」：长线的人打开总览不需要每日排行，持仓页有「最近一天」一列和排序。 */

.v2-overview { container: v2-overview / inline-size; }
.v2-overview__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-section); align-items: start; }
.v2-overview__main, .v2-overview__side { display: contents; min-width: 0; }
.v2-overview__main > *, .v2-overview__side > * { min-width: 0; }
.v2-overview-hero { order: 1; }
.v2-overview__main > [data-key="next-steps"] { order: 2; }
.v2-overview__main > [data-key="todo"] { order: 2; }
/* 手机上一条线读下来：总资产、要做的事、收益、走势、资产类别、退休 */
.v2-overview-year { order: 3; }
.v2-overview-trend { order: 4; }
.v2-overview-alloc { order: 5; }
.v2-overview-retire { order: 6; }
.v2-overview .v2-section + .v2-section { margin-top: 0; }

@container v2-overview (min-width: 600px) {
  .v2-overview__main { display: flex; flex-direction: column; gap: var(--gap-section); }
  .v2-overview__side { display: grid; gap: var(--gap-section); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@container v2-overview (min-width: 900px) {
  .v2-overview__grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .v2-overview__side { display: flex; flex-direction: column; gap: var(--gap-section); align-items: stretch; }
  /* 右栏没有内容时单栏，主栏宽度和两栏时的主栏差不多，不铺满整屏（J18） */
  .v2-overview__grid.is-single { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .v2-overview__grid.is-single > .v2-overview__side { display: none; }
}

.v2-overview-rows { display: flex; flex-direction: column; gap: 12px; }

/* 标题行的短链接（「查看」「复盘」）手指点击区不足 44 宽，向两侧补足 */
.v2-overview .v2-section-tools .v2-link::after { left: -12px; right: -12px; }

/* ── 主数字 ──────────────────────────────────────────────────────── */

.v2-overview-hero__value { margin-top: 2px; }
.v2-overview-hero__note { font-size: var(--t-xs); color: var(--text-3); margin-top: 4px; }
.v2-overview-uncounted { margin-top: 8px; font-size: var(--t-sm); color: var(--text-2); text-wrap: pretty; }
.v2-overview-uncounted .v2-link { display: inline-flex; margin-left: 6px; vertical-align: baseline; }
.v2-overview-uncounted .v2-link::after { top: calc(50% - var(--hit) / 2); bottom: calc(50% - var(--hit) / 2); }

/* 最近一天：打开最想看的数，紧跟总资产，不小不灰 */
.v2-overview-hero__day {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px;
  margin-top: 8px; font-size: var(--t-lg); font-weight: 600; line-height: 1.4;
}
.v2-overview-hero__daylabel { font-weight: 400; color: var(--text-2); }

.v2-overview-hero__daywhy { margin-left: 6px; font-size: var(--t-sm); font-weight: 400; color: var(--text-3); }
/* 能点开看构成时整行是按钮：样子不变，尾巴一个箭头 */
.v2-overview-hero__day.is-button {
  position: relative; border: 0; padding: 0; background: none; color: inherit;
  font-family: inherit; text-align: left; cursor: pointer;
}
.v2-overview-hero__day.is-button::after { content: ""; position: absolute; inset: calc((1.4em - max(var(--hit), 1.4em)) / 2) -4px; }
.v2-overview-hero__day.is-button > .v2-icon { align-self: center; color: var(--text-3); }
@media (hover: hover) { .v2-overview-hero__day.is-button:hover .v2-overview-hero__daylabel { color: var(--text-1); } }

/* 最近一天的构成：可以收起的一段，手机上也留卡片（开发指南 6.1「页面的容器」） */
.v2-overview-dayparts {
  max-width: 640px; margin-top: 8px; padding: 12px var(--card-pad);
  background: var(--surface); border-radius: var(--r-card);
}
.v2-overview-dayparts__groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 24px; }
.v2-overview-dayparts .v2-card__label { margin-bottom: 0; font-size: var(--t-sm); }
.v2-overview-dayparts .v2-kv__row { min-height: 36px; padding: 4px 0; }
/* 名字一行，太长截断（全名在持仓详情里）；金额和百分比不折行 */
.v2-overview-dayparts .v2-kv__k { display: block; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-overview-dayparts .v2-kv__v { display: flex; flex: none; align-items: baseline; gap: 8px; white-space: nowrap; overflow-wrap: normal; }
.v2-overview-dayparts .v2-kv__sub { display: inline; font-size: var(--t-xs); }
.v2-overview-dayparts__more { margin-top: 8px; font-size: var(--t-sm); }
.v2-overview-dayparts__when { margin: 0 0 8px; }
@container v2-overview (min-width: 600px) {
  .v2-overview-dayparts__groups { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.v2-overview-hero__change {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; row-gap: 2px;
  margin-top: 4px; font-size: var(--t-md); line-height: 1.5;
}
/* 「比上次打开（11月19日）」加一个「?」，不是按钮（J11 去掉了今年、全部的切换） */
.v2-overview-hero__mode { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--text-2); white-space: nowrap; }
.v2-overview-hero__delta { font-weight: 600; }
.v2-overview-hero__split { color: var(--text-2); }


/* ── 要做的事：两级。收起时一行（图标、标题、主按钮），点这一行展开说明和「稍后提醒」 ──
 * 总览每天看一眼，第一屏要同时看到总资产、几条待办和收益卡的开头；说明是想知道「为什么、怎么办」时才读的，收在里面。
 * 电脑和手机同一个结构：左边整块是展开按钮，右边主按钮单独可点，两者不重叠。 */

.v2-overview-todo {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
}
.v2-overview-todo + .v2-overview-todo::before {
  content: ""; position: absolute; top: 0; left: calc(var(--card-pad) + 44px); right: 0;
  border-top: 0.5px solid var(--line);
}
.v2-overview-todo__head {
  position: relative;
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 56px;
  padding: 10px 4px 10px var(--card-pad);
  border: 0; background: none; color: inherit; font: inherit; text-align: left;
}
button.v2-overview-todo__head { cursor: pointer; }
/* 展开箭头在标题右侧、主按钮左边，各行对齐成一列；灰色，不和主按钮抢 */
.v2-overview-todo__head > .v2-icon:last-child { flex: none; color: var(--text-3); }
/* 只给能悬停的指针：手机上点过之后 :hover 留在手指下面，一行被拿掉后下一行移上来，会一直显示成按下的样子 */
@media (hover: hover) {
  button.v2-overview-todo__head:hover .v2-overview-todo__title { color: var(--accent); }
  button.v2-overview-todo__head:hover > .v2-icon:last-child { color: var(--text-1); }
}
/* 小图标：淡色圆底（Apple 列表的做法），一种事一种颜色（--todo-*），不用涨跌的绿和红。图标比底色深一点，保证 3:1 */
.v2-overview-todo__icon {
  --c: var(--accent);
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 13%, transparent);
  color: color-mix(in srgb, var(--c) 82%, #000);
}
.v2-overview-todo__icon--close { --c: var(--todo-close); }
.v2-overview-todo__icon--reconcile { --c: var(--todo-reconcile); }
.v2-overview-todo__icon--rsu { --c: var(--todo-rsu); }
.v2-overview-todo__icon--dividend { --c: var(--todo-dividend); }
.v2-overview-todo__icon--valuation { --c: var(--todo-valuation); }
.v2-overview-todo__icon--allocation { --c: var(--todo-allocation); }
/* 标题最多两行：长账户名、长资产名截断，全名在点开后的说明和落点页里 */
.v2-overview-todo__title {
  flex: 1 1 auto; min-width: 0;
  font-size: var(--t-md); font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; text-wrap: pretty;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.v2-overview-todo__go { display: flex; align-items: center; padding: 0 var(--card-pad) 0 8px; }
/* 主按钮同宽（四个字的宽度），各行的展开箭头和按钮上下对齐；字更多的按钮照样撑开 */
.v2-overview-todo__go .v2-btn { min-width: 6em; }
/* 展开的说明和标题左边对齐（图标 32 + 间距 12） */
.v2-overview-todo__more { grid-column: 1 / -1; padding: 0 var(--card-pad) 12px calc(var(--card-pad) + 44px); margin-top: -4px; }
.v2-overview-todo__body { font-size: var(--t-sm); color: var(--text-2); line-height: 1.55; text-wrap: pretty; }
/* 文字按钮自带左右 8 像素内边距，往左挪回去，字和说明的左边对齐 */
.v2-overview-todo__later { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0 -8px; }

.v2-overview-clear {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--t-sm); color: var(--text-2); line-height: 1.5;
}
.v2-overview-clear .v2-icon { color: var(--ok); }
.v2-overview-clear__link { position: relative; color: inherit; text-decoration: none; }
.v2-overview-clear__link::after { content: ""; position: absolute; inset: calc((1.5em - max(var(--hit), 1.5em)) / 2) 0; }
.v2-overview-clear__link:hover { color: var(--text-1); text-decoration: underline; }

.v2-overview-sheetnote { margin-top: 12px; }
.v2-overview-sheetintro { margin-bottom: 8px; }
.v2-overview-gap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 0; border-top: 0.5px solid var(--line); }
.v2-overview-gap__main { min-width: 0; }
.v2-overview-gap__name { font-size: var(--t-md); font-weight: 500; line-height: 1.4; }
.v2-overview-gap__why { font-size: var(--t-xs); color: var(--text-3); line-height: 1.5; margin-top: 2px; }

/* ── 资产走势 ────────────────────────────────────────────────────── */

.v2-overview-trend > .v2-card { display: flex; flex-direction: column; min-width: 0; }
.v2-overview-trend .v2-how { margin-top: 8px; }
.v2-overview-trend__line { text-wrap: pretty; }
.v2-overview-trend .v2-ph--chart { flex: 1 1 auto; }
.v2-overview-trend__plot { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
/* contain:size 让画布不撑高容器，图表高度只由版面决定，右栏更长时跟着变高 */
.v2-overview-trend__chart { flex: 1 1 auto; min-height: 360px; contain: size; }
@media (max-width: 699px) { .v2-overview-trend__chart { min-height: 230px; } }

/* ── 退休测算 ────────────────────────────────────────────────────── */

.v2-overview-retire__line { margin-top: 4px; font-size: var(--t-sm); color: var(--text-2); }
.v2-overview-retire__when { margin-top: 8px; }

/* ── 今年 ────────────────────────────────────────────────────────── */

/* 今年一组指标格，下面一行记账以来的年化：不同期间的数用细线分开 */
.v2-overview-year__group .v2-card__label { margin-bottom: 8px; font-size: var(--t-sm); font-weight: 600; color: var(--text-1); }
.v2-overview-year__note { margin-top: 10px; }
.v2-overview-year__longrun {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 0.5px solid var(--line);
  font-size: var(--t-sm); color: var(--text-2);
}
.v2-overview-year__longrun > .v2-num { flex: none; font-size: var(--t-md); font-weight: 600; }
