/* ==========  광고 소재 분석 전용 스타일 ========== */

:root {
  --pos: #2BB673;
  --pos-soft: #E5F6EE;
  --neg: #DC5D6F;
  --neg-soft: #FCE7EA;
  --warn: #E89A2A;
  --warn-soft: #FBF1DD;
  --info: #5BB9E8;
  --info-soft: #E0F1FA;
}

/* 매체 핀 */
.media-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.media-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285F4, #34A853 50%, #FBBC05 75%, #EA4335);
}

/* 서브내비 row (서브내비 + baseline pill 가로 정렬) */
.subnav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.subnav {
  display: inline-flex;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 데이터 소스 pill */
.data-source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.data-source.ds-mock { color: var(--text-muted); }
.data-source.ds-active { color: var(--text); border-color: rgba(43,182,115,0.3); }
.data-source.ds-preview { color: #B5781D; border-color: #FBE6BD; background: #FFFCF3; }
.data-source .ds-dot.ds-warn { background: #E89A2A; box-shadow: 0 0 0 3px rgba(232,154,42,0.18); }

.data-source .ds-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.data-source .ds-dot.ds-live {
  background: #2BB673;
  box-shadow: 0 0 0 3px rgba(43,182,115,0.15);
}

.data-source .ds-dot.ds-mock {
  background: #B0B0B8;
}

.data-source .ds-meta {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11px;
}

/* Baseline pill (기준 ROAS) */
.baseline-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
}

.baseline-pill .bp-label {
  color: var(--text-muted);
  font-weight: 500;
}

.baseline-pill input {
  width: 56px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.baseline-pill input::-webkit-outer-spin-button,
.baseline-pill input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.baseline-pill input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.baseline-pill .bp-mode {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}

.baseline-pill .bp-mode.auto {
  background: var(--primary-soft);
  color: var(--primary);
}

.baseline-pill .bp-mode.manual {
  background: #FBF1DD;
  color: #B5781D;
}

.baseline-pill .bp-reset {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.baseline-pill .bp-reset:hover { color: var(--text); }

.subnav-item {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .12s, color .12s;
}

.subnav-item:hover { color: var(--text); }

.subnav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* KPI 4개 카드 가로 정렬 */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.kpi-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.kpi-delta.pos { color: var(--pos); }
.kpi-delta.neg { color: var(--neg); }
.kpi-delta-arrow { font-size: 10px; }
.kpi-delta-prev {
  color: var(--text-soft);
  font-weight: 400;
  margin-left: 4px;
}

/* 카드 헤더 */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  gap: 10px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.3px;
}

.card-sub {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.card { margin-bottom: 16px; padding: 22px 24px 24px; }

.chart-wrap-tall { height: 460px; }
.chart-wrap-mid  { height: 280px; }

/* ===== 트렌드 차트 metric 탭 ===== */
.trend-tabs {
  display: inline-flex;
  background: #F4F4F8;
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
  margin-bottom: 12px;
}

.trend-tab {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.trend-tab:hover { color: var(--text); }

.trend-tab.is-active {
  background: white;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(20,20,30,0.06);
}

/* ===== Top Movers ===== */
.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 1180px) {
  .movers-grid { grid-template-columns: 1fr; }
}

.movers-col {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: white;
}

.movers-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.movers-col-head .mc-arrow { font-size: 14px; }
.movers-col.up    .movers-col-head { color: var(--pos); }
.movers-col.down  .movers-col-head { color: var(--neg); }

.mover-item {
  display: grid;
  grid-template-columns: 1fr auto 90px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}

.mover-item:last-child { border-bottom: none; }

.mover-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.mover-name .mover-meta {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}

.mover-delta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
}

.mover-delta.pos { color: var(--pos); }
.mover-delta.neg { color: var(--neg); }

.mover-spark {
  display: flex;
  justify-content: flex-end;
}

.movers-empty {
  color: var(--text-soft);
  font-size: 12px;
  padding: 14px 0;
  text-align: center;
}

/* ===== Winning Settings (상위 vs 하위 광고 그룹) ===== */
.winning-card { background: linear-gradient(180deg, #FAFAFE 0%, #FFFFFF 100%); }

.winning-head {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.ws-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.ws-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  background: white;
}

.ws-stat-top { border-color: rgba(43,182,115,0.3); }
.ws-stat-bot { border-color: rgba(220,93,111,0.3); }

.ws-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-bottom: 4px;
}

.ws-stat-top .ws-stat-label { color: var(--pos); }
.ws-stat-bot .ws-stat-label { color: var(--neg); }

.ws-stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.ws-stat-meta {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 3px;
}

.ws-arrow {
  text-align: center;
  padding: 0 8px;
}

.ws-arrow-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.ws-arrow-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.ws-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-size: 12px;
}

.ws-groups-col {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ws-groups-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-right: 4px;
}

.ws-groups-top .ws-groups-label { color: var(--pos); }
.ws-groups-bot .ws-groups-label { color: var(--neg); }

.ws-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: var(--text);
}

.ws-group-chip em {
  font-style: normal;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  font-size: 11.5px;
}

.ws-groups-bot .ws-group-chip em { color: var(--neg); }

/* 비교 표 */
.winning-body { margin-top: 4px; }

.ws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.ws-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  background: #FAFAFC;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.2px;
}

.ws-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ws-table tr:last-child td { border-bottom: none; }

.ws-th-dim     { width: 18%; }
.ws-th-top     { width: 24%; color: var(--pos) !important; }
.ws-th-bot     { width: 24%; color: var(--neg) !important; }
.ws-th-insight { width: 34%; }

.ws-cell-dim {
  font-weight: 700;
  color: var(--text);
}

.ws-cell-top { color: var(--text); }
.ws-cell-bot { color: var(--text); }

.ws-cell-val code {
  display: inline-block;
  background: #F4F4F8;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text);
  margin-right: 3px;
}

.ws-cell-val em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}

.ws-cell-insight {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.ws-cell-insight strong {
  color: var(--primary);
  font-weight: 700;
}

.ws-row.gap-big {
  background: linear-gradient(90deg, rgba(92,92,224,0.04), transparent);
}

.ws-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-soft);
  font-size: 12.5px;
}

@media (max-width: 1180px) {
  .ws-summary { grid-template-columns: 1fr; }
  .ws-arrow { padding: 8px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
  .ws-th-dim, .ws-th-top, .ws-th-bot, .ws-th-insight { width: auto; }
}

/* ===== 광고 그룹 리더보드 ===== */
.ag-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.ag-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.ag-compare-btn:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: rgba(92,92,224,0.35);
  color: var(--primary);
}

.ag-compare-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.ag-table th {
  text-align: left;
  background: #FAFAFC;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.ag-table th:hover { color: var(--text); }
.ag-table th.num { text-align: right; }
.ag-table th.is-sorted { color: var(--primary); font-weight: 600; }
.ag-table th.is-sorted::after {
  content: '';
  display: inline-block;
  margin-left: 4px;
  border: 4px solid transparent;
  vertical-align: middle;
}
.ag-table th.is-sorted.dir-desc::after { border-top-color: var(--primary); margin-bottom: -4px; }
.ag-table th.is-sorted.dir-asc::after { border-bottom-color: var(--primary); margin-top: -4px; }

.ag-table .th-check, .ag-table .td-check { width: 32px; padding: 11px 4px 11px 12px; cursor: default; }
.ag-table .ag-compare-check { cursor: pointer; accent-color: var(--primary); }

.ag-row {
  cursor: pointer;
  transition: background .12s;
}

.ag-row:hover { background: #FAFAFC; }
.ag-row.is-expanded { background: var(--primary-soft); }

.ag-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.ag-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ag-name { font-weight: 600; color: var(--text); }
.ag-meta { color: var(--text-muted); font-size: 12px; }
.ag-net { font-size: 12px; color: var(--text); }
.ag-net em { font-style: normal; color: var(--text-soft); font-size: 11px; }

/* 펼친 상세 행 */
.ag-detail-row td {
  background: #FCFCFE;
  padding: 16px 24px;
  border-bottom: 2px solid var(--line);
}

.ag-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 32px;
}

.ag-detail-block {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 12.5px;
}

.ag-detail-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
}

.ag-detail-val {
  color: var(--text);
  line-height: 1.6;
}

.ag-detail-val code {
  display: inline-block;
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text);
  margin-right: 3px;
  margin-bottom: 2px;
}

.ag-detail-meta {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 400;
}

.ag-creative-chip {
  display: inline-block;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  margin-right: 4px;
  margin-bottom: 3px;
  color: var(--text);
}

/* ===== 히트맵 ===== */
.heatmap-wrap {
  overflow-x: auto;
}

.hm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 12px;
}

.hm-th {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
  background: #FAFAFC;
  border-radius: 6px;
}

.hm-th-aud {
  text-align: left;
  color: var(--text);
  font-weight: 600;
  padding: 8px 12px;
  white-space: nowrap;
  background: #FAFAFC;
  border-radius: 6px;
  min-width: 200px;
}

.hm-cell {
  padding: 8px 10px;
  text-align: center;
  border-radius: 6px;
  cursor: default;
  min-width: 90px;
  vertical-align: middle;
}

.hm-empty-cell {
  background: repeating-linear-gradient(45deg, #FAFAFC, #FAFAFC 4px, #F4F4F8 4px, #F4F4F8 8px);
  min-height: 36px;
}

.hm-roas {
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.hm-cost {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.hm-cell.hm-low .hm-roas  { color: #B33A4D; }
.hm-cell.hm-high .hm-roas { color: #1F8E55; }

.hm-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.hm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hm-legend-item i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.hm-legend-meta {
  margin-left: auto;
  color: var(--text-soft);
}

.hm-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-soft);
}

/* ===== 비교 모달 ===== */
.ag-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ag-modal[hidden] { display: none; }

.ag-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 30, 0.5);
}

.ag-modal-card {
  position: relative;
  background: white;
  border-radius: 14px;
  width: min(900px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.ag-modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ag-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.ag-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 6px;
}

.ag-modal-close:hover { background: var(--bg); color: var(--text); }

.ag-modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}

.cmp-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.cmp-side {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
}

.cmp-side.cmp-winner {
  border-color: var(--pos);
  box-shadow: 0 0 0 3px rgba(43,182,115,0.15);
}

.cmp-side-tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
}

.cmp-side.cmp-winner .cmp-side-tag {
  background: var(--pos-soft);
  color: var(--pos);
}

.cmp-side-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.cmp-side-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.cmp-side-roas {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cmp-side.cmp-winner .cmp-side-roas { color: var(--pos); }

.cmp-side-roas-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.cmp-vs {
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 700;
}

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.cmp-table th {
  background: #FAFAFC;
  text-align: left;
  font-weight: 600;
  padding: 10px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
}

.cmp-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.cmp-table tr:last-child td { border-bottom: none; }

.cmp-section td {
  background: #F4F4F8;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 14px;
}

.cmp-label { font-weight: 600; color: var(--text); width: 22%; }

.cmp-val {
  color: var(--text);
  word-break: break-word;
}

.cmp-val code {
  display: inline-block;
  background: #F4F4F8;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  margin-right: 3px;
  margin-bottom: 2px;
}

.cmp-meta { color: var(--text-soft); font-size: 11px; font-weight: 400; }

.cmp-diff {
  background: linear-gradient(90deg, rgba(232,154,42,0.07), transparent);
}

.cmp-diff .cmp-label { color: var(--warn); }

.cmp-takeaway {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

.cmp-takeaway strong { color: var(--primary); }

@media (max-width: 720px) {
  .cmp-head { grid-template-columns: 1fr; }
  .cmp-vs { display: none; }
  .ag-detail-grid { grid-template-columns: 1fr; }
}

/* ===== 필터 바 ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px;
  background: #FAFAFC;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
}

.filter-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text-muted);
  flex: 0 1 220px;
}

.filter-search input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  padding: 7px 6px;
  width: 100%;
  outline: none;
  color: var(--text);
}

.filter-search input::placeholder { color: var(--text-soft); }

.filter-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.filter-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  flex: 1 1 auto;
}

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-group-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.filter-chip {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
  white-space: nowrap;
}

.filter-chip:hover { color: var(--text); border-color: var(--text-soft); }

.filter-chip.is-active {
  background: var(--primary-soft);
  border-color: rgba(92,92,224,0.35);
  color: var(--primary);
  font-weight: 600;
}

.filter-clear {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--neg);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: auto;
}

.filter-clear:hover { background: var(--neg-soft); }

/* Insight 카드 */
.insight-card { background: linear-gradient(180deg, #FAFAFE 0%, #FFFFFF 100%); }

.insight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.insight-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  font-size: 13px;
  line-height: 1.55;
}

.insight-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.insight-icon.pos { background: var(--pos-soft); color: var(--pos); }
.insight-icon.neg { background: var(--neg-soft); color: var(--neg); }
.insight-icon.warn { background: var(--warn-soft); color: var(--warn); }
.insight-icon.info { background: var(--info-soft); color: var(--info); }

.insight-item strong { color: var(--text); font-weight: 700; }
.insight-item .pos-num { color: var(--pos); font-weight: 700; }
.insight-item .neg-num { color: var(--neg); font-weight: 700; }
.insight-item .chip-name {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 1px 7px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 12px;
  margin: 0 1px;
}

/* Quadrant legend */
.quadrant-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.quadrant-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot-scale   { background: #2BB673; }
.dot-test    { background: #5BB9E8; }
.dot-cut     { background: #DC5D6F; }
.dot-monitor { background: #B0B0B8; }

/* 2 column grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.grid-2 .card { margin-bottom: 16px; }

@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* Trend meta */
.trend-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.trend-meta strong {
  color: var(--text);
  font-weight: 700;
  margin-right: 4px;
}

/* 테이블 */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

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

.lb-table th {
  text-align: left;
  background: #FAFAFC;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.lb-table th:hover { color: var(--text); }
.lb-table th.num { text-align: right; }
.lb-table th.is-sorted { color: var(--primary); font-weight: 600; }
.lb-table th.is-sorted::after {
  content: '';
  display: inline-block;
  margin-left: 4px;
  border: 4px solid transparent;
  vertical-align: middle;
}
.lb-table th.is-sorted.dir-desc::after { border-top-color: var(--primary); margin-bottom: -4px; }
.lb-table th.is-sorted.dir-asc::after { border-bottom-color: var(--primary); margin-top: -4px; }

.lb-table tbody tr {
  cursor: pointer;
  transition: background .12s;
}

.lb-table tbody tr:hover { background: #FAFAFC; }
.lb-table tbody tr.is-selected { background: var(--primary-soft); }

.lb-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.lb-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lb-table td.creative-name {
  font-weight: 600;
  color: var(--text);
}

.lb-table td .tag-row {
  display: block;
  font-weight: 400;
  color: var(--text-soft);
  font-size: 11px;
  margin-top: 2px;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.signal-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.signal-scale   { background: #E5F6EE; color: #1F8E55; }
.signal-scale .pill-dot   { background: #2BB673; }
.signal-test    { background: #E0F1FA; color: #2683B5; }
.signal-test .pill-dot    { background: #5BB9E8; }
.signal-maintain{ background: #F4F4F8; color: #6E6E78; }
.signal-maintain .pill-dot{ background: #B0B0B8; }
.signal-cut     { background: #FCE7EA; color: #B33A4D; }
.signal-cut .pill-dot     { background: #DC5D6F; }
.signal-fatigue { background: #FBF1DD; color: #B5781D; }
.signal-fatigue .pill-dot { background: #E89A2A; }

.delta-cell {
  font-weight: 600;
}
.delta-cell.pos { color: var(--pos); }
.delta-cell.neg { color: var(--neg); }
.delta-cell.flat { color: var(--text-soft); }

.spark { display: inline-block; vertical-align: middle; }

/* 날짜 picker 사용자 지정 */
.date-range-caret {
  color: var(--text-muted);
  display: inline-flex;
  margin-left: 4px;
}

.date-custom {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding: 8px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.date-custom-title {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 8px;
}

.date-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}

.date-custom-row input[type="date"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
}

.date-custom-row input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.date-custom-row span {
  color: var(--text-soft);
  font-size: 12px;
}

.date-apply {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin: 0 4px;
}

.date-apply:hover { background: var(--primary-strong); }

/* 썸네일 컬럼 */
.lb-table .th-thumb { width: 76px; }
.lb-table td.td-thumb { padding: 8px; }

.thumb {
  display: block;
  width: 64px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  background: #ECECEF;
  position: relative;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 14px;
}

/* 소재명 + 분류 뱃지 */
.cname-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--text);
}

.vbadge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.vbadge-hero  { background: #FFF4D6; color: #B5781D; }
.vbadge-new   { background: #E0F1FA; color: #2683B5; }
.vbadge-accel { background: #E5F6EE; color: #1F8E55; }
.vbadge-spike { background: #FCE7EA; color: #B33A4D; }
.vbadge-tired { background: #2D2D33; color: #FFFFFF; }

/* YouTube 누적 조회수 */
.ytv-cell .ytv-main {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ytv-cell .ytv-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.ytv-empty { color: var(--text-soft); }
