:root {
  --bg: #f5f6fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --up: #e74c3c;
  --down: #2ecc71;
  --border: #e0e0e0;
  --hover: #f0f7ff;
  --active: #dbeafe;
  --focus: #3b82f6;
  --chart-bg: #ffffff;
  --btn-bg: #ffffff;
  --btn-color: #2c3e50;
  --btn-border: #d1d5db;
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #c1c1c1;
}

body.dark {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #cbd5e1;
  --up: #ff6b6b;
  --down: #51cf66;
  --border: #0f172a;
  --hover: #1e293b;
  --active: #334155;
  --focus: #60a5fa;
  --chart-bg: #1e293b;
  --btn-bg: #1e293b;
  --btn-color: #cbd5e1;
  --btn-border: #475569;
  --scrollbar-track: #1e293b;
  --scrollbar-thumb: #475569;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.search-box {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  font-size: 14px;
}

.search-box input:focus {
  border-color: var(--focus);
}

.search-box .theme-btn {
  padding: 8px 12px;
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-color);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}
.search-box .theme-btn:hover {
  border-color: var(--focus);
}

.search-box .clear-btn {
  position: absolute;
  right: 90px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: none;
  width: 20px;
  height: 20px;
  justify-content: center;
  align-items: center;
}

.search-box .clear-btn.visible {
  display: flex;
}

.search-hint {
  padding: 4px 12px 10px;
  font-size: 12px;
  color: #94a3b8;
}

.stock-table-wrap {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.stock-table-wrap::-webkit-scrollbar {
  width: 8px;
}

.stock-table-wrap::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.stock-table-wrap::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

.stock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stock-table th {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  z-index: 1;
}

.stock-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.stock-table tr:hover td {
  background: var(--hover);
}

.stock-table tr.active td {
  background: var(--active) !important;
}

.price {
  font-weight: 600;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chart-header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  min-height: 52px;
  box-sizing: border-box;
}

.chart-header h2 {
  font-size: 18px;
  margin: 0;
}

.price-info {
  font-size: 14px;
  color: #64748b;
}

.indicator-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  visibility: hidden;
}
.indicator-btns.visible {
  visibility: visible;
}

.ind-btn,
.theme-btn,
.ma-set-btn {
  padding: 4px 12px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.ind-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.period-toggle {
  display: flex;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.period-btn {
  padding: 4px 12px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.period-btn.active {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.ma-set-btn {
  margin-left: 6px;
  font-size: 14px;
}

.chart-container {
  min-height: 400px;
  flex: 1;
  background: var(--chart-bg);
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal {
  background: var(--card-bg);
  color: var(--text);
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  min-width: 300px;
}

.modal input {
  width: 100%;
  padding: 8px;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 6px 12px;
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-color);
}

.view-toggle {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.view-btn {
  padding: 6px 16px;
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-color);
  font-size: 12px;
}

.view-btn.active {
  background: var(--focus);
  color: #fff;
  border-color: var(--focus);
}

.ind-select {
  padding: 6px 12px;
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-color);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.ind-select:focus {
  border-color: var(--focus);
}
.ind-select option {
  background: var(--card-bg);
  color: var(--text);
}

.indicator-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.indicator-btns.hidden { display: none; }

.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.realtime-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.sub-chart-container {
  flex: 1;
  background: var(--chart-bg);
  border-radius: 8px;
  min-height: 200px;
}

.realtime-right {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-left: 1px solid var(--border);
}

.stock-info-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.info-row .label {
  color: #64748b;
  font-size: 13px;
}

.info-row .value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.info-row .price-value {
  font-size: 18px;
  font-weight: 600;
}

.order-book {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
}

.order-book-header {
  padding: 8px 12px;
  background: var(--bg);
  font-size: 12px;
  color: #64748b;
  border-bottom: 1px solid var(--border);
}

.sell-orders,
.buy-orders {
  padding: 4px 8px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 12px;
}

.order-row.active {
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
  font-weight: 500;
}

.sell-orders .order-price {
  color: var(--up);
}

.buy-orders .order-price {
  color: var(--down);
}

.order-vol {
  color: #64748b;
}

.minute-deals {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 10px;
}

.deals-header {
  padding: 8px 12px;
  background: var(--bg);
  font-size: 12px;
  color: #64748b;
  border-bottom: 1px solid var(--border);
}

.deals-list {
  max-height: 200px;
  overflow-y: auto;
}

.deal-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 11px;
}

.deal-row.header {
  font-weight: 600;
  background: var(--bg);
  color: #64748b;
}

.deal-row span {
  flex: 1;
  text-align: center;
}

.deal-row span:first-child {
  text-align: left;
}

.deal-row span:last-child {
  text-align: right;
}

.deal-row.up {
  color: var(--up);
}

.deal-row.down {
  color: var(--down);
}

.indicator-btns.hidden {
  display: none;
}

/* === AI 分析报告样式 === */
.analysis-btn {
  padding: 6px 16px;
  border: 1.5px solid #6366f1;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
  margin-left: 6px;
}
.analysis-btn:hover { opacity: 0.85; }
.analysis-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.analysis-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}
.analysis-panel {
  width: min(680px, 96vw);
  background: var(--card-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 32px rgba(0,0,0,0.25);
  animation: slideInRight 0.28s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.analysis-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}
.analysis-panel-header h3 { font-size: 16px; font-weight: 600; }
.analysis-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
}
.analysis-close-btn:hover { opacity: 1; }
.analysis-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  line-height: 1.8;
  font-size: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.analysis-panel-body::-webkit-scrollbar { width: 6px; }
.analysis-panel-body::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
.analysis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 16px;
  color: #94a3b8;
}
.analysis-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Markdown 渲染样式 */
.md-body h1 { font-size: 20px; font-weight: 700; margin-bottom: 12px; color: var(--text); border-bottom: 2px solid #6366f1; padding-bottom: 6px; }
.md-body h2 { font-size: 16px; font-weight: 600; margin: 20px 0 10px; color: var(--text); }
.md-body h3 { font-size: 14px; font-weight: 600; margin: 14px 0 8px; }
.md-body p { margin-bottom: 10px; }
.md-body blockquote { border-left: 3px solid #6366f1; padding: 6px 14px; background: rgba(99,102,241,0.07); border-radius: 4px; margin: 8px 0; color: #64748b; font-size: 13px; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-body table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 16px; }
.md-body table th { background: rgba(99,102,241,0.12); padding: 8px 12px; text-align: left; font-weight: 600; border: 1px solid var(--border); }
.md-body table td { padding: 7px 12px; border: 1px solid var(--border); }
.md-body table tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
.md-body ul { padding-left: 20px; margin-bottom: 10px; }
.md-body li { margin-bottom: 5px; }
.md-body strong { font-weight: 700; }
.md-body code { background: rgba(99,102,241,0.1); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
body.dark .md-body table tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
body.dark .md-body blockquote { background: rgba(99,102,241,0.12); }

.analysis-panel-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.analysis-refresh-btn {
  padding: 7px 18px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.analysis-refresh-btn:hover { background: #4f46e5; }
 
 /* 排序样式 */
 .stock-table th.sortable {
   cursor: pointer;
   user-select: none;
   white-space: nowrap;
   transition: background-color 0.2s;
 }
 
 .stock-table th.sortable:hover {
   background: var(--hover);
 }
 
 .sort-icon {
   display: inline-flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   vertical-align: middle;
   width: 14px;
   height: 14px;
   margin-left: 4px;
   opacity: 0.3;
   transition: opacity 0.2s;
 }
 
 .stock-table th.sortable:hover .sort-icon {
   opacity: 0.6;
 }
 
 .sort-icon::before,
 .sort-icon::after {
   content: "";
   display: block;
   width: 0;
   height: 0;
   border-left: 4px solid transparent;
   border-right: 4px solid transparent;
 }
 
 .sort-icon::before {
   border-bottom: 4px solid currentColor;
   margin-bottom: 2px;
 }
 
 .sort-icon::after {
   border-top: 4px solid currentColor;
 }
 
  /* 升序 */
  [data-sort="asc"] .sort-icon {
    opacity: 1 !important;
  }
  [data-sort="asc"] .sort-icon::after {
    display: none;
  }
  
  /* 降序 */
  [data-sort="desc"] .sort-icon {
    opacity: 1 !important;
  }
  [data-sort="desc"] .sort-icon::before {
    display: none;
  }

/* ── View Switch Group ── */
.view-switch-group {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px 12px;
  margin-bottom: 2px;
}
.standalone .view-switch-group {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  padding: 3px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.view-switch-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  opacity: 0.7;
}
.view-switch-btn:hover { opacity: 1; background: var(--hover); }
.view-switch-btn.active { opacity: 1; background: var(--active); color: var(--focus); font-weight: 600; }

/* ── Screener Layout ── */
.screener-layout {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px;
}
.screener-header { margin-bottom: 16px; }
.screener-header h2 { font-size: 20px; margin: 0; }
.screener-subtitle { font-size: 13px; color: var(--text); opacity: 0.6; }

/* Strategy Cards */
.screener-strategies {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.strategy-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.strategy-card:hover { border-color: var(--focus); box-shadow: 0 2px 12px rgba(59,130,246,0.15); }
.strategy-card.active { border-color: var(--focus); background: var(--hover); box-shadow: 0 2px 12px rgba(59,130,246,0.2); }
.strategy-icon { font-size: 28px; margin-bottom: 6px; }
.strategy-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.strategy-desc { font-size: 12px; opacity: 0.6; }

/* Filter Panel */
.screener-filters {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.filter-toggle {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-toggle:hover { background: var(--hover); }
.filter-toggle .arrow { transition: transform 0.2s; font-size: 10px; }
.filter-toggle.open .arrow { transform: rotate(90deg); }
.filter-body { padding: 0 16px 16px; }
.filter-row { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-row:last-child { margin-bottom: 0; }
.filter-group { flex: 1; min-width: 150px; }
.filter-group label { display: block; font-size: 12px; margin-bottom: 4px; opacity: 0.7; }
.filter-range { display: flex; align-items: center; gap: 6px; }
.filter-input {
  width: 80px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 13px; font-family: inherit;
}
.filter-select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 13px; font-family: inherit;
}

/* Action Buttons */
.screener-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.screener-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.screener-btn.primary { background: var(--focus); color: #fff; }
.screener-btn.primary:hover { opacity: 0.9; }
.screener-btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.screener-btn.secondary { background: var(--btn-bg); color: var(--text); border: 1px solid var(--btn-border); }
.screener-btn.secondary:hover { background: var(--hover); }
.screener-btn.secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.screener-status { font-size: 13px; opacity: 0.7; margin-left: auto; }

/* Results Table */
.screener-results {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.results-header {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.results-elapsed { font-size: 12px; opacity: 0.5; font-weight: 400; }
.results-table-wrap { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table th {
  padding: 10px 8px;
  text-align: right;
  font-weight: 600;
  font-size: 12px;
  opacity: 0.7;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--card-bg);
}
.results-table th:first-child { text-align: center; }
.results-table th:nth-child(2),
.results-table th:nth-child(3) { text-align: left; }
.results-table td {
  padding: 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results-table td:first-child { text-align: center; color: var(--text); opacity: 0.5; }
.results-table td:nth-child(2),
.results-table td:nth-child(3) { text-align: left; font-weight: 500; }
.results-table tr:hover td { background: var(--hover); }
.results-table tr { cursor: pointer; }
.up { color: var(--up); }
.down { color: var(--down); }
.suggestion-buy { color: var(--up); font-weight: 600; }
.suggestion-watch { color: #e67e22; font-weight: 600; }
.suggestion-wait { color: var(--focus); font-weight: 600; }
.suggestion-avoid { color: var(--down); font-weight: 600; }

/* Score Bars */
.score-bar-wrap { display: flex; align-items: center; gap: 4px; }
.score-bar {
  width: 50px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
  display: inline-block;
}
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* AI Report Panel */
.screener-ai-report {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
  overflow: hidden;
}
.ai-report-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-report-header h3 { margin: 0; font-size: 15px; }
.ai-report-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  opacity: 0.5;
  padding: 0 4px;
}
.ai-report-close:hover { opacity: 1; }
.ai-report-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ====== ����ģ�飨����/����/�ز⣩ ====== */
.quant-layout { display: flex; gap: 16px; flex: 1; min-height: 0; }
.quant-strategies-layout { align-items: flex-start; }
.quant-panel {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.quant-factor-list-panel { flex: 0 0 300px; }
.quant-panel-head {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.quant-sub { font-weight: 400; font-size: 12px; opacity: 0.7; }
.quant-empty { padding: 24px 12px; text-align: center; color: var(--text-muted, #888); font-size: 13px; }
.quant-factors { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.quant-factor-item {
  padding: 10px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.quant-factor-item:hover { background: var(--hover-bg, #f5f5f5); }
.quant-factor-item.active { border-color: var(--accent, #4f46e5); background: var(--hover-bg, #f5f5f5); }
.quant-factor-name { font-size: 14px; }
.quant-factor-cat { font-size: 12px; color: var(--text-muted, #888); border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; }
.quant-factor-detail { font-size: 13px; display: flex; flex-direction: column; gap: 10px; }
.quant-detail-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.quant-detail-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border-color, #e5e7eb); }
.quant-detail-row span { color: var(--text-muted, #888); min-width: 52px; }
.quant-detail-row b { font-weight: 500; }

.quant-templates { display: flex; flex-wrap: wrap; gap: 10px; }
.quant-template-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  background: var(--card-bg, #fff);
  transition: border-color 0.15s;
}
.quant-template-item:hover { border-color: var(--accent, #4f46e5); }
.quant-template-item b { font-size: 14px; }
.quant-template-item span { font-size: 12px; color: var(--text-muted, #888); }
.quant-strategies { display: flex; flex-direction: column; gap: 8px; }
.quant-strategy-card { border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; padding: 12px; }
.quant-strategy-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.quant-strategy-type { font-size: 12px; color: var(--text-muted, #888); margin-left: 8px; }
.quant-strategy-actions { display: flex; gap: 6px; }
.quant-strategy-actions button, .quant-btn {
  padding: 5px 10px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  background: var(--card-bg, #fff);
  cursor: pointer;
  font-size: 13px;
}
.quant-strategy-actions button:hover, .quant-btn:hover { border-color: var(--accent, #4f46e5); }
.quant-strategy-actions button.danger:hover { border-color: #e74c3c; color: #e74c3c; }
.quant-strategy-meta { font-size: 12px; color: var(--text-muted, #888); }
.quant-btn.primary { background: var(--accent, #4f46e5); color: #fff; border-color: transparent; }
.quant-btn.primary:hover { background: var(--accent-hover, #4338ca); }

.quant-editor {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel-bg, #fff);
}
.quant-editor-head { display: flex; justify-content: space-between; align-items: center; }
.quant-form-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.quant-form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.quant-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted, #888);
}
.quant-form-grid input, .quant-form-grid select {
  padding: 7px 9px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  font-size: 14px;
  background: var(--card-bg, #fff);
  color: var(--text);
  min-width: 120px;
}
.quant-actions { display: flex; gap: 8px; margin-top: 8px; }
.quant-billing-bar { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--text-muted, #888); }
.quant-billing-bar b { color: var(--text-color, #222); }

.quant-progress { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.quant-progress-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border-color, #e5e7eb);
  overflow: hidden;
}
.quant-progress-bar div { height: 100%; background: var(--accent, #4f46e5); transition: width 0.3s; }
.quant-progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted, #888); }

.quant-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }
.quant-metric { border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; padding: 10px; text-align: center; }
.quant-metric-label { font-size: 12px; color: var(--text-muted, #888); }
.quant-metric-value { font-size: 16px; font-weight: 600; margin-top: 4px; }
.quant-bench-note { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted, #888); text-align: left; padding-top: 2px; }
.quant-chart { height: 320px; margin: 10px 0; }
.quant-warning { padding: 10px 12px; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: 13px; margin: 8px 0; }
.quant-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.quant-table th, .quant-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-color, #e5e7eb); text-align: left; }
.quant-table th { color: var(--text-muted, #888); font-weight: 500; }
.quant-disclaimer { margin-top: 10px; font-size: 12px; color: var(--text-muted, #888); text-align: center; }
.quant-data-scroll { flex: 1; overflow: auto; padding: 4px; min-height: 0; }
.quant-st-badge { display: inline-block; padding: 1px 6px; margin-left: 6px; border-radius: 4px; background: #e74c3c; color: #fff; font-size: 11px; font-weight: 700; }

.quant-ic-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 10px 0 0; }
.quant-ic-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted, #888); }
.quant-ic-controls select { padding: 5px 8px; border: 1px solid var(--border-color, #d1d5db); border-radius: 6px; background: var(--card-bg, #fff); color: var(--text); font-size: 13px; }
.quant-ic-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.quant-ic-metric { border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; padding: 8px 6px; text-align: center; }
.quant-ic-metric .v { font-size: 15px; font-weight: 600; }
.quant-ic-metric .k { font-size: 11px; color: var(--text-muted, #888); margin-top: 2px; }
.quant-ic-charts { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.quant-ic-chart-half { flex: 1 1 280px; min-width: 260px; }
.quant-ic-note { font-size: 12px; color: var(--text-muted, #888); margin-top: 6px; line-height: 1.6; }
