/* 호버 액션 노출 공통 패턴 — 카드/행 호버 시 .actions 만 표시 */
.has-hover-actions {
  position: relative;
}
.has-hover-actions .hover-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.15s ease-out;
  display: flex;
  gap: 4px;
}
.has-hover-actions:hover .hover-actions,
.has-hover-actions:focus-within .hover-actions {
  opacity: 1;
}

.hover-actions button,
.hover-actions .action-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-secondary) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 6px;
  padding: 4px 8px !important;
  cursor: pointer;
  font-size: 11px !important;
  line-height: 1.2 !important;
  transition: all 0.15s ease-out;
}
.hover-actions button:hover,
.hover-actions .action-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

/* 핀 표시 (영구 보존) */
.pinned-indicator {
  display: inline-block;
  margin-left: 6px;
  color: #d97706;
}
.session-card.pinned {
  border-left: 3px solid #d97706;
}

/* 동의어 / 카탈로그 표 */
.syn-table-wrap {
  margin-top: 12px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--card-border, #2d3748);
  border-radius: 8px;
  background: var(--card-bg, #1a202c);
}
.syn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.syn-table th {
  position: sticky;
  top: 0;
  background: var(--card-bg, #1a202c);
  z-index: 1;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--card-border, #2d3748);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-dim, #9ca3af);
}
.syn-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--card-border-soft, #2a3140);
  vertical-align: middle;
}
.syn-table tbody tr:hover {
  background: rgba(251, 191, 36, 0.05);
}
.syn-table input[type="text"],
.syn-table input[type="number"] {
  width: 100%;
  background: transparent;
  border: 1px solid var(--card-border, #2d3748);
  color: inherit;
  padding: 4px 6px;
  border-radius: 4px;
  font: inherit;
  box-sizing: border-box;
}
.syn-table tfoot td {
  background: rgba(251, 191, 36, 0.04);
}

.src-schema { color: #6b7280; font-size: 11px; }
.src-custom { color: #d97706; font-size: 11px; font-weight: 600; }

/* 데이터 품질 배지 */
.data-quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin: 8px 0;
  border: 1px solid transparent;
}
.data-quality-badge.level-ok    { background:#d1fae5; color:#065f46; border-color:#a7f3d0; }
.data-quality-badge.level-warn  { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.data-quality-badge.level-error { background:#fee2e2; color:#991b1b; border-color:#fecaca; }

.dq-score {
  font-weight: 700;
  font-size: 16px;
  min-width: 28px;
  text-align: center;
}
.dq-label { font-weight: 500; }
.dq-warn-count { margin-left: 4px; font-size: 12px; }

.dq-detail {
  margin-left: 8px;
  font-size: 12px;
}
.dq-detail summary { cursor: pointer; }
.dq-detail ul {
  margin: 4px 0 0 14px;
  padding: 0;
  list-style: disc;
}

/* 후보 탭 카드 */
.cand-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.cand-card {
  background: var(--card-bg, #1a202c);
  border: 1px solid var(--card-border, #2d3748);
  border-left: 3px solid #d97706;
  border-radius: 8px;
  padding: 12px 14px;
}
.cand-card-head { display:flex; align-items:center; }
.cand-hit-badge {
  background: #d97706; color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}
.cand-q {
  font-size: 13px;
  color: var(--text, #e5e7eb);
  margin: 8px 0 10px;
  line-height: 1.4;
}
.cand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.cand-row label {
  width: 55px;
  font-size: 12px;
  color: var(--text-dim, #9ca3af);
}
.cand-row input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--card-border, #2d3748);
  color: inherit;
  padding: 4px 8px;
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
}
.cand-meta {
  font-size: 11px;
  color: var(--text-dim, #9ca3af);
  margin: 6px 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cand-actions {
  display: flex;
  gap: 6px;
}

.cand-badge {
  display: inline-block;
  background: #d97706;
  color: #fff;
  border-radius: 10px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

.btn.btn-sm {
  padding: 2px 8px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--card-border, #2d3748);
  border-radius: 4px;
  cursor: pointer;
  color: inherit;
}
.btn.btn-sm:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: #fbbf24;
}

/* ==========================================
   Workflow List Redesign Visual Distinction
   ========================================== */

/* 1. 홈으로 이동 버튼 */
.btn-hero-back {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-secondary) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease-out;
}
.btn-hero-back:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--text) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  opacity: 1 !important;
}

/* 2. 탭 컨트롤 디자인 고도화 (버튼 형태 및 활성화 구분 극대화) */
.wf-tab {
  padding: 10px 20px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  
  /* 비활성 탭: 뚜렷한 입체 버튼 형태 부여 */
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: var(--text-secondary, #9ca3af) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

/* 비활성 탭 호버 상태 - 돌출 및 글로우 */
.wf-tab:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

/* 비활성 탭 클릭/눌림 상태 - 물리적 프레스 효과 */
.wf-tab:active {
  transform: translateY(1px) scale(0.97) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45) !important;
}

/* 활성 탭 (Active State) - 개별 전용 컬러 및 고대비 솔리드 배경 */
.wf-tab[data-tab="sessions"].active {
  color: #ffffff !important;
  background: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.6) !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.wf-tab[data-tab="sessions"].active:hover {
  background: #2563eb !important;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.wf-tab[data-tab="templates"].active {
  color: #ffffff !important;
  background: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.6) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.wf-tab[data-tab="templates"].active:hover {
  background: #059669 !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.wf-tab[data-tab="candidates"].active {
  color: #1a1b1e !important;
  background: #fac858 !important;
  border: 1px solid rgba(250, 200, 88, 0.6) !important;
  box-shadow: 0 4px 14px rgba(250, 200, 88, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}
.wf-tab[data-tab="candidates"].active:hover {
  background: #f0b93a !important;
  box-shadow: 0 6px 18px rgba(250, 200, 88, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.wf-tab[data-tab="synonyms"].active {
  color: #ffffff !important;
  background: #9a60b4 !important;
  border: 1px solid rgba(154, 96, 180, 0.6) !important;
  box-shadow: 0 4px 14px rgba(154, 96, 180, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.wf-tab[data-tab="synonyms"].active:hover {
  background: #844c9c !important;
  box-shadow: 0 6px 18px rgba(154, 96, 180, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.wf-tab[data-tab="catalog"].active {
  color: #1a1b1e !important;
  background: #06b6d4 !important;
  border: 1px solid rgba(6, 182, 212, 0.6) !important;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}
.wf-tab[data-tab="catalog"].active:hover {
  background: #0891b2 !important;
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

/* Light Theme Portal overrides for Tabs */
[data-theme="portal-light"] .wf-tab {
  background: #f3f4f6 !important;
  border: 1px solid #d1d5db !important;
  color: #4b5563 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}
[data-theme="portal-light"] .wf-tab:hover {
  background: #e5e7eb !important;
  border-color: #9ca3af !important;
  color: #111827 !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1) !important;
}
[data-theme="portal-light"] .wf-tab[data-tab="sessions"].active {
  background: #3b82f6 !important;
  color: #ffffff !important;
}
[data-theme="portal-light"] .wf-tab[data-tab="templates"].active {
  background: #10b981 !important;
  color: #ffffff !important;
}
[data-theme="portal-light"] .wf-tab[data-tab="candidates"].active {
  background: #f59e0b !important;
  color: #ffffff !important;
}
[data-theme="portal-light"] .wf-tab[data-tab="synonyms"].active {
  background: #9a60b4 !important;
  color: #ffffff !important;
}
[data-theme="portal-light"] .wf-tab[data-tab="catalog"].active {
  background: #06b6d4 !important;
  color: #ffffff !important;
}

/* 3. 자산 카드 구분 대폭 강화 (Left Border & Translucent Theme Background) */

/* 세션 카드 (임시) */
.session-card {
  border-left: 4px solid #3b82f6 !important;
  border-color: rgba(59, 130, 246, 0.15) !important;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.05), rgba(59, 130, 246, 0.02)) !important;
  transition: all 0.15s ease-out;
}
.session-card:hover {
  border-left-color: #60a5fa !important;
  border-color: rgba(59, 130, 246, 0.45) !important;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.09), rgba(59, 130, 246, 0.04)) !important;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15) !important;
}

/* 세션 카드 (보존/고정) */
.session-card.pinned {
  border-left: 4px solid #fac858 !important;
  border-color: rgba(250, 200, 88, 0.2) !important;
  background: linear-gradient(180deg, rgba(250, 200, 88, 0.06), rgba(250, 200, 88, 0.03)) !important;
}
.session-card.pinned:hover {
  border-left-color: #fbbf24 !important;
  border-color: rgba(250, 200, 88, 0.5) !important;
  background: linear-gradient(180deg, rgba(250, 200, 88, 0.1), rgba(250, 200, 88, 0.05)) !important;
  box-shadow: 0 8px 24px rgba(250, 200, 88, 0.15) !important;
}

/* 템플릿 카드 */
.template-card {
  border-left: 4px solid #10b981 !important;
  border-color: rgba(16, 185, 129, 0.15) !important;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.02)) !important;
  transition: all 0.15s ease-out;
}
.template-card:hover {
  border-left-color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.09), rgba(16, 185, 129, 0.04)) !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15) !important;
}

/* 후보 카드 */
.cand-card {
  border-left: 4px solid #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.15) !important;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.02)) !important;
  transition: all 0.15s ease-out;
}
.cand-card:hover {
  border-left-color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.09), rgba(245, 158, 11, 0.04)) !important;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15) !important;
}

/* 4. 세션 & 템플릿 배지 세련되고 뚜렷하게 강화 */
.session-asset-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
  display: inline-block;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.session-asset-badge.pinned-label {
  background: rgba(250, 200, 88, 0.1) !important;
  color: #fac858 !important;
  border: 1px solid rgba(250, 200, 88, 0.3) !important;
}
.template-asset-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(145, 204, 117, 0.1) !important;
  color: #91cc75 !important;
  border: 1px solid rgba(145, 204, 117, 0.3) !important;
  display: inline-block;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* 5. 후보 카드 텍스트 점선 연출 */
.cand-card .cand-row input {
  border: 1px dashed rgba(250, 200, 88, 0.3) !important;
  background: rgba(255, 255, 255, 0.01) !important;
  transition: border-color 0.15s, background-color 0.15s;
}
.cand-card .cand-row input:focus {
  border-style: solid !important;
  border-color: #fac858 !important;
  background: rgba(250, 200, 88, 0.05) !important;
  outline: none !important;
}

/* 6. 동의어 & 컬럼 카탈로그 테이블 헤더 및 셀 에딧 힌트 */
#syn-table th {
  background: rgba(154, 96, 180, 0.12) !important;
  color: #e9d5ff !important;
  border-bottom: 2px solid rgba(154, 96, 180, 0.4) !important;
}
#cat-table th {
  background: rgba(115, 192, 222, 0.12) !important;
  color: #cffafe !important;
  border-bottom: 2px solid rgba(115, 192, 222, 0.4) !important;
}
.syn-table [data-editable] {
  cursor: text;
  border-bottom: 1px dashed transparent;
  transition: all 0.15s ease-out;
  padding: 2px 4px;
  display: inline-block;
}
.syn-table [data-editable]:hover {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: var(--text-secondary);
}
.syn-table [data-editable]:hover::after {
  content: " (편집)";
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.6;
  margin-left: 4px;
}

/* 7. CSS 기반 핀 토글 텍스트 연출 (이모지 완전 제거) */
.pin-toggle-btn::before {
  content: "고정";
  font-size: 11px;
  font-weight: 600;
}
.pinned .pin-toggle-btn::before {
  content: "해제";
}

/* ==========================================
   Interactive Buttons vs. Static Badges (Tags)
   ========================================== */

/* 1. Interactive Tag Buttons (button.de-tag, .de-presets button, .tpl-toggle-json) */
button.de-tag,
.de-presets button,
.nw-grid-actions button.de-tag,
.tpl-toggle-json {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  pointer-events: auto !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  padding: 5px 10px !important;
  border-radius: 6px !important; /* Slightly rounded corners representing a button */
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
  color: var(--text-secondary, #e5e7eb) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Hover State for Interactive Buttons - glowing, raised, and themed */
button.de-tag:hover,
.de-presets button:hover,
.nw-grid-actions button.de-tag:hover,
.tpl-toggle-json:hover {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.22) 0%, rgba(59, 130, 246, 0.08) 100%) !important;
  border-color: rgba(59, 130, 246, 0.6) !important;
  color: #93c5fd !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

/* Focus State */
button.de-tag:focus,
.tpl-toggle-json:focus {
  outline: none !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4) !important;
}

/* Pressed State for Interactive Buttons - tactile compression */
button.de-tag:active,
.de-presets button:active,
.nw-grid-actions button.de-tag:active,
.tpl-toggle-json:active {
  transform: translateY(1px) scale(0.97) !important;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.04) 100%) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
}

/* 2. Static Badges / Metadata Tags (span.de-tag, .subject-key-tag, .intent-tag) */
span.de-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default !important;
  pointer-events: none !important; /* Make them completely non-interactive */
  font-weight: 500 !important;
  font-size: 11px !important;
  padding: 3px 9px !important;
  border-radius: 999px !important; /* Perfect Pill Shape */
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
  margin-right: 4px;
  vertical-align: middle;
}

/* Ensure no changes on hover/active for spans */
span.de-tag:hover,
span.de-tag:active {
  cursor: default !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Subject Key Tags - Cyan/Slate theme */
.subject-key-tag {
  background: rgba(139, 233, 253, 0.09) !important;
  color: #8be9fd !important;
  border: 1px solid rgba(139, 233, 253, 0.25) !important;
}
.subject-key-tag:hover {
  background: rgba(139, 233, 253, 0.09) !important;
  color: #8be9fd !important;
  border-color: rgba(139, 233, 253, 0.25) !important;
}

/* Intent Tags - Lavender/Purple theme */
.intent-tag {
  background: rgba(154, 96, 180, 0.12) !important;
  color: #d6bcfa !important;
  border: 1px solid rgba(154, 96, 180, 0.3) !important;
}
.intent-tag:hover {
  background: rgba(154, 96, 180, 0.12) !important;
  color: #d6bcfa !important;
  border-color: rgba(154, 96, 180, 0.3) !important;
}

/* 3. Disable badge visual upgrade */
.tpl-badge-disabled {
  background: rgba(238, 102, 102, 0.15) !important;
  color: #ee6666 !important;
  border: 1px solid rgba(238, 102, 102, 0.3) !important;
  border-radius: 999px !important; /* Pill style */
  padding: 2px 8px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  display: inline-block;
  vertical-align: middle;
}

/* 4. Portal-Light Theme specific overrides for Light Mode */
[data-theme="portal-light"] button.de-tag,
[data-theme="portal-light"] .de-presets button,
[data-theme="portal-light"] .nw-grid-actions button.de-tag,
[data-theme="portal-light"] .tpl-toggle-json {
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%) !important;
  border: 1px solid #d1d5db !important;
  color: #4b5563 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 1px 0 #ffffff !important;
}

[data-theme="portal-light"] button.de-tag:hover,
[data-theme="portal-light"] .de-presets button:hover,
[data-theme="portal-light"] .nw-grid-actions button.de-tag:hover,
[data-theme="portal-light"] .tpl-toggle-json:hover {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%) !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.12), inset 0 1px 0 #ffffff !important;
}

[data-theme="portal-light"] button.de-tag:active,
[data-theme="portal-light"] .de-presets button:active,
[data-theme="portal-light"] .nw-grid-actions button.de-tag:active,
[data-theme="portal-light"] .tpl-toggle-json:active {
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  border-color: #3b82f6 !important;
}

[data-theme="portal-light"] .subject-key-tag {
  background: rgba(9, 131, 161, 0.07) !important;
  color: #0983a1 !important;
  border: 1px solid rgba(9, 131, 161, 0.22) !important;
}

[data-theme="portal-light"] .intent-tag {
  background: rgba(128, 90, 213, 0.07) !important;
  color: #805ad5 !important;
  border: 1px solid rgba(128, 90, 213, 0.22) !important;
}
