:root {
  /* 기본(밤) 테마 */
  --bg: #0f1420;
  --surface: #1a2130;
  --surface-2: #222b3d;
  --border: #2e3a52;
  --text: #e6eaf2;
  --text-dim: #9aa6bd;
  --primary: #4f8cff;
  --primary-hover: #3d78e8;
  --accent: #34d399;
  --warn: #fbbf24;
  --fail: #f87171;
  --bad: #e11d48;
  --radius: 12px;
  --header-bg: linear-gradient(135deg, #182238 0%, #101726 100%);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  /* 낮 테마 */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --border: #dbe2ee;
  --text: #1b2436;
  --text-dim: #5b6a83;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #059669;
  --warn: #b45309;
  --fail: #dc2626;
  --bad: #be123c;
  --header-bg: linear-gradient(135deg, #e6edf9 0%, #f4f6fb 100%);
  --shadow: 0 6px 20px rgba(30, 50, 90, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 32px;
  transition: background 0.3s ease;
}
.site-header .wrap { position: relative; }
.site-header h1 { margin: 0; font-size: 1.8rem; }

/* 비글 브랜드 (로고 + 제목) */
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.site-logo-link {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 50%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.site-logo-link:hover { transform: scale(1.05); }
.site-logo-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.site-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
  display: block;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-en { font-size: 1rem; color: var(--text-dim); font-weight: 600; }
.brand-sub { margin: 0; color: var(--text-dim); font-size: 0.95rem; }

/* 낮/밤 테마 토글 */
.theme-toggle {
  position: absolute;
  top: 0;
  right: 20px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.3s ease, color 0.3s ease;
}
.theme-toggle:hover { transform: scale(1.08) rotate(-8deg); border-color: var(--primary); color: var(--primary); }
.theme-toggle:active { transform: scale(0.96); }
.theme-toggle .icon { display: block; }
/* 밤 테마에서는 해(낮으로 전환) 아이콘, 낮 테마에서는 달(밤으로 전환) 아이콘 표시 */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.tagline { margin: 0; color: var(--text-dim); font-size: 1.02rem; }
.tagline strong { color: var(--text); }

/* Tabs */
/* 검토 유형(모드) 전환: 데이터셋 리뷰 / 논문 리뷰 */
.mode-switch { display: flex; gap: 10px; justify-content: center; margin: 24px auto 0; }
.mode-btn {
  position: relative;
  padding: 10px 24px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-dim);
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mode-btn:hover { color: var(--text); border-color: var(--primary); }
.mode-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
/* '실험적 기능' 코너 배지 — 논문 리뷰가 아직 완성 전임을 표시 */
.exp-badge {
  position: absolute; top: -9px; right: -10px;
  background: var(--warn); color: var(--bg);
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28); cursor: help;
}
:root[data-mode="dataset"] .mode-paper { display: none !important; }
:root[data-mode="paper"] .mode-dataset { display: none !important; }

/* 논문 검토 결과 목록 */
.paper-list { display: grid; gap: 8px; margin-top: 6px; }
.paper-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); text-decoration: none; color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.paper-item:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16); }
.pi-title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-meta { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; font-size: 0.82rem; }
.pbadge { padding: 2px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.pbadge.ok { background: rgba(52, 211, 153, 0.18); color: var(--accent); }
.pbadge.warn { background: rgba(251, 191, 36, 0.20); color: var(--warn); }
.pbadge.fail { background: rgba(248, 113, 113, 0.18); color: var(--fail); }
.pbadge.info { background: rgba(79, 140, 255, 0.16); color: var(--primary); }
.pbadge.none { background: rgba(154, 166, 189, 0.15); color: var(--text-dim); }

.tabs {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  position: relative;
  flex-wrap: wrap;
}

/* 메뉴별 공유 링크 */
.share-wrap { margin-left: auto; position: relative; }
.share-btn { white-space: nowrap; }
.share-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: min(94vw, 440px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px;
}
.share-menu h4 { margin: 2px 4px 10px; font-size: 0.92rem; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; }
.share-row .sr-label { font-size: 0.85rem; white-space: nowrap; min-width: 92px; }
.share-row .sr-url {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  padding: 6px 8px;
  font-size: 0.78rem;
  font-family: inherit;
}
.share-row .sr-url:focus { outline: none; border-color: var(--primary); color: var(--text); }
.share-row .sr-copy { flex: 0 0 auto; }
.share-copied { min-height: 1.1em; margin: 8px 4px 2px; font-size: 0.82rem; color: var(--accent); }
@media (max-width: 560px) {
  .share-wrap { margin-left: 0; }
  .share-row .sr-label { min-width: 76px; }
}
.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 16px;
  font-size: 0.98rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Panels */
main { padding: 24px 0 40px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.card h3 { margin-top: 0; }

.notice {
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 6px;
  margin: 0 0 20px;
  font-size: 0.94rem;
}
.dim { color: var(--text-dim); }
.notice .dim { font-size: 0.86rem; }

/* Form */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.92rem; }
.req { color: var(--fail); }
input[type="text"], textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.2);
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

.preview { margin-top: 18px; }
.preview summary { cursor: pointer; color: var(--text-dim); font-size: 0.9rem; }
.preview pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  font-size: 0.88rem;
  margin-top: 10px;
}

.checklist ul { margin: 0; padding-left: 20px; }
.checklist li { margin-bottom: 8px; }
.how a { color: var(--primary); text-underline-offset: 2px; }

/* Results */
.results-head { display: flex; align-items: center; justify-content: space-between; }
.results-actions { display: flex; gap: 8px; }

/* 인증(토큰) 패널 */
.auth-panel {
  margin: 14px 0;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.auth-desc { margin: 0 0 10px; font-size: 0.9rem; }
.auth-help { margin: 0 0 12px; padding-left: 20px; font-size: 0.84rem; color: var(--text-dim); }
.auth-help li { margin-bottom: 5px; }
.auth-help a { color: var(--primary); }
.auth-row { display: flex; gap: 8px; flex-wrap: wrap; }
.auth-row input {
  flex: 1 1 260px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
}
.auth-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,140,255,0.2); }
#auth-status { margin: 10px 0 0; font-size: 0.84rem; }
#auth-status.ok { color: var(--accent); }
#auth-status.err { color: var(--fail); }
.results-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.result-row:hover { border-color: var(--primary); }
.result-title { font-weight: 600; font-size: 0.95rem; }
.result-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 0.8rem; text-align: right; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.badge.done { background: rgba(52, 211, 153, 0.15); color: var(--accent); }
.badge.prog { background: rgba(79, 140, 255, 0.15); color: var(--primary); }
.badge.wait { background: rgba(154, 166, 189, 0.15); color: var(--text-dim); }
.badge.fail { background: rgba(248, 113, 113, 0.15); color: var(--fail); }

/* How-to */
.how { padding-left: 20px; }
.how li { margin-bottom: 10px; }
.disclaimer {
  margin-top: 16px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 14px;
  font-size: 0.9rem;
  color: var(--text);
}
.disclaimer strong { color: var(--warn); }

/* 이미 검토된 데이터셋 안내(중복 방지) */
.request-notice { margin-top: 18px; }
.dup-card {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.94rem;
  line-height: 1.6;
}
.dup-card h4 { margin: 0 0 8px; font-size: 1.02rem; }
.dup-card p { margin: 8px 0; }
.dup-card code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.88em;
}
.dup-issue a { font-weight: 600; word-break: break-all; }
.dup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px; }
.dup-hint { font-size: 0.82rem; margin-top: 6px; }

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.88rem;
}
.site-footer a { color: var(--primary); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .result-row { flex-direction: column; align-items: flex-start; }
  .result-meta { align-items: flex-start; text-align: left; }
}

/* ── 접근 암호 게이트 오버레이 ───────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
:root[data-auth="1"] #login-overlay { display: none; }
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}
.login-box h2 { margin: 0 0 6px; font-size: 1.3rem; }
.login-desc { margin: 0 0 18px; color: var(--text-dim); font-size: 0.9rem; }
.login-box input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 11px 12px;
  font-size: 0.98rem;
  font-family: inherit;
  margin-bottom: 12px;
}
.login-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,140,255,0.2); }
.login-box .btn { width: 100%; }
.login-msg { min-height: 1.1em; margin: 12px 0 0; font-size: 0.86rem; color: var(--fail); }
.login-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--text-dim); }

/* ── 검토 결과: 검색 + 페이지당 개수 ─────────────────────────── */
.results-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0 4px;
}
.results-search {
  flex: 1 1 240px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.92rem;
  font-family: inherit;
}
.results-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,140,255,0.2); }
.page-size { font-size: 0.86rem; color: var(--text-dim); white-space: nowrap; }
.page-size select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 8px;
  font-family: inherit;
  font-size: 0.9rem;
  margin: 0 4px;
}

/* ── 대시보드 ─────────────────────────────────────────────────── */
.dash-updated { font-size: 0.82rem; margin: 0 0 4px; }
.dash-section { margin-top: 28px; }
.dash-section > h4 {
  margin: 0 0 14px; font-size: 1.05rem;
  display: flex; align-items: center; gap: 7px;
}

/* 대시보드 세부 메뉴(탭형 서브 내비게이션): 선택한 섹션만 표시 */
.dash-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 10px -22px 4px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dash-navbtn {
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.dash-navbtn:hover { color: var(--text); border-color: var(--primary); }
.dash-navbtn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.dash-navbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 세부 메뉴 아래 첫 섹션의 상단 여백은 축소(메뉴 바로 아래에 붙도록) */
.dash-panel > .dash-section:first-child { margin-top: 16px; }

/* 요약 통계 카드 */
/* 검토 현황: 설명 + 판정 분포 막대 + 판정 카드 + 세부 리스크 */
.st-intro { font-size: 0.92rem; line-height: 1.65; margin: 0 0 14px; color: var(--text); }
.st-hl-ok { color: var(--accent); }

.st-bar {
  display: flex; height: 34px; border-radius: 999px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
}
.st-seg {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: #fff; font-size: 0.8rem; font-weight: 700; min-width: 0; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: width 0.4s ease;
}
.st-seg.ok   { background: var(--accent); }
.st-seg.warn { background: var(--warn); }
.st-seg.fail { background: var(--fail); }
.st-seg.none { background: var(--text-dim); }

.st-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.st-card {
  border: 1px solid var(--border); border-top: 4px solid var(--text-dim);
  border-radius: 12px; background: var(--surface-2); padding: 14px 14px 16px;
}
.st-card.ok   { border-top-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.st-card.warn { border-top-color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, var(--surface-2)); }
.st-card.fail { border-top-color: var(--fail); background: color-mix(in srgb, var(--fail) 11%, var(--surface-2)); }
.st-card.none { border-top-color: var(--text-dim); }
.st-card-top { display: flex; align-items: baseline; gap: 6px; }
.st-emoji { font-size: 1.2rem; }
.st-count { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--text); }
.st-unit { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); margin-left: 1px; }
.st-pct { margin-left: auto; font-size: 0.95rem; font-weight: 700; }
.st-card.ok .st-pct { color: var(--accent); }
.st-card.warn .st-pct { color: var(--warn); }
.st-card.fail .st-pct { color: var(--fail); }
.st-card.none .st-pct { color: var(--text-dim); }
.st-name { margin-top: 8px; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.st-mean { margin-top: 3px; font-size: 0.8rem; line-height: 1.45; color: var(--text-dim); }

.st-risks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.st-risk {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.st-risk-ico { font-size: 1.4rem; flex: 0 0 auto; }
.st-risk-num { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.st-risk-label { font-size: 0.82rem; color: var(--text-dim); margin-top: 2px; }

.dash-meta-line {
  margin: 14px 0 0; font-size: 0.88rem; color: var(--text-dim);
  display: flex; gap: 18px; flex-wrap: wrap;
}
.dash-meta-line strong { color: var(--text); }

/* 차트 박스 (도넛 + 스택바) */
.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
}
.chart-box h5 { margin: 0 0 14px; font-size: 0.95rem; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 0.86rem; flex: 1; min-width: 0; }
.donut-legend .lg { display: flex; align-items: center; gap: 8px; }
.donut-legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.donut-legend .lg-count { margin-left: auto; color: var(--text-dim); white-space: nowrap; }

/* 항목별 리스크 스택 막대 */
.risk-item { margin-bottom: 15px; }
.risk-item:last-child { margin-bottom: 0; }
.risk-item .ri-label { font-size: 0.86rem; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.stack-bar { display: flex; height: 22px; border-radius: 5px; overflow: hidden; background: var(--bg); }
.stack-seg { height: 100%; min-width: 0; }
.seg-low     { background: var(--accent); }
.seg-mid     { background: var(--warn); }
.seg-high    { background: var(--fail); }
.seg-unknown { background: var(--text-dim); }
.seg-none    { background: var(--border); }
.risk-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 0.8rem; color: var(--text-dim); }
.risk-legend .lg { display: flex; align-items: center; gap: 6px; }
.risk-legend .sw { width: 10px; height: 10px; border-radius: 2px; }

/* AI 자동리뷰 결과 만족도 */
/* ① 요약: 큰 만족 비율 + 구성 막대 */
.cf-summary {
  display: flex; align-items: center; gap: 22px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; margin-bottom: 16px;
}
.cf-score { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.cf-score-num {
  font-size: 2.9rem; font-weight: 800; line-height: 1; color: var(--accent);
}
.cf-score-unit { font-size: 1.3rem; font-weight: 700; margin-left: 2px; }
.cf-score-label { font-size: 0.86rem; font-weight: 600; line-height: 1.4; }
.cf-bar-wrap { flex: 1 1 auto; min-width: 0; }
.cf-bar {
  display: flex; height: 32px; border-radius: 999px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
}
.cf-seg {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: #fff; font-size: 0.8rem; font-weight: 700; min-width: 0;
  white-space: nowrap; transition: width 0.4s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.cf-seg.high { background: var(--accent); }
.cf-seg.medium { background: var(--warn); }
.cf-seg.low { background: var(--fail); }
.cf-seg.bad { background: var(--bad); }
.cf-seg.none { background: var(--text-dim); }
.cf-bar-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px;
  font-size: 0.82rem; color: var(--text-dim);
}
.cf-lg { display: inline-flex; align-items: center; gap: 6px; }
.cf-lg strong { color: var(--text); }
.cf-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.cf-dot.high { background: var(--accent); }
.cf-dot.medium { background: var(--warn); }
.cf-dot.low { background: var(--fail); }
.cf-dot.bad { background: var(--bad); }
.cf-dot.none { background: var(--text-dim); }

/* ② 레벨별 카드 */
.cf-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cf-card {
  position: relative; text-align: center; overflow: hidden;
  padding: 16px 12px 18px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.cf-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.cf-card.high::before { background: var(--accent); }
.cf-card.medium::before { background: var(--warn); }
.cf-card.low::before { background: var(--fail); }
.cf-card.bad::before { background: var(--bad); }
.cf-card.none::before { background: var(--text-dim); }
.cf-card.high { background: color-mix(in srgb, var(--accent) 11%, var(--surface-2)); }
.cf-card.medium { background: color-mix(in srgb, var(--warn) 13%, var(--surface-2)); }
.cf-card.low { background: color-mix(in srgb, var(--fail) 13%, var(--surface-2)); }
.cf-card.bad { background: color-mix(in srgb, var(--bad) 13%, var(--surface-2)); }
.cf-emoji { font-size: 1.8rem; line-height: 1; }
.cf-label { margin-top: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.cf-count { margin-top: 8px; font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text); }
.cf-unit { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); margin-left: 2px; }
.cf-pct { margin-top: 5px; font-size: 1rem; font-weight: 700; }
.cf-card.high .cf-pct { color: var(--accent); }
.cf-card.medium .cf-pct { color: var(--warn); }
.cf-card.low .cf-pct { color: var(--fail); }
.cf-card.bad .cf-pct { color: var(--bad); }
.cf-card.none .cf-pct { color: var(--text-dim); }

/* 검토 추이 */
/* 검토 추이: 일/월/연 단위 전환 토글 */
.trend-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.trend-unit-btn {
  padding: 5px 15px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim);
  font-size: 0.84rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.trend-unit-btn:hover { color: var(--text); border-color: var(--primary); }
.trend-unit-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.trend { display: flex; align-items: flex-end; gap: 5px; height: 140px; padding-top: 6px; }
.trend-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; justify-content: flex-end; height: 100%; }
.trend-bar { width: 62%; max-width: 30px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 3px; transition: height 0.3s; }
.trend-cnt { font-size: 0.72rem; color: var(--text-dim); }
.trend-date { font-size: 0.66rem; color: var(--text-dim); white-space: nowrap; }

/* 데이터셋별 상세 테이블 */
.dash-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.dash-filter .results-search { flex: 1 1 200px; }
.dash-select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-family: inherit; font-size: 0.86rem;
}
.dash-select:focus { outline: none; border-color: var(--primary); }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  border-radius: 999px; padding: 5px 13px; font-size: 0.82rem; cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.dash-table-wrap { overflow-x: auto; }
table.dash-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.dash-table th, table.dash-table td {
  text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top;
}
table.dash-table th { color: var(--text-dim); font-weight: 600; white-space: nowrap; font-size: 0.8rem; }
table.dash-table tbody tr.ds-row { cursor: pointer; }
table.dash-table tbody tr.ds-row:hover { background: var(--surface-2); }
.cell-risk { display: flex; align-items: flex-start; gap: 6px; }
.risk-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.risk-dot.low     { background: var(--accent); }
.risk-dot.mid     { background: var(--warn); }
.risk-dot.high    { background: var(--fail); }
.risk-dot.unknown { background: var(--text-dim); }
.risk-dot.none    { background: var(--border); }
.cell-text {
  max-width: 220px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-text[data-full] { cursor: help; }
/* 셀 호버 시 전체 내용을 보여주는 떠 있는 툴팁 (body 에 부착, 표 overflow 에 잘리지 않음) */
.cell-tip {
  position: absolute;
  z-index: 1000;
  display: none;
  max-width: 360px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.ds-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.ds-link:hover { text-decoration: underline; }
.row-toggle { color: var(--text-dim); font-size: 0.8rem; }
.vbadge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.vbadge.ok   { background: rgba(52, 211, 153, 0.15); color: var(--accent); }
.vbadge.warn { background: rgba(251, 191, 36, 0.18); color: var(--warn); }
.vbadge.fail { background: rgba(248, 113, 113, 0.15); color: var(--fail); }
.vbadge.none { background: rgba(154, 166, 189, 0.15); color: var(--text-dim); }
.cbadge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.cbadge.high { background: rgba(52, 211, 153, 0.15); color: var(--accent); }
.cbadge.medium { background: rgba(251, 191, 36, 0.18); color: var(--warn); }
.cbadge.low { background: rgba(248, 113, 113, 0.15); color: var(--fail); }
.cbadge.bad { background: rgba(225, 29, 72, 0.15); color: var(--bad); }
.cbadge.none { background: rgba(154, 166, 189, 0.15); color: var(--text-dim); }

/* 상세 드릴다운(종합의견 4×3) */
tr.detail-row > td { background: var(--bg); padding: 0; }
.detail-inner { padding: 14px 16px; }
.detail-inner .di-verdict { margin: 0 0 12px; font-size: 0.9rem; }
.detail-inner .di-confidence { margin: -5px 0 12px; font-size: 0.9rem; }
table.detail-table {
  width: 100%; border-collapse: collapse; font-size: 0.84rem; table-layout: fixed;
}
table.detail-table th, table.detail-table td {
  border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top;
  overflow-wrap: anywhere; word-break: break-word;
}
table.detail-table th { background: var(--surface-2); color: var(--text-dim); font-weight: 600; white-space: nowrap; }
table.detail-table td:first-child { font-weight: 600; }
/* 열 폭: 검토 항목 / 확인 결과 / 내부 판단 / 판단 근거 */
table.detail-table th:nth-child(1), table.detail-table td:nth-child(1) { width: 13%; }
table.detail-table th:nth-child(2), table.detail-table td:nth-child(2) { width: 14%; }
table.detail-table th:nth-child(3), table.detail-table td:nth-child(3) { width: 16%; }
table.detail-table th:nth-child(4), table.detail-table td:nth-child(4) { width: 57%; }
table.detail-table td.basis-cell { line-height: 1.55; }
table.detail-table a.src-link {
  display: inline-block; margin: 2px 4px 2px 0; padding: 1px 7px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--primary); font-size: 0.78rem; text-decoration: none; white-space: nowrap;
}
table.detail-table a.src-link:hover { text-decoration: underline; }
.detail-inner .di-foot { margin: 12px 0 0; font-size: 0.84rem; }

/* ── ⚖️ 소송이 걸려있는 데이터셋 현황 ─────────────────────────── */
/* 목적 배너: 이 섹션이 '무단 이용 → 저작권 침해 소송' 리스크임을 명확히 안내 */
.lit-intro {
  display: flex; gap: 12px; align-items: flex-start;
  background: color-mix(in srgb, var(--fail) 9%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--fail) 32%, var(--border));
  border-left: 4px solid var(--fail);
  border-radius: 12px; padding: 14px 16px; margin: 0 0 16px;
}
.lit-intro-icon { font-size: 1.4rem; line-height: 1.3; flex: 0 0 auto; }
.lit-intro p { margin: 0; font-size: 0.9rem; line-height: 1.65; }

/* 컨트롤: 데이터셋 검색 + 페이지당 개수 선택 */
.lit-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px;
}
.lit-controls .results-search { flex: 1 1 240px; }
.lit-search-count { font-size: 0.82rem; white-space: nowrap; }
.lit-empty { margin: 4px 2px 0; font-size: 0.9rem; }

/* 카드 리스트(컴팩트): 데이터셋 1건 = 카드 1개, 세로 공간 최소화 */
/* minmax(0,1fr): 카드가 긴 텍스트(다건 소송 병합 등)로 컨테이너를 넘어 가로로 늘어나지 않게 함 */
.lit-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.lit-card {
  min-width: 0; overflow: hidden;
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-dim);
  border-radius: 10px; background: var(--surface-2);
  padding: 10px 13px; cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lit-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16); }
.lit-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lit-card.sev-high { border-left-color: var(--fail); }
.lit-card.sev-mid  { border-left-color: var(--warn); }
.lit-card.sev-low  { border-left-color: var(--primary); }
.lit-card.sev-none { border-left-color: var(--text-dim); }

.lit-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lit-card-ds {
  font-size: 1.02rem; font-weight: 800; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto;
}
.lit-card-ds .chev { color: var(--text-dim); font-size: 0.8rem; flex: 0 0 auto; transition: transform 0.15s ease; }
.lit-card.open .lit-card-ds .chev { transform: rotate(90deg); color: var(--primary); }
.lit-card-head .lbadge { flex: 0 0 auto; }

/* 사건명: 다건 소송 병합 등 긴 경우 최대 2줄까지만 표시(넘치면 …), 나머지는 펼침에서 확인 */
.lit-card-case {
  margin-top: 4px; font-size: 0.9rem; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}

.lit-parties {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  margin-top: 5px; font-size: 0.83rem; color: var(--text);
  min-width: 0; overflow-wrap: anywhere;
}
.lit-party { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.lit-party .role {
  font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.lit-party.plaintiff .role { background: rgba(52, 211, 153, 0.18); color: var(--accent); }
.lit-party.defendant .role { background: rgba(248, 113, 113, 0.18); color: var(--fail); }
.lit-vs { color: var(--text-dim); font-weight: 700; font-style: italic; }
.lit-dot { color: var(--text-dim); }
.lit-docket { font-size: 0.78rem; font-weight: 600; color: var(--text-dim); }
.lit-card-detail { margin-top: 10px; }

/* 침해 입증 근거 강도 배지 */
.lbadge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.lbadge.high { background: rgba(248, 113, 113, 0.18); color: var(--fail); }
.lbadge.mid  { background: rgba(251, 191, 36, 0.20); color: var(--warn); }
.lbadge.low  { background: rgba(79, 140, 255, 0.16); color: var(--primary); }
.lbadge.none { background: rgba(154, 166, 189, 0.15); color: var(--text-dim); }

.lit-legend { margin: 14px 2px 0; font-size: 0.8rem; line-height: 2.1; }

/* 펼침 상세: 라벨/값 그리드 */
.lit-detail { padding: 14px 16px; background: var(--bg); }
.lit-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px; margin: 0;
}
.lit-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lit-field.wide { grid-column: 1 / -1; }
.lit-field dt { font-size: 0.76rem; font-weight: 600; color: var(--text-dim); }
.lit-field dd { margin: 0; font-size: 0.9rem; line-height: 1.55; word-break: break-word; }
.lit-quote {
  margin: 2px 0 0; padding: 8px 12px; font-size: 0.9rem; line-height: 1.55;
  background: var(--surface-2); border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0; color: var(--text);
}
.lit-foot { margin: 14px 0 0; font-size: 0.84rem; }

@media (max-width: 700px) {
  .st-cards { grid-template-columns: repeat(2, 1fr); }
  .st-risks { grid-template-columns: 1fr; }
  .dash-charts { grid-template-columns: 1fr; }
  .cell-text { max-width: 140px; }
  .cf-cards { grid-template-columns: repeat(2, 1fr); }
  .cf-summary { flex-direction: column; align-items: stretch; gap: 14px; }
  .cf-score { justify-content: center; }
  .lit-grid { grid-template-columns: 1fr; }
}

/* ── 검토 결과: 페이지네이션 ─────────────────────────────────── */
.results-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}
.results-pager .btn[disabled] { opacity: 0.4; cursor: default; }
.page-info { font-size: 0.88rem; color: var(--text-dim); min-width: 8em; text-align: center; }
