/* 小崔 quant-report-dev 通用样式 */
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #0e1117; color: #e6e6e6;
  font-size: 14px;
}
a { color: #4da3ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #161b22; border-bottom: 1px solid #30363d;
  position: sticky; top: 0; z-index: 100;
}
.topbar .brand { font-weight: 600; font-size: 16px; color: #fff; }
.topbar .nav { display: flex; gap: 8px; }
.topbar .nav a {
  padding: 6px 12px; border-radius: 6px;
  color: #c9d1d9;
}
.topbar .nav a.active { background: #1f6feb; color: #fff; }

/* 选择器条 */
.selectors {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 16px;
  background: #161b22; border-bottom: 1px solid #30363d;
}
.selectors label { display: flex; align-items: center; gap: 4px; }
.selectors select {
  background: #0d1117; color: #e6e6e6;
  border: 1px solid #30363d; border-radius: 6px;
  padding: 4px 8px; font-size: 14px;
}
.selectors .reload-btn {
  margin-left: auto;
  background: #238636; color: #fff;
  border: none; border-radius: 6px;
  padding: 4px 12px; cursor: pointer;
}
.selectors .reload-btn:hover { background: #2ea043; }
.selectors .last-update { color: #8b949e; font-size: 12px; align-self: center; }

/* 摘要卡片栏 */
.summary-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 12px 16px;
}
.summary-card {
  background: #161b22; border: 1px solid #30363d; border-radius: 8px;
  padding: 12px 16px;
}
.summary-card .label { color: #8b949e; font-size: 12px; }
.summary-card .value { font-size: 20px; font-weight: 600; margin-top: 4px; }
.value.pos { color: #3fb950; }
.value.neg { color: #f85149; }

/* 主容器 */
.main { padding: 12px 16px; }
.chart-card, .table-card, .insight-card {
  background: #161b22; border: 1px solid #30363d; border-radius: 8px;
  padding: 12px; margin-bottom: 12px;
}
.card-title { font-size: 14px; color: #c9d1d9; margin: 0 0 8px 0; }

/* 数据表 */
table.report-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.report-table th, .report-table td {
  padding: 6px 8px; text-align: right;
  border-bottom: 1px solid #21262d;
}
.report-table th {
  background: #0d1117; color: #8b949e;
  cursor: pointer; user-select: none;
  position: sticky; top: 0;
}
.report-table th.sortable:hover { color: #fff; }
.report-table th .arrow { font-size: 10px; color: #4da3ff; margin-left: 4px; }
.report-table td:first-child, .report-table th:first-child { text-align: left; }
.report-table tr.pnl-pos { background: rgba(63, 185, 80, 0.08); }
.report-table tr.pnl-neg { background: rgba(248, 81, 73, 0.08); }
.report-table tr.pnl-zero { background: rgba(139, 148, 158, 0.04); }
.report-table .val-pos { color: #3fb950; font-weight: 600; }
.report-table .val-neg { color: #f85149; font-weight: 600; }
.report-table .val-zero { color: #8b949e; }

/* 分页 */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px; }
.pager button {
  background: #21262d; color: #c9d1d9;
  border: 1px solid #30363d; border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
}
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager button:hover:not(:disabled) { background: #30363d; }
.pager .page-info { color: #8b949e; font-size: 12px; }

/* ECharts 容器 */
#chart-curve { width: 100%; height: 380px; }
.insight-chart { width: 100%; height: 280px; }

/* 移动端响应式 ≤768 px */
@media (max-width: 768px) {
  .topbar { flex-direction: column; gap: 8px; align-items: stretch; }
  .topbar .nav { justify-content: center; }
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .selectors { flex-direction: column; align-items: stretch; }
  .selectors .last-update { text-align: center; }
  /* 表格降维为折叠卡片 */
  .report-table thead { display: none; }
  .report-table, .report-table tbody, .report-table tr, .report-table td { display: block; }
  .report-table tr {
    border: 1px solid #30363d; border-radius: 6px;
    margin-bottom: 8px; padding: 8px;
  }
  .report-table td {
    text-align: left !important; border: none;
    padding: 4px 0;
  }
  .report-table td::before {
    content: attr(data-label) ': ';
    color: #8b949e; font-weight: 500; margin-right: 6px;
  }
  #chart-curve, .insight-chart { height: 280px; }
}
