/* ==================================================================
 * AI Assistant — C안: 엔터프라이즈 분석 보고서 톤 (Bloomberg·은행)
 * ================================================================
 * 본 파일은 backend router (/api/v1/ai-assistant/panel.css) 가 서빙.
 *
 * 디자인 원칙 (C안):
 *   - 정형화된 보고서 (어두운 헤더 + 섹션 라벨 + 표 행)
 *   - 정보 밀도 높음 (작은 글자·등폭 글꼴·세밀한 격자)
 *   - 차분한 모노톤 + 절제된 액센트
 *   - 라벨·수치는 등폭 글꼴 (정렬 가지런)
 * ================================================================== */

/* ===== Provider 식별 칩 (2026-05-17 박제 — Cloud vs On-premise 비교 평가용) ===== */
.ai-provider-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.ai-provider-chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.ai-provider-chip.cloud {
  background: rgba(8, 74, 142, 0.08);
  color: #084a8e;
  border: 1px solid rgba(8, 74, 142, 0.25);
}
.ai-provider-chip.cloud .dot {
  background: #084a8e;
}
.ai-provider-chip.local {
  background: rgba(111, 66, 193, 0.08);
  color: #6f42c1;
  border: 1px solid rgba(111, 66, 193, 0.25);
}
.ai-provider-chip.local .dot {
  background: #6f42c1;
}
.ai-provider-chip .model-name {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: inherit;
  opacity: 0.75;
}

/* ===== 상태분석 inline 로딩 (잔상 제거 직후 표시) ===== */
.ai-status-loading-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  background: var(--surface);
  border-radius: 4px;
  margin-top: 8px;
}
.ai-status-loading-inline .ai-loading-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(8, 74, 142, 0.15);
  border-top-color: var(--ai-1, #084a8e);
  border-radius: 50%;
  animation: ai-spin 0.9s linear infinite;
}
.ai-status-loading-inline .ai-loading-text {
  font-size: 12px;
  color: var(--text-2, #4a5468);
  font-weight: 500;
}
/* On-premise 그룹: 보라 톤 spinner */
.ai-provider-chip.local + .ai-status-loading-inline .ai-loading-spinner {
  border-color: rgba(111, 66, 193, 0.15);
  border-top-color: #6f42c1;
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* ===== 응답 컨테이너 ===== */
#ai-status-response {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

/* ===== 헤더: 어두운 배경 + 흰 글자 (보고서 표지) ===== */
.ai-status-resp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: var(--text-1);
  color: #fff;
  border-bottom: 2px solid var(--accent);
}

.ai-status-resp-header-icon {
  width: 16px;
  height: 16px;
  background: none;
  color: var(--accent);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-status-resp-header-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.ai-status-resp-header-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.96);
}

/* 우측 라벨 */
.ai-status-resp-header::after {
  content: 'STATUS REPORT';
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.45);
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

/* ===== 요약 섹션 (SUMMARY) ===== */
.ai-status-summary {
  padding: 14px 18px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.72;
  color: var(--text-1);
  position: relative;
}
.ai-status-summary::before {
  content: 'SUMMARY';
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-3);
  margin-bottom: 7px;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

/* ===== 인사이트 = 표 (KEY FINDINGS) ===== */
.ai-status-insights {
  padding: 14px 0 4px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
}
.ai-status-insights::before {
  content: 'KEY FINDINGS';
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-3);
  padding: 0 18px 8px;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

/* 표 행 — header(icon+label) + text + metric */
.ai-status-insight {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 14px;
  padding: 11px 18px;
  background: none;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--border-soft);
  transition: background 0.12s ease;
}

.ai-status-insight:hover {
  background: var(--bg-alt);
  transform: none;
  box-shadow: none;
}

/* header 영역 = 색상 막대 + 라벨 (한 묶음 좌측) */
.ai-status-insight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  min-width: 96px;
}

/* 도트 = 4×18 색상 막대 (보고서 격자선 톤) */
.ai-status-insight-icon svg { display: none; }
.ai-status-insight-icon {
  width: 4px;
  height: 18px;
  border-radius: 0;
  background: var(--text-3);
  flex-shrink: 0;
}

/* 라벨 = 등폭 + 대문자 톤 (영문 라벨 효과) */
.ai-status-insight-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  background: none;
  padding: 0;
  border-radius: 0;
  white-space: nowrap;
}

.ai-status-insight-text {
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.5;
  margin: 0;
}

/* 큰 수치 — 우측 정렬 등폭 */
.ai-status-insight-metric {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  text-align: right;
  letter-spacing: 0;
  margin: 0;
  white-space: nowrap;
  min-width: 48px;
}

/* ===== 색별 톤 (도트 + 라벨 + 수치 색만) ===== */

.ai-status-insight[data-tone="urgent"] .ai-status-insight-icon { background: #d92d20; }
.ai-status-insight[data-tone="urgent"] .ai-status-insight-label { color: #b42318; }
.ai-status-insight[data-tone="urgent"] .ai-status-insight-metric { color: #b42318; }

.ai-status-insight[data-tone="alert"] .ai-status-insight-icon { background: #dc6803; }
.ai-status-insight[data-tone="alert"] .ai-status-insight-label { color: #b54708; }
.ai-status-insight[data-tone="alert"] .ai-status-insight-metric { color: #b54708; }

.ai-status-insight[data-tone="advice"] .ai-status-insight-icon { background: var(--accent); }
.ai-status-insight[data-tone="advice"] .ai-status-insight-label { color: var(--accent); }
.ai-status-insight[data-tone="advice"] .ai-status-insight-metric { color: var(--accent); }

.ai-status-insight[data-tone="achieved"] .ai-status-insight-icon { background: #079455; }
.ai-status-insight[data-tone="achieved"] .ai-status-insight-label { color: #027a48; }
.ai-status-insight[data-tone="achieved"] .ai-status-insight-metric { color: #027a48; }

.ai-status-insight[data-tone="info"] .ai-status-insight-icon { background: var(--text-3); }
.ai-status-insight[data-tone="info"] .ai-status-insight-label { color: var(--text-2); }

/* ===== 에러 배지 ===== */
.ai-status-error {
  margin: 0 18px 14px;
  padding: 9px 12px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-left: 3px solid #b42318;
  border-radius: 2px;
  font-size: 12px;
  color: #b42318;
  line-height: 1.5;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

/* ===== Loading Placeholder — 회전 스피너 + 짧은 텍스트 ===== */
.ai-status-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  text-align: center;
}

#ai-status-loading .ai-status-placeholder-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  background: none;
  animation: ai-spin 0.8s linear infinite;
}
#ai-status-loading .ai-status-placeholder-icon svg { display: none; }

#ai-status-loading .ai-status-placeholder-text {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* no-project: 정보 아이콘 + 안내 */
#ai-no-project .ai-status-placeholder {
  padding: 36px 20px;
  gap: 12px;
}
#ai-no-project .ai-status-placeholder-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bg);
  border-radius: 50%;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
#ai-no-project .ai-status-placeholder-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
#ai-no-project .ai-status-placeholder-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  max-width: 340px;
}

/* ===== 좁은 화면 ===== */
@media (max-width: 480px) {
  .ai-status-resp-header { padding: 10px 14px; }
  .ai-status-resp-header::after { display: none; }
  .ai-status-summary { padding: 12px 14px 14px; }
  .ai-status-insights::before { padding: 0 14px 8px; }
  .ai-status-insight { padding: 10px 14px; column-gap: 10px; }
  .ai-status-insight-header { min-width: 80px; gap: 8px; }
  .ai-status-insight-text { font-size: 12px; }
  .ai-status-insight-metric { font-size: 14px; }
}


/* =================================================================
 * AI 작업이력 검색 (triggerAISearch) — C안 보고서 톤 정합
 * ================================================================= */

/* === 검색 입력 폼 === */
.ai-search-form {
  display: grid;
  grid-template-columns: auto 1fr auto auto;  /* icon | input | reset | submit */
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  margin: 14px 0 14px;
  padding: 0 4px 0 0;
  overflow: hidden;
}
.ai-search-form-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-3);
}
.ai-search-form-icon svg { width: 14px; height: 14px; }

.ai-search-input {
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
  background: transparent;
  padding: 8px 4px;
  width: 100%;
  font-family: inherit;
}
.ai-search-input::placeholder { color: var(--text-3); }

.ai-search-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ai-search-submit-btn:hover { background: var(--accent-hover); }
.ai-search-submit-btn svg { width: 13px; height: 13px; }

/* === 검색·대화 리셋 버튼 (보조 액션 — 회색 톤, 호버 시 부각) === */
.ai-search-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 4px;
  background: transparent;
  color: var(--text-3);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.ai-search-reset-btn:hover {
  background: var(--bg-alt);
  color: var(--text-1);
  border-color: var(--border);
}
.ai-search-reset-btn:active {
  background: var(--border-soft);
}
.ai-search-reset-btn svg {
  width: 11px;
  height: 11px;
}

/* === 검색 placeholder (초기 / 결과 없음 / 로딩) === */
.ai-search-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px 20px;
  text-align: center;
}
.ai-search-placeholder-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bg);
  color: var(--accent);
}
.ai-search-placeholder-icon svg { width: 17px; height: 17px; }
.ai-search-placeholder-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  max-width: 340px;
}

/* 로딩 시 회전 스피너 */
.ai-search-spinner {
  border: 2px solid var(--border) !important;
  border-top-color: var(--accent) !important;
  background: none !important;
  animation: ai-spin 0.8s linear infinite;
  width: 22px !important;
  height: 22px !important;
}
.ai-search-spinner svg { display: none; }

/* === 검색 결과 컨테이너 === */
#ai-search-results-container {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

/* AI 자연어 답변 카드 (NL Search 옵션 A — runSearch 응답 상단) */
.ai-search-ai-answer {
  margin: 0 0 14px 0;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}
.ai-search-ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}
.ai-search-ai-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #6366f1;
}
.ai-search-ai-icon .ico {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.ai-search-ai-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #4338ca;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}
.ai-search-ai-meta {
  margin-left: auto;
  font-size: 10.5px;
  color: #6b7280;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}
.ai-search-ai-body {
  padding: 12px 16px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #1f2937;
}
.ai-search-ai-body h2,
.ai-search-ai-body h3,
.ai-search-ai-body h4 {
  margin: 12px 0 6px;
  color: #111827;
  font-weight: 700;
}
.ai-search-ai-body h2 { font-size: 15px; }
.ai-search-ai-body h3 { font-size: 14px; }
.ai-search-ai-body h4 { font-size: 13px; }
.ai-search-ai-body p { margin: 6px 0; }
.ai-search-ai-body ul,
.ai-search-ai-body ol { margin: 6px 0 6px 20px; padding: 0; }
.ai-search-ai-body li { margin: 3px 0; }
.ai-search-ai-body strong { color: #4338ca; font-weight: 700; }
.ai-search-ai-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 12.5px;
}
.ai-search-ai-body th,
.ai-search-ai-body td {
  border: 1px solid #d1d5db;
  padding: 5px 8px;
  text-align: left;
}
.ai-search-ai-body th {
  background: rgba(99, 102, 241, 0.05);
  font-weight: 700;
}

/* 결과 요약 헤더 (RESULTS 라벨 + 요약 라인) */
.ai-search-summary {
  padding: 14px 18px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ai-search-summary-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-3);
  margin-bottom: 6px;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}
.ai-search-summary-text {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.55;
}
.ai-search-summary-text strong {
  color: var(--accent);
  font-weight: 700;
}

/* 결과 리스트 */
.ai-search-results {
  display: flex;
  flex-direction: column;
}

/* 결과 행 */
.ai-search-result-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  column-gap: 12px;
  align-items: start;
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  transition: background 0.12s ease;
}
.ai-search-result-row:hover { background: var(--bg-alt); }

/* type 라벨 (이슈/작업지시/할일) — 색별 톤 */
.ai-search-result-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--bg-alt);
  color: var(--text-2);
  border: 1px solid var(--border);
  height: 22px;
  white-space: nowrap;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}
.ai-search-result-type-issue {
  background: #fef3f2; color: #b42318; border-color: #fecdca;
}
.ai-search-result-type-work_request {
  background: #fff8eb; color: #b54708; border-color: #fee4b6;
}
.ai-search-result-type-task {
  background: var(--accent-bg-soft); color: var(--accent); border-color: var(--accent-bg);
}
.ai-search-result-type-message {
  background: #eff8ff; color: #175cd3; border-color: #b2ddff;
}
.ai-search-result-type-folder,
.ai-search-result-type-document {
  background: #f0fdf4; color: #166534; border-color: #bbf7d0;
}
.ai-search-result-type-issue_comment,
.ai-search-result-type-work_request_comment {
  background: #faf5ff; color: #6b21a8; border-color: #e9d5ff;
}
.ai-search-result-type-progress_update {
  background: #fdf2f8; color: #9d174d; border-color: #fbcfe8;
}
.ai-search-result-type-issue_attachment,
.ai-search-result-type-work_request_attachment {
  background: #f8fafc; color: #475569; border-color: #cbd5e1;
}

/* 결과 본문 */
.ai-search-result-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ai-search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.45;
  word-break: break-word;
}
.ai-search-result-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}
.ai-search-result-num {
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ai-search-result-project {
  color: var(--text-2);
}
.ai-search-result-actor {
  color: var(--text-2);
}
.ai-search-result-ts {
  font-variant-numeric: tabular-nums;
}
.ai-search-result-snippet {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 관련도 (우측 큰 등폭 숫자) */
.ai-search-result-relevance {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  text-align: right;
  min-width: 24px;
  align-self: center;
}

/* 토큰 하이라이트 */
.ai-search-hl {
  background: #fef3c7;
  color: #92400e;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
}

/* 좁은 화면 */
@media (max-width: 480px) {
  .ai-search-result-row {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    padding: 10px 14px;
  }
  .ai-search-result-relevance {
    grid-column: 2;
    text-align: right;
    font-size: 14px;
  }
  .ai-search-summary { padding: 12px 14px 10px; }
}


/* =================================================================
 * AI Chat Thread (follow-up 질문 + 답변 + .docx 다운로드)
 * ================================================================= */

.ai-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.ai-chat-thread:empty { display: none; }

/* === Chat 메시지 bubble === */
.ai-chat-msg {
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 10px;
  align-items: start;
}

.ai-chat-msg-role {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.ai-chat-msg-user .ai-chat-msg-role {
  background: var(--bg-alt);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.ai-chat-msg-ai .ai-chat-msg-role {
  background: var(--accent);
  color: #fff;
}

.ai-chat-msg-body {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-1);
  min-width: 0;
}
.ai-chat-msg-user .ai-chat-msg-body {
  background: var(--bg-alt);
  border-color: var(--border);
}
.ai-chat-msg-ai .ai-chat-msg-body {
  background: var(--accent-bg-soft);
  border-color: var(--accent-bg);
}

/* === Chat 로딩 === */
.ai-chat-msg-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12.5px;
}
.ai-chat-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: ai-spin 0.8s linear infinite;
  display: inline-block;
}

/* === Chat 마크다운 렌더링 === */
.ai-chat-md > :first-child { margin-top: 0; }
.ai-chat-md > :last-child { margin-bottom: 0; }

.ai-chat-md h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 14px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ai-chat-md h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin: 12px 0 6px;
}
.ai-chat-md h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin: 10px 0 4px;
}

.ai-chat-md p {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-1);
}

.ai-chat-md ul {
  margin: 6px 0 6px 20px;
  padding: 0;
}
.ai-chat-md li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-1);
  margin: 3px 0;
}

.ai-chat-md strong {
  font-weight: 700;
  color: var(--text-1);
}

/* 마크다운 표 */
.ai-chat-md-table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.ai-chat-md-table th {
  background: var(--bg-alt);
  color: var(--text-1);
  font-weight: 700;
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
.ai-chat-md-table td {
  padding: 7px 10px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-1);
  vertical-align: top;
}
.ai-chat-md-table tr:hover td { background: var(--bg-alt); }

/* === .docx 다운로드 버튼 === */
.ai-chat-docx-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  font-family: inherit;
}
.ai-chat-docx-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.ai-chat-docx-btn:active {
  transform: translateY(0);
}
.ai-chat-docx-btn svg {
  width: 13px;
  height: 13px;
}

/* === Chat 에러 === */
.ai-chat-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-left: 3px solid #b42318;
  border-radius: 4px;
  font-size: 12px;
  color: #b42318;
  line-height: 1.5;
}

/* 좁은 화면 — chat 메시지 */
@media (max-width: 480px) {
  .ai-chat-msg { grid-template-columns: 28px 1fr; column-gap: 8px; }
  .ai-chat-msg-role { width: 28px; height: 28px; font-size: 10.5px; }
  .ai-chat-msg-body { padding: 9px 12px; font-size: 12.5px; }
  .ai-chat-md-table { font-size: 11.5px; }
  .ai-chat-md-table th, .ai-chat-md-table td { padding: 6px 8px; }
}
