﻿
/* ──────────────────────────────────────────────────
   LINE 渠道 — 对话式 IM 风格样式
   独立区块，不影响邮件收件台排版。
   ────────────────────────────────────────────────── */

/* LINE 收件台双栏布局 */
.line-inbox-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}

/* 关键逻辑：LINE 是三栏聊天工作台，外层页面不能滚动；只允许各栏内部滚动。 */
body:has(.content-scroll > #lineView.active) {
  overflow: hidden;
  height: 100%;
}

body:has(.content-scroll > #lineView.active) .app-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body:has(.content-scroll > #lineView.active) .main-panel {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

body:has(.content-scroll > #lineView.active) .sidebar {
  height: 100%;
  max-height: 100%;
}

/* LINE 页填满主面板可视区，避免外层 content-scroll 滚动时顶栏遮挡三栏头部 */
.content-scroll:has(> #lineView.active) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  /* 不能写 height:100%，否则会与上方 topbar 叠高，平板上裁掉底部确认发送 */
}

.content-scroll > #lineView.active {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 左侧会话列表栏 */
.line-conv-sidebar {
  width: 300px;
  min-width: 220px;
  max-width: 380px;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  overflow: hidden;
}

.line-conv-sidebar-header {
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.line-conv-sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.line-conv-sidebar-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.line-conv-sidebar-controls .form-select {
  flex: 1;
}

.line-conv-sidebar-search {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.line-conv-sidebar-search .form-control {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
}

.line-conv-sidebar-search .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.line-conv-list {
  flex: 1;
  /* 关键逻辑：flex 子项需 min-height:0，列表才能在侧栏内独立滚动。 */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

.line-conv-loading,
.line-conv-empty {
  padding: 20px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* 会话列表项 */
.line-conv-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s;
}

.line-conv-item:hover {
  background: var(--accent-soft);
}

.line-conv-item.is-selected {
  background: #e8f3ff;
  border-left: 3px solid #00b300;
  /* 选中左边框不挤占内容宽度，避免处理人被额外截断 */
  padding-left: 11px;
}

.line-conv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00b300;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.line-conv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.line-conv-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.line-conv-meta {
  flex: 1;
  min-width: 0;
}

.line-conv-main-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.line-conv-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* B 端标记必须完整显示，客户名过长时让位收缩而不是把标记挤出可视区。 */
.line-conv-main-row .line-conv-name {
  min-width: 0;
}

.line-conv-main-row .business-lead-badge {
  flex: none;
}

.line-conv-preview {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.line-conv-title {
  font-size: 0.74rem;
  color: #4b5563;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-conv-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.line-conv-sub {
  font-size: 0.72rem;
  color: #00b300;
  flex: 0 0 auto;
  /* 业务逻辑：公众号名优先完整展示，不截断 */
  overflow: visible;
  white-space: nowrap;
}

/* 处理中：与公众号名同行，吃满右侧剩余空间（含时间列下方空位） */
.line-conv-handler {
  font-size: 0.72rem;
  color: #b45309;
  margin-left: auto;
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-conv-handler.is-mine {
  color: #047857;
}

.line-conv-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.line-conv-time {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
}

.line-conv-unreplied-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

/* 右侧聊天面板 */
.line-chat-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #8cabd9;
}

.line-chat-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.line-chat-placeholder-inner {
  text-align: center;
}

.line-chat-logo {
  font-size: 2.5rem;
  font-weight: 900;
  color: #00b300;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.line-chat-body {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 聊天顶部栏 */
.line-chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.line-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.line-chat-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

/* 会话处理态头栏提示：自己持有 / 他人持有 */
.line-handling-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: 46%;
}

.line-handling-status-text {
  font-size: 0.82rem;
  color: #b45309;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-handling-status.is-mine .line-handling-status-text {
  color: #047857;
}

.line-handling-status.is-other .line-handling-status-text {
  color: #b45309;
}

.line-messages-refresh-hint {
  font-size: 0.78rem;
  color: #b45309;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #00b300;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.line-chat-user-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.line-chat-account-label {
  font-size: 0.75rem;
  color: #00b300;
}

/* 消息滚动区（LINE 官方蓝灰背景） */
.line-messages-scroll {
  flex: 1;
  /* 关键逻辑：flex 子项默认 min-height:auto 会被内容撑开，导致无法在内部滚动。 */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 10px 16px;
  background: #8cabd9;
  position: relative;
}

.line-messages-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(140, 171, 217, 0.78);
  pointer-events: none;
}

.line-loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 36px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  color: #1f2937;
}

.line-loading-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(0, 179, 0, 0.18);
  border-top-color: #00b300;
  border-radius: 50%;
  animation: line-ai-spin 0.85s linear infinite;
  flex-shrink: 0;
}

.line-loading-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #374151;
}

/* 消息行：参考 LINE 官方，一行内 bubble + 时间戳 */
.line-messages-list {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  justify-content: flex-end;
}

.line-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  margin-bottom: 8px;
}

.line-msg-row.line-msg-continued {
  margin-bottom: 2px;
}

.line-msg-left {
  align-self: flex-start;
  justify-content: flex-start;
}

.line-msg-right {
  align-self: flex-end;
  margin-left: auto;
  justify-content: flex-end;
}

.line-msg-right .line-msg-content {
  margin-left: auto;
}

.line-msg-no-avatar {
  padding-left: 38px;
}

.line-msg-avatar-slot {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.line-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #555;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.line-msg-content {
  min-width: 0;
  max-width: min(72%, 760px);
}

.line-msg-bubble-line {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 100%;
}

.line-msg-left .line-msg-bubble-line {
  justify-content: flex-start;
}

.line-msg-right .line-msg-bubble-line {
  justify-content: flex-end;
}

.line-bubble {
  background: #fff;
  border-radius: 14px;
  padding: 7px 10px;
  max-width: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.line-msg-left .line-bubble {
  border-bottom-left-radius: 4px;
}

.line-msg-right .line-bubble {
  background: #8de055;
  border-bottom-right-radius: 4px;
}

.line-bubble-text {
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  color: #111;
}

.line-bubble-emoji {
  width: 1.2em;
  height: 1.2em;
  vertical-align: text-bottom;
}

.line-bubble-text.muted {
  color: #666;
  font-style: normal;
}

.line-bubble-translation {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.78rem;
  line-height: 1.45;
  color: #666;
}

.line-bubble-transcript {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #555;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line-bubble-transcript > div + div {
  margin-top: 5px;
}

.line-bubble-transcript-label {
  font-weight: 600;
}

.line-bubble-transcript.is-pending,
.line-bubble-transcript.is-empty {
  color: #777;
}

.line-bubble-transcript.is-failed,
.line-bubble-transcript .is-failed {
  color: #a94442;
}

.line-bubble-status {
  margin-left: 4px;
  font-size: 0.75rem;
  color: #666;
}

.line-bubble-status.is-failed {
  color: #dc3545;
}

.line-send-retry-btn {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(220, 53, 69, 0.35);
  background: #fff;
  color: #dc3545;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.line-send-retry-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.line-bubble-img {
  max-width: min(320px, 100%);
  max-height: 320px;
  border-radius: 8px;
  display: block;
}

.line-bubble-image-preview {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  display: block;
  cursor: zoom-in;
}

.line-msg-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  max-width: 7.5rem;
}

.line-msg-left .line-msg-meta {
  align-items: flex-start;
}

.line-msg-sender {
  font-size: 0.62rem;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}

.line-msg-time {
  font-size: 0.62rem;
  color: rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  padding-bottom: 3px;
}

.line-msg-meta .line-msg-time {
  padding-bottom: 0;
}

.line-msg-system {
  align-self: center;
  max-width: 100%;
  margin: 10px 0;
}

.line-msg-system-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #555;
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 999px;
}

.line-msg-system-time {
  color: #888;
  white-space: nowrap;
}

.line-msg-error {
  color: var(--danger);
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
}

/* 底部回复区：矮屏/平板上允许区内滚动，避免「确认发送」被视口裁切 */
.line-reply-area {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(48vh, 460px);
  max-height: min(48dvh, 460px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.line-reply-draft-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.line-reply-textarea {
  /* 高度由脚本随内容调整，取消原生拖拽手柄，避免紧邻发送按钮时误触。 */
  resize: none;
  min-height: 56px;
  max-height: 240px;
  overflow-y: hidden;
  font-size: 0.88rem;
  border-radius: 10px;
}

.line-reply-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 6px;
}

.line-bubble-sticker {
  width: clamp(96px, 18vw, 160px);
  height: clamp(96px, 18vw, 160px);
  object-fit: contain;
  display: block;
}

.line-bubble-file a {
  color: inherit;
  text-decoration: underline;
}

.line-bubble-file-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: min(260px, 70vw);
  max-width: min(360px, 76vw);
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #111;
}

.line-bubble-file-card.line-bubble-outbound {
  background: rgba(255, 255, 255, 0.86);
}

.line-file-icon {
  flex: 0 0 auto;
  min-width: 42px;
  height: 42px;
  padding: 0 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  color: #444;
  font-size: 0.62rem;
  font-weight: 700;
}

.line-file-main {
  min-width: 0;
  flex: 1 1 auto;
}

.line-file-name {
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.line-file-meta {
  margin-top: 2px;
  color: #666;
  font-size: 0.75rem;
}

.line-file-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.line-file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: #198754;
  border: 1px solid rgba(25, 135, 84, 0.28);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.line-bubble-playable-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(260px, 70vw);
  max-width: min(360px, 76vw);
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #111;
}

.line-bubble-playable-card.line-bubble-outbound {
  background: rgba(255, 255, 255, 0.86);
}

.line-bubble-video {
  width: 100%;
  max-height: 320px;
  border-radius: 10px;
  background: #000;
  display: block;
}

.line-bubble-audio {
  width: 100%;
  display: block;
}

.line-playable-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.line-playable-meta-row .line-file-actions {
  margin-top: 0;
  flex: 0 0 auto;
}

.line-image-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.72);
}

.line-image-preview-modal {
  position: fixed;
  inset: 32px;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.line-image-preview-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  background: #fff;
  pointer-events: auto;
}

.line-image-preview-actions {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.line-image-preview-action {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  cursor: pointer;
}

.line-image-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.line-bubble:has(.line-bubble-image-ocr-layout),
.line-bubble:has(.line-bubble-file-ocr-layout) {
  overflow: visible;
}

.line-bubble-image-ocr-layout,
.line-bubble-file-ocr-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  max-width: min(640px, 100%);
  width: 100%;
}

.line-bubble-file-ocr-layout {
  flex-direction: column;
}

.line-bubble-image-ocr-layout .line-bubble-media {
  flex: 0 0 min(200px, 38%);
  min-width: 0;
}

.line-bubble-image-ocr-layout .line-bubble-img {
  max-width: 100%;
  width: auto;
}

.line-image-ocr-panel {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
}

.line-image-ocr-status {
  display: inline-flex;
  align-items: center;
  margin-bottom: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
}

.line-image-ocr-status.is-success {
  background: #e8f7ef;
  color: #116c3a;
}

.line-image-ocr-status.is-warning {
  background: #fff2e0;
  color: #9a5a00;
}

.line-image-ocr-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-top: 6px;
}

.line-image-ocr-row span {
  color: var(--muted);
  font-size: 0.72rem;
}

.line-image-ocr-row strong {
  width: 100%;
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.line-image-ocr-text {
  margin-top: 8px;
  color: var(--muted);
}

.line-image-ocr-text summary {
  cursor: pointer;
  user-select: none;
}

.line-image-ocr-text div {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 5px;
  padding: 6px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.line-image-ocr-error {
  margin-top: 6px;
  color: var(--danger);
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 760px) {
  .line-bubble-image-ocr-layout .line-bubble-media {
    flex-basis: min(160px, 36%);
  }
}

/* 附件区：单行工具栏，展开时才显示商品列表 */
.line-reply-attachment-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 6px;
}

.line-attachment-details {
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.line-attachment-details[open] {
  flex: 1 1 100%;
}

.line-attachment-details.d-none {
  display: none !important;
}

.line-attachment-summary {
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  user-select: none;
}

.line-attachment-summary::-webkit-details-marker {
  display: none;
}

.line-attachment-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.line-attachment-details[open] .line-attachment-summary::before {
  transform: rotate(90deg);
}

.line-upload-native-input {
  width: min(320px, 100%);
  padding: 2px 8px;
  font-size: 0.75rem;
}

.line-product-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 96px;
  overflow-y: auto;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #e8ecf0;
  width: 100%;
}

.line-attachment-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  margin: 0;
  cursor: pointer;
}

.line-attachment-option-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-attachment-option-size {
  font-size: 0.7rem;
  color: var(--muted);
}

.line-pending-attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.line-reply-attachment-bar.has-pending .line-pending-attachment-chips {
  flex-basis: 100%;
}

.line-upload-status {
  flex: 1 1 220px;
  min-width: 180px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.line-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e8f4fd;
  font-size: 0.72rem;
}

.line-attachment-chip-remove {
  border: 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.line-reply-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.line-reply-suggestion-panel {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #f8faf8;
}

.line-reply-suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.line-reply-suggestion-panel:not(.is-collapsed) .line-reply-suggestion-header {
  margin-bottom: 8px;
}

.line-reply-suggestion-header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.line-reply-suggestion-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}

.line-reply-suggestion-toggle:hover .line-reply-suggestion-title {
  color: #111;
}

.line-reply-suggestion-chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #666;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.line-reply-suggestion-panel.is-collapsed .line-reply-suggestion-chevron {
  transform: rotate(-90deg);
}

.line-reply-suggestion-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
}

.line-reply-suggestion-header-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.line-reply-suggestion-tabs {
  display: inline-flex;
  gap: 4px;
}

.line-reply-suggestion-tab {
  border: 1px solid #d7e3d7;
  background: #fff;
  color: #555;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 2px 10px;
  cursor: pointer;
}

.line-reply-suggestion-tab.is-active {
  background: #00b300;
  border-color: #00b300;
  color: #fff;
}

.line-reply-suggestion-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.line-reply-suggestion-panel.is-collapsed .line-reply-suggestion-body {
  display: none;
}

.line-reply-suggestion-panel.is-analyzing {
  border-color: rgba(0, 179, 0, 0.28);
  background: linear-gradient(180deg, #f8fff8 0%, #f3faf3 100%);
}

.line-reply-suggestion-panel.is-stale {
  border-color: rgba(245, 158, 11, 0.32);
  background: #fffaf0;
}

.line-reply-suggestion-panel.is-stale .line-reply-suggestion-title::after {
  content: "上一条建议";
  display: inline-flex;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #8a5a00;
  font-size: 0.68rem;
  font-weight: 500;
  vertical-align: middle;
}

.line-reply-suggestion-panel.is-updating .line-reply-suggestion-title::after {
  content: "更新中";
}

.line-reply-suggestion-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 0.74rem;
  line-height: 1.3;
  color: #2f6b2f;
}

.line-reply-suggestion-loading .line-ai-analyzing-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-reply-suggestion-loading.is-error {
  color: #8a5a00;
}

.line-reply-suggestion-loading.is-error .line-ai-analyzing-text {
  font-weight: 600;
}

.line-ai-analyzing-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 179, 0, 0.18);
  border-top-color: #00b300;
  border-radius: 50%;
  animation: line-ai-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.line-ai-analyzing-text {
  font-weight: 600;
}

.line-ai-analyzing-dots::after {
  content: "";
  animation: line-ai-dots 1.2s steps(4, end) infinite;
}

@keyframes line-ai-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes line-ai-dots {
  0%,
  20% {
    content: "";
  }
  40% {
    content: ".";
  }
  60% {
    content: "..";
  }
  80%,
  100% {
    content: "...";
  }
}

.line-reply-suggestion-text {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #444;
  white-space: pre-wrap;
  word-break: break-word;
}

.line-reply-suggestion-panel.is-stale .line-reply-suggestion-text {
  color: #5f5132;
}

.line-reply-suggestion-text.is-verification-failed {
  color: #a33a2b;
  font-weight: 600;
}

.line-reply-suggestion-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0;
  flex-shrink: 0;
}

/* 着色沿用 yahoo.css 的全局 .btn.audit-risk-*，这里只防止「风控审计 · 风险高」折行。 */
.line-reply-suggestion-actions .btn[class*="audit-risk-"] {
  white-space: nowrap;
  font-weight: 600;
}

.line-suggestion-revision-modal {
  width: min(480px, calc(100vw - 32px));
}

.line-suggestion-revision-hint {
  margin: 0 0 12px;
  font-size: 0.86rem;
  color: var(--muted);
}

.line-suggestion-revision-input {
  min-height: 108px;
  resize: vertical;
}

.line-suggestion-revision-actions {
  justify-content: flex-end;
}

.line-send-btn {
  background: #00b300;
  border-color: #00b300;
  color: #fff;
  font-weight: 600;
  padding: 6px 20px;
  border-radius: 20px;
}

.line-send-btn:hover {
  background: #009900;
  border-color: #009900;
}

.line-reply-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 6px;
}

.line-session-info-modal {
  width: min(760px, calc(100vw - 32px));
}

.line-session-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.line-session-info-grid .field-label {
  margin-bottom: 0;
}

/* 右栏：会话基本信息面板 */
.line-info-panel {
  width: 340px;
  min-width: 300px;
  max-width: 380px;
  height: 100%;
  min-height: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease, opacity 0.2s ease;
}

.line-inbox-layout.info-collapsed .line-info-panel {
  width: 0;
  min-width: 0;
  max-width: 0;
  border-left: none;
  opacity: 0;
  pointer-events: none;
}

.line-info-panel-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.line-info-panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}

.line-info-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.line-info-panel-collapse,
.line-info-panel-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
}

.line-info-panel-close {
  display: none;
  font-size: 1.3rem;
}

.line-info-panel-expand {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 12;
  width: 28px;
  height: 72px;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
}

.line-info-panel-expand:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.line-info-panel-content {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.line-info-panel-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(1px);
  pointer-events: auto;
}

.line-info-panel-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.line-info-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
}

.line-info-panel .line-session-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.line-info-panel .line-session-info-grid .field-label {
  font-size: 0.78rem;
  margin-bottom: 0;
}

.line-info-panel .line-session-info-grid .form-control,
.line-info-panel .line-session-info-grid .form-select {
  font-size: 0.82rem;
}

.line-info-field-full {
  grid-column: 1 / -1;
}

.line-info-field-row {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.line-info-field-row--lang-name {
  grid-template-columns: 0.85fr 1.15fr;
}

.line-info-field-row--contact {
  grid-template-columns: 1fr 1fr;
}

.line-info-customer-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  overflow: hidden;
}

.line-info-customer-section-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}

.line-info-customer-section-summary::-webkit-details-marker {
  display: none;
}

.line-info-customer-section-summary::after {
  content: "▸";
  font-size: 0.72rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.line-info-customer-section[open] .line-info-customer-section-summary::after {
  transform: rotate(90deg);
}

.line-info-customer-section-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.line-product-combobox {
  position: relative;
}

.line-product-candidates {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.line-product-candidate-item,
.line-product-candidate-empty {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text);
}

.line-product-candidate-item:hover,
.line-product-candidate-item:focus {
  background: var(--surface-soft);
}

.line-product-candidate-empty {
  color: var(--muted);
  cursor: default;
}

.line-info-order-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.line-info-order-row .form-control {
  flex: 1;
  min-width: 0;
}

.line-info-order-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

#lineOrderInfoCard .line-info-order-row {
  margin-top: 2px;
}

#lineOrderInfoCard .line-info-order-summary {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(23, 78, 166, 0.12);
}

.line-info-order-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 5px;
}

.line-info-order-head .line-info-insight-title {
  margin: 0 auto 0 0;
}

.line-info-order-head .btn {
  padding: 2px 8px;
  font-size: 0.72rem;
}

#lineOrderInfoCard {
  padding: 8px 10px;
}

#lineOrderInfoCard .form-control,
#lineOrderInfoCard .line-info-order-row .btn {
  font-size: 0.76rem;
}

.line-info-order-compact {
  color: #1f2937;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.line-info-order-compact.is-warning,
.line-info-order-compact-warning {
  color: #b54708;
}

.line-info-order-compact-warning {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.line-order-detail-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#lineCancelOrderBackdrop.open {
  display: block;
  z-index: 1065;
}

#lineCancelOrderModal {
  z-index: 1070;
}

@media (max-width: 640px) {
  .line-order-detail-modal-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.line-info-todo-card {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background: #fff;
}

.line-info-todo-card .todo-compact-head {
  margin-bottom: 3px;
}

.line-info-todo-card .todo-compact-due {
  max-width: 64px;
}

.line-info-todo-card .todo-compact-number {
  min-width: 24px;
  font-size: 0.64rem;
}

.line-info-todo-card .todo-compact-status {
  max-width: 52px;
}

.line-info-product-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-word;
}

.line-info-product-hint.is-warning {
  color: var(--danger);
}

.line-info-missing {
  border: 1px solid #f0c36d;
  background: #fff8e6;
  color: #8a6d1b;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.line-info-missing.is-conflict {
  border-color: #e59f31;
  background: #fff3db;
  color: #8a4d00;
}

.line-info-insight-card {
  border: 1px solid #dbe7f6;
  background: #f8fbff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.line-info-insight-title {
  font-weight: 700;
  color: #174ea6;
  margin-bottom: 6px;
}

.line-info-insight-text {
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.line-info-order-summary {
  display: grid;
  gap: 5px;
  color: #334155;
}

.line-info-order-summary-text {
  color: #334155;
  line-height: 1.45;
  word-break: break-word;
}

.line-info-order-summary-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.line-info-panel-actions {
  display: none;
}

.line-info-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.line-info-panel-backdrop.is-hidden {
  display: none;
}

/* 桌面端面板常驻，抽屉遮罩不应出现 */
@media (min-width: 1101px) {
  .line-info-panel-backdrop {
    display: none !important;
  }
  .line-inbox-layout.info-collapsed .line-info-panel-backdrop {
    display: none !important;
  }
}

/* 中屏：面板收为抽屉，默认隐藏，由 info-open 打开 */
@media (max-width: 1100px) {
  .line-info-panel {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: min(360px, 92vw);
    max-width: 92vw;
    min-width: 0;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 50;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
    opacity: 1;
    pointer-events: auto;
  }
  .line-inbox-layout.info-collapsed .line-info-panel {
    width: min(360px, 92vw);
    max-width: 92vw;
    opacity: 1;
    pointer-events: auto;
  }
  .line-inbox-layout.info-open .line-info-panel {
    transform: translateX(0);
  }
  .line-info-panel-close {
    display: inline-block;
  }
  .line-info-panel-expand {
    display: none !important;
  }
}

/* LINE 账号管理 */
.line-account-modal {
  width: min(640px, calc(100vw - 32px));
}

.line-accounts-table {
  width: 100%;
  font-size: 0.85rem;
}

.line-accounts-table .line-token-masked {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

/* 已通过连通校验：删除按钮灰色不可点 */
.line-accounts-table .line-account-delete-disabled:disabled {
  color: #9ca3af;
  border-color: #d1d5db;
  background: #f3f4f6;
  opacity: 1;
  cursor: not-allowed;
}

.line-webhook-url-input {
  font-size: 0.72rem;
  min-width: 200px;
}

/* 响应式：小屏幕隐藏左栏 */
@media (max-width: 640px) {
  .line-conv-sidebar {
    width: 100%;
    max-width: 100%;
    position: absolute;
    z-index: 10;
    height: 100%;
  }
  .line-chat-pane {
    display: none;
  }
  .line-inbox-layout.chat-active .line-conv-sidebar {
    display: none;
  }
  .line-inbox-layout.chat-active .line-chat-pane {
    display: flex;
  }

  .line-msg-content {
    max-width: min(86%, 100%);
  }

  .line-session-info-grid {
    grid-template-columns: 1fr;
  }

  .line-info-field-row--lang-name,
  .line-info-field-row--contact {
    grid-template-columns: 1fr;
  }
}
