/* ─────────────────────────────────────────────────────────────
    17  트렌드 워크스페이스 (ECharts)
───────────────────────────────────────────────────────────── */

/* 타임바 */
.trend-timebar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.trend-timebar .tr-sep { width: 1px; height: 22px; background: var(--bd); margin: 0 2px; }
.tr-quick { display: inline-flex; gap: 4px; }
.tr-quick button,
.tr-tog {
  background: var(--s3); border: 1px solid var(--bd); color: var(--t1);
  border-radius: var(--r); padding: 5px 9px; cursor: pointer; font-size: 12px;
  transition: all var(--tr);
}
.tr-quick button:hover, .tr-tog:hover { border-color: var(--bd2); color: var(--t0); }
.tr-tog.on   { background: var(--a); border-color: var(--a); color: #fff; }
#tr-live-btn.live-on { background: var(--red); border-color: var(--red); color: #fff; }
.tr-layers { display: inline-flex; gap: 4px; flex-wrap: wrap; }

.trend-timebar .dt-display { min-width: 150px; }
.trend-timebar .inp { width: auto; }

.tr-groupbar { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; }
.tr-groupbar select { min-width: 150px; }

/* 메인 (차트 + Insights 슬롯) */
.trend-main { display: flex; gap: 12px; align-items: stretch; }
.trend-chartwrap { flex: 1; min-width: 0; }
.trend-chart { width: 100%; height: 480px; }
.trend-insights { width: 320px; flex-shrink: 0; }
.trend-insights.hidden { display: none; }

/* 범례 / 통계 표 */
.tr-legend, .tr-analog { width: 100%; border-collapse: collapse; font-size: 12px; }
.tr-legend th, .tr-analog th {
  text-align: left; color: var(--t2); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 6px 8px; border-bottom: 1px solid var(--bd); position: sticky; top: 0; background: var(--s2);
}
.tr-legend td, .tr-analog td { padding: 5px 8px; border-bottom: 1px solid var(--bd); color: var(--t0); }
.tr-legend tbody tr { cursor: pointer; transition: background var(--tr); }
.tr-legend tbody tr:hover, .tr-analog tbody tr:hover { background: var(--s3); }
.tr-legend tbody tr.tr-sel { background: var(--ag); font-weight: 600; }
.tr-analog tbody tr.tr-pick { background: rgba(16,185,129,.14); }
.tr-tag { font-family: var(--fm); white-space: nowrap; }
.tr-legend .val, .tr-analog .val { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--fm); }
.tr-legend .mut { color: var(--t2); }
.tr-legend input[type=color] { width: 28px; height: 20px; border: none; background: none; padding: 0; cursor: pointer; }
.tr-legend select { padding: 2px 4px; font-size: 11px; }
.tr-rm { background: none; border: none; color: var(--t2); cursor: pointer; font-size: 14px; line-height: 1; }
.tr-rm:hover { color: var(--red); }

.tr-empty { padding: 28px; text-align: center; color: var(--t2); }

/* Insights 패널 */
.tr-ins-hd { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 8px; }
.tr-ins-body { font-size: 13px; color: var(--t1); line-height: 1.55; overflow-y: auto; max-height: 460px; }

/* 그룹 빌더 모달 */
.tr-modal { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; }
.tr-modal.hidden { display: none; }
.tr-modal-box { background: var(--s2); border: 1px solid var(--bd2); border-radius: var(--rl);
  width: min(960px, 93vw); max-height: 86vh; display: flex; flex-direction: column; }
.tr-modal-hd { display: flex; gap: 8px; align-items: center; padding: 16px; border-bottom: 1px solid var(--bd); }
.tr-modal-hd .inp { flex: 1; }
.tr-analog-wrap { overflow-y: auto; flex: 1; padding: 0 16px; }
.tr-modal-ft { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 14px 16px; border-top: 1px solid var(--bd); }
.tr-modal-ft #tr-builder-count { margin-right: auto; color: var(--t2); font-size: 12px; }

/* Y축 zoom 인디케이터 */
.tr-yzoom-indicator {
  display: none; font-size: 11px; color: var(--a); font-weight: 600;
  padding: 3px 8px; border: 1px solid var(--a); border-radius: var(--r);
  vertical-align: middle; white-space: nowrap; cursor: pointer;
}
.tr-yzoom-indicator.active { display: inline-block; }
.tr-yzoom-indicator:hover { background: var(--s3); }

/* 라이브 현재값 강조 */
.tr-legend .tr-live-cur { color: var(--grn); font-weight: 700; }
