/* 界面主题与文档排版分离：界面字号、缩放和导航不写入 Word 语义模型。 */
:root {
  color-scheme: light;
  --accent: #185abd;
  --border: #d4d7dc;
  --muted: #60656c;
  --hover: #e2e8f1;
  --chrome: #f3f4f7;
  font:
    13px/1.4 "Segoe UI",
    "Microsoft YaHei",
    "Noto Sans",
    sans-serif;
  color: #242424;
  background: #e8eaee;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-width: 360px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 7px;
  white-space: nowrap;
}
button:hover:not(:disabled) {
  background: var(--hover);
  border-color: #b7c6db;
}
button:active:not(:disabled),
button[aria-pressed="true"] {
  background: #d7e4f6;
  border-color: #9db9e2;
}
button:disabled {
  cursor: default;
  color: #8a8a8a;
  opacity: 0.58;
}
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input,
select {
  border: 1px solid #afb4bc;
  border-radius: 2px;
  min-height: 27px;
  background: white;
  padding: 3px 6px;
}
input:focus,
select:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"] {
  accent-color: var(--accent);
  min-height: 0;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.primary {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}
.primary:hover:not(:disabled) {
  color: white;
  background: #124b9f;
}
[hidden],
.icon-definitions,
#csrf {
  display: none !important;
}
.app-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  background: #e9ecf3;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 27px;
  background: #185abd;
  box-shadow: 3px 0 0 #6793cf;
  border-radius: 2px;
  color: white;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
}
.autosave-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  white-space: nowrap;
}
.autosave-switch {
  display: inline-block;
  width: 29px;
  height: 16px;
  border-radius: 12px;
  background: var(--accent);
  position: relative;
}
.autosave-switch::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  top: 3px;
  right: 3px;
}
.quick-access {
  display: flex;
  gap: 1px;
}
.quick-access button {
  width: 28px;
  padding: 3px;
}
.quick-access #save-document {
  color: #76559e;
}
.file-heading {
  min-width: 100px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  white-space: nowrap;
}
#document-title {
  width: min(22vw, 310px);
  min-width: 90px;
  background: transparent;
  border-color: transparent;
  text-overflow: ellipsis;
  padding: 4px;
}
#document-title:hover,
#document-title:focus {
  border-color: #b8c2d4;
  background: white;
}
#save-status {
  color: var(--muted);
  font-size: 11px;
  margin-left: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#save-status[data-recovery="unavailable"]::after {
  content: " · 本地恢复受限";
  color: #8a4f00;
}
.title-search {
  width: 260px;
  max-width: 25vw;
  height: 32px;
  justify-content: flex-start;
  background: #ffffffa6;
  border: 1px solid #d1d5df;
  box-shadow: 0 1px 2px #00000005;
  color: #60656c;
}
.title-search kbd {
  margin-left: auto;
  font: 10px inherit;
  opacity: 0.7;
}
.product-label {
  font-size: 11px;
  color: #646c78;
  white-space: nowrap;
  margin-left: 10px;
}
.tab-strip {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 37px;
  gap: 8px;
  flex-shrink: 0;
  background: var(--chrome);
}
.ribbon-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 5px;
}
.ribbon-tabs button,
.file-tab {
  padding: 4px 10px;
  border-radius: 0;
  position: relative;
}
.ribbon-tabs button[aria-selected="true"] {
  font-weight: 600;
  color: var(--accent);
}
.ribbon-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  height: 3px;
  bottom: 2px;
  left: 9px;
  right: 9px;
  border-radius: 2px;
  background: var(--accent);
}
.document-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}
.editing-mode {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  margin-right: 10px;
}
.document-actions button {
  min-height: 27px;
  font-size: 12px;
}
.ribbon {
  --ribbon-content-height: 72px;
  --ribbon-label-height: 20px;
  --ribbon-scrollbar-height: 8px;
  --ribbon-panel-height: calc(
    7px + var(--ribbon-content-height) + var(--ribbon-label-height) + 4px +
      var(--ribbon-scrollbar-height)
  );
  position: relative;
  flex-shrink: 0;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 5px;
  margin: 0 8px 5px;
  box-shadow: 0 1px 2px #00000005;
}
.ribbon-panel {
  display: flex;
  /* 所有标签共享尺寸；预留横向滚动条空间，切换或溢出不移动正文。 */
  height: var(--ribbon-panel-height);
  min-height: var(--ribbon-panel-height);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 7px 22px 4px 7px;
  scrollbar-width: thin;
}
.ribbon-panel::-webkit-scrollbar {
  height: var(--ribbon-scrollbar-height);
}
.ribbon-group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: calc(var(--ribbon-content-height) + var(--ribbon-label-height));
  padding: 0 10px var(--ribbon-label-height);
  border-right: 1px solid #dddfe3;
  flex-shrink: 0;
  min-width: 70px;
}
.ribbon-group:last-of-type {
  border: 0;
}
.group-content {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--ribbon-content-height);
  flex-shrink: 0;
}
.group-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 12px;
  color: #575757;
  text-align: center;
}
.large-tool {
  flex-direction: column;
  height: var(--ribbon-content-height);
  min-width: 48px;
  padding: 5px 7px;
  gap: 4px;
}
.large-tool svg {
  width: 31px;
  height: 31px;
  stroke-width: 1.2;
  color: #486b9a;
}
.stack-tools {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.stack-tools button {
  justify-content: flex-start;
  font-size: 12px;
  min-height: 23px;
  height: 23px;
}
.stack-tools label {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 31px;
}
.font-row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 33px;
}
.font-row button {
  min-width: 28px;
  height: 28px;
}
.font-row sup {
  font-size: 9px;
  margin-left: -5px;
}
.font-row sub {
  font-size: 9px;
}
.font-group {
  width: 294px;
}
.paragraph-group {
  width: 211px;
}
#font-family {
  width: 142px;
  font-size: 12px;
}
#font-size {
  width: 50px;
  font-size: 12px;
}
.format-row {
  gap: 1px;
}
.tool-separator {
  height: 19px;
  width: 1px;
  background: #dfe1e4;
  margin: 0 4px;
}
.color-label {
  width: 34px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 28px;
  font-weight: 600;
  font-family: serif;
  font-size: 17px;
  cursor: pointer;
}
.color-label input {
  position: absolute;
  width: 24px;
  height: 5px;
  min-height: 0;
  padding: 0;
  border: 0;
  bottom: 1px;
  cursor: pointer;
}
.dialog-launcher {
  position: absolute;
  bottom: -1px;
  right: 1px;
  min-height: 17px;
  width: 17px;
  font-size: 12px;
  padding: 0;
}
.style-gallery {
  display: flex;
  gap: 5px;
  padding-top: 4px;
}
.style-gallery button {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 98px;
  height: 61px;
  border: 1px solid #dddfe6;
  opacity: 0.8;
}
.style-gallery span {
  font-size: 17px;
  font-family: "Microsoft YaHei", sans-serif;
}
.style-gallery small {
  font-size: 10px;
}
.style-gallery .heading-sample {
  font-size: 23px;
  color: #556179;
}
.collapse-ribbon {
  position: absolute;
  bottom: 0;
  right: 1px;
  width: 20px;
  height: 17px;
  min-height: 17px;
  padding: 0;
  color: #60656c;
}
.ribbon-collapsed .ribbon-panel {
  display: none;
}
.ribbon-collapsed .ribbon {
  height: 9px;
}
.ribbon-collapsed .collapse-ribbon {
  transform: rotate(180deg);
}
.ribbon-hint {
  padding: 5px 22px;
  margin: auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}
.shape-choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  margin-left: 8px;
}
.shape-choice select {
  width: 116px;
}
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sidebar {
  width: 244px;
  padding: 12px 14px;
  background: #f8f9fb;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
}
.sidebar-title {
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sidebar-title button {
  font-size: 22px;
  color: #737373;
}
.navigation-search {
  display: flex;
  align-items: center;
  height: 30px;
  border: 1px solid #989da6;
  border-bottom: 2px solid var(--accent);
  background: white;
  padding: 0 7px;
}
.navigation-search svg {
  width: 15px;
}
.navigation-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}
.navigation-search:focus-within {
  outline: 1px solid var(--accent);
}
.sidebar-caption {
  color: #676b70;
  font-size: 11px;
  margin: 13px 0 5px;
}
#outline {
  flex: 1;
  overflow: auto;
  min-height: 60px;
}
#outline button,
#image-outline button,
#shape-outline button {
  display: block;
  width: 100%;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 6px 7px;
  font-size: 12px;
  border-radius: 0;
  min-height: 30px;
}
#outline button[aria-current="true"] {
  background: #e4ecf7;
  border-left: 3px solid var(--accent);
  color: #174d93;
}
.object-navigation {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 9px;
  font-size: 12px;
  max-height: 37%;
  overflow: auto;
}
.object-navigation summary {
  cursor: pointer;
}
#image-outline,
#shape-outline {
  max-height: 110px;
  overflow: auto;
}
.document-area {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #e8eaee;
}
#viewport {
  overflow: auto;
  overflow-anchor: none;
  flex: 1;
  min-height: 0;
  padding: 12px 36px 44px;
  scrollbar-gutter: stable;
}
#page-stage {
  position: relative;
  margin: 0 auto;
}
#pages {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
}
.page-surface {
  isolation: isolate;
  /* 页外图元和旋转手柄不参与视口滚动范围；纸张尺寸是唯一几何边界。
     paint containment 不创建额外滚动容器，避免聚焦页内控件时隐式滚动。 */
  contain: paint;
  position: absolute;
  background: white;
  box-shadow:
    0 0 0 1px #cdd0d6,
    0 2px 5px #0000000d;
  touch-action: none;
}
.page-surface canvas {
  display: block;
  position: relative;
  z-index: 1;
}
.page-number {
  position: absolute;
  bottom: 23px;
  left: 50%;
  color: #91959e;
  font-size: 10px;
  pointer-events: none;
}
.page-crop-marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  fill: none;
  stroke: #aaa;
  stroke-width: 1px;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}
.crop-marks-hidden .page-crop-marks {
  display: none;
}
.page-gridlines {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  fill: none;
  stroke: #b6b6b6;
  stroke-width: 0.75px;
  stroke-linecap: butt;
}
.gridlines-visible .page-gridlines {
  display: block;
}
@media (forced-colors: active) {
  .page-crop-marks,
  .page-gridlines {
    stroke: GrayText;
  }
}
@media print {
  .page-crop-marks,
  .page-gridlines {
    display: none !important;
  }
}
.ruler-bar {
  height: 26px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.horizontal-ruler {
  position: absolute;
  top: 4px;
  height: 18px;
  background: #fff;
  border: 1px solid #d0d3d8;
  transform-origin: top left;
}
.ruler-tick {
  position: absolute;
  height: 5px;
  border-left: 1px solid #626970;
  bottom: 1px;
  font-size: 9px;
  color: #5f656e;
  text-indent: -3px;
}
.ruler-tick.major {
  height: 14px;
  border: 0;
}
.ruler-margin {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #d7d9de;
}
.object-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 7px 12px;
  background: #fafbfe;
  border-bottom: 1px solid #cdd8e7;
  flex-shrink: 0;
  font-size: 11px;
}
.object-tools strong {
  color: #34558b;
  font-weight: 600;
  padding-right: 5px;
}
.object-tools label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.object-tools input[type="number"] {
  width: 65px;
}
.object-tools input[type="color"] {
  width: 29px;
  height: 26px;
  padding: 2px;
}
.object-tools button {
  border-color: #c6ccd6;
  font-size: 11px;
  background: #fff;
}
#image-alt {
  width: 112px;
}
#shape-source-note {
  width: 100%;
  color: #72767d;
  font-size: 10px;
}
.document-image {
  z-index: 2;
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #f3f5f7;
  line-height: 0;
  touch-action: none;
  min-height: 0;
  min-width: 0;
}
.document-image.behind-text {
  z-index: 0;
}
.document-image img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.document-image.selected {
  outline: 1px solid #666;
  outline-offset: 0;
}
.image-selection-overlay {
  position: absolute;
  pointer-events: none;
  outline: 1px solid #666;
}
.image-hit-overlay {
  position: absolute;
  pointer-events: auto;
  background: transparent;
  border: 0;
  padding: 0;
  touch-action: none;
}
.image-selection-overlay [data-image-handle],
.image-selection-overlay [data-image-rotate],
.image-selection-overlay .picture-wrap-overlay {
  pointer-events: auto;
}
.document-shape,
.document-shape:hover:not(:disabled),
.document-shape:active:not(:disabled),
.document-shape.selected,
.document-shape[aria-pressed="true"] {
  position: absolute;
  z-index: 3;
  padding: 0;
  border: 0;
  border-radius: 0;
  min-height: 0;
  min-width: 0;
  background: transparent;
  box-shadow: none;
  appearance: none;
  touch-action: none;
  cursor: pointer;
}
.document-shape:hover {
  outline: 1px dashed var(--accent);
}
.document-shape.selected,
.document-shape:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.image-resize-handle {
  display: none;
  position: absolute;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border-radius: 50%;
  background: white;
  border: 2px solid #666;
  z-index: 1;
  touch-action: none;
  transform: scale(var(--image-handle-scale, 1));
}
.image-resize-handle::after {
  content: "";
  position: absolute;
  inset: -5px;
}
.image-resize-handle[data-image-handle="nw"],
.image-resize-handle[data-image-handle="n"],
.image-resize-handle[data-image-handle="ne"] {
  top: -5px;
}
.image-resize-handle[data-image-handle="sw"],
.image-resize-handle[data-image-handle="s"],
.image-resize-handle[data-image-handle="se"] {
  bottom: -5px;
}
.image-resize-handle[data-image-handle="nw"],
.image-resize-handle[data-image-handle="w"],
.image-resize-handle[data-image-handle="sw"] {
  left: -5px;
}
.image-resize-handle[data-image-handle="ne"],
.image-resize-handle[data-image-handle="e"],
.image-resize-handle[data-image-handle="se"] {
  right: -5px;
}
.image-resize-handle[data-image-handle="n"],
.image-resize-handle[data-image-handle="s"] {
  left: calc(50% - 5px);
  cursor: ns-resize;
}
.image-resize-handle[data-image-handle="w"],
.image-resize-handle[data-image-handle="e"] {
  top: calc(50% - 5px);
  cursor: ew-resize;
}
.image-resize-handle[data-image-handle="nw"],
.image-resize-handle[data-image-handle="se"] {
  cursor: nwse-resize;
}
.image-resize-handle[data-image-handle="ne"],
.image-resize-handle[data-image-handle="sw"] {
  cursor: nesw-resize;
}
.document-image.selected .image-resize-handle,
.image-selection-overlay .image-resize-handle {
  display: block;
}
.document-image.behind-text .image-resize-handle,
.document-image.picture-points-editing .image-resize-handle,
.image-selection-overlay.picture-points-editing .image-resize-handle {
  display: none;
}
.picture-resize-preview {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  outline: 1px solid #666;
  contain: layout style;
  will-change: width, height, transform;
}
.picture-resize-preview img {
  display: block;
  width: 100%;
  height: 100%;
}
.picture-resize-preview .image-resize-handle {
  display: block;
}
.image-rotate-handle {
  display: none;
  position: absolute;
  left: calc(50% - 12px);
  top: calc(-12px - 30px * var(--image-handle-scale, 1));
  width: 24px;
  height: 24px;
  color: #666;
  cursor: grab;
  touch-action: none;
  transform: scale(var(--image-handle-scale, 1));
  z-index: 2;
}
.image-rotate-handle svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transform: scaleX(-1);
}
.image-rotate-handle::after {
  content: "";
  position: absolute;
  width: 1px;
  height: 18px;
  top: 24px;
  left: 12px;
  background: #888;
  pointer-events: none;
}
.document-image.selected .image-rotate-handle,
.image-selection-overlay .image-rotate-handle,
.picture-resize-preview .image-rotate-handle {
  display: block;
}
.document-image.behind-text .image-rotate-handle,
.document-image.picture-points-editing .image-rotate-handle,
.image-selection-overlay.picture-points-editing .image-rotate-handle {
  display: none;
}
.image-error {
  position: absolute;
  inset: 0;
  align-content: center;
  padding: 8px;
  color: #765520;
  font-size: 12px;
  line-height: 1.7;
  background: #fff5e7;
}
#input-bridge {
  /* 输入桥只承接键盘/输入法，不能挡住正文与图片控制点的指针命中。 */
  pointer-events: none;
  position: fixed;
  width: 2px;
  height: 20px;
  padding: 0;
  border: 0;
  resize: none;
  opacity: 0.01;
  z-index: 5;
  overflow: hidden;
  caret-color: transparent;
  font-size: 16px;
  background: transparent;
  color: transparent;
  outline: none;
}
.text-caret {
  position: fixed;
  z-index: 30;
  background: #242424;
  pointer-events: none;
  user-select: none;
  animation: text-caret-blink-a 1.1s step-end infinite;
}
.text-caret[data-blink="true"] {
  animation-name: text-caret-blink-b;
}
.text-caret[hidden] {
  display: none;
}
@keyframes text-caret-blink-a {
  50% {
    opacity: 0;
  }
}
@keyframes text-caret-blink-b {
  50% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .text-caret {
    animation: none;
  }
}
@media (forced-colors: active) {
  .text-caret {
    background: CanvasText;
  }
}
@media print {
  .text-caret {
    display: none !important;
  }
}
#message {
  margin: 0;
  padding: 9px 16px;
  color: #8a320a;
  background: #fff2d4;
  border-bottom: 1px solid #e0c688;
  font-size: 12px;
  flex-shrink: 0;
  max-height: 95px;
  overflow: auto;
}
.statusbar {
  height: 27px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  background: #f3f4f7;
  border-top: 1px solid #d3d6de;
  padding: 0 12px;
  font-size: 11px;
  color: #525861;
  white-space: nowrap;
}
.status-spacer {
  flex: 1;
}
.statusbar button {
  height: 24px;
  min-height: 24px;
  padding: 2px 4px;
}
.statusbar svg {
  width: 15px;
  height: 15px;
}
#zoom-range {
  width: 108px;
  padding: 0;
  accent-color: #666f7c;
  min-height: 0;
  height: 14px;
}
#zoom-label {
  width: 44px;
  font-size: 11px;
}
/* 原生 dialog 负责焦点圈定和 Escape；不引入整套 UI 框架或全局键盘陷阱。 */
dialog {
  padding: 0;
  border: 1px solid #bfc6d2;
  border-radius: 7px;
  color: #242424;
  background: #fafafa;
  box-shadow: 0 12px 40px #0003;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 30px);
}
dialog::backdrop {
  background: #101c3033;
}
.editor-dialog {
  width: 440px;
}
.editor-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0f2f6;
  border-bottom: 1px solid #dce0e6;
  padding: 10px 15px;
}
.editor-dialog h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.editor-dialog header button,
.dialog-close {
  font-size: 21px;
}
.editor-dialog form > div,
.editor-dialog #information-content {
  padding: 20px;
}
.editor-dialog label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 15px;
}
.editor-dialog label input:not([type="checkbox"]),
.editor-dialog select {
  width: 225px;
}
.dialog-checkboxes {
  display: flex;
  gap: 25px;
}
.dialog-checkboxes label {
  gap: 6px;
}
.editor-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 15px 14px;
}
.editor-dialog footer button {
  min-width: 78px;
  border-color: #bac2ce;
}
.dialog-note {
  font-size: 12px;
  color: #6c727c;
  line-height: 1.8;
}
.information-dialog {
  width: 550px;
}
#information-content {
  white-space: pre-line;
  line-height: 1.9;
  max-height: 60vh;
  overflow: auto;
}
.file-dialog {
  width: 760px;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.file-backstage {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
}
.file-sidebar {
  background: var(--accent);
  padding: 28px 22px;
  color: white;
}
.file-sidebar h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 500;
}
.file-sidebar p {
  margin: 0;
  color: #dbe8fb;
  font-size: 11px;
}
.file-content {
  min-width: 0;
  padding: 28px;
  position: relative;
}
.file-workspace-heading {
  padding-right: 24px;
}
.file-workspace-heading h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 500;
}
.file-workspace-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.file-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 24px;
}
.file-cards button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 16px 12px;
  border: 1px solid #dce2eb;
  background: #fff;
  white-space: normal;
  text-align: left;
}
.file-dialog button {
  border-radius: 0;
}
.file-dialog button:hover:not(:disabled) {
  background: #edf4ff;
  border-color: #a9c4e8;
}
.file-dialog button:active:not(:disabled) {
  background: #dceaff;
  border-color: var(--accent);
}
.file-cards svg {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  color: var(--accent);
}
.file-cards strong {
  font-size: 14px;
  font-weight: 600;
}
.file-cards span {
  font-size: 11px;
  color: var(--muted);
}
.file-recovery {
  padding-top: 18px;
  border-top: 1px solid #e5e8ee;
}
.file-recovery h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
}
.recovery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.recovery-actions button {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
  border-color: #cbd4e0;
}
.dialog-close {
  position: absolute;
  top: 7px;
  right: 10px;
}
.file-dialog .dialog-close {
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 5px;
  color: var(--muted);
}
.file-recovery .dialog-note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.7;
}
@media (max-width: 640px) {
  .file-backstage {
    grid-template-columns: minmax(0, 1fr);
  }
  .file-sidebar {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 14px 18px;
  }
  .file-sidebar h2 {
    margin: 0;
    font-size: 20px;
  }
  .file-content {
    padding: 20px 18px;
  }
}
@media (max-width: 440px) {
  .file-cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin: 18px 0;
  }
  .file-cards button {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 2px;
    padding: 12px;
  }
  .file-cards svg {
    grid-row: span 2;
    align-self: center;
    margin-bottom: 0;
  }
}
.context-popup {
  position: fixed;
  z-index: 100;
  width: 258px;
  filter: drop-shadow(0 4px 8px #0003);
}
.mini-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 7px;
  background: #fff;
  border: 1px solid #b9bdc5;
  border-radius: 4px;
  margin-bottom: 5px;
}
.mini-toolbar select {
  min-width: 0;
  width: 134px;
  font-size: 12px;
}
.mini-toolbar input[type="number"] {
  width: 58px;
}
.mini-toolbar button {
  min-width: 28px;
}
.context-items {
  background: #fff;
  border: 1px solid #b9bdc5;
  border-radius: 4px;
  padding: 5px 0;
  max-height: calc(100dvh - 140px);
  overflow: auto;
}
.context-items button {
  display: flex;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  width: 100%;
  height: 31px;
  padding: 4px 13px;
  font-size: 12px;
  gap: 12px;
}
.context-items button:hover:not(:disabled),
.context-items button:focus-visible {
  background: #e6edf7;
  outline: 0;
}
.context-items button svg {
  width: 16px;
  height: 16px;
  color: #626b78;
}
.context-items kbd {
  margin-left: auto;
  color: #858a92;
  font:
    11px "Segoe UI",
    sans-serif;
}
.context-items hr {
  border: 0;
  height: 1px;
  background: #e5e5e5;
  margin: 5px 10px;
}
.context-paste-heading {
  font-size: 11px;
  padding: 4px 14px;
  color: #676d75;
}
.sr-only {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
@media (max-width: 1280px) {
  .product-label {
    display: none;
  }
  .title-search {
    width: 215px;
  }
  .styles-group .style-gallery button {
    width: 82px;
  }
  .ribbon-group {
    padding-left: 7px;
    padding-right: 7px;
  }
  .font-group {
    width: 286px;
  }
}
@media (max-width: 1000px) {
  .autosave-label {
    display: none;
  }
  .app-header {
    gap: 9px;
  }
  #save-status {
    max-width: 115px;
  }
  .sidebar {
    width: 205px;
  }
  .statusbar {
    gap: 10px;
  }
  #layout-status {
    display: none;
  }
  .styles-group {
    display: none;
  }
  .editing-mode {
    display: none;
  }
  .title-search {
    width: 180px;
  }
}
@media (max-width: 760px) {
  .app-header {
    height: 43px;
    padding: 0 9px;
  }
  .title-search {
    width: 33px;
    min-width: 33px;
    padding: 5px;
  }
  .title-search span,
  .title-search kbd,
  .file-heading > span:not(#save-status) {
    display: none;
  }
  .file-heading {
    gap: 0;
  }
  #document-title {
    width: 35vw;
  }
  #save-status {
    max-width: 90px;
    font-size: 10px;
    margin-left: 3px;
  }
  .tab-strip {
    overflow-x: auto;
    gap: 2px;
    padding: 0 5px;
  }
  .ribbon-tabs {
    gap: 0;
  }
  .ribbon-tabs button,
  .file-tab {
    padding: 3px 8px;
  }
  .document-actions {
    padding-left: 4px;
  }
  .document-actions #export-document {
    font-size: 0;
    gap: 0;
  }
  .document-actions #export-document svg {
    width: 18px;
  }
  .sidebar {
    width: 180px;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    box-shadow: 4px 0 15px #0002;
  }
  .workspace {
    position: relative;
  }
  #viewport {
    padding: 12px 22px 35px;
  }
  .statusbar {
    gap: 6px;
    padding: 0 6px;
    font-size: 10px;
  }
  #document-stats {
    max-width: calc(100vw - 290px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #zoom-range {
    width: 68px;
  }
  .object-tools {
    max-height: 138px;
    overflow: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  button[aria-pressed="true"],
  .ribbon-tabs button[aria-selected="true"] {
    outline: 1px solid Highlight;
  }
  .page-surface {
    border: 1px solid CanvasText;
  }
  .context-items button:focus-visible {
    outline: 2px solid Highlight;
  }
}
/* 紧凑迷你工具栏与正文格式控件保持一致的两行布局。 */
.mini-toolbar > select {
  width: 170px;
}
.mini-format-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 3px;
}
@media (max-width: 760px) {
  #message,
  .object-tools {
    z-index: 11;
  }
}
/* 统一下拉箭头的跨浏览器外观；不放宽脚本或样式安全策略。 */
select {
  appearance: none;
  background-image: url("../icons/chevron-down.svg?v=14");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
}
.context-search {
  width: calc(100% - 14px);
  margin: 1px 7px 5px;
  height: 25px;
  min-height: 25px;
  font-size: 11px;
  border-color: #b8bdc7;
}

/* 导航窗格：标题、页面、结果共享稳定外框，内容区独立滚动。 */
.navigation-pane {
  width: 280px;
  padding: 10px 14px 0;
  background: #fafafa;
}
.navigation-pane .sidebar-title {
  font-size: 21px;
  font-weight: 600;
  margin-bottom: 19px;
}
.navigation-pane .navigation-search {
  height: 32px;
  flex-shrink: 0;
  border: 1px solid #a6a6a6;
  padding-inline: 6px;
}
.navigation-pane .navigation-search input {
  font-size: 14px;
}
.navigation-search svg {
  flex-shrink: 0;
  color: #2258a5;
}
.navigation-tabs {
  display: flex;
  gap: 23px;
  flex-shrink: 0;
  margin-top: 17px;
  border-bottom: 1px solid #e2e2e2;
}
.navigation-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 9px 0 10px;
  font-size: 15px;
  color: #444;
}
.navigation-tabs button[aria-selected="true"] {
  color: #185abd;
  border-bottom-color: #185abd;
  font-weight: 600;
}
.navigation-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 0;
  overscroll-behavior: contain;
}
.navigation-empty {
  font-size: 13px;
  line-height: 1.8;
  color: #666;
  margin: 6px 3px;
}
.navigation-content #outline {
  overflow: visible;
  min-height: 0;
}
.heading-row {
  display: flex;
  position: relative;
  height: 28px;
  align-items: center;
  padding-inline-end: 2px;
}
#outline .heading-row > button[data-paragraph] {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 28px;
  min-height: 28px;
  margin-inline-start: 18px;
  padding: 3px 6px;
  white-space: nowrap;
  text-align: start;
  font-size: 13px;
  line-height: 22px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: #444;
}
#outline .heading-row > button[data-paragraph]:hover {
  background: #e9eff8;
}
#outline .heading-row > .heading-toggle {
  position: absolute;
  display: grid;
  place-items: center;
  width: 18px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: #595959;
}
#outline .heading-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-block: 4px solid transparent;
  border-inline-start: 6px solid currentColor;
}
#outline .heading-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}
#outline .heading-toggle:hover {
  color: #185abd;
}
#outline .heading-row > button[aria-current="true"] {
  background: #cbdcf4;
  color: #263c59;
}
#outline .heading-row > button:focus-visible {
  outline: 1px solid #185abd;
  outline-offset: -1px;
}
@media (forced-colors: active) {
  #outline .heading-row > button[aria-current="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
  #outline .heading-row > .heading-toggle {
    color: ButtonText;
  }
  #outline .heading-row > button:focus-visible {
    outline-color: Highlight;
  }
}
.navigation-result-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #595959;
}
.navigation-result-tools span {
  flex: 1;
}
.navigation-result-tools button {
  width: 26px;
  min-height: 26px;
  font-size: 18px;
}
#navigation-results button {
  width: 100%;
  text-align: start;
  padding: 10px 8px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
  border-radius: 0;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
#navigation-results button[aria-current="true"] {
  background: #e8f0fc;
  border-color: #a1bde5;
}
#navigation-results mark {
  background: #fff1a0;
  color: inherit;
}
#page-thumbnails {
  position: relative;
  width: 100%;
}
.page-thumbnail {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  font-size: 12px;
  color: #555;
}
.thumbnail-sheet {
  display: block;
  position: relative;
  isolation: isolate;
  background: white;
  border: 1px solid #c4c4c4;
  box-shadow: 0 1px 3px #0002;
  overflow: hidden;
}
.thumbnail-sheet canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
}
.thumbnail-sheet img {
  position: absolute;
  z-index: 2;
  object-fit: fill;
  pointer-events: none;
}
.thumbnail-sheet img.behind-text {
  z-index: 0;
}
.page-thumbnail[aria-current="true"] .thumbnail-sheet {
  outline: 2px solid #185abd;
  outline-offset: 1px;
}
.page-thumbnail[aria-current="true"] > span:last-child {
  color: #185abd;
  font-weight: 600;
}
.selection-pane {
  border-left: 1px solid var(--border);
  border-right: 0;
  overflow: auto;
}
.selection-pane h3 {
  font-size: 13px;
  margin: 14px 0 6px;
}
.selection-pane #image-outline,
.selection-pane #shape-outline {
  max-height: none;
  overflow: visible;
}
@media (max-width: 900px) {
  .navigation-pane {
    width: 230px;
  }
  .selection-pane {
    position: absolute;
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 15;
    box-shadow: -3px 0 12px #0002;
  }
  .workspace {
    position: relative;
  }
}
@media (forced-colors: active) {
  .navigation-tabs button[aria-selected="true"] {
    border-bottom-color: Highlight;
  }
  .page-thumbnail[aria-current="true"] .thumbnail-sheet {
    outline-color: Highlight;
  }
}

/* 开始选项采用原生模态焦点管理；固定小面板避免为每个按钮常驻复杂DOM。 */
.home-options-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid #c8c8c8;
  border-radius: 10px;
  padding: 22px;
  color: #242424;
  box-shadow: 0 12px 40px #0003;
}
.home-options-dialog::backdrop {
  background: #0003;
}
.home-options-dialog h2 {
  margin: 0 0 18px;
  font-size: 18px;
}
.home-options-content {
  display: grid;
  gap: 12px;
}
.home-options-content label {
  display: grid;
  gap: 5px;
  font-size: 13px;
}
.home-options-content input,
.home-options-content select {
  min-height: 32px;
  border: 1px solid #aaa;
  border-radius: 4px;
  padding: 4px 8px;
  min-width: 0;
}
.home-option-grid,
.home-format-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.home-options-dialog button {
  border: 1px solid #bbb;
  background: #fafafa;
  border-radius: 5px;
  min-height: 34px;
  padding: 6px 12px;
  color: #242424;
  cursor: pointer;
}
.home-options-dialog button:hover {
  background: #eaf1fb;
  border-color: #7b9fcc;
}
.home-option-grid button[aria-pressed="true"] {
  background: #deebf7;
  border-color: #2b579a;
  color: #17457a;
}
.home-options-dialog button:focus-visible {
  outline: 2px solid #185abd;
  outline-offset: 2px;
}
.home-options-close {
  margin-top: 18px;
  float: right;
}
.format-painter-active canvas {
  cursor: crosshair;
}
/* 交互只提升当前 SVG；文档页面仍由原有虚拟化 Canvas 承担。 */
.shape-drag-preview {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  z-index: 1050;
  pointer-events: none;
  display: none;
}
.shape-drawing-hint {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1051;
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border: 1px solid #cbd9ea;
  border-radius: 6px;
  background: #f5f9ff;
  color: #24538c;
  font-size: 12px;
  box-shadow: 0 2px 8px #0001;
  pointer-events: none;
}
.shape-drawing-hint[hidden] {
  display: none;
}
.shape-drawing-mode,
.shape-drawing-mode *,
.shape-gesture-active {
  cursor: crosshair !important;
  touch-action: none;
  user-select: none;
}
.document-shape.shape-editable {
  cursor: move;
}
.shape-handle {
  display: none;
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid #3976b8;
  background: white;
  box-sizing: border-box;
  border-radius: 50%;
  z-index: 4;
}
.document-shape.selected .shape-handle {
  display: block;
}
.shape-handle-nw {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}
.shape-handle-n {
  left: calc(50% - 4px);
  top: -5px;
  cursor: ns-resize;
}
.shape-handle-ne {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}
.shape-handle-e {
  right: -5px;
  top: calc(50% - 4px);
  cursor: ew-resize;
}
.shape-handle-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}
.shape-handle-s {
  left: calc(50% - 4px);
  bottom: -5px;
  cursor: ns-resize;
}
.shape-handle-sw {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}
.shape-handle-w {
  left: -5px;
  top: calc(50% - 4px);
  cursor: ew-resize;
}
.shape-handle-rotate {
  left: calc(50% - 4px);
  top: -28px;
  cursor: grab;
}
.shape-handle-rotate::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  height: 15px;
  border-left: 1px solid #3976b8;
  pointer-events: none;
}
.document-shape {
  pointer-events: none;
}
/* 拖动时仅保留当前矢量预览；旧位置的选择框和手柄不能留在纸面上。 */
.document-shape.shape-transient {
  visibility: hidden;
}
.shape-hit-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.shape-handle {
  pointer-events: auto;
}
.shape-handle.shape-adjustment {
  width: 9px;
  height: 9px;
  background: #ffce3a;
  border: 1px solid #8d6500;
  border-radius: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  cursor: crosshair;
  z-index: 6;
  touch-action: none;
}
.shape-adjustment::before {
  content: "";
  position: absolute;
  inset: -5px;
}
