/* =====================================================
   A股智能分析终端 - 专业级交易终端 UI
   ===================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* 背景 */
  --bg-0: #04060e;
  --bg-1: #0a0e1a;
  --bg-2: #101628;
  --bg-3: #151d33;
  --bg-4: #1a2340;
  /* 边框 */
  --bd-1: #1a2340;
  --bd-2: #243052;
  --bd-3: #2e3d63;
  /* 文字 */
  --tx-1: #e8ecf4;
  --tx-2: #8892a8;
  --tx-3: #4e5568;
  --tx-4: #363d4f;
  /* 功能色 */
  --red: #ef4444;
  --red-lt: #ff6b6b;
  --red-dk: #dc2626;
  --red-bg: rgba(239,68,68,.07);
  --green: #22c55e;
  --green-lt: #4ade80;
  --green-dk: #16a34a;
  --green-bg: rgba(34,197,94,.07);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251,191,36,.07);
  --blue: #58a6ff;
  --blue-bg: rgba(88,166,255,.07);
  --cyan: #22d3ee;
  --cyan-bg: rgba(34,211,238,.07);
  --purple: #a78bfa;
  --gold: #d4a843;
  /* 渐变 */
  --grad-blue: linear-gradient(135deg, #58a6ff, #2563eb);
  --grad-red: linear-gradient(135deg, #ef4444, #dc2626);
  --grad-green: linear-gradient(135deg, #22c55e, #16a34a);
  --grad-cyan: linear-gradient(135deg, #22d3ee, #0891b2);
  /* 阴影 */
  --shadow-1: 0 1px 3px rgba(0,0,0,.3);
  --shadow-2: 0 4px 12px rgba(0,0,0,.3);
  --shadow-glow: 0 0 20px rgba(88,166,255,.12);
  /* 尺寸 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body {
  background: var(--bg-0);
  color: var(--tx-1);
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 1520px; margin: 0 auto; }

/* ========== 顶部状态栏 ========== */
.topbar {
  background: var(--bg-1);
  border-bottom: 1px solid var(--bd-1);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(16px);
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  max-width: 1520px;
  margin: 0 auto;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--grad-blue);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px rgba(88,166,255,.25);
}
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub { font-size: 10px; color: var(--tx-3); letter-spacing: 0.8px; text-transform: uppercase; }

.topbar-center { display: flex; align-items: center; gap: 12px; }
.mkt-badge {
  padding: 3px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}
.mkt-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.mkt-badge.open {
  background: var(--red-bg);
  color: var(--red-lt);
  border: 1px solid rgba(239,68,68,.18);
}
.mkt-badge.open::before { background: var(--red-lt); animation: mkt-pulse 1.5s infinite; }
.mkt-badge.closed {
  background: rgba(110,118,129,.06);
  color: var(--tx-3);
  border: 1px solid rgba(110,118,129,.12);
}
.mkt-badge.closed::before { background: var(--tx-3); }

@keyframes mkt-pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.server-date { font-size: 12px; color: var(--tx-3); font-family: "Cascadia Code", monospace; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock-wrap {
  padding: 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-sm);
}
.clock {
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 1px;
  font-weight: 500;
}
.next-rpt {
  font-size: 11px;
  color: var(--tx-3);
  padding: 3px 10px;
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-sm);
}
.btn-primary {
  background: var(--grad-blue);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
}
.btn-primary:hover { box-shadow: 0 0 14px rgba(88,166,255,.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.loading { opacity: .55; pointer-events: none; }

/* ========== 股票标签 ========== */
.tabs-wrap {
  display: flex;
  padding: 0 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--bd-1);
  max-width: 1520px;
  margin: 0 auto;
}

.stock-tab {
  padding: 10px 22px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--tx-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.stock-tab:hover { color: var(--tx-1); background: rgba(88,166,255,.03); }
.stock-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.stock-tab .tp {
  font-family: "Cascadia Code", monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--bg-2);
}

/* ========== 主内容区 ========== */
.main { padding: 16px 20px; max-width: 1520px; margin: 0 auto; }

/* ========== Hero 数据栏 ========== */
.hero-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--bg-1);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 16px;
}
.hero-info { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.hero-name-wrap { display: flex; flex-direction: column; gap: 2px; }
.hero-name { font-size: 22px; font-weight: 700; }
.hero-code { font-size: 12px; color: var(--tx-3); font-family: "Cascadia Code", monospace; }
.hero-price-wrap { display: flex; flex-direction: column; align-items: flex-start; }
.hero-price {
  font-size: 40px;
  font-weight: 800;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  line-height: 1.1;
  letter-spacing: -1px;
}
.hero-change {
  font-size: 15px;
  font-family: "Cascadia Code", monospace;
  font-weight: 500;
}
.hero-stats { display: flex; gap: 18px; flex-wrap: wrap; }

.hs-item { display: flex; flex-direction: column; align-items: center; min-width: 72px; }
.hs-label { font-size: 10px; color: var(--tx-3); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.hs-value { font-size: 15px; font-weight: 600; font-family: "Cascadia Code", monospace; }

/* ========== 关键指标行 ========== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.metric-card {
  background: var(--bg-1);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .2s;
}
.metric-card:hover { border-color: var(--bd-2); background: var(--bg-2); }
.metric-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.metric-body { flex: 1; min-width: 0; }
.metric-label { font-size: 11px; color: var(--tx-3); }
.metric-val { font-size: 15px; font-weight: 600; font-family: "Cascadia Code", monospace; margin-top: 1px; }
.metric-sub { font-size: 10px; color: var(--tx-4); margin-top: 1px; }

/* ========== 图表网格布局 ========== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 1200px) { .charts-grid { grid-template-columns: 1fr; } }

.charts-col-main { display: flex; flex-direction: column; gap: 10px; }
.charts-col-side { display: flex; flex-direction: column; gap: 10px; }

/* ========== 通用卡片 ========== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bd-1);
}
.card-head-left { display: flex; align-items: center; gap: 8px; }
.card-head-right { display: flex; align-items: center; gap: 8px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--tx-2); }
.card-hint { font-size: 11px; color: var(--tx-4); font-family: "Cascadia Code", monospace; }
.card-body { padding: 0; }

.period-btns { display: flex; gap: 2px; }
.p-btn {
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--bd-1);
  border-radius: 4px;
  color: var(--tx-3);
  font-size: 11px;
  cursor: pointer;
  transition: all .2s;
}
.p-btn.active { background: var(--cyan-bg); color: var(--cyan); border-color: rgba(34,211,238,.25); }
.p-btn:hover { color: var(--tx-1); }

/* ========== 仪表盘详情 ========== */
.gauge-detail { margin-top: 6px; }
.gd-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
}
.gd-label { color: var(--tx-3); }
.gd-value { font-family: "Cascadia Code", monospace; font-weight: 600; }

/* ========== 关键价位 ========== */
.levels-stack { display: flex; flex-direction: column; gap: 5px; }
.lvl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: all .15s;
}
.lvl-row:hover { transform: translateX(2px); }
.lvl-row.res { background: var(--green-bg); }
.lvl-row.sup { background: var(--red-bg); }
.lvl-row.cur { background: var(--blue-bg); border: 1px solid rgba(88,166,255,.15); }
.lvl-label { color: var(--tx-2); font-size: 11px; }
.lvl-price { font-family: "Cascadia Code", monospace; font-weight: 600; font-size: 13px; }
.lvl-price.up { color: var(--red-lt); }
.lvl-price.dn { color: var(--green-lt); }
.lvl-price.cur { color: var(--blue); }

/* ========== 估值指标 ========== */
.val-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.val-item {
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--bd-1);
}
.val-label { font-size: 10px; color: var(--tx-3); margin-bottom: 2px; }
.val-value { font-size: 14px; font-weight: 600; font-family: "Cascadia Code", monospace; }

/* ========== 技术信号列表 ========== */
.section { margin-bottom: 16px; }
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.sec-head h2 { font-size: 15px; font-weight: 700; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--bd-1);
  color: var(--tx-2);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all .2s;
}
.btn-ghost:hover { background: var(--bg-2); color: var(--tx-1); }

.signals-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.sig-item {
  background: var(--bg-1);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .2s;
}
.sig-item:hover { border-color: var(--bd-2); }
.sig-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.sig-icon.bull { background: var(--red-bg); color: var(--red-lt); }
.sig-icon.bear { background: var(--green-bg); color: var(--green-lt); }
.sig-icon.neu { background: var(--yellow-bg); color: var(--yellow); }
.sig-body { flex: 1; min-width: 0; }
.sig-name { font-size: 12px; font-weight: 600; }
.sig-desc { font-size: 11px; color: var(--tx-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== 报告卡片 ========== */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) { .reports-grid { grid-template-columns: 1fr; } }

.rpt-card {
  background: var(--bg-1);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-1);
}
.rpt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bd-1);
}
.rpt-title { font-size: 14px; font-weight: 600; }
.rpt-time { font-size: 11px; color: var(--tx-3); font-family: "Cascadia Code", monospace; }
.rpt-price-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.rpt-price { font-size: 22px; font-weight: 700; font-family: "JetBrains Mono", "Cascadia Code", monospace; }
.rpt-change { font-size: 14px; font-family: "Cascadia Code", monospace; font-weight: 500; }
.rpt-meta { font-size: 12px; color: var(--tx-2); margin-bottom: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.rpt-signals { margin-bottom: 10px; }
.rpt-sig-line {
  font-size: 12px;
  padding: 2px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.rpt-sig-dot { font-weight: 700; width: 20px; flex-shrink: 0; font-size: 11px; }
.rpt-levels { display: flex; gap: 16px; margin: 8px 0; font-size: 11px; }
.rpt-level-l { color: var(--tx-3); }
.rpt-signal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.rpt-signal-bar-l { font-size: 12px; color: var(--tx-2); }
.rpt-signal-bar-v { font-size: 16px; font-weight: 700; }
.rpt-prediction {
  font-size: 12px;
  color: var(--tx-2);
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  line-height: 1.7;
  border-left: 3px solid var(--bd-2);
}

/* ========== 历史报告 ========== */
.select-box {
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  color: var(--tx-2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.history-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: var(--bg-0); }
.history-list::-webkit-scrollbar-thumb { background: var(--bd-2); border-radius: 2px; }

.h-item {
  background: var(--bg-1);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  transition: all .15s;
}
.h-item:hover { border-color: var(--bd-2); background: var(--bg-2); }
.h-time { color: var(--tx-3); font-family: "Cascadia Code", monospace; font-size: 11px; white-space: nowrap; min-width: 118px; }
.h-stock { font-weight: 600; min-width: 68px; }
.h-price { font-family: "Cascadia Code", monospace; min-width: 85px; }
.h-signal { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.h-pred { color: var(--tx-3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

/* ========== 通用颜色 ========== */
.up { color: var(--red); }
.dn { color: var(--green); }
.flat { color: var(--tx-2); }

.no-data { text-align: center; padding: 30px; color: var(--tx-3); font-size: 13px; }

/* ========== 动画 ========== */
@keyframes flashUp { 0% { color: var(--red-lt); transform: scale(1.02); } 100% { } }
@keyframes flashDown { 0% { color: var(--green-lt); transform: scale(1.02); } 100% { } }
.flash-up { animation: flashUp .4s; }
.flash-down { animation: flashDown .4s; }

/* ========== ECharts tooltip ========== */
.echarts-tooltip-dark {
  background: rgba(13,17,30,.95) !important;
  border-color: #2a3548 !important;
  color: #e8ecf4 !important;
}
