:root {
  --up: #c6322a;
  --down: #2ba471;
  --bg: #f5f6f8;
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

.login-mask {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%); z-index: 9999;
}
.login-card { width: 360px; border-radius: 12px; }
.login-title { text-align: center; font-size: 20px; font-weight: 600; margin-bottom: 20px; color: #1f2329; }

body {
  margin: 0;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #1f2329;
}

.app-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(90deg, #1f2937, #374151);
  color: #fff;
}

.app-header .title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.app-header .sub {
  font-size: 12px;
  color: #cbd5e1;
}

.app-main {
  padding: 14px 16px;
}

.filter-card {
  margin-bottom: 12px;
}

.filter-card :deep(.el-card__body),
.filter-card .el-card__body {
  padding: 12px 14px;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-row + .filter-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #ebeef5;
}

.filter-row .lbl {
  font-size: 13px;
  color: #606266;
  font-weight: 600;
}

/* 列头筛选触发图标 */
.filter-flag {
  margin-left: 4px;
  cursor: pointer;
  color: #c0c4cc;
  font-size: 12px;
  user-select: none;
}

.filter-flag:hover {
  color: #2563eb;
}

.filter-flag.on {
  color: #2563eb;
  font-weight: 700;
}

.star {
  cursor: pointer;
  font-size: 16px;
  color: #c0c4cc;
  user-select: none;
}

.star.on {
  color: #f7b500;
}

.fund-cell {
  cursor: pointer;
  line-height: 1.3;
}

.fund-cell .fname {
  color: #2563eb;
  font-weight: 600;
}

.fund-cell .fcode {
  color: #909399;
  font-size: 12px;
}

.up {
  color: var(--up);
  font-weight: 600;
}

.down {
  color: var(--down);
  font-weight: 600;
}

.block-title {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 700;
  border-left: 3px solid #2563eb;
  padding-left: 8px;
}

.desc {
  margin-bottom: 6px;
}

.chart {
  width: 100%;
  height: 280px;
}

.chart .empty {
  text-align: center;
  color: #909399;
  padding: 60px 0;
}

/* 高级筛选面板 */
.filter-panel {
  padding: 0 4px;
}

.fp-tip {
  margin-bottom: 12px;
}

.fp-item {
  padding: 10px 10px;
  border: 1px solid #ebeef5;
  border-radius: 6px;
  margin-bottom: 8px;
}

.fp-item.active {
  border-color: #c6e2ff;
  background: #f5f9ff;
}

.fp-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ====================== 顶部 tabs ====================== */
.main-tabs > .el-tabs__header {
  margin-bottom: 12px;
}

/* ====================== 定投回测 ====================== */
.bt-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bt-toolbar .el-card__body {
  padding: 10px 14px;
}

.bt-toolbar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.bt-tip {
  font-size: 12px;
  color: #909399;
  margin-left: auto;
  max-width: 620px;
  line-height: 1.4;
}

.bt-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bt-item .el-card__body {
  padding: 12px 14px;
}

.bt-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bt-item-idx {
  font-weight: 700;
  color: #2563eb;
  font-size: 14px;
}

.bt-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.bt-form.bt-ref,
.bt-form.bt-rules {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #ebeef5;
}

.bt-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bt-field > label {
  font-size: 13px;
  color: #606266;
  font-weight: 600;
  white-space: nowrap;
}

.bt-unit {
  font-size: 12px;
  color: #909399;
}

.bt-rules-label {
  font-size: 13px;
  color: #606266;
  font-weight: 600;
}

.bt-tier {
  font-size: 12px;
  color: #303133;
  min-width: 40px;
  text-align: right;
}

.bt-rules-hint {
  font-size: 12px;
  color: #c0a000;
}

.bt-results {
  margin-top: 4px;
}

.bt-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.bt-chart {
  width: 100%;
  height: 420px;
}

/* ============ 回测：收藏夹 / 历史记录 ============ */
.bt-subtabs {
  --el-tabs-header-height: 38px;
}

.fav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f0f0;
}

.fav-row:last-child {
  border-bottom: none;
}

.fav-info {
  min-width: 0;
}

.fav-label {
  font-weight: 600;
  color: #303133;
}

.fav-sub {
  font-size: 12px;
  color: #909399;
  margin-top: 2px;
}

.fav-ops {
  flex-shrink: 0;
  white-space: nowrap;
}

.bt-history {
  margin-top: 4px;
}

.bt-history-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bt-hist-detail {
  padding: 6px 8px 10px;
  background: #fafafa;
}

/* ============ 通用实时日志面板 ============ */
.job-log {
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.job-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.job-log-title {
  font-size: 13px;
  font-weight: 600;
  color: #303133;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.job-log-body {
  height: 360px;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  background: #1e1e1e;
  color: #d4d4d4;
}

.job-log-empty {
  color: #888;
  text-align: center;
  padding-top: 40px;
}

.job-log-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.job-log-t {
  color: #6a9955;
  margin-right: 8px;
  user-select: none;
}

.job-log-line.lvl-warn .job-log-msg {
  color: #dcdcaa;
}

.job-log-line.lvl-error .job-log-msg {
  color: #f48771;
}

/* ============ 指标 (FED / PE) ============ */
.ind-wrap {
  padding: 4px 0;
}

.ind-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.ind-toolbar .ind-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ind-toolbar .ind-field > label {
  font-size: 13px;
  color: #606266;
}

.ind-spacer {
  flex: 1;
}

.ind-chart {
  width: 100%;
  height: 440px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
}

.ind-meta {
  font-size: 12px;
  color: #909399;
  margin: 8px 2px 0;
}

/* ============ 数据更新 / 基金获取 通用两栏 ============ */
.ops-wrap {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .ops-wrap {
    grid-template-columns: 1fr;
  }
}

.ops-panel {
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.ops-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: #303133;
}

.ops-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.ops-check-hint {
  font-size: 12px;
  color: #909399;
  margin-left: 24px;
}

.ops-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.ops-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ops-row > label {
  font-size: 13px;
  color: #606266;
  min-width: 64px;
}

/* 基金获取表单（数据源→分类级联）：紧凑、单列、控件占满面板宽度 */
.ff-form {
  margin-top: 4px;
}
.ff-form .el-form-item {
  margin-bottom: 12px;
}
.ff-form .el-form-item:last-child {
  margin-bottom: 0;
}

/* 搜索获取：结果多选列表 */
.ff-search {
  margin-top: 4px;
}
.ff-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 10px;
  border-bottom: 1px solid #ebeef5;
}
.ff-search-count {
  font-size: 12px;
  color: #909399;
}
.ff-search-list {
  max-height: 360px;
  overflow-y: auto;
  margin-top: 6px;
  display: block;
}
.ff-search-list .el-checkbox.ff-search-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 7px 6px;
  border-bottom: 1px dashed #f0f0f0;
}
.ff-search-list .el-checkbox.ff-search-item:hover {
  background: #f5f7fa;
}
/* 让 checkbox 文本区填满，内部各列横向排布 */
.ff-search-item .el-checkbox__label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  white-space: normal;
}
.ff-si-name {
  font-size: 13px;
  color: #303133;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}
.ff-si-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #409eff;
  width: 72px;
  flex: none;
}
.ff-si-meta {
  font-size: 12px;
  color: #909399;
  flex: none;
}

.preset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.preset-tags .el-tag {
  cursor: pointer;
}

.bt-err-line {
  font-size: 12px;
  line-height: 1.7;
}
