.chat-records-admin {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-records-admin__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-records-admin__subtitle {
  margin: 6px 0 0;
  color: var(--admin-muted);
}

.chat-records-admin__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-records-admin__breadcrumb {
  font-size: 13px;
  color: var(--admin-muted);
}

.chat-records-admin__filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.chat-records-admin__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  font-size: 13px;
  color: var(--admin-muted);
}

.chat-records-admin__field select {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.chat-records-admin__folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  min-height: 120px;
}

.chat-records-admin__folder-grid.list {
  grid-template-columns: 1fr;
}

.chat-records-admin__folder {
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 16px;
  background: #f7f8ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-records-admin__folder:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(79, 110, 247, 0.18);
}

.chat-records-admin__folder-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-records-admin__folder-title {
  font-weight: 600;
  color: #1f2937;
}

.chat-records-admin__folder-subtitle {
  font-size: 12px;
  color: var(--admin-muted);
}

.chat-records-admin__folder-count {
  font-size: 12px;
  color: #4f6ef7;
  background: rgba(79, 110, 247, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.chat-records-admin__folder-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(79, 110, 247, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f6ef7;
  font-size: 20px;
}

.chat-records-admin__detail {
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-records-admin__detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.chat-records-admin__detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-records-admin__detail-title {
  margin: 0;
  font-size: 18px;
}

.chat-records-admin__detail-subtitle {
  margin: 6px 0 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.chat-records-admin__messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-records-admin__pair {
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 14px;
  background: #fdfdff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-records-admin__pair-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--admin-muted);
}

.chat-records-admin__mode-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  white-space: nowrap;
}

.chat-records-admin__message {
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fafafa;
}

.chat-records-admin__message.user {
  border-left: none;
}

.chat-records-admin__message.assistant {
  border-left: none;
}

.chat-records-admin__message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--admin-muted);
  margin-bottom: 8px;
}

.chat-records-admin__message.user .chat-records-admin__message-header span:first-child {
  color: var(--admin-accent);
  font-weight: 700;
}

.chat-records-admin__message-body {
  font-size: 14px;
  line-height: 1.6;
  color: #1f2937;
  /* 不用 word-break:break-word：它会在任意位置硬断，公式/英文标识符会被切成残缺符号。
     与 .render-rich-surface 基面保持一致，只在长串放不下时才断行。 */
  overflow-wrap: anywhere;
  word-break: normal;
  min-width: 0;
  max-width: 100%;
}

/* 聊天记录里的代码块在气泡内横向滚动，避免超长行被气泡/弹窗裁掉 */
.chat-records-admin__message-body pre {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 行间公式同样给横向滚动兜底（低端/纯 HTML 渲染没有 .render-rich-surface 时也生效） */
.chat-records-admin__message-body mjx-container[display="true"],
.chat-records-admin__message-body :is(.MathJax_Display, .math-display, .mjx-display) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-records-admin__render-target {
  min-width: 0;
  max-width: 100%;
}

.chat-records-admin__render-target--warning {
  outline: 1px dashed rgba(245, 158, 11, 0.45);
  outline-offset: 3px;
}

.chat-records-admin__message.user .chat-records-admin__message-body {
  color: var(--admin-accent);
  font-weight: 600;
}

.chat-records-admin__message-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--admin-muted);
}

.chat-records-admin__hint {
  font-size: 13px;
  color: var(--admin-muted);
}

.chat-records-admin__empty {
  border: 1px dashed var(--admin-border);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--admin-muted);
}

@media (max-width: 768px) {
  .chat-records-admin__folder-grid {
    grid-template-columns: 1fr;
  }
}
