:root {
  --ok-green: #198754;
  --ok-yellow: #ffc107;
  --ok-red: #dc3545;
  --ok-blue: #0d6efd;
  --ok-deep-red: #842029;
}
body { background: #f6f7f9; color: #1f2933; }
.metric { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; min-height: 84px; }
.metric .label { color: #667085; font-size: .86rem; }
.metric .value { font-size: 1.35rem; font-weight: 700; }
.risk-metric-value { font-size: 1.05rem !important; line-height: 1.25; overflow-wrap: anywhere; }
.backtest-metric { font-size: 1.05rem !important; line-height: 1.25; overflow-wrap: anywhere; }
.backtest-simple-shell { max-width: 1440px; margin: 0 auto; }
.backtest-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 22px 24px;
  color: #fff;
  background: linear-gradient(135deg, #162033 0%, #265446 58%, #7a2f34 100%);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(22, 32, 51, .14);
}
.backtest-hero h1 { margin: 4px 0 8px; font-size: 1.75rem; font-weight: 850; letter-spacing: 0; }
.backtest-hero p { margin: 0; max-width: 720px; color: rgba(255,255,255,.82); }
.backtest-kicker { color: rgba(255,255,255,.72); font-size: .82rem; font-weight: 800; }
.backtest-note,
.backtest-empty {
  padding: 12px 14px;
  color: #667085;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
.backtest-answer-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.backtest-answer-grid div {
  min-height: 92px;
  padding: 14px;
  background: #fbfdff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.backtest-answer-grid span {
  display: block;
  margin-bottom: 7px;
  color: #667085;
  font-size: .84rem;
  font-weight: 800;
}
.backtest-answer-grid strong { font-size: 1.8rem; line-height: 1.1; }
.backtest-conclusion {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-weight: 700;
}
.backtest-chart {
  margin-bottom: 18px;
  padding: 14px;
  background: #fbfdff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.backtest-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.backtest-chart-head h3 {
  margin: 0 0 3px;
  color: #1f2937;
  font-size: 1.02rem;
  font-weight: 850;
}
.backtest-chart-head p {
  margin: 0;
  color: #667085;
  font-size: .86rem;
}
.backtest-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  max-width: 460px;
}
.backtest-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: #475467;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}
.backtest-chart-legend span::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: #64748b;
}
.backtest-chart-legend .legend-close::before { background: #111827; }
.backtest-chart-legend .legend-buy::before { background: #198754; }
.backtest-chart-legend .legend-watch::before { background: #d49b00; }
.backtest-chart-legend .legend-target::before { background: #0d6efd; }
.backtest-chart-legend .legend-stop::before { background: #dc3545; }
.backtest-chart-frame {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.backtest-chart-frame svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}
.chart-bg {
  fill: #f8fafc;
}
.chart-grid {
  stroke: #d8dee8;
  stroke-width: 1;
}
.chart-axis-label,
.chart-date-label {
  fill: #64748b;
  font-size: 12px;
  font-weight: 700;
}
.close-line {
  fill: none;
  stroke: #111827;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.price-line {
  stroke-width: 2;
  stroke-dasharray: 8 7;
}
.label-leader {
  stroke-width: 1.5;
  stroke-dasharray: 2 3;
  opacity: .8;
}
.line-buy { stroke: #198754; fill: #0f7a45; }
.line-watch { stroke: #d49b00; fill: #946900; }
.line-target { stroke: #0d6efd; fill: #164080; }
.line-stop { stroke: #dc3545; fill: #b42318; }
.line-label {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 5;
  stroke-linejoin: round;
  font-size: 12px;
  font-weight: 850;
}
.event-dot {
  stroke: #fff;
  stroke-width: 3;
}
.event-dot-buy,
.event-label-buy { fill: #198754; }
.event-dot-signal,
.event-label-signal { fill: #d49b00; }
.event-dot-target,
.event-label-target { fill: #0d6efd; }
.event-dot-stop,
.event-label-stop { fill: #dc3545; }
.event-label {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4;
  stroke-linejoin: round;
  font-size: 12px;
  font-weight: 900;
}
.backtest-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}
.backtest-timeline::before {
  content: "";
  position: absolute;
  left: 104px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #e5e7eb;
}
.backtest-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.backtest-timeline-item::before {
  content: "";
  position: absolute;
  left: 98px;
  top: 18px;
  width: 14px;
  height: 14px;
  background: #94a3b8;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #cbd5e1;
}
.event-BUY_FILLED::before,
.event-TARGET1::before,
.event-TARGET2::before { background: #198754; }
.event-STOP::before,
.event-MISS::before,
.event-AMBIGUOUS_EVENT::before { background: #dc3545; }
.event-SIGNAL::before { background: #ffc107; }
.backtest-timeline-date {
  padding-top: 12px;
  color: #475467;
  font-size: .86rem;
  font-weight: 800;
  text-align: right;
}
.backtest-timeline-card {
  padding: 13px 15px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.backtest-timeline-price {
  margin: 6px 0;
  color: #1f2937;
  font-size: 1.24rem;
  font-weight: 850;
}
@media (max-width: 992px) {
  .backtest-hero { align-items: flex-start; flex-direction: column; }
  .backtest-answer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .backtest-chart-head { align-items: stretch; flex-direction: column; }
  .backtest-chart-legend { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .backtest-hero { padding: 18px; }
  .backtest-answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-chart { padding: 10px; }
  .backtest-timeline::before { left: 10px; }
  .backtest-timeline-item { grid-template-columns: 1fr; gap: 6px; padding-left: 28px; }
  .backtest-timeline-item::before { left: 4px; }
  .backtest-timeline-date { padding-top: 0; text-align: left; }
}
.stock-card { border-radius: 8px; border: 1px solid #e3e6ea; }
.status-BUY_READY { border-left: 6px solid var(--ok-green); }
.status-WATCH { border-left: 6px solid var(--ok-yellow); }
.status-WAIT { border-left: 6px solid var(--ok-red); }
.status-HOLD { border-left: 6px solid var(--ok-blue); }
.status-SELL_TARGET_1, .status-SELL_TARGET_2, .status-STOP_TRIGGERED, .status-REVIEW_REQUIRED, .status-DATA_ERROR { border-left: 6px solid var(--ok-deep-red); }
.badge-BUY_READY { background: var(--ok-green); }
.badge-WATCH { background: var(--ok-yellow); color: #212529; }
.badge-WAIT { background: var(--ok-red); }
.badge-HOLD { background: var(--ok-blue); }
.badge-SELL_TARGET_1, .badge-SELL_TARGET_2, .badge-STOP_TRIGGERED, .badge-REVIEW_REQUIRED, .badge-DATA_ERROR { background: var(--ok-deep-red); }
.table-sm td, .table-sm th { vertical-align: middle; }
.form-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; }
.dashboard-shell {
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
}
.dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  padding: 22px 24px;
  margin-bottom: 14px;
  color: #fff;
  background: linear-gradient(135deg, #172033 0%, #2b5a51 54%, #8b3838 100%);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(23, 32, 51, .16);
}
.dashboard-kicker {
  color: rgba(255,255,255,.72);
  font-size: .82rem;
  font-weight: 800;
}
.dashboard-hero h1 {
  margin: 4px 0 8px;
  font-size: 1.85rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.16;
}
.dashboard-hero p {
  max-width: 760px;
  margin: 0;
  color: rgba(255,255,255,.84);
}
.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.dashboard-stat,
.dashboard-panel,
.dashboard-details {
  min-width: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.dashboard-stat {
  min-height: 106px;
  padding: 15px 16px;
  border-top-width: 5px;
}
.dashboard-stat span,
.risk-grid span,
.account-metrics span,
.strategy-grid span {
  display: block;
  color: #64748b;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.dashboard-stat strong {
  display: block;
  color: #1f2937;
  font-size: 2rem;
  line-height: 1.05;
}
.dashboard-panel {
  padding: 16px;
  margin-bottom: 14px;
}
.dashboard-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.dashboard-panel-head.compact { margin-bottom: 10px; }
.dashboard-panel h2 {
  margin: 0 0 3px;
  color: #1f2937;
  font-size: 1.08rem;
  font-weight: 850;
}
.dashboard-panel p {
  margin: 0;
  color: #667085;
  font-size: .86rem;
}
.dashboard-panel-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 850;
  white-space: nowrap;
}
.dashboard-panel-badge {
  color: #344054;
  background: #eef2f7;
}
.stock-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stock-board-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  background: #fbfdff;
  border: 1px solid #e2e8f0;
  border-left-width: 6px;
  border-radius: 8px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.stock-board-card:hover {
  color: inherit;
  border-color: #cbd5e1;
  box-shadow: 0 10px 22px rgba(31, 41, 55, .09);
  transform: translateY(-1px);
}
.stock-board-top,
.stock-board-price,
.range-label,
.stock-board-action {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.stock-board-name {
  min-width: 0;
}
.stock-board-name strong {
  display: block;
  color: #1f2937;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.stock-board-name span {
  color: #667085;
  font-size: .82rem;
  font-weight: 700;
}
.stock-board-price {
  align-items: baseline;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #edf1f6;
  border-radius: 8px;
}
.stock-board-price strong {
  color: #111827;
  font-size: 1.62rem;
  line-height: 1;
  font-weight: 900;
}
.stock-board-price span {
  font-size: .98rem;
  font-weight: 850;
}
.stock-board-ranges {
  display: grid;
  gap: 9px;
}
.range-label {
  align-items: center;
  margin-bottom: 5px;
}
.range-label span,
.stock-board-action span,
.stock-board-facts span {
  color: #667085;
  font-size: .78rem;
  font-weight: 800;
}
.range-label strong,
.stock-board-action strong {
  color: #344054;
  font-size: .86rem;
  text-align: right;
}
.range-track {
  position: relative;
  height: 9px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: visible;
}
.range-track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.buy-range::before { background: linear-gradient(90deg, #d7efe2 0%, #34a66a 48%, #d7efe2 100%); }
.watch-range::before { background: linear-gradient(90deg, #fff3bf 0%, #d99a00 48%, #fff3bf 100%); }
.range-track i {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: #172033;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(23, 32, 51, .24);
  transform: translateY(-50%);
}
.stock-board-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.stock-board-facts div {
  min-height: 58px;
  padding: 8px 9px;
  background: #fff;
  border: 1px solid #edf1f6;
  border-radius: 8px;
}
.stock-board-facts strong {
  display: block;
  color: #1f2937;
  font-size: .9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.stock-board-action {
  align-items: center;
  padding: 10px 11px;
  background: #f8fafc;
  border: 1px solid #edf1f6;
  border-radius: 8px;
}
.tone-buy { border-color: #23955a !important; }
.tone-watch { border-color: #d99a00 !important; }
.tone-hold { border-color: #2563eb !important; }
.tone-wait { border-color: #94a3b8 !important; }
.tone-danger { border-color: #b42318 !important; }
.status-chip.tone-buy { color: #0b4f2e; background: #d7f3e2; border: 1px solid #b9e8cd !important; }
.status-chip.tone-watch { color: #704d00; background: #fff1b8; border: 1px solid #f3d26a !important; }
.status-chip.tone-hold { color: #164080; background: #dbeafe; border: 1px solid #b9d4ff !important; }
.status-chip.tone-wait { color: #475467; background: #eef2f7; border: 1px solid #d8dee8 !important; }
.status-chip.tone-danger { color: #8a1f17; background: #ffe3df; border: 1px solid #f7b8af !important; }
.dashboard-stat.tone-buy { border-top-color: #23955a; }
.dashboard-stat.tone-watch { border-top-color: #d99a00; }
.dashboard-stat.tone-hold { border-top-color: #2563eb; }
.dashboard-stat.tone-wait { border-top-color: #94a3b8; }
.dashboard-stat.tone-danger { border-top-color: #b42318; }
.is-up { color: #0f7a45 !important; }
.is-down { color: #b42318 !important; }
.is-flat { color: #475467 !important; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 14px;
}
.todo-list {
  display: grid;
  gap: 8px;
}
.todo-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 11px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.todo-item span {
  color: #344054;
  font-size: .9rem;
  font-weight: 700;
}
.todo-item strong {
  font-size: .84rem;
  white-space: nowrap;
}
.todo-item.state-done { background: #f1fbf5; border-color: #c9ead6; }
.todo-item.state-error { background: #fff1f0; border-color: #f4beb8; }
.account-metrics,
.risk-grid,
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.account-metrics div,
.risk-grid div,
.strategy-grid div {
  min-width: 0;
  min-height: 78px;
  padding: 12px;
  background: #fbfdff;
  border: 1px solid #edf1f6;
  border-radius: 8px;
}
.account-metrics strong,
.risk-grid strong,
.strategy-grid strong {
  display: block;
  color: #1f2937;
  font-size: 1.08rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.strategy-grid small {
  display: block;
  margin-top: 5px;
  color: #667085;
  font-size: .82rem;
  line-height: 1.35;
}
.dashboard-empty {
  padding: 18px;
  color: #667085;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
.dashboard-details {
  padding: 14px 16px;
}
.dashboard-details summary {
  cursor: pointer;
  color: #344054;
  font-weight: 850;
}
@media (max-width: 1180px) {
  .stock-board,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 860px) {
  .dashboard-summary,
  .account-metrics,
  .risk-grid,
  .strategy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stock-board-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }
  .dashboard-hero h1 {
    font-size: 1.48rem;
  }
  .dashboard-hero-actions {
    justify-content: flex-start;
  }
  .dashboard-summary,
  .account-metrics,
  .risk-grid,
  .strategy-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-panel-head,
  .stock-board-top,
  .stock-board-price,
  .stock-board-action {
    align-items: stretch;
    flex-direction: column;
  }
  .range-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .range-label strong,
  .stock-board-action strong {
    text-align: left;
  }
}
.readonly-lock { background: #eef2f7; border-left: 4px solid #64748b; padding: 12px; }
.rule-box { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; height: 100%; }
.rule-box .label { color: #667085; font-size: .84rem; margin-bottom: 4px; }
.rule-box .value { font-weight: 700; }
.rule-risk { background: #fff7f7; border-color: #f3c4c4; }
.rule-target { background: #f3fbf6; border-color: #bfe5cd; }
.rule-version-card {
  overflow: hidden;
}
.rule-version-card[open] .rule-version-summary {
  border-bottom: 1px solid #eef2f7;
}
.rule-version-history {
  background: #fbfdff;
}
.rule-version-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 1.4fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.rule-version-summary::-webkit-details-marker {
  display: none;
}
.rule-version-summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #475467;
  background: #eef2f7;
  border-radius: 50%;
  font-weight: 800;
  grid-column: 1;
  grid-row: 1;
}
.rule-version-card[open] .rule-version-summary::before {
  content: "-";
}
.rule-version-title {
  min-width: 0;
  padding-left: 34px;
  grid-column: 1;
  grid-row: 1;
}
.rule-version-title h3 {
  margin: 0 0 3px;
  color: #1f2937;
  font-size: .98rem;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.rule-version-title div {
  color: #667085;
  font-size: .82rem;
}
.rule-version-snapshot {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}
.rule-version-snapshot span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  color: #475467;
  background: #f1f5f9;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
}
.rule-version-summary .badge {
  justify-self: end;
}
.rule-version-summary:hover {
  background: #f8fafc;
}
.research-report-list { display: grid; gap: 12px; }
.research-report-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}
.research-report-content {
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  color: #344054;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
}
.market-shell { max-width: 1480px; margin: 0 auto; }
.market-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  color: #fff;
  background: linear-gradient(135deg, #172033 0%, #245246 52%, #7c2d2d 100%);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 16px 36px rgba(23, 32, 51, .18);
}
.market-hero h1 { margin: 4px 0 8px; font-size: 1.8rem; font-weight: 800; letter-spacing: 0; }
.market-hero p { margin: 0; max-width: 680px; color: rgba(255,255,255,.82); }
.market-kicker { color: rgba(255,255,255,.72); font-size: .84rem; font-weight: 700; }
.market-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.market-toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 480px) 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.market-date-form,
.market-run-card,
.market-panel,
.market-stat,
.market-note {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.market-date-form { display: flex; gap: 10px; align-items: center; padding: 14px; }
.market-date-form .form-control { max-width: 180px; }
.market-run-card { padding: 13px 16px; }
.market-run-label,
.market-stat span {
  display: block;
  color: #64748b;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.market-run-main { font-size: 1.12rem; font-weight: 800; }
.market-run-note,
.market-stat small,
.market-panel p {
  color: #667085;
  font-size: .86rem;
}
.market-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.market-stat { padding: 15px 16px; min-height: 106px; }
.market-stat strong { display: block; font-size: 1.35rem; line-height: 1.2; margin-bottom: 8px; }
.market-up { color: #0f7a45 !important; }
.market-down { color: #b42318 !important; }
.market-neutral { color: #475467 !important; }
.market-note { padding: 12px 14px; margin-bottom: 14px; color: #475467; background: #f8fafc; }
.market-panel { padding: 16px; margin-bottom: 14px; }
.market-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}
.market-panel h2 { margin: 0 0 2px; font-size: 1.05rem; font-weight: 800; }
.market-panel p { margin: 0; }
.market-table-wrap { border: 1px solid #e5e7eb; border-radius: 8px; }
.market-table { margin-bottom: 0; min-width: 1080px; }
.market-table thead th {
  position: sticky;
  top: 56px;
  z-index: 1;
  background: #f8fafc;
  color: #475467;
  font-size: .78rem;
  border-bottom: 1px solid #d8dee8;
}
.market-table tbody tr:hover { background: #f9fbfd; }
.market-table td,
.market-table th { padding: 10px 9px; }
.market-table .form-control-sm {
  min-width: 78px;
  border-color: #d7dde7;
  background: #fbfdff;
}
.market-table .form-control-sm:focus {
  border-color: #667085;
  box-shadow: 0 0 0 .15rem rgba(102,112,133,.16);
}
.market-stock-cell strong { display: block; font-weight: 800; }
.market-stock-cell span { display: block; color: #667085; font-size: .82rem; }
.market-source,
.market-quality {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.market-source { color: #344054; background: #eef2f7; }
.market-quality { margin-top: 5px; background: #fff1f0; }
.market-import-panel summary {
  cursor: pointer;
  font-weight: 800;
  color: #344054;
}
@media (max-width: 992px) {
  .market-hero { align-items: flex-start; flex-direction: column; }
  .market-hero-actions { justify-content: flex-start; }
  .market-toolbar,
  .market-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .market-hero { padding: 18px; }
  .market-hero h1 { font-size: 1.45rem; }
  .market-toolbar,
  .market-stats { grid-template-columns: 1fr; }
  .market-date-form { align-items: stretch; flex-direction: column; }
  .market-date-form .form-control { max-width: none; }
  .market-panel-head { align-items: stretch; flex-direction: column; }
}

.stock-detail-shell {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}
.stock-detail-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  margin-bottom: 14px;
  color: #fff;
  background: linear-gradient(135deg, #1e293b 0%, #30594f 48%, #8a3b3b 100%);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(30, 41, 59, .16);
}
.stock-kicker {
  color: rgba(255,255,255,.72);
  font-size: .82rem;
  font-weight: 800;
}
.stock-title-block h1 {
  margin: 4px 0 10px;
  font-size: 1.9rem;
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: 0;
}
.stock-code-row,
.stock-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.stock-code-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  color: rgba(255,255,255,.86);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 700;
}
.stock-pill-active {
  color: #113822 !important;
  background: #c7f0d8 !important;
  border-color: #c7f0d8 !important;
}
.stock-pill-muted {
  color: rgba(255,255,255,.84) !important;
}
.stock-hero-actions {
  justify-content: flex-end;
}
.stock-summary-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.35fr .8fr;
  gap: 14px;
  margin-bottom: 14px;
}
.stock-summary-card,
.stock-panel {
  min-width: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.stock-summary-card {
  min-height: 118px;
  padding: 16px;
}
.stock-summary-card strong {
  display: block;
  color: #1f2937;
  font-size: 1.28rem;
  line-height: 1.25;
  margin-bottom: 7px;
}
.stock-card-label {
  color: #64748b;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 7px;
}
.stock-card-note {
  color: #667085;
  font-size: .85rem;
}
.stock-price-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.stock-price-line strong {
  margin-bottom: 0;
  font-size: 1.6rem;
}
.stock-price-line span {
  font-weight: 800;
}
.stock-change-up { color: #0f7a45 !important; }
.stock-change-down { color: #b42318 !important; }
.stock-change-flat { color: #475467 !important; }
.stock-state-buy { border-left: 5px solid #0f7a45; }
.stock-state-watch { border-left: 5px solid #d49b00; }
.stock-state-risk { border-left: 5px solid #b42318; }
.stock-state-target { border-left: 5px solid #0d6efd; }
.stock-state-neutral { border-left: 5px solid #94a3b8; }
.stock-range-track {
  position: relative;
  height: 10px;
  margin: 10px 0 8px;
  background: linear-gradient(90deg, #cfe7dc 0%, #f3df9b 50%, #efc7c7 100%);
  border-radius: 999px;
}
.stock-range-track span {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: #1f2937;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(31, 41, 55, .25);
  transform: translateY(-50%);
}
.stock-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.stock-side-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.stock-panel {
  padding: 16px;
}
.stock-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.stock-panel-head.compact {
  margin-bottom: 10px;
}
.stock-panel h2 {
  margin: 0 0 3px;
  color: #1f2937;
  font-size: 1.05rem;
  font-weight: 850;
}
.stock-panel p {
  margin: 0;
  color: #667085;
  font-size: .86rem;
}
.stock-panel-badge,
.stock-source {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  color: #344054;
  background: #eef2f7;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}
.stock-sparkline {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 118px;
  padding: 12px 10px 8px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.stock-sparkline span {
  flex: 1 1 0;
  min-width: 4px;
  border-radius: 4px 4px 0 0;
}
.stock-sparkline .is-up { background: #279660; }
.stock-sparkline .is-down { background: #c4493d; }
.stock-sparkline .is-flat { background: #94a3b8; }
.stock-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.stock-market-table {
  min-width: 760px;
}
.stock-market-table thead th {
  color: #475467;
  background: #f8fafc;
  border-bottom: 1px solid #d8dee8;
  font-size: .78rem;
}
.stock-edit-form {
  display: grid;
  gap: 9px;
}
.stock-edit-form .form-label {
  margin-bottom: -3px;
  color: #475467;
  font-size: .82rem;
  font-weight: 800;
}
.stock-toggle-row {
  padding-top: 4px;
  padding-bottom: 4px;
}
.stock-rule-map {
  display: grid;
  gap: 8px;
}
.stock-rule-map div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 9px 11px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.stock-rule-map span {
  color: #64748b;
  font-size: .82rem;
  font-weight: 800;
}
.stock-rule-map strong {
  text-align: right;
  font-size: .94rem;
}
.stock-rule-map small {
  color: inherit;
  font-weight: 800;
}
.stock-rule-map .is-risk {
  background: #fff7f7;
  border-color: #f3c4c4;
}
.stock-rule-map .is-risk strong { color: #b42318; }
.stock-rule-map .is-target {
  background: #f3fbf6;
  border-color: #bfe5cd;
}
.stock-rule-map .is-target strong { color: #0f7a45; }
.stock-empty {
  padding: 18px;
  color: #667085;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
@media (max-width: 1100px) {
  .stock-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stock-main-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .stock-detail-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }
  .stock-title-block h1 {
    font-size: 1.5rem;
  }
  .stock-hero-actions {
    justify-content: flex-start;
  }
  .stock-summary-grid {
    grid-template-columns: 1fr;
  }
  .stock-panel-head {
    align-items: stretch;
    flex-direction: column;
  }
  .rule-version-summary {
    grid-template-columns: 1fr auto;
  }
  .rule-version-summary::before {
    grid-column: 1;
    grid-row: 1;
  }
  .rule-version-title {
    grid-column: 1 / 3;
    grid-row: 1;
    padding-right: 76px;
  }
  .rule-version-snapshot {
    grid-column: 1 / 3;
    grid-row: 2;
    padding-left: 34px;
  }
  .rule-version-summary .badge {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
}
