/* ==========================================================================
   梯形资金水池 · 高端量化金融终端设计系统 (Quant Dark System)
   Inspired by TradingView, Linear, Raycast, and Shadcn/Tremor.
   ========================================================================== */

:root {
  /* 基础暗黑配色：深邃玄黑蓝，克制内敛 */
  --bg: #090a0f;
  --bg-sidebar: #0e0f16;
  --bg-card: #13141d;
  --bg-card-hover: #171924;
  --bg-card-subtle: rgba(255, 255, 255, 0.02);
  --bg-surface: #1a1c28;
  
  /* 精致发丝微光边框 */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(255, 255, 255, 0.2);
  
  /* 排版文字层级 */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-dim: #475569;
  
  /* 量化语义色彩 (A股进出池红进绿出，场外天青，沉淀金黄) */
  --up: #f43f5e;           /* 进池/上涨: 玫瑰红 */
  --up-glow: rgba(244, 63, 94, 0.16);
  --dn: #10b981;           /* 出池/下跌: 翡翠绿 */
  --dn-glow: rgba(16, 185, 129, 0.16);
  --off: #38bdf8;          /* 场外资金: 天青蓝 */
  --off-glow: rgba(56, 189, 248, 0.16);
  --gold: #fbbf24;         /* 新进存量/预警: 琥珀金 */
  --gold-glow: rgba(251, 191, 36, 0.16);
  --accent: #6366f1;       /* 交互强调: 靛紫 */
  
  /* 圆角与阴影 */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.6);
  --shadow-lg: 0 16px 36px rgba(0,0,0,0.75);

  /* 字体族：系统最高级抗锯齿字体，数字严格等宽 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --side-w: 236px;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text-main); font-family: var(--font-sans); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* 主程序视口 */
body.app {
  height: 100vh;
  display: flex;
  background: var(--bg);
  background-image: 
    radial-gradient(1200px 700px at 15% -10%, rgba(56, 189, 248, 0.05), transparent 70%),
    radial-gradient(1000px 600px at 85% 100%, rgba(244, 63, 94, 0.04), transparent 60%);
  overflow: hidden;
}
body.app.scroll { height: auto; min-height: 100vh; overflow: auto; }
body.app.scroll .workspace { min-height: 100vh; }

/* ==========================================================================
   现代化侧边栏 (High-end Fintech Sidebar)
   ========================================================================== */
.side {
  width: var(--side-w);
  flex: none;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  user-select: none;
  z-index: 30;
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(244, 63, 94, 0.25));
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}
.brand-avatar svg { width: 20px; height: 20px; }
.brand-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: #fff;
  font-family: var(--font-mono);
}
.brand-text small {
  display: block;
  margin-top: 1px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
}
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 16px; }
.nav-label {
  margin: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.16s ease;
  position: relative;
}
.nav a .nav-ic { width: 16px; height: 16px; flex: none; stroke: currentColor; opacity: 0.75; transition: all 0.15s; }
.nav a span { flex: 1; }
.nav a .nav-arrow { font-size: 14px; color: var(--text-dim); opacity: 0; transform: translateX(-4px); transition: all 0.15s; font-style: normal; }
.nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}
.nav a:hover .nav-ic { opacity: 1; stroke: #38bdf8; }
.nav a:hover .nav-arrow { opacity: 1; transform: translateX(0); }
.nav a.active {
  background: rgba(56, 189, 248, 0.1);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.12);
}
.nav a.active .nav-ic { opacity: 1; stroke: #38bdf8; }
.side-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--border);
}
.foot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.foot-desc { margin-top: 4px; font-size: 11px; color: var(--text-dim); line-height: 1.45; }

/* 工作台主区 */
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

/* 顶栏控制条 */
.top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 15, 22, 0.7);
  backdrop-filter: blur(16px);
  z-index: 20;
}
.titles h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.titles p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 现代 HUD 状态指标带 */
.hud-bar {
  flex: none;
  padding: 9px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(19, 20, 29, 0.6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}
.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.hud-chip .lbl { color: var(--text-faint); font-size: 11px; font-weight: 500; }
.hud-chip .val { font-weight: 650; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hud-chip.active { background: rgba(56, 189, 248, 0.08); border-color: rgba(56, 189, 248, 0.25); color: #fff; }

/* 画布主工作区 */
.stage {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 16px;
  gap: 12px;
}
.stage > canvas {
  width: 100%;
  display: block;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  cursor: crosshair;
}

/* 下拉菜单 */
.select {
  background: var(--bg-surface);
  color: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.select:hover { border-color: rgba(255,255,255,0.25); }
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,0.25); }

/* 悬浮胶囊播放条 (Apple-style Floating Capsule Playbar) */
.playbar {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  border-top: 1px solid var(--border);
  background: rgba(14, 15, 22, 0.85);
  backdrop-filter: blur(16px);
}
.playbar button {
  background: linear-gradient(180deg, #fff 0%, #e2e8f0 100%);
  color: #0f172a;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.16s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.playbar button:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.playbar button:active { transform: translateY(0); }
.playbar input[type=range] {
  flex: 1;
  height: 6px;
  accent-color: #38bdf8;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  cursor: pointer;
}
.playbar .hint { font-size: 11.5px; color: var(--text-dim); }

/* 标签与徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  padding: 2.5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}
.badge.up { background: var(--up-glow); border-color: rgba(244, 63, 94, 0.3); color: var(--up); }
.badge.dn { background: var(--dn-glow); border-color: rgba(16, 185, 129, 0.3); color: var(--dn); }
.badge.off { background: var(--off-glow); border-color: rgba(56, 189, 248, 0.3); color: var(--off); }
.badge.gold { background: var(--gold-glow); border-color: rgba(251, 191, 36, 0.3); color: var(--gold); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.up { background: var(--up); box-shadow: 0 0 8px var(--up); }
.dot.dn { background: var(--dn); box-shadow: 0 0 8px var(--dn); }
.dot.off { background: var(--off); box-shadow: 0 0 8px var(--off); }
.dot.gold { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* 文本色彩 */
.up { color: var(--up) !important; }
.dn { color: var(--dn) !important; }
.off { color: var(--off) !important; }
.gold { color: var(--gold) !important; }
.muted { color: var(--text-muted) !important; }
.faint { color: var(--text-faint) !important; }

/* ==========================================================================
   总览首页专属控制台 (Cockpit Layout)
   ========================================================================== */
.dash {
  padding: 28px 36px 72px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.hero-header {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.hero-title { font-size: 21px; font-weight: 750; color: #fff; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* 4格核心账本卡片 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.kpi:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-k { font-size: 12.5px; font-weight: 650; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.kpi-v {
  margin-top: 10px;
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
}
.sparkline-box {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 96px;
  height: 40px;
  opacity: 0.9;
  pointer-events: none;
}

/* 资金蓄水天平 (Capital Balance Bar) */
.balance-card {
  margin: 18px 0;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-md);
}
.balance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.balance-track {
  height: 14px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  display: flex;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}
.balance-fill-pool {
  background: linear-gradient(90deg, #e11d48, #f43f5e);
  height: 100%;
  transition: width 0.4s ease;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.4);
}
.balance-fill-off {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  height: 100%;
  transition: width 0.4s ease;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}
.balance-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* 核心脉搏矩阵 (3-column) */
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.pulse-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}
.pulse-head { font-size: 13px; font-weight: 650; color: var(--text-muted); display: flex; align-items: center; justify-content: space-between; }
.pulse-val { font-size: 24px; font-weight: 750; margin: 10px 0 6px; font-family: var(--font-mono); }
.pulse-sub { font-size: 12px; color: var(--text-faint); line-height: 1.6; }

/* 模块直达网格 */
.sec-head {
  margin: 36px 0 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.linkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.linkcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.linkcard:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.linkcard-top { display: flex; align-items: center; justify-content: space-between; }
.linkcard-num {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  padding: 2px 7px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}
.linkcard-title { font-size: 15px; font-weight: 700; color: #fff; margin-top: 12px; }
.linkcard-desc { font-size: 12px; color: var(--text-faint); margin-top: 6px; line-height: 1.6; }
.linkcard-tags { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.linkcard-tag { font-size: 11px; color: var(--text-muted); background: rgba(255,255,255,0.04); padding: 3px 8px; border-radius: 4px; }

/* 选项卡胶囊切换器 */
.tabs { display: flex; gap: 6px; align-items: center; flex: none; }
.tab {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: #fff; background: var(--bg-card-hover); }
.tab.active { background: #fff; color: #090a0f; border-color: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }

/* 今日水池量化研判与核心结论汇总看板 */
.conclusion-box {
  margin: 18px 0;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(26, 28, 40, 0.95) 0%, rgba(19, 20, 29, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-top: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(56, 189, 248, 0.06);
}
.conclusion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 8px;
}
.conclusion-title {
  font-size: 15px;
  font-weight: 750;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: -0.01em;
}
.conclusion-title .pulse-dot {
  width: 8px;
  height: 8px;
}
.conclusion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.conc-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.16s ease;
}
.conc-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
.conc-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.conc-dim {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.conc-stat {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.45;
  margin-bottom: 6px;
}
.conc-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.55;
}
.conc-desc b {
  color: var(--text-main);
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .pulse-grid { grid-template-columns: 1fr; }
  .conclusion-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .conclusion-grid { grid-template-columns: 1fr; }
}
