/* 阅读与后续编辑共用纸张及块样式，观感对齐 Word：灰色工作区、白色页面、左侧导航窗格与 Office 主题排版。所有覆盖均限定在本阅读器。 */
.docx-viewer {
  --ed-canvas-bg: #e8e8ea;
  --docx-ink: #1f1f1f;
  --docx-muted: #605e5c;
  --docx-accent: #2b579a;
  --docx-heading: #2f5496;
  --docx-chrome: #f6f6f7;
  --docx-chrome-line: #d8d8da;
  --docx-body-font: Calibri, Carlito, "DengXian", "等线", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --docx-heading-font: "Calibri Light", Calibri, Carlito, "DengXian Light", "等线 Light", "DengXian", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--ed-canvas-bg);
}
.docx-viewer .ed-workspace { background: var(--ed-canvas-bg); }
.docx-viewer .ed-sidebar { flex-basis: 248px; width: 248px; padding: 16px 8px 16px 12px; border-right: 1px solid var(--docx-chrome-line); background: var(--docx-chrome); }
.docx-viewer .ed-sidebar-content { position: sticky; top: 80px; max-height: calc(100dvh - 130px); overflow-y: auto; scrollbar-width: thin; }
.ed-shell.docx-viewer .ed-stage { padding: 28px 32px 40px; }
.ed-shell.docx-viewer .ed-canvas-card { max-width: none; min-height: 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
.docx-viewer .ed-toolbar { grid-template-columns: minmax(150px,1fr) auto auto; gap: 16px; border-bottom-color: var(--docx-chrome-line); }
.docx-viewer .ed-toolbar-center { overflow: visible; }
.docx-viewer .ed-statusbar { position: sticky; bottom: 0; z-index: 15; min-height: 28px; padding-block: 3px; border-top-color: var(--docx-chrome-line); background: var(--docx-chrome); color: var(--docx-muted); }
.docx-tools { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; }
.docx-zoom, .docx-search, .docx-search-step { height: 30px; border: 1px solid #c8c8ca; border-radius: 4px; background: #fff; color: #323130; font: inherit; }
.docx-zoom { width: 78px; padding: 0 6px; cursor: pointer; }
.docx-search { width: 170px; min-width: 0; padding: 0 10px; }
.docx-search:focus { border-color: var(--docx-accent); }
.docx-search::placeholder { color: #605e5c; opacity: 1; }
.docx-search-step { width: 30px; padding: 0; cursor: pointer; font-size: 15px; }
.docx-search-step:hover { background: #ededee; }
.docx-search-step:disabled { cursor: default; color: #8a8886; background: #f3f3f4; }
.docx-search-count { min-width: 44px; color: var(--docx-muted); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.docx-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; width: max-content; min-width: 100%; }
.docx-page { position: relative; flex: none; box-sizing: border-box; border: 0; background: #fff; color: var(--docx-ink); box-shadow: 0 0 0 1px #00000012, 0 1px 3px #0000001f, 0 6px 16px -6px #00000029; }
.docx-page-body { display: flow-root; min-width: 0; font: 11pt/1.65 var(--docx-body-font); overflow-wrap: anywhere; }
.docx-viewer .docx-page-body .docx-paragraph { margin-top: 0; margin-bottom: 10pt; color: inherit; line-height: 1.65; white-space: pre-wrap; }
.docx-viewer .docx-page-body :is(h1,h2,h3,h4,h5,h6) { font-family: var(--docx-heading-font); color: var(--docx-heading); letter-spacing: 0; }
.docx-viewer .docx-page-body h1 { margin: 20pt 0 10pt; font-size: 18pt; line-height: 1.3; font-weight: 600; }
.docx-viewer .docx-page-body h2 { margin: 16pt 0 8pt; font-size: 14pt; line-height: 1.35; font-weight: 600; }
.docx-viewer .docx-page-body h3 { margin: 14pt 0 6pt; font-size: 12pt; line-height: 1.4; font-weight: 600; color: #1f3763; }
.docx-viewer .docx-page-body h4, .docx-viewer .docx-page-body h5, .docx-viewer .docx-page-body h6 { margin: 10pt 0 3pt; font-size: 11pt; line-height: 1.4; font-weight: 600; font-style: italic; }
.docx-viewer .docx-page-body .docx-title { margin: 0 0 10pt; font-size: 28pt; line-height: 1.2; font-weight: 400; color: var(--docx-ink); letter-spacing: -.01em; }
.docx-viewer .docx-page-body blockquote { margin: 10pt 36pt; padding: 0; border: 0; background: none; color: #404040; font-style: italic; }
.docx-text { white-space: pre-wrap; }
.docx-text:empty::after { content: '\200b'; }
.docx-text a { color: #0563c1; text-decoration: underline; text-underline-offset: 2px; }
.docx-list { display: flow-root; margin: 0 0 4pt; padding-left: calc(21pt + var(--docx-list-level,0) * 18pt); }
.docx-viewer .docx-list .docx-paragraph { margin-bottom: 0; padding-left: 2pt; }
.docx-list li::marker { color: var(--docx-ink); }
.docx-viewer .docx-page .docx-table { table-layout: fixed; width: 100%; margin: 6pt 0 10pt; border-collapse: collapse; white-space: normal; font-size: 10.5pt; }
.docx-viewer .docx-table th, .docx-viewer .docx-table td { min-width: 0; padding: 5pt 6pt; border: .75pt solid #5f5f5f; background: #fff; color: var(--docx-ink); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.docx-viewer .docx-table th { background: #fff; font-weight: 700; }
.docx-viewer .docx-table tr:nth-child(odd) td { background: #fff; }
.docx-viewer .docx-table .docx-paragraph { margin: 0; line-height: 1.4; }
.docx-image { display: block; max-width: 100%; height: auto; margin: 6pt 0; object-fit: fill; }
.docx-paragraph[style*="text-align: center"] .docx-image { margin-inline: auto; }
.docx-paragraph[style*="text-align: right"] .docx-image { margin-left: auto; }
.docx-page-header, .docx-page-footer { position: absolute; left: var(--docx-margin-left); right: var(--docx-margin-right); display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--docx-muted); font: 9pt/1.4 var(--docx-body-font); }
.docx-page-header { top: 0; height: var(--docx-margin-top); }
.docx-page-footer { bottom: 0; height: var(--docx-margin-bottom); }
.docx-viewer .docx-page-header .docx-paragraph, .docx-viewer .docx-page-footer .docx-paragraph { margin: 0; font: inherit; color: inherit; }
.docx-page-number { margin-left: auto; font-variant-numeric: tabular-nums; }
.docx-viewer [data-block-id] { scroll-margin-top: 100px; }
.docx-viewer [data-block-id]:focus { outline: none; }
.docx-viewer [data-block-id]:focus-visible { outline: 2px solid var(--ed-blue); outline-offset: 4px; }
/* 导航窗格：按标题层级缩进，当前位置用 Word 蓝标示。 */
.docx-toc-title { margin: 2px 0 12px 8px; color: var(--docx-ink); font-size: 15px; font-weight: 600; letter-spacing: 0; }
.docx-toc-link { display: block; width: 100%; padding: 6px 8px 6px calc(8px + (var(--docx-heading-level,1) - 1) * 14px); border: 0; border-left: 3px solid transparent; border-radius: 0; background: transparent; color: #323130; font: 13px/1.5 var(--ed-font); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.docx-toc-link:hover { background: #e9e9eb; color: var(--docx-ink); }
.docx-toc-link[aria-current] { border-left-color: var(--docx-accent); background: #dfe7f3; color: #1b3f77; font-weight: 600; }
.docx-toc-empty { margin-left: 8px; font-size: 12px; color: var(--docx-muted); }
.docx-search-hit { padding: 0; border-radius: 1px; background: #ffe98f; color: var(--docx-ink); }
.docx-search-current { background: #ffb900; box-shadow: 0 0 0 1px #c98b00; }
@media (max-width: 1000px) and (min-width: 701px) {
  .docx-viewer .ed-toolbar { grid-template-columns: minmax(0,1fr) auto; }
  .docx-viewer .ed-toolbar-center { grid-column: 1 / -1; grid-row: 2; }
  .docx-viewer .ed-toolbar-end { grid-row: 1; grid-column: 2; }
  .docx-viewer .ed-sidebar { flex-basis: 200px; width: 200px; }
}
@media (max-width: 700px) {
  .docx-viewer .ed-toolbar { grid-template-columns: minmax(0,1fr); gap: 4px; padding: 8px 10px; }
  .docx-viewer .ed-toolbar-end { display: none; }
  .docx-viewer .ed-toolbar-center { grid-row: 2; height: 48px; padding: 0; width: 100%; }
  .docx-tools { width: 100%; gap: 4px; }
  .docx-zoom { width: 68px; flex-shrink: 0; }
  .docx-search { width: 0; flex: 1; }
  .docx-zoom, .docx-search, .docx-search-step { height: 44px; font-size: 12px; }
  .docx-search-step { width: 36px; flex-shrink: 0; }
  .docx-search-count { min-width: 42px; }
  .ed-shell.docx-viewer .ed-stage { padding: 12px 8px 24px; overflow-x: hidden; }
  .docx-pages { align-items: stretch; width: 100%; }
  .docx-viewer .docx-page { width: 100% !important; min-width: 0; min-height: 0 !important; padding: 56px 22px 62px !important; zoom: 1 !important; }
  .docx-page-body { font-size: 11pt; }
  .docx-viewer .docx-page-body h1 { font-size: 17pt; }
  .docx-viewer .docx-page-body .docx-title { font-size: 23pt; }
  .docx-viewer .docx-table th, .docx-viewer .docx-table td { padding: 6px; }
  .docx-page-header, .docx-page-footer { left: 22px; right: 22px; font-size: 7.5pt; }
  .docx-page-header { height: 42px; }
  .docx-page-footer { height: 48px; }
  .docx-viewer .ed-sidebar { width: min(300px,85vw); padding: 16px; }
  .docx-viewer .ed-sidebar-content { position: static; max-height: none; }
  .docx-toc-link { min-height: 44px; }
  .docx-viewer [data-block-id] { scroll-margin-top: 140px; }
}

/* 编辑器组合阅读画布；格式栏沿用 Word 功能区的浅灰底与蓝色按下态。工具和交互覆盖不影响 C5 只读实例。 */
.docx-editor { min-width: 0; background: #e8e8ea; }
.docx-editor .docx-formatbar { position: sticky; top: 64px; z-index: 19; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; padding: 6px 16px; border-bottom: 1px solid #d8d8da; background: #f6f6f7; }
.docx-editor .docx-format-button, .docx-editor .docx-style-select, .docx-editor .docx-color-control { box-sizing: border-box; min-width: 32px; height: 32px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #323130; font: 14px/1 var(--ed-font); cursor: pointer; }
.docx-editor .docx-format-button { padding: 0 9px; }
.docx-editor .docx-format-button:hover, .docx-editor .docx-color-control:hover { background: #e5e5e7; border-color: #d0d0d2; }
.docx-editor .docx-format-button:disabled { color: #a19f9d; cursor: default; }
.docx-editor .docx-format-button[aria-label="Bold"] { font-weight: 750; }
.docx-editor .docx-format-button[aria-label="Italic"] { font-style: italic; }
.docx-editor .docx-format-button[aria-label="Underline"] { text-decoration: underline; }
.docx-editor .docx-format-button[aria-label="Strikethrough"] { text-decoration: line-through; }
.docx-editor .docx-style-select { width: 112px; padding: 0 8px; border-color: #c8c8ca; background: #fff; margin: 0 8px; }
.docx-editor .docx-color-control { position: relative; display: grid; place-items: center; width: 32px; border-bottom: 3px solid #c00000; }
.docx-editor .docx-color-control:has(input[aria-label="Highlight color"]) { border-bottom-color: #ffd400; }
.docx-editor .docx-color-control input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.docx-editor .docx-save-button { margin-left: 12px; border-color: #2b579a; background: #2b579a; color: #fff; font-size: 13px; }
.docx-editor .docx-save-button:hover { border-color: #1e4279; background: #1e4279; }
.docx-editor .docx-edit-message { margin-left: 16px; color: #605e5c; font-size: 12px; }
.docx-editor .docx-text[contenteditable] { display: block; min-height: 1em; border-radius: 2px; outline: 0; caret-color: #2b579a; cursor: text; }
.docx-editor .docx-text[contenteditable]:focus { box-shadow: -2px 0 0 -1px #9ab7db; }
.docx-editor .docx-text[contenteditable]::selection, .docx-editor .docx-text[contenteditable] *::selection { background: #c8ddfa; color: inherit; }
.docx-editor .docx-table td:focus-within, .docx-editor .docx-table th:focus-within { outline: 2px solid #709bce; outline-offset: -2px; background: #f8fbff; }
.docx-editor .docx-page-body a { cursor: text; }
.docx-editor .docx-formatbar :focus-visible { outline: 2px solid #2b579a; outline-offset: 2px; }
@media (max-width: 700px) {
  .docx-editor .docx-formatbar { top: 106px; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding: 6px 8px; gap: 2px; }
  .docx-editor .docx-formatbar > * { flex-shrink: 0; }
  .docx-editor .docx-format-button, .docx-editor .docx-style-select, .docx-editor .docx-color-control { min-width: 44px; height: 44px; }
  .docx-editor .docx-style-select { margin: 0 4px; }
  .docx-editor .docx-save-button { position: sticky; right: 0; z-index: 1; box-shadow: -8px 0 8px #f6f6f7; }
  .docx-editor .docx-edit-message { max-width: 180px; margin-left: 8px; }
}

.docx-editor .docx-search-hit { color: inherit; }

.docx-editor .docx-format-button[aria-pressed="true"] { color: #1b3f77; background: #d6e0ef; border-color: #b9c9e2; }

.docx-editor .docx-save-button:disabled { color: #fff; opacity: .55; }

/* —— 直接体验：看上去就是 Word —— 顶部一条功能区（只读态与编辑态同一位置、同一外观），页面居中在灰色工作区，底部状态栏左侧是页数字数、右侧是搜索与缩放。 */
.docx-ribbon svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ed-direct .docx-ribbon { position: sticky; top: 0 !important; z-index: 19; display: flex; align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 2px; min-height: 44px; padding: 6px 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #d2d2d4; background: #f3f3f3; }
.ed-direct .docx-ribbon > * { flex: none; }
.ed-direct .docx-ribbon .docx-format-button, .ed-direct .docx-ribbon .docx-color-control { box-sizing: border-box; display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #323130; font: 14px/1 var(--ed-font); cursor: pointer; }
.ed-direct .docx-ribbon .docx-format-button:hover, .ed-direct .docx-ribbon .docx-color-control:hover { background: #e1e1e3; }
.ed-direct .docx-ribbon .docx-format-button[aria-pressed="true"] { background: #cfd9ea; border-color: #b9c9e2; color: #1b3f77; }
.ed-direct .docx-ribbon .docx-format-button[aria-label="Bold"] { font-weight: 750; }
.ed-direct .docx-ribbon .docx-format-button[aria-label="Italic"] { font-style: italic; font-family: Georgia, serif; }
.ed-direct .docx-ribbon .docx-format-button[aria-label="Underline"] { text-decoration: underline; }
.ed-direct .docx-ribbon .docx-format-button[aria-label="Strikethrough"] { text-decoration: line-through; }
.ed-direct .docx-ribbon .docx-style-select { width: 124px; height: 30px; margin: 0 8px; padding: 0 8px; border: 1px solid #c8c8ca; border-radius: 4px; background: #fff; color: #323130; font: 13px/1 var(--ed-font); }
.ed-direct .docx-ribbon .docx-color-control { position: relative; width: 32px; padding: 0; border-bottom: 3px solid #c00000; border-radius: 4px 4px 0 0; }
.ed-direct .docx-ribbon .docx-color-control[title="Highlight color"] { border-bottom-color: #ffd400; }
/* 分组分隔：样式框前、加粗前、对齐前、列表前、插入前。 */
.ed-direct .docx-ribbon :is(.docx-style-select, [aria-label="Bold"], [aria-label="Align left"], [aria-label="Bulleted list"], [aria-label="Insert paragraph"]) { margin-left: 13px; }
.ed-direct .docx-ribbon :is([aria-label="Bold"], [aria-label="Align left"], [aria-label="Bulleted list"], [aria-label="Insert paragraph"]) { position: relative; overflow: visible; }
.ed-direct .docx-ribbon :is([aria-label="Bold"], [aria-label="Align left"], [aria-label="Bulleted list"], [aria-label="Insert paragraph"])::before { content: ''; position: absolute; left: -8px; top: 5px; bottom: 5px; width: 1px; background: #d2d2d4; }
.ed-direct .docx-ribbon .docx-save-button { display: none; }
.ed-direct .docx-ribbon .docx-edit-message { margin-left: auto; padding-left: 16px; color: #605e5c; font-size: 12px; white-space: nowrap; }
.ed-direct .docx-ribbon-preview :is(.docx-format-button, .docx-color-control, .docx-style-select) { pointer-events: none; }
.ed-direct .docx-ribbon-preview { cursor: pointer; }
[data-ed-can-edit="true"] .ed-direct .docx-viewer .docx-page-body, .ed-direct[data-ed-can-edit="true"] .docx-viewer .docx-page-body { cursor: text; }
/* 查看器自带的工具条（缩放、搜索）移到底部，叠在状态栏右侧。 */
.ed-direct .docx-viewer .ed-toolbar { order: 4; position: sticky; bottom: 0; z-index: 16; display: flex; justify-content: space-between; min-height: 28px; margin-top: -28px; padding: 0 10px; gap: 8px; border: 0; background: transparent; pointer-events: none; }
.ed-direct .docx-viewer .ed-toolbar > * { pointer-events: auto; }
.ed-direct .docx-viewer .ed-toolbar-end, .ed-direct .docx-viewer .ed-toolbar .ed-pill { display: none; }
.ed-direct .docx-viewer .ed-toolbar .ed-icon-button { width: 24px; height: 24px; flex-basis: 24px; background: transparent; }
.ed-direct .docx-viewer .ed-toolbar-center { padding: 0; }
.ed-direct .docx-viewer :is(.docx-zoom, .docx-search, .docx-search-step) { height: 22px; font-size: 11px; }
.ed-direct .docx-viewer .docx-search { width: 150px; }
.ed-direct .docx-viewer .docx-search-step { width: 22px; font-size: 12px; }
.ed-direct .docx-viewer .ed-statusbar { order: 3; padding-left: 44px; }
.ed-direct .docx-editor { background: #e8e8ea; }

.ed-direct .docx-edit-message:empty { display: none; }
