/* 策略回测系统公用样式 —— 白色浅色主题，与 shaixuan 保持一致 */

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #1f2937;
    min-height: 100vh;
    font-size: 14px;
}

#app { min-height: calc(100vh - 70px); }

.bt-main {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px 40px;
}

/* 子导航 */
.bt-subnav {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}
.bt-subnav-left { flex: 1; }
.bt-title {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}
.bt-emoji { font-size: 28px; }
.bt-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.bt-tabs::-webkit-scrollbar { display: none; }
.bt-tab {
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
    top: 1px;
}
.bt-tab:hover { color: #2563eb; background: #f3f4f6; }
.bt-tab.active {
    color: #2563eb;
    background: #fff;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    border-bottom: 1px solid #fff;
}

/* 筛选条 */
.bt-filter-bar {
    background: #fff;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-label {
    font-weight: 600;
    color: #606266;
    margin-right: 4px;
    white-space: nowrap;
}

/* 策略下拉项：代码徽标 + 中文名 */
.opt-code {
    display: inline-block;
    min-width: 38px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'SF Mono', 'Menlo', monospace;
    margin-right: 8px;
    vertical-align: middle;
}
.opt-code-buy {
    background: rgba(103, 194, 58, 0.12);
    color: #529b2e;
    border: 1px solid rgba(103, 194, 58, 0.4);
}
.opt-code-sell {
    background: rgba(245, 108, 108, 0.12);
    color: #c45656;
    border: 1px solid rgba(245, 108, 108, 0.4);
}
.opt-cn {
    color: #303133;
    font-size: 13px;
}

/* KPI 卡片 */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.kpi-card {
    background: #fff;
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.kpi-card.kpi-primary { background: linear-gradient(135deg, #eff6ff, #fff); border-color: #dbeafe; }
.kpi-card.kpi-success { background: linear-gradient(135deg, #f0fdf4, #fff); border-color: #d1fae5; }
.kpi-label { font-size: 13px; color: #6b7280; margin-bottom: 6px; }
.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    margin-bottom: 4px;
}
.kpi-unit { font-size: 16px; color: #9ca3af; margin-left: 2px; font-weight: 500; }
.kpi-sub { font-size: 12px; color: #9ca3af; }

/* 两栏布局 */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 14px;
    margin-bottom: 16px;
}

/* Panel */
.panel {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 16px 18px;
    margin-bottom: 16px;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
}
.panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}
.panel-sub { font-size: 12px; color: #9ca3af; }
.panel-link { color: #2563eb; font-size: 13px; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

/* 最优策略 */
.best-panel { }
.best-panel.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; }
.best-body { display: flex; flex-direction: column; gap: 12px; }
.best-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.best-code {
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}
.best-cn { font-size: 20px; font-weight: 700; color: #111827; }
.best-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px 0;
}
.metric { display: flex; flex-direction: column; gap: 2px; }
.m-label { font-size: 12px; color: #6b7280; }
.m-value { font-size: 18px; font-weight: 700; color: #111827; }
.m-value.primary { color: #2563eb; }

/* TOP5 */
.top5-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.top5-item {
    display: grid;
    grid-template-columns: 50px 60px 1fr 36px 90px 80px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid #f3f4f6;
}
.top5-item:hover { background: #f9fafb; border-color: #e5e7eb; }
.top5-rank {
    font-weight: 700;
    font-size: 14px;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    text-align: center;
}
.top5-rank.rank-1 { background: #fef3c7; color: #d97706; }
.top5-rank.rank-2 { background: #e5e7eb; color: #4b5563; }
.top5-rank.rank-3 { background: #fed7aa; color: #c2410c; }
.top5-code { font-family: monospace; font-weight: 600; font-size: 13px; color: #1f2937; }
.top5-name { font-size: 14px; color: #111827; }
.top5-cat { font-size: 12px; padding: 2px 6px; border-radius: 4px; text-align: center; }
.top5-cat.cat-buy { background: #d1fae5; color: #059669; }
.top5-cat.cat-sell { background: #fee2e2; color: #dc2626; }
.top5-wr { font-size: 13px; color: #6b7280; text-align: right; }
.top5-wr b { color: #2563eb; }
.top5-ret { font-size: 13px; font-weight: 600; text-align: right; }
.top5-empty { padding: 24px; text-align: center; color: #9ca3af; }

/* 表格 */
.daily-best-table, .ranking-table { margin-top: 4px; }
.link { color: #2563eb; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link code.mono { color: #2563eb; }
.cn-name { margin-left: 6px; font-weight: 500; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.mono.small { font-size: 11px; }
.stars { color: #f59e0b; letter-spacing: 1px; font-size: 12px; }

/* 收益色 */
.ret-up { color: #dc2626; font-weight: 600; }
.ret-down { color: #059669; font-weight: 600; }
.ret-flat { color: #6b7280; }
.wr-big { font-size: 15px; color: #111827; }
.wr-big.high { color: #dc2626; }
.score-big { font-size: 15px; color: #2563eb; }

/* 每日胜率走势 */
.trend-list { max-height: 400px; overflow-y: auto; padding-right: 4px; }
.trend-row {
    display: grid;
    grid-template-columns: 100px 1fr 55px 75px 60px;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.trend-row:hover { background: #f9fafb; }
.trend-date { font-size: 12px; color: #6b7280; font-family: monospace; }
.trend-bar-wrap { height: 18px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.trend-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    transition: width 0.3s;
}
.trend-wr { font-size: 13px; font-weight: 600; color: #1f2937; text-align: right; }
.trend-wr.high-wr { color: #dc2626; }
.trend-ret { font-size: 12px; text-align: right; }
.trend-cnt { font-size: 11px; color: #9ca3af; text-align: right; }

/* 状态页 / 空态 */
.state-panel {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 12px;
    margin-top: 40px;
}
.state-emoji { font-size: 64px; margin-bottom: 16px; }
.state-panel h2 { margin: 10px 0; font-size: 22px; color: #111827; }
.state-panel p { color: #6b7280; margin-bottom: 20px; }

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}
.empty-emoji { font-size: 40px; margin-bottom: 8px; }
.empty-text { font-size: 14px; }

/* 底部说明 */
.foot-tips {
    margin-top: 30px;
    padding: 18px 24px;
    background: #f9fafb;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
}
.foot-tips h4 { margin: 0 0 12px; font-size: 14px; color: #111827; }
.foot-tips ul { margin: 0; padding-left: 20px; color: #4b5563; font-size: 13px; line-height: 1.7; }
.foot-tips li { margin-bottom: 4px; }
.foot-tips b { color: #1f2937; }

/* 详情页 */
.detail-head-panel { }
.dh-left { display: flex; flex-direction: column; gap: 6px; }
.dh-code-name { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dh-code {
    padding: 6px 12px;
    background: #eff6ff;
    border-radius: 8px;
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: #2563eb;
}
.dh-cn { font-size: 22px; font-weight: 700; color: #111827; }
.dh-ruleid { font-size: 12px; color: #9ca3af; }
.dh-ruleid code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; color: #6b7280; }
.holding-label { font-size: 15px; font-weight: 600; color: #6b7280; }
.holding-label.cur-holding {
    color: #2563eb;
    padding: 2px 10px;
    background: #eff6ff;
    border-radius: 6px;
}
.stock-code-inline { color: #9ca3af; font-family: monospace; font-size: 12px; margin-left: 6px; }

/* 管理页 · 手动触发回测卡片区 */
.admin-ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}
.op-card {
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
    min-height: 148px;
}
.op-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
    transform: translateY(-1px);
}
.op-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
    letter-spacing: .2px;
}
.op-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 14px;
    min-height: 36px; /* 让 4 张卡的描述行高度一致、按钮对齐 */
}
.op-actions {
    margin-top: auto;            /* 按钮吸底，4 张卡按钮对齐 */
    display: flex;
    flex-wrap: nowrap;           /* 禁止换行 */
    align-items: center;
    gap: 8px;
    min-width: 0;                /* 关键：允许子项收缩 */
}
.op-actions .op-picker {
    flex: 1 1 auto;              /* 日期选择器吃掉剩余空间 */
    min-width: 0;                /* 允许压缩，不把按钮挤出去 */
    max-width: 100%;
}
.op-actions .el-button {
    flex: 0 0 auto;              /* 按钮固定宽度，永远不换行、不压缩 */
    white-space: nowrap;
}

/* 策略名称：加粗 + 深色，一眼识别 */
.strategy-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    letter-spacing: .2px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .best-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .bt-main { padding: 0 10px 40px; }
    .bt-title { font-size: 18px; }
    .bt-emoji { font-size: 22px; }
    .bt-tab { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
    .top5-item {
        grid-template-columns: 36px 50px 1fr 80px;
    }
    .top5-cat { display: none; }
    .top5-wr { display: none; }
}
@media (max-width: 640px) {
    .bt-main { padding: 0 8px 40px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .bt-filter-bar { flex-direction: column; align-items: flex-start; }
    .bt-subnav { margin-bottom: 10px; padding-bottom: 8px; }
    .bt-title { font-size: 16px; margin-bottom: 8px; }
    .panel { padding: 12px 12px; }
    .kpi-card { padding: 12px 14px; }
    .kpi-value { font-size: 22px; }
}

/* ==========================================================================
   🔧 Element Plus 日期选择器样式保护
   el-date-picker 弹出层挂在 body 下，容易被全局样式污染。
   这里显式 reset，确保日期格子里显示的是"1~31"日期数字，而不是被按钮或其他元素覆盖。
   ========================================================================== */
.el-picker-panel,
.el-date-picker,
.el-date-range-picker {
    font-size: 14px !important;
    color: #1f2937 !important;
}

/* 弹出层顶部的"<<  <  2026 February  >  >>" */
.el-picker-panel__body-wrapper .el-picker-panel__body .el-date-picker__header,
.el-picker-panel .el-date-picker__header {
    padding: 12px 12px 0 !important;
    margin: 0 !important;
}
.el-date-picker__header-label,
.el-picker-panel__icon-btn {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1f2937 !important;
    line-height: 1.5 !important;
    padding: 0 4px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.el-date-picker__header-label:hover,
.el-picker-panel__icon-btn:hover {
    color: #2563eb !important;
}

/* 星期表头 Sun Mon Tue... */
.el-date-table th {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #6b7280 !important;
    padding: 6px 0 !important;
    background: transparent !important;
    border: none !important;
}

/* 日期格：关键 reset，让里面"1~31"的数字正常显示 */
.el-date-table td,
.el-date-table td.available,
.el-date-table td.current,
.el-date-table td.start-date,
.el-date-table td.end-date,
.el-date-table td.in-range {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.el-date-table td .el-date-table-cell {
    width: auto !important;
    height: 30px !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
}
.el-date-table td .el-date-table-cell__text,
.el-date-table td span,
.el-date-table td div {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #1f2937 !important;
    line-height: 24px !important;
    height: 24px !important;
    width: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: transparent !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
/* 非本月的日期灰一点 */
.el-date-table td.prev-month .el-date-table-cell__text,
.el-date-table td.next-month .el-date-table-cell__text,
.el-date-table td.prev-month span,
.el-date-table td.next-month span {
    color: #cbd5e1 !important;
}
/* 今天 */
.el-date-table td.today .el-date-table-cell__text,
.el-date-table td.today span {
    color: #2563eb !important;
    font-weight: 600 !important;
}
/* hover */
.el-date-table td.available:hover .el-date-table-cell__text,
.el-date-table td.available:hover span {
    background: #eff6ff !important;
    color: #2563eb !important;
}
/* 选中态 */
.el-date-table td.current:not(.disabled) .el-date-table-cell__text,
.el-date-table td.current:not(.disabled) span {
    background: #2563eb !important;
    color: #fff !important;
    font-weight: 600 !important;
}
/* disabled */
.el-date-table td.disabled .el-date-table-cell__text,
.el-date-table td.disabled span {
    background: #f3f4f6 !important;
    color: #d1d5db !important;
    cursor: not-allowed !important;
}
/* 区间选择中的 in-range */
.el-date-table td.in-range .el-date-table-cell {
    background: #eff6ff !important;
}

/* daterange 两列之间的分隔 */
.el-date-range-picker__content {
    padding: 12px !important;
}
.el-date-range-picker__header {
    padding: 0 0 10px !important;
}

/* 确保弹出层里任何按钮都不受主页 primary/warning/danger 大 padding 影响 */
.el-picker-panel .el-button,
.el-date-picker .el-button {
    padding: 6px 14px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    min-height: auto !important;
    width: auto !important;
}
/* 底部"此刻/确认"栏 */
.el-picker-panel__footer {
    padding: 8px 12px !important;
    background: #fafafa !important;
    border-top: 1px solid #f0f0f0 !important;
}
