/* VibeCrew chat surface styles split from app.css. */

/* ==== Chat Header ==== */
.chat-header {
  padding: 14px 20px; border-bottom: 1px solid var(--vc-line);
  display: flex; align-items: center; gap: 12px;
  background: var(--vc-bg); flex-shrink: 0;
}

/* chat 메시지 아바타 — 28px 원형 */
.chat-msg.assistant .avatar, .chat-msg.user .avatar { width: 28px; height: 28px; font-size: var(--vc-fs-xs); }

/* ==== Chat ==== */
.chat-wrap {
  display: flex; flex-direction: column;
  flex: 1 1 auto; height: auto; min-height: 0;
  max-width: 100%; width: 100%; margin: 0 auto;
  position: relative;
  min-width: 0;
  overflow-x: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-history {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 4px 16px;
  background: transparent; scrollbar-gutter: stable;
  min-width: 0;
  min-height: 0;   /* flex 스크롤 컨테이너 정석 — min-height:auto(기본)면 긴 콘텐츠가
     컨테이너를 부풀려 입력창을 밀어냄. 0 으로 콘텐츠보다 작아질 수 있게 →
     긴 답변(시크 tool call 등)이 와도 입력창이 아래로 안 밀리고 history 가 스크롤됨. (보비 2026-05-31) */
  overscroll-behavior: none;             /* 스크롤 끝 body 전파 차단 — 무해, 유지 */
  -webkit-overflow-scrolling: touch;     /* iOS 관성(모멘텀) 스크롤 복원 (보비 2026-05-31).
     #486 이 '풍선 바운스' 잡겠다고 이 줄을 제거했으나, 진범은 #488(복사버튼 2px 삐짐)이었음.
     제거는 관성 스크롤만 죽이는 부작용이라 복원. 풍선 바운스 차단은 #488 이 담당. */
}
.chat-history::-webkit-scrollbar { width: 6px; }
.chat-history::-webkit-scrollbar-track { background: transparent; }
.chat-history::-webkit-scrollbar-thumb { background: var(--vc-white-08); border-radius: 3px; }
.chat-history:hover::-webkit-scrollbar-thumb { background: var(--vc-white-30); }
.chat-history { scrollbar-width: thin; scrollbar-color: var(--vc-white-08) transparent; }
.chat-history:hover { scrollbar-color: var(--vc-white-30) transparent; }

/* 가운데 반투명 (클로드 앱 스타일) — 우측 고정 대신 하단 중앙, blur 반투명 */
.scroll-bottom-btn {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px;
  width: 36px; height: 36px; border-radius: var(--vc-r-pill);
  background: var(--vc-surface-98); color: var(--vc-text); border: 1px solid var(--vc-line-2); cursor: pointer;
  display: none; align-items: center; justify-content: center;
  box-shadow: var(--vc-elev-2); z-index: 50;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: opacity var(--vc-fast), transform var(--vc-fast), background var(--vc-fast);
}
.scroll-bottom-btn:hover { transform: translateX(-50%) translateY(-2px); background: var(--vc-surface-3); }
.scroll-bottom-btn.show { display: flex; }
.scroll-bottom-btn svg { width: 18px; height: 18px; }

/* ==== 채팅 메시지 (msg / chat-msg) ==== */
.msg { display: flex; gap: 10px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: linear-gradient(180deg, var(--vc-blue), var(--vc-blue-h));
  color: var(--vc-on-accent); padding: 10px 14px;
  border-radius: 18px 18px 4px 18px;
  max-width: 72%; font-size: var(--vc-fs-md); line-height: 1.5;
}
.msg.ai .bubble {
  background: var(--vc-surface);
  border: 1px solid var(--vc-line);
  color: var(--vc-text); padding: 10px 14px;
  border-radius: 4px 18px 18px 18px;
  max-width: 72%; font-size: var(--vc-fs-md); line-height: 1.5;
}
.msg-meta { font-size: var(--vc-fs-xs); color: var(--vc-muted); margin-bottom: 4px; }

.chat-msg {
  margin-bottom: 8px; font-size: var(--vc-fs-md); line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  display: flex; flex-direction: column; position: relative;
  min-width: 0; max-width: 100%;
}
/* user 메시지: 우측 정렬 */
.chat-msg.user { align-items: flex-end; }
.chat-msg.user > .body, .chat-msg.user .chat-msg-bubble-body > .body {
  background: linear-gradient(180deg, var(--vc-blue), var(--vc-blue-h));
  color: var(--vc-on-accent);
  padding: 8px 12px;
  border-radius: 18px 18px 4px 18px;
  width: max-content;
  /* 보비 (2026-05-23): 75% → 90%. 우측 플릿 패널 열렸을 때 채팅창 좁아져서
   * 75% 가 너무 작아 한 어절도 못 들어가고 강제 줄바꿈 발생. 90% 로 늘림. */
  max-width: 90%;
  min-width: 0;
  /* 한국어 어절 단위 유지 (짧은 문장 강제 줄바꿈 방지). 긴 영문/URL 은 break-word 폴백 */
  word-break: keep-all;
  overflow-wrap: break-word;
  box-shadow: 0 2px 8px var(--vc-blue-25);
}
/* assistant 메시지: 좌측 정렬, surface 버블 */
.chat-msg.assistant { align-items: flex-start; }
.chat-msg.assistant > .body, .chat-msg.assistant .chat-msg-bubble-body > .body {
  background: var(--vc-surface);
  border: 1px solid var(--vc-line);
  color: var(--vc-text);
  padding: var(--vc-s-3) var(--vc-s-4);
  border-radius: var(--vc-r-2) var(--vc-r-5) var(--vc-r-5) var(--vc-r-5);
  max-width: 90%;
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.chat-msg.assistant.long-response {
  width: 100%;
}
.chat-msg.assistant.long-response .chat-msg-bubble-row {
  width: 100%;
}
.chat-msg.assistant.long-response .chat-msg-bubble-body {
  max-width: min(100%, 86ch);
}
.chat-msg.assistant.long-response .chat-msg-bubble-body > .body {
  width: 100%;
  max-width: 100%;
  line-height: 1.72;
  padding: var(--vc-s-4) var(--vc-s-5);
  border-radius: var(--vc-r-4);
  box-shadow: var(--vc-elev-1);
}
.chat-msg.system { align-items: center; font-size: var(--vc-fs-xs); color: var(--vc-amber); }
.chat-msg.system > .body { background: none; border: none; padding: 0; }
.chat-msg[data-crew-priority="high"] > .body {
  border-color: var(--vc-amber-50);
  box-shadow: 0 0 0 1px var(--vc-amber-10);
}
/* 메시지 헤더: 워커 이름 + 시간 */
.chat-msg .ts, .chat-msg .ts-row {
  font-size: 11px; color: var(--vc-muted);
  margin-bottom: 2px; padding: 0 2px;
  display: flex; align-items: center; gap: 6px;
}
.chat-msg.forwarded {
  align-items: center; opacity: 0.65;
  max-width: 90%; margin-left: auto; margin-right: auto;
}
.chat-msg.forwarded > .body {
  background: var(--vc-white-03);
  border: 1px dashed var(--vc-line-2);
  padding: 8px 12px; border-radius: var(--vc-r-3);
  font-size: var(--vc-fs-sm); color: var(--vc-text-2); max-width: 100%;
}
.chat-msg.forwarded .ts-row { justify-content: center; font-style: italic; }
.chat-msg.forwarded .forward-icon { display: inline-block; transform: rotate(90deg); font-size: var(--vc-fs-sm); }

.crew-msg-tags {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin: 2px 0 4px; max-width: 90%;
}
.chat-msg.user .crew-msg-tags { justify-content: flex-end; }
.crew-msg-tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  border-radius: var(--vc-r-pill); border: 1px solid var(--vc-line);
  background: var(--vc-white-04); color: var(--vc-muted);
  font-size: 10px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.crew-msg-tag.priority-high,
.crew-msg-tag.blocked,
.crew-msg-tag.attention {
  background: var(--vc-amber-10); border-color: var(--vc-amber-50); color: var(--vc-amber);
}
.crew-msg-tag.handoff,
.crew-msg-tag.task,
.crew-msg-tag.mention {
  background: var(--vc-blue-10); border-color: var(--vc-blue-30); color: var(--vc-blue-2);
}
.crew-msg-tag.pr { background: var(--vc-purple-15); border-color: var(--vc-purple-30); color: var(--vc-purple-2); }
.crew-msg-tag.done { background: var(--vc-green-10); border-color: var(--vc-green-40); color: var(--vc-green-2); }
.crew-msg-tag.noise { background: var(--vc-white-03); border-color: var(--vc-line); color: var(--vc-muted); }
.crew-msg-tag.request { background: var(--vc-white-06); border-color: var(--vc-blue-20); color: var(--vc-text-2); }
.crew-msg-tag.task-id,
.crew-msg-tag.mention-count { font-family: var(--vc-mono); font-size: 9.5px; }

/* 버블 row: 아바타 + body 가로 배치 */
.chat-msg-bubble-row {
  display: flex; align-items: flex-start; gap: 8px;
  min-width: 0; max-width: 100%;
}
/* user 버블 row: body 먼저, 아바타 우측 */
.chat-msg-bubble-row.user-bubble-row {
  justify-content: flex-end;
}
.chat-msg-bubble-row.user-bubble-row .chat-msg-bubble-body {
  align-items: flex-end;
}
.chat-msg-bubble-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-msg .body pre,
.chat-msg .body code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.chat-msg .body table { display: block; max-width: 100%; overflow-x: auto; }
/* user bubble-body: 우측 정렬 */
.chat-msg.user .chat-msg-bubble-body { align-items: flex-end; }
/* user ts-row: 우측 정렬 */
.chat-msg.user .ts-row { justify-content: flex-end; }
/* split-attach 이미지 박스 — user/assistant bubble 배경·그림자·padding 무효화. 이미지만 깔끔하게. */
.chat-msg.chat-msg-attach > .body,
.chat-msg.chat-msg-attach .chat-msg-bubble-body > .body {
  background: none;
  box-shadow: none;
  padding: 0;
  border: none;
  width: auto;
  max-width: 100%;
}

/* Worker Card 아바타 링 상태 */
.avatar.xl.state-busy { box-shadow: 0 0 0 2px var(--vc-amber); animation: ring-pulse 1.4s infinite; }
.avatar.xl.state-unread { box-shadow: 0 0 0 2px var(--vc-blue); }
@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--vc-amber); }
  50% { box-shadow: 0 0 0 4px var(--vc-amber-45); }
}

/* ==== SSE Streaming / Tool Calls ==== */
.tool-call-box {
  background: transparent;
  border: none;
  padding: 0;
  margin: 4px 0; font-size: var(--vc-fs-sm);
}
.tool-call-box.pending { opacity: 0.75; }
.tool-call-box > summary { list-style: none; cursor: pointer; user-select: none; }
.tool-call-box > summary::-webkit-details-marker { display: none; }
.tool-call-box > summary::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--vc-fast); color: var(--vc-muted);
}
.tool-call-box[open] > summary::before { transform: rotate(45deg); }
.tool-call-name { color: var(--vc-muted); font-weight: 500; font-family: var(--vc-mono); font-size: var(--vc-fs-xs); display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.tool-call-desc { color: var(--vc-text-2); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 400; max-width: 50ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-call-status { color: var(--vc-muted); font-size: var(--vc-fs-xs); font-weight: 400; margin-left: 8px; opacity: 0.7; flex-shrink: 0; }
.tool-call-input { color: var(--vc-muted); font-size: var(--vc-fs-xs); margin: 4px 0 0 18px; max-height: 80px; overflow: hidden; font-family: var(--vc-mono); white-space: pre-wrap; word-break: break-all; opacity: 0.8; }
.tool-call-result { margin: 4px 0 0 18px; padding: 0; font-family: var(--vc-mono); font-size: var(--vc-fs-xs); color: var(--vc-text-2); max-height: 120px; overflow: auto; white-space: pre-wrap; opacity: 0.8; }
.tool-call-result.error { color: var(--vc-red-2); opacity: 1; }
/* 도구 호출 2개 이상이면 묶음 details — 클로드 앱 스타일. summary 한 줄, 펼치면 개별 항목 */
.tool-call-group { margin: 4px 0; }
.tool-call-group > .tool-call-group-summary {
  list-style: none; cursor: pointer; user-select: none;
  color: var(--vc-muted); font-family: var(--vc-mono); font-size: var(--vc-fs-xs);
}
.tool-call-group > .tool-call-group-summary::-webkit-details-marker { display: none; }
.tool-call-group > .tool-call-group-summary::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--vc-fast);
}
.tool-call-group[open] > .tool-call-group-summary::before { transform: rotate(45deg); }
.tool-call-group-counts { opacity: 0.7; margin-left: 4px; }
.tool-call-group > .tool-call-box { margin-left: 14px; }
.usage-row { font-size: var(--vc-fs-xs); color: var(--vc-muted); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.work-duration-row {
  color: var(--vc-muted);
  font-size: var(--vc-fs-xs);
  margin-top: var(--vc-s-1);
  display: flex;
  gap: var(--vc-s-2);
  align-items: center;
}
/* 응답 생성 중 + 시간 한 줄로 (단순 inline-flex, streaming-line 래퍼 없이) */
.streaming-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--vc-muted); font-size: var(--vc-fs-xs); margin-top: 4px; }
.streaming-indicator .stream-elapsed { font-size: 11px; opacity: 0.8; margin-left: 4px; }
.streaming-indicator .stream-elapsed:not(:empty)::before { content: '· '; opacity: 0.6; margin-right: 2px; }

.msg-copy {
  position: absolute; bottom: 2px; right: 2px;
  background: none; border: 1px solid transparent; color: var(--vc-muted);
  padding: 1px 6px; border-radius: var(--vc-r-1); cursor: pointer;
  font-size: var(--vc-fs-xs); opacity: 0;
  transition: opacity var(--vc-fast), background var(--vc-fast); line-height: 1; min-height: auto;
}
.chat-msg:hover > .msg-copy { opacity: 0.7; }
.msg-copy:hover { opacity: 1 !important; background: var(--vc-white-06); border-color: var(--vc-line-2); color: var(--vc-text); }
.chat-msg.user > .msg-copy { right: auto; left: 2px; }

/* 마지막 user 메시지 hover 액션 */
.msg-user-actions {
  position: absolute; top: -10px; right: 8px;
  display: flex; gap: 4px; opacity: 0;
  transition: opacity var(--vc-fast); pointer-events: none;
}
.chat-msg.user:hover > .msg-user-actions { opacity: 1; pointer-events: auto; }
.msg-user-actions button {
  background: var(--vc-surface); border: 1px solid var(--vc-line-2); color: var(--vc-text);
  width: 26px; height: 26px; border-radius: var(--vc-r-pill); cursor: pointer;
  font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--vc-elev-1); padding: 0;
}
.msg-user-actions button svg { width: 13px; height: 13px; }
.msg-user-actions button:hover { background: var(--vc-blue); color: var(--vc-on-accent); border-color: var(--vc-blue); }

/* 날짜 구분선 */
.date-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 12px; padding: 0 4px;
}
.date-divider::before, .date-divider::after { content: ''; flex: 1; height: 1px; background: var(--vc-line); }
.date-divider span {
  font-size: 11px; color: var(--vc-muted); padding: 3px 12px;
  background: var(--vc-white-04); border-radius: var(--vc-r-pill); white-space: nowrap;
}

/* ==== Chat Input Area ==== */
.chat-input-area-wrapper {
  padding: 12px 16px;
  border-top: 1px solid var(--vc-line);
  background: var(--vc-bg);
}
.chat-input-shell {
  display: flex; flex-direction: column;
  flex-shrink: 0;   /* 입력창은 절대 찌그러지지 않음 — 긴 답변이 와도 항상 맨 아래 고정. (보비 2026-05-31) */
  background: var(--vc-surface);
  border: 1px solid var(--vc-line-2);
  border-radius: 14px;
  padding: 12px;
  transition: border-color var(--vc-fast), box-shadow var(--vc-fast);
  min-width: 0;
}
.chat-input-shell:focus-within {
  border-color: var(--vc-blue-50);
  box-shadow: 0 0 0 3px var(--vc-blue-08);
}
.chat-input-shell.is-loading { opacity: 0.7; }
.chat-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--vc-text); font-size: var(--vc-fs-md); resize: none;
  max-height: 120px; line-height: 1.5;
}
.chat-input::placeholder { color: var(--vc-muted); }
.chat-input-area::placeholder { color: var(--vc-muted); }
.chat-input-area {
  width: 100%; min-height: 64px; max-height: 240px;
  background: transparent; border: none; outline: none; resize: none;
  color: var(--vc-text); font-size: var(--vc-fs-md); line-height: 1.5;
  font-family: inherit; padding: 2px 0;
}
.chat-input-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px; padding-top: 6px; flex-wrap: wrap;
}
.chat-attachments {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid var(--vc-white-06);
}
.chat-attach-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  background: var(--vc-blue-10); border: 1px solid var(--vc-blue-20);
  border-radius: var(--vc-r-3); font-size: var(--vc-fs-xs); color: var(--vc-text); position: relative;
}
.chat-attach-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
.chat-attach-chip .x {
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--vc-black-35); color: var(--vc-on-accent); font-size: 14px; line-height: 1;
  font-weight: bold; user-select: none; transition: background var(--vc-fast);
}
.chat-attach-chip .x:hover { background: var(--vc-red); }
.chat-target-wrap { display: flex; align-items: center; gap: 6px; }
.chat-target-label { font-size: var(--vc-fs-xs); color: var(--vc-muted); }
.chat-target-select {
  padding: 3px 8px; background: transparent;
  border: 1px solid var(--vc-line-2); border-radius: var(--vc-r-1);
  color: var(--vc-text); font-size: var(--vc-fs-xs); outline: none; cursor: pointer;
}
.chat-target-select:hover { border-color: var(--vc-blue); }
.chat-send-icon {
  width: 36px; height: 36px; padding: 0;
  background: linear-gradient(135deg, var(--vc-blue), var(--vc-purple));
  border: none; border-radius: 50%; color: var(--vc-on-accent);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity var(--vc-fast), transform var(--vc-fast);
  box-shadow: 0 2px 8px var(--vc-blue-30);
}
.chat-send-icon:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.chat-send-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-send-icon.is-stop { background: var(--vc-red); }
.chat-send-icon.is-stop:hover { background: var(--vc-red-h); }
.chat-send-icon svg, .voice-btn svg { width: 16px; height: 16px; display: block; }

/* ==== Voice ==== */
.voice-btn {
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 1px solid var(--vc-line-2);
  border-radius: var(--vc-r-3); color: var(--vc-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--vc-fast);
}
.voice-btn:hover { color: var(--vc-text); border-color: var(--vc-blue); }
.voice-btn.active { color: var(--vc-on-accent); background: var(--vc-blue); border-color: var(--vc-blue); }
.voice-btn.recording { color: var(--vc-on-accent); background: var(--vc-red); border-color: var(--vc-red); animation: rec-pulse 1.2s infinite; }
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--vc-red-40); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
.chat-loading {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--vc-white-30); border-top-color: var(--vc-on-accent);
  border-radius: var(--vc-r-pill); animation: spin 0.8s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ================================================================
   Slash Command Picker
   ================================================================ */
.slash-picker {
  position: absolute; bottom: 100%; left: 0; right: 0;
  background: var(--vc-surface); border: 1px solid var(--vc-line-2);
  border-radius: var(--vc-r-4); overflow: hidden;
  box-shadow: var(--vc-elev-3); z-index: 100;
  display: none;
  margin-bottom: 4px;
}
.slash-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; width: 100%; background: none; border: none;
  text-align: left; cursor: pointer; color: var(--vc-text);
  transition: background var(--vc-fast);
  border-bottom: 1px solid var(--vc-line);
}
.slash-item:last-child { border-bottom: none; }
.slash-item:hover, .slash-item.active { background: var(--vc-blue-10); }
.slash-item-icon {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  background: var(--vc-surface); border: 1px solid var(--vc-line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--vc-text-2);
  font-family: var(--vc-mono);
}
.slash-item-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.slash-item-cmd { font-size: 12px; font-weight: 700; color: var(--vc-blue-2); font-family: var(--vc-mono); }
.slash-item-desc { font-size: 11px; color: var(--vc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Mobile chat overrides kept after the split so they still win over base chat rules. */
.chat-input-shell { margin-bottom: max(8px, env(safe-area-inset-bottom)); }
@media (max-width: 640px) {
  .chat-wrap { flex: 1; height: auto; min-height: 0; max-width: 100%; overflow-x: hidden; }
  .chat-history { padding: 12px 16px 8px; overflow-x: hidden; }
  .chat-msg, .body { max-width: 100%; overflow-x: hidden; word-break: break-word; }
  .chat-history table { display: block; overflow-x: auto; max-width: 100%; }
  .chat-msg.user > .body { max-width: 88%; }
  .chat-input-shell { padding: 8px 12px; margin: 0 8px 8px; }
  .chat-input-area { font-size: 16px; }
  .chat-send-icon { min-width: 44px; min-height: 44px; }
  /* 받는 워커 드롭다운: 폰트 16px(iOS 포커스 자동줌 차단) + 터치 44px. (보비 2026-06-02) */
  .chat-target-select { font-size: 16px; min-height: 44px; padding: 0 10px; }
  /* 복사버튼은 데스크탑에서 hover 로만 노출(opacity:0) — 터치 기기엔 hover 가 없어
     영구히 안 보이고 복사 불가. 모바일에선 상시 노출 + 터치 44px. (보비 2026-06-02) */
  .msg-copy {
    opacity: 0.6; position: static; display: inline-flex;
    align-items: center; min-height: 32px; padding: 4px 10px; margin-top: 2px;
  }
  .chat-msg.user > .msg-copy { left: auto; right: auto; }
}
@media (max-width: 400px) {
  .chat-input-footer { flex-direction: column; align-items: stretch; gap: 8px; }
  .chat-input-footer .chat-target-wrap { width: 100%; justify-content: space-between; }
}

/* ==== Phase 2: 실시간 툴 타임라인 관제 UI (Active Monitor) ==== */
.chat-main-container {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
}

.chat-main-container.assistant .chat-wrap {
  max-width: 100%;
}

.chat-main-container:not(.assistant) .chat-wrap {
  max-width: calc(100% - 340px);
}

.active-timeline-panel {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--vc-line);
  background: var(--vc-bg-2-40);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.timeline-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--vc-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--vc-bg-2-40);
  flex-shrink: 0;
}

.timeline-header h4 {
  margin: 0;
  font-size: var(--vc-fs-sm);
  font-weight: 600;
  color: var(--vc-text);
  letter-spacing: -0.01em;
}

/* 실시간 대기 펄스 닷 */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.pulse-dot.green {
  background: var(--vc-green);
  box-shadow: 0 0 0 0 var(--vc-green-70);
  animation: sse-pulse 1.8s infinite;
}

@keyframes sse-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 var(--vc-green-70);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px var(--vc-green-00);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 var(--vc-green-00);
  }
}

/* 대기 상태 뷰 */
.timeline-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.timeline-empty-icon {
  font-size: 32px;
  margin-bottom: 16px;
  animation: float-cup 3s ease-in-out infinite;
}

@keyframes float-cup {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.timeline-empty p {
  font-size: var(--vc-fs-sm);
  font-weight: 500;
  color: var(--vc-text-2);
  margin: 0 0 8px;
}

.timeline-empty small {
  font-size: var(--vc-fs-xs);
  color: var(--vc-muted);
  line-height: 1.4;
  max-width: 220px;
}

/* 리스트 및 카드 디자인 */
.timeline-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--vc-white-08) transparent;
}

.timeline-list::-webkit-scrollbar {
  width: 4px;
}
.timeline-list::-webkit-scrollbar-track {
  background: transparent;
}
.timeline-list::-webkit-scrollbar-thumb {
  background: var(--vc-white-08);
  border-radius: 2px;
}
.timeline-list:hover::-webkit-scrollbar-thumb {
  background: var(--vc-white-18);
}

/* 개별 카드 (Glassmorphism + micro-interaction) */
.timeline-card {
  background: var(--vc-white-02);
  border: 1px solid var(--vc-white-04);
  border-radius: var(--vc-r-3);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--vc-fast) var(--vc-ease);
  animation: timeline-fade-in 0.28s var(--vc-ease-out) forwards;
  opacity: 0;
  transform: translateY(8px);
}

@keyframes timeline-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.timeline-card:hover {
  background: var(--vc-white-04);
  border-color: var(--vc-white-08);
  box-shadow: var(--vc-elev-1);
}

/* 상태별 스타일링 */
.timeline-card.running {
  background: var(--vc-blue-03);
  border-color: var(--vc-blue-20a);
  animation: timeline-fade-in 0.28s var(--vc-ease-out) forwards, card-pulse 2s infinite ease-in-out;
}

@keyframes card-pulse {
  0%, 100% { border-color: var(--vc-blue-20a); box-shadow: 0 0 0 0 var(--vc-blue-05); }
  50% { border-color: var(--vc-blue-40); box-shadow: 0 0 8px 1px var(--vc-blue-15); }
}

.timeline-card.success {
  border-left: 3px solid var(--vc-green);
}

.timeline-card.failed {
  border-left: 3px solid var(--vc-red);
  background: var(--vc-red-03);
}

/* 카드 헤더 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* HSL 기반 세련된 도구 칩 */
.tool-chip {
  font-family: var(--vc-mono);
  font-size: var(--vc-fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--vc-r-1);
  letter-spacing: -0.01em;
}

.tool-chip.read {
  background: var(--vc-blue-12);
  color: var(--vc-blue-2);
  border: 1px solid var(--vc-blue-20a);
}

.tool-chip.edit {
  background: var(--vc-purple-12);
  color: var(--vc-purple-2);
  border: 1px solid var(--vc-purple-20);
}

.tool-chip.exec {
  background: var(--vc-amber-10);
  color: var(--vc-amber-2);
  border: 1px solid var(--vc-amber-15);
}

.card-duration {
  font-size: 11px;
  color: var(--vc-muted);
  font-weight: 500;
}

/* 카드 바디 (입출력 미리보기) */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-input, .card-output {
  font-family: var(--vc-mono);
  font-size: 11px;
  padding: 6px 8px;
  border-radius: var(--vc-r-1);
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.35;
}

.card-input {
  background: var(--vc-input);
  color: var(--vc-text-2);
  border: 1px solid var(--vc-white-02);
}

.card-output {
  background: var(--vc-black-20);
  color: var(--vc-muted);
  border: 1px solid var(--vc-black-10);
}

/* 카드 푸터 */
.card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.busy {
  background: var(--vc-amber);
  box-shadow: 0 0 0 0 var(--vc-amber-60);
  animation: dot-busy-pulse 1.4s infinite;
}

@keyframes dot-busy-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--vc-amber-60); }
  50% { transform: scale(1.2); box-shadow: 0 0 0 4px var(--vc-amber-00); }
}

.status-dot.ok {
  background: var(--vc-green);
}

.status-dot.fail {
  background: var(--vc-red);
}

.card-status-text {
  font-size: 11px;
  color: var(--vc-muted);
  font-weight: 500;
}

/* ==== 반응형 쿼리 ==== */
@media (max-width: 1024px) {
  .chat-main-container:not(.assistant) .chat-wrap {
    max-width: 100%;
  }
  .active-timeline-panel {
    display: none;
  }
}

/* ==== Phase 8: 실시간 관제 슬라이딩 접이식 토글 UI ==== */
.active-timeline-panel {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, border-left 0.3s ease;
}

/* 접힌 상태의 관제 패널 */
.active-timeline-panel.collapsed {
  width: 0px !important;
  opacity: 0;
  border-left: none !important;
  pointer-events: none;
}

/* 대화방 크기 확장 (접힌 상태 시) */
.chat-main-container.collapsed-timeline .chat-wrap {
  max-width: 100% !important;
}

/* 헤더 툴바 닫기 버튼 */
.timeline-header-close-btn {
  background: transparent;
  border: none;
  color: var(--vc-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.timeline-header-close-btn:hover {
  background: var(--vc-line-2);
  color: var(--vc-text);
}

/* 접혀있을 때 세로로 나타나는 플로팅 탭 버튼 (Steve Jobs Glassmorphism) */
.active-monitor-float-tab {
  position: absolute;
  right: 0;
  top: 120px;
  background: var(--vc-slate-60);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--vc-line-2);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 6px;
  color: var(--vc-green);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  box-shadow: -4px 4px 16px var(--vc-black-30);
  z-index: 100;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.active-monitor-float-tab:hover {
  background: var(--vc-slate-85);
  color: var(--vc-emerald);
  transform: translateX(-2px);
}

.active-monitor-float-tab svg {
  margin-bottom: 4px;
  transform: rotate(-90deg);
}

.active-monitor-float-tab .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vc-green);
  box-shadow: 0 0 0 0 var(--vc-emerald-60);
  animation: float-pulse 1.4s infinite;
}

@keyframes float-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--vc-emerald-60); }
  50% { box-shadow: 0 0 0 6px var(--vc-emerald-00); }
}
