/* ============================================================
   Vergex Design Language 重构
   纯黑底 · 紫色品牌色 · 半透明卡片 · Mona Sans
   参考: https://vergex.trade/
   ============================================================ */
:root {
  color-scheme: dark;
  /* 品牌 */
  --brand: #776be3;
  --brand-active: #8172ff;
  --brand-gradient: linear-gradient(135deg, #b1a7ff, #776be3);
  /* 文字 - 带紫调的白 */
  --text-primary: #eae9f4;
  --text-secondary: rgba(234, 233, 244, 0.6);
  --text-tertiary: rgba(234, 233, 244, 0.4);
  /* 背景 */
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-fill: rgba(255, 255, 255, 0.03);
  --topbar-bg: rgba(0, 0, 0, 0.8);
  --sidebar-bg: #000000;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  /* 功能色 */
  --success: #00e096;
  --success-bg: rgba(0, 224, 150, 0.1);
  --success-border: rgba(0, 224, 150, 0.2);
  --error: #ff4160;
  --error-bg: rgba(255, 65, 96, 0.1);
  --error-border: rgba(255, 65, 96, 0.2);
  --warning: #ff784b;
  --warning-bg: rgba(255, 120, 75, 0.1);
  --warning-border: rgba(255, 120, 75, 0.2);
  --info: #1f8bff;
  --info-bg: rgba(31, 139, 255, 0.1);
  --info-border: rgba(31, 139, 255, 0.2);
  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.3);
  /* 圆角 */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
}

/* ===== Light theme overrides ===== */
[data-theme="light"] {
  color-scheme: light;
  --text-primary: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.65);
  --text-tertiary: rgba(26, 26, 46, 0.42);
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.035);
  --bg-card-hover: rgba(0, 0, 0, 0.06);
  --bg-fill: rgba(0, 0, 0, 0.02);
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --sidebar-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --success: #00a86b;
  --success-bg: rgba(0, 168, 107, 0.1);
  --success-border: rgba(0, 168, 107, 0.25);
  --error: #e13550;
  --error-bg: rgba(225, 53, 80, 0.08);
  --error-border: rgba(225, 53, 80, 0.2);
  --warning: #e2622e;
  --warning-bg: rgba(226, 98, 46, 0.1);
  --warning-border: rgba(226, 98, 46, 0.25);
  --info: #1677d9;
  --info-bg: rgba(22, 119, 217, 0.08);
  --info-border: rgba(22, 119, 217, 0.22);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0,0.05);
}

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

html { scrollbar-width: none; }
::-webkit-scrollbar { width: 0; height: 0; }

body {
  font-family: 'Mona Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== App layout ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.brand-text {
  flex: 1;
  min-width: 0;
}
.sidebar-toggle {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.sidebar-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-card);
}
.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(119, 107, 227, 0.4);
}
.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.brand-tag {
  font-size: 12px;
  color: var(--text-tertiary);
}
.nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-2);
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-3);
  height: 40px;
  line-height: 40px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}
.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-card);
  font-weight: 500;
  border: 1px solid var(--border);
}
.nav-item.active .nav-icon {
  color: var(--brand-active);
}
.nav-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* 导航分组：按「盯盘 / 研究 / 自动化」的频次与场景分层，小标题只做视觉分隔，
   不可点击；组与组之间留一段空白，避免九项连成一坨看不清边界。 */
.nav-group + .nav-group { margin-top: var(--sp-3); }
.nav-group-label {
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-1);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  user-select: none;
}
/* 内联 SVG 图标：尺寸走 1em（随父级字号缩放），颜色继承 currentColor 随主题变化；
   与文字并排时靠父级 flex 对齐，不在 flex 容器里时退回 baseline 微调。 */
.icn {
  flex: 0 0 auto;
  vertical-align: -0.125em;
}
.boundary {
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
}
.boundary p {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ===== User box ===== */
.user-box {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card);
}
.user-name {
  color: var(--text-secondary);
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-link {
  color: var(--text-tertiary);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s;
}
.logout-link:hover { color: var(--error); }
/* 头像+用户名整体作为个人信息入口；按钮重置为无样式容器，hover 时名字提亮。 */
.user-profile {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.user-profile:hover .user-name { color: var(--text-primary); }

/* ===== Sidebar collapsed state ===== */
.sidebar {
  transition: width 0.2s ease;
}
.sidebar.collapsed {
  width: 64px;
}
[data-sidebar-collapsed="1"] .sidebar {
  width: 64px;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .boundary,
.sidebar.collapsed .user-box {
  display: none;
}
[data-sidebar-collapsed="1"] .sidebar .brand-text,
[data-sidebar-collapsed="1"] .sidebar .nav-label,
[data-sidebar-collapsed="1"] .sidebar .nav-group-label,
[data-sidebar-collapsed="1"] .sidebar .boundary,
[data-sidebar-collapsed="1"] .sidebar .user-box {
  display: none;
}
.sidebar.collapsed .brand {
  justify-content: center;
  padding: var(--sp-4) var(--sp-2);
  gap: 0;
}
[data-sidebar-collapsed="1"] .sidebar .brand {
  justify-content: center;
  padding: var(--sp-4) var(--sp-2);
  gap: 0;
}
.sidebar.collapsed .brand-icon {
  margin: 0;
}
[data-sidebar-collapsed="1"] .sidebar .brand-icon {
  margin: 0;
}
.sidebar.collapsed .sidebar-toggle {
  display: none;
}
[data-sidebar-collapsed="1"] .sidebar .sidebar-toggle {
  display: none;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}
[data-sidebar-collapsed="1"] .sidebar .nav-item {
  justify-content: center;
  padding: 0;
}
.sidebar.collapsed .nav-item .nav-icon {
  width: auto;
  font-size: 20px;
}
[data-sidebar-collapsed="1"] .sidebar .nav-item .nav-icon {
  width: auto;
  font-size: 20px;
}
.sidebar-expand {
  display: none;
  margin: var(--sp-3) auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.sidebar-expand:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-card);
}
.sidebar.collapsed .sidebar-expand {
  display: inline-flex;
}
[data-sidebar-collapsed="1"] .sidebar .sidebar-expand {
  display: inline-flex;
}

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 64px;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.prices-input {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.price-source {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 0 var(--sp-2);
  border-left: 2px solid var(--success);
  line-height: 1.4;
}
.market-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.market-sessions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.market-sessions .badge {
  font-size: 11px;
  padding: 2px var(--sp-2);
  white-space: nowrap;
}
.snapshot-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.snapshot-meta.is-stale {
  color: var(--warning, var(--text-secondary));
}
.snapshot-meta .badge {
  font-size: 11px;
  padding: 2px var(--sp-2);
  white-space: nowrap;
}
.form-row-g {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  align-items: end;
}
.cn-import-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.cn-import-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cn-import-stat .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.cn-import-stat .stat-value {
  font-size: 16px;
  font-weight: 600;
}
.cn-import-warnings,
.cn-import-positions {
  margin: var(--sp-3) 0 0;
  padding-left: var(--sp-4);
  font-size: 13px;
  color: var(--text-secondary);
}
.cn-import-warnings li {
  color: var(--warning);
}
.cn-import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: var(--sp-2);
}
.cn-import-table th,
.cn-import-table td {
  padding: var(--sp-1) var(--sp-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.cn-import-table td.num {
  text-align: right;
}
.cn-import-table .row-error td {
  color: var(--error);
}
.cn-import-table .row-skipped td {
  color: var(--text-secondary);
}
.cn-import-rows {
  max-height: 260px;
  overflow-y: auto;
  margin-top: var(--sp-2);
}

/* ===== Buttons ===== */
/* 桌面端尺寸偏紧凑：看板一屏内会有多组操作按钮（工具栏、卡片操作、弹层），
   36px/14px 的组合在密集布局里显得笨重。移动端由 @media 单独放大到 40–44px
   以保住触摸目标，所以这里收小不影响手机。 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
  line-height: 1;
  font-family: inherit;
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.btn-primary {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #ffffff;
  font-weight: 500;
}
.btn-primary:hover {
  background: var(--brand-active);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(119, 107, 227, 0.4);
}
.btn-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
  font-weight: 500;
}
.btn-success:hover {
  background: rgba(0, 224, 150, 0.18);
  border-color: var(--success);
}
.btn-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}
.btn-warning:hover {
  background: rgba(255, 120, 75, 0.18);
  border-color: var(--warning);
}
.btn-danger {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}
.btn-danger:hover {
  background: rgba(255, 65, 96, 0.18);
  border-color: var(--error);
}
.btn-sm {
  height: 24px;
  padding: 0 var(--sp-2);
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--brand);
}
.btn-ghost:hover {
  background: var(--bg-card);
  border-color: var(--brand);
}
.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

/* ===== Sections ===== */
.section {
  display: none;
  padding: var(--sp-6);
  flex: 1;
}
.section.active { display: block; }

/* ===== KPI grid ===== */
.kpi-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.kpi {
  flex: 0 1 calc((100% - 3 * var(--sp-4)) / 4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: all 0.2s;
}
.kpi:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.kpi-label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-2);
}
.kpi-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi-sub {
  margin-top: var(--sp-1);
  min-height: 14px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.kpi-note {
  flex: 0 0 100%;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-tertiary);
  text-align: center;
}
.kpi-note:empty { display: none; }

/* ===== Dashboard privacy mode (eye toggle) ===== */
.dashboard-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: var(--sp-3);
}
/* 开启后模糊看板上的金额/数量，布局保持不变；因作用于容器类，
   刷新重渲染后遮罩依旧生效。 */
#dashboard.privacy .kpi-value,
#dashboard.privacy .kpi-sub,
#dashboard.privacy .num {
  filter: blur(7px);
  user-select: none;
  -webkit-user-select: none;
}

/* ===== Dashboard grid ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-4);
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-strong); }
.card-wide { grid-column: 1 / -1; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.card-body {
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
}

/* ===== Badge / Tag ===== */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--sp-1);
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-danger { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge-neutral { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }

/* ===== Trend chart ===== */
.trend-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg-btn {
  background: transparent; border: none; border-right: 1px solid var(--border);
  padding: 4px 10px; font-size: 12px; color: var(--text-secondary); cursor: pointer; line-height: 1.4;
}
.seg-btn:last-child { border-right: none; }
.seg-btn.active { background: var(--info-bg); color: var(--info); font-weight: 600; }
.seg-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.trend-title { font-size: 13px; font-weight: 600; margin: 4px 0 6px; color: var(--text-primary); }
.trend-svg { width: 100%; height: 160px; display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; }
.trend-stock { margin-top: 10px; }
.trend-stock-head { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.trend-stock-head .badge { font-size: 11px; }

/* ===== Price cell (live quote) ===== */
.price-cell {
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}
.price-current {
  font-weight: 600;
  font-size: 14px;
}
.price-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 1px;
}
.price-ohlc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.price-up .price-current,
.price-up .price-change { color: var(--success); }
.price-down .price-current,
.price-down .price-change { color: var(--error); }
.price-mute { color: var(--text-tertiary); }

/* ===== Table ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: var(--bg-card); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Focus stocks ===== */
.focus-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3);
}
.focus-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  transition: all 0.2s;
}
.focus-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(119, 107, 227, 0.15);
}
.focus-item h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}
.focus-item .symbol {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
}
.focus-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-secondary);
}
.focus-item .meta span {
  background: var(--bg-fill);
  padding: 2px var(--sp-2);
  border-radius: var(--sp-1);
  border: 1px solid var(--border);
}

/* ===== Overview/Todo sections ===== */
.overview-section, .todo-section {
  margin-bottom: var(--sp-5);
}
.overview-section:last-child, .todo-section:last-child { margin-bottom: 0; }
.overview-section h4, .todo-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.overview-section h4::before, .todo-section h4::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--brand-gradient);
  border-radius: 2px;
}
/* 汇总表中的口径拆分行（如已实现盈亏的“成交重放 / 现金流”） */
.overview-section td.sub-item {
  color: var(--text-tertiary);
  font-size: 12px;
  padding-left: var(--sp-4);
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
/* 标的前端搜索框（#/signals 与 #/bindings）：观感与筛选下拉对齐，允许换行时不撑开布局。 */
.toolbar input[type="search"],
.card-header input[type="search"] {
  height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.toolbar input[type="search"]:focus,
.card-header input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
}
.card-header input[type="search"] {
  margin-left: auto;
}

/* ===== States ===== */
.empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--sp-7) var(--sp-4);
  font-size: 13px;
}
.loading {
  text-align: center;
  color: var(--brand);
  padding: var(--sp-5);
  font-size: 13px;
}
.alert-text { color: var(--error); }

/* 历史报告的读时数据质量提示（不改正文，仅在报告页顶部标出） */
.report-warning {
  border: 1px solid var(--error-border, rgba(255, 65, 96, 0.28));
  background: var(--error-bg);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
}
.report-warning b { color: var(--error); margin-right: 4px; }

/* ===== Login overlay ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(119, 107, 227, 0.15), transparent 60%);
  pointer-events: none;
}
.login-box {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-7);
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.login-icon {
  font-size: 40px;
  margin-bottom: var(--sp-3);
  display: inline-flex;
  width: 56px;
  height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--brand-gradient);
  box-shadow: 0 8px 24px rgba(119, 107, 227, 0.4);
}
.login-box h2 {
  margin: 0 0 var(--sp-1);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.login-sub {
  color: var(--text-tertiary);
  margin: 0 0 var(--sp-6);
  font-size: 13px;
}
.btn-block {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  padding: 0 var(--sp-4);
  height: 44px;
  line-height: 44px;
  font-size: 15px;
}
.login-apps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.login-app-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  padding: 0 var(--sp-4);
  height: 44px;
  line-height: 44px;
  font-size: 15px;
}
.login-tip {
  color: var(--text-tertiary);
  font-size: 12px;
  margin: var(--sp-4) 0 0;
  min-height: 1em;
}

.hidden { display: none !important; }

/* ===== Mobile menu button (hidden on desktop) ===== */
.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}
.sidebar-scrim {
  display: none;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .kpi { flex-basis: calc((100% - var(--sp-4)) / 2); }
  .dashboard-grid { grid-template-columns: 1fr; }
}


/* ===== Toolbar filter & actions ===== */
.filter-group {
  display: inline-flex;
  margin-left: var(--sp-3);
}
.filter-group select {
  height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.filter-group select:hover { border-color: var(--border-strong); }
/* AI 辩论筛选栏：复用 filter-group 的控件观感，允许换行；分页条居中对齐。 */
.llm-filter-bar { flex-wrap: wrap; align-items: center; }
.llm-filter-bar select,
.llm-filter-bar input[type="search"] {
  height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.llm-filter-bar select { cursor: pointer; }
.llm-filter-bar select:hover { border-color: var(--border-strong); }
.pager-bar { justify-content: flex-end; }
.pager-bar .btn:disabled { opacity: 0.45; cursor: not-allowed; }
td.actions {
  white-space: nowrap;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  align-items: center;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-dialog {
  position: relative;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-dialog.modal-wide {
  width: 680px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 var(--sp-1);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: var(--sp-5); }

/* ===== 个人信息面板 ===== */
.profile-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
}
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}
.profile-card-info { min-width: 0; }
.profile-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-menu-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}
.profile-menu-label { flex: 1; }
.profile-menu-chev { color: var(--text-tertiary); font-size: 18px; line-height: 1; }

/* ===== Form ===== */
.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}
.form-row label {
  font-size: 13px;
  color: var(--text-secondary);
}
.form-row .req { color: var(--error); }
.form-row input,
.form-row select,
.form-row textarea {
  height: 38px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-fill);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.form-row textarea {
  height: auto;
  min-height: 64px;
  padding: var(--sp-2) var(--sp-3);
  resize: vertical;
  line-height: 1.5;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--brand);
}
.form-row input:disabled,
.form-row select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.form-error {
  color: var(--error);
  font-size: 13px;
  margin: var(--sp-2) 0 0;
  min-height: 1em;
}
.helper-text {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: var(--sp-3);
}
.result-panel {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
  background: var(--success-bg);
}
.result-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--sp-3);
}
.result-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.result-row:last-child {
  margin-bottom: 0;
}
.result-label {
  color: var(--text-secondary);
  font-size: 12px;
}
.copy-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.copy-row code,
.price-source code {
  display: inline-block;
  max-width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-fill);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.select-with-create {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  min-width: 0;
}
.select-with-create select {
  flex: 1 1 180px;
  min-width: 0;
  height: 38px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-fill);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}
.select-with-create select:focus {
  outline: none;
  border-color: var(--brand);
}
.select-with-create .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.inline-create {
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-fill);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.inline-create input {
  height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.inline-create input:focus {
  outline: none;
  border-color: var(--brand);
}
.inline-create .form-error {
  margin: 0;
}

.stock-search {
  position: relative;
}
.stock-search #stockSearchMarket {
  margin-bottom: var(--sp-1);
}
.search-results {
  margin-top: var(--sp-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
}
.search-item {
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover {
  background: var(--bg-card-hover);
}
.search-item .search-desc {
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item .search-type {
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}
.search-empty {
  color: var(--text-tertiary);
  justify-content: center;
  cursor: default;
}
.search-empty:hover { background: transparent; }

/* ============================================================
   股票管理模态框
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1rem;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin: 0 0 0.75rem;
}
.stock-manage-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.stock-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.stock-manage-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stock-manage-item .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.stock-manage-symbol { font-weight: 600; }
.stock-manage-meta { font-size: 0.75rem; color: var(--text-tertiary); }

/* ============================================================
   AI 深度辩论（子 Tab / 发起弹层 / 报告弹层）
   ============================================================ */
/* 信号页内的二级 Tab：规则信号 / AI 深度辩论，同页切换不重载导航。 */
.sub-tabs {
  display: flex;
  gap: var(--sp-1);
  padding: 3px;
  margin-bottom: var(--sp-4);
  background: var(--bg-fill);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
}
.sub-tab {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.sub-tab:hover { color: var(--text-primary); }
.sub-tab.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  font-weight: 500;
}
.signal-pane.hidden { display: none; }

/* 发起辩论弹层的标的勾选列表。 */
.llm-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}
.llm-pick-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-fill);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.llm-pick-item:hover { background: var(--bg-card-hover); }
.llm-pick-item input { accent-color: var(--brand); flex-shrink: 0; }
.llm-pick-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.llm-pick-symbol { font-weight: 600; }
.llm-pick-meta { font-size: 0.75rem; color: var(--text-tertiary); }

/* 手动辩论的「是否影响绑定实盘账户」开关。默认关闭；打开后强调这是
   账户相关/可执行的辩论，避免和纯研究票混淆。 */
.llm-scope-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.2rem 0 0.35rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg-fill);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.llm-scope-row:hover { background: var(--bg-card-hover); }
.llm-scope-row.is-on {
  border-color: var(--warning-border);
  background: var(--warning-bg);
}
.llm-scope-row input { accent-color: var(--brand); flex-shrink: 0; margin-top: 0.2rem; }
.llm-scope-text { min-width: 0; }
.llm-scope-text small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-tertiary);
  font-size: 0.74rem;
  line-height: 1.55;
}

/* 分析师勾选（深度辩论 / 盘中辩论的分析师设置卡片） */
.analyst-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-fill);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.analyst-check:hover { background: var(--bg-card-hover); }
.analyst-check input { accent-color: var(--brand); flex-shrink: 0; }
.analyst-check input:disabled { cursor: not-allowed; }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.modal-actions .form-error { margin: 0; flex: 1; }
.llm-lang-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.llm-lang-row select {
  background: var(--bg-fill);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}
.report-lang-tabs { margin-bottom: 0.5rem; }

/* 报告正文区（现在是独立页，不再受弹层限宽）。 */
.report-md {
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-primary);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
.report-md h1, .report-md h2, .report-md h3 {
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
  color: var(--text-primary);
}
.report-md h1:first-child, .report-md h2:first-child { margin-top: 0; }
.report-md p { margin: 0.4rem 0; }
.report-md ul { margin: 0.4rem 0 0.4rem 1.2rem; }
.report-md li { margin: 0.15rem 0; }
.report-md code {
  background: var(--bg-fill);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 0.8rem;
}
.report-md strong { color: var(--text-primary); font-weight: 600; }
.report-md hr { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }

/* ===== 富文本 Markdown 元素（marked 解析后才会出现）=====
   旧极简渲染器只产出 h/p/ul/hr，下面的标签原先一个都不会出现；引入 marked 后
   才需要样式。表格套 .md-table-wrap 做横向滚动（见 app.js renderMarkdown）。 */
.report-md .md-table-wrap { overflow-x: auto; margin: 0.6rem 0; }
.report-md table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.report-md th, .report-md td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.report-md th { background: var(--bg-fill); font-weight: 600; white-space: nowrap; }
.report-md ol { margin: 0.4rem 0 0.4rem 1.2rem; }
.report-md pre {
  background: var(--bg-fill);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}
.report-md pre code { background: none; padding: 0; font-size: 0.78rem; }
.report-md blockquote {
  margin: 0.5rem 0;
  padding-left: 0.7rem;
  border-left: 2px solid var(--border-strong);
  color: var(--text-secondary);
}
.report-md a { color: var(--info); text-decoration: none; }
.report-md a:hover { text-decoration: underline; }
.report-md img { max-width: 100%; }

/* 报告弹层分节 Tab：辩论详情（分析师报告/多空辩论/交易计划/风控辩论/最终决策）。
   sticky：分节正文很长时，Tab 栏滚出视野就没法切节；.sub-tabs 自带不透明底色，
   吸顶后不会透出下方文字。 */
.report-tabs {
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
  position: sticky;
  top: 0;
  z-index: 2;
}
.report-section-pane.hidden { display: none; }

/* ===== 盘中实时辩论面板 ===== */
/* 触发器清单：每种触发一格里显示「名称 + 生效档位」，未生效的置灰，
   让「为什么现在没触发」在页面上一眼可读。 */
.intraday-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.intraday-trigger {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-fill);
  font-size: 12px;
  color: var(--text-secondary);
}
.intraday-trigger.active {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}
.intraday-trigger .lv {
  font-size: 11px;
  color: var(--text-tertiary);
}
.intraday-trigger.active .lv { color: inherit; opacity: 0.75; }

/* alpha 统计条：settled 为 0 时没有可展示的收益，用占位提示而不是 0%。 */
.alpha-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}
.alpha-stat { min-width: 92px; }
.alpha-stat-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 2px; }
.alpha-stat-value { font-size: 16px; font-weight: 600; }

/* 任务行里的阶段进度：挂在状态徽章下方，作为第二行小字。 */
.stage-line { font-size: 11px; margin-top: 2px; }

/* 一列多行时间（派单/完成/源数据/到期）。用 flex 列而不是 <br>：H5 卡片模式
   把 <td> 变成 flex 容器，<br> 会被忽略，多行会在同一行里挤成一串。 */
.time-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
  min-width: 0;
}
.time-stack .stage-line { margin-top: 0; }

/* ===== H5 移动端适配层 =====
   两条断点：<=1024px 收窄栅格，<=768px 进入手机布局。
   手机布局的核心是「表格转卡片」：同一个 DOM，靠 data-label / data-priority
   在窄屏重排为卡片，桌面端表现完全不变。 */

/* 仅移动端可见的元素，默认隐藏。 */
.bottom-nav,
.pull-indicator,
.row-toggle,
td.row-more {
  display: none;
}

/* ===== Touch ergonomics =====
   触摸设备没有真正的 hover：悬停态会「粘」在最后一次点击的元素上，
   造成「点过了还亮着」的错觉。这里统一让 :active 承担反馈，清掉悬停态。 */
@media (hover: none) {
  .kpi:hover { background: var(--bg-card); border-color: var(--border); }
  .card:hover { border-color: var(--border); }
  /* 复位 .focus-item:hover 的位移与投影，否则点过的卡片会一直「浮着」。 */
  .focus-item:hover {
    background: var(--bg-card);
    border-color: var(--border);
    transform: none;
    box-shadow: none;
  }
  tbody tr:hover td { background: transparent; }
  .nav-item:hover { color: var(--text-secondary); background: transparent; }
  .nav-item.active:hover { color: var(--text-primary); background: var(--bg-card); }
  /* 各按钮变体改的是背景/边框/投影，逐项还原到基础态；
     只写 filter 是无效的——基础规则里根本没有 filter。 */
  .btn:hover { background: var(--bg-card); border-color: var(--border); }
  .btn-primary:hover {
    background: var(--brand-gradient);
    border-color: transparent;
    box-shadow: none;
  }
  .btn-success:hover { background: var(--success-bg); border-color: var(--success-border); }
  .btn-warning:hover { background: var(--warning-bg); border-color: var(--warning-border); }
  .btn-danger:hover { background: var(--error-bg); border-color: var(--error-border); }
  .btn-ghost:hover { background: transparent; border-color: var(--border); }
  .logout-link:hover { color: var(--text-tertiary); }

  .btn:active { transform: scale(0.97); }
  .seg-btn:active { background: var(--bg-card); }
  tbody tr:active td { background: var(--bg-card); }
}

@media (max-width: 768px) {
  /* 关掉浏览器自带的下拉刷新，避免与页面内的下拉刷新重复触发。 */
  html, body { overscroll-behavior-y: contain; }

  /* ---------- 侧边栏：抽屉 ---------- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 264px;
    max-width: 82vw;
    transform: translateX(-100%);
    z-index: 200;
    transition: transform 0.25s ease;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  /* 抽屉里始终显示完整文字标签，不受桌面端折叠状态影响。 */
  .sidebar .nav-label,
  .sidebar .nav-group-label,
  .sidebar .brand-text,
  .sidebar .boundary,
  .sidebar .user-box { display: block; }
  .sidebar .sidebar-toggle,
  .sidebar .sidebar-expand { display: none; }
  .sidebar .nav-item { height: 48px; line-height: 48px; }
  .sidebar-scrim.mobile-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
  }
  .main { margin-left: 0; }

  /* ---------- 顶栏：吸附 + 汉堡按钮 ---------- */
  .mobile-menu-btn { display: flex; }
  .topbar {
    height: auto;
    padding: var(--sp-2) var(--sp-3);
    padding-top: calc(var(--sp-2) + env(safe-area-inset-top));
    padding-left: max(var(--sp-3), env(safe-area-inset-left));
    padding-right: max(var(--sp-3), env(safe-area-inset-right));
    gap: var(--sp-2);
    flex-wrap: wrap;
    z-index: 120;
  }
  .topbar h1 { font-size: 15px; flex: 1; min-width: 0; }
  /* 按钮优先占第一行；行情状态徽章换行成一条可横向滚动的窄条，
     否则徽章会把「刷新行情 / 刷新看板」挤出屏幕右侧。 */
  .prices-input {
    width: 100%;
    justify-content: space-between;
    gap: var(--sp-2);
    flex-wrap: wrap;
  }
  .prices-input > .seg,
  .prices-input > .btn { order: 1; }
  .market-strip {
    order: 2;
    flex: 1 1 100%;
    gap: var(--sp-2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  /* 行情来源说明与快照元信息是桌面端的长文案，手机上占满一整行且挤掉操作按钮。 */
  .price-source { display: none; }
  .snapshot-meta { font-size: 11px; }

  /* ---------- 底部标签栏 ---------- */
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 180;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    /* 避开 iPhone 底部横条。 */
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .bottom-nav-item {
    flex: 1;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--sp-1) 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item:active { background: var(--bg-card); }
  .bottom-nav-item.active { color: var(--brand-active); }
  .bn-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; font-size: 18px; line-height: 1; }
  .bn-label { font-size: 10px; letter-spacing: 0.02em; }

  /* 给固定底栏让位，避免最后一张卡片被遮住。 */
  .main { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

  /* ---------- 内容区 ---------- */
  .section {
    padding: var(--sp-3);
    padding-left: max(var(--sp-3), env(safe-area-inset-left));
    padding-right: max(var(--sp-3), env(safe-area-inset-right));
  }
  /* 未被卡片化的宽表格（A股导入预览等）仍在卡片内横向滚动，不撑破容器。 */
  .card-body { padding: var(--sp-3); overflow-x: auto; }
  .card-header { padding: var(--sp-3); }

  /* 无表头的键值对表格（看板「盈亏汇总」）保持网格，只收紧字号与间距。 */
  .kv-table td, .kv-table th { font-size: 12px; padding: 6px var(--sp-1); }
  .kv-table td:first-child, .kv-table td:nth-child(3) { color: var(--text-secondary); }

  /* ---------- KPI：两列紧凑排布 ---------- */
  .kpi-grid { gap: var(--sp-3); margin-bottom: var(--sp-4); }
  .kpi {
    flex: 0 1 calc((100% - var(--sp-3)) / 2);
    padding: var(--sp-3);
  }
  .kpi-label { font-size: 12px; margin-bottom: var(--sp-1); }
  .kpi-value { font-size: 17px; overflow-wrap: anywhere; }

  /* ---------- 工具栏：按钮排成两列大按钮 ---------- */
  /* 桌面端把 .btn 收紧到 30px，但触摸目标必须回到 44px（iOS HIG 下限）。
     这里统一抬高基础尺寸，下面各处的 min-height 继续按场景微调。 */
  .btn { height: 44px; padding: 0 var(--sp-4); font-size: 14px; }
  .btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: 12px; }
  .icon-btn { width: 44px; height: 44px; font-size: 18px; }
  .toolbar { flex-wrap: wrap; gap: var(--sp-2); }
  .toolbar .btn { flex: 1 1 calc(50% - var(--sp-2)); min-height: 44px; }
  .toolbar .price-source { display: none; }
  .filter-group { flex: 1 1 100%; margin-left: 0; }
  .filter-group select { width: 100%; height: 44px; }

  /* ---------- 表格转卡片 ---------- */
  /* 卡片模式里必须去掉表格的 shrink-to-fit：display:table 的宽度会被「最宽的一行」
     反推，宏观事件里 180 字符的长 URL 会把整张表撑宽，所有卡片跟着超出屏幕并
     被横向裁切。改成 block + width:100% 后，宽度只由卡片自身决定。 */
  table.responsive { display: block; width: 100%; max-width: 100%; min-width: 0; }
  table.responsive thead { display: none; }
  table.responsive tbody,
  table.responsive tr,
  table.responsive td { display: block; width: auto; }

  table.responsive tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-fill);
    padding: var(--sp-3);
    margin-bottom: var(--sp-3);
  }
  table.responsive tr:last-child { margin-bottom: 0; }
  table.responsive td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: 5px 0;
    border-bottom: none;
    text-align: right;
    min-width: 0;
    /* 用 anywhere（而不是 break-word）：只有它会把长 URL / 无空格英文串的
       min-content 降到单字符，卡片才不会因一行超长文本被撑宽。 */
    overflow-wrap: anywhere;
  }
  /* 单元格里的第二行（浮盈亏百分比、已实现现金流明细）在卡片里另起一行右对齐。
     它们原本靠 <br> 换行，而 flex 容器会忽略 <br>，所以由 data-multiline 标记
     显式占满一行。只认这个标记：无行情时单元格里只有一个 .price-mute「-」，
     若按类名匹配会把整个单元格撑成两行高。 */
  table.responsive td[data-multiline] > .price-mute {
    flex: 0 0 100%;
    min-width: 0;
    text-align: right;
    font-size: 12px;
  }
  /* 时间列在卡片里独占一行：标签在上、多行时间在下（td 是 flex-wrap，
     100% 让时间块换行到标签下方），避免和「派单 / 完成 / 到期」挤在同一行。 */
  table.responsive td > .time-stack {
    flex: 1 1 100%;
    text-align: right;
  }
  table.responsive td > .badge { margin-left: auto; }
  /* 列名取自单元格自身的 data-label，无需重复维护表头。 */
  table.responsive td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--text-tertiary);
    font-size: 12px;
    text-align: left;
    white-space: nowrap;
  }

  /* 卡片标题行：主标的 + 状态徽章。 */
  table.responsive td[data-role="title"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    font-size: 16px;
    font-weight: 600;
    padding: 0 0 var(--sp-2);
    margin-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
  }
  table.responsive td[data-role="title"]::before { display: none; }
  /* 标题单元格里的副行（如宏观事件摘要）跟随标题左对齐——通用的
     data-multiline 规则把副行右对齐是为浮盈亏百分比这类数字设计的。 */
  table.responsive td[data-role="title"] > .price-mute { text-align: left; }

  /* 次要字段默认收起，点「详情」展开。 */
  table.responsive tr:not(.expanded) td[data-priority="low"] { display: none; }
  table.responsive td[data-priority="low"] { color: var(--text-secondary); font-size: 13px; }

  /* 操作区：整行铺开的按钮组。 */
  table.responsive td.actions {
    display: flex;
    flex-flow: row wrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-3) 0 0;
    margin-top: var(--sp-2);
    border-top: 1px solid var(--border);
  }
  table.responsive td.actions::before { display: none; }
  table.responsive td.actions .btn {
    flex: 1 1 calc(33% - var(--sp-2));
    min-height: 40px;
    min-width: 64px;
  }

  /* 「详情」开关独占一行，排在操作按钮之后。 */
  table.responsive td.row-more {
    display: block;
    padding: 0;
    border: none;
  }
  .row-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-1);
    width: 100%;
    min-height: 40px;
    margin-top: var(--sp-1);
    background: none;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
  }
  .row-toggle .chev {
    display: inline-block;
    transition: transform 0.2s ease;
  }
  table.responsive tr.expanded .row-toggle .chev { transform: rotate(180deg); }

  /* ---------- 趋势图 ---------- */
  .trend-svg { height: 132px; }

  /* ---------- 弹窗：全屏 + 底部操作条 ---------- */
  .modal-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
  }
  /* .modal-overlay + .modal-box 是另一套弹窗（股票管理 / 发起 AI 辩论）。
     此前 H5 只把 .modal-dialog 全屏，这两个弹层在窄屏上仍是居中浮层：
     内容一多就超出 80vh，勾选列表和语言说明会顶到屏幕外。这里统一成全屏
     可滚动布局，并给底部操作条留出安全区。 */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-box {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    padding: calc(var(--sp-3) + env(safe-area-inset-top)) var(--sp-3) var(--sp-3);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  /* 股票管理弹层没有 sticky 操作条，底部安全区直接由内容容器让位；
     AI 辩论弹层由 .modal-actions 自己带 safe-area，避免双倍留白。 */
  #stockManageOverlay .modal-box {
    padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  }
  .modal-box .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin-top: auto;
    padding-top: var(--sp-2);
    padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-wrap: wrap;
  }
  .modal-box .modal-actions .form-error { flex: 1 1 100%; min-height: 0; }
  .modal-box .modal-actions .btn { flex: 1 1 100%; min-height: 44px; }
  .modal-box .modal-header .btn { min-height: 44px; }
  .stock-manage-item .btn { min-height: 44px; }
  /* 全屏弹层里改由外层滚动，标的列表不再单独嵌套滚动，避免双滚动条。 */
  .llm-pick-list { max-height: none; }
  .llm-lang-row select { height: 44px; min-height: 44px; font-size: 16px; }
  .modal-dialog .modal-header,
  .modal-dialog form { padding: var(--sp-3); }
  .modal-dialog .modal-header {
    padding-top: calc(var(--sp-3) + env(safe-area-inset-top));
  }
  .modal-body { -webkit-overflow-scrolling: touch; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row label { margin-bottom: 4px; }
  .select-with-create { flex-direction: column; align-items: stretch; }
  .form-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg-elevated);
    padding: var(--sp-3) 0 calc(var(--sp-3) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    margin-top: var(--sp-3);
  }
  .form-actions .btn { flex: 1; min-height: 44px; }

  /* iOS 在聚焦字号小于 16px 的输入框时会自动放大整个页面。
     基础样式里 .form-row / .inline-create / .filter-group 等带类名的选择器
     把字号硬编码成 14px，权重高于元素选择器，这里必须用同等或更高的权重覆盖。 */
  input, select, textarea,
  .form-row input, .form-row select, .form-row textarea,
  .inline-create input, .select-with-create select,
  .filter-group select { font-size: 16px; }
  input[type="number"], input[type="text"], input[type="datetime-local"] { min-height: 44px; }

  .login-box { padding: var(--sp-5) var(--sp-4); margin: var(--sp-3); }
  .login-app-btn { min-height: 48px; }
}

/* ---------- 下拉刷新指示器 ---------- */
.pull-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 50%;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  color: var(--text-secondary);
  font-size: 12px;
  z-index: 300;
  transform: translate(-50%, -160%);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
}
/* Scoped to the mobile breakpoint so a stray .visible on a desktop viewport
   (e.g. after a resize that outruns the JS teardown) cannot surface it. */
@media (max-width: 768px) {
  .pull-indicator.visible {
    display: flex;
    transform: translate(-50%, 0);
    opacity: 1;
  }
}
.pull-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand-active);
  border-radius: 50%;
}
.pull-indicator.refreshing .pull-spinner { animation: pull-spin 0.7s linear infinite; }
@keyframes pull-spin { to { transform: rotate(360deg); } }

/* ===== LLM 结构化结论卡片（报告详情页） ===== */
.llm-digest-card {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 0.9rem;
}
.llm-digest-card.is-stale { border-left-color: #d9534f; }
.llm-digest-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.35rem; }
.llm-digest-title { font-weight: 600; margin-right: 0.2rem; }
.llm-digest-chips { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.llm-digest-chip {
  font-size: 0.78rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; white-space: nowrap;
}
.llm-digest-chip.chip-rating { border-color: var(--brand); font-weight: 600; }
.llm-digest-chip.chip-muted { opacity: 0.75; }
.llm-digest-chip.chip-stale { border-color: #d9534f; color: #d9534f; opacity: 1; }
.llm-digest-row { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.22rem 0; }
.llm-digest-label { flex: 0 0 5.2rem; display: inline-flex; align-items: center; gap: 0.28rem; color: var(--text-secondary); white-space: nowrap; }
.llm-digest-warn { color: var(--text-secondary); font-style: italic; }
.llm-digest-tranches { margin: 0; padding-left: 1.1rem; }
.llm-digest-tranches li { margin: 0.05rem 0; }
.llm-digest-caution {
  margin: 0.25rem 0 0.4rem; padding: 0.25rem 0.5rem; border-radius: 6px;
  background: rgba(217, 83, 79, 0.12); color: #d9534f; font-size: 0.82rem;
}
.llm-digest-foot { margin-top: 0.45rem; color: var(--text-secondary); font-size: 0.76rem; }

/* ===== LLM 决策简报（对标 TradingAgents Report QCOM 页） ===== */
.llm-brief-card {
  margin: 0 0 0.9rem; padding: 0.85rem 1rem;
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 10px; background: var(--bg-card); font-size: 0.9rem;
}
.brief-title { font-size: 1rem; margin: 0 0 0.3rem; line-height: 1.5; }
.brief-meta { color: var(--text-secondary); font-size: 0.8rem; margin-bottom: 0.5rem; }
.llm-digest-chips.brief-rating { margin-bottom: 0.6rem; }
.brief-price-list { border-top: 1px solid var(--border); margin-top: 0.4rem; }
.brief-price-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem;
  padding: 0.42rem 0; border-bottom: 1px solid var(--border);
}
.brief-price-label { color: var(--text-secondary); white-space: nowrap; }
.brief-price-val { text-align: right; font-variant-numeric: tabular-nums; }
.brief-pct { color: var(--text-secondary); font-size: 0.8rem; margin-left: 0.35rem; }
.brief-stop { color: var(--error); font-weight: 600; }
.brief-tip {
  display: inline-block; width: 1em; height: 1em; line-height: 1em; text-align: center;
  border: 1px solid var(--border-strong); border-radius: 50%;
  color: var(--text-tertiary); font-size: 0.7rem; cursor: help; margin-left: 0.15rem;
}
/* 价位阶梯：左低右高，百分比相对参考价。 */
.brief-ladder { margin: 0.7rem 0 0.4rem; }
.brief-ladder-note { color: var(--text-secondary); font-size: 0.78rem; margin-bottom: 1.6rem; }
.brief-ladder-track { position: relative; height: 4px; border-radius: 2px; background: var(--bg-fill); border: 1px solid var(--border); margin: 0 0.6rem 2.4rem; }
.brief-ladder-dot { position: absolute; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-tertiary); transform: translateX(-50%); }
.brief-ladder-dot.is-ref { background: var(--brand); }
.brief-ladder-dot.is-target { background: var(--success); }
.brief-ladder-dot.is-stop { background: var(--error); }
.brief-ladder-dot i {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-style: normal; font-size: 0.72rem; line-height: 1.4; white-space: nowrap;
  color: var(--text-secondary); text-align: center;
}
/* 分析师信号四格。 */
.brief-analyst-head { font-weight: 600; margin: 0.7rem 0 0.4rem; }
.brief-analyst-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.brief-analyst { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.6rem; background: var(--bg-fill); }
.brief-analyst-name { display: flex; align-items: center; gap: 0.3rem; font-weight: 600; font-size: 0.82rem; margin-bottom: 0.2rem; }
.brief-analyst-name .icn { color: var(--text-secondary); }
.brief-analyst-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; }
.brief-analyst-note { margin-top: 0.4rem; color: var(--text-tertiary); font-size: 0.78rem; line-height: 1.6; }
.brief-hint { color: var(--text-secondary); font-size: 0.8rem; margin: 0.5rem 0 0; }
/* 报告两栏：左侧阶段目录 + 右侧正文。窄屏堆叠。 */
.brief-view-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.report-layout { display: flex; gap: 0.9rem; align-items: flex-start; }
.report-toc { flex: 0 0 12.5rem; position: sticky; top: 0; max-height: 70vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; background: var(--bg-fill); }
.toc-head { padding: 0.15rem 0.3rem 0.5rem; margin-bottom: 0.45rem; border-bottom: 1px solid var(--border); }
.toc-title { font-size: 0.82rem; font-weight: 600; }
.toc-hint { margin-top: 0.15rem; font-size: 0.68rem; line-height: 1.5; color: var(--text-tertiary); }
.toc-group + .toc-group { margin-top: 0.6rem; }
.toc-stage { display: flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.25rem; padding-left: 0.15rem; }
.toc-num {
  flex: 0 0 auto; min-width: 1.05rem; height: 1.05rem; padding: 0 0.2rem;
  border-radius: 999px; background: var(--bg-card); color: var(--text-secondary);
  font-size: 0.66rem; font-weight: 600; line-height: 1.05rem; text-align: center;
}
.toc-stage-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-item {
  display: flex; align-items: center; gap: 0.4rem; width: 100%; text-align: left;
  padding: 0.28rem 0.45rem 0.28rem 1.1rem;
  border: none; border-radius: 6px; background: transparent; color: var(--text-primary);
  font-size: 0.83rem; cursor: pointer;
}
.toc-item .icn { color: var(--text-tertiary); }
.toc-item.active .icn { color: var(--brand-active); }
.toc-item-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-item.active { background: var(--bg-card-hover); font-weight: 600; }
.report-content { flex: 1; min-width: 0; }
.brief-chap-meta { color: var(--text-secondary); font-size: 0.78rem; margin-bottom: 0.15rem; }
.brief-snapshot-note { color: var(--text-tertiary); font-size: 0.76rem; margin-bottom: 0.5rem; }
.brief-next { margin-top: 0.8rem; }

/* ===== 报告页内嵌技术图表（手写 SVG，无图表库） ===== */
.report-charts { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.1rem; max-width: 780px; }
.report-chart-note {
  margin-bottom: 1.1rem; padding: 0.6rem 0.7rem;
  border: 1px dashed var(--border); border-radius: 8px;
  color: var(--text-tertiary); font-size: 0.78rem; line-height: 1.6;
  background: var(--bg-fill); max-width: 780px;
}
.report-chart {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.6rem 0.7rem 0.5rem; background: var(--bg-fill);
}
.report-chart-head h4 { margin: 0 0 0.35rem; font-size: 0.86rem; font-weight: 600; }
.report-chart-canvas { position: relative; }
.report-chart-svg { display: block; width: 100%; height: auto; }
.report-chart-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; margin-top: 0.4rem; }
.chart-legend-item {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.12rem 0.45rem; border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-secondary);
  font-size: 0.74rem; line-height: 1.5; cursor: pointer;
}
.chart-legend-item:hover { background: var(--bg-card-hover); }
.chart-legend-item i { width: 0.6rem; height: 0.6rem; border-radius: 2px; flex: 0 0 auto; }
.chart-legend-item.is-off { opacity: 0.42; text-decoration: line-through; }
.report-chart-caption { margin-top: 0.45rem; color: var(--text-tertiary); font-size: 0.74rem; line-height: 1.6; }
.rc-grid { stroke: var(--border); stroke-width: 1; }
.rc-ytick, .rc-xtick, .rc-bandlabel { fill: var(--text-tertiary); font-size: 10px; }
.rc-band { stroke: var(--text-tertiary); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.chart-crosshair { stroke: var(--text-tertiary); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart-tip {
  position: absolute; top: 4px; transform: translateX(-50%); min-width: 8.5rem;
  padding: 0.35rem 0.45rem; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg-elevated); box-shadow: var(--shadow-md);
  font-size: 0.72rem; line-height: 1.5; pointer-events: none; z-index: 2;
}
.chart-tip-date { color: var(--text-secondary); margin-bottom: 0.2rem; }
.chart-tip-row { display: flex; align-items: center; gap: 0.3rem; }
.chart-tip-row i { width: 0.55rem; height: 0.55rem; border-radius: 2px; flex: 0 0 auto; }
.chart-tip-row span { color: var(--text-secondary); }
.chart-tip-row b { margin-left: auto; font-weight: 600; }
@media (max-width: 768px) {
  .report-layout { flex-direction: column; }
  .report-toc { flex: none; width: 100%; position: static; max-height: none; }
  .brief-analyst-grid { grid-template-columns: 1fr; }
}

/* ===== 研究报告独立页 ===== */
.report-page-head {
  display: flex; gap: 0.6rem; align-items: flex-start;
  margin-bottom: 0.9rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--border);
}
.report-page-titles { min-width: 0; }
.report-page-titles h2 { margin: 0 0 0.15rem; font-size: 1.05rem; line-height: 1.4; }
.report-page-titles .modal-hint { margin: 0; }
