/* 对话阅读规范：只调整显示，保留原消息、Markdown 结构与业务事件。 */
body .container-main.legaleasy-unified,
body .app-shell {
  --le-reading-font: 16px;
  --le-reading-leading: 1.9;
  --le-reading-paragraph: 16px;
  --le-reading-message-gap: 28px;
  --le-reading-font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

/* 两种页面结构共用同一套正文规则。 */
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) {
  min-width: 0;
  color: #334155;
  font-family: var(--le-reading-font-family);
  font-size: var(--le-reading-font);
  font-weight: 400;
  line-height: var(--le-reading-leading);
  letter-spacing: .01em;
  text-align: left;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: auto;
  background: transparent;
}
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(p,li,blockquote) {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(p,ul,ol,blockquote,pre,table) { margin: 0 0 var(--le-reading-paragraph); }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) > :last-child { margin-bottom: 0; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(h1,h2,h3,h4,h5,h6) {
  margin: 28px 0 12px;
  padding: 0;
  border: 0;
  color: #1e293b;
  font-weight: 650;
  line-height: 1.5;
  scroll-margin-top: 16px;
}
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) > :is(h1,h2,h3,h4,h5,h6):first-child { margin-top: 0; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) h1 { font-size: 24px; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) h2 { font-size: 20px; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) h3 { font-size: 18px; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(h4,h5,h6) { font-size: 16px; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(strong,b) { color: #1e293b; font-weight: 650; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(ul,ol) { padding-left: 1.5em; list-style-position: outside; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) ul { list-style-type: disc; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) ol { list-style-type: decimal; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) li { margin: 8px 0; padding-left: .15em; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) li::marker { color: #64748b; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) li > :is(p,ul,ol) { margin-top: 6px; margin-bottom: 6px; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) ul ul { list-style-type: circle; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) blockquote { padding: 12px 16px; border-left: 3px solid #ccdbee; border-radius: 0 12px 12px 0; background: #f8fafc; color: #475569; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) blockquote > :last-child { margin-bottom: 0; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) a { color: #286bc1; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) a:hover { color: #174c91; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) hr { height: 0; margin: 28px 0; border: 0; border-top: 1px solid #e2e8f0; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) table { display: block; max-width: 100%; width: max-content; overflow-x: auto; border-collapse: collapse; font-size: 14px; line-height: 1.75; overscroll-behavior-inline: contain; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(th,td) { min-width: 7.5em; max-width: 26em; padding: 10px 12px; border: 1px solid #e2e8f0; vertical-align: top; text-align: left; white-space: normal; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) th { color: #334155; background: #f1f5f9; font-weight: 650; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) table:has(tr > :nth-child(5)) :is(th,td) { min-width: 12em; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(th,td)[align="center"] { text-align: center; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(th,td)[align="right"] { text-align: right; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) code { padding: .15em .35em; border-radius: 5px; background: #f1f5f9; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .875em; letter-spacing: 0; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) pre { max-width: 100%; padding: 16px; overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; font-size: 14px; line-height: 1.7; letter-spacing: 0; overscroll-behavior-inline: contain; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) pre :is(code,.md-editor-code-block) { padding: 0; border: 0; background: transparent; font-size: inherit; white-space: pre !important; word-break: normal !important; overflow-wrap: normal; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(table,pre) { overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(table,pre)::-webkit-scrollbar { display: block; height: 6px; }
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) :is(table,pre)::-webkit-scrollbar-thumb { border-radius: 6px; background: #cbd5e1; }

body .container-main.legaleasy-unified .messages-container > .message { margin: 0; }
body .container-main.legaleasy-unified .messages-container > .message + .message { margin-top: var(--le-reading-message-gap); }
body .container-main.legaleasy-unified .messages-container > .message.ai { width: 100%; max-width: 100%; min-width: 0; }
body .container-main.legaleasy-unified .messages-container > .message.user { max-width: min(88%,660px); }
body .container-main.legaleasy-unified .messages-container .message.ai .message-text { --md-bk-color: transparent; margin: 0; padding: 0; border-radius: 0; background: transparent; }
body .container-main.legaleasy-unified .messages-container .message.ai .preview-wrapper { min-width: 0; padding-bottom: 36px; }
body .container-main.legaleasy-unified .messages-container .message.ai :is(.copy-icon,.copy-icon2) { display: inline-flex; align-items: center; justify-content: center; left: 0; bottom: 0; width: 28px; height: 28px; border-radius: 8px; }
body .container-main.legaleasy-unified .messages-container .message.user .message-text,
body .app-shell .conversation .user-bubble { margin: 0; padding: 12px 16px; color: #334155; font-family: var(--le-reading-font-family); font-size: var(--le-reading-font); line-height: 1.8; letter-spacing: .01em; }
body .container-main.legaleasy-unified .messages-container .message.user .aligned-text { color: inherit; font-size: inherit; line-height: inherit; }
body .container-main.legaleasy-unified .messages-container .message.user .legaleasy-user-markdown { background: transparent; }
body .container-main.legaleasy-unified .messages-container .message.user .md-editor-preview-wrapper { padding: 0; }
body .container-main.legaleasy-unified .messages-container .message.user .md-editor-preview { padding: 0; color: inherit; text-align: left; }
body .container-main.legaleasy-unified .messages-container .message.user .md-editor-preview > :last-child { margin-bottom: 0; }
body .container-main.legaleasy-unified .messages-container .md-editor-preview input[type="checkbox"] { width: 15px; height: 15px; margin: 0 7px 0 0; vertical-align: middle; accent-color: #3b82f6; pointer-events: none; }
body .container-main.legaleasy-unified .messages-container .md-editor-preview .task-list-item { list-style: none; }

/* 隐藏对话轨道的纵向滚动条，仍保留鼠标、触控和键盘滚动。 */
body .container-main.legaleasy-unified .conver-main .messages-container,
body .container-main.legaleasy-unified .conver-content:has(.opening),
body .app-shell .content-scroll { scrollbar-width: none !important; }
body .container-main.legaleasy-unified .conver-main .messages-container::-webkit-scrollbar,
body .container-main.legaleasy-unified .conver-content:has(.opening)::-webkit-scrollbar,
body .app-shell .content-scroll::-webkit-scrollbar { display: none !important; width: 0; }
@media(min-width:801px) {
  body .container-main.legaleasy-unified.legaleasy-desktop-workspace .conver-main .messages-container { width: 100%; max-width: 840px; margin-inline: auto; padding: 0 0 12px; }
  body .app-shell.legaleasy-desktop-workspace .content-scroll { width: 100%; max-width: 840px; margin-inline: auto; }
}
body .container-main.legaleasy-unified .input-actions .n-button { color: #64748b !important; }
body .container-main.legaleasy-unified .input-actions svg { width: 22px; height: 22px; }
body .container-main.legaleasy-unified .input-actions .legaleasy-upload-action:not([aria-disabled="true"]) { color: #507bad !important; }
body .container-main.legaleasy-unified .input-actions .legaleasy-upload-action[aria-disabled="true"] { color: #a4afbd !important; cursor: help; }
body .container-main.legaleasy-unified .input-actions .legaleasy-upload-action[aria-disabled="true"]:hover { background: #f4f6f9; }
body .container-main.legaleasy-unified .files svg { width: 20px; height: 20px; color: #64748b; }
body .container-main.legaleasy-unified .files .close svg { width: 18px; height: 18px; }
body .container-main.legaleasy-unified .copy-icon svg,
body .container-main.legaleasy-unified .copy-icon2 svg { width: 18px; height: 18px; color: #64748b; }
body .container-main.legaleasy-unified :is(.copy-icon,.copy-icon2):focus-visible { outline: 2px solid #b9d5f7; outline-offset: 2px; }
#legaleasy-qr-dialog .legaleasy-qr-close svg { width: 20px; height: 20px; }
body .container-main.legaleasy-unified .modal-overlay .close-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; }
body .app-shell .attach-button[aria-disabled="true"] { color: #a4afbd; cursor: help; }
.preview-dialog .dialog-close svg, .attachment-chip button svg { width: 20px; height: 20px; }
body .app-shell .conversation .message { margin-bottom: var(--le-reading-message-gap); }
body .app-shell .conversation .message + .message { margin-top: 0; }
body .app-shell .conversation .message-assistant .message-body { width: 100%; max-width: 100%; min-width: 0; }
body .app-shell .conversation .message-user .message-body { max-width: min(88%,660px); }
body .app-shell .conversation .answer-footer { color: #94a3b8; font-size: 12px; letter-spacing: 0; line-height: 1.6; }

@media (min-width: 801px) {
  body .container-main.legaleasy-unified .conver-main .messages-container { padding: 0 max(0px,calc((100% - 840px)/2)) 12px; }
  body .app-shell .conversation { max-width: 840px; }
}
@media (max-width: 800px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  body .container-main.legaleasy-unified, body .app-shell { --le-reading-leading: 1.85; --le-reading-message-gap: 24px; }
  body .container-main.legaleasy-unified .conver-main .messages-container { padding: 0 0 12px; }
  body .container-main.legaleasy-unified .messages-container > .message.ai { width: 100%; max-width: 100%; }
  body .container-main.legaleasy-unified .messages-container > .message.user { max-width: 94%; }
  body .container-main.legaleasy-unified .messages-container .message.ai .preview-wrapper { padding-bottom: 48px; }
  body .container-main.legaleasy-unified .messages-container .message.ai :is(.copy-icon,.copy-icon2) { width: 44px; height: 44px; opacity: .7; }
  body .app-shell .conversation .message-assistant .message-body { width: 100%; }
  body .app-shell .conversation .message-user .message-body { max-width: 94%; }
  :is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) h1 { font-size: 22px; }
  :is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) h2 { font-size: 19px; }
  :is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) h3 { font-size: 17px; }
}
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) table.legaleasy-balanced-table {
  display: table; width: 100%; min-width: 760px; table-layout: fixed; overflow-wrap: anywhere;
}
:is(body .container-main.legaleasy-unified .messages-container .md-editor-preview, body .app-shell .conversation .answer-card) table.legaleasy-balanced-table :is(th,td) {
  min-width: 0; max-width: none; padding: 10px 8px;
}
.legaleasy-table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; margin-bottom: 18px; scrollbar-width: thin; }
