/* 테스트 UX/UI — 안전공학 톤 UX 프로토타입 */

@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  /* 종이 & 잉크 */
  --paper: #f6f4ef;
  --paper-2: #efece5;
  --paper-3: #e8e4dc;
  --ink: #17181a;
  --ink-2: #2a2c30;
  --ink-3: #4d5058;
  --ink-4: #7a7e88;
  --line: #d8d3c8;
  --line-2: #c4beb1;

  /* 신호등 (채도 절제) */
  --green: #5b8a5a;
  --amber: #e8ae2f;
  --amber-ink: #a67200;
  --red: #c82d2d;
  --red-ink: #a02929;

  /* 강조 잉크 (프로젝트 프라이머리) */
  --accent: #1f3a68;
  --accent-2: #2f5390;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 0 rgba(23, 24, 26, 0.04), 0 2px 8px rgba(23, 24, 26, 0.04);
  --shadow-2: 0 2px 0 rgba(23, 24, 26, 0.05), 0 8px 24px rgba(23, 24, 26, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-feature-settings: "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ─── App shell ─────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 24px 0;
}

.workspace {
  display: grid;
  grid-template-columns: 260px 1fr 380px;
  gap: 16px;
  flex: 1;
  min-height: 0;
  margin-top: 0;
}

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  background: #fbfaf5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-1);
  height: fit-content;
  position: sticky;
  top: 20px;
}
.sidebar-block { display: flex; flex-direction: column; gap: 10px; }
.sidebar-block--tight { gap: 8px; }

.block-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.mode-switch { display: flex; flex-direction: column; gap: 6px; }
.mode-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: all 0.12s ease;
  position: relative;
}
.mode-btn:hover { border-color: var(--line-2); background: #fff; }
.mode-btn--active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-2);
}
.mode-btn-tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-4);
  text-transform: uppercase;
}
.mode-btn--active .mode-btn-tag { color: rgba(246, 244, 239, 0.6); }
.mode-btn-tag--b {} /* 조건 B 라벨은 색상 동일 */
.mode-btn-title {
  font-size: 15px;
  font-weight: 700;
  margin: 2px 0;
  letter-spacing: -0.01em;
}
.mode-btn-desc { font-size: 11.5px; color: var(--ink-4); }
.mode-btn--active .mode-btn-desc { color: rgba(246, 244, 239, 0.65); }

.mode-hint {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--paper-2);
  border-radius: 6px;
  border-left: 2px solid var(--line-2);
}

/* Legend */
.legend { display: flex; flex-direction: column; gap: 5px; }
.legend-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.03em;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1.5px solid;
  white-space: nowrap;
}
.legend-desc { color: var(--ink-4); font-size: 11px; }

/* Pending */
.pending-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 8px;
}
.pending-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pending-text { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }

.axis-note {
  padding: 10px 12px;
  background: var(--paper-2);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.axis-line { display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.axis-tag {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.axis-line--emph .axis-tag { color: var(--accent); }
.axis-desc { color: var(--ink-4); font-size: 10.5px; }
.axis-caution {
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  line-height: 1.45;
}

.sidebar-footer { margin-top: auto; padding-top: 8px; }
.ghost-btn {
  width: 100%;
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: all 0.1s ease;
}
.ghost-btn:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Chat column ──────────────────────────────────────────── */
.chat-col {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 640px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.chat-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-title-main { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.chat-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.chat-badge--a { background: var(--paper-3); color: var(--ink-3); }
.chat-badge--b { background: #eff6ff; color: #1d6fa8; border: 1px solid #bfdbfe; }
.chat-sub { font-size: 12px; color: var(--ink-4); margin-top: 4px; }

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 340px;
  max-height: 640px;
}

/* Empty state */
.empty {
  margin: 40px auto;
  max-width: 500px;
  text-align: center;
  color: var(--ink-3);
  padding: 30px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--paper);
}
.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.empty-body { font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
.empty-body em { color: var(--accent); font-style: normal; font-weight: 600; }
.empty-hint { font-size: 11px; color: var(--ink-4); letter-spacing: 0.03em; }

/* Bubbles */
.bubble { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.bubble--user { align-self: flex-end; align-items: flex-end; }
.bubble--assistant { align-self: flex-start; align-items: flex-start; }

.bubble-role {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bubble-text {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  text-wrap: pretty;
  word-break: keep-all;
}
.bubble--user .bubble-text {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 500;
}

/* Thinking */
.thinking {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
  animation: think 1.2s infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes think {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Highlights */
.hl {
  position: relative;
  cursor: pointer;
  padding: 0 3px;
  margin: 0 1px;
  border-bottom: 2px solid;
  border-radius: 2px;
  transition: all 0.15s ease;
  font-weight: 500;
}
.hl:hover {
  filter: brightness(0.95);
  box-shadow: 0 0 0 1px currentColor;
}
.hl--active {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px rgba(31, 58, 104, 0.12);
  border-radius: 3px;
}
.hl--checked {
  opacity: 0.55;
  background-color: rgba(91, 138, 90, 0.08) !important;
  border-bottom-color: var(--green) !important;
}
/* L1 — 밑줄 없음 (일반 서술) */
.hl--l1 { border-bottom-color: transparent; background: transparent; font-weight: 400; cursor: default; }
.hl--l1:hover { filter: none; box-shadow: none; }
/* L2 — 파랑 */
.hl--l2 { border-bottom-color: #3b82f6; background: rgba(59,130,246,0.08); }
/* L3 — 황색 */
.hl--l3 { border-bottom-color: #e8ae2f; background: rgba(232,174,47,0.12); }
/* L4 — 적색 */
.hl--l4 { border-bottom-color: #c82d2d; background: rgba(200,45,45,0.09); }
.hl-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px 1px;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  border-radius: 3px;
  letter-spacing: 0.02em;
  vertical-align: 2px;
  font-family: "Pretendard Variable", sans-serif;
}
.hl-check {
  display: inline-block;
  margin-left: 3px;
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
}

/* Segment summary */
.seg-summary {
  margin-top: 4px;
  padding: 8px 14px 10px;
  background: transparent;
  width: 100%;
  max-width: 560px;
}
.seg-summary-bar {
  height: 3px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.seg-summary-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
}
.seg-summary-text { font-size: 11px; color: var(--ink-4); }
.seg-summary-text b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Composer */
.composer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.composer-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.scenario-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.scenario-btn {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  transition: all 0.12s ease;
}
.scenario-btn:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.scenario-icon {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  min-width: 20px;
  padding-top: 1px;
}
.scenario-question { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.scenario-trigger {
  font-size: 10.5px;
  color: var(--ink-4);
  margin-top: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.02em;
}
.composer-fake {
  display: flex;
  gap: 8px;
  align-items: center;
}
.composer-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-4);
  font-family: inherit;
}
.composer-input:disabled { cursor: not-allowed; }
.composer-send {
  padding: 10px 16px;
  background: var(--paper-3);
  color: var(--ink-4);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: not-allowed;
}

/* ─── Review panel ─────────────────────────────────────────── */
.review-col {
  background: #fbfaf5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  height: fit-content;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
}
.review-col--dim {
  background: repeating-linear-gradient(
    45deg,
    var(--paper) 0 12px,
    var(--paper-2) 12px 24px
  );
}

.review-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
}
.review-head-title { font-size: 13px; font-weight: 700; letter-spacing: 0.01em; }
.review-head-sub {
  font-size: 11px;
  color: rgba(246, 244, 239, 0.65);
  margin-top: 2px;
}

.review-empty {
  padding: 30px 22px;
  text-align: center;
  color: var(--ink-3);
}
.review-empty-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 14px;
}
.review-empty-body { font-size: 13px; line-height: 1.7; margin-bottom: 24px; }
.review-empty-body b { color: var(--ink); }
.review-empty-quote {
  font-size: 12px;
  font-style: italic;
  line-height: 1.7;
  color: var(--red-ink);
  padding: 14px;
  border-left: 3px solid var(--red);
  background: rgba(200, 45, 45, 0.05);
  text-align: left;
}

.review-placeholder { padding: 18px; overflow-y: auto; }
.rp-title { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.rp-body { font-size: 12px; color: var(--ink-3); line-height: 1.7; margin-bottom: 20px; }
.rp-body b { color: var(--ink); }

.friction {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  border-top: 3px solid var(--accent);
}
.friction-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.friction-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.65;
}
.friction-list li { margin-bottom: 6px; }
.friction-list b { color: var(--ink); }

.review-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-tier {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid;
}
.detail-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1.5px solid;
}
.detail-cat { font-size: 11.5px; color: var(--ink-4); font-weight: 500; }

.detail-quote {
  background: var(--paper-2);
  border-left: 2px solid var(--line-2);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
}
.detail-quote-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 4px;
}
.detail-quote-text {
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.55;
  font-style: italic;
  word-break: keep-all;
}

.detail-block-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.detail-block-label--warn { color: var(--red-ink); }

.detail-reason-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
  word-break: keep-all;
}
.detail-concern-text {
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
  padding: 10px 12px;
  background: rgba(200, 45, 45, 0.05);
  border: 1px solid rgba(200, 45, 45, 0.15);
  border-radius: 6px;
  word-break: keep-all;
}
.detail-check-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}
.detail-check-list li { margin-bottom: 4px; }
.detail-source-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.source-chip {
  font-size: 11px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* Confirm row */
.confirm-row {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  align-items: flex-start;
}
.confirm-row:hover { border-color: var(--ink); }
.confirm-row--on {
  background: rgba(91, 138, 90, 0.08);
  border-color: var(--green);
}
.confirm-row input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}
.confirm-title { font-size: 12.5px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.confirm-sub { font-size: 11px; color: var(--ink-4); margin-top: 3px; line-height: 1.45; }

/* Decision */
.decision {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.decision-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.decision-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.55; margin-top: 4px; }
.decision-warn { color: var(--red); font-weight: 700; }
.decision-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.decision-btn {
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  transition: all 0.12s ease;
}
.decision-btn:not(:disabled):hover { border-color: var(--ink); }
.decision-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.decision-btn.is-selected { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.decision-btn--use.is-selected { background: var(--green); border-color: var(--green); }
.decision-btn-title { font-size: 12.5px; font-weight: 700; }
.decision-btn-desc { font-size: 10.5px; color: var(--ink-4); margin-top: 2px; }
.decision-btn.is-selected .decision-btn-desc { color: rgba(246, 244, 239, 0.7); }

/* Scrollbar */
.chat-scroll::-webkit-scrollbar,
.review-body::-webkit-scrollbar,
.review-placeholder::-webkit-scrollbar {
  width: 6px;
}
.chat-scroll::-webkit-scrollbar-thumb,
.review-body::-webkit-scrollbar-thumb,
.review-placeholder::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}

/* Responsive fallback */
@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 240px 1fr 340px;
  }
}
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar, .review-col { position: static; max-height: none; }
}

/* ═══════════════════════════════════════════════════════════
   A: 판단 결과 배지 (버블 하단)
══════════════════════════════════════════════════════════════ */
.dbadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid;
  width: fit-content;
}
.dbadge--used  { background: rgba(91,138,90,0.1);  border-color: var(--green);   color: #3a6639; }
.dbadge--hold  { background: rgba(59,130,246,0.08); border-color: #3b82f6;        color: #1d6fa8; }
.dbadge--reask { background: rgba(232,174,47,0.10); border-color: #e8ae2f; color: #a67200; }

/* A: 리뷰 패널 결과 피드백 카드 */
.decision-result {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1.5px solid;
}
.decision-result--used  { background: rgba(91,138,90,0.08);  border-color: var(--green);  }
.decision-result--hold  { background: rgba(59,130,246,0.07); border-color: #3b82f6;       }
.decision-result--reask { background: rgba(232,174,47,0.09); border-color: #e8ae2f; }
.dr-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.decision-result--used  .dr-title { color: #3a6639; }
.decision-result--hold  .dr-title { color: #1d6fa8; }
.decision-result--reask .dr-title { color: #a67200; }
.dr-body { font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }
.dr-reask-hint { margin-top: 8px; }
.dr-reask-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 3px;
}
.dr-reask-text {
  font-size: 12px; font-style: italic;
  color: var(--ink-2);
  background: var(--paper-2);
  border-left: 2px solid #e8ae2f;
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
}

/* ═══════════════════════════════════════════════════════════
   B: 마스터 대시보드
══════════════════════════════════════════════════════════════ */
.master-dash {
  min-height: 100vh;
  padding: 28px 32px;
  background: var(--bg);
  font-family: 'Pretendard Variable', sans-serif;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.dash-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}
.dash-title-badge {
  font-size: 10px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
}
.dash-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-filter-row {
  display: flex;
  gap: 6px;
}
.dash-filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--line-2);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.12s;
}
.dash-filter-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.dash-filter-btn.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dash-export-btn {
  padding: 7px 16px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.12s;
}
.dash-export-btn:hover { opacity: 0.85; }

/* 통계 카드 */
.dash-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-stat {
  flex: 1;
  min-width: 100px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  text-align: center;
}
.stat-val { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-label { font-size: 11px; color: var(--ink-4); margin-top: 4px; font-weight: 600; }
.stat--used  { border-color: var(--green); }
.stat--used  .stat-val { color: #3a6639; }
.stat--hold  { border-color: #3b82f6; }
.stat--hold  .stat-val { color: #1d6fa8; }
.stat--reask { border-color: #e8ae2f; }
.stat--reask .stat-val { color: #a67200; }

/* 테이블 */
.dash-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.dash-table thead { background: var(--paper-2); }
.dash-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.dash-table th:hover { color: var(--ink); }
.dash-sort-icon { font-size: 10px; color: var(--ink-4); }
.dash-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr:hover { background: var(--paper-2); }
.dash-row--used  td { background: rgba(91,138,90,0.03); }
.dash-row--hold  td { background: rgba(59,130,246,0.03); }
.dash-row--reask td { background: rgba(232,174,47,0.03); }
.dash-td-email { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.dash-td-num   { text-align: center; font-weight: 700; color: var(--ink); }

.dash-decision-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
}
.dash-decision-tag--used  { background: rgba(91,138,90,0.1); border-color: var(--green); color: #3a6639; }
.dash-decision-tag--hold  { background: rgba(59,130,246,0.08); border-color: #3b82f6; color: #1d6fa8; }
.dash-decision-tag--reask { background: rgba(232,174,47,0.1); border-color: #e8ae2f; color: #a67200; }

.dash-empty { padding: 40px; text-align: center; color: var(--ink-4); font-size: 14px; }
.dash-loading { padding: 40px; text-align: center; color: var(--ink-4); }
.dash-error { padding: 20px; color: var(--red); font-size: 13px; background: #fff1f1; border-radius: 8px; }

/* ═══════════════════════════════════════════════════════════
   조건 B — Citation UI
══════════════════════════════════════════════════════════════ */

/* 모드 버튼 조건 C 태그 (보라색) */
.mode-btn-tag--c {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

/* 채팅 상단 배지 — 조건 C */
.chat-badge--c {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.3);
}

/* Citation wrap — 인라인 블록으로 칩이 줄바꿈 안되게 */
/* ── Citation 단락 래퍼 ──────────────────────────────────────── */
.cit-para {
  display: inline;
}

/* ── Citation 칩 wrapper ─────────────────────────────────────── */
.cit-wrap {
  display: inline;
  position: relative;
}

/* ── 인라인 출처 칩 — Gemini 스타일 캡슐 ─────────────────────── */
.cit-chip {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'Pretendard Variable', sans-serif;
  color: #444;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  vertical-align: middle;
  white-space: nowrap;
  transition: background 0.12s;
  user-select: none;
  line-height: 1.6;
}
.cit-chip:hover,
.cit-chip--open {
  background: #e2e2e2;
}

/* ── 팝오버 카드 — Gemini 스타일 ───────────────────────────────── */
.cit-popover {
  position: absolute;
  z-index: 300;
  top: calc(100% + 10px);
  left: 0;
  display: inline-flex;
  flex-direction: column;
  min-width: 270px;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.08);
  overflow: visible;
  text-decoration: none;
}
/* 삼각형 꼬리 */
.cit-pop-arrow {
  position: absolute;
  top: -7px;
  left: 18px;
  width: 14px;
  height: 7px;
  overflow: hidden;
}
.cit-pop-arrow::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #fff;
  box-shadow: -1px -1px 3px rgba(0,0,0,0.08);
}
/* 팝오버 본문 링크 영역 */
.cit-pop-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px 12px;
  text-decoration: none;
  color: inherit;
  border-radius: 12px 12px 0 0;
  transition: background 0.1s;
}
.cit-pop-body:hover { background: #f8f9fa; }
/* 사이트 아이콘 + 도메인 한 줄 */
.cit-pop-site {
  display: flex;
  align-items: center;
  gap: 7px;
}
.cit-pop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.cit-pop-domain {
  font-size: 11.5px;
  color: #5f6368;
  font-weight: 400;
}
/* 기사 제목 */
.cit-pop-title {
  font-size: 13px;
  color: #202124;
  font-weight: 600;
  line-height: 1.45;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 미리보기 텍스트 */
.cit-pop-preview {
  font-size: 11.5px;
  color: #5f6368;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
}
/* 페이지네이션 바 */
.cit-pop-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px 12px 8px;
  border-top: 1px solid #f1f3f4;
  border-radius: 0 0 12px 12px;
}
.cit-pop-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  border-radius: 50%;
  font-size: 16px;
  color: #5f6368;
  cursor: pointer;
  transition: background 0.1s;
  padding: 0;
  line-height: 1;
}
.cit-pop-nav-btn:hover:not(:disabled) { background: #f1f3f4; }
.cit-pop-nav-btn:disabled { color: #c4c7cb; cursor: default; }
.cit-pop-nav-label {
  font-size: 12px;
  color: #5f6368;
  min-width: 36px;
  text-align: center;
}

/* bubble-text를 relative로 — 팝오버 기준점 */
.bubble-text {
  position: relative;
}

/* Citation 모드일 때 리뷰 패널 — 파란 상단 라인 */
.review-col--citation {
  border-top: 3px solid #3b82f6 !important;
}
.review-col--citation .review-empty-title {
  color: #1d6fa8;
}

/* ── 조건별 Answer Banner ─────────────────────────────────────── */
.answer-banner {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 16px;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid transparent;
  flex-wrap: wrap;
}
.answer-banner-icon {
  font-size: 13px;
  flex-shrink: 0;
}
.answer-banner-text {
  font-weight: 500;
  color: inherit;
}
.answer-banner-sub {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.65;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
/* 조건 A — 중립 회색 */
.answer-banner--plain {
  background: #f9fafb;
  color: #6b7280;
  border-bottom-color: #e5e7eb;
}
/* 조건 B — 파란 citation 톤 */
.answer-banner--citation {
  background: #eff6ff;
  color: #1d6fa8;
  border-bottom-color: #bfdbfe;
}
/* 조건 C — 황색 경고 톤 */
.answer-banner--testux {
  background: #fffbeb;
  color: #a67200;
  border-bottom-color: #fde68a;
}

/* ── 버블 role 옆 근거 건수 배지 ─────────────────────────────── */
.bubble-evidence-count {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border-radius: 20px;
  background: #eff6ff;
  color: #1d6fa8;
  border: 1px solid #bfdbfe;
  vertical-align: middle;
}

/* ── 하이라이트 세그먼트 — 근거 건수 인라인 배지 ──────────────── */
.hl-evidence-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border-radius: 10px;
  background: rgba(0,0,0,0.06);
  color: inherit;
  opacity: 0.75;
  vertical-align: middle;
  line-height: 1.6;
}

/* ── ReviewPanel 세그먼트 detail — 근거 건수 배지 ────────────── */
.detail-evidence-count {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border-radius: 20px;
  background: #eff6ff;
  color: #1d6fa8;
  border: 1px solid #bfdbfe;
  vertical-align: middle;
}

/* ── Citation 유형 레이블 칩 ─────────────────────────────────── */
.cit-type-label {
  display: inline-block;
  margin: 0 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid currentColor;
  vertical-align: middle;
  letter-spacing: 0.02em;
  line-height: 1.6;
  opacity: 0.9;
}

/* ── Citation 팝오버 — reason 설명 텍스트 ───────────────────── */
.cit-pop-reason {
  margin-top: 5px;
  font-size: 11.5px;
  color: #374151;
  font-weight: 400;
  line-height: 1.5;
  word-break: keep-all;
  padding-bottom: 2px;
}

/* chat-badge--b 는 위에서 정의 (파란 citation 톤) */

/* ═══════════════════════════════════════════════════════════════
   애널리틱스 대시보드 (adash) — 마스터 전용
   ═══════════════════════════════════════════════════════════════ */

/* 루트 컨테이너 */
.adash {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--paper);
  font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ── 헤더 ── */
.adash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #17181a;
  color: #e8e6e1;
  flex-shrink: 0;
}
.adash-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.adash-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.adash-badge-master {
  display: inline-block;
  padding: 2px 7px;
  background: #c82d2d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.06em;
}
.adash-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.adash-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-right: 4px;
}
.adash-btn-refresh,
.adash-btn-export {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #3a3d42;
  background: #2a2c30;
  color: #e8e6e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.adash-btn-refresh:hover { background: #3a3d42; }
.adash-btn-export {
  border-color: #1d6fa8;
  background: #0f3258;
  color: #a8d4f5;
}
.adash-btn-export:hover { background: #1d4d7a; }

/* ── 탭 네비게이션 ── */
.adash-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  flex-shrink: 0;
  padding: 0 20px;
}
.adash-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-4);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.adash-tab:hover { color: var(--ink-2); }
.adash-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── KPI 그리드 ── */
.adash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 20px;
  background: var(--paper);
  flex-shrink: 0;
}
.adash-kpi {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-1);
}
.adash-kpi--hl {
  border-color: #f5c6c6;
  background: #fff8f8;
}
.adash-kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adash-kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}
.adash-kpi--hl .adash-kpi-value {
  color: var(--red-ink);
}
.adash-kpi-note {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 5px;
  line-height: 1.4;
}

/* ── 바 차트 ── */
.adash-chart-wrap {
  padding: 0 20px 16px;
  flex-shrink: 0;
}
.adash-bar-canvas {
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.adash-empty-chart {
  margin: 0 20px 16px;
  padding: 32px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
}

/* ── 섹션 타이틀 ── */
.adash-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 10px;
  padding: 0 20px;
  letter-spacing: -0.01em;
}

/* ── 테이블 공통 ── */
.adash-table-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 16px 0 0;
}
.adash-scroll-table {
  flex: 1;
  overflow: auto;
  margin: 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.adash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.adash-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--paper-2);
  color: var(--ink-4);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  cursor: default;
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.adash-table th:hover { background: var(--paper-3); }
.adash-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  white-space: nowrap;
}
.adash-table tr:hover td { background: var(--paper-2); }
.adash-td-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.adash-td-num {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.adash-td-summary {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--ink-4);
}

/* ── 결정 태그 ── */
.adash-dtag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.adash-dtag--used   { background: #dcfce7; color: #15803d; }
.adash-dtag--hold   { background: #fef9c3; color: #a16207; }
.adash-dtag--reask  { background: #eff6ff; color: #1d6fa8; }

/* ── 행 색조 ── */
.adash-tr--hold  td { background: #fefce8; }
.adash-tr--reask td { background: #eff6ff; }

/* ── 오정보 수용 태그 ── */
.adash-misinfo-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}
.adash-misinfo-tag--yes { background: #fee2e2; color: #b91c1c; }
.adash-misinfo-tag--no  { background: #d1fae5; color: #065f46; }

/* ── 이벤트 태그 ── */
.adash-event-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  background: var(--paper-3);
  color: var(--ink-3);
}
.adash-event-tag--source_open   { background: #eff6ff; color: #1d6fa8; }
.adash-event-tag--source_close  { background: #f0f9ff; color: #0369a1; }
.adash-event-tag--segment_click { background: #fefce8; color: #a16207; }
.adash-event-tag--submit        { background: #dcfce7; color: #15803d; }
.adash-event-tag--reask         { background: #f0f9ff; color: #0369a1; }

/* ── 빈 상태 ── */
.adash-empty {
  padding: 40px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13px;
}

/* ── 로딩 ── */
.adash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100vh;
  font-size: 14px;
  color: var(--ink-4);
}
.adash-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: adash-spin 0.8s linear infinite;
}
@keyframes adash-spin { to { transform: rotate(360deg); } }

/* ── 에러 ── */
.adash-error {
  padding: 32px;
  color: var(--red-ink);
  font-size: 13px;
  background: #fff8f8;
  border: 1px solid #f5c6c6;
  border-radius: 10px;
  margin: 20px;
}

/* ── 각주/노트 ── */
.adash-footnote {
  margin: 0 20px 16px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-radius: 7px;
  font-size: 11px;
  color: var(--ink-4);
  line-height: 1.6;
}
.adash-event-note {
  margin: 8px 20px 16px;
  font-size: 11px;
  color: var(--ink-4);
  text-align: right;
}

/* ── 반응형 (소형 화면) ── */
@media (max-width: 900px) {
  .adash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .adash-kpi-grid { grid-template-columns: 1fr; }
  .adash-kpi-value { font-size: 22px; }
}

/* ── 조건 필터 바 (adash-cond-bar) ────────────────────────── */
.adash-cond-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.adash-cond-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 4px;
}
.adash-cond-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.adash-cond-btn:hover {
  border-color: var(--accent-2);
  color: var(--accent);
}
.adash-cond-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(31,58,104,0.18);
}

/* 조건별 활성 색상 구분 */
.adash-cond-btn[data-mode="plain"].is-active  { background: #4d5058; border-color: #4d5058; }
.adash-cond-btn[data-mode="citation"].is-active { background: #1d6fa8; border-color: #1d6fa8; }
.adash-cond-btn[data-mode="test-ux"].is-active { background: #1f3a68; border-color: #1f3a68; }

/* ── 섹션 내 조건 배지 ──────────────────────────────────────── */
.adash-cond-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ── CSV 버튼 그룹 ──────────────────────────────────────────── */
.adash-export-group {
  display: flex;
  gap: 4px;
  align-items: center;
}
.adash-btn-export--sub {
  border-color: #2d4a6e !important;
  background: #0a2040 !important;
  color: #7db8e0 !important;
  font-size: 11px !important;
  padding: 4px 9px !important;
}
.adash-btn-export--sub:hover { background: #1a3a60 !important; }

/* ═══════════════════════════════════════════════════════════
   사전 동의 화면 (Informed Consent)
   ═══════════════════════════════════════════════════════════ */
#consent-root {
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 60px;
}
.consent-card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  overflow: hidden;
}
.consent-header {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  padding: 32px 36px 24px;
}
.consent-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--blue);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.consent-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.consent-subtitle {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
}
.consent-body {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.consent-section { display: flex; flex-direction: column; gap: 8px; }
.consent-sec-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}
.consent-sec-body {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.75;
}
.consent-sec-list {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.75;
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.consent-footer {
  border-top: 1px solid var(--line);
  padding: 24px 36px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.consent-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.consent-check-row input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.consent-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.consent-decline-btn {
  padding: 9px 18px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-4);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.consent-decline-btn:hover { background: var(--paper-2); }
.consent-agree-btn {
  padding: 10px 26px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.consent-agree-btn:disabled {
  background: #d1d5db;
  color: #9ca3af;
  opacity: 1;
  cursor: not-allowed;
  box-shadow: none;
}
.consent-agree-btn:not(:disabled) {
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(29,78,216,.35), 0 3px 10px rgba(29,78,216,.4);
}
.consent-agree-btn:not(:disabled):hover {
  background: #1e40af;
  box-shadow: 0 0 0 3px rgba(29,78,216,.5), 0 5px 16px rgba(29,78,216,.5);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════
   실험 완료 화면 (Completion Screen)
   ═══════════════════════════════════════════════════════════ */
.completion-wrap {
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.completion-card {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  overflow: hidden;
}
.completion-header {
  text-align: center;
  padding: 40px 36px 28px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.completion-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e6f4ea;
  color: #2e7d32;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.completion-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.completion-sub {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.7;
}
.completion-cond {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.completion-cond-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.completion-cond-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink-3);
  border: 1px solid var(--line-2);
}
.completion-badge--b { background: #eff6ff; color: #1d6fa8; border-color: #3b82f6; }
.completion-badge--c { background: #fff1f1; color: #a02929; border-color: #c82d2d; }
.completion-summary {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}
.completion-sec-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 14px;
}
.completion-rows { display: flex; flex-direction: column; gap: 10px; }
.completion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.completion-row-icon { font-size: 16px; flex-shrink: 0; }
.completion-row-q {
  flex: 1;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.4;
}
.completion-row-d {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
.completion-row-d--used  { background: #e6f4ea; color: #2e7d32; }
.completion-row-d--hold  { background: #fff8e1; color: #a67200; }
.completion-row-d--reask { background: #eff6ff; color: #1d6fa8; }
.completion-row-d--none  { background: var(--paper-3); color: var(--ink-4); }
.completion-survey {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}
.completion-survey-desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.7;
  margin: 0 0 16px;
}
.completion-survey-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 24px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: background .15s;
}
.completion-survey-btn:hover { background: #155fa0; }
.completion-footer {
  padding: 18px 28px;
  font-size: 12px;
  color: var(--ink-4);
  line-height: 1.7;
  text-align: center;
  background: var(--paper);
}

/* ═══════════════════════════════════════════════════════════
   조건 잠금 카드 (Sidebar)
   ═══════════════════════════════════════════════════════════ */
.block-label-lock { font-size: 12px; }
.mode-fixed-card {
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mode-fixed-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--paper-3);
  color: var(--ink-3);
  width: fit-content;
}
.mode-fixed-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}
.mode-fixed-desc { font-size: 11px; color: var(--ink-4); }

/* ═══════════════════════════════════════════════════════════
   세션 바 — 조건 배지
   ═══════════════════════════════════════════════════════════ */
.session-mode-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink-3);
  border: 1px solid var(--line-2);
}

/* ═══════════════════════════════════════════════════════════
   조건 간 비교 탭 (CompareTab)
   ═══════════════════════════════════════════════════════════ */
.adash-compare { display: flex; flex-direction: column; gap: 24px; }
.adash-compare-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .adash-compare-bars { grid-template-columns: 1fr; } }
.adash-compare-metric { display: flex; flex-direction: column; gap: 10px; }
.adash-cbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.adash-cbar-label {
  width: 46px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  flex-shrink: 0;
}
.adash-cbar-track {
  flex: 1;
  height: 22px;
  background: var(--paper-3);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.adash-cbar-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
  transition: width .5s ease;
}
.adash-cbar-val {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}
.adash-cbar-n {
  width: 60px;
  font-size: 11px;
  color: var(--ink-4);
  flex-shrink: 0;
  text-align: right;
}
.adash-tr--hl { background: var(--paper-2) !important; }
.adash-td-label { font-weight: 600; color: var(--ink-2); }
.adash-td-num   { font-family: 'JetBrains Mono', monospace; font-size: 13px; text-align: right; }
/* 판단 분포 */
.adash-decision-dist { display: flex; gap: 16px; }
@media (max-width: 700px) { .adash-decision-dist { flex-direction: column; } }
.adash-dist-col { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.adash-dist-label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.adash-dist-bar {
  height: 20px;
  display: flex;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-3);
}
.adash-dist-seg { min-width: 2px; transition: flex .4s; }
.adash-dist-nums { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; font-weight: 700; }
.adash-dist-empty { font-size: 12px; color: var(--ink-4); }

/* ═══════════════════════════════════════════════════════════
   진행 현황 탭 (ProgressTab)
   ═══════════════════════════════════════════════════════════ */
.adash-progress { display: flex; flex-direction: column; gap: 20px; }
.adash-progress-summary { padding: 16px; background: var(--paper); border-radius: 8px; border: 1px solid var(--line); }
.adash-progress-bar-wrap { display: flex; flex-direction: column; gap: 8px; }
.adash-progress-bar-track {
  height: 12px;
  background: var(--paper-3);
  border-radius: 6px;
  overflow: hidden;
}
.adash-progress-bar-fill {
  height: 100%;
  background: #2e7d32;
  border-radius: 6px;
  transition: width .6s ease;
}
.adash-progress-bar-label { font-size: 13px; color: var(--ink-2); }
.adash-progress-pct { margin-left: 6px; color: var(--ink-4); }
.adash-progress-group { display: flex; flex-direction: column; gap: 10px; }
.adash-progress-group-header { font-size: 13px; color: var(--ink-3); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.adash-progress-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 900px) { .adash-progress-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .adash-progress-grid { grid-template-columns: repeat(2, 1fr); } }
.adash-progress-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 10px 8px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.adash-progress-cell--done    { border-color: #81c784; background: #f1f8f1; }
.adash-progress-cell--partial { border-color: #ffcc02; background: #fffef0; }
.adash-progress-cell-name { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.adash-progress-cell-bar { display: flex; gap: 4px; }
.adash-progress-pip {
  width: 18px;
  height: 6px;
  border-radius: 3px;
  background: var(--paper-3);
  border: 1px solid var(--line-2);
}
.adash-progress-pip--done { background: #2e7d32; border-color: #2e7d32; }
.adash-progress-cell-status { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.adash-progress-cell--done .adash-progress-cell-status { color: #2e7d32; }
.adash-progress-cell-time { font-size: 10px; color: var(--ink-4); font-family: 'JetBrains Mono', monospace; }

/* ═══════════════════════════════════════════════════════════════
   라틴 스퀘어 진행 현황 (Sidebar — tester 전용)
   ═══════════════════════════════════════════════════════════════ */
.latin-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.latin-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  opacity: 0.55;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}
.latin-step--done {
  opacity: 1;
  background: #f1f8f1;
  border-color: #81c784;
}
.latin-step--current {
  opacity: 1;
  background: var(--paper-2);
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(47, 83, 144, 0.12);
}
.latin-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  flex-shrink: 0;
}
.latin-step--done    .latin-step-num { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.latin-step--current .latin-step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.latin-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.latin-step-cond {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink-3);
  display: inline-block;
  width: fit-content;
}
.latin-step-cond.mode-btn-tag--b { background: #eff6ff; color: #1d6fa8; }
.latin-step-cond.mode-btn-tag--c { background: #fff1f1; color: #a02929; }
.latin-step-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.latin-step-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════════
   로그인 — 참가자 번호 입력
   ═══════════════════════════════════════════════════════════════ */
.login-pid-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s;
}
.login-pid-row:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(47, 83, 144, 0.1);
}
.login-pid-prefix {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--paper-2);
  border-right: 1px solid var(--line-2);
  height: 42px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.login-pid-input {
  border: none !important;
  border-radius: 0 !important;
  flex: 1;
  width: 80px;
  font-size: 20px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  text-align: center;
  padding: 0 12px !important;
  height: 42px;
  background: transparent !important;
  box-shadow: none !important;
}
.login-pid-input::-webkit-outer-spin-button,
.login-pid-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.login-pid-input[type=number] { -moz-appearance: textfield; }
.login-pid-hint {
  font-size: 11.5px;
  color: var(--ink-4);
  margin-top: 5px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   완료 화면 — 라틴 스퀘어 조건 순서 표시
   ═══════════════════════════════════════════════════════════════ */
.completion-cond-order {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.completion-row-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.completion-row-mode {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink-3);
  display: inline-block;
  width: fit-content;
}
.completion-row-mode.completion-badge--b { background: #eff6ff; color: #1d6fa8; }
.completion-row-mode.completion-badge--c { background: #fff1f1; color: #a02929; }

/* ═══════════════════════════════════════════════════════════════
   조건 A/B 인라인 판단 블록 (AssistantBubble 하단)
   ═══════════════════════════════════════════════════════════════ */
.inline-decision {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.inline-decision-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.inline-decision-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.inline-decision-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--line-2);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  min-width: 90px;
}
.inline-decision-btn:hover { border-color: var(--ink-3); background: #fff; }
.inline-decision-btn-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.inline-decision-btn-desc {
  font-size: 10px;
  color: var(--ink-4);
}
.inline-decision-btn--used.is-selected  { border-color: #2e7d32; background: #f1f8f1; }
.inline-decision-btn--used.is-selected .inline-decision-btn-title { color: #2e7d32; }
.inline-decision-btn--hold.is-selected  { border-color: var(--amber-ink); background: #fffbeb; }
.inline-decision-btn--hold.is-selected .inline-decision-btn-title { color: var(--amber-ink); }
.inline-decision-btn--reask.is-selected { border-color: var(--accent-2); background: #eff6ff; }
.inline-decision-btn--reask.is-selected .inline-decision-btn-title { color: var(--accent-2); }
.inline-decision-result {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
}
.inline-decision-result--used  { background: #f1f8f1; color: #2e7d32; }
.inline-decision-result--hold  { background: #fffbeb; color: var(--amber-ink); }
.inline-decision-result--reask { background: #eff6ff; color: var(--accent-2); }
