/* ═══════════════════════════════════════════════════════
   Strategy Workspace — Rally Score 客製化工作區
   Prefix: sw-
   Version: 1.0
   ═══════════════════════════════════════════════════════ */

/* ── Header ── */
.sw-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-default);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sw-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sw-header-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ── Status Filter Chips ── */
.sw-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.sw-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  transition: all 0.15s;
  user-select: none;
}
.sw-chip:hover {
  background: var(--color-bg-hover);
}
.sw-chip.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: 600;
}
.sw-chip-count {
  font-size: 10px;
  opacity: 0.7;
}

/* ── Signal Table ── */
.sw-table-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
}
.sw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.sw-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-bg-secondary);
  padding: 5px 6px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 11px;
  border-bottom: 1px solid var(--color-border-default);
  white-space: nowrap;
}
.sw-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--color-border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sw-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.sw-table tbody tr:hover {
  background: var(--color-bg-hover);
}
.sw-table tbody tr.sw-row-selected {
  background: var(--color-accent-subtle);
  border-left: 3px solid var(--color-accent);
}
.sw-code {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
  font-weight: 600;
}

/* ── Score Bar (inline) ── */
.sw-score-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sw-score-bar-track {
  width: 40px;
  height: 6px;
  background: var(--color-bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.sw-score-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--color-accent);
  transition: width 0.3s;
}
.sw-score-val {
  font-size: 11px;
  font-weight: 600;
  min-width: 24px;
}

/* ── Status Badge ── */
.sw-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  white-space: nowrap;
}
.sw-badge-icon {
  font-size: 12px;
}

/* ── Factor Hint (last column, auto-expand) ── */
.sw-hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* ── Detail Panel (bottom) ── */
.sw-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.sw-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border-default);
  padding: 0 12px;
}
.sw-detail-tab {
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.sw-detail-tab:hover {
  color: var(--color-text-primary);
}
.sw-detail-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}
.sw-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  min-height: 0; /* flex 子元素需要此屬性才能正確收縮 */
}
.sw-detail-content.sw-detail-chart-mode {
  padding: 0;
  overflow: hidden; /* 圖表模式不需捲軸，Highcharts 自己管理 */
}

/* ── Factor Analysis Tab ── */
.sw-factor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-subtle);
}
.sw-factor-stock {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
}
.sw-factor-score {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
}
.sw-factor-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--color-bg-tertiary);
}

.sw-factor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

/* ── Factor Card (left column) ── */
.sw-factors-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sw-factor-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sw-factor-label {
  width: 90px;
  font-size: 11px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.sw-factor-bar {
  flex: 1;
  height: 8px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.sw-factor-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.sw-factor-bar-fill.high {
  background: var(--color-accent);
}
.sw-factor-bar-fill.mid {
  background: var(--color-warning);
}
.sw-factor-bar-fill.low {
  background: var(--color-text-muted);
}
.sw-factor-value {
  width: 70px;
  font-size: 11px;
  text-align: right;
  color: var(--color-text-primary);
  flex-shrink: 0;
}
.sw-factor-info {
  cursor: help;
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ── Institutional Summary (right column) ── */
.sw-inst-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sw-inst-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.sw-inst-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.sw-inst-label {
  color: var(--color-text-secondary);
}
.sw-inst-value {
  font-weight: 600;
}
.sw-inst-pos {
  color: var(--color-danger);
}
.sw-inst-neg {
  color: var(--color-success);
}

/* ── Insight Box ── */
.sw-insight {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--color-bg-tertiary);
  border-radius: 6px;
  border-left: 3px solid var(--color-warning);
}
.sw-insight-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-warning);
  margin-bottom: 4px;
}
.sw-insight-text {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── Institutional Detail Table ── */
.sw-inst-detail {
  margin-top: 12px;
}
.sw-inst-detail-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}
.sw-inst-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.sw-inst-table th {
  background: var(--color-bg-secondary);
  padding: 4px 6px;
  text-align: right;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-default);
}
.sw-inst-table th:first-child {
  text-align: left;
}
.sw-inst-table td {
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px solid var(--color-border-subtle);
}
.sw-inst-table td:first-child {
  text-align: left;
  color: var(--color-text-secondary);
}

/* ── Chart Tab ── */
.sw-chart-container {
  width: 100%;
  height: 100%; /* 填滿 .sw-detail-content，由 VSplitter 控制實際高度 */
}

/* ── History Panel (collapsed) ── */
.sw-history-section {
  border-top: 1px solid var(--color-border-subtle);
}
.sw-history-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.sw-history-toggle:hover {
  color: var(--color-text-secondary);
}
.sw-history-arrow {
  font-size: 9px;
  transition: transform 0.2s;
}
.sw-history-content {
  padding: 0 12px 8px;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Real-time Price Columns ── */
.sw-rt-price {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
  font-weight: 600;
}
.sw-rt-change {
  font-size: 11px;
  font-weight: 600;
}

/* ── Factor Realtime Price Line ── */
.sw-factor-realtime {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.sw-factor-realtime strong {
  color: var(--color-text-primary);
  font-size: 13px;
}

/* ── Threshold Warning ── */
.sw-threshold-warn {
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* ── Utilities ── */
.sw-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--color-text-muted);
  font-size: 12px;
}
.sw-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--color-text-muted);
  font-size: 12px;
}
.sw-pos { color: var(--color-danger); }
.sw-neg { color: var(--color-success); }

/* ═══════════════════════════════════════════════════════
   Convergence Score — 條件聚攏趨近 Mission Control
   ═══════════════════════════════════════════════════════ */

/* ── Section shared ── */
.sw-conv-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

/* ── ① Score Header ── */
.sw-conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border-default);
}
.sw-conv-header-left { display: flex; flex-direction: column; gap: 2px; }
.sw-conv-stock { font-size: 14px; font-weight: 600; }
.sw-conv-status { font-size: 12px; }

.sw-conv-score-section {
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--color-border-default);
}
.sw-conv-score-big {
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sw-conv-score-icon { font-size: 22px; }
.sw-conv-score-num { font-variant-numeric: tabular-nums; }
.sw-conv-score-label { font-size: 14px; font-weight: 500; opacity: 0.8; }
.sw-conv-score-bar { max-width: 220px; margin: 0 auto 8px; }
.sw-conv-cond-blocks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
}
.sw-conv-block {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid var(--color-border-default);
}
.sw-conv-block.filled {
  background: var(--color-success);
  border-color: var(--color-success);
}
.sw-conv-block.empty {
  background: transparent;
}
.sw-conv-cond-text { margin-left: 6px; }

/* ── ② Condition Timeline ── */
.sw-conv-timeline-section {
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--color-border-default);
}
.sw-conv-timeline {
  margin-bottom: 10px;
}
.sw-tl-track {
  position: relative;
  height: 36px;
  margin: 0 8px;
}
.sw-tl-line {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-border-default);
}
.sw-tl-dot {
  position: absolute;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 700;
  z-index: 1;
}
.sw-tl-dot.met {
  background: var(--color-success);
  color: #fff;
  border: 2px solid var(--color-success);
}
.sw-tl-dot.unmet {
  background: var(--color-bg-default, #1a1a2e);
  color: var(--color-text-muted);
  border: 2px solid var(--color-border-default);
}
.sw-tl-dot-label { font-size: 7px; letter-spacing: -0.3px; }
.sw-tl-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--color-text-muted);
  padding: 0 4px;
}

.sw-conv-cond-list { margin-top: 4px; }
.sw-conv-cond-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 12px;
}
.sw-conv-cond-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 13px; }
.sw-conv-cond-label { min-width: 100px; }
.sw-conv-cond-detail {
  flex: 1;
  font-size: 11px;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.sw-conv-cond-lead {
  font-size: 10px;
  color: var(--color-text-muted);
  min-width: 55px;
  text-align: right;
}
.sw-conv-gap {
  font-size: 10px;
  color: var(--color-warning);
  background: var(--color-warning-bg, rgba(255,165,0,0.1));
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}
.sw-conv-cond-implicit {
  opacity: 0.45;
  font-style: italic;
}

/* ── ③ Key Factors ── */
.sw-conv-factors-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border-default);
}
.sw-conv-factor-row {
  margin-bottom: 8px;
}
.sw-conv-factor-row:last-child { margin-bottom: 0; }
.sw-conv-factor-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 12px;
}
.sw-conv-factor-label { flex: 1; font-weight: 500; }
.sw-conv-factor-weight {
  font-size: 10px;
  color: var(--color-text-muted);
  background: var(--color-bg-subtle, rgba(255,255,255,0.05));
  padding: 1px 5px;
  border-radius: 3px;
}
.sw-conv-factor-value {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
  min-width: 50px;
  text-align: right;
}
.sw-conv-factor-warn {
  font-size: 10px;
  color: var(--color-warning);
  font-weight: 600;
}
.sw-conv-factor-note {
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
}
.sw-conv-factor-note .sw-conv-factor-top { margin-bottom: 0; }
.sw-factor-bar-fill.warn {
  background: var(--color-warning);
}

/* ── ④ Research Context ── */
.sw-conv-research-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border-default);
}
.sw-conv-research-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.sw-conv-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  background: var(--color-bg-subtle, rgba(255,255,255,0.03));
  border-radius: 4px;
}
.sw-conv-stat-val {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-default);
}
.sw-conv-stat-label {
  font-size: 9px;
  color: var(--color-text-muted);
  text-align: center;
}

.sw-conv-warning {
  padding: 8px 10px;
  background: rgba(255, 165, 0, 0.08);
  border: 1px solid rgba(255, 165, 0, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: var(--color-warning, #f0a030);
  line-height: 1.5;
  margin-bottom: 8px;
}
.sw-conv-warning-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 2px;
}
.sw-conv-warning-action {
  margin-top: 4px;
  font-weight: 600;
}

.sw-conv-insight {
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
  padding: 4px 0;
}

/* ── Signal list: convergence status cell ── */
.sw-table td:has(.sw-conv-mini-blocks) {
  white-space: nowrap;
  overflow: visible;
}
/* ── Sortable headers ── */
.sw-sortable {
  cursor: pointer;
  user-select: none;
}
.sw-sortable:hover {
  color: var(--color-text-default);
}
.sw-sort-icon {
  font-size: 9px;
  margin-left: 2px;
  opacity: 0.3;
  vertical-align: middle;
}
.sw-sort-icon.active {
  opacity: 1;
  color: var(--color-info);
}

.sw-conv-mini-blocks {
  display: inline-block;
  margin-left: 4px;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--color-success);
  vertical-align: middle;
}

/* Trade lifecycle */
.sw-trade-header { display: flex; justify-content: space-between; align-items: center; padding: 12px; }
.sw-trade-entry-info { font-size: 0.8rem; opacity: 0.7; margin-left: 8px; }
.sw-trade-score-row { display: flex; justify-content: space-between; padding: 4px 12px 8px; font-size: 0.85rem; }
.sw-trade-section-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.5; padding: 8px 12px 4px; }
.sw-trade-v3-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; padding: 0 12px 8px; font-size: 0.85rem; }
.sw-trade-exit-triggers { display: flex; gap: 16px; padding: 8px 12px; background: var(--color-surface, #1a1a2e); border-radius: 6px; font-size: 0.8rem; margin: 0 12px 12px; }
.sw-return { font-weight: 700; font-family: 'SF Mono', monospace; }
.sw-return.positive { color: var(--color-success); }
.sw-return.negative { color: var(--color-danger, #e74c3c); }

/* Trade entry/exit row pairs */
.sw-exit-row td, .sw-holding-row td { border-top: none !important; padding-top: 0 !important; opacity: 0.85; }

/* History search */
.sw-history-search { padding: 4px 8px 8px; }
.sw-search-input {
  width: 180px; padding: 4px 8px; border: 1px solid var(--color-border, #333);
  border-radius: 4px; background: var(--color-surface, #1a1a2e);
  color: var(--color-text-primary, #eee); font-size: 0.85rem;
}
.sw-search-input::placeholder { color: var(--color-text-secondary, #888); }

/* ── Trade Detail Panel v2 ── */

.sw-td-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
}
.sw-td-hero-stock { font-size: 15px; font-weight: 600; }
.sw-td-hero-meta { font-size: 0.8rem; margin-top: 2px; opacity: 0.85; }
.sw-td-hero-right { display: flex; gap: 10px; }
.sw-td-hero-card {
  text-align: center;
  padding: 6px 10px;
  background: var(--color-surface, #1a1a2e);
  border-radius: 6px;
  min-width: 72px;
}
.sw-td-hero-card-val { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sw-td-hero-card-label { font-size: 0.65rem; opacity: 0.5; margin-top: 1px; }

.sw-td-section { padding: 8px 12px; border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06)); }
.sw-td-section:last-child { border-bottom: none; }
.sw-td-section-title {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; opacity: 0.45; margin-bottom: 6px;
}

.sw-td-score-row { display: flex; flex-direction: column; gap: 4px; }
.sw-td-score-bar-wrap { display: flex; align-items: center; gap: 8px; }
.sw-td-score-bar {
  flex: 1; height: 8px; background: var(--color-surface, #1a1a2e);
  border-radius: 4px; overflow: hidden; max-width: 200px;
}
.sw-td-score-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--color-warning) 0%, var(--color-success) 100%);
  transition: width 0.3s ease;
}
.sw-td-score-num { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sw-td-signal-badge { font-size: 0.75rem; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: rgba(255,255,255,0.06); }
.sw-td-cond-summary { display: flex; align-items: center; margin-top: 4px; font-size: 0.85rem; }

/* ── Score Sparkline (10-day bar chart) ── */
.sw-td-sparkline {
  position: relative; margin: 8px 0 4px;
  height: 56px; max-width: 200px;
}
.sw-td-spark-ref {
  position: absolute; left: 0; right: 0;
  border-top: 1px dashed rgba(255,255,255,0.35);
}
.sw-td-spark-ref-60 {
  border-top: 1px dotted rgba(255,255,255,0.2);
  pointer-events: none;
}
.sw-td-spark-bars {
  display: flex; align-items: flex-end; gap: 2px; height: 100%;
  position: relative; z-index: 1;
}
.sw-td-spark-bar {
  flex: 1; min-width: 8px; max-width: 14px;
  border-radius: 2px 2px 0 0;
  transition: height 0.3s ease, filter 0.15s ease;
  cursor: default;
}
.sw-td-spark-bar:hover { filter: brightness(1.3); }
.sw-td-spark-bar.today { box-shadow: 0 0 0 1px rgba(255,255,255,0.5); }

.sw-td-cond-list { display: flex; flex-direction: column; gap: 3px; }
.sw-td-cond-row { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 2px 0; }
.sw-td-cond-icon { width: 18px; text-align: center; flex-shrink: 0; }
.sw-td-cond-label { min-width: 95px; font-weight: 500; }
.sw-td-cond-detail { flex: 1; opacity: 0.7; font-size: 0.8rem; }
.sw-td-v3-tag {
  font-size: 0.65rem; font-weight: 600; padding: 1px 4px;
  border-radius: 3px; background: rgba(46,204,113,0.15); color: var(--color-success);
}
.sw-td-v3-tag.miss { background: rgba(231,76,60,0.15); color: var(--color-danger, #e74c3c); }

.sw-td-inst-row { display: flex; align-items: center; gap: 6px; padding: 1px 0 1px 24px; font-size: 0.8rem; }
.sw-td-inst-label { width: 30px; opacity: 0.6; }
.sw-td-inst-bar {
  flex: 1; height: 6px; background: var(--color-surface, #1a1a2e);
  border-radius: 3px; overflow: hidden; max-width: 120px;
}
.sw-td-inst-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.sw-td-inst-bar-fill.high { background: var(--color-success); }
.sw-td-inst-bar-fill.mid { background: var(--color-warning); }
.sw-td-inst-bar-fill.low { background: var(--color-danger, #e74c3c); }
.sw-td-inst-val { width: 35px; text-align: right; font-variant-numeric: tabular-nums; opacity: 0.7; }
.sw-td-inst-summary { padding: 2px 0 2px 24px; font-size: 0.75rem; opacity: 0.6; }

.sw-td-timeline { display: flex; flex-direction: column; gap: 2px; }
.sw-td-tl-row { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 3px 0; }
.sw-td-tl-current { font-weight: 600; }
.sw-td-tl-icon { width: 22px; text-align: center; flex-shrink: 0; }
.sw-td-tl-date { width: 42px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.sw-td-tl-action { width: 36px; }
.sw-td-tl-price { width: 55px; text-align: right; font-variant-numeric: tabular-nums; }
.sw-td-tl-note { flex: 1; text-align: right; font-size: 0.8rem; }
/* ── Next Step Section ── */
.sw-td-next { padding: 10px 12px; border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06)); }
.sw-td-next-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sw-td-next-icon { font-size: 1.1rem; flex-shrink: 0; }
.sw-td-next-title { font-size: 0.85rem; font-weight: 600; }
.sw-td-next-countdown { font-size: 0.75rem; opacity: 0.5; margin-left: auto; }
.sw-td-next-body { font-size: 0.8rem; line-height: 1.6; opacity: 0.85; }
.sw-td-next-body strong { opacity: 1; }
.sw-td-next-progress { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.sw-td-next-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.sw-td-next-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.sw-td-next-bar-fill.add { background: var(--color-info, #3498db); }
.sw-td-next-bar-fill.reduce { background: var(--color-warning, #f39c12); }
.sw-td-next-bar-fill.done { background: var(--color-success, #2ecc71); }
.sw-td-next-pct { font-size: 0.75rem; font-variant-numeric: tabular-nums; opacity: 0.6; min-width: 36px; text-align: right; }
.sw-td-next-fair { margin-top: 8px; padding: 6px 8px; background: var(--color-surface, #1a1a2e); border-radius: 6px; font-size: 0.8rem; }
.sw-td-next-fair-row { display: flex; justify-content: space-between; line-height: 1.8; }
.sw-td-next-fair-label { opacity: 0.6; }
.sw-td-next-fair-val { font-variant-numeric: tabular-nums; }
.sw-td-next-fair-formula { font-size: 0.7rem; opacity: 0.35; text-align: right; }

/* ── Exit Risk Section ── */
.sw-td-exit { padding: 8px 12px; border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06)); }
.sw-td-exit-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.45; margin-bottom: 6px; }
.sw-td-exit-list { display: flex; flex-direction: column; gap: 4px; }
.sw-td-exit-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.sw-td-exit-label { width: 36px; opacity: 0.6; flex-shrink: 0; }
.sw-td-exit-gauge { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.sw-td-exit-gauge-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
.sw-td-exit-gauge-fill.safe { background: var(--color-success, #2ecc71); }
.sw-td-exit-gauge-fill.warn { background: var(--color-warning, #f39c12); }
.sw-td-exit-gauge-fill.danger { background: var(--color-danger, #e74c3c); }
.sw-td-exit-val { font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; opacity: 0.7; }
.sw-td-exit-na { opacity: 0.3; font-style: italic; }

/* === Convergence V2: Revenue Block === */
.sw-td-revenue {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  background: var(--color-bg-secondary, rgba(255,255,255,0.03));
}
.sw-td-revenue .sw-td-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sw-td-rev-date {
  font-size: 12px;
  color: var(--color-text-muted);
}
.sw-td-rev-rank-hero {
  font-size: 16px;
  margin: 8px 0;
  color: var(--color-text-secondary);
}
.sw-td-rev-rank-hero strong {
  font-size: 22px;
  color: var(--color-text-primary);
}
.sw-td-rev-cards {
  display: flex;
  gap: 12px;
  margin: 8px 0;
}
.sw-td-rev-card {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 12px;
  text-align: center;
}
.sw-td-rev-card-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.sw-td-rev-card-value {
  font-size: 18px;
  font-weight: 600;
}
.sw-td-rev-card-value.pos { color: var(--color-success, #27ae60); }
.sw-td-rev-card-value.neg { color: var(--color-danger, #e74c3c); }
.sw-td-rev-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 6px 0 4px;
}
.sw-td-rev-filter {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Revenue rank badges in signal list */
.sw-rev-rank { font-weight: 600; font-size: 12px; }
.sw-rev-gold   { color: #f0b90b; }
.sw-rev-silver { color: #a0a0a0; }
.sw-rev-bronze { color: #cd7f32; }
.sw-rev-pos { color: var(--color-success, #27ae60); }
.sw-rev-neg { color: var(--color-danger, #e74c3c); }
.sw-th-rev-rank, .sw-th-rev-yoy { width: 60px; text-align: center; }

/* Entry type badge (條件到位 / 法人加速) */
.sw-entry-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 4px;
  vertical-align: middle;
}

/* Entry condition snapshot */
.sw-td-snapshot-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sw-td-snap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}
.sw-td-snap-label {
  color: var(--color-text-secondary);
  min-width: 80px;
}
.sw-td-snap-value {
  text-align: right;
}
.sw-td-snap-row.sw-snap-pass .sw-td-snap-value { color: var(--color-success); }
.sw-td-snap-row.sw-snap-pending .sw-td-snap-value { color: #ffcc80; }
.sw-td-snap-row.sw-snap-fail .sw-td-snap-value { color: var(--color-danger); }

/* Timeline tracking table */
.sw-td-timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.sw-td-timeline-table th {
  padding: 4px 6px;
  color: var(--color-text-muted);
  font-weight: 500;
  border-bottom: 2px solid var(--color-border);
  font-size: 0.72rem;
}
.sw-td-timeline-table td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--color-border);
}
.sw-td-timeline-table tr.sw-tl-entry {
  background: rgba(230, 81, 0, 0.1);
}
.sw-td-timeline-table tr.sw-tl-entry td:first-child {
  color: #ffcc80;
  font-weight: 600;
}
.sw-td-timeline-table tr.sw-tl-today td {
  font-weight: 600;
  color: var(--color-text-primary);
}
.sw-td-timeline-table tr.sw-tl-threshold td {
  color: var(--color-text-muted);
  border-top: 2px solid var(--color-border);
  font-size: 0.72rem;
}
.sw-td-timeline-summary {
  margin-top: 8px;
  padding: 6px 8px;
  background: var(--color-bg-secondary);
  border-radius: 4px;
  font-size: 0.78rem;
}

/* ── Warmup Strategy Styles ── */
.sw-warmup-hot { color: #ff1744; }
.sw-warmup-warm { color: #ff9100; }
.sw-temp-hot { color: #ff1744; }
.sw-temp-warm { color: #ff9100; }
.sw-temp-cool { color: #42a5f5; }
.sw-temp-cold { color: #1565c0; }
