/* ── Alpine cloak ── */
[x-cloak] { display: none !important; }

/* ── 모바일 풀다운 새로고침 방지 ── */
html, body { overscroll-behavior-y: none; }

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 2px; }

/* ── 사이드바 목록 + 채팅 스크롤바 항상 표시 ── */
#sidebar-conv-section .overflow-y-scroll,
#sidebar-rep-section .overflow-y-scroll,
#sidebar-dd-section .overflow-y-scroll,
#msg-container, #report-result-container,
#dd-report-container, #dd-msg-container, #dd-toc-container {
  scrollbar-width: thin;
  scrollbar-color: #4b5563 transparent;
}
#sidebar-conv-section .overflow-y-scroll::-webkit-scrollbar,
#sidebar-rep-section .overflow-y-scroll::-webkit-scrollbar,
#sidebar-dd-section .overflow-y-scroll::-webkit-scrollbar,
#msg-container::-webkit-scrollbar,
#report-result-container::-webkit-scrollbar,
#dd-report-container::-webkit-scrollbar,
#dd-msg-container::-webkit-scrollbar,
#dd-toc-container::-webkit-scrollbar { width: 6px; }
#sidebar-conv-section .overflow-y-scroll::-webkit-scrollbar-thumb,
#sidebar-rep-section .overflow-y-scroll::-webkit-scrollbar-thumb,
#sidebar-dd-section .overflow-y-scroll::-webkit-scrollbar-thumb,
#msg-container::-webkit-scrollbar-thumb,
#report-result-container::-webkit-scrollbar-thumb,
#dd-report-container::-webkit-scrollbar-thumb,
#dd-msg-container::-webkit-scrollbar-thumb,
#dd-toc-container::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 3px; cursor: pointer; }
#sidebar-conv-section .overflow-y-scroll::-webkit-scrollbar-thumb:hover,
#sidebar-rep-section .overflow-y-scroll::-webkit-scrollbar-thumb:hover,
#sidebar-dd-section .overflow-y-scroll::-webkit-scrollbar-thumb:hover,
#msg-container::-webkit-scrollbar-thumb:hover,
#report-result-container::-webkit-scrollbar-thumb:hover,
#dd-report-container::-webkit-scrollbar-thumb:hover,
#dd-msg-container::-webkit-scrollbar-thumb:hover,
#dd-toc-container::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* ── 마크다운 스타일 ── */
.prose h1, .prose h2, .prose h3 { font-weight: 600; margin: 1rem 0 0.5rem; }
.prose h1 { font-size: 1.25rem; }
.prose h2 { font-size: 1.1rem; }
.prose h3 { font-size: 1rem; }
.prose p  { margin: 0.5rem 0; line-height: 1.65; }
.prose ul { margin: 0.5rem 0 0.5rem 1.5rem; list-style-type: disc; }
.prose ul ul { list-style-type: circle; margin-top: 0.2rem; margin-bottom: 0.2rem; }
.prose ul ul ul { list-style-type: square; }
.prose ol { margin: 0.5rem 0 0.5rem 1.5rem; list-style-type: decimal; }
.prose ol ol { list-style-type: lower-alpha; margin-top: 0.2rem; margin-bottom: 0.2rem; }
.prose ol ol ol { list-style-type: lower-roman; }
.prose li { margin: 0.2rem 0; }
.prose code { background: var(--bg-elev); color: var(--t1); padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.85em; }
.prose pre  { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 8px; overflow-x: auto; margin: 0.75rem 0; font-size: 0.85rem; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote { border-left: 3px solid #6366f1; padding-left: 1rem; color: var(--t3); margin: 0.5rem 0; }
.prose strong { font-weight: 600; }
.prose table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.8125rem; }
.prose th { background: var(--bg-elev); color: var(--t1); padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; border: 1px solid var(--bd-sub); }
.prose td { padding: 0.5rem 0.75rem; border: 1px solid var(--bd); color: var(--t2); background: var(--tbl-row-even); }
.prose tr:nth-child(even) td { background: var(--tbl-row-odd); }
.prose a { color: #6366f1; text-decoration: underline; }
.notice-content a { color: #818cf8; text-decoration: underline; }
.notice-content a:hover { color: #a5b4fc; }
.notice-content img { max-width: 100%; height: auto; border-radius: 6px; margin: .5rem 0; }
.notice-content p { margin: .4rem 0; }
.notice-content ul { margin: .4rem 0 .4rem 1.5rem; list-style-type: disc; }
.notice-content ol { margin: .4rem 0 .4rem 1.5rem; list-style-type: decimal; }
.notice-content li { margin: .2rem 0; }
.notice-content strong { font-weight: 600; }
.notice-content h1,.notice-content h2,.notice-content h3 { font-weight: 600; margin: .8rem 0 .3rem; }
.notice-content h1 { font-size: 1.1rem; }
.notice-content h2 { font-size: 1rem; }
.notice-content h3 { font-size: .9rem; }

/* ── 스트리밍 애니메이션 ── */
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes pulse-red { 0%,100%{opacity:1} 50%{opacity:0.15} }
@keyframes progress-slide {
  0%   { transform: translateX(-120%) scaleX(0.4); }
  50%  { transform: translateX(60%)   scaleX(0.9); }
  100% { transform: translateX(220%)  scaleX(0.4); }
}
.progress-indeterminate {
  width: 45%; height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 4px;
  animation: progress-slide 1.6s ease-in-out infinite;
}
.chart-spinner { animation: spin 1s linear infinite; }
.dot { width:6px; height:6px; border-radius:50%; background:#9ca3af; display:inline-block;
       animation: bounce 1s infinite; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
.stream-dot-red   { width:6px; height:6px; border-radius:50%; background:#ef4444; display:inline-block; flex-shrink:0; animation: pulse-red 0.9s ease-in-out infinite; }
.stream-dot-green { width:6px; height:6px; border-radius:50%; background:#22c55e; display:inline-block; flex-shrink:0; }
.stt-dot { width:10px; height:10px; border-radius:50%; background:#fff; display:block; animation: pulse-red 0.7s ease-in-out infinite; }

textarea { scrollbar-width: none; }
textarea::-webkit-scrollbar { display: none; }

/* ── 모바일 입력 패널 ── */
#chat-input-panel,
#report-input-panel {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── 입력 패널 리사이즈 핸들 (채팅/보고서 공용) ── */
.rsz-handle {
  height: 14px; cursor: ns-resize; flex-shrink: 0;
  touch-action: none; user-select: none; -webkit-user-select: none;
  display: flex; align-items: center; justify-content: center;
  border-top: 1px solid var(--bd);
}
.rsz-handle::before {
  content: ''; width: 36px; height: 3px; border-radius: 2px;
  background: #374151; transition: background 0.15s;
}
.rsz-handle:hover::before { background: #6366f1; }
/* 모바일: 터치 타겟 확대 */
@media (pointer: coarse) {
  .rsz-handle { height: 36px; }
}

/* 터치 기기: hover-only 버튼 항상 표시 */
@media (pointer: coarse) {
  .group .group-hover\:opacity-100 { opacity: 1 !important; }
  .group\/folder .group-hover\/folder\:opacity-100 { opacity: 1 !important; }
}

/* ── Q&A 입력 textarea 상단 리사이즈 핸들 ── */
.qna-rsz-handle {
  height: 14px; cursor: ns-resize; flex-shrink: 0;
  touch-action: none; user-select: none; -webkit-user-select: none;
  display: flex; align-items: center; justify-content: center;
  border-top: 1px solid rgba(99,102,241,0.2);
}
.qna-rsz-handle::before {
  content: ''; width: 36px; height: 3px; border-radius: 2px;
  background: #374151; transition: background 0.15s;
}
.qna-rsz-handle:hover::before { background: #6366f1; }
@media (pointer: coarse) {
  .qna-rsz-handle { height: 36px; }
}

/* ── Q&A 하단 리사이즈 핸들 (전체 높이 조절) ── */
.qna-bot-rsz-handle {
  height: 10px; cursor: ns-resize; flex-shrink: 0;
  touch-action: none; user-select: none; -webkit-user-select: none;
  display: flex; align-items: center; justify-content: center;
}
.qna-bot-rsz-handle::before {
  content: ''; width: 36px; height: 3px; border-radius: 2px;
  background: #374151; transition: background 0.15s;
}
.qna-bot-rsz-handle:hover::before { background: #6366f1; }
@media (pointer: coarse) {
  .qna-bot-rsz-handle { height: 28px; }
}

/* ── Q&A 상단 리사이즈 핸들 (타이틀 위치에서 위아래 크기 조절) ── */
.qna-top-rsz-handle {
  height: 10px; cursor: ns-resize; flex-shrink: 0;
  touch-action: none; user-select: none; -webkit-user-select: none;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid rgba(99,102,241,0.2);
  background: rgba(99,102,241,0.05);
}
.qna-top-rsz-handle::before {
  content: ''; width: 36px; height: 3px; border-radius: 2px;
  background: #374151; transition: background 0.15s;
}
.qna-top-rsz-handle:hover::before { background: #6366f1; }
@media (pointer: coarse) {
  .qna-top-rsz-handle { height: 28px; }
}

/* ── CSS 변수 hover 유틸 (인라인 onmouseover 대체) ── */
.hover-elev:hover { background: var(--bg-elev) !important; }
.hover-elev-from-surf { background: var(--bg-surf); }
.hover-elev-from-surf:hover { background: var(--bg-elev) !important; }

/* ── 기본 폰트 ── */
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif; font-size: 13px; }
.prose { font-size: 14px; line-height: 1.7; }
.prose h1 { font-size: 1.15rem; }
.prose h2 { font-size: 1rem; }
.prose h3 { font-size: 0.9rem; }

/* ── Deep Dive 보고서 섹션 카드 레이아웃 ── */
/* 보고서 헤더 (제목 + 생성일) */
#dd-report-content .dd-report-meta {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--bd);
}
#dd-report-content .dd-report-meta h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}
#dd-report-content .dd-report-meta p {
  font-size: 0.8rem;
  color: var(--t4);
  margin: 0;
}

/* 레벨1 섹션 카드 */
#dd-report-content .dd-report-section {
  background: var(--bg-surf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 1rem;
}
/* 레벨1 섹션 카드 헤더 (h1 = TOC 레벨1) */
#dd-report-content .dd-report-section > h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 1.1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bd-sub);
  line-height: 1.4;
  display: flex;
  align-items: baseline;
  gap: 0;
  scroll-margin-top: 16px;
}
/* 레벨2 소목차 헤더 (h2 = TOC 레벨2) */
#dd-report-content .dd-report-section > h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--t1);
  margin: 1.6rem 0 0.6rem;
  padding: 0.45rem 0.8rem;
  background: var(--bg-elev);
  border-left: 2px solid rgba(99,102,241,0.5);
  border-radius: 0 6px 6px 0;
  scroll-margin-top: 16px;
}
#dd-report-content .dd-report-section > h2:first-of-type {
  margin-top: 0.25rem;
}
/* ── 공통 리치 텍스트 스타일 (DD 뷰 · 홈 게시 · 공유 페이지 공통) ────── */
/* 적용 대상: #dd-report-content .dd-report-section, .dd-rich-text */

/* 레벨3 세세목차 헤더 (h3) — 배경 + 좌측 강조 */
#dd-report-content .dd-report-section h3,
.dd-rich-text h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--t1);
  margin: 1.25rem 0 0.5rem;
  padding: 0.35rem 0.7rem;
  background: linear-gradient(90deg, rgba(139,92,246,0.12) 0%, rgba(139,92,246,0.03) 100%);
  border-left: 3px solid rgba(139,92,246,0.55);
  border-radius: 0 4px 4px 0;
  scroll-margin-top: 16px;
}
/* h4 이하 — 미니 라벨 스타일 */
#dd-report-content .dd-report-section h4,
.dd-rich-text h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--t2);
  margin: 0.9rem 0 0.35rem;
  padding: 0.2rem 0.55rem;
  background: rgba(156,163,175,0.08);
  border-left: 2px solid rgba(156,163,175,0.4);
  border-radius: 0 3px 3px 0;
  scroll-margin-top: 16px;
}

/* 본문 가독성 */
#dd-report-content .dd-report-section p,
.dd-rich-text p {
  margin: 0.55rem 0;
  line-height: 1.7;
  color: var(--t2);
}
/* 본문 내 강조 (인라인 strong) — 초록 pill */
#dd-report-content .dd-report-section p strong,
#dd-report-content .dd-report-section li strong,
.dd-rich-text p strong,
.dd-rich-text li strong {
  display: inline-block;
  color: rgba(134, 239, 172, 1);
  font-weight: 600;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  padding: 0.02em 0.45em;
  border-radius: 4px;
  line-height: 1.4;
}

/* 단독 strong 문단 (의사 소제목) */
#dd-report-content .dd-report-section p.dd-pseudo-heading,
.dd-rich-text p.dd-pseudo-heading {
  margin: 1rem 0 0.4rem;
}
#dd-report-content .dd-report-section p.dd-pseudo-heading > strong,
.dd-rich-text p.dd-pseudo-heading > strong {
  display: block;
  color: rgba(253, 224, 71, 1);
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  border: none;
  padding: 0.2rem 0 0.2rem 1rem;
  border-radius: 0;
  position: relative;
  letter-spacing: 0.01em;
}
#dd-report-content .dd-report-section p.dd-pseudo-heading > strong::before,
.dd-rich-text p.dd-pseudo-heading > strong::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0.2rem;
  color: rgba(251, 191, 36, 0.75);
  font-size: 0.85rem;
  line-height: 1.4;
}
#dd-report-content .dd-report-section ul,
#dd-report-content .dd-report-section ol,
.dd-rich-text ul,
.dd-rich-text ol {
  margin: 0.5rem 0 0.9rem;
  padding-left: 1.4rem;
}
#dd-report-content .dd-report-section li,
.dd-rich-text li {
  margin: 0.25rem 0;
  line-height: 1.65;
  color: var(--t2);
}
/* 인라인 코드 */
#dd-report-content .dd-report-section code,
.dd-rich-text code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.88em;
  background: rgba(99,102,241,0.1);
  color: rgba(165,180,252,1);
  padding: 0.08em 0.35em;
  border-radius: 4px;
}
/* 인용구 */
#dd-report-content .dd-report-section blockquote,
.dd-rich-text blockquote {
  margin: 0.75rem 0;
  padding: 0.5rem 0.9rem;
  border-left: 3px solid rgba(251,191,36,0.55);
  background: rgba(251,191,36,0.06);
  border-radius: 0 6px 6px 0;
  color: var(--t2);
}
/* 구분선 */
#dd-report-content .dd-report-section hr,
.dd-rich-text hr {
  margin: 1.25rem 0;
  border: none;
  border-top: 1px dashed var(--bd-sub);
}

/* 섹션 번호 뱃지 */
.dd-hnum {
  font-size: 0.72em;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: rgba(129,140,248,0.95);
  background: rgba(99,102,241,0.22);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  margin-right: 0.5em;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
h2 .dd-hnum {
  color: rgba(129,140,248,0.88);
  background: rgba(99,102,241,0.18);
  font-size: 0.75em;
}
h3 .dd-hnum {
  color: rgba(167,139,250,0.85);
  background: rgba(139,92,246,0.16);
  font-size: 0.78em;
}

/* 라이트 테마 보정 */
html[data-theme="light"] #dd-report-content .dd-report-section {
  background: #ffffff;
  border-color: #e2e8f0;
}
html[data-theme="light"] #dd-report-content .dd-report-section > h2 {
  background: #f8fafc;
  border-left-color: rgba(99,102,241,0.45);
}
html[data-theme="light"] #dd-report-content .dd-report-section h3,
html[data-theme="light"] .dd-rich-text h3 {
  background: linear-gradient(90deg, rgba(139,92,246,0.08) 0%, rgba(139,92,246,0.02) 100%);
  border-left-color: rgba(139,92,246,0.45);
  color: #1e293b;
}
html[data-theme="light"] #dd-report-content .dd-report-section h4,
html[data-theme="light"] .dd-rich-text h4 {
  background: rgba(100,116,139,0.05);
  border-left-color: rgba(100,116,139,0.35);
  color: #334155;
}
html[data-theme="light"] #dd-report-content .dd-report-section p strong,
html[data-theme="light"] #dd-report-content .dd-report-section li strong,
html[data-theme="light"] .dd-rich-text p strong,
html[data-theme="light"] .dd-rich-text li strong {
  background: rgba(22,163,74,0.08);
  border-color: rgba(22,163,74,0.25);
  color: #15803d;
}
html[data-theme="light"] #dd-report-content .dd-report-section p.dd-pseudo-heading > strong,
html[data-theme="light"] .dd-rich-text p.dd-pseudo-heading > strong {
  background: transparent;
  color: #b45309;
}
html[data-theme="light"] #dd-report-content .dd-report-section p.dd-pseudo-heading > strong::before,
html[data-theme="light"] .dd-rich-text p.dd-pseudo-heading > strong::before {
  color: rgba(217, 119, 6, 0.8);
}
html[data-theme="light"] #dd-report-content .dd-report-section code,
html[data-theme="light"] .dd-rich-text code {
  background: rgba(79,70,229,0.08);
  color: #4338ca;
}
html[data-theme="light"] #dd-report-content .dd-report-section blockquote,
html[data-theme="light"] .dd-rich-text blockquote {
  background: rgba(251,191,36,0.08);
}
html[data-theme="light"] .dd-hnum {
  color: rgba(79,70,229,0.85);
  background: rgba(79,70,229,0.08);
}
html[data-theme="light"] h2 .dd-hnum { color: rgba(79,70,229,0.7); background: rgba(79,70,229,0.07); }
html[data-theme="light"] h3 .dd-hnum { color: rgba(109,40,217,0.65); background: rgba(109,40,217,0.06); }

/* PDF 인쇄 시 섹션 나눔 */
@media print {
  #dd-report-content .dd-report-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .dd-hnum { background: transparent !important; }
}

/* ── 유저 메시지 인라인 액션 바 ── */
.msg-actions { display: none; }
.msg-actions.open { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 0 4px; }
.msg-action-btn {
  position: relative; padding: 4px; border-radius: 6px;
  color: var(--t4); transition: color 0.15s, background 0.15s; background: transparent; border: none; cursor: pointer;
}
.msg-action-btn:hover { color: var(--t2); }
.folder-menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; font-size: 12px; color: var(--t1);
  background: transparent; border: none; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.folder-menu-item:hover { background: #6366f1; color: #ffffff; }
.folder-menu-item.danger { color: #f87171; }
.folder-menu-item.danger:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }
.msg-action-btn::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  background: var(--bg-elev); color: var(--t1); border: 1px solid var(--bd);
  font-size: 11px; padding: 2px 8px; border-radius: 5px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 10;
}
.msg-action-btn:hover::after { opacity: 1; }

/* ── 끊긴 응답 배지 ── */
.msg-truncated-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 6px 12px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  font-size: 12px; color: #fbbf24;
}
.msg-truncated-badge__icon { font-size: 13px; }
.msg-truncated-badge__text { color: var(--t2); }
.msg-truncated-badge__btn {
  background: rgba(245, 158, 11, 0.18);
  border: none; color: #fbbf24;
  padding: 3px 10px; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  transition: background 0.15s;
}
.msg-truncated-badge__btn:hover { background: rgba(245, 158, 11, 0.30); }
html[data-theme="light"] .msg-truncated-badge {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(217, 119, 6, 0.4);
  color: #92400e;
}
html[data-theme="light"] .msg-truncated-badge__text { color: #78350f; }
html[data-theme="light"] .msg-truncated-badge__btn {
  background: rgba(245, 158, 11, 0.20); color: #92400e;
}
html[data-theme="light"] .msg-truncated-badge__btn:hover { background: rgba(245, 158, 11, 0.35); }

/* ── 테마 변수 ── */
:root {
  --bg-base: #030712; --bg-surf: #111827; --bg-elev: #1f2937;
  --bd: #1f2937; --bd-sub: #374151;
  --t1: #f3f4f6; --t2: #d1d5db; --t3: #9ca3af; --t4: #6b7280;
  --tbl-row-even: #0f172a; --tbl-row-odd: #1e293b;
  --chart-wrap-bg: rgba(31,41,55,0.5); --chart-wrap-bd: rgba(75,85,99,0.4);
  /* 상태 색상 */
  --c-busy: #f87171; --c-busy-bg: rgba(248,113,113,0.15); --c-busy-bd: rgba(248,113,113,0.4);
  --c-done: #34d399; --c-done-bg: rgba(52,211,153,0.15);
  --c-accent: #818cf8;
  --c-bullet-busy: #ef4444; --c-bullet-done: #22c55e;
}
html[data-theme="light"] {
  --bg-base: #f8fafc; --bg-surf: #ffffff; --bg-elev: #f1f5f9;
  --bd: #e2e8f0; --bd-sub: #cbd5e1;
  --t1: #0f172a; --t2: #334155; --t3: #64748b; --t4: #94a3b8;
  --tbl-row-even: #ffffff; --tbl-row-odd: #f8fafc;
  --chart-wrap-bg: #ffffff; --chart-wrap-bd: #e2e8f0;
  /* 상태 색상 — 라이트 */
  --c-busy: #dc2626; --c-busy-bg: rgba(220,38,38,0.08); --c-busy-bd: rgba(220,38,38,0.3);
  --c-done: #16a34a; --c-done-bg: rgba(22,163,74,0.08);
  --c-accent: #6366f1;
  --c-bullet-busy: #dc2626; --c-bullet-done: #16a34a;
}

/* ── 대화 목록 아이템 (테마별 별도 정의) ── */
.conv-active   { background: rgba(99,102,241,0.18); color: #c7d2fe; font-weight: 600; box-shadow: inset 3px 0 0 #818cf8; }
.conv-inactive { color: #9ca3af; }
.conv-inactive:hover { background: #1f2937; color: #e5e7eb; }
html[data-theme="light"] .conv-active   { background: #c7d2fe; color: #3730a3; font-weight: 600; box-shadow: inset 3px 0 0 #4338ca; }
html[data-theme="light"] .conv-inactive { color: #64748b; }
html[data-theme="light"] .conv-inactive:hover { background: #f1f5f9; color: #0f172a; }

/* ── 심층 보고서 목차 아이템 ── */
.dd-toc-l1 {
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  color: #9ca3af;
  cursor: default;
}
.dd-toc-l1:hover {
  background: #1e2839;
  border-color: #374151;
  color: #e5e7eb;
}
.dd-toc-l1.dd-toc-done  { background: rgba(30,27,75,0.4); border-color: rgba(99,102,241,0.3); color: #c7d2fe; }
.dd-toc-l1.dd-toc-busy  { background: rgba(30,27,75,0.2); border-color: rgba(99,102,241,0.35); color: #a5b4fc; }

.dd-toc-l2 {
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  margin-left: 1.25rem;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  color: #6b7280;
  cursor: default;
}
.dd-toc-l2:hover {
  background: #1a2030;
  border-color: #2d3748;
  color: #d1d5db;
}
.dd-toc-l2.dd-toc-done  { background: rgba(30,27,75,0.25); border-color: rgba(99,102,241,0.2); color: #a5b4fc; }
.dd-toc-l2.dd-toc-busy  { background: rgba(30,27,75,0.12); border-color: rgba(99,102,241,0.22); color: #818cf8; }

/* 라이트 모드 목차 아이템 */
html[data-theme="light"] .dd-toc-l1 { color: #64748b; }
html[data-theme="light"] .dd-toc-l1:hover { background: #f0f4ff; border-color: #c7d2fe; color: #1e293b; }
html[data-theme="light"] .dd-toc-l1.dd-toc-done { background: #eef2ff; border-color: #a5b4fc; color: #3730a3; }
html[data-theme="light"] .dd-toc-l1.dd-toc-busy { background: #f5f3ff; border-color: #c4b5fd; color: #5b21b6; }

html[data-theme="light"] .dd-toc-l2 { color: #94a3b8; }
html[data-theme="light"] .dd-toc-l2:hover { background: #f5f7ff; border-color: #ddd6fe; color: #334155; }
html[data-theme="light"] .dd-toc-l2.dd-toc-done { background: #f5f3ff; border-color: #c4b5fd; color: #4338ca; }
html[data-theme="light"] .dd-toc-l2.dd-toc-busy { background: #faf5ff; border-color: #ddd6fe; color: #6d28d9; }

/* level-3 */
.dd-toc-l3 {
  border: 1px solid transparent;
  border-radius: 0.375rem;
  padding: 0.3rem 0.5rem;
  margin-left: 2.75rem;
  color: #6b7280;
  font-size: 0.7rem;
  cursor: default;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dd-toc-l3:hover { background: #161d2a; border-color: #2d3748; color: #c1c8d4; }
.dd-toc-l3.dd-toc-done { background: rgba(30,27,75,0.2); border-color: rgba(99,102,241,0.18); color: #a5b4fc; }
.dd-toc-l3.dd-toc-busy { background: rgba(30,27,75,0.1); border-color: rgba(99,102,241,0.2); color: #818cf8; }
html[data-theme="light"] .dd-toc-l3 { color: #94a3b8; }
html[data-theme="light"] .dd-toc-l3:hover { background: #f8f9ff; border-color: #e0e7ff; color: #475569; }
html[data-theme="light"] .dd-toc-l3.dd-toc-done { background: #f0f4ff; border-color: #c7d2fe; color: #4338ca; }
html[data-theme="light"] .dd-toc-l3.dd-toc-busy { background: #faf5ff; border-color: #ddd6fe; color: #6d28d9; }

/* 드래그 앤 드롭 */
.dd-toc-l1[draggable="true"], .dd-toc-l2[draggable="true"], .dd-toc-l3[draggable="true"] { cursor: grab; }
.dd-toc-l1[draggable="true"]:active, .dd-toc-l2[draggable="true"]:active, .dd-toc-l3[draggable="true"]:active { cursor: grabbing; }
.dd-toc-dragover { border-color: #6366f1 !important; background: rgba(99,102,241,0.15) !important; }
html[data-theme="light"] .dd-toc-dragover { border-color: #6366f1 !important; background: rgba(99,102,241,0.08) !important; }

/* ── 라이트 모드: Tailwind 클래스 전역 오버라이드 ── */
html[data-theme="light"] body           { background-color: #f8fafc !important; color: #0f172a !important; }
html[data-theme="light"] .bg-gray-950   { background-color: #f8fafc !important; }
html[data-theme="light"] .bg-gray-900   { background-color: #ffffff !important; }
html[data-theme="light"] .bg-gray-800   { background-color: #f1f5f9 !important; }
html[data-theme="light"] .bg-gray-700   { background-color: #e2e8f0 !important; }
html[data-theme="light"] .text-gray-100 { color: #0f172a !important; }
html[data-theme="light"] .text-gray-200 { color: #1e293b !important; }
html[data-theme="light"] .text-gray-300 { color: #334155 !important; }
html[data-theme="light"] .text-gray-400 { color: #475569 !important; }
html[data-theme="light"] .text-gray-500 { color: #64748b !important; }
html[data-theme="light"] .text-gray-600 { color: #64748b !important; }
html[data-theme="light"] .border-gray-800 { border-color: #e2e8f0 !important; }
html[data-theme="light"] .border-gray-700 { border-color: #cbd5e1 !important; }
html[data-theme="light"] .hover\:bg-gray-800:hover { background-color: #f1f5f9 !important; }
html[data-theme="light"] .hover\:bg-gray-700:hover { background-color: #e2e8f0 !important; }
html[data-theme="light"] .hover\:bg-gray-600:hover { background-color: #cbd5e1 !important; }
html[data-theme="light"] .hover\:bg-gray-900:hover { background-color: #f8fafc !important; }
html[data-theme="light"] .hover\:text-gray-200:hover { color: #0f172a !important; }
html[data-theme="light"] .hover\:text-gray-300:hover { color: #334155 !important; }
html[data-theme="light"] .placeholder-gray-600::placeholder { color: #94a3b8 !important; }
html[data-theme="light"] .bg-indigo-900  { background-color: #ede9fe !important; }
html[data-theme="light"] .border-indigo-700 { border-color: #c4b5fd !important; }
/* 투명도 변형 (bg-xxx/nn) 오버라이드 */
html[data-theme="light"] .bg-gray-800\/60 { background-color: #f8fafc !important; }
html[data-theme="light"] .bg-gray-800\/40 { background-color: #f1f5f9 !important; }
html[data-theme="light"] .bg-gray-800\/30 { background-color: #f1f5f9 !important; }
html[data-theme="light"] .border-gray-700\/50 { border-color: #cbd5e1 !important; }
html[data-theme="light"] .border-gray-700\/30 { border-color: #e2e8f0 !important; }
html[data-theme="light"] .bg-red-900\/30   { background-color: #fee2e2 !important; }
html[data-theme="light"] .bg-indigo-500\/15 { background-color: #e0e7ff !important; }
/* prose */
html[data-theme="light"] .prose          { color: #0f172a; }
html[data-theme="light"] .prose pre      { background: #f1f5f9 !important; color: #1e293b !important; }
html[data-theme="light"] .prose pre code { background: none !important; color: inherit !important; }
/* 스크롤바 */
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
/* 사이드바 로고 텍스트 (버튼 제외, span만 타깃) */
html[data-theme="light"] #sidebar span.text-white { color: #0f172a !important; }

/* ── 사이드바 레이아웃 ── */
/* 기본: fixed 드로어 (모바일 + 핀 해제 데스크탑) */
#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  width: 18rem;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
#sidebar.sidebar-open { transform: translateX(0); }
.hamburger-btn { display: flex; }
#sidebar-overlay { display: none; }
#sidebar-overlay.sidebar-open { display: block; }

/* 핀 고정 상태: 사이드바가 일반 흐름으로 항상 표시 */
#sidebar.sidebar-pinned {
  position: relative !important;
  transform: translateX(0) !important;
  flex-shrink: 0;
}
/* 핀 고정 상태: 햄버거·오버레이 숨김 */
.has-pinned-sidebar .hamburger-btn { display: none !important; }
.has-pinned-sidebar #sidebar-overlay { display: none !important; }

/* ── 보고서 뷰 ── */
.report-prompt-area { min-height: 100px; }
.report-result-area { flex: 1; overflow-y: auto; }

/* ── PDF 인쇄 ── */
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area {
    display: block !important;
    position: fixed; inset: 0; z-index: 9999;
    background: #ffffff; color: #0f172a;
    padding: 15mm 16mm; box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
  }
  #print-area h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 3mm; color: #0f172a; }
  #print-area .print-meta { font-size: 11px; color: #64748b; margin-bottom: 6mm; border-bottom: 1px solid #e2e8f0; padding-bottom: 3mm; }
  #print-area .prose { color: #0f172a !important; }
  #print-area .prose h1, #print-area .prose h2, #print-area .prose h3 { color: #0f172a !important; }
  #print-area .prose p, #print-area .prose li { color: #1e293b !important; }
  #print-area .prose code { background: #f1f5f9 !important; color: #1e293b !important; }
  #print-area .prose pre  { background: #f1f5f9 !important; color: #1e293b !important; }
  #print-area .prose blockquote { color: #475569 !important; border-left-color: #6366f1; }
  #print-area .prose th { background: #e2e8f0 !important; color: #0f172a !important; border-color: #cbd5e1 !important; }
  #print-area .prose td { background: #ffffff !important; color: #1e293b !important; border-color: #e2e8f0 !important; }
  #print-area .prose tr:nth-child(even) td { background: #f8fafc !important; }
  .dl-wrap { position: relative; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area th, #print-area td { color: #0f172a !important; background: #ffffff !important; border-color: #e2e8f0 !important; }
  #print-area th { background: #f1f5f9 !important; font-weight: 600 !important; }
  #print-area img { max-width: 100%; height: auto; }
  #print-area .chart-wrap { background: #ffffff !important; border-color: #e2e8f0 !important; }
  @page { margin: 0; size: A4; }
}

/* ── 후속 질문 제안 ── */
.suggest-questions-wrap { margin-top: 14px; }
.suggest-box {
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 14px;
  padding: 14px 16px 12px;
  background: rgba(99,102,241,.04);
}
.suggest-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #818cf8;
  margin-bottom: 10px; display: flex; align-items: center; gap: 5px;
}
.suggest-label::before {
  content: ''; display: inline-block; width: 3px; height: 10px;
  background: #6366f1; border-radius: 2px;
}
.suggest-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
}
.suggest-btn {
  text-align: left; background: rgba(255,255,255,.04);
  border: 1px solid rgba(99,102,241,.2); border-radius: 12px;
  padding: 8px 16px; font-size: 13px; color: var(--t2);
  cursor: pointer; line-height: 1.4;
  transition: border-color .15s, color .15s, background .15s;
  white-space: normal; word-break: keep-all;
}
.suggest-btn:hover {
  border-color: #6366f1; color: #4f46e5;
  background: rgba(99,102,241,.08);
}
html[data-theme="dark"] .suggest-btn:hover {
  color: #c7d2fe;
  background: rgba(99,102,241,.15);
}
/* 스켈레톤 */
.suggest-skeleton-wrap {
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 14px; padding: 14px 16px 12px;
  background: rgba(99,102,241,.03);
}
.suggest-skeleton-label {
  height: 10px; width: 72px; border-radius: 4px; margin-bottom: 10px;
  background: rgba(99,102,241,.15); animation: skel-pulse 1.4s ease-in-out infinite;
}
.suggest-skeleton-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
}
.suggest-skeleton-btn {
  height: 36px; border-radius: 999px;
  background: rgba(255,255,255,.05); animation: skel-pulse 1.4s ease-in-out infinite;
}
@keyframes skel-pulse { 0%,100%{opacity:.4} 50%{opacity:.9} }

/* ── 공유 수신자 태그 ── */
.share-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(79,70,229,0.2); border: 1px solid rgba(99,102,241,0.45);
  color: #a5b4fc; font-size: 12px; border-radius: 999px; padding: 3px 10px;
}
.share-tag button { color: #818cf8; line-height: 0; }
.share-tag button:hover { color: #c7d2fe; }
html[data-theme="light"] .share-tag {
  background: #e0e7ff; border-color: #a5b4fc; color: #3730a3;
}
html[data-theme="light"] .share-tag button { color: #6366f1; }
html[data-theme="light"] .share-tag button:hover { color: #4338ca; }

/* ── 폴더 섹션 ── */
.folder-section {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-top: 4px;
  overflow: hidden;
}
.folder-header {
  background: rgba(156, 163, 175, 0.22);
  border-left: 3px solid rgba(251, 191, 36, 0.55);
}
.folder-header .text-gray-300 {
  color: #e5e7eb !important;
}
.folder-header .text-gray-500 {
  color: #9ca3af !important;
}
.folder-header .text-gray-600 {
  color: #9ca3af !important;
}
.folder-items {
  background: rgba(180, 180, 200, 0.07);
}
html[data-theme="light"] .folder-section {
  border-color: rgba(180, 140, 60, 0.3) !important;
}
html[data-theme="light"] .folder-header {
  background: #4b5563 !important;
  border-left: 3px solid rgba(251, 191, 36, 0.8) !important;
}
html[data-theme="light"] .folder-header .text-gray-300 { color: #ffffff !important; }
html[data-theme="light"] .folder-header .text-gray-500 { color: rgba(255,255,255,0.65) !important; }
html[data-theme="light"] .folder-header .text-gray-600 { color: rgba(255,255,255,0.5) !important; }
html[data-theme="light"] .folder-header button:hover svg {
  color: #ffffff !important;
  opacity: 1 !important;
}
html[data-theme="light"] .folder-items {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* ── 배지 (읽기 전용 / 복사본) ── */
.badge-readonly, .badge-clone {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}
html[data-theme="light"] .badge-readonly,
html[data-theme="light"] .badge-clone {
  background: #d1fae5; border-color: #6ee7b7; color: #065f46;
}

/* ── 심층 보고서 채팅 메시지 ── */
#dd-msg-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.dd-msg-user {
  align-self: flex-end;
  max-width: 80%;
  background: rgba(99, 102, 241, 0.15);
  color: #e0e7ff;
  padding: 0.625rem 0.875rem;
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-left: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.dd-msg-assistant {
  align-self: flex-start;
  width: 100%;
  background: transparent;
  color: #cbd5e1;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  line-height: 1.75;
}

/* assistant 내부 마크다운 스타일 */
.dd-msg-assistant h1,
.dd-msg-assistant h2,
.dd-msg-assistant h3,
.dd-msg-assistant h4 {
  color: #f1f5f9;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.dd-msg-assistant h1 { font-size: 1.1rem; border-bottom: 1px solid #334155; padding-bottom: 0.375rem; }
.dd-msg-assistant h2 { font-size: 1rem; }
.dd-msg-assistant h3 { font-size: 0.9rem; color: #a5b4fc; }
.dd-msg-assistant h4 { font-size: 0.875rem; color: #94a3b8; }

.dd-msg-assistant p {
  margin-bottom: 0.75rem;
  color: #cbd5e1;
}
.dd-msg-assistant p:last-child { margin-bottom: 0; }

.dd-msg-assistant ul,
.dd-msg-assistant ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.dd-msg-assistant ul { list-style-type: disc; }
.dd-msg-assistant ol { list-style-type: decimal; }
.dd-msg-assistant li {
  margin-bottom: 0.3rem;
  color: #cbd5e1;
  line-height: 1.65;
}
.dd-msg-assistant li > ul,
.dd-msg-assistant li > ol {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.dd-msg-assistant strong { color: #f1f5f9; font-weight: 600; }
.dd-msg-assistant em { color: #a5b4fc; font-style: italic; }

.dd-msg-assistant blockquote {
  border-left: 3px solid #4f46e5;
  padding-left: 1rem;
  margin: 0.75rem 0;
  color: #94a3b8;
  font-style: italic;
}

.dd-msg-assistant code {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
  font-size: 0.8rem;
  color: #93c5fd;
  font-family: ui-monospace, monospace;
}
.dd-msg-assistant pre {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}
.dd-msg-assistant pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.8rem;
}

.dd-msg-assistant table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8rem;
}
.dd-msg-assistant th {
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border: 1px solid #334155;
  text-align: left;
}
.dd-msg-assistant td {
  padding: 0.35rem 0.75rem;
  border: 1px solid #1e293b;
  color: #cbd5e1;
}
.dd-msg-assistant tr:nth-child(even) td { background: rgba(255,255,255,0.03); }

.dd-msg-assistant hr {
  border: none;
  border-top: 1px solid #1e293b;
  margin: 1rem 0;
}

html[data-theme="light"] .dd-msg-user {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #c7d2fe;
}
html[data-theme="light"] .dd-msg-assistant { color: #334155; }
html[data-theme="light"] .dd-msg-assistant h1,
html[data-theme="light"] .dd-msg-assistant h2,
html[data-theme="light"] .dd-msg-assistant h3 { color: #1e293b; }
html[data-theme="light"] .dd-msg-assistant p,
html[data-theme="light"] .dd-msg-assistant li { color: #475569; }
html[data-theme="light"] .dd-msg-assistant strong { color: #1e293b; }
html[data-theme="light"] .dd-msg-assistant code { background: #f1f5f9; color: #4f46e5; }
html[data-theme="light"] .dd-msg-assistant pre { background: #f8fafc; border-color: #e2e8f0; }
html[data-theme="light"] .dd-msg-assistant th { background: #f1f5f9; color: #1e293b; }
html[data-theme="light"] .dd-msg-assistant td { border-color: #e2e8f0; color: #475569; }

/* ── 메트릭 카드 ── */
.metric-cards-wrap { margin: 20px 0; }
.metric-card { transition: box-shadow 0.15s ease; }
.metric-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
@media (max-width: 640px) {
  .metric-cards-wrap .metric-card { min-width: calc(50% - 8px) !important; max-width: 100% !important; }
}
@media (max-width: 400px) {
  .metric-cards-wrap .metric-card { min-width: 100% !important; max-width: 100% !important; }
}


/* ── 채팅 진행 상태 패널 ── */
.chat-status-panel {
  background: linear-gradient(135deg, rgba(49,46,129,0.22) 0%, rgba(67,56,202,0.12) 100%);
  border-top: 1px solid rgba(99,102,241,0.22);
  backdrop-filter: blur(8px);
}
.chat-status-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(99,102,241,0.25);
  border-top-color: #818cf8;
  animation: spin 0.75s linear infinite;
}
.chat-status-current { font-size: 0.8125rem; color: #c7d2fe; font-weight: 450; }
.chat-status-step-time { font-size: 0.7rem; color: rgba(165,180,252,0.5); flex-shrink: 0; }
.chat-status-total { font-size: 0.7rem; color: rgba(129,140,248,0.55); flex-shrink: 0; }
html[data-theme="light"] .chat-status-panel {
  background: linear-gradient(135deg, rgba(238,242,255,0.95) 0%, rgba(224,231,255,0.9) 100%);
  border-top-color: rgba(99,102,241,0.18);
}
html[data-theme="light"] .chat-status-spinner { border-color: rgba(99,102,241,0.2); border-top-color: #6366f1; }
html[data-theme="light"] .chat-status-current { color: #3730a3; }
html[data-theme="light"] .chat-status-step-time { color: rgba(79,70,229,0.45); }
html[data-theme="light"] .chat-status-total { color: rgba(79,70,229,0.5); }

/* ── 딥다이브 제안 카드 ─────────────────────────────────────────────── */
.dd-suggest-card {
  margin-top: 0.75rem;
  padding: 1rem 1.125rem;
  border-radius: 10px;
  border: 1px solid rgba(99,102,241,0.3);
  background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(139,92,246,0.06) 100%);
}
.dd-suggest-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: #a5b4fc;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.625rem;
}
.dd-suggest-body { display: flex; flex-direction: column; gap: 0.5rem; }
.dd-suggest-meta { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.25rem; }
.dd-suggest-row { display: flex; align-items: baseline; gap: 0.5rem; }
.dd-suggest-label { display: block; font-size: 0.75rem; color: rgba(165,180,252,0.6); margin-bottom: 0.2rem; }
.dd-suggest-value { font-size: 0.875rem; color: var(--t1); font-weight: 500; }
.dd-suggest-title-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  color: var(--t1);
  font-size: 0.875rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.dd-suggest-title-input:focus { border-color: rgba(99,102,241,0.7); background: rgba(255,255,255,0.09); }
html[data-theme="light"] .dd-suggest-title-input {
  background: rgba(255,255,255,0.8);
  border-color: rgba(99,102,241,0.25);
  color: #1e1b4b;
}
html[data-theme="light"] .dd-suggest-title-input:focus { border-color: #6366f1; background: #fff; }
.dd-suggest-actions { display: flex; gap: 0.625rem; margin-top: 0.25rem; }
.dd-suggest-btn-make {
  flex: 1;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1px solid rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.2);
  color: #c7d2fe;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dd-suggest-btn-make:hover { background: rgba(99,102,241,0.35); border-color: rgba(99,102,241,0.75); }
.dd-suggest-btn-cancel {
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--t3);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.dd-suggest-btn-cancel:hover { background: rgba(255,255,255,0.06); }
html[data-theme="light"] .dd-suggest-card {
  border-color: rgba(99,102,241,0.2);
  background: linear-gradient(135deg, rgba(238,242,255,0.9) 0%, rgba(224,231,255,0.7) 100%);
}
html[data-theme="light"] .dd-suggest-header { color: #6366f1; }
html[data-theme="light"] .dd-suggest-label { color: rgba(79,70,229,0.55); }
html[data-theme="light"] .dd-suggest-value { color: #1e1b4b; }
html[data-theme="light"] .dd-suggest-btn-make {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.12);
  color: #4338ca;
}
html[data-theme="light"] .dd-suggest-btn-make:hover { background: rgba(99,102,241,0.22); }
html[data-theme="light"] .dd-suggest-btn-cancel { border-color: rgba(0,0,0,0.12); color: #6b7280; }
html[data-theme="light"] .dd-suggest-btn-cancel:hover { background: rgba(0,0,0,0.04); }
.dd-suggest-notice {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: rgba(165,180,252,0.7);
  animation: dd-notice-fade 3s ease forwards;
}
html[data-theme="light"] .dd-suggest-notice { color: rgba(79,70,229,0.55); }
@keyframes dd-notice-fade {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── PDS(Code Agent) 홈 배지 ─ 다크/라이트 양쪽 가독성 보장 ── */
.pds-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}
/* dark theme (default) — 부드러운 lighter shade */
.pds-badge-critical { background: rgba(239, 68, 68, 0.20); color: #fca5a5; }
.pds-badge-warn     { background: rgba(245, 158, 11, 0.20); color: #fcd34d; }
.pds-badge-info     { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }
.pds-badge-resolved { background: rgba(16, 185, 129, 0.18); color: #86efac; }
.pds-badge-user     { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }
.pds-badge-fw       { background: rgba(168, 85, 247, 0.20); color: #d8b4fe; }
.pds-badge-method   { background: rgba(59, 130, 246, 0.20); color: #93c5fd; }
.pds-badge-page     { background: rgba(139, 92, 246, 0.20); color: #c4b5fd; font-weight: 600; }
.pds-badge-api      { background: rgba(249, 115, 22, 0.20); color: #fdba74; font-weight: 600; }
.pds-badge-service  { background: rgba(20, 184, 166, 0.20); color: #5eead4; }
.pds-badge-db       { background: rgba(99, 102, 241, 0.20); color: #a5b4fc; font-family: ui-monospace, monospace; }
.pds-badge-op       { background: var(--bg-elev); color: var(--t3); font-family: ui-monospace, monospace; text-transform: uppercase; }
.pds-badge-device   { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }

/* light theme — 진한 글씨 + 옅은 배경으로 대비 확보 */
html[data-theme="light"] .pds-badge-critical { background: #fee2e2; color: #b91c1c; }
html[data-theme="light"] .pds-badge-warn     { background: #fef3c7; color: #b45309; }
html[data-theme="light"] .pds-badge-info     { background: #e0e7ff; color: #4338ca; }
html[data-theme="light"] .pds-badge-resolved { background: #d1fae5; color: #047857; }
html[data-theme="light"] .pds-badge-user     { background: #e0e7ff; color: #4338ca; }
html[data-theme="light"] .pds-badge-fw       { background: #f3e8ff; color: #7e22ce; }
html[data-theme="light"] .pds-badge-method   { background: #dbeafe; color: #1d4ed8; }
html[data-theme="light"] .pds-badge-page     { background: #ede9fe; color: #6d28d9; }
html[data-theme="light"] .pds-badge-api      { background: #ffedd5; color: #c2410c; }
html[data-theme="light"] .pds-badge-service  { background: #ccfbf1; color: #0f766e; }
html[data-theme="light"] .pds-badge-db       { background: #e0e7ff; color: #4338ca; }
html[data-theme="light"] .pds-badge-device   { background: #e0e7ff; color: #4338ca; }

/* ── 공용 스키마 편집 모달 — host(client) 가 dark 테마여도 모달 내부는 light 강제 ── */
/* admin 페이지는 항상 light 라 영향 없음 */
.schema-modal-light {
  color: #0f172a;            /* slate-900 */
}
.schema-modal-light * {
  color: inherit;
}
.schema-modal-light input,
.schema-modal-light textarea,
.schema-modal-light select {
  color: #0f172a !important;
  background-color: #ffffff;
}
.schema-modal-light input::placeholder,
.schema-modal-light textarea::placeholder {
  color: #9ca3af !important; /* gray-400 */
  opacity: 1;
}
.schema-modal-light input:disabled,
.schema-modal-light textarea:disabled,
.schema-modal-light select:disabled {
  background-color: #f3f4f6;
  color: #6b7280 !important;
}
/* 색상 가진 input (타입 셀의 emerald/violet/sky 등) 은 자체 색 유지 */
.schema-modal-light input.text-emerald-700,
.schema-modal-light input.text-indigo-700,
.schema-modal-light input.text-violet-700,
.schema-modal-light input.text-amber-700,
.schema-modal-light input.text-sky-700,
.schema-modal-light input.text-purple-700,
.schema-modal-light input.text-slate-700 {
  color: revert !important;
}
