/* ════════════════════════════════════════════════════════════════
   关键点识别 — CSS v10 · "Reading-grade" Claude.ai aesthetic
   暖纸背景 · 衬线大标题 · 克制留白 · 赭石/clay 点缀 · 极简描边
   ════════════════════════════════════════════════════════════════ */

:root {
  /* ── 暖色纸面体系 ── */
  --bg:           #faf9f5;   /* 主背景：暖纸白 */
  --bg-sunken:    #f4f2ea;   /* 下沉面：侧栏 */
  --surface:      #ffffff;   /* 卡片 */
  --surface-warm: #fdfcf8;   /* 略暖卡片 */
  --surface-hover:#f6f4ee;

  /* ── 墨色文字（暖中性） ── */
  --ink:    #1f1e1d;
  --ink-2:  #56544d;
  --ink-3:  #84817a;
  --ink-4:  #adaaa0;   /* placeholder / 极弱 */

  /* ── 描边 ── */
  --border:      rgba(31,30,29,0.11);
  --border-soft: rgba(31,30,29,0.06);
  --border-hair: rgba(31,30,29,0.045);

  /* ── 强调色：Claude clay / 赭石 ── */
  --accent:       #c96442;
  --accent-hover: #b35334;
  --accent-ink:   #9a4527;
  --accent-soft:  rgba(201,100,66,0.10);
  --accent-line:  rgba(201,100,66,0.28);

  /* ── 状态色（克制但可辨） ── */
  --rBreak: #bf5a26;  --rBreak-soft: rgba(191,90,38,0.10);
  --lBreak: #5f57c0;  --lBreak-soft: rgba(95,87,192,0.10);
  --rSide:  #b23a52;  --rSide-soft:  rgba(178,58,82,0.10);
  --lSide:  #2f7d57;  --lSide-soft:  rgba(47,125,87,0.10);
  --none:   #84817a;  --none-soft:   rgba(132,129,122,0.10);

  /* ── 涨跌（A股：红涨绿跌） ── */
  --up:   #c4452f;  --up-soft:   rgba(196,69,47,0.08);
  --down: #2f8a5f;  --down-soft: rgba(47,138,95,0.08);
  --warn: #b8742a;

  /* ── 字体 ── */
  --font-serif: 'Source Serif 4', 'Noto Serif SC', Georgia, 'Times New Roman', serif;
  --font-sans:  'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* ── 形状 ── */
  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --pill:      999px;

  /* ── 阴影（极淡） ── */
  --shadow-sm:   0 1px 2px rgba(31,30,29,0.04);
  --shadow-card: 0 1px 3px rgba(31,30,29,0.045), 0 1px 2px rgba(31,30,29,0.025);
  --shadow-pop:  0 12px 40px rgba(31,30,29,0.14), 0 2px 8px rgba(31,30,29,0.08);

  /* ── 度量 ── */
  --topbar-h:  60px;
  --sidebar-w: 360px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}

button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; outline: none; }
a { color: var(--accent-ink); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* 数字一律等宽，便于对齐 */
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 滚动条：极细、暖灰 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(31,30,29,0.14); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(31,30,29,0.24); background-clip: content-box; }

#app { height: 100%; display: flex; flex-direction: column; }

/* ════════════════════════════════════════════════
   顶栏
   ════════════════════════════════════════════════ */
#topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  z-index: 40;
}
#topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
}
.app-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.date-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  padding: 3px 9px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-soft);
  border-radius: var(--pill);
}
#topbar-right { display: flex; align-items: center; gap: 8px; }

/* ════════════════════════════════════════════════
   按钮
   ════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .08s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--surface-hover); color: var(--ink); border-color: var(--border); }

.btn--danger { color: var(--up); border-color: rgba(196,69,47,0.25); }
.btn--danger:hover { background: var(--up-soft); color: var(--up); }

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* 键盘提示徽标 */
.kbd-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-left: 5px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--ink-3); background: var(--bg-sunken);
  border: 1px solid var(--border-soft); border-radius: 4px;
  vertical-align: middle;
}

/* ════════════════════════════════════════════════
   主体两栏
   ════════════════════════════════════════════════ */
#main {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

/* 左栏 */
#left-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sunken);
  border-right: 1px solid var(--border-soft);
}

/* 右栏 */
#right-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
}

/* ════════════════════════════════════════════════
   Tab 栏
   ════════════════════════════════════════════════ */
#tab-bar { padding: 14px 16px 4px; }
.tab-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tab-row--views { margin-bottom: 8px; }
.tab-row--tables {
  padding-top: 10px;
  border-top: 1px solid var(--border-hair);
  gap: 4px;
}

.tab-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  border-radius: var(--pill);
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab-btn:hover { background: var(--surface-hover); color: var(--ink); }
.tab-btn--table { font-size: 12.5px; padding: 5px 10px; color: var(--ink-3); }

.tab-btn--active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.tab-btn--view.tab-btn--active { color: var(--accent-ink); border-color: var(--accent-line); background: var(--surface); }

.tab-count {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  color: var(--ink-4);
  padding: 1px 5px; border-radius: var(--pill);
  background: rgba(31,30,29,0.05);
}
.tab-count--hot { color: #fff; background: var(--accent); }

/* ════════════════════════════════════════════════
   筛选区
   ════════════════════════════════════════════════ */
#filter-area { padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 10px; }

#filter-row { display: flex; gap: 8px; align-items: center; }
.search-wrap {
  flex: 1 1 auto; position: relative; display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 12px; color: var(--ink-4); pointer-events: none;
}
#search-box {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#search-box::placeholder { color: var(--ink-4); }
#search-box:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 通用输入 / 下拉 */
.input, .select {
  height: 38px; padding: 0 11px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input--sm { height: 32px; font-size: 12.5px; padding: 0 9px; }
.input::placeholder { color: var(--ink-4); }
.select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 L6 8 L9.5 4.5' stroke='%2384817a' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

#filter-row-bottom { display: flex; gap: 8px; align-items: center; }
#filter-row-bottom .select { flex: 1 1 auto; }

/* 状态 chips */
#status-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
  user-select: none;
}
.chip:hover { background: var(--surface-hover); }
.chip::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: .55;
}
.chip[data-status="rBreak"] { color: var(--rBreak); }
.chip[data-status="lBreak"] { color: var(--lBreak); }
.chip[data-status="rSide"]  { color: var(--rSide); }
.chip[data-status="lSide"]  { color: var(--lSide); }
.chip[data-status="none"]   { color: var(--none); }
.chip--active {
  color: #fff; border-color: transparent;
}
.chip--active::before { background: rgba(255,255,255,0.85); opacity: 1; }
.chip[data-status="rBreak"].chip--active { background: var(--rBreak); }
.chip[data-status="lBreak"].chip--active { background: var(--lBreak); }
.chip[data-status="rSide"].chip--active  { background: var(--rSide); }
.chip[data-status="lSide"].chip--active  { background: var(--lSide); }
.chip[data-status="none"].chip--active   { background: var(--none); }

/* 新鲜突破 chip */
.chip--fresh { color: var(--accent); white-space: nowrap; }
.chip--fresh::before { content: "✦"; width: auto; height: auto; background: none; border-radius: 0; font-size: 11px; opacity: 1; }
.chip--fresh.chip--active { background: var(--accent); color: #fff; border-color: transparent; }
.chip--fresh.chip--active::before { background: none; }

/* ── 情绪过滤面板 ── */
#emo-panel { margin: 0 16px; border-top: 1px solid var(--border-hair); }
.emo-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 2px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  user-select: none;
}
.emo-panel-header:hover { color: var(--ink); }
.toggle-icon { font-size: 14px; color: var(--ink-3); }
#emo-panel-body { padding: 2px 2px 12px; display: flex; flex-direction: column; gap: 10px; }
.emo-panel-note { font-size: 11.5px; color: var(--ink-4); }

.emo-switch-row { display: flex; align-items: center; gap: 9px; }
.switch-label { font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
#emo-filter-status { margin-left: auto; font-size: 11px; color: var(--accent-ink); font-family: var(--font-mono); }

/* 拨动开关 */
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 34px; height: 20px; border-radius: var(--pill);
  background: rgba(31,30,29,0.18);
  transition: background .18s ease;
  position: relative;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .18s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }

.emo-rule-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
}
.emo-rule-list label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.emo-rule-list input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px; flex: 0 0 auto;
  border: 1.5px solid var(--border); border-radius: 4px;
  background: var(--surface); cursor: pointer; position: relative;
  transition: background .14s ease, border-color .14s ease;
}
.emo-rule-list input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.emo-rule-list input[type=checkbox]:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}
.emo-quick-links { font-size: 11.5px; color: var(--ink-3); }
.link-divider { color: var(--ink-4); margin: 0 2px; }
.emo-breakdown {
  font-size: 11.5px; color: var(--ink-2);
  padding: 8px 10px; background: var(--accent-soft);
  border-radius: var(--radius-xs);
}
.emo-breakdown b { color: var(--accent-ink); }

/* ════════════════════════════════════════════════
   列表
   ════════════════════════════════════════════════ */
#list-container {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 10px 24px;
  min-height: 0;
}
.list-empty {
  padding: 48px 24px; text-align: center;
  font-size: 13px; color: var(--ink-3); line-height: 1.9;
}

.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: background .12s ease;
}
.list-item:hover { background: var(--surface-hover); }
.list-item--selected { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); }
.list-item--selected::before {
  content: ""; position: absolute; left: 0; top: 12%; bottom: 12%;
  width: 3px; border-radius: var(--pill); background: var(--accent);
}
.list-item--disabled { cursor: default; opacity: 0.62; }
.list-item--disabled:hover { background: transparent; }

.list-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--none); }
.list-dot--rBreak { background: var(--rBreak); }
.list-dot--lBreak { background: var(--lBreak); }
.list-dot--rSide  { background: var(--rSide); }
.list-dot--lSide  { background: var(--lSide); }
.list-dot--none   { background: var(--none); }
.list-dot--gone   { background: var(--ink-4); }

.list-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.list-info > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.list-name {
  font-size: 13.5px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-code { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

.mini-badge {
  flex: 0 0 auto;
  font-size: 10.5px; font-weight: 600; padding: 1px 6px;
  border-radius: var(--pill); line-height: 1.5;
}
.mini-badge--rBreak { color: var(--rBreak); background: var(--rBreak-soft); }
.mini-badge--lBreak { color: var(--lBreak); background: var(--lBreak-soft); }
.mini-badge--rSide  { color: var(--rSide);  background: var(--rSide-soft); }
.mini-badge--lSide  { color: var(--lSide);  background: var(--lSide-soft); }

.mom-mark {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 3px;
  font-size: 10px; font-weight: 700; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 4px;
}

.list-extra { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); flex: 0 0 auto; }
.list-extra--dev { color: var(--ink-2); font-weight: 500; }

/* sparkline 微缩图 */
.list-spark { flex: 0 0 auto; display: inline-flex; width: 36px; height: 22px; opacity: 0.9; }
.list-spark svg { display: block; }
.spark-line { fill: none; stroke-width: 1.4; }
.spark-fill { opacity: 0.10; }

/* 收藏星标 */
.list-star {
  flex: 0 0 auto;
  font-size: 15px; line-height: 1; color: var(--ink-4);
  width: 22px; text-align: center; cursor: pointer;
  transition: color .14s ease, transform .1s ease;
}
.list-star:hover { color: var(--accent); transform: scale(1.12); }
.list-star--on { color: var(--accent); }

.list-sentinel { height: 1px; }

/* ── 今日变化分组 ── */
.changes-prevnote {
  font-size: 11.5px; color: var(--ink-3);
  padding: 6px 12px 10px;
}
.changes-head {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 14px 12px 6px;
}
.changes-head-title { font-size: 12.5px; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.changes-head-n {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  color: #fff; padding: 0 6px; border-radius: var(--pill);
}
.changes-head--rBreak .changes-head-n { background: var(--rBreak); }
.changes-head--lBreak .changes-head-n { background: var(--lBreak); }
.changes-head--rSide  .changes-head-n { background: var(--rSide); }
.changes-head--none   .changes-head-n { background: var(--none); }
.changes-head--gone   .changes-head-n { background: var(--ink-4); }
.changes-head-desc { font-size: 11px; color: var(--ink-4); }

/* ── 持仓项 ── */
.holding-item .list-extra { font-size: 13px; }
.holding-pnl { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.holding-pnl.pnl-up { color: var(--up); }
.holding-pnl.pnl-down { color: var(--down); }
.holding-pnlpct { display: block; font-size: 10.5px; font-weight: 500; opacity: 0.8; }

/* ════════════════════════════════════════════════
   详情区
   ════════════════════════════════════════════════ */
#detail-panel { min-height: 100%; }

#detail-empty {
  height: calc(100vh - var(--topbar-h));
  display: flex; align-items: center; justify-content: center;
}
.empty-state { text-align: center; max-width: 360px; padding: 24px; }
.empty-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 78px; height: 78px; margin-bottom: 22px;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 22px;
}
.empty-title {
  font-family: var(--font-serif); font-size: 26px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em; margin-bottom: 10px;
}
.empty-sub { font-size: 14px; color: var(--ink-3); line-height: 1.8; }

#detail-content { max-width: 1080px; margin: 0 auto; padding: 28px 32px 60px; }

/* ── 详情头部 ── */
#detail-header { margin-bottom: 22px; }
.detail-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-name {
  font-family: var(--font-serif); font-size: 28px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.015em; line-height: 1.2;
}
.detail-code {
  font-family: var(--font-mono); font-size: 14px; color: var(--ink-3);
  padding-top: 4px;
}
.detail-star {
  margin-left: auto; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--pill);
  display: inline-flex; align-items: center; gap: 2px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.detail-star:hover { background: var(--surface-hover); color: var(--ink); }
.detail-star.list-star--on { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }

.detail-group { margin-top: 10px; font-size: 12px; color: var(--ink-4); }

/* hero 价格条 */
.detail-hero {
  display: flex; align-items: center; gap: 24px;
  margin-top: 16px; padding: 4px 0;
}
.detail-hero-left { display: flex; align-items: baseline; gap: 10px; }
.hero-price { font-family: var(--font-mono); font-size: 32px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.hero-price.is-up { color: var(--up); }
.hero-price.is-down { color: var(--down); }
.hero-dev { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--ink-3); }
.hero-dev.is-up { color: var(--up); }
.hero-dev.is-down { color: var(--down); }
.detail-hero-spark { flex: 1 1 auto; min-width: 0; max-width: 260px; }
.hero-spark { width: 100%; height: 44px; display: block; }

.detail-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.chip--status {
  cursor: default; font-size: 12px; font-weight: 600; padding: 4px 12px;
  border: none;
}
.chip--status::before { display: none; }
.chip--status.st--rBreak { color: var(--rBreak); background: var(--rBreak-soft); }
.chip--status.st--lBreak { color: var(--lBreak); background: var(--lBreak-soft); }
.chip--status.st--rSide  { color: var(--rSide);  background: var(--rSide-soft); }
.chip--status.st--lSide  { color: var(--lSide);  background: var(--lSide-soft); }
.chip--status.st--none   { color: var(--none);   background: var(--none-soft); }

/* ── 卡片 ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  margin-bottom: 18px;
}
#detail-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 0; }
#detail-cards-grid .card { margin-bottom: 18px; }

.card-title {
  font-family: var(--font-serif); font-size: 16px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.005em;
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* 卡片内嵌「说明」折叠 */
.card-help { margin-bottom: 14px; }
.card-help > summary {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; list-style: none; gap: 10px;
}
.card-help > summary::-webkit-details-marker { display: none; }
.help-hint { font-size: 11.5px; color: var(--ink-4); transition: color .15s ease; }
.card-help[open] .help-hint { color: var(--accent); }
.card-help > summary:hover .help-hint { color: var(--accent); }
.help-body {
  margin-top: 12px; padding: 14px 16px;
  font-size: 12.5px; line-height: 1.75; color: var(--ink-2);
  background: var(--surface-warm); border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
}
.help-body p { margin-bottom: 8px; }
.help-body ul { margin: 6px 0 8px; padding-left: 18px; }
.help-body li { margin-bottom: 4px; }
.help-body b { color: var(--ink); font-weight: 600; }
.help-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink-2); }
.help-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-dot--rBreak { background: var(--rBreak); }
.legend-dot--lBreak { background: var(--lBreak); }
.legend-dot--rSide  { background: var(--rSide); }
.legend-dot--lSide  { background: var(--lSide); }
.legend-dot--none   { background: var(--none); }

/* ── 关键点网格 ── */
.kp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kp-cell {
  position: relative;
  padding: 12px 14px;
  background: var(--surface-warm);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
}
.kp-cell--rel { border-color: var(--accent-line); background: var(--accent-soft); }
.kp-cell-label { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.kp-cell-rel-tag {
  font-size: 9.5px; font-weight: 700; color: #fff; background: var(--accent);
  padding: 0 5px; border-radius: var(--pill);
}
.kp-cell-val { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--ink); }
.kp-cell-spark { position: absolute; right: 10px; bottom: 10px; width: 56px; height: 22px; opacity: 0.85; }
.kp-cell-spark .spark-line { stroke-width: 1.3; }

.kp-tip { margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.kp-tip--rel { color: var(--accent-ink); }
.kp-tip b { font-weight: 600; }
.kp-date { margin-top: 10px; font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }
.kp-cur-price {
  margin-top: 12px; padding: 10px 12px; font-size: 12.5px;
  background: var(--bg-sunken); border-radius: var(--radius-sm); color: var(--ink-2);
}
.kp-cur-price strong { font-family: var(--font-mono); }
.kp-cur-price--up { color: var(--up); background: var(--up-soft); }
.kp-cur-price--down { color: var(--down); background: var(--down-soft); }

/* ── 情绪数据网格 ── */
.emo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.emo-cell {
  padding: 10px 8px; text-align: center;
  background: var(--surface-warm); border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
}
.emo-cell-label { font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }
.emo-cell-val { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--ink); }
.emo-cell--bad { background: var(--up-soft); border-color: rgba(196,69,47,0.2); }
.emo-cell--bad .emo-cell-val { color: var(--up); }
.emo-cell-hint { font-size: 9.5px; color: var(--up); margin-top: 2px; }

/* ── 行情走势卡 ── */
.freq-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-sunken); border-radius: var(--radius-sm); }
.freq-tab {
  padding: 4px 14px; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  border-radius: var(--radius-xs); transition: background .14s ease, color .14s ease;
}
.freq-tab:hover { color: var(--ink); }
.freq-tab--active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.kline-container { width: 100%; height: 420px; position: relative; }
.chart-loading, .chart-error, .chart-no-data {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 240px; text-align: center; gap: 8px;
  font-size: 13px; color: var(--ink-3);
}
.chart-error p { color: var(--ink-2); }
.chart-error-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6px; }
.chart-warning-alert {
  font-size: 12px; color: var(--warn); background: rgba(184,116,42,0.08);
  padding: 7px 12px; border-radius: var(--radius-xs); margin-bottom: 10px;
}
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.manual-override-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.manual-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }

/* K线 legend（chart.js 动态注入，样式在此） */
.kline-legend {
  position: absolute; top: 8px; left: 10px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding: 7px 11px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11px;
  pointer-events: none;
}
.legend-item { display: inline-flex; gap: 4px; align-items: baseline; }
.legend-label { color: var(--ink-4); }
.legend-val { color: var(--ink); font-weight: 500; }
.legend-val--up { color: var(--up); }
.legend-val--down { color: var(--down); }

/* ════════════════════════════════════════════════
   仓位参考
   ════════════════════════════════════════════════ */
#detail-position .card-title { display: block; margin-bottom: 16px; }
.pos-section { margin-bottom: 16px; }
.pos-section-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 9px; text-transform: none; }
.pos-section--auto { padding: 14px 16px; background: var(--surface-warm); border: 1px solid var(--border-hair); border-radius: var(--radius-sm); }

.pos-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.pos-row:last-child { margin-bottom: 0; }
.pos-label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.pos-row .input { width: 100%; }
.pos-hint { font-size: 11px; color: var(--ink-4); }

.auto-badge {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: var(--pill);
  color: var(--lSide); background: var(--lSide-soft);
}
.auto-badge--modified { color: var(--warn); background: rgba(184,116,42,0.1); }

.risk-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip--risk {
  padding: 5px 12px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); border: 1px solid var(--border);
}
.chip--risk::before { display: none; }
.chip--risk.chip--active { background: var(--accent); color: #fff; border-color: transparent; }
.risk-chips .input { width: 92px; }

.pos-prompt { font-size: 12.5px; color: var(--ink-3); padding: 12px; text-align: center; background: var(--surface-warm); border-radius: var(--radius-sm); }
.text-error { color: var(--up); }
.text-muted { color: var(--ink-3); }
.pos-na { font-size: 12.5px; }

.pos-result-box { margin-top: 4px; }
.pos-main { font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.pos-main strong { font-family: var(--font-mono); font-size: 18px; color: var(--accent-ink); font-weight: 700; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pos-cell { padding: 10px 12px; background: var(--surface-warm); border: 1px solid var(--border-hair); border-radius: var(--radius-sm); }
.pos-cell-label { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.pos-cell-val { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--ink); }

.pos-alerts { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.pos-alert { font-size: 12px; padding: 9px 12px; border-radius: var(--radius-sm); line-height: 1.5; }
.pos-alert--bad  { color: var(--up); background: var(--up-soft); }
.pos-alert--warn { color: var(--warn); background: rgba(184,116,42,0.09); }
.pos-alert--info { color: var(--ink-2); background: var(--bg-sunken); }

.pos-disclaimer { margin-top: 14px; font-size: 11px; color: var(--ink-4); text-align: center; }

/* 持仓横幅 */
.hold-banner { padding: 13px 15px; margin-bottom: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); }
.hold-banner-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.hold-tag { font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 9px; border-radius: var(--pill); }
.hold-line { font-size: 12.5px; color: var(--ink-2); }
.hold-line b { font-family: var(--font-mono); color: var(--ink); }
.hold-pnl-row { margin-top: 7px; font-size: 13px; }
.hold-pnl-row b { font-family: var(--font-mono); }
.hold-pnl-row.pnl-up { color: var(--up); }
.hold-pnl-row.pnl-down { color: var(--down); }

.pos-hold-btn { margin-top: 4px; }
.pos-hold-hint { display: block; margin-top: 7px; font-size: 11px; color: var(--ink-4); }

/* ════════════════════════════════════════════════
   弹层 / Modal
   ════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(31,30,29,0.32);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
.modal {
  position: fixed; z-index: 91; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 40px));
  max-height: calc(100vh - 64px); overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  animation: popIn .2s cubic-bezier(.2,.8,.3,1);
}
.modal--wide { width: min(680px, calc(100vw - 40px)); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border-hair);
}
.modal-title { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.modal-title--danger { color: var(--up); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px 18px; display: flex; justify-content: flex-end; border-top: 1px solid var(--border-hair); }

.settings-field { margin-bottom: 22px; }
.settings-label { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.settings-hint { font-size: 12px; color: var(--ink-3); line-height: 1.65; margin-bottom: 9px; }
.settings-status-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.status-dot-ok { width: 8px; height: 8px; border-radius: 50%; background: var(--lSide); box-shadow: 0 0 0 3px var(--lSide-soft); }
.settings-folder-name { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }

.settings-danger-zone { padding-top: 18px; border-top: 1px solid var(--border-hair); }
.settings-danger-label { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; }
.settings-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 方法说明文档排版 */
.method-doc { font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.method-kicker {
  font-family: var(--font-serif); font-size: 16px; line-height: 1.7; color: var(--ink);
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
}
.method-doc h4 {
  font-family: var(--font-serif); font-size: 15.5px; font-weight: 600; color: var(--ink);
  margin: 20px 0 8px;
}
.method-doc p { margin-bottom: 10px; }
.method-doc ul { margin: 8px 0 12px; padding-left: 20px; }
.method-doc li { margin-bottom: 6px; }
.method-doc b { color: var(--ink); font-weight: 600; }
.method-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 12px 0; font-size: 12.5px; }
.method-legend span { display: inline-flex; align-items: center; gap: 6px; }

.error-text { font-size: 13px; color: var(--up); line-height: 1.7; }

/* 解析警告面板（右下角浮层） */
#warnings-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  width: min(380px, calc(100vw - 40px)); max-height: 50vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  animation: popIn .2s ease;
}
.warnings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border-hair);
  font-size: 13px; font-weight: 600; color: var(--warn);
  position: sticky; top: 0; background: var(--surface);
}
#warnings-list { list-style: none; padding: 10px 16px 16px; }
#warnings-list li { font-size: 12px; color: var(--ink-2); padding: 4px 0; line-height: 1.5; border-bottom: 1px solid var(--border-hair); }
#warnings-list li:last-child { border-bottom: none; }

/* Toast */
#toast-container {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 11px 18px;
  font-size: 13px; color: var(--bg);
  background: var(--ink);
  border-radius: var(--pill);
  box-shadow: var(--shadow-pop);
  animation: toastIn .26s cubic-bezier(.2,.8,.3,1);
  max-width: 80vw;
}
.toast--fade { animation: toastOut .4s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* 拖拽导入遮罩 */
#drag-overlay {
  position: fixed; inset: 0; z-index: 99;
  display: flex; align-items: center; justify-content: center;
  background: rgba(250,249,245,0.86); backdrop-filter: blur(3px);
}
.drag-overlay-inner {
  text-align: center; padding: 48px 64px;
  border: 2px dashed var(--accent-line); border-radius: 22px;
  background: var(--surface);
}
.drag-overlay-text { font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--accent-ink); }
.drag-overlay-sub { margin-top: 6px; font-size: 13px; color: var(--ink-3); }

/* 窄屏返回栏 */
#narrow-detail-wrap { display: none; }
.narrow-back-bar { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); background: var(--bg); }

/* ════════════════════════════════════════════════
   响应式
   ════════════════════════════════════════════════ */
@media (max-width: 1180px) {
  :root { --sidebar-w: 320px; }
  #detail-content { padding: 24px 24px 56px; }
  #detail-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  #main { grid-template-columns: 1fr; }
  #left-panel { border-right: none; }
  body.narrow #right-panel { display: none; }
  body.narrow.detail-open #left-panel { display: none; }
  body.narrow.detail-open #right-panel { display: block; }
  body.narrow.detail-open #narrow-detail-wrap { display: block; position: sticky; top: 0; z-index: 30; }
  #detail-content { padding: 18px 16px 48px; }
  .detail-name { font-size: 24px; }
  .hero-price { font-size: 26px; }
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  .emo-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 520px) {
  #topbar { padding: 0 16px; }
  .btn--ghost { padding: 0 10px; }
  .emo-grid { grid-template-columns: repeat(2, 1fr); }
}
