/* 交易日历:内照明心 + 三所统计分析共用,随 data-theme 浅/深切换 */
.trade-cal-wrap {
  --trade-cal-wrap-bg: var(--inset-surface, rgba(0, 0, 0, 0.22));
  --trade-cal-cell-bg: var(--section-surface, var(--inset-surface, rgba(0, 0, 0, 0.32)));
  --trade-cal-cell-border: rgba(255, 255, 255, 0.14);
  --trade-cal-cell-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  --trade-cal-cell-empty-bg: color-mix(in srgb, var(--trade-cal-cell-bg) 72%, transparent);
  --trade-cal-cell-hover-bg: color-mix(in srgb, var(--accent, #6366f1) 12%, var(--trade-cal-cell-bg));
  --trade-cal-cell-hover-border: color-mix(in srgb, var(--accent, #6366f1) 45%, transparent);
  --trade-cal-selected-border: rgba(59, 130, 246, 0.85);
  --trade-cal-selected-bg: color-mix(in srgb, #3b82f6 16%, var(--trade-cal-cell-bg));
  --trade-cal-selected-shadow: rgba(59, 130, 246, 0.45);
  --trade-cal-sick-bg: color-mix(in srgb, var(--red, #ef4444) 14%, var(--trade-cal-cell-bg));
  --trade-cal-sick-border: color-mix(in srgb, var(--red, #ef4444) 55%, transparent);
  --trade-cal-sick-shadow: color-mix(in srgb, var(--red, #ef4444) 45%, transparent);
  --trade-cal-sick-tag-bg: color-mix(in srgb, var(--red, #ef4444) 25%, transparent);
  --trade-cal-sick-tag-fg: color-mix(in srgb, var(--red, #ef4444) 70%, #fff);
  --trade-cal-pos: var(--green, #22c55e);
  --trade-cal-neg: var(--red, #ef4444);
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft, rgba(120, 140, 200, 0.28));
  background: var(--trade-cal-wrap-bg);
}
.stats-calendar-wrap {
  margin-bottom: 14px;
}
.trade-cal-wrap button.trade-cal-cell {
  background: var(--trade-cal-cell-bg) !important;
  background-image: none !important;
  border: 1px solid var(--trade-cal-cell-border);
  box-shadow: var(--trade-cal-cell-shadow);
  padding: 6px 4px;
  min-height: 72px;
  width: 100%;
  line-height: 1.15;
  font-size: inherit;
  text-align: center;
}
.trade-cal-wrap button.trade-cal-cell:not(.has-trade) {
  background: var(--trade-cal-cell-empty-bg) !important;
  cursor: default;
}
.trade-cal-wrap button.trade-cal-cell:disabled {
  opacity: 1;
  cursor: default;
}
.trade-cal-wrap .trade-cal-head .btn,
.trade-cal-wrap .trade-cal-head button {
  min-height: 0;
  min-width: 34px;
  padding: 4px 12px;
  line-height: 1.2;
}
.trade-cal-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.trade-cal-title {
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
  color: var(--text, #e8ecff);
}
.trade-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.trade-cal-wd {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted, #8892b0);
}
.trade-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.trade-cal-cell {
  min-height: 72px;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid var(--trade-cal-cell-border);
  box-shadow: var(--trade-cal-cell-shadow);
  background: var(--trade-cal-cell-bg);
  color: inherit;
  font: inherit;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}
.trade-cal-cell.has-trade {
  cursor: pointer;
}
.trade-cal-wrap button.trade-cal-cell.has-trade:hover {
  background: var(--trade-cal-cell-hover-bg) !important;
  background-image: none !important;
  border-color: var(--trade-cal-cell-hover-border);
}
.trade-cal-cell.is-selected {
  border-color: var(--trade-cal-selected-border);
  background: var(--trade-cal-selected-bg);
  box-shadow: 0 0 0 2px var(--trade-cal-selected-shadow);
}
.trade-cal-cell.is-sick-day {
  border-color: var(--trade-cal-sick-border);
  background: var(--trade-cal-sick-bg);
}
.trade-cal-cell.is-sick-day.is-selected {
  border-color: var(--trade-cal-selected-border);
  background: color-mix(in srgb, #3b82f6 14%, var(--trade-cal-sick-bg));
  box-shadow: 0 0 0 2px var(--trade-cal-selected-shadow);
}
.trade-cal-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #e8ecff);
}
.trade-cal-pnl {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text, #e8ecff);
}
.trade-cal-cell.pnl-pos .trade-cal-pnl {
  color: var(--trade-cal-pos);
}
.trade-cal-cell.pnl-neg .trade-cal-pnl {
  color: var(--trade-cal-neg);
}
.trade-cal-cnt {
  font-size: 0.65rem;
  color: var(--muted, #8892b0);
  font-weight: 500;
}
.trade-cal-sick-tag {
  font-size: 0.62rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--trade-cal-sick-tag-bg);
  color: var(--trade-cal-sick-tag-fg);
  font-weight: 600;
}
.trade-cal-pad {
  background: transparent;
  border: none;
  min-height: 0;
}

html[data-theme="light"] .trade-cal-wrap {
  --trade-cal-wrap-bg: var(--inset-surface, #eef3f8);
  --trade-cal-cell-bg: #ffffff;
  --trade-cal-cell-empty-bg: #f6f9fc;
  --trade-cal-cell-border: rgba(0, 75, 115, 0.18);
  --trade-cal-cell-shadow: 0 1px 4px rgba(30, 60, 100, 0.08);
  --trade-cal-cell-hover-bg: color-mix(in srgb, var(--accent, #2563eb) 10%, #ffffff);
  --trade-cal-selected-border: rgba(37, 99, 235, 0.75);
  --trade-cal-selected-bg: color-mix(in srgb, #2563eb 12%, #ffffff);
  --trade-cal-selected-shadow: rgba(37, 99, 235, 0.35);
  --trade-cal-sick-tag-fg: #b91c1c;
}
