/* ============================================================
   我的股票（2026-10-31 主从布局）
   左侧股票列表（含迷你走势图） + 右侧详情面板
   涨红跌绿（A股习惯）
   ============================================================ */

/* ---------- 顶部汇总条 ---------- */
.stk-top{
  display:flex;align-items:center;gap:14px;flex-wrap:wrap;
  margin-bottom:12px;padding:12px 16px;
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius-md,12px);
}
.stk-sum{display:flex;align-items:center;gap:26px;flex-wrap:wrap}
.stk-sum-item{display:flex;flex-direction:column;gap:2px;line-height:1.2}
.stk-sum-item b{font-size:19px;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}
.stk-sum-item span{font-size:11px;color:var(--text-3)}
.stk-actions{margin-left:auto;display:flex;align-items:center;gap:10px}
.stk-time{font-size:11.5px;color:var(--text-3)}

/* ---------- 工具条 ---------- */
.stk-toolbar{margin-bottom:10px}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface)}
.seg-btn{
  border:none;background:transparent;cursor:pointer;
  padding:6px 15px;font-size:12.5px;color:var(--text-2);
  font-family:inherit;transition:background .14s,color .14s;
}
.seg-btn+.seg-btn{border-left:1px solid var(--line)}
.seg-btn:hover{background:var(--surface-2)}
.seg-btn.on{background:var(--brand);color:#fff;font-weight:600}

/* ---------- 主从布局 ---------- */
/* ⚠ 2026-10-31 用户要求：列表占 1/3，让出的 2/3 给右侧详情 */
/* ⚠ 2026-11-02：两列**等高且与页面齐平**（--stk-h 由 JS 按视口实测后内联） */
.stk-master{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,2fr);
  gap:12px;
  align-items:stretch;          /* 两列等高 */
  height:var(--stk-h,auto);
}

/* ---------- 左：列表 ---------- */
.stk-list-card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius-md,12px);overflow:hidden;
  display:flex;flex-direction:column;
  height:100%;min-height:0;
}
.stk-list-scroll{
  /* ⚠ 2026-11-02：改翻页，不再内部滚动 → 去掉 max-height / overflow-y */
  flex:1 1 auto;min-height:0;
  overflow:hidden;
}
.stk-li{
  display:grid;
  grid-template-columns:minmax(104px,1.7fr) 46px 58px 72px;
  align-items:center;gap:10px;
  padding:9px 14px;
  border-bottom:1px solid var(--line);
  cursor:pointer;transition:background .14s;
}
.stk-li:hover{background:var(--surface-2)}
.stk-li.on{background:var(--brand-soft);box-shadow:inset 3px 0 0 var(--brand)}

.sl-name{display:flex;align-items:center;gap:6px;min-width:0}
.sl-name b{
  font-size:13px;font-weight:600;color:var(--text);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  /* 名称优先占空间：市场标记和代码可压缩 */
  flex:0 1 auto;max-width:none;
}
.sl-mk{
  flex:0 0 auto;font-size:9px;font-weight:700;color:#fff;
  background:#E23A3A;padding:1px 3px;border-radius:3px;letter-spacing:.2px;
}
.sl-code{
  flex:0 1 auto;min-width:0;font-size:10.5px;color:var(--text-3);
  font-variant-numeric:tabular-nums;
  white-space:nowrap;overflow:hidden;
}
.sl-spark{display:flex;align-items:center;justify-content:center}
.sl-price{
  text-align:right;font-size:13.5px;font-weight:600;color:var(--text);
  font-variant-numeric:tabular-nums;
}
.sl-chg{
  text-align:center;font-size:12.5px;font-weight:700;
  padding:4px 0;border-radius:6px;
  /* ⚠ 必须 !important —— 全局 `.up{color:#E23A3A !important}` 会把白字覆盖成红字（红底红字看不见） */
  color:#fff !important;
  font-variant-numeric:tabular-nums;
}
.sl-chg.up{background:#E23A3A}
.sl-chg.down{background:#12A150}
.sl-chg.flat{background:#9AA4B2}

.stk-list-foot{
  padding:8px 14px;font-size:11.5px;color:var(--text-3);
  border-top:1px solid var(--line);background:var(--surface-2);
}

/* ---------- 迷你走势图 ---------- */
.stk-spark{display:block;overflow:visible}
.stk-spark .sp-line{fill:none;stroke-width:1.1;stroke-linejoin:round;stroke-linecap:round}
.stk-spark .sp-area{stroke:none;opacity:.14}
.stk-spark.up .sp-line{stroke:#E23A3A}
.stk-spark.up .sp-area{fill:#E23A3A}
.stk-spark.down .sp-line{stroke:#12A150}
.stk-spark.down .sp-area{fill:#12A150}
.stk-spark.flat .sp-line{stroke:#9AA4B2}
.stk-spark.flat .sp-area{fill:#9AA4B2}

/* ---------- 右：详情 ---------- */
/* ⚠ 2026-11-02：详情卡与左侧列表等高，内容超出时内部滚动 */
.stk-detail-card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius-md,12px);overflow:hidden;
  height:100%;min-height:0;
  overflow-y:auto;
}
.stk-detail-empty{
  padding:60px 20px;text-align:center;color:var(--text-3);font-size:13px;
}
.sd-head{
  display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;
  padding:14px 16px 0;
}
.sd-title{display:flex;align-items:baseline;gap:6px;min-width:0}
.sd-title b{font-size:17px;font-weight:700;color:var(--text)}
.sd-title span{font-size:12px;color:var(--text-3);font-variant-numeric:tabular-nums}
.sd-time{margin-left:auto;font-size:11px;color:var(--text-3)}

.sd-price{
  display:flex;align-items:baseline;gap:12px;
  padding:6px 16px 14px;
}
.sdp-num{font-size:34px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}
.sdp-chg{font-size:14px;font-weight:600;font-variant-numeric:tabular-nums}

/* 指标网格 */
/* ⚠ 2026-10-31 用户要求：指标一行 9 个 */
.sd-grid{
  display:grid;grid-template-columns:repeat(9,1fr);
  border-top:1px solid var(--line);
}
.sd-cell{
  display:flex;flex-direction:column;align-items:flex-start;gap:2px;
  padding:7px 10px;border-bottom:1px solid var(--line);min-width:0;
}
.sd-cell:not(:nth-child(9n)){border-right:1px solid var(--line)}
.sdc-l{font-size:11px;color:var(--text-3);white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;max-width:100%}
.sdc-v{font-size:12.5px;font-weight:600;color:var(--text);font-variant-numeric:tabular-nums;white-space:nowrap}

/* 分时图 */
.sd-chart{border-top:1px solid var(--line);padding:10px 10px 6px}
.sd-chart-h{font-size:12px;color:var(--text-3);margin-bottom:4px;padding-left:4px}
.stk-mini-chart{display:block;width:100%;height:auto}
.mc-grid{stroke:var(--line);stroke-width:1;stroke-dasharray:2 3}
.mc-lbl{fill:var(--text-3);font-size:9px;text-anchor:end}
.mc-line{fill:none;stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}
.mc-area{stroke:none;opacity:.12}
.mc-base{stroke:var(--text-3);stroke-width:1;stroke-dasharray:4 3;fill:none}
.stk-mini-chart.up .mc-line{stroke:#E23A3A}
.stk-mini-chart.up .mc-area{fill:#E23A3A}
.stk-mini-chart.down .mc-line{stroke:#12A150}
.stk-mini-chart.down .mc-area{fill:#12A150}
.stk-nodata{padding:40px 0;text-align:center;color:var(--text-3);font-size:12px}

/* 涨跌色（作用域限定在股票页，避免 !important 污染整页） */
.stk-top .up{color:#E23A3A !important}
.stk-top .down{color:#12A150 !important}
.sd-price .up,.sdp-num.up{color:#E23A3A !important}
.sd-price .down,.sdp-num.down{color:#12A150 !important}
/* ⚠ 原本是无作用域的全局规则（.flat{color:...!important}）→ 污染整页，收窄到股票页 */
.stk-master .flat,.stk-list-card .flat{color:var(--text-3) !important}
/* 详情大价格
   ⚠ .mkt-a / .up 在**同一个元素**上（class="sd-price mkt-a"）
   → 必须用 `.mkt-a .sdp-num` 这种「同元素 class + 子元素」写法，
     不能写 `.sd-price .mkt-a .sdp-num`（后代选择器匹配不到） */
.mkt-a .sdp-num,.mkt-a .sdp-chg{color:#E23A3A !important}
.mkt-a .sdp-num.down,.mkt-a .sdp-chg.down{color:#12A150 !important}
.mkt-hk .sdp-num,.mkt-hk .sdp-chg{color:#12A150 !important}
.mkt-hk .sdp-num.down,.mkt-hk .sdp-chg.down{color:#E23A3A !important}

.stk-foot{
  margin-top:10px;padding:8px 14px;font-size:11.5px;color:var(--text-3);
  border-top:1px solid var(--line);
}

@media(max-width:1100px){
  .stk-master{grid-template-columns:1fr}
  .stk-detail-card{position:static;max-height:none}
}
@media(max-width:900px){
  .stk-sum{gap:16px}
  .stk-actions{margin-left:0}
  .stk-list-scroll{max-height:none}
  .stk-li{grid-template-columns:minmax(90px,1.4fr) 54px 66px 76px;gap:7px;padding:9px 10px}
  .sl-spark{display:none}
}

/* ---------- 自选股分组 Tab ---------- */
.stk-groups{display:flex;gap:4px;flex-wrap:wrap;align-items:center}
.stk-grp{
  border:none;background:transparent;cursor:pointer;
  padding:6px 13px;border-radius:16px;
  font-size:13px;color:var(--text-2);font-family:inherit;
  transition:background .14s,color .14s;
}
.stk-grp:hover{background:var(--surface-2)}
.stk-grp.on{background:var(--brand);color:#fff;font-weight:600}
.stk-grp-c{
  margin-left:5px;font-size:10.5px;opacity:.7;
  font-variant-numeric:tabular-nums;
}

/* ---------- 列表卡片头部（标题 + 搜索框 + 排序框） ---------- */
.stk-list-head{
  display:flex;align-items:center;gap:10px;
  padding:9px 14px;border-bottom:1px solid var(--line);
  background:var(--surface-2);
}
.stk-list-t{font-size:12.5px;font-weight:600;color:var(--text-2);flex:0 0 auto}
.stk-sort{
  margin-left:auto;width:auto;min-width:118px;
  height:30px;padding:0 26px 0 10px;font-size:12px;flex:0 0 auto;
}

/* ---------- 搜索框（2026-11-02 新增） ---------- */
.stk-search{position:relative;flex:1 1 auto;min-width:0}
.stk-search-in{
  width:100%;height:30px;padding:0 10px;font-size:12px;
  background:var(--surface);
}
.stk-search-pop{
  display:none;
  position:absolute;left:0;right:0;top:calc(100% + 5px);
  z-index:30;
  background:var(--surface);border:1px solid var(--line);
  border-radius:10px;box-shadow:0 10px 28px rgba(16,24,40,.14);
  max-height:320px;overflow-y:auto;
}
.stk-search-pop.on{display:block}
.stk-sr{
  display:flex;align-items:center;gap:7px;
  padding:8px 11px;border-bottom:1px solid var(--line);
  font-size:12.5px;cursor:pointer;
}
.stk-sr:last-child{border-bottom:none}
.stk-sr:hover{background:var(--surface-2)}
.stk-sr.added{opacity:.6;cursor:default}
.stk-sr.added:hover{background:transparent}
.stk-sr-name{
  font-weight:600;color:var(--text);flex:0 1 auto;min-width:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
/* ⚠ 2026-11-02：搜索结果可点击 → 点名称直接在右侧看该股票 */
.stk-sr-name.pick{cursor:pointer}
.stk-sr-name.pick:hover{color:var(--brand);text-decoration:underline}
.stk-sr-mk{
  flex:0 0 auto;font-size:9px;font-weight:700;color:#fff;
  background:#E23A3A;padding:1px 3px;border-radius:3px;letter-spacing:.2px;
}
.stk-sr-code{
  flex:0 0 auto;font-size:10.5px;color:var(--text-3);
  font-variant-numeric:tabular-nums;
}
.stk-sr-add{
  margin-left:auto;flex:0 0 auto;font-size:11px;color:var(--text-3);
}
.stk-sr-add-btn{
  margin-left:auto;flex:0 0 auto;
  border:1px solid rgba(37,99,235,.35);background:var(--brand-soft);
  color:var(--brand);border-radius:7px;
  padding:3px 9px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;
  transition:background .14s,color .14s;
}
.stk-sr-add-btn:hover{background:var(--brand);color:#fff}
.stk-sr-add-btn:disabled{opacity:.6;cursor:default}
.stk-sr-empty{padding:14px 12px;font-size:12px;color:var(--text-3);text-align:center}

/* ---------- 分页条（复用邮件页 .mail-pager 样式） ---------- */
.stk-pager{background:var(--surface-2)}

/* ---------- 列表行时间（价格下方） ---------- */
.sl-price{
  text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:1px;
}
.sl-price b{font-size:13.5px;font-weight:600;color:var(--text);font-variant-numeric:tabular-nums}
.sl-time{font-size:10.5px;color:var(--text-3);font-variant-numeric:tabular-nums}

/* ---------- 图表周期 Tab ---------- */
.sd-chart-h{
  display:flex;align-items:center;gap:10px;
  margin-bottom:6px;padding-left:2px;
}
.sd-tabs{display:flex;gap:2px}
.sd-tab{
  border:none;background:transparent;cursor:pointer;
  padding:5px 12px;border-radius:6px;
  font-size:12.5px;color:var(--text-2);font-family:inherit;
  transition:background .14s,color .14s;
}
.sd-tab:hover{background:var(--surface-2)}
.sd-tab.on{background:var(--brand);color:#fff;font-weight:600}
.sd-chart-legend{margin-left:auto;font-size:11px;color:var(--text-3)}

/* ---------- K 线蜡烛 ---------- */
.stk-kline{display:block;width:100%;height:auto}
.kl-wick{stroke-width:1}
.kl-wick.up{stroke:#E23A3A}
.kl-wick.down{stroke:#12A150}
.kl-body.up{fill:#E23A3A}
.kl-body.down{fill:#12A150}
.mc-x{text-anchor:middle}

@media(max-width:1280px){
  .sd-grid{grid-template-columns:repeat(5,1fr)}
  .sd-cell:not(:nth-child(9n)){border-right:none}
  .sd-cell:nth-child(5n+1),.sd-cell:nth-child(5n+2),.sd-cell:nth-child(5n+3),.sd-cell:nth-child(5n+4){border-right:1px solid var(--line)}
}
@media(max-width:900px){
  .sd-grid{grid-template-columns:repeat(3,1fr)}
  .sd-cell{border-right:1px solid var(--line) !important}
  .sd-cell:nth-child(3n){border-right:none}
}

/* ---------- 十字光标 ---------- */
.ch-overlay{cursor:crosshair}
.ch-cross{pointer-events:none}
.ch-v{stroke:#8A94A6;stroke-width:1;stroke-dasharray:3 3}
.ch-h{stroke:#8A94A6;stroke-width:1;stroke-dasharray:3 3}
.ch-bg{fill:#2C3542;stroke:none}
.ch-tx{fill:#fff;font-size:10.5px;text-anchor:middle}
.ch-ty{fill:#fff;font-size:10.5px;text-anchor:end}
/* ⚠ 2026-11-05：十字光标右轴标签带涨跌幅 → 涨红跌绿（A股习惯） */
.ch-ty.up{fill:#E23A3A}
.ch-ty.down{fill:#12A150}

/* 右轴：相对开盘价的涨跌幅刻度 */
.mc-pct{text-anchor:start;font-size:9px;fill:var(--text-3)}
.mc-pct.up{fill:#E23A3A}
.mc-pct.down{fill:#12A150}
.mc-pct.flat{fill:var(--text-3)}
.mc-open{font-weight:600}
/* 时间/日期轴 */
.mc-axis{stroke:var(--line);stroke-width:1}
.mc-tick{stroke:var(--text-3);stroke-width:1;opacity:.55}

/* 指标数值按市场配色（覆盖上面删掉的固定色） */
.mkt-a .sdc-v.up{color:#E23A3A !important}
.mkt-a .sdc-v.down{color:#12A150 !important}
.mkt-hk .sdc-v.up{color:#12A150 !important}
.mkt-hk .sdc-v.down{color:#E23A3A !important}

/* ============================================================
   涨跌配色（按市场区分）—— 完整版
   A股（sh/sz）→ 涨红跌绿
   港股（hk）/ 美股（us）→ **涨绿跌红**（港美市场惯例）
   ⚠ 之前一律红涨，港股年K 红绿混画看着像「树枝」。
   ⚠ 这些规则要**放在文件末尾**并用 !important，
      否则会被前面的 `.stk-mini-chart.up .mc-line`（3 个 class）压过。
   ============================================================ */

/* ---- A股：涨红跌绿 ---- */
.mkt-a .sl-chg.up{background:#E23A3A !important}
.mkt-a .sl-chg.down{background:#12A150 !important}
.mkt-a .stk-spark.up .sp-line{stroke:#E23A3A !important}
.mkt-a .stk-spark.up .sp-area{fill:#E23A3A !important}
.mkt-a .stk-spark.down .sp-line{stroke:#12A150 !important}
.mkt-a .stk-spark.down .sp-area{fill:#12A150 !important}
.mkt-a .mc-line{stroke:#E23A3A !important}
.mkt-a .mc-area{fill:#E23A3A !important}
.mkt-a .kl-body.up{fill:#E23A3A !important}
.mkt-a .kl-body.down{fill:#12A150 !important}
.mkt-a .kl-wick.up{stroke:#E23A3A !important}
.mkt-a .kl-wick.down{stroke:#12A150 !important}

/* ---- 港股 / 美股：涨绿跌红 ---- */
.mkt-hk .sl-chg.up{background:#12A150 !important}
.mkt-hk .sl-chg.down{background:#E23A3A !important}
.mkt-hk .stk-spark.up .sp-line{stroke:#12A150 !important}
.mkt-hk .stk-spark.up .sp-area{fill:#12A150 !important}
.mkt-hk .stk-spark.down .sp-line{stroke:#E23A3A !important}
.mkt-hk .stk-spark.down .sp-area{fill:#E23A3A !important}
.mkt-hk .mc-line{stroke:#12A150 !important}
.mkt-hk .mc-area{fill:#12A150 !important}
.mkt-hk .kl-body.up{fill:#12A150 !important}
.mkt-hk .kl-body.down{fill:#E23A3A !important}
.mkt-hk .kl-wick.up{stroke:#12A150 !important}
.mkt-hk .kl-wick.down{stroke:#E23A3A !important}
