/* ==========================================================================
   译拍即合 Yipact v2 — 60% / 40% Split Workspace + Telegram Chat + Insights
   ========================================================================== */

.chat-view {
  background: var(--bg-canvas);
  overflow: hidden;
}

/* Mobile Tab Bar (hidden on desktop >= 960px) */
.chat-mobile-tabs {
  display: none;
  padding: 8px 12px;
  background: var(--bg-glass-strong);
  border-bottom: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

/* ---------- 60% / 40% Split Layout Container ---------- */
.chat-split {
  flex: 1;
  min-height: 0;
  display: grid;
  overflow: hidden;
}

/* ==========================================================================
   LEFT COLUMN (60%) — Telegram-Inspired Conversation Pane
   ========================================================================== */
.chat-left-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  background-image: radial-gradient(var(--bg-chat-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  border-right: 1px solid var(--border-hairline);
}

/* Left Top Header: Peer Avatar, Status, Title, Language Pair */
.chat-left-header {
  position: relative;
  z-index: var(--z-sticky);
  height: var(--header-height);
  padding: 0 clamp(14px, 2vw, 22px);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.peer-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--avatar-bg);
  border: 1px solid var(--g-blue-border);
  color: var(--g-blue-deep);
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

.peer-avatar-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--avatar-dot-border);
  background: var(--g-green);
}

.peer-avatar-dot.is-offline {
  background: var(--g-yellow);
}

.peer-avatar-dot.is-left {
  background: var(--g-red);
}

.peer-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.peer-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.peer-name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meeting-title-chip {
  font-size: 12px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.peer-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-secondary);
  flex-wrap: wrap;
}

.lang-pair-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 11.5px;
  font-weight: 550;
}

/* Status / Reconnect / Ended Floating Banner */
.chat-banner {
  position: absolute;
  top: calc(var(--header-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-primary);
  max-width: calc(100% - 28px);
  animation: toastEnter 260ms var(--ease-spring) both;
}

.chat-banner.is-ended {
  background: var(--g-red-tint);
  border-color: var(--g-red-border);
  color: var(--g-red-deep);
}

.chat-banner svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- Message Stream ---------- */
.chat-stream-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px clamp(12px, 2.4vw, 24px) 14px;
  scroll-behavior: smooth;
}

.chat-stream {
  max-width: var(--chat-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

/* Empty Conversation State */
.chat-empty {
  margin: auto;
  max-width: 440px;
  padding: 26px 22px;
  border-radius: var(--radius-xl);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm);
  text-align: center;
  animation: fadeSlideUp 380ms var(--ease-spring) both;
}

.chat-empty-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 15px;
  background: var(--g-blue-tint);
  color: var(--g-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-empty-icon svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.chat-empty h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink-primary);
}

.chat-empty p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.chat-empty-tips {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  text-align: start;
}

.chat-empty-tip-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.chat-empty-tip-row .status-dot {
  margin-top: 6px;
}

/* ---------- Message Row & Telegram Bubbles ---------- */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: min(86%, 600px);
  gap: 6px;
  border-radius: 22px;
  transition: transform var(--dur-fast) var(--ease-spring);
}

.msg-row.is-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.is-peer {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-row.is-new.is-mine .msg-bubble {
  animation: bubbleInRight 280ms var(--ease-spring) both;
}

.msg-row.is-new.is-peer .msg-bubble {
  animation: bubbleInLeft 280ms var(--ease-spring) both;
}

.msg-bubble {
  position: relative;
  padding: 12px 16px 10px;
  line-height: 1.64;
  font-size: 14.8px;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  transition: border-color var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-base) var(--ease-spring);
}

/* Outgoing (My Message) */
.msg-row.is-mine .msg-bubble {
  background: var(--bubble-mine-bg);
  border: 1px solid var(--bubble-mine-border);
  color: var(--bubble-mine-ink);
  border-radius: 20px 20px 5px 20px;
  box-shadow: var(--shadow-xs);
}

/* Incoming (Peer Translated Message) */
.msg-row.is-peer .msg-bubble {
  background: var(--bubble-peer-bg);
  border: 1px solid var(--bubble-peer-border);
  color: var(--bubble-peer-ink);
  border-radius: 20px 20px 20px 5px;
  box-shadow: var(--shadow-sm);
}

/* Active Linked Highlight when hovered or selected from Insights pane */
.msg-row.is-peer.is-insight-active .msg-bubble {
  border-color: var(--g-blue);
  box-shadow: 0 0 0 2.5px rgba(66, 133, 244, 0.16), var(--shadow-md);
}

.bubble-content {
  user-select: text;
  -webkit-user-select: text;
}

/* ==========================================================================
   v2 Three Distinct Segment Annotation Styles
   ========================================================================== */

/* 1. kind="term" — Professional Term: Bold + Hover Tooltip */
.seg-term {
  display: inline;
  font-weight: 700;
  color: var(--seg-term-ink);
  background: var(--seg-term-bg);
  padding: 0 4px;
  border-radius: 5px;
  cursor: help;
  transition: background var(--dur-fast) var(--ease-smooth),
    color var(--dur-fast) var(--ease-smooth);
}

.seg-term:hover,
.seg-term:focus-visible,
.seg-term.is-active {
  background: var(--seg-term-bg-hover);
  outline: none;
}

/* 2. kind="phrase" — Special Phrase: Dashed Underline + Click Card */
.seg-phrase {
  display: inline;
  padding: 0 2px 1px;
  margin: 0 -1px;
  border-radius: 4px;
  background: var(--seg-phrase-bg);
  border-bottom: 1.5px dashed var(--seg-phrase-underline);
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth);
}

.seg-phrase:hover {
  background: var(--seg-phrase-bg-hover);
}

.seg-phrase[aria-expanded="true"] {
  background: var(--seg-phrase-active-bg);
  border-bottom: 1.5px solid var(--g-blue);
  color: var(--g-blue-deep);
}

/* 3. kind="doc_ref" — Pre-Meeting Doc Reference: Fluorescent Yellow Highlight */
.seg-doc-ref {
  display: inline;
  padding: 1px 4px;
  margin: 0 1px;
  border-radius: 5px;
  background: var(--seg-doc-bg);
  color: var(--seg-doc-ink);
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth);
}

.seg-doc-ref:hover {
  background: var(--seg-doc-bg-hover);
}

.seg-doc-ref[aria-expanded="true"] {
  background: var(--seg-doc-active-bg);
  box-shadow: inset 0 -2px 0 var(--seg-doc-border);
}

/* Floating Term Tooltip (Hover / Click on kind="term") */
.term-tooltip {
  position: fixed;
  z-index: var(--z-popover);
  max-width: min(320px, calc(100vw - 24px));
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--g-blue-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: pillPop 180ms var(--ease-spring) both;
}

.term-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.term-tooltip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--g-blue-deep);
}

.term-tooltip-badge svg {
  width: 13px;
  height: 13px;
  color: var(--g-blue);
  flex-shrink: 0;
}

.term-tooltip-word {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-primary);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--seg-term-bg);
}

.term-tooltip-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-primary);
  white-space: pre-wrap;
}

.term-tooltip-foot {
  display: flex;
  justify-content: flex-end;
}

/* Translating Shimmer State */
.translating-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 210px;
  padding: 2px 0;
}

.translating-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

/* Failed Translation State */
.translation-failed-box {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.failed-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--g-red-deep);
}

.failed-badge svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.failed-detail {
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.failed-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Bubble Footer (Timestamp, Delivery Checkmarks, Peek Original, Ref Pill) */
.bubble-footer {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-tertiary);
  user-select: none;
}

.msg-row.is-mine .bubble-footer {
  justify-content: flex-end;
  gap: 6px;
}

.bubble-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bubble-micro-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}

.bubble-micro-btn:hover {
  background: var(--bg-surface);
  color: var(--ink-primary);
}

.bubble-micro-btn.is-active {
  background: var(--g-blue-tint-soft);
  border-color: var(--g-blue-border);
  color: var(--g-blue-deep);
}

.bubble-micro-btn.is-doc {
  background: var(--g-yellow-tint);
  border-color: var(--g-yellow-border);
  color: var(--g-yellow-deep);
}

.bubble-micro-btn.is-doc:hover {
  background: var(--g-yellow-tint-hover);
}

.bubble-micro-btn.is-insight-pill {
  background: var(--g-blue-tint-soft);
  border-color: var(--g-blue-border);
  color: var(--g-blue-deep);
}

.bubble-micro-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.delivery-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
}

.delivery-status svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.delivery-status.is-sent {
  color: var(--ink-tertiary);
}

.delivery-status.is-delivered {
  color: var(--g-green);
}

.delivery-status.is-failed {
  color: var(--g-red);
}

/* Expanded Original Text Peek Box */
.original-peek {
  margin-top: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  animation: cardUnfold 220ms var(--ease-spring) both;
}

.original-peek-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-tertiary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.original-peek-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

/* Inline Semantic / Doc Ref Annotation Card */
.annotation-card {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--g-blue-border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: cardUnfold 240ms var(--ease-spring) both;
}

.annotation-card.is-doc-card {
  border-color: var(--g-yellow-border);
}

.annotation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.annotation-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--g-blue-deep);
}

.annotation-card.is-doc-card .annotation-title {
  color: var(--g-yellow-deep);
}

.annotation-title svg {
  width: 14px;
  height: 14px;
  color: var(--g-blue);
  flex-shrink: 0;
}

.annotation-card.is-doc-card .annotation-title svg {
  color: var(--g-yellow);
}

.annotation-quote {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--g-yellow-tint);
  color: var(--g-yellow-deep);
  font-weight: 550;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.annotation-body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-primary);
  white-space: pre-wrap;
}

/* Pre-Meeting Document Citation Pills */
.ref-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-item {
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}

.ref-pill-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-primary);
  text-align: start;
  transition: background var(--dur-fast);
}

.ref-pill-toggle:hover {
  background: var(--bg-surface);
}

.ref-pill-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ref-pill-left svg {
  width: 14px;
  height: 14px;
  color: var(--g-blue);
  flex-shrink: 0;
}

.ref-jump-label {
  font-size: 11px;
  color: var(--g-blue-deep);
  flex-shrink: 0;
}

.annotation-card .btn-icon svg,
.msg-refs-card .btn-icon svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ref-pill-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-excerpt {
  padding: 7px 10px 9px 29px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-elevated);
}

.annotation-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Inline Message Refs Card */
.msg-refs-card {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--g-yellow-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: cardUnfold 220ms var(--ease-spring) both;
}

.msg-refs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 650;
  color: var(--g-yellow-deep);
}

/* Scroll-to-Bottom Pill */
.scroll-bottom-btn {
  position: absolute;
  bottom: 84px;
  right: 20px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--g-blue);
  animation: pillPop 220ms var(--ease-pop) both;
}

.scroll-bottom-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---------- Telegram-Style Floating Pill Composer ---------- */
.chat-composer-wrap {
  padding: 8px clamp(12px, 2.4vw, 24px) 14px;
  background: var(--composer-fade);
  flex-shrink: 0;
}

.composer-form {
  max-width: var(--chat-max-width);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 6px 7px 6px 13px;
  border-radius: 26px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  transition: border-color var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-base) var(--ease-spring);
}

.composer-form:focus-within {
  border-color: var(--g-blue);
  box-shadow: 0 8px 28px rgba(66, 133, 244, 0.16), 0 0 0 3px rgba(66, 133, 244, 0.12);
}

.composer-lang-tag {
  align-self: center;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.composer-lang-tag:hover {
  background: var(--g-blue-tint-soft);
  color: var(--g-blue-deep);
}

.composer-input {
  flex: 1;
  min-width: 0;
  min-height: 26px;
  max-height: 132px;
  padding: 7px 2px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14.8px;
  line-height: 1.5;
  color: var(--ink-primary);
}

.composer-input::placeholder {
  color: var(--ink-tertiary);
}

.composer-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--g-blue);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.28);
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-pop), opacity var(--dur-fast);
}

.composer-send-btn:hover:not(:disabled) {
  background: var(--g-blue-hover);
  transform: scale(1.05);
}

.composer-send-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.composer-send-btn:disabled {
  background: var(--bg-surface-hover);
  color: var(--ink-tertiary);
  box-shadow: none;
  opacity: 1;
}

.composer-send-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  transform: translateX(-0.5px);
}

/* ==========================================================================
   RIGHT COLUMN (40%) — Toolbar + Top Insights + Bottom Memo
   ========================================================================== */
.chat-right-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  overflow: hidden;
}

/* Right Top Toolbar (Matches Figure 2: Code, Docs, Language, Settings, Leave) */
.chat-right-header {
  height: var(--header-height);
  padding: 0 12px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: safe flex-end;
  gap: 6px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-right-header::-webkit-scrollbar {
  display: none;
}

.code-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 33px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}

.code-pill-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.code-pill-btn:active {
  transform: scale(0.96);
}

.code-pill-btn.is-copied {
  background: var(--g-green-tint);
  border-color: var(--g-green-border);
  color: var(--g-green-deep);
}

.code-pill-btn svg {
  width: 13px;
  height: 13px;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.code-pill-btn.is-copied svg {
  color: var(--g-green-deep);
}

.header-docs-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 33px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-primary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}

.header-docs-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.header-docs-btn:active {
  transform: scale(0.96);
}

.header-docs-btn svg {
  width: 14px;
  height: 14px;
  color: var(--g-blue);
  flex-shrink: 0;
}

.docs-count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--g-blue);
  color: #ffffff;
  font-size: 11px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.docs-count-badge.is-zero {
  background: var(--bg-surface-hover);
  color: var(--ink-secondary);
}

/* Right Split Body: Top 50% Insights + Bottom 50% Memo */
.chat-right-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

/* ---------- Top Half: Insights / 备注 Panel ---------- */
.insights-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.insights-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--g-blue-tint);
  color: var(--g-blue-deep);
  font-size: 11px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.insights-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.insights-empty {
  margin: auto;
  max-width: 300px;
  text-align: center;
  padding: 18px 14px;
  color: var(--ink-tertiary);
  font-size: 12.5px;
  line-height: 1.6;
}

.insights-empty-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--ink-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.insights-empty-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Individual Insight Card */
.insight-card {
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-base) var(--ease-spring),
    transform var(--dur-fast) var(--ease-spring);
  animation: cardUnfold 240ms var(--ease-spring) both;
}

.insight-card:hover {
  border-color: var(--border-subtle);
}

.insight-card.is-highlighted {
  border-color: var(--g-blue);
  box-shadow: 0 0 0 2.5px rgba(66, 133, 244, 0.18), var(--shadow-md);
}

.insight-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  text-align: start;
  transition: background var(--dur-fast);
}

.insight-card-head:hover {
  background: var(--bg-surface);
}

.insight-card.is-highlighted .insight-card-head {
  background: var(--g-blue-tint-soft);
}

.insight-msg-snippet {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.insight-msg-time {
  font-size: 11px;
  color: var(--ink-tertiary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.insight-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.insight-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insight-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 650;
}

.insight-tag svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.insight-tag.is-subtext {
  background: var(--g-blue-tint);
  color: var(--g-blue-deep);
}

.insight-tag.is-risk {
  background: var(--g-red-tint);
  color: var(--g-red-deep);
}

.insight-tag.is-questions {
  background: var(--g-green-tint);
  color: var(--g-green-deep);
}

.insight-tag.is-uncertainty {
  background: var(--g-yellow-tint);
  color: var(--g-yellow-deep);
}

.insight-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-primary);
  white-space: pre-wrap;
}

.insight-questions-list {
  display: grid;
  gap: 2px;
}

.insight-question-pill {
  justify-self: start;
  max-width: 100%;
  padding: 3px 2px;
  color: var(--g-blue-deep);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: start;
}

.insight-question-pill:hover,
.insight-question-pill:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Floating "问问 AI" Text-Selection Pill ---------- */
.ask-ai-pill {
  position: fixed;
  z-index: var(--z-floating);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-toast);
  color: var(--ink-toast);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-pill);
  animation: pillPop 200ms var(--ease-pop) both;
  transition: background var(--dur-fast), transform var(--dur-fast);
}

.ask-ai-pill:hover {
  background: var(--g-blue);
  color: #ffffff;
  transform: translateY(-1px);
}

.ask-ai-pill:active {
  transform: scale(0.95);
}

.ask-ai-pill svg {
  width: 14px;
  height: 14px;
  color: var(--g-yellow);
  flex-shrink: 0;
}

.ask-ai-pill:hover svg {
  color: #ffffff;
}

/* ---------- Right Slide-Over Drawers (Private AI Side-Chat & Meeting Docs) ---------- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) - 1);
  background: var(--bg-scrim);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-smooth);
}

.drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.slide-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--drawer-width), 92vw);
  z-index: var(--z-drawer);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-hairline);
  box-shadow: -12px 0 38px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  transform: translateX(104%);
  transition: transform 340ms var(--ease-spring);
  will-change: transform;
}

.slide-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.drawer-title-wrap {
  min-width: 0;
}

.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.drawer-title svg {
  width: 17px;
  height: 17px;
  color: var(--g-blue);
  flex-shrink: 0;
}

.private-badge {
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-secondary);
  font-size: 11.5px;
}

.private-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.dropzone-title .dropzone-instruction { color: inherit; }

/* Side-Chat Quote & Stream */
.side-quote-box {
  margin: 12px 16px 0;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border-inline-start: 3px solid var(--g-blue);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-secondary);
  max-height: 110px;
  overflow-y: auto;
  flex-shrink: 0;
}

.side-quote-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-tertiary);
  margin-bottom: 3px;
}

.side-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-msg {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  animation: cardUnfold 220ms var(--ease-spring) both;
}

.side-msg.is-ai {
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--ink-primary);
  border-bottom-left-radius: 5px;
}

.side-msg.is-user {
  align-self: flex-end;
  max-width: 88%;
  background: var(--bubble-mine-bg);
  color: var(--bubble-mine-ink);
  border-bottom-right-radius: 5px;
}

.side-msg.is-error {
  background: var(--g-red-tint);
  color: var(--g-red-deep);
  border: 1px solid var(--g-red-border);
}

.side-msg-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.side-composer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.side-input {
  flex: 1;
  min-height: 38px;
  max-height: 110px;
  padding: 8px 12px;
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  outline: none;
  resize: none;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-primary);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.side-input:focus {
  background: var(--bg-canvas);
  border-color: var(--g-blue);
}

.side-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--g-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur-fast), transform var(--dur-fast);
}

.side-send-btn:hover:not(:disabled) {
  background: var(--g-blue-hover);
}

.side-send-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.side-send-btn:disabled {
  background: var(--bg-surface-hover);
  color: var(--ink-tertiary);
  opacity: 1;
}

.side-send-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Meeting Docs Drawer Body */
.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--ink-tertiary);
  font-size: 13px;
}

.mobile-quick-actions {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ==========================================================================
   Responsive Narrow Screen (< 960px) — Segmented Tabs: 对话 / 备注 / 备忘录
   ========================================================================== */
.workspace-splitter {
  display: none;
}

@media (min-width: 960px) {
  .chat-view {
    --bg-workspace: #eef2f7;
    background: var(--bg-workspace);
    padding: 10px;
  }

  [data-theme="dark"] .chat-view {
    --bg-workspace: #0b0f16;
  }

  .chat-split {
    grid-template-columns: minmax(380px, var(--workspace-left, 3fr)) 12px minmax(320px, 2fr);
    overflow: visible;
  }

  .chat-left-pane,
  .chat-right-body > .insights-pane,
  .chat-right-body > .memo-pane {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .chat-right-body > .insights-pane,
  .chat-right-body > .memo-pane {
    background: var(--bg-elevated);
  }

  .chat-left-header::before,
  .memo-topbar::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 16px;
    width: 32px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--g-blue);
  }

  .memo-topbar {
    position: relative;
  }

  .memo-topbar::before {
    background: var(--g-green);
  }

  .chat-right-pane {
    background: transparent;
    gap: 8px;
    overflow-y: auto;
  }

  .chat-right-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: calc(var(--header-height) - 8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    justify-content: safe flex-end;
  }

  .chat-right-body {
    min-height: 352px;
    grid-template-rows: minmax(150px, var(--workspace-top, 1fr)) 12px minmax(190px, 1fr);
    overflow: visible;
  }

  .workspace-splitter {
    display: grid;
    place-items: center;
    touch-action: none;
    user-select: none;
    cursor: col-resize;
    border-radius: var(--radius-pill);
  }

  .splitter-top {
    cursor: row-resize;
  }

  .workspace-splitter::after {
    content: "";
    width: 4px;
    height: 32px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    transition: background var(--dur-fast);
  }

  .splitter-top::after {
    width: 32px;
    height: 4px;
  }

  .workspace-splitter:hover::after,
  .workspace-splitter:focus-visible::after,
  .dragging-split-left .splitter-left::after,
  .dragging-split-top .splitter-top::after {
    background: var(--g-blue);
  }

  .workspace-splitter:focus-visible {
    outline: none;
  }

  .workspace-splitter:focus-visible::after {
    outline: 2px solid var(--g-blue);
    outline-offset: 2px;
  }
}

body:is(.dragging-split-left, .dragging-split-top) *,
body:is(.dragging-split-left, .dragging-split-top) {
  user-select: none !important;
  cursor: var(--workspace-drag-cursor) !important;
}

body.dragging-split-left { --workspace-drag-cursor: col-resize; }
body.dragging-split-top { --workspace-drag-cursor: row-resize; }

@media (width < 960px) {
  .mobile-quick-actions {
    display: inline-flex;
  }

  .chat-mobile-tabs {
    display: block;
  }

  .chat-split {
    display: flex;
    flex-direction: column;
  }

  .chat-left-pane,
  .chat-right-pane {
    flex: 1;
    border-right: none;
  }

  /* On narrow screens, right-header stays visible above tabs OR docked inside mobile flow */
  .chat-view[data-mobile-tab="chat"] .chat-right-pane {
    display: none;
  }

  .chat-view[data-mobile-tab="insights"] .chat-left-pane,
  .chat-view[data-mobile-tab="memo"] .chat-left-pane {
    display: none;
  }

  .chat-view[data-mobile-tab="insights"] .chat-right-body {
    grid-template-rows: minmax(0, 1fr);
  }

  .chat-view[data-mobile-tab="insights"] .memo-pane {
    display: none;
  }

  .chat-view[data-mobile-tab="memo"] .chat-right-body {
    grid-template-rows: minmax(0, 1fr);
  }

  .chat-view[data-mobile-tab="memo"] .insights-pane {
    display: none;
  }

  .msg-row {
    max-width: 90%;
  }
}

@media (max-width: 1180px) and (min-width: 960px) {
  .header-docs-label {
    display: none;
  }
  .meeting-title-chip {
    max-width: 140px;
  }
}

@media (max-width: 520px) {
  .header-docs-label,
  .composer-lang-tag {
    display: none;
  }
}
