/* =========================================================
   체험단 자동선정 — 정적 데모
   현대적 admin SaaS 룩 (사이드바 다크, 본문 라이트)
   ========================================================= */

:root {
  --sidebar-w: 240px;
  --header-h: 60px;

  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --brand-strong: #4338ca;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --bg-page: var(--gray-50);
  --bg-card: #ffffff;
  --text-body: var(--gray-700);
  --text-heading: var(--gray-900);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #06b6d4;

  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.06);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* 규격 — 통일 높이/패딩 */
  --h-btn: 38px;
  --h-btn-sm: 30px;
  --h-input: 38px;
  --h-input-sm: 32px;
  --h-card-header: 52px;
  --h-kpi-card: 110px;
  --pad-card: 18px;
  --pad-card-header: 14px 18px;
  --gap-card: 16px;
}

/* ─── 베이스 ─────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--text-heading); font-weight: 700; }
.text-muted { color: var(--text-muted) !important; }
code { color: var(--brand-strong); background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; font-size: .85em; }

/* ─── 사이드바 (좌측 고정) ─────────────────────── */
.app-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--gray-900);
  color: var(--gray-300);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px;
  text-decoration: none; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand:hover { color: #fff; }
.brand-mark {
  width: 34px; height: 34px;
  background: var(--brand);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.brand-name { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-section {
  padding: 14px 20px 6px;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-500);
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px;
  color: var(--gray-300);
  text-decoration: none;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav-item.active {
  background: rgba(79,70,229,0.18);
  color: #fff;
  border-left-color: var(--brand);
}
.nav-item i { font-size: 1.05rem; width: 18px; text-align: center; opacity: 0.85; }
.nav-item.active i { opacity: 1; }

.nav-item-ai i { color: #fbbf24; opacity: 1; }
.nav-item-ai:hover i { color: #fcd34d; }

/* AI 패널 (insight/추천 등) */
.ai-panel {
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 100%);
  color: #e0e7ff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ai-panel::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(251,191,36,0.25), transparent 70%);
}
.ai-panel .ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(251,191,36,0.15); color: #fcd34d;
  padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; margin-bottom: 8px;
}
.ai-panel h6 { color: #fff; margin: 0 0 8px; font-weight: 700; }
.ai-panel .ai-body { font-size: .9rem; line-height: 1.6; }
.ai-panel button { background: #fbbf24; color: #1e1b4b; border: 0; }
.ai-panel button:hover { background: #fcd34d; }

/* 위험 감지 카드 */
.risk-card { border-left: 4px solid var(--gray-300); padding: 12px 14px; background: var(--gray-50); border-radius: var(--radius-md); margin-bottom: 8px; }
.risk-card.risk-high { border-color: var(--danger); background: #fef2f2; }
.risk-card.risk-medium { border-color: var(--warning); background: #fffbeb; }
.risk-card.risk-ok { border-color: var(--success); background: #f0fdf4; }
.risk-card .risk-title { font-weight: 600; margin: 0 0 4px; }
.risk-card .risk-action { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }
.risk-card:last-child { margin-bottom: 0; }

.sidebar-footer {
  margin: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  color: var(--gray-300);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: .85rem;
  text-align: center;
}
.sidebar-footer:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ─── 상단 헤더 ────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  z-index: 1020;
}
.app-header .page-title h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}
.app-header .page-title .text-muted { font-size: .78rem; }

.user-trigger {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid transparent;
  padding: 6px 12px; border-radius: var(--radius-md);
  cursor: pointer;
}
.user-trigger:hover { background: var(--gray-50); border-color: var(--border); }
.user-avatar { font-size: 1.4rem; color: var(--gray-600); display: inline-flex; }
.user-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-info strong { font-size: .85rem; color: var(--text-heading); font-weight: 600; }
.user-info small { font-size: .7rem; color: var(--text-muted); }
.role-super, .role-operator {
  font-size: .65rem; padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.role-super { background: #fee2e2; color: #991b1b; }
.role-operator { background: var(--brand-soft); color: var(--brand-strong); }

/* ─── 본문 영역 (사이드바 + 헤더가 있는 페이지) ─── */
body[data-nav] {
  padding-left: var(--sidebar-w);
  padding-top: var(--header-h);
}
body[data-nav] > main,
body[data-nav] > .container-fluid {
  padding: 24px 0px !important;
  max-width: 1600px;
}
/* 본문 내부 콘텐츠는 헤더와 같은 좌우 정렬 (28px) */
body[data-nav] > main > *,
body[data-nav] > .container-fluid > * {
  padding-left: 28px;
  padding-right: 28px;
}
/* row는 자체 gutter가 있으니 패딩 보정 */
body[data-nav] > main > .row,
body[data-nav] > .container-fluid > .row {
  padding-left: 20px;
  padding-right: 20px;
  margin-left: 0;
  margin-right: 0;
}
/* 모달은 본문 패딩 영향받지 않음 */
body[data-nav] > main > .modal,
body[data-nav] > .container-fluid > .modal {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body[data-nav] > main > .modal .modal-dialog,
body[data-nav] > .container-fluid > .modal .modal-dialog {
  margin: 1.75rem auto;
}

/* ─── 카드 공통 (높이 통일) ───────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: var(--pad-card-header);
  font-weight: 600;
  color: var(--text-heading);
  min-height: var(--h-card-header);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.card-header.bg-white { background: transparent !important; }
.card-header strong { font-weight: 600; }
.card-body { padding: var(--pad-card); flex: 1; }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  min-height: var(--h-card-header);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
/* row 안의 카드 동일 높이 */
.row > [class*="col-"] > .card { height: 100%; }

/* ─── KPI 카드 (동일 높이) ───────────────────── */
.kpi-card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xs);
  transition: transform .15s, box-shadow .15s;
  min-height: var(--h-kpi-card);
}
.kpi-card .card-body { padding: 16px 18px; display: flex; flex-direction: column; justify-content: center; }
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kpi-label { color: var(--text-muted); font-size: .82rem; font-weight: 500; margin-bottom: 6px; }
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: var(--text-heading); }
.kpi-card small { color: var(--text-muted); font-size: .72rem; margin-top: 4px; }

/* ─── 등급 배지 (통일 padding + min-width) ──── */
.badge {
  font-weight: 600;
  padding: 5px 9px;
  font-size: .72rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  letter-spacing: 0.02em;
}
.grade-S { background: #f59e0b; color: #fff; }
.grade-A { background: #4f46e5; color: #fff; }
.grade-B { background: #10b981; color: #fff; }
.grade-C { background: #94a3b8; color: #fff; }
.grade-D { background: #ef4444; color: #fff; }
.badge.grade-S, .badge.grade-A, .badge.grade-B, .badge.grade-C, .badge.grade-D {
  min-width: 28px;
  padding: 5px 7px;
}

/* ─── 결과 배지 ────────────────────────────────── */
.result-selected     { background: #d1fae5; color: #065f46; }
.result-reserve      { background: #fef3c7; color: #92400e; }
.result-excluded     { background: var(--gray-100); color: var(--gray-600); }
.result-disqualified { background: #fee2e2; color: #991b1b; }

/* ─── 상태 배지 ────────────────────────────────── */
.status-recruiting { background: #dbeafe; color: #1e40af; }
.status-selecting  { background: #fef3c7; color: #92400e; }
.status-confirmed  { background: #d1fae5; color: #065f46; }
.status-completed  { background: var(--gray-100); color: var(--gray-600); }
.status-cancelled  { background: #fee2e2; color: #991b1b; }
.status-draft      { background: var(--gray-100); color: var(--gray-600); }

/* ─── 슬라이더 (행 높이 고정) ───────────────── */
.slider-row {
  display: grid;
  grid-template-columns: 130px 1fr 56px;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  margin-bottom: 8px;
}
.slider-row label {
  font-size: .85rem; font-weight: 500; margin: 0;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slider-row .weight-value {
  text-align: right; font-weight: 700;
  font-family: 'Menlo', 'Monaco', monospace;
  color: var(--text-heading);
  font-size: .9rem;
}
.form-range { accent-color: var(--brand); }
.weight-total {
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-align: center;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.weight-total.ok  { background: #d1fae5; color: #065f46; }
.weight-total.bad { background: #fee2e2; color: #991b1b; }

/* ─── 테이블 (행 높이 통일) ──────────────────── */
.table { color: var(--text-body); margin: 0; }
.table > :not(caption) > * > * { padding: 12px 14px; vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: 8px 12px; }
.table thead th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  height: 44px;
}
.table tbody tr { border-color: var(--gray-100); height: 52px; }
.table-sm tbody tr { height: 40px; }
.table-hover tbody tr:hover { background: var(--gray-50); }
.table .btn-sm { min-height: 28px; padding: 0 10px; }

.applicant-table th { font-size: .7rem; }
.applicant-table td { font-size: .85rem; vertical-align: middle; }
.applicant-table tbody tr { height: 56px; }
.applicant-table tbody tr.is-disqualified { opacity: 0.45; }

.score-bar {
  height: 6px; background: var(--gray-200);
  border-radius: 3px; overflow: hidden;
  display: inline-block; vertical-align: middle;
  width: 60px; margin-right: 6px;
}
.score-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-strong) 100%);
}

/* ─── 캠페인 카드 (동일 높이) ───────────────── */
.campaign-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--bg-card);
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  height: 100%;
}
.campaign-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: inherit;
}

/* ─── 버튼 (높이 통일) ──────────────────────── */
.btn {
  font-weight: 500;
  border-radius: var(--radius-md);
  min-height: var(--h-btn);
  padding: 0 14px;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  white-space: nowrap;
}
.btn-sm { min-height: var(--h-btn-sm); padding: 0 10px; font-size: .8rem; }
.btn-lg { min-height: 46px; padding: 0 18px; font-size: 1rem; }
.btn i { font-size: 1em; line-height: 0; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-strong); border-color: var(--brand-strong); color: #fff;
}
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-link {
  color: var(--brand); text-decoration: none;
  min-height: auto; padding: 0; font-weight: 500;
}
.btn-link:hover { color: var(--brand-strong); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-warning { color: #fff; }
.btn-group .btn, .d-grid .btn { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ─── 폼 (높이 통일) ────────────────────────── */
.form-control, .form-select {
  border-color: var(--gray-300);
  border-radius: var(--radius-md);
  color: var(--text-heading);
  min-height: var(--h-input);
  padding: 6px 12px;
  font-size: .9rem;
}
.form-control-sm, .form-select-sm { min-height: var(--h-input-sm); padding: 4px 10px; font-size: .82rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.form-label { font-weight: 500; font-size: .82rem; color: var(--text-heading); margin-bottom: 6px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(79,70,229,0.12); border-color: var(--brand); }
.form-range { height: 32px; }
textarea.form-control { min-height: auto; padding: 8px 12px; }

/* ─── 빈 상태 ─────────────────────────────────── */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; opacity: 0.4; display: block; margin-bottom: 8px; }
.empty-state p { margin: 0; font-size: .9rem; }

/* ─── 브레드크럼 / 알림 ──────────────────────── */
.breadcrumb { background: transparent; padding: 0; margin-bottom: 12px; font-size: .8rem; }
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--brand); }
.breadcrumb-item.active { color: var(--text-heading); font-weight: 500; }

.alert { border-radius: var(--radius-md); border: 0; }
.alert-info { background: #cffafe; color: #155e75; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* ─── tour 인덱스 카드 (동일 높이) ───────── */
.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.tour-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}
.tour-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); color: inherit; }
.tour-card .num { font-size: .72rem; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; }
.tour-card h6 { margin: 0; font-weight: 700; color: var(--text-heading); font-size: 1rem; }
.tour-card p { font-size: .82rem; color: var(--text-muted); margin: 0; line-height: 1.5; }
.tour-card .badge-row { margin-top: auto; padding-top: 8px; }

/* ─── 반응형: 태블릿/모바일에서 사이드바 토글 (간단) ─── */
@media (max-width: 991px) {
  body[data-nav] { padding-left: 0; }
  .app-sidebar { transform: translateX(-100%); transition: transform .2s; }
  .app-sidebar.open { transform: translateX(0); }
  .app-header { left: 0; padding: 0 16px; }
}

/* ─── 모달 / 드롭다운 ───────────────────────── */
.modal-content { border: 0; border-radius: var(--radius-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 14px 20px; }
.dropdown-menu { border-color: var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 6px; }
.dropdown-item { border-radius: var(--radius-sm); padding: 8px 12px; font-size: .88rem; }
.dropdown-item:hover { background: var(--gray-100); }

/* ─── 탭 ─────────────────────────────────────── */
.nav-tabs {
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.nav-tabs .nav-link {
  border: 0; color: var(--text-muted);
  padding: 10px 16px; font-weight: 500;
  border-bottom: 2px solid transparent;
}
.nav-tabs .nav-link.active {
  background: transparent; color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ─── 차트 영역 여백 ──────────────────────────── */
canvas { max-width: 100%; }
