/* ═══════════════════════════════════════════════════════
   独狼量化 · 大盘状态预警机 V4 前端样式表 (整合完全体)
   ═══════════════════════════════════════════════════════ */

/* ─── 变量 ─── */
:root {
  --bg-primary: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --bg-sub: #21262d;
  --border: #30363d;
  --border-highlight: #58a6ff;
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --green: #2ea043;
  --green-dim: rgba(46, 160, 67, 0.15);
  --red: #f85149;
  --red-dim: rgba(248, 81, 73, 0.15);
  --yellow: #d29922;
  --yellow-dim: rgba(210, 153, 34, 0.15);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.15);
  --blue: #58a6ff;
  --blue-dim: rgba(88, 166, 255, 0.12);
  --muted: #d4e3ec;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 4px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── 全局 ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding: 4px 14px 0 14px; /* 极限压缩 body 边距 */
  overflow-x: hidden;
}

/* ─── 顶部状态栏 ─── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 16px; /* 压缩顶栏上下 padding 至 4px */
  background: linear-gradient(180deg, #161b22 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 6px; /* 压缩底 margin 至 6px */
  backdrop-filter: blur(8px);
}

.top-bar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.top-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(33, 38, 45, 0.78);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.top-nav__link:hover,
.top-nav__link.active {
  background: var(--blue-dim);
  border-color: rgba(88, 166, 255, 0.55);
  color: #ffffff;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #58a6ff, #1f6feb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.badge {
  background-color: var(--bg-sub);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}

.top-bar__center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 360px;
  justify-content: center;
}

.top-bar__date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 2px 8px;
  background: var(--bg-sub);
  border-radius: 20px;
  border: 1px solid var(--border);
}

.top-bar__right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

/* 标的切换下拉框 */
.selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.selector-label {
  font-size: 12px;
  color: var(--text-secondary);
}

select {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  font-family: 'Outfit', sans-serif;
  transition: border-color 0.2s;
}

select:focus {
  border-color: var(--blue);
}

/* 仓位圆环 */
.ceiling-ring {
  position: relative;
  width: 44px;
  height: 44px;
}
.ceiling-ring svg { transform: rotate(-90deg); }
.ceiling-ring__bg { fill: none; stroke: var(--border); stroke-width: 4; }
.ceiling-ring__fill { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ceiling-ring__label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

/* ─── 复合主工作区 ─── */
.workspace-grid {
  display: grid;
  grid-template-columns: 1200px 1fr; /* 左侧图表区精确锁定 1200px (对应物理宽约 33cm)，右侧看板自适应拉伸 */
  gap: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.workspace-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* K线与三副图区域 */
.chart-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.chart-ticker {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-price {
  font-size: 14px;
  font-weight: 700;
}

.chart-change {
  font-size: 12px;
  font-weight: 600;
}

.price-up { color: var(--green); }
.price-down { color: var(--red); }

.chart-container-multi {
  display: flex;
  flex-direction: column;
  height: 553px; /* 非全屏加高 73 像素以优化显示，原为 480px */
  width: 100%;
}

.chart-container-multi.solo-mode {
  height: 620px; /* 降低 120 像素，原为 740px */
}

/* F11 全屏自适应：当可见视口高度超过 1000px 时自动把图表区高度加高，降低 120 像素，原为 740px */
@media (min-height: 1000px) {
  .chart-container-multi {
    height: 620px !important;
  }
}

#pane-kline {
  flex: 1; /* 主图自适应伸缩 */
  min-height: 200px;
}

#pane-vol, #pane-akdj, #pane-flow {
  height: 75px; /* 从 100px 减小至 75px，实现等比例缩放 */
  flex-shrink: 0;
}

.chart-pane {
  position: relative;
  width: 100%;
  background-color: #000000;
  border-bottom: 1px solid var(--border);
}

.chart-pane:last-child {
  border-bottom: none;
}

/* 面板内部文字小标题 */
.pane-title {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  z-index: 5;
  pointer-events: none;
  font-family: 'Outfit', sans-serif;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-title__text {
  color: var(--text-primary);
  font-weight: 800;
  margin-right: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 3px;
  background-color: var(--bg-sub);
}

.pane-legend {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: bold; /* 加粗 */
  color: #ffffff; /* 变白色 */
}

.pane-expand-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  cursor: pointer;
  z-index: 6;
  transition: var(--transition);
}

.pane-expand-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background-color: var(--blue-dim);
}

.chart-pane.expanded {
  height: 240px !important; /* 降低放大后的高度以适配首屏高度约束 */
}

.ma-legend {
  display: flex;
  flex-direction: column; /* 强制纵向排列以分 2 行 */
  gap: 10px;
  padding: 6px 8px;
  background-color: #000000;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.ma-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ma-legend__label {
  font-weight: 600;
}

.ma-legend__val {
  font-weight: 700;
}

/* 开关控制按钮条 (对齐老前端) */
.chart-controls {
  display: flex;
  gap: 6px;
  margin-top: 4px; /* 压缩间距 */
  padding-top: 4px; /* 压缩内边距 */
  border-top: 1px solid var(--border);
}

.toggle-btn {
  background-color: var(--bg-sub);
  border: 1px solid var(--border);
  color: #ffffff; /* 灰色变为白色 */
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10.5px;
  font-family: 'Outfit', sans-serif;
  font-weight: bold; /* 加粗 */
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.toggle-btn.active {
  background-color: var(--blue-dim);
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 6px rgba(88,166,255,0.15);
}

/* 周期切换按钮：使用绿色高亮区分 */
.toggle-btn.period.active {
  background-color: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 6px rgba(46,160,67,0.2);
}

/* 按钮组分隔符 */
.btn-separator {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 26px;
  user-select: none;
  padding: 0 2px;
}

/* AI判断灯 */
.ai-lamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--text-muted);
  background: var(--bg-sub);
  border: 1px solid var(--border);
  cursor: default;
  transition: var(--transition);
}

.ai-lamp--buy {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(46,160,67,0.3);
}

.ai-lamp--warn {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 8px rgba(248,81,73,0.3);
}

.ai-lamp--off {
  background: var(--bg-sub);
  color: var(--text-muted);
  border-color: var(--border);
}

/* action 按钮（操作类，非 toggle） */
.toggle-btn.action-btn {
  color: #ffffff; /* 灰色变为白色 */
  font-weight: bold; /* 加粗 */
  border-style: dashed;
}

.toggle-btn.action-btn:hover {
  color: var(--yellow);
  border-color: var(--yellow);
}

/* 按钮栏支持换行 */
.chart-controls {
  flex-wrap: wrap;
}

/* 游标控制条 */
.cursor-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px; /* 压缩纵向 padding */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cursor-bar--daily {
  margin-top: 6px;
  padding: 4px 12px;
  background: #111820;
}

.cursor-bar__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cursor-bar input[type="range"] {
  flex: 1;
  accent-color: var(--blue);
  cursor: pointer;
}

.ctrl-btn {
  background: var(--bg-sub);
  border: 1px solid var(--border);
  color: #ffffff; /* 灰色/普通变为白色 */
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-family: 'Outfit', sans-serif;
  font-weight: bold; /* 加粗 */
  transition: var(--transition);
}

.ctrl-btn:hover {
  background: var(--border);
  border-color: #ffffff; /* 边框变白色 */
}

.ctrl-btn.playing {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
}

/* 右侧：PyQt 非对称大色块卡片看板 */
.workspace-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 报价条 */
.quote-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quote-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.quote-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.quote-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
}

.quote-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: auto;
}

.quote-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.quote-details b {
  color: var(--text-primary);
}

.automation-health-panel {
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.96), rgba(13, 17, 23, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.automation-health-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.automation-health-panel__eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--blue);
  letter-spacing: 0.6px;
}

.automation-health-panel h2 {
  margin: 1px 0 0;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text-primary);
}

.automation-health-panel__badge {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-sub);
}

.automation-health-panel__badge.is-ok {
  color: #7ee787;
  border-color: rgba(46, 160, 67, 0.85);
  background: rgba(46, 160, 67, 0.14);
}

.automation-health-panel__badge.is-error {
  color: #ff8b8b;
  border-color: rgba(248, 81, 73, 0.85);
  background: rgba(248, 81, 73, 0.14);
}

.automation-health-panel__badge.is-loading {
  color: #f3c969;
  border-color: rgba(210, 153, 34, 0.8);
  background: rgba(210, 153, 34, 0.12);
}

.automation-health-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.automation-health-panel__grid div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(48, 54, 61, 0.8);
  border-radius: 6px;
  background: rgba(33, 38, 45, 0.62);
}

.automation-health-panel__grid span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

.automation-health-panel__grid b {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-health-panel__note {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

/* 大色块卡片容器 */
.color-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.color-panel {
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 173px; /* 96px * 1.8 = 172.8px */
  box-shadow: var(--shadow);
  font-family: "SimHei", "STHeiti", "Microsoft YaHei", sans-serif;
  font-weight: bold;
}

.color-panel:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 10px rgba(255,255,255,0.06);
}

.panel-header {
  font-size: 19px; /* 10.5px * 1.8 = 18.9px */
  font-weight: bold;
  letter-spacing: 0.5px;
  opacity: 0.8;
  text-transform: uppercase;
}

.panel-main-val {
  font-size: 24.3px; /* 13.5px * 1.8 = 24.3px */
  font-weight: bold;
  line-height: 1.25;
}

.panel-desc {
  font-size: 18px; /* 10px * 1.8 = 18px */
  opacity: 0.7;
  line-height: 1.35;
}

/* 对齐老前端颜色配置 */
.panel-blue {
  background: linear-gradient(135deg, #1f6feb 0%, #161b22 100%);
  color: #f0f6fc;
  border-color: #388bfd;
}

.panel-dark {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}
.panel-dark .panel-main-val {
  color: var(--text-primary);
}

.panel-orange {
  background: linear-gradient(135deg, #b17a0b 0%, #161b22 100%);
  color: #f0f6fc;
  border-color: #d29922;
}

.panel-green {
  background: linear-gradient(135deg, #1b7a30 0%, #161b22 100%);
  color: #f0f6fc;
  border-color: #2ea043;
}

.legacy-lamp-panel {
  margin-top: 12px;
  background: #10161d;
  border: 1px solid #30363d;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: #ffffff;
  font-family: "JetBrains Mono", "Microsoft YaHei", monospace;
}

.legacy-lamp-panel__title {
  padding: 10px 12px;
  border-bottom: 1px solid #30363d;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
}

.legacy-lamp-panel__body {
  margin: 0;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.58;
  white-space: pre-wrap;
}

.tactical-panel {
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.11), rgba(22, 27, 34, 0.94) 46%),
    var(--bg-card);
  border: 1px solid rgba(88, 166, 255, 0.26);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tactical-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tactical-panel__eyebrow {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tactical-panel__title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.tactical-panel__badge {
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  background: rgba(139, 148, 158, 0.08);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 7px;
  white-space: nowrap;
}

.tactical-panel__badge.is-buy {
  color: #3fb950;
  border-color: rgba(63, 185, 80, 0.55);
  background: rgba(63, 185, 80, 0.12);
}

.tactical-panel__badge.is-risk {
  color: #ff7b72;
  border-color: rgba(255, 123, 114, 0.58);
  background: rgba(248, 81, 73, 0.13);
}

.tactical-panel__badge.is-watch {
  color: #d29922;
  border-color: rgba(210, 153, 34, 0.56);
  background: rgba(210, 153, 34, 0.11);
}

.tactical-panel__summary {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.tactical-signal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tactical-chip {
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 4px;
  color: var(--text-secondary);
  background: rgba(139, 148, 158, 0.08);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 6px;
}

.tactical-chip.is-hot {
  color: #39ff88;
  border-color: rgba(57, 255, 136, 0.5);
  background: rgba(46, 160, 67, 0.18);
}

.tactical-chip.is-warn {
  color: #ffcc66;
  border-color: rgba(255, 204, 102, 0.48);
  background: rgba(210, 153, 34, 0.16);
}

.tactical-chip.is-danger {
  color: #ff7b72;
  border-color: rgba(255, 123, 114, 0.52);
  background: rgba(248, 81, 73, 0.16);
}

.tactical-chip.is-muted {
  color: #8b949e;
}

.tactical-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tactical-levels div {
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 4px;
  padding: 6px 7px;
}

.tactical-levels span {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  margin-bottom: 3px;
}

.tactical-levels b {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.tactical-panel__note {
  color: var(--text-secondary);
  border-top: 1px solid rgba(139, 148, 158, 0.16);
  padding-top: 7px;
  font-size: 11px;
  line-height: 1.35;
}

/* ─── 下部白箱层 (一半宽度居中排版已改为左对齐) ─── */
.detail-container {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 14px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, #080b0f 100%);
}

.detail-header-bar {
  max-width: 100%;
  margin: 0 0 18px 0; /* 靠左显示，间距放大为 18px */
  padding: 0 15px;
}

.detail-header-bar h2 {
  font-size: 21px; /* 14px * 1.5 = 21px */
  font-weight: bold;
  color: #ffffff; /* 灰色改为白色 */
  border-left: 4.5px solid var(--blue); /* 3px * 1.5 = 4.5px */
  padding-left: 12px; /* 8px * 1.5 = 12px */
}

.main {
  max-width: 100%; /* 取消限宽 */
  margin: 0;  /* 靠左对齐 */
  padding: 0 15px 120px; /* 80px * 1.5 = 120px */
}

/* ─── 层级折叠面板 ─── */
.layer {
  margin-bottom: 15px; /* 10px * 1.5 = 15px */
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow);
}
.layer:hover {
  border-color: #3d444d;
}

.layer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 24px; /* 10px 16px * 1.5 = 15px 24px */
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
}
.layer__header:hover {
  background: var(--bg-card-hover);
}

.layer__title {
  display: flex;
  align-items: center;
  gap: 12px; /* 8px * 1.5 = 12px */
  font-size: 19.5px; /* 13px * 1.5 = 19.5px */
  font-weight: bold; /* 加粗 */
  color: #ffffff; /* 确保为白色 */
}
.layer__icon {
  font-size: 22.5px; /* 15px * 1.5 = 22.5px */
  width: 30px; /* 20px * 1.5 = 30px */
  text-align: center;
}
.layer__badge {
  font-size: 14.25px; /* 9.5px * 1.5 = 14.25px */
  padding: 2px 9px; /* 1px 6px * 1.5 = 1.5px 9px */
  border-radius: 15px; /* 10px * 1.5 = 15px */
  font-weight: bold;
  font-family: 'JetBrains Mono', monospace;
}

.layer__chevron {
  font-size: 16.5px; /* 11px * 1.5 = 16.5px */
  color: #ffffff; /* 灰色变为白色 */
  font-weight: bold;
  transition: transform 0.3s ease;
}
.layer.collapsed .layer__chevron {
  transform: rotate(-90deg);
}

.layer__body {
  padding: 18px 24px; /* 12px 16px * 1.5 = 18px 24px */
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
}
.layer.collapsed .layer__body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-color: transparent;
}

/* ─── 子区块 ─── */
.sub-section {
  margin-bottom: 15px; /* 10px * 1.5 = 15px */
  padding: 12px 18px; /* 8px 12px * 1.5 = 12px 18px */
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.sub-section:last-child { margin-bottom: 0; }

.sub-section__title {
  font-size: 17.25px; /* 11.5px * 1.5 = 17.25px */
  font-weight: bold; /* 加粗 */
  color: #ffffff; /* 灰色变为白色 */
  margin-bottom: 9px; /* 6px * 1.5 = 9px */
  display: flex;
  align-items: center;
  gap: 9px; /* 6px * 1.5 = 9px */
}

/* ─── KV 行 ─── */
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0; /* 4px * 1.5 = 6px */
  border-bottom: 1px solid rgba(48,54,61,0.3);
  font-size: 18px; /* 12px * 1.5 = 18px */
  font-weight: bold; /* 全局加粗 */
}
.kv-row:last-child { border-bottom: none; }

.kv-row__key {
  color: #ffffff; /* 灰色变为白色 */
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px; /* 4px * 1.5 = 6px */
}
.kv-row__cn {
  color: #ffffff; /* 确保为白色 */
  font-size: 18px; /* 12px * 1.5 = 18px */
  font-weight: bold;
}
.kv-row__en {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px; /* 10px * 1.5 = 15px */
  color: #ffffff; /* 灰色/暗色变白色 */
  font-weight: bold;
}
.kv-row__value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold; /* 加粗 */
  color: #ffffff; /* 确保为白色 */
}

/* ─── 布尔值 ─── */
.bool-true { color: var(--green); }
.bool-false { color: var(--red); opacity: 0.55; }

/* ─── 状态标签 ─── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
}
.tag--green { background: var(--green-dim); color: var(--green); }
.tag--red { background: var(--red-dim); color: var(--red); }
.tag--yellow { background: var(--yellow-dim); color: var(--yellow); }
.tag--orange { background: var(--orange-dim); color: var(--orange); }
.tag--blue { background: var(--blue-dim); color: var(--blue); }
.tag--muted { background: rgba(107,114,128,0.15); color: var(--muted); }

/* ─── 风险仪表 ─── */
.risk-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}
.risk-gauge__bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

/* 浮动工具条 (Tooltip) */
.kline-tooltip {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  background-color: rgba(22, 27, 34, 0.75);
  border: 1px solid rgba(88, 166, 255, 0.3); /* 增加略微亮蓝的边框进行区分 */
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: bold;
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  line-height: 1.6;
  width: 140px; /* 固定宽度，防止撑满整个横向区间 */
}
.risk-gauge__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.risk-gauge__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  min-width: 30px;
  text-align: right;
}

/* ─── 理由列表 ─── */
.reason-list {
  list-style: none;
  padding: 0;
}
.reason-list li {
  padding: 3px 0 3px 18px; /* 2px 0 2px 12px * 1.5 = 3px 0 3px 18px */
  position: relative;
  font-size: 18px; /* 12px * 1.5 = 18px */
  color: #ffffff; /* 灰色变为白色 */
  font-weight: bold; /* 加粗 */
  line-height: 1.45;
}
.reason-list li::before {
  content: '›';
  position: absolute;
  left: 3px; /* 2px * 1.5 = 3px */
  color: #ffffff; /* 灰色变为白色 */
  font-weight: bold; /* 加粗 */
}

/* ─── 标签云 ─── */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag-cloud .tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  padding: 1px 5px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ─── 链路图 ─── */
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 0;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 90;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.5);
}
.pipeline__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 4px 8px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  line-height: 1.2;
}
.pipeline__node:hover {
  border-color: var(--blue);
  background: var(--bg-card-hover);
}
.pipeline__node--active {
  border-color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 8px rgba(46,160,67,0.18);
  color: var(--text-primary);
}
.pipeline__node-icon { font-size: 13px; margin-bottom: 1px; }
.pipeline__node-label { font-size: 9px; color: var(--text-secondary); }

.pipeline__arrow {
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 3px;
  flex-shrink: 0;
}

/* ─── 加载状态 ─── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  gap: 10px;
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ─── 错误状态 ─── */
.error-box {
  padding: 12px 16px;
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 12.5px;
}

/* ─── 响应式 ─── */
@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .top-bar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .top-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .top-bar__center {
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .cursor-bar { flex-wrap: wrap; }
  .pipeline__arrow { display: none; }
  .pipeline { padding: 8px 0; }
  .pipeline__node { min-width: 76px; padding: 3px; font-size: 9px; }
}

/* ─── 底部双栏布局样式 ─── */
.bottom-grid {
  display: grid;
  grid-template-columns: 900px 1fr; /* 从 1200px 缩小 1/4 至 900px (缩窄 300px/约 8.2cm) */
  gap: 14px;
  margin-top: 20px;
  margin-bottom: 50px;
}

.bottom-grid .detail-container {
  max-width: 100% !important;
  margin: 0 !important;
}

.market-overview-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
  color: #ffffff;
}

.overview-header h3 {
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  letter-spacing: 0;
}

.section-title {
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}

/* ETF 栅格布局 */
.etf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.etf-item {
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px; /* 2px * 1.5 = 3px */
  align-items: center;
  transition: var(--transition);
}

.etf-item:hover {
  background: var(--bg-card-hover);
  border-color: #ffffff; /* 边框变白色 */
}

.etf-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 900;
}

.etf-name {
  font-size: 13px;
  color: #ffffff;
  font-weight: 900;
}

.etf-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 900;
}

/* 颜色分级 */
.rank-up, .item-up {
  border-left: 3px solid var(--green) !important; /* 2px * 1.5 = 3px */
}
.rank-up .etf-change, .rank-up .leader-change, .item-up .macro-pct {
  color: var(--green);
  font-weight: bold;
}

.rank-down, .item-down {
  border-left: 3px solid var(--red) !important; /* 2px * 1.5 = 3px */
}
.rank-down .etf-change, .rank-down .leader-change, .item-down .macro-pct {
  color: var(--red);
  font-weight: bold;
}

.rank-flat, .item-flat {
  border-left: 3px solid var(--muted) !important; /* 2px * 1.5 = 3px */
}
.rank-flat .etf-change {
  color: #ffffff; /* 灰色变为白色 */
  font-weight: bold;
}

.item-warn {
  border-left: 3px solid var(--orange) !important; /* 2px * 1.5 = 3px */
}
.item-warn .macro-pct {
  color: var(--orange);
  font-weight: bold;
}

/* 宏观资产样式 */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.macro-item {
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px; /* 2px * 1.5 = 3px */
  transition: var(--transition);
}

.macro-name {
  font-size: 14px;
  color: #ffffff;
  font-weight: 900;
}

.macro-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 900;
}

.macro-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 900;
}

/* 科技龙头列表样式 */
.leaders-list {
  display: flex;
  flex-direction: column;
  gap: 9px; /* 6px * 1.5 = 9px */
}

.leader-row {
  display: flex;
  align-items: center;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: 9px; /* 6px * 1.5 = 9px */
  padding: 9px 18px; /* 6px 12px * 1.5 = 9px 18px */
  transition: var(--transition);
}

.leader-row:hover {
  background: var(--bg-card-hover);
  border-color: #ffffff; /* 鼠标悬浮变白边框 */
}

.leader-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16.5px; /* 11px * 1.5 = 16.5px */
  font-weight: bold;
  width: 75px; /* 50px * 1.5 = 75px */
}

.leader-name {
  font-size: 16px; /* 10.5px * 1.5 = 15.75px */
  color: #ffffff; /* 灰色变为白色 */
  flex: 1;
  font-weight: bold; /* 加粗 */
}

.leader-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16.5px; /* 11px * 1.5 = 16.5px */
  font-weight: bold;
}

/* 24 个边缘行业板块列表：仅替换原 NASDAQ Leaders 红圈区域 */
.edge-sector-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.edge-sector-loading {
  grid-column: 1 / -1;
  padding: 12px 14px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.edge-sector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 52px 58px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  transition: var(--transition);
}

.edge-sector-row:hover {
  background: var(--bg-card-hover);
  border-color: #ffffff;
}

.edge-sector-row.rank-up {
  border-left-color: var(--green) !important;
}

.edge-sector-row.rank-down {
  border-left-color: var(--red) !important;
}

.edge-sector-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.edge-sector-name {
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edge-sector-code {
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.1;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edge-sector-change,
.edge-sector-ceiling,
.edge-sector-freshness {
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.edge-sector-row.rank-up .edge-sector-change {
  color: var(--green);
}

.edge-sector-row.rank-down .edge-sector-change {
  color: var(--red);
}

.edge-sector-ceiling {
  font-size: 12px;
  opacity: 0.96;
}

.edge-sector-freshness {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 21px;
  border-radius: 5px;
  font-size: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.edge-sector-freshness.is-fresh {
  color: var(--green);
  border-color: rgba(0, 255, 127, 0.35);
  background: rgba(0, 255, 127, 0.08);
}

.edge-sector-freshness.is-stale {
  color: var(--red);
  border-color: rgba(255, 80, 96, 0.4);
  background: rgba(255, 80, 96, 0.09);
}

@media (max-width: 1280px) {
  .edge-sector-list {
    grid-template-columns: 1fr;
  }
}

/* ─── 跨周期回测 Modal 弹窗样式 ─── */
#backtestModal {
  display: none; 
  position: fixed; 
  z-index: 2000; 
  left: 0; 
  top: 0; 
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgba(0, 0, 0, 0.85); 
  backdrop-filter: blur(8px); 
  justify-content: center; 
  align-items: center;
}

#backtestModal.show {
  display: flex !important;
}

#backtestModal .modal-content {
  background-color: var(--bg-main); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  width: 92%; 
  max-width: 1400px; 
  padding: 24px; 
  position: relative; 
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

#backtestModal .close-btn {
  position: absolute; 
  right: 20px; 
  top: 15px; 
  color: #aaa; 
  font-size: 28px; 
  font-weight: bold; 
  cursor: pointer; 
  transition: color 0.2s;
}

#backtestModal .close-btn:hover {
  color: #ffffff;
}

/* ─── 性能回测对比 Modal 弹窗样式 ─── */
#perfBacktestModal {
  display: none; 
  position: fixed; 
  z-index: 2000; 
  left: 0; 
  top: 0; 
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgba(0, 0, 0, 0.85); 
  backdrop-filter: blur(8px); 
  justify-content: center; 
  align-items: center;
}

#perfBacktestModal.show {
  display: flex !important;
}

#perfBacktestModal .modal-content {
  background-color: var(--bg-main); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  padding: 24px; 
  position: relative; 
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: modalFadeIn 0.3s ease;
}

#perfBacktestModal .close-btn {
  position: absolute; 
  right: 20px; 
  top: 15px; 
  color: #aaa; 
  font-size: 28px; 
  font-weight: bold; 
  cursor: pointer; 
  transition: color 0.2s;
}

#perfBacktestModal .close-btn:hover {
  color: #ffffff;
}
/* ─── 人工审计 / 穿越环境 Modal ─── */
#reviewModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

#reviewModal.show {
  display: flex;
}

#reviewModal .review-modal-content {
  width: min(1120px, 94vw);
  max-height: 88vh;
  overflow: auto;
  background: #111820;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  padding: 18px;
  position: relative;
}

#reviewModal .close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

#reviewModal .close-btn:hover {
  color: var(--text);
}

#reviewModal h2 {
  margin: 0 36px 14px 0;
  color: var(--cyan);
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.review-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.review-panel-wide {
  grid-column: 1 / -1;
}

.review-mini-chart {
  width: 100%;
  height: 280px;
  min-height: 280px;
}

.review-panel h3 {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 14px;
}

.review-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 10px;
  font-size: 12px;
}

.review-kv span:nth-child(odd) {
  color: var(--muted);
}

.review-kv span:nth-child(even) {
  color: var(--text);
  word-break: break-word;
}

.review-reasons {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.review-json {
  white-space: pre-wrap;
  font: 12px/1.45 Consolas, monospace;
  color: #c9d7e8;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 6px;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
}

.review-textarea {
  width: 100%;
  min-height: 64px;
  margin-top: 10px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 8px;
  font: 12px/1.45 Consolas, monospace;
}

.review-save-btn {
  margin-top: 10px;
}

.review-save-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.review-table-wrap {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  font: 12px/1.4 Consolas, monospace;
  color: var(--text);
}

.review-table th,
.review-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

.review-table th {
  position: sticky;
  top: 0;
  background: #111827;
  color: var(--orange);
  z-index: 1;
}

.review-table tr.is-today td {
  background: rgba(210, 153, 34, 0.22);
  color: #fff;
}
