/* K线专业投研增强外挂层（RS相对强弱 + 种子→树苗信号轨 + ATR盈亏比与仓位反推尺 · 物理事件隔离零延迟版） */

.kline-advisor-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.technical-chart-shell.is-advisor-picking,
.technical-chart-shell.is-advisor-picking .technical-chart {
  cursor: crosshair !important;
}

.technical-analysis-inline-panel {
  position: relative;
}

.kline-advisor-dock {
  position: absolute;
  top: 48px;
  right: 14px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: min(395px, calc(100% - 72px));
  pointer-events: none;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.kline-advisor-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.36);
  background: rgba(248, 250, 252, 0.94);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  flex-wrap: wrap;
}

.kline-advisor-pill {
  display: inline-flex;
  align-items: center;
  height: 25px;
  padding: 0 10px;
  border-radius: 999px !important;
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color 90ms ease, color 90ms ease, transform 60ms ease;
}

.kline-advisor-pill:hover {
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
}

.kline-advisor-pill:active {
  transform: scale(0.96);
}

.kline-advisor-pill.is-active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.kline-advisor-pill.is-active.is-warn {
  background: #d97706;
  border-color: #b45309;
  color: #ffffff;
}

.kline-advisor-fold {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50% !important;
  border: none;
  background: rgba(15, 23, 42, 0.07);
  color: #475569;
  font-size: 12px;
  cursor: pointer;
}

.kline-advisor-fold[hidden] {
  display: none !important;
}

.kline-advisor-card-slot {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.kline-advisor-card {
  width: 100%;
  min-width: 285px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  color: #0f172a;
  font-size: 11.5px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kline-advisor-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.kline-advisor-tabs button {
  height: 22px;
  padding: 0 8px;
  border: none;
  border-radius: 999px !important;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.kline-advisor-tabs button.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.kline-advisor-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.kline-advisor-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kline-advisor-card__meta {
  font-size: 11px;
  line-height: 1.45;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.kline-advisor-mini-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.kline-advisor-mini-seg button {
  height: 21px;
  padding: 0 8px;
  border: none;
  border-radius: 999px !important;
  background: transparent;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.kline-advisor-mini-seg button.is-active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}

.kline-advisor-odds {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.kline-advisor-odds.is-good {
  background: #ecfdf5;
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #047857;
}

.kline-advisor-odds.is-warn {
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.48);
  color: #b45309;
}

.kline-advisor-pick-btn,
.kline-advisor-reset-btn {
  height: 23px;
  padding: 0 9px;
  border-radius: 999px !important;
  border: 1px solid rgba(37, 99, 235, 0.32);
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.kline-advisor-reset-btn {
  border-color: rgba(100, 116, 139, 0.32);
  background: #f8fafc;
  color: #475569;
}

.kline-advisor-reset-btn[hidden] {
  display: none !important;
}

.kline-advisor-pick-btn.is-picking {
  background: #1d4ed8;
  color: #ffffff;
}

.kline-advisor-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.kline-advisor-atr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.kline-advisor-atr-grid .is-stop {
  color: #dc2626;
}

.kline-advisor-atr-grid .is-target {
  color: #047857;
}

.kline-advisor-cap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.kline-advisor-input-lbl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #475569;
  font-weight: 600;
}

.kline-advisor-input,
.kline-advisor-select {
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #ffffff;
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.kline-advisor-input {
  width: 62px;
}

.kline-advisor-input--price {
  width: 72px;
}

.kline-advisor-input:focus,
.kline-advisor-select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  border-color: #2563eb;
}

.kline-advisor-pos-box {
  padding: 5px 8px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid rgba(37, 99, 235, 0.16);
  color: #1e293b;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.kline-advisor-tooltip {
  position: absolute;
  z-index: 15;
  max-width: 320px;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-variant-numeric: tabular-nums;
}

.kline-advisor-tooltip[hidden] {
  display: none;
}

/* 深色模式高对比度适配 */
html[data-table-theme='dark'] .kline-advisor-bar,
html[data-app-theme='modern-dark'] .kline-advisor-bar,
body.dark-theme .kline-advisor-bar {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.26);
}

html[data-table-theme='dark'] .kline-advisor-pill,
html[data-app-theme='modern-dark'] .kline-advisor-pill {
  color: #e2e8f0;
}

html[data-table-theme='dark'] .kline-advisor-pill:hover {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
}

html[data-table-theme='dark'] .kline-advisor-pill.is-active {
  background: #2563eb;
  color: #ffffff;
}

html[data-table-theme='dark'] .kline-advisor-fold {
  background: rgba(255, 255, 255, 0.10);
  color: #cbd5e1;
}

html[data-table-theme='dark'] .kline-advisor-card,
html[data-app-theme='modern-dark'] .kline-advisor-card {
  background: rgba(15, 23, 42, 0.97);
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

html[data-table-theme='dark'] .kline-advisor-tabs {
  border-bottom-color: rgba(148, 163, 184, 0.2);
}

html[data-table-theme='dark'] .kline-advisor-tabs button {
  background: #1e293b;
  color: #cbd5e1;
}

html[data-table-theme='dark'] .kline-advisor-tabs button.is-active {
  background: #172554;
  color: #93c5fd;
}

html[data-table-theme='dark'] .kline-advisor-card__meta,
html[data-table-theme='dark'] .kline-advisor-label,
html[data-table-theme='dark'] .kline-advisor-input-lbl {
  color: #cbd5e1;
}

html[data-table-theme='dark'] .kline-advisor-mini-seg {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-table-theme='dark'] .kline-advisor-mini-seg button {
  color: #cbd5e1;
}

html[data-table-theme='dark'] .kline-advisor-mini-seg button.is-active {
  background: #0f172a;
  color: #93c5fd;
}

html[data-table-theme='dark'] .kline-advisor-odds.is-good {
  background: #052e16;
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

html[data-table-theme='dark'] .kline-advisor-odds.is-warn {
  background: #451a03;
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde68a;
}

html[data-table-theme='dark'] .kline-advisor-reset-btn {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

html[data-table-theme='dark'] .kline-advisor-atr-grid {
  color: #e2e8f0;
}

html[data-table-theme='dark'] .kline-advisor-atr-grid .is-stop {
  color: #fca5a5;
}

html[data-table-theme='dark'] .kline-advisor-atr-grid .is-target {
  color: #6ee7b7;
}

html[data-table-theme='dark'] .kline-advisor-input,
html[data-table-theme='dark'] .kline-advisor-select {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.35);
  color: #f8fafc;
}

html[data-table-theme='dark'] .kline-advisor-pos-box {
  background: #1e293b;
  border-color: rgba(96, 165, 250, 0.28);
  color: #f1f5f9;
}
