:root {
  --canvas: #f4f5f2;
  --surface: #ffffff;
  --surface-soft: #f8f8f5;
  --ink: #1f2421;
  --muted: #68706a;
  --line: #dfe3dd;
  --line-strong: #cdd3cc;
  --red: #c9443d;
  --green: #177b61;
  --amber: #a76413;
  --magenta: #a44270;
  --blue: #23628b;
  --shadow: 0 12px 32px rgba(24, 33, 28, 0.06);
  /* 内容区宽度: 上限 2400px, 两侧按视口留 3vw 呼吸。
     原先固定 min(1600px, 100%-40px) —— 在 1920/2560 屏上左右各空 160/480px。
     现在 1920 屏可用 ~1862px, 2560 屏达上限 2400px, 仍保留适度留白。 */
  --shell-max: 2400px;
  --shell-gutter: 3vw;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button { font: inherit; letter-spacing: 0; }
/* ── 模块折叠 / 展开（用户 2026-09-19 要求，配合 lib/accordion.js）── */
.acc-mod { position: relative; }
.acc-mod.is-collapsed { padding-bottom: 8px; }
.acc-mod.is-collapsed::after {
  content: "（已折叠 · 点右上角 ▸ 展开）";
  display: block; margin: 2px 0 0; font-size: 11.5px; color: var(--muted);
}
.acc-toggle {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 26px; height: 22px; padding: 0; line-height: 1;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--muted);
  cursor: pointer; font-size: 12px; opacity: .65;
}
.acc-toggle:hover { opacity: 1; color: var(--ink); border-color: var(--ink); }
/* 二级子模块的按钮：更小更淡，避免和卡片右上角的大按钮抢位置 */
.acc-toggle-sub {
  width: 20px; height: 18px; font-size: 10px;
  top: 2px; right: 4px; opacity: .40;
}
.acc-toggle-sub:hover { opacity: 1; }
.acc-sub.is-collapsed { padding-bottom: 4px; }
.acc-sub.is-collapsed::after { content: "（已折叠 · 点 ▸ 展开）"; font-size: 11px; }
.acc-title-collapsed { margin-bottom: 0 !important; }

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(var(--shell-max), calc(100% - var(--shell-gutter)));
  min-height: 68px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 24px;
}

.identity { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #252b27;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-copy { display: grid; gap: 1px; }
.brand-name { font-size: 17px; }
.brand-subtitle { color: var(--muted); font-size: 11px; }
.tabs { display: flex; align-self: stretch; }
.tab {
  min-width: 94px;
  padding: 0 17px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: var(--surface-soft); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--red); font-weight: 700; }
.refresh-button, .retry-button {
  justify-self: end;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
.refresh-button:hover, .retry-button:hover { border-color: #8e9890; }

.content-shell { width: min(var(--shell-max), calc(100% - var(--shell-gutter))); margin: 18px auto 40px; }
.source-banner {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  background: var(--surface);
  font-size: 13px;
}
.source-banner.is-demo { border-left-color: var(--amber); }
.source-banner.is-live { border-left-color: var(--green); }
.source-label { white-space: nowrap; }
.source-message { color: var(--muted); }

.summary-strip {
  min-height: 142px;
  margin: 12px 0 18px;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(180px, .65fr) minmax(360px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 22px 28px;
  border: 1px solid var(--line-strong);
  border-top: 3px solid #303731;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.summary-lead { min-width: 0; }
.summary-kicker, .metric-label { color: var(--muted); font-size: 12px; }
.leader-name { margin: 5px 0 3px; font-size: 29px; line-height: 1.15; letter-spacing: 0; }
.leader-note { margin: 0; color: var(--muted); font-size: 13px; }
.signal-clock { display: grid; justify-items: center; gap: 3px; }
.clock-value { font-size: 30px; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); font-size: 12px; }
.summary-metrics { display: grid; grid-template-columns: repeat(4, minmax(68px, 1fr)); }
.summary-metric { min-height: 58px; display: grid; align-content: center; gap: 5px; padding: 0 14px; border-left: 1px solid var(--line); }
.metric-value { font-size: 23px; font-variant-numeric: tabular-nums; }
.summary-metric.is-score .metric-value { color: var(--red); }

.view-stack { display: grid; gap: 14px; }
.candidate-section, .technical-view, .review-view { border: 1px solid var(--line); background: var(--surface); }
.candidate-section { border-top: 3px solid var(--green); }
.candidate-section.tone-amber { border-top-color: var(--amber); }
.candidate-section.tone-magenta { border-top-color: var(--magenta); }
.section-heading, .view-heading {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.section-title, .view-title { margin: 0; font-size: 16px; letter-spacing: 0; }
/* 标题+计数 左侧成组；配合 .view-heading 的 space-between，
   使「范围筛选 / 情绪chip」等控件稳定贴在**最右边**（否则3个子元素会均匀分布） */
.heading-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.view-heading .filter-field, .view-heading .mood-stage-chip { flex: 0 0 auto; }
.section-description { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--muted);
  background: #eef0ed;
  font-size: 12px;
  white-space: nowrap;
}
.badge-primary { color: #9f2f2a; background: #f9e6e3; }
.badge-board { color: #fff; background: var(--red); }
.badge-concept { margin: 2px 4px 2px 0; color: #185b78; background: #e4f0f5; }
.count-badge { color: var(--ink); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; }
/* 表头固定 + 数据区内部滚动（全站所有 .table-scroll 通用）
   原来只有 overflow-x:auto：按规范另一轴会算成 auto，但容器高度不受限 ⇒ 纵向滚动条其实在整页，
   而 thead 的 sticky 滚动祖先正是这个 div（它自己纵向不滚）→ 表头跟着页面一起滚走。
   给它 max-height 之后：容器自己纵向滚动，thead 钉在容器顶部，数据在下面滚。
   max-height 兜住顶栏(sticky)+视图标题+筛选条，无需页面上下滚动即可看全表格。 */
.table-scroll {
  width: 100%;
  /* 2026-09-19 用户要求「去掉内嵌滚动条」：
     原来是 overflow:auto + max-height:calc(100vh-148px)，让**每个表格自成一个滚动容器**，
     于是页面上出现多条滚动条 ✗。现在放开高度/溢出 → 全页只有一组滚动条 ✓
     代价：thead 的 sticky 不再被这个 div 限制，改为相对**视口**（见下条，top 用 --hdr-h）。 */
  max-height: none;
  overflow: visible;
}
.table-scroll > .data-table > thead > tr > th {
  position: sticky;
  /* 钉在吸顶的 .app-header 下方（--hdr-h 由 accordion.js 实测写入 html 上） */
  top: var(--hdr-h, 0px);
  z-index: 4;              /* 要高于「右侧吸附列」(z-index:2)，否则表头会被数据行盖住 */
  background: var(--surface);
}
/* zt/未封表最后一列同时右吸顶吸 → 交角处要再高一档 */
.zt-table.reason-sticky > thead > tr > th:last-child { z-index: 6; }
.data-table { width: 100%; min-width: 1180px; border-collapse: collapse; table-layout: auto; }
.data-table th {
  height: 38px;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
}
.data-table td { min-height: 66px; padding: 13px 10px; border-bottom: 1px solid #eceeeb; vertical-align: middle; font-size: 12px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafbf9; }
/* 列宽交给内容自适应(table-layout:auto)。原脚手架的 9 条 nth-child 固定列宽已移除——
   它们是给已下线的旧看板(9列：#/标的/判定/强度/高开/竞价/角色/板型/概念/依据)用的，
   套到现在的 9~18 列表格上会把"日期"压成42px、又把未定义列平分剩余空间导致右侧过宽。 */
.legacy-dashboard-table th:nth-child(1), .legacy-dashboard-table td:nth-child(1) { width: 42px; }
.stock-cell { display: grid; gap: 4px; }
.stock-name { color: #26332b; font-size: 13px; }
.stock-code { margin-left: 6px; color: #929a94; font-size: 11px; font-variant-numeric: tabular-nums; }
.stock-cell .stock-code { margin-left: 0; }
.rank-cell, .numeric, .num { font-variant-numeric: tabular-nums; }

/* ── 单元格间距统一（2026-09-19）──────────────────────────────
   问题: 各 Tab 的横向 padding 不一致(基础10px / 打板生态4px / 清仓走势6px / 席位8px),
        且列宽随内容伸缩 → 视觉上"有的空隔大有的小"。
   做法: ① 全站横向 padding 统一为 8px(各表只保留自己的纵向节奏)
        ② 数字列/居中列给统一 min-width —— 这样不管数值是 3 还是 3000, 占位一致。
   注: 数字列类名有 `.numeric`(57处) 与 `.num`(仅 cleared-view 2处, 原先无任何CSS) 两种。 */
.data-table th, .data-table td { padding-left: 8px; padding-right: 8px; }
.data-table th.numeric, .data-table td.numeric,
.data-table th.num, .data-table td.num { min-width: 66px; }
.data-table th.center, .data-table td.center { min-width: 54px; }
.strength { color: var(--amber); font-weight: 800; font-size: 15px !important; }
.positive { color: var(--red); font-weight: 700; }
.negative { color: var(--green); font-weight: 700; }
.role-cell, .reason-cell { color: #505953; line-height: 1.55; }
.section-empty, .loading-state, .error-state { min-height: 150px; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); text-align: center; }
.loading-indicator { width: 25px; height: 25px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view-heading { min-height: 58px; }
.view-count { color: var(--muted); font-size: 12px; }
.signal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.signal-card { min-height: 190px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.signal-card:nth-child(3n) { border-right: 0; }
.signal-card-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.signal-score { color: var(--amber); font-size: 25px; }
.signal-facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 20px 0 14px; font-size: 12px; }
.signal-facts dt { color: var(--muted); }
.signal-facts dd { margin: 0; text-align: right; }
.signal-reason { margin: 0; color: #505953; font-size: 12px; line-height: 1.55; }
.review-table { min-width: 760px; }
.review-date { font-weight: 700; }

@media (max-width: 980px) {
  .header-inner { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; grid-row: 2; min-height: 45px; justify-content: center; order: 3; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-metrics { grid-column: 1 / -1; }
  .summary-metric:first-child { border-left: 0; }
  .signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signal-card:nth-child(3n) { border-right: 1px solid var(--line); }
  .signal-card:nth-child(2n) { border-right: 0; }
}

@media (max-width: 640px) {
  .header-inner, .content-shell { width: calc(100% - 24px); }
  .header-inner { gap: 8px; }
  .brand-subtitle { display: none; }
  .refresh-button { padding: 0 12px; }
  .tabs { overflow-x: auto; justify-content: start; }
  .tab { min-width: 33.333%; padding: 0 10px; }
  .content-shell { margin-top: 12px; }
  .source-banner { align-items: start; }
  .summary-strip { grid-template-columns: 1fr; padding: 20px; gap: 18px; }
  .leader-name { font-size: 25px; }
  .signal-clock { justify-items: start; }
  .summary-metrics { grid-column: auto; }
  .summary-metric { padding: 0 8px; }
  .summary-metric:first-child { border-left: 0; }
  .metric-value { font-size: 19px; }
  .signal-grid { grid-template-columns: 1fr; }
  .signal-card, .signal-card:nth-child(3n) { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-indicator { animation: none; }
}

/* ── 单弹窗表单（2026-09-19）───────────────────────────────
   用途: 持仓/清仓 的「添加」与「编辑」统一走这里 —— 所有字段同屏,
   点一次「保存」全部提交, 取代原先逐字段 window.prompt 的交互。 */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(20, 26, 22, .38);
  backdrop-filter: blur(2px);
}
.modal-box {
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 22, 18, .28);
  padding: 20px 22px 18px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-title { margin: 0; font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface-soft); color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--red); border-color: var(--red); }
.modal-desc { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.modal-form { margin-top: 14px; display: grid; gap: 12px; }
.modal-row { display: grid; gap: 5px; }
.modal-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.modal-required { color: var(--red); font-style: normal; font-weight: 700; }
.modal-input {
  width: 100%; min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px;
}
.modal-input:focus {
  outline: 0; border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}
.modal-input:read-only { background: var(--surface-soft); color: var(--muted); }
.modal-row { position: relative; }
.stock-search-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40;
  max-height: 260px; overflow-y: auto; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface-raised); box-shadow: var(--shadow);
}
.stock-search-list[hidden] { display: none; }
.stock-search-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 8px 10px; border: 0; border-radius: 4px;
  background: transparent; color: var(--ink); cursor: pointer; text-align: left; font-size: 12px;
}
.stock-search-option:hover { background: var(--hover); }
.stock-search-option b { font-weight: 700; }
.stock-search-option span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.stock-name:not(.is-editable) { cursor: pointer; }
.stock-name:not(.is-editable):hover {
  color: var(--blue); text-decoration: underline; text-underline-offset: 2px;
}
.value-editable { cursor: pointer; }
.value-editable:hover {
  color: var(--blue); text-decoration: underline; text-underline-offset: 2px;
  background: var(--hover);
}
.modal-hint { font-size: 11px; color: var(--muted); }
.modal-error {
  margin: 0; padding: 7px 10px; border-radius: 8px;
  background: #fdecea; color: #a33b35; font-size: 12px;
}
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-btn {
  min-height: 36px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.modal-btn:hover { border-color: #8e9890; }
.modal-primary { color: #fff; background: #26352e; border-color: #26352e; }
.modal-primary:hover { background: #1d2923; border-color: #1d2923; }

/* 可点击的股票名称(取代原「编辑」按钮) */
.stock-name.is-editable { cursor: pointer; }
.stock-name.is-editable:hover {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

