/* =============================================
   Section 3 — 구좌 묶음 비교 페이지 스타일
   ============================================= */

/* ── 컨트롤 바 ──────────────────────────────── */
.s3-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.s3-period-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  padding: 4px 10px;
  background: var(--snow);
  border-radius: var(--radius-sm);
}

.s3-package-add {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.s3-btn {
  font-family: var(--font-base);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--slate);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.s3-btn:hover { background: var(--snow); }
.s3-btn--ghost { color: var(--slate); }

/* ── 비교 영역 ──────────────────────────────── */
.s3-compare {
  padding: var(--sp-3) var(--sp-4);
  background: var(--snow);
  min-height: calc(100vh - 200px);
}

.s3-compare__header {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.s3-col-head {
  background: var(--mist);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.s3-col-head--month { background: transparent; }

.s3-compare__body {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.s3-empty-state {
  padding: var(--sp-12) var(--sp-4);
  text-align: center;
  color: var(--silver);
  font-size: 14px;
}

/* 월 단위 행: As-is | 월 라벨 | To-be */
.s3-month-row {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.s3-month-row:last-child { border-bottom: none; }

.s3-month-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mist);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  min-height: 36px;
}

/* 칩 컨테이너 (As-is / To-be 각각) */
.s3-chip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.s3-chip-list:empty::before {
  content: '—';
  color: var(--silver);
  font-size: 12px;
  padding: 4px;
}

/* "+ 구좌 추가" 버튼 — To-be 컬럼 하단 */
.s3-add-slot-btn {
  margin-top: 4px;
  padding: 6px 10px;
  font-family: var(--font-base);
  font-size: 11px;
  font-weight: 600;
  color: var(--slate);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  align-self: flex-start;
}
.s3-add-slot-btn:hover {
  background: var(--mist);
  color: var(--ink);
  border-color: var(--silver);
}

/* ── 슬롯 Picker 모달 ─────────────────────── */
.s3-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.s3-picker-overlay[hidden] { display: none; }

.s3-picker {
  background: var(--white);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.s3-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.s3-picker__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.s3-picker__close {
  width: 28px; height: 28px;
  font-size: 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--slate);
  transition: background var(--t-fast);
}
.s3-picker__close:hover { background: var(--mist); }

.s3-picker__search {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.s3-picker__search input {
  width: 100%;
  font-family: var(--font-base);
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.s3-picker__search input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.s3-picker__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) 0;
}

.s3-picker-section {
  padding: var(--sp-2) 0;
}
.s3-picker-section__head {
  position: sticky;
  top: 0;
  background: var(--snow);
  padding: 6px var(--sp-4);
  font-size: 11px;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.s3-picker-section__head--empty  { color: var(--success); }
.s3-picker-section__head--filled { color: var(--warning); }

.s3-picker-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-4);
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background var(--t-fast);
}
.s3-picker-row:hover { background: var(--snow); }

.s3-picker-row__indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.s3-picker-row__indicator--empty  { background: var(--success); }
.s3-picker-row__indicator--filled { background: var(--warning); }

.s3-picker-row__main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.s3-picker-row__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s3-picker-row__breadcrumb {
  font-size: 10.5px;
  color: var(--silver);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s3-picker-row__existing {
  font-size: 11px;
  color: var(--warning);
  font-weight: 500;
  padding: 2px 6px;
  background: rgba(243, 156, 18, 0.1);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.s3-picker-empty {
  padding: var(--sp-6);
  text-align: center;
  color: var(--silver);
  font-size: 13px;
}

/* ── 슬롯 칩 ─────────────────────────────── */
.s3-chip {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}

/* 상태별 색상 */
.s3-chip--kept {
  background: #DBE9F8;       /* 시안 파란색 */
  color: #1E3A5F;
}
.s3-chip--added {
  background: #FCE7B4;       /* 시안 노란색 */
  color: #6B4A00;
  border-color: #E8C56C;
}
.s3-chip--removed {
  background: #E8DBF7;       /* 시안 보라색 */
  color: #4A2E7A;
  text-decoration: line-through;
  text-decoration-color: rgba(74, 46, 122, 0.6);
}

/* 칩 내부 요소 */
.s3-chip__name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s3-chip__meta {
  font-size: 11px;
  color: inherit;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s3-chip__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.08);
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.s3-chip__action:hover { background: rgba(0,0,0,0.16); }

/* ── 비교요약 ───────────────────────────── */
.s3-summary {
  background: var(--white);
  margin: 0 var(--sp-4) var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}
.s3-summary__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--sp-3);
}

.s3-summary__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}

.s3-metric {
  background: var(--snow);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.s3-metric--wide { grid-column: span 2; }
.s3-metric--full { grid-column: 1 / -1; }

/* ── 브랜드 시너지 ───────────────────────── */
.s3-synergy {
  background: linear-gradient(135deg, var(--snow) 0%, rgba(155, 202, 60, 0.08) 100%);
  border-color: rgba(155, 202, 60, 0.4);
}
.s3-synergy__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.s3-synergy__row {
  margin: 0;
  align-items: baseline;
}
.s3-synergy__bars {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
}
.s3-syn-dim {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.s3-syn-dim__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.s3-syn-dim__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s3-syn-dim__delta {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.s3-syn-dim__delta--up   { background: rgba(46, 204, 113, 0.15); color: var(--success, #2ECC71); }
.s3-syn-dim__delta--down { background: rgba(231, 76, 60, 0.15);  color: var(--error, #E74C3C); }
.s3-syn-dim__delta--zero { background: var(--mist); color: var(--silver); }

.s3-syn-dim__bar-wrap {
  position: relative;
  height: 16px;
  background: var(--mist);
  border-radius: 4px;
  overflow: hidden;
}
.s3-syn-dim__bar-asis,
.s3-syn-dim__bar-tobe {
  position: absolute;
  left: 0;
  top: 0; bottom: 0;
  border-radius: 4px;
  transition: width var(--t-normal);
}
.s3-syn-dim__bar-asis {
  background: var(--silver);
  opacity: 0.45;
  height: 16px;
}
.s3-syn-dim__bar-tobe {
  background: linear-gradient(90deg, var(--green) 0%, #5BA8D4 100%);
  height: 8px;
  top: 4px;
  bottom: 4px;
}
.s3-syn-dim__values {
  font-size: 10px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.s3-syn-dim__values .from { color: var(--silver); }
.s3-syn-dim__values .to   { color: var(--ink); font-weight: 600; }

.s3-metric__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 4px;
}

.s3-metric__row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin: 4px 0 6px;
}
.s3-metric__from { font-size: 18px; font-weight: 600; color: var(--silver); }
.s3-metric__arrow { color: var(--silver); }
.s3-metric__to   { font-size: 22px; font-weight: 700; color: var(--ink); }
.s3-metric__delta {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  margin-left: auto;
}
.s3-metric__delta--up   { background: rgba(46, 204, 113, 0.15); color: var(--success); }
.s3-metric__delta--down { background: rgba(231, 76, 60, 0.15);  color: var(--error); }
.s3-metric__delta--zero { background: var(--mist); color: var(--slate); }

.s3-metric__hint {
  font-size: 10.5px;
  color: var(--silver);
  letter-spacing: 0.01em;
}

/* 변경 카운트 */
.s3-change-added   { font-size: 20px; font-weight: 700; color: var(--success); }
.s3-change-removed { font-size: 20px; font-weight: 700; color: var(--error); margin-left: var(--sp-3); }

/* ── AI · 브랜드 정성 평가 ─────────────────── */
.s3-ai-eval {
  background: linear-gradient(180deg, var(--white) 0%, var(--snow) 100%);
  margin: 0 var(--sp-4) var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.s3-ai-eval[hidden] { display: none; }

.s3-ai-eval::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green) 0%, #5BA8D4 50%, #B07ED4 100%);
}

.s3-ai-eval__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px dashed var(--border);
}

.s3-ai-eval__title-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.s3-ai-eval__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green) 0%, #5BA8D4 100%);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
}
.s3-ai-eval__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.s3-ai-eval__badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(155, 202, 60, 0.15);
  color: var(--green-dark, #6BA52A);
  border: 1px solid rgba(155, 202, 60, 0.4);
  text-transform: uppercase;
}

.s3-ai-eval__brand-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.s3-ai-eval__brand-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate);
  letter-spacing: 0.02em;
}
.s3-ai-eval__brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  padding: 4px 10px;
  background: var(--mist);
  border-radius: var(--radius-sm);
}
.s3-ai-eval__overall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--white);
  background: var(--ink);
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

.s3-ai-eval__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
}

.s3-ai-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
  position: relative;
}
.s3-ai-card:hover {
  box-shadow: var(--shadow-1);
  border-color: var(--silver);
}

.s3-ai-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.s3-ai-card__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.s3-ai-card__tier {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.s3-ai-card__tier--high { background: rgba(46, 204, 113, 0.15); color: var(--success, #2ECC71); }
.s3-ai-card__tier--mid  { background: rgba(243, 156, 18, 0.15); color: var(--warning, #E68A1A); }
.s3-ai-card__tier--low  { background: rgba(231, 76, 60, 0.15);  color: var(--error, #E74C3C); }

.s3-ai-card__score-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.s3-ai-card__score {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.s3-ai-card__score-max {
  font-size: 12px;
  color: var(--silver);
  font-weight: 600;
}

.s3-ai-card__bar-wrap {
  position: relative;
  height: 6px;
  background: var(--mist);
  border-radius: 3px;
  overflow: hidden;
}
.s3-ai-card__bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: 3px;
  transition: width var(--t-normal);
}
.s3-ai-card__bar--high { background: var(--green); }
.s3-ai-card__bar--mid  { background: #F2B342; }
.s3-ai-card__bar--low  { background: #E07B6B; }

.s3-ai-card__evidence {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--slate);
  margin-top: 2px;
}
.s3-ai-card__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.s3-ai-card__source-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--snow);
  color: var(--slate);
  border: 1px solid var(--border);
}

.s3-ai-eval__hint {
  margin-top: var(--sp-3);
  font-size: 10.5px;
  color: var(--silver);
  font-style: italic;
}

/* 옵션 분포 막대 */
.s3-distribution {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
}
.s3-dist-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  font-size: 11px;
  color: var(--ink);
}
.s3-dist-row__label { font-weight: 600; color: var(--slate); }
.s3-dist-row__bar-wrap {
  position: relative;
  height: 14px;
  background: var(--mist);
  border-radius: 7px;
  overflow: hidden;
}
.s3-dist-row__bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--green);
  transition: width var(--t-normal);
}
.s3-dist-row__bar--asis  { background: var(--silver); opacity: 0.4; }
.s3-dist-row__bar--tobe  { background: var(--green-dark); }
.s3-dist-row__count { font-size: 11px; font-weight: 700; min-width: 50px; text-align: right; }
