.inlineCreativeAgentMessage.assistant {
  align-items: stretch;
  display: grid;
  gap: 4px 8px;
  grid-template-areas:
    "assets assets"
    "bubble bubble"
    "actions time";
  grid-template-columns: minmax(0, 1fr) auto;
  position: relative;
}

.inlineCreativeAgentMessage.assistant .inlineCreativeAgentMessageAssets {
  grid-area: assets;
}

.inlineCreativeAgentMessage.assistant .inlineCreativeAgentMessageBubble {
  grid-area: bubble;
  width: 100%;
}

.inlineCreativeAgentMessage.assistant.lj-ai-document-host .inlineCreativeAgentMessageBubble {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.inlineCreativeAgentMessage.assistant > .inlineCreativeAgentMessageTime {
  align-self: center;
  grid-area: time;
  justify-self: end;
}

.lj-ai-response-raw[hidden] {
  display: none !important;
}

.lj-ai-rich-response {
  color: inherit;
  display: grid;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.lj-ai-response-body {
  color: inherit;
  display: grid;
  font-size: 14px;
  gap: 10px;
  line-height: 1.78;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lj-ai-response-body :where(h2, h3, h4) {
  color: #25262b;
  line-height: 1.35;
  margin: 10px 0 0;
}

.lj-ai-response-body h2 {
  font-size: 18px;
}

.lj-ai-response-body h3 {
  font-size: 16px;
}

.lj-ai-response-body h4 {
  font-size: 14px;
}

.lj-ai-response-body :where(p, ul, ol, blockquote) {
  margin: 0;
}

.lj-ai-response-body :where(ul, ol) {
  display: grid;
  gap: 5px;
  padding-left: 22px;
}

.lj-ai-response-body blockquote {
  background: #f5f5f3;
  border-left: 3px solid #8e8f89;
  border-radius: 0 10px 10px 0;
  color: #5d5e63;
  padding: 9px 12px;
}

.lj-ai-response-body hr {
  border: 0;
  border-top: 1px solid #e5e5e2;
  margin: 4px 0;
  width: 100%;
}

.lj-ai-response-body a {
  color: #5d4cc5;
  text-decoration: underline;
  text-decoration-color: #5d4cc566;
  text-underline-offset: 3px;
}

.lj-ai-response-body p > code,
.lj-ai-response-body li > code,
.lj-ai-response-body td > code {
  background: #efefed;
  border: 1px solid #e1e1de;
  border-radius: 5px;
  color: #414248;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: .9em;
  padding: 1px 5px;
}

.lj-ai-table-scroll {
  border: 1px solid #dededb;
  border-radius: 12px;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
}

.lj-ai-table-scroll:focus-visible {
  outline: 2px solid #6252cd55;
  outline-offset: 2px;
}

.lj-ai-table-scroll table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.6;
  min-width: 760px;
  width: 100%;
}

.lj-ai-table-scroll :where(th, td) {
  border-bottom: 1px solid #e6e6e3;
  border-right: 1px solid #e6e6e3;
  padding: 11px 13px;
  vertical-align: top;
}

.lj-ai-table-scroll th {
  background: #f4f4f1;
  color: #3a3b40;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.lj-ai-table-scroll tr:last-child td {
  border-bottom: 0;
}

.lj-ai-table-scroll :where(th, td):last-child {
  border-right: 0;
}

.lj-ai-table-scroll tbody tr:nth-child(even) td {
  background: #fafaf8;
}

@media (max-width: 640px) {
  .lj-ai-table-scroll {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .lj-ai-table-scroll table,
  .lj-ai-table-scroll tbody,
  .lj-ai-table-scroll tr,
  .lj-ai-table-scroll td {
    display: block;
  }

  .lj-ai-table-scroll table {
    min-width: 0;
  }

  .lj-ai-table-scroll thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .lj-ai-table-scroll tbody {
    display: grid;
    gap: 10px;
  }

  .lj-ai-table-scroll tbody tr {
    background: #ffffff;
    border: 1px solid #dededb;
    border-radius: 12px;
    padding: 7px 12px;
  }

  .lj-ai-table-scroll tbody tr:nth-child(even) td {
    background: transparent;
  }

  .lj-ai-table-scroll td {
    align-items: start;
    border: 0;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(4.5em, 5.5em) minmax(0, 1fr);
    padding: 7px 0;
    text-align: left !important;
  }

  .lj-ai-table-scroll td::before {
    color: #77787e;
    content: attr(data-label);
    font-size: .88em;
    font-weight: 700;
  }
}

.lj-ai-code-block {
  background: #ffffff;
  border: 1px solid #dededb;
  border-radius: 12px;
  color: #34353a;
  min-width: 0;
  overflow: hidden;
}

.lj-ai-code-block > header {
  align-items: center;
  background: #f7f7f4;
  border-bottom: 1px solid #e6e6e3;
  display: flex;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 10px 0 13px;
}

.lj-ai-code-block > header span {
  color: #77787e;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  text-transform: lowercase;
}

.lj-ai-code-copy {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #5f6066;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  padding: 5px 8px;
}

.lj-ai-code-copy:hover,
.lj-ai-code-copy:focus-visible {
  background: #ecece8;
  color: #33343a;
}

.lj-ai-code-copy:focus-visible {
  outline: 2px solid #6252cd55;
  outline-offset: 1px;
}

.lj-ai-code-block pre {
  margin: 0;
  max-height: 460px;
  overflow: auto;
  padding: 14px;
  white-space: pre;
}

.lj-ai-code-block code {
  color: inherit;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.65;
}

/* ---- 回复操作：默认隐藏，悬停/聚焦该条消息时在卡片底部元信息行浮现 ---- */

.lj-ai-response-actions {
  align-items: center;
  display: flex;
  grid-area: actions;
  justify-self: start;
  min-height: 22px;
  padding: 0 2px;
  position: static;
}

.lj-ai-copy-icon {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #77787e;
  cursor: pointer;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  transition: background-color .16s ease, color .16s ease, opacity .16s ease;
  width: 26px;
}

.lj-ai-copy-icon svg {
  height: 15px;
  width: 15px;
}

.lj-ai-copy-icon:hover,
.lj-ai-copy-icon:focus-visible {
  background: #ecece8;
  color: #33343a;
}

.inlineCreativeAgentMessage.assistant:hover .lj-ai-copy-icon,
.inlineCreativeAgentMessage.assistant:focus-within .lj-ai-copy-icon,
.lj-ai-rich-response:hover .lj-ai-copy-icon,
.lj-ai-rich-response:focus-within .lj-ai-copy-icon,
.lj-ai-document-modal-header:hover .lj-ai-copy-icon,
.lj-ai-document-modal-header:focus-within .lj-ai-copy-icon {
  opacity: 1;
  pointer-events: auto;
}

/* 文档预览是明确的操作场景；复制全文在触屏设备上不依赖 hover 才可见。 */
.lj-ai-document-modal-header .lj-ai-copy-icon {
  opacity: 1;
  pointer-events: auto;
}

.lj-ai-copy-icon:focus-visible {
  outline: 2px solid #6252cd55;
  outline-offset: 1px;
}

/* ---- 文档产物：对话里单独显示成一份“文件”（像微信发文件），点击打开预览 ---- */

.lj-ai-document-message {
  background: #ffffff;
  border: 1px solid #dededb;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgb(36 37 42 / 7%);
  min-width: 0;
  overflow: hidden;
}

.lj-ai-document-file {
  align-items: center;
  appearance: none;
  background: #ffffff;
  border: 0;
  border-radius: 14px;
  color: inherit;
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 13px;
  justify-content: flex-start;
  min-width: 0;
  padding: 13px 14px;
  text-align: left;
  transition: background-color .16s ease;
  width: 100%;
}

.lj-ai-document-file:hover,
.lj-ai-document-file:focus-visible {
  background: #f7f6fb;
}

.lj-ai-document-file:focus-visible {
  outline: 2px solid #6252cd55;
  outline-offset: -2px;
}

.lj-ai-document-thumb {
  align-items: center;
  background: #efeafc;
  border-radius: 10px;
  color: #5b4cc4;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 1px;
  height: 46px;
  justify-content: center;
  width: 44px;
}

.lj-ai-document-thumb svg {
  height: 20px;
  width: 20px;
}

.lj-ai-document-ext {
  color: #5b4cc4;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
}

.lj-ai-document-lines {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.lj-ai-document-name {
  color: #25262b;
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lj-ai-document-meta {
  color: #8a8b85;
  font-size: 10px;
  line-height: 1.5;
}

.lj-ai-document-open-label {
  align-items: center;
  background: #f3f1fb;
  border-radius: 9px;
  color: #5b4cc4;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  padding: 6px 10px;
  white-space: nowrap;
}

/* ---- 文档预览弹窗 ---- */

.lj-ai-document-modal {
  align-items: center;
  background: rgb(19 19 22 / 55%);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 9999;
}

.lj-ai-document-modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 30px 70px rgb(0 0 0 / 28%);
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 900px);
  max-width: 860px;
  overflow: hidden;
  width: 100%;
}

.lj-ai-document-modal-header {
  align-items: center;
  background: #f6f6f3;
  border-bottom: 1px solid #e6e6e2;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-width: 0;
  padding: 12px 16px;
}

.lj-ai-document-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.lj-ai-document-kind {
  color: #6658c7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.lj-ai-document-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.lj-ai-document-download {
  appearance: none;
  background: #5b4cc4;
  border: 1px solid #5b4cc4;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgb(91 76 196 / 22%);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  justify-content: center;
  min-height: 32px;
  padding: 0 13px;
  white-space: nowrap;
}

.lj-ai-document-download:hover,
.lj-ai-document-download:focus-visible {
  background: #4e40b0;
  border-color: #4e40b0;
}

.lj-ai-document-download:focus-visible {
  outline: 2px solid #6252cd55;
  outline-offset: 1px;
}

.lj-ai-document-close {
  appearance: none;
  background: #ffffff;
  border: 1px solid #d9d9d4;
  border-radius: 9px;
  color: #4c4d52;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  justify-content: center;
  min-height: 32px;
  padding: 0 13px;
  white-space: nowrap;
}

.lj-ai-document-close:hover,
.lj-ai-document-close:focus-visible {
  background: #f1f1ed;
  border-color: #cfcfc9;
  color: #2e2f34;
}

.lj-ai-document-close:focus-visible {
  outline: 2px solid #6252cd55;
  outline-offset: 1px;
}

.lj-ai-document-modal-scroll {
  background: #ffffff;
  overflow: auto;
}

.lj-ai-document-modal-scroll .lj-ai-document-paper {
  padding: 26px 32px 32px;
}

body.lj-ai-modal-open {
  overflow: hidden;
}

.lj-ai-document-paper {
  background: #ffffff;
  color: #26272b;
  padding: 20px 24px 24px;
}

.lj-ai-document-paper .lj-ai-response-body {
  font-size: 15px;
  gap: 12px;
  line-height: 1.9;
}

.lj-ai-document-paper h1 {
  color: #1f2024;
  font-size: 22px;
  line-height: 1.4;
  margin: 2px 0 4px;
}

.lj-ai-document-paper h2 {
  font-size: 19px;
  margin-top: 16px;
}

.lj-ai-document-paper h3 {
  font-size: 16px;
  margin-top: 12px;
}

.lj-ai-document-paper h4 {
  font-size: 14px;
  margin-top: 10px;
}

.lj-ai-document-paper .lj-ai-table-scroll {
  border-color: #d8d8d3;
  margin: 12px 0;
}

.lj-ai-document-paper .lj-ai-table-scroll table {
  font-size: 13px;
  line-height: 1.65;
}

.lj-ai-document-paper .lj-ai-table-scroll th {
  background: #efefeb;
  color: #33343a;
}

.lj-ai-document-paper .lj-ai-code-block {
  margin: 4px 0;
}

.lj-ai-document-paper blockquote {
  margin: 4px 0;
}

@media (max-width: 620px) {
  .lj-ai-response-body {
    font-size: 13px;
    gap: 9px;
  }

  .lj-ai-table-scroll table {
    min-width: 540px;
  }

  .lj-ai-code-block pre {
    max-height: 360px;
  }

  .lj-ai-document-modal {
    align-items: flex-end;
    padding: 0;
  }

  .lj-ai-document-modal-dialog {
    border-radius: 18px 18px 0 0;
    max-height: 94vh;
  }

  .lj-ai-document-modal-scroll .lj-ai-document-paper {
    padding: 18px 16px 24px;
  }

  .lj-ai-document-paper .lj-ai-response-body {
    font-size: 14px;
    line-height: 1.82;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lj-ai-copy-icon,
  .lj-ai-code-copy,
  .lj-ai-document-download,
  .lj-ai-document-close,
  .lj-ai-document-file {
    transition: none;
  }
}
