/* ===== New Message Floating Button ===== */
.new-msg-floating {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
  transition: opacity 150ms ease;
  animation: floatingBounce 0.3s ease;
}

.new-msg-floating:hover {
  opacity: 0.9;
}

@keyframes floatingBounce {
  0% { transform: translateX(-50%) translateY(10px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ===== Agent Main Panel (직접 대화 모드) ===== */
.agent-main-panel {
  position: relative;
}

.agent-main-panel #agentMainCanvas {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}

/* 하나 부르기 버튼 */
.quick-cmd.cmd-hana-return {
  color: var(--accent-pink);
  border: 1.5px solid var(--accent-pink);
  background: var(--accent-pink-light);
  font-weight: 600;
  padding: 6px 16px;
}
.quick-cmd.cmd-hana-return:hover {
  background: var(--accent-pink);
  color: white;
}

/* ===== Chat Area ===== */
.chat-area {
  flex: 1;
  position: relative;
  min-height: 0;
}

.chat-messages {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ===== Chat Bubbles ===== */
.message {
  display: flex;
  gap: 8px;
  max-width: 70%;
  animation: messageIn 200ms ease-out;
}

.message.secretary { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  background: linear-gradient(180deg, #F8FAFF, #E8EDFF);
}

.message-avatar.hidden { visibility: hidden; }

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.bubble {
  padding: 12px 16px;
  border-radius: var(--radius-bubble);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  overflow: hidden;
}

.secretary .bubble {
  background: var(--bubble-secretary);
  border-top-left-radius: 4px;
}

.user .bubble {
  background: var(--bubble-user);
  border-top-right-radius: 4px;
}

/* ===== Markdown in Bubbles ===== */
.bubble.markdown-body p { margin: 0 0 8px; }
.bubble.markdown-body p:last-child { margin-bottom: 0; }
.bubble.markdown-body h1, .bubble.markdown-body h2, .bubble.markdown-body h3 {
  font-size: 15px; font-weight: 700; margin: 12px 0 4px;
}
.bubble.markdown-body h1 { font-size: 17px; }
.bubble.markdown-body ul, .bubble.markdown-body ol {
  margin: 4px 0; padding-left: 20px;
}
.bubble.markdown-body li { margin: 2px 0; }
.bubble.markdown-body code {
  background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px;
}
.bubble.markdown-body pre {
  background: #1E1E2E; color: #CDD6F4; padding: 12px; border-radius: 8px;
  overflow-x: auto; margin: 8px 0; font-size: 13px; line-height: 1.4;
}
.bubble.markdown-body pre code {
  background: none; padding: 0; color: inherit;
}
.bubble.markdown-body blockquote {
  border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 12px;
  color: var(--text-secondary);
}
.bubble.markdown-body a { color: var(--accent); text-decoration: underline; }
a.wikilink {
  color: var(--accent-pink);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-pink);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
a.wikilink:hover { opacity: 0.7; }
.bubble.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 4px 0;
}
.bubble.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.bubble.markdown-body strong { font-weight: 600; }
.bubble.markdown-body table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; max-width: 100%; }
.bubble.markdown-body th, .bubble.markdown-body td {
  border: 1px solid var(--border); padding: 4px 8px;
}
.bubble.markdown-body th { background: var(--bg-hover); font-weight: 600; }

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

.secretary .message-time { text-align: left; }
.user .message-time { text-align: right; }

/* ===== Agent Bubbles ===== */
.message.agent { align-self: flex-start; }

.message.agent .message-avatar {
  width: 28px;
  height: 28px;
}

.agent-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  padding: 0 2px;
}

.hana-name { color: var(--primary); }
.agent-sori .agent-name { color: var(--agent-sori-name); }
.agent-seoyeon .agent-name { color: var(--agent-seoyeon-name); }
.agent-jihyun .agent-name { color: var(--agent-jihyun-name); }

.agent-sori .bubble { background: var(--agent-sori-bubble); border-top-left-radius: 4px; }
.agent-seoyeon .bubble { background: var(--agent-seoyeon-bubble); border-top-left-radius: 4px; }
.agent-jihyun .bubble { background: var(--agent-jihyun-bubble); border-top-left-radius: 4px; }

.message.agent .message-time { text-align: left; }

/* ===== Delegation Message ===== */
.message.delegation .delegation-bubble {
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  animation: delegationIn 300ms ease-out;
}

@keyframes delegationIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* History divider */
.history-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.history-divider::before,
.history-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: 0.5;
}

/* Agent typing indicator */
.typing-indicator.agent-typing .typing-bubble {
  gap: 6px;
}
.typing-indicator .typing-agent-label {
  font-size: 12px;
  font-weight: 500;
  margin-right: 4px;
}
.typing-indicator .typing-agent-label.sori { color: var(--agent-sori-name); }
.typing-indicator .typing-agent-label.seoyeon { color: var(--agent-seoyeon-name); }
.typing-indicator .typing-agent-label.jihyun { color: var(--agent-jihyun-name); }

/* ===== Typing Indicator ===== */
.typing-indicator {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  padding-left: 40px;
}

.typing-bubble {
  background: var(--bubble-secretary);
  padding: 12px 16px;
  border-radius: var(--radius-bubble);
  border-top-left-radius: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.typing-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 6px;
  white-space: nowrap;
  animation: fadeIn 200ms ease;
}

/* ===== Sidecar Model Loading Banner ===== */
.sidecar-loading-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary, #1e1e2e);
  border-top: 1px solid var(--border, #313244);
  font-size: 13px;
  color: var(--text-secondary, #a6adc8);
  animation: fadeIn 200ms ease;
}

.sidecar-loading-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.sidecar-loading-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Action Buttons ===== */
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.action-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 150ms ease;
}

.action-btn:hover {
  background: var(--accent-pink-light);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Quick Commands ===== */
.quick-commands {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px 10px;
  flex-shrink: 0;
}

.quick-cmd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  min-height: 30px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-sidebar);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.quick-cmd:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.quick-cmd.cmd-sori {
  color: var(--agent-sori-name);
  border: 1px solid color-mix(in srgb, var(--agent-sori-name) 25%, transparent);
}
.quick-cmd.cmd-sori:hover {
  background: var(--agent-sori-bubble);
  color: var(--agent-sori-name);
}

.quick-cmd.cmd-seoyeon {
  color: var(--agent-seoyeon-name);
  border: 1px solid color-mix(in srgb, var(--agent-seoyeon-name) 25%, transparent);
}
.quick-cmd.cmd-seoyeon:hover {
  background: var(--agent-seoyeon-bubble);
  color: var(--agent-seoyeon-name);
}

.quick-cmd.cmd-jihyun {
  color: var(--agent-jihyun-name);
  border: 1px solid color-mix(in srgb, var(--agent-jihyun-name) 25%, transparent);
}
.quick-cmd.cmd-jihyun:hover {
  background: var(--agent-jihyun-bubble);
  color: var(--agent-jihyun-name);
}

.quick-cmd.cmd-all-appear {
  color: var(--accent-pink);
  border: 1px solid color-mix(in srgb, var(--accent-pink) 25%, transparent);
}
.quick-cmd.cmd-all-appear:hover {
  background: var(--accent-pink-light);
  color: var(--accent-pink);
}
.quick-cmd.cmd-all-appear.active {
  background: var(--accent-pink);
  color: #fff;
  border-color: var(--accent-pink);
}
.quick-cmd.cmd-standby {
  color: var(--accent-pink);
  border: 1px solid color-mix(in srgb, var(--accent-pink) 25%, transparent);
}
.quick-cmd.cmd-standby:hover {
  background: var(--accent-pink-light);
  color: var(--accent-pink);
}

/* ===== Command Autocomplete Popup ===== */
.cmd-autocomplete {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
  z-index: 200;
  scrollbar-width: thin;
}

.cmd-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 80ms ease;
  font-size: 13px;
}

.cmd-ac-item:hover,
.cmd-ac-item.selected {
  background: var(--accent-pink-light, rgba(255, 107, 138, 0.08));
}

.cmd-ac-command {
  font-weight: 600;
  color: var(--accent-pink);
  white-space: nowrap;
  width: 110px;
  flex-shrink: 0;
}

.cmd-ac-alias {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  width: 90px;
  flex-shrink: 0;
}

.cmd-ac-desc {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: right;
}

/* 롱프레스 툴팁 */
.cmd-ac-tooltip {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 4px);
  background: var(--bg-secondary, #1e1e2e);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
  z-index: 210;
  pointer-events: none;
  word-break: keep-all;
}
.cmd-ac-tooltip.visible {
  display: block;
}

@media (max-width: 767px) {
  .cmd-autocomplete {
    max-height: 200px;
  }
  .cmd-ac-item {
    padding: 10px 12px;
    font-size: 14px;
    position: relative;
  }
  .cmd-ac-command {
    width: 90px;
  }
  .cmd-ac-alias {
    width: 70px;
  }
  .cmd-ac-desc {
    font-size: 11px;
  }
}

/* ===== Input Area ===== */
.input-area {
  padding: 8px 16px 16px;
  flex-shrink: 0;
  position: relative;
}

/* 커맨드 pill 바 (입력창 위) */
.cmd-pill-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
}

.cmd-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
}

.cmd-pill.pill-sori { background: var(--agent-sori-bubble); color: var(--agent-sori-name); }
.cmd-pill.pill-seoyeon { background: var(--agent-seoyeon-bubble); color: var(--agent-seoyeon-name); }
.cmd-pill.pill-jihyun { background: var(--agent-jihyun-bubble); color: var(--agent-jihyun-name); }

.cmd-pill-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.cmd-pill-remove:hover { color: var(--text-primary); }

/* 유저 버블 내 커맨드 pill */
.user-cmd-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
  vertical-align: middle;
  background: rgba(255,255,255,0.25);
  color: inherit;
}

.user-cmd-pill.pill-sori { background: var(--agent-sori-bubble); color: var(--agent-sori-name); }
.user-cmd-pill.pill-seoyeon { background: var(--agent-seoyeon-bubble); color: var(--agent-seoyeon-name); }
.user-cmd-pill.pill-jihyun { background: var(--agent-jihyun-bubble); color: var(--agent-jihyun-name); }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color 200ms ease;
}

.input-wrapper:focus-within {
  border-color: var(--accent-pink);
}

#messageInput {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  background: transparent;
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent-pink);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms ease;
}

.send-btn:hover { background: #E85A78; }
.send-btn.cancel-mode { background: var(--text-muted); }
.send-btn.cancel-mode:hover { background: var(--text-secondary); }

/* + 버튼 (더보기) */
.plus-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 150ms ease;
}
.plus-btn:hover { color: var(--accent-pink); border-color: var(--accent-pink); }
.plus-btn.active { color: var(--accent-pink); border-color: var(--accent-pink); transform: rotate(45deg); }

/* + 메뉴 팝업 */
.plus-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
}
.plus-menu.show { display: block; }
.plus-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.plus-menu-item:hover { background: var(--border); }
.plus-menu-item svg { color: var(--text-muted); flex-shrink: 0; }

/* 첨부 미리보기 바 */
.attachment-preview {
  display: flex;
  gap: 8px;
  padding: 8px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.attachment-preview::-webkit-scrollbar { display: none; }

.attach-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  font-size: 12px;
  white-space: nowrap;
  max-width: 180px;
}
.attach-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}
.attach-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}
.attach-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.attach-remove:hover { color: var(--text-primary); }

/* 드래그앤드롭 오버레이 */
.drop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.drop-overlay.active { display: flex; }
.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: white;
  font-size: 18px;
  font-weight: 600;
  padding: 40px 60px;
  border: 2px dashed rgba(255,255,255,0.6);
  border-radius: 16px;
  background: rgba(255, 107, 138, 0.2);
}
.drop-overlay-content svg { stroke: var(--accent-pink); }

/* 메시지 내 첨부파일 */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.msg-attach-img {
  display: block;
  max-width: 240px;
  border-radius: 12px;
  overflow: hidden;
}
.msg-attach-img img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
/* 채팅 내 비디오 플레이어 */
.msg-video {
  display: block;
  max-width: 420px;
  width: 100%;
  border-radius: 12px;
  margin: 8px 0;
  background: #000;
}
.msg-attach-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 150ms;
}
.msg-attach-file:hover { background: var(--border); }
.msg-attach-icon { font-size: 16px; }
.msg-attach-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Screen Recorder ===== */
.plus-menu-item.recording {
  color: #ff4444;
}
.plus-menu-item.recording svg { color: #ff4444; }

.record-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  color: #ff4444;
  font-weight: 500;
}
.record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4444;
  animation: recordBlink 1s ease-in-out infinite;
}
@keyframes recordBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.record-timer { font-variant-numeric: tabular-nums; }

/* 녹화 완료 결과 카드 */
.recording-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px !important;
  background: var(--bg-sidebar) !important;
}
.recording-result-icon { font-size: 24px; }
.recording-result-info { flex: 1; }
.recording-result-title { font-weight: 600; font-size: 13px; }
.recording-result-meta { font-size: 11px; color: var(--text-muted); }
.recording-download-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 150ms;
}
.recording-download-btn:hover { background: #E85A78; }

/* Chat mobile */
@media (max-width: 767px) {
  .message {
    max-width: 85%;
  }

  .bubble {
    padding: 10px 14px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
  }

  .message.agent .message-avatar {
    width: 24px;
    height: 24px;
  }

  .agent-name {
    font-size: 11px;
  }

  .message.delegation .delegation-bubble {
    font-size: 12px;
    padding: 5px 10px;
  }

  .quick-commands {
    padding: 6px 12px 8px;
    gap: 6px;
  }

  .quick-cmd {
    font-size: 11px;
    padding: 5px 10px;
    min-height: 28px;
  }

  .input-area {
    padding: 6px 10px 6px;
  }

  .input-wrapper {
    padding: 6px 10px;
  }

  #messageInput {
    font-size: 16px; /* iOS 줌 방지 */
  }

  .action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .chat-messages {
    padding: 12px;
  }
}

/* ===== Routine Report Card ===== */
.routine-card {
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated, rgba(0,0,0,0.03));
  padding: 12px 14px;
}

.routine-card.routine-success {
  border-left-color: #22c55e;
}

.routine-card.routine-failed {
  border-left-color: #ef4444;
}

.routine-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.routine-icon {
  font-size: 14px;
}

.routine-title {
  font-weight: 600;
  font-size: 14px;
}

.routine-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.routine-detail {
  margin-top: 8px;
}

.routine-detail.collapsed .routine-detail-body {
  display: none;
}

.routine-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-family);
}

.routine-toggle:hover {
  text-decoration: underline;
}

.routine-detail-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.routine-retry-btn {
  margin-top: 8px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: var(--radius-sm, 6px);
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
}

.routine-retry-btn:hover {
  background: #dc2626;
}

.routine-retry-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

/* ===== Voice Input (Plus Menu Item + Status) ===== */

/* 녹음 중: + 메뉴 아이템 강조 */
#voiceMicBtn.voice-active {
  color: #ef4444;
  font-weight: 600;
}

/* 미지원 브라우저 */
#voiceMicBtn.voice-unsupported {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 전사 건수 배지 (메뉴 아이템 내 인라인) */
.voice-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  margin-left: 6px;
}

/* 음성 상태 바 (입력창 하단) */
.voice-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font-size: 12px;
  color: #ef4444;
  animation: fadeIn 200ms ease;
}

.voice-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: recordBlink 1s ease-in-out infinite;
}

.voice-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  flex-shrink: 0;
}

.voice-interim {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-style: italic;
}

/* 상태바 정지 버튼 */
.voice-stop-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: none;
  border-radius: var(--radius-full);
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 200ms ease;
}

.voice-stop-btn:hover {
  background: #dc2626;
}

/* 녹음 중: + 버튼 강조 */
.plus-btn.voice-recording {
  color: #ef4444;
  animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* 모바일 */
@media (max-width: 767px) {
  .voice-stop-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .voice-status-bar {
    padding: 4px 10px;
  }
}

/* ===== Thinking Block (qwen <think> 추론 영역) ===== */
.thinking-block {
  display: none;
  margin-bottom: 4px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  font-size: 0.85em;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.thinking-block summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
}

.thinking-block summary::before {
  content: "▶ ";
  font-size: 0.8em;
}

.thinking-block[open] summary::before {
  content: "▼ ";
}

.thinking-block .thinking-content {
  margin-top: 6px;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  font-size: 0.95em;
  color: var(--text-secondary);
}

/* 글로벌 토글 ON일 때만 표시 */
body.show-thinking .thinking-block {
  display: block;
}
