/* ============================================================
   Space 文档编辑器增强 —— 样式层
   1) Word 段落悬浮菜单（浅色浮层 + 次级菜单）
   2) Word「开始」选项卡 ribbon（5 组）
   3) 新块类型：h1/h2/h3 / ul / ol / code / quote / divider
   4) 查找替换面板、段落标记、评论标记
   ============================================================ */

/* ---------------- 新块类型 ---------------- */
.doc-editor .block.h1 > [data-field="text"],
.doc-editor .block.h2 > [data-field="text"],
.doc-editor .block.h3 > [data-field="text"] { font-weight: 800; line-height: 1.3; color: #0f2540; }
.doc-editor .block.h1 > [data-field="text"] { font-size: 26px; margin-top: 6px; }
.doc-editor .block.h2 > [data-field="text"] { font-size: 21px; }
.doc-editor .block.h3 > [data-field="text"] { font-size: 17px; }

.doc-editor .block.ul,
.doc-editor .block.ol { display: flex; align-items: flex-start; gap: 8px; }
.doc-editor .block.ul::before {
  content: "•"; flex: none; font-weight: 800; color: #2f5fa8; font-size: 17px; line-height: 1.6;
}
.doc-editor .block.ol::before {
  content: attr(data-num) "."; flex: none; font-weight: 700; color: #2f5fa8; min-width: 20px; line-height: 1.6;
}
.doc-editor .block.ul > [data-field="text"],
.doc-editor .block.ol > [data-field="text"] { flex: 1; }

.doc-editor .block.code > [data-field="text"] {
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 13px; background: #f1f5f9; border: 1px solid #dbe3ee; border-radius: 8px;
  padding: 10px 12px; white-space: pre-wrap; color: #1f3350;
}
.doc-editor .block.quote > [data-field="text"] {
  border-left: 4px solid #93b4e0; background: #f7fafd; padding: 8px 14px;
  color: #3d557a; font-style: italic; border-radius: 0 8px 8px 0;
}
.doc-editor .block.divider { padding: 6px 0; }
.doc-editor .block.divider > .ec-hr { flex: 1; height: 0; border-top: 2px solid #d9e2ef; }

/* 段落标记 ¶ */
.doc-editor.ec-show-marks .block[data-type="paragraph"] > [data-field="text"]::after {
  content: "¶"; color: #b6c4d8; font-weight: 700; margin-left: 2px;
}
.doc-editor.ec-show-marks .block [data-field="text"]:empty::before {
  content: "·"; color: #cdd8e6;
}

/* ---------------- 块左侧抓手 ---------------- */
.doc-editor .block { position: relative; }
.ec-grip {
  position: absolute; left: -26px; top: 2px; width: 20px; height: 22px;
  display: flex; align-items: center; justify-content: center; cursor: grab;
  /* 20261019c：默认就露出来（淡），hover 才加深 —— 原来要 hover 整个块才出现，用户找不到 */
  color: #c3cfdf; border-radius: 6px; font-size: 14px; line-height: 1; user-select: none;
  transition: color .12s ease, background .12s ease;
}
.doc-editor .block:hover > .ec-grip { color: #7f93ac; }
.ec-grip:hover { background: #e8eff9; color: #2f5fa8; }
.ec-grip:active { cursor: grabbing; }

/* ---- 抓手拖动排序（20261013l；20261019c 抓手改为常驻可见）---- */
.block.ec-dragging { opacity: .5; }
/* 正在拖的那个块，抓手高亮，一眼看出拖的是谁 */
.block.ec-dragging > .ec-grip { background: #dbe6f6; color: #2f5fa8; }
body.ec-drag-mode { cursor: grabbing !important; }
body.ec-drag-mode * { user-select: none !important; }
.ec-dropline {
  position: fixed; z-index: 9998; height: 0; display: none; pointer-events: none;
  border-top: 3px solid #2f5fa8; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(47, 95, 168, .16), 0 2px 6px rgba(47, 95, 168, .22);
}
/* 缩略框自带 overflow:hidden，会把框外左侧的抓手裁掉（=拖不到）→ 放开裁剪，圆角交给 header 自己画 */
.doc-editor .block.collapse { overflow: visible; }
.doc-editor .block.collapse > .collapse-header { border-radius: 9px 9px 0 0; }

/* ---- 缩略框内粘贴的表格（20261013l）---- */
.doc-editor [contenteditable] table.ec-pt {
  border-collapse: collapse; margin: 6px 0; max-width: 100%;
  font-size: 13px; line-height: 1.45;
}
.doc-editor [contenteditable] table.ec-pt td,
.doc-editor [contenteditable] table.ec-pt th {
  border: 1px solid #dbe3ef; padding: 4px 8px; vertical-align: middle; word-break: break-word;
}
.doc-editor [contenteditable] table.ec-pt th { font-weight: 700; }

/* ---------------- 悬浮菜单（浅色浮层） ---------------- */
.ec-menu {
  position: fixed; z-index: 9999; background: #fff; border: 1px solid #e2e9f3;
  border-radius: 12px; box-shadow: 0 14px 38px rgba(23, 43, 77, .16), 0 2px 6px rgba(23, 43, 77, .06);
  padding: 8px; min-width: 268px; font-size: 13px; color: #24354f;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.ec-menu-row { display: flex; gap: 4px; padding: 2px 2px 6px; }
.ec-menu-row .ec-tb {
  flex: 1; height: 30px; border: 1px solid transparent; background: transparent; border-radius: 7px;
  cursor: pointer; color: #3d557a; font-weight: 700; display: flex; align-items: center; justify-content: center;
  font-size: 13px; padding: 0;
}
.ec-menu-row .ec-tb:hover { background: #eef4fd; border-color: #cfe0f5; color: #1f5fb0; }
.ec-menu-row .ec-tb.active { background: #e3eefc; border-color: #9dc2ea; color: #14528f; }
.ec-menu-row .ec-tb svg { width: 15px; height: 15px; display: block; }
.ec-menu-row .ec-tb .t1 { font-size: 15px; }
.ec-menu-row .ec-tb .t2 { font-size: 12px; }
.ec-div { height: 1px; background: #edf1f7; margin: 6px 2px; }
.ec-mi {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer;
  position: relative; user-select: none;
}
.ec-mi:hover, .ec-mi.hot { background: #f1f6fd; }
.ec-mi .ec-mi-ic {
  width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center;
  color: #5b7ba6;
}
.ec-mi .ec-mi-ic svg { width: 16px; height: 16px; }
.ec-mi .ec-mi-tx { flex: 1; white-space: nowrap; }
.ec-mi .ec-mi-ar { color: #a8b8cc; font-size: 11px; }
.ec-mi .ec-mi-kb { color: #a8b8cc; font-size: 11px; letter-spacing: .3px; }
.ec-mi.danger:hover { background: #fdf0f0; }
.ec-mi.danger:hover .ec-mi-ic, .ec-mi.danger:hover .ec-mi-tx { color: #c0392b; }

/* 次级菜单 */
.ec-sub {
  position: fixed; z-index: 10000; background: #fff; border: 1px solid #e2e9f3; border-radius: 12px;
  box-shadow: 0 14px 38px rgba(23, 43, 77, .16); padding: 8px; min-width: 214px; font-size: 13px; color: #24354f;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; max-height: 70vh; overflow: auto;
}
.ec-sub .ec-mi { padding: 6px 9px; }
.ec-sub-grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; }
.ec-sub-grid .ec-cell {
  width: 86px; padding: 8px 6px; border: 1px solid #e6ecf5; border-radius: 9px; cursor: pointer;
  text-align: center; color: #3d557a; background: #fbfcfe; font-size: 12px;
}
.ec-sub-grid .ec-cell:hover { background: #eef4fd; border-color: #b8d2ef; color: #14528f; }
.ec-sub-grid .ec-cell b { display: block; font-size: 15px; margin-bottom: 3px; color: #2f5fa8; }

/* 色板 */
.ec-sw { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 8px; cursor: pointer; }
.ec-sw:hover { background: #f1f6fd; }
.ec-sw .ec-sw-chip { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .12); flex: none; }
.ec-sw-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; padding: 4px; }
.ec-sw-grid .ec-sw-cell { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .12); cursor: pointer; }
.ec-sw-grid .ec-sw-cell:hover { outline: 2px solid #6fa5dd; outline-offset: 1px; }

/* ---------------- 「开始」选项卡 ribbon ---------------- */
/* ---------------- 功能框吸顶（20261010h，Word 365 行为） ----------------
   用户反馈：向下输入内容时顶部功能框随页面滚走。
   真实滚动发生在 window/HTML 层，但 style.css 给 .main-content 设了 overflow-y:auto
   —— 它从不内部滚动，却把 sticky 的贴靠容器变成自己 ⇒ 里面所有 position:sticky
   （.topbar、.doc-editor-header 本来就写了 sticky）全部失效。放开成 visible
   （与实际滚动行为一致，横向往 body 的 overflow-x:hidden 兜底），sticky 链才生效。
   功能框（Word=#wordToolbar / Excel=.excel-toolbar）吸在 header 正下方，
   top 由 ECR.fixTopbar 按 header 实测高度写入（header flex-wrap 换行时自适应），
   这里的 134px 只是 JS 未跑时的兜底值；z-index 低于 header(30)/topbar(40)。 */
.main-content { overflow: visible !important; }
#docEditorPage #wordToolbar,
#docEditorPage .excel-toolbar { position: sticky; top: 134px; z-index: 29; }

/* 20261010j：用户反馈去掉 Word 编辑器顶部那条操作提示（💡 选中文字即可设置格式…）。
   零侵入：index.html 里的 .doc-editor-tip 不动，直接隐藏。Excel 的 .excel-tip 未动。 */
#wordEditorArea .doc-editor-tip { display: none; }

.ec-ribbon { border: 1px solid #e2e9f3; border-radius: 12px; background: #fff; margin-bottom: 8px; overflow: visible; }
.ec-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid #edf1f7; background: #fafcfe; border-radius: 12px 12px 0 0; }
.ec-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 700; color: #6b7f99; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ec-tab:hover { color: #2f5fa8; }
.ec-tab.active { color: #14528f; border-bottom-color: #2f5fa8; background: #fff; }
.ec-panel { display: none; padding: 8px 10px 10px; }
.ec-panel.active { display: block; }
.ec-groups { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.ec-group { padding: 0 10px; border-right: 1px solid #edf1f7; display: flex; flex-direction: column; gap: 5px; }
.ec-group:first-child { padding-left: 2px; }
.ec-group:last-child { border-right: 0; }
.ec-gbody { display: flex; align-items: center; gap: 3px; flex: 1; }
.ec-gtitle { font-size: 10.5px; color: #9aabc2; text-align: center; font-weight: 600; letter-spacing: .4px; }
.ec-b {
  min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid transparent; background: transparent;
  border-radius: 6px; cursor: pointer; color: #3d557a; font-size: 13px; display: inline-flex;
  align-items: center; justify-content: center; gap: 4px; white-space: nowrap;
}
.ec-b:hover { background: #eef4fd; border-color: #cfe0f5; color: #1f5fb0; }
.ec-b.on { background: #e3eefc; border-color: #9dc2ea; color: #14528f; }
/* 连续格式刷（双击）：底色更实，一眼能看出「还粘在手上」 */
.ec-b.on.stick { background: #cfe2fa; border-color: #6aa6e0; color: #0f4a86; box-shadow: inset 0 0 0 1px #6aa6e0; }
.ec-b svg { width: 15px; height: 15px; }
.ec-b .ec-x { font-size: 10px; color: #9aabc2; }
.ec-b.big { font-size: 15px; }
.ec-sel {
  height: 28px; border: 1px solid #dfe7f2; border-radius: 6px; background: #fff; color: #3d557a;
  font-size: 12.5px; padding: 0 4px; cursor: pointer; max-width: 130px;
}
.ec-sel:hover { border-color: #b8d2ef; }
.ec-colorwrap { position: relative; display: inline-flex; }
.ec-colorbar { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; border-radius: 2px; }
.ec-vsep { width: 1px; height: 22px; background: #edf1f7; margin: 0 3px; }

/* ribbon 里的下拉浮层 */
.ec-pop {
  position: fixed; z-index: 9998; background: #fff; border: 1px solid #e2e9f3; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(23, 43, 77, .15); padding: 7px; font-size: 13px; color: #24354f;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; min-width: 160px;
}
.ec-pop .ec-mi { padding: 6px 9px; }

/* 查找替换面板 */
.ec-fr {
  display: none; align-items: center; gap: 6px; padding: 6px 10px; background: #f7fafd;
  border-top: 1px solid #edf1f7; font-size: 12.5px; color: #3d557a; flex-wrap: wrap;
}
.ec-fr.show { display: flex; }
.ec-fr input {
  height: 26px; border: 1px solid #dfe7f2; border-radius: 6px; padding: 0 8px; font-size: 12.5px;
  min-width: 130px; color: #24354f;
}
.ec-fr .ec-fr-info { color: #8fa0b8; margin-left: auto; }
mark.ec-hit { background: #ffe08a; color: inherit; border-radius: 3px; }
mark.ec-hit.cur { background: #ffb020; }

/* 评论标记 */
.doc-editor .ec-comment { background: #fff4d6; border-bottom: 1.5px dashed #e0a52a; cursor: pointer; }
/* 已解决：换成中性灰虚线，一眼能和「待处理」的黄色批注区分开（2026-09-23） */
.doc-editor .ec-comment.done { background: #eef2f7; border-bottom-color: #b9c5d6; color: #6b7b93; }
.ec-cmt-pop .ec-cmt-meta { font-size: 11.5px; color: #8fa0b8; margin-bottom: 6px; }
.ec-cmt-pop .ec-cmt-done {
  margin-left: 6px; font-size: 11px; font-weight: 400; color: #1d8f58;
  background: #e6f6ee; border-radius: 999px; padding: 1px 8px;
}
.ec-cmt-pop {
  position: fixed; z-index: 10001; width: 268px; background: #fff; border: 1px solid #e2e9f3;
  border-radius: 10px; box-shadow: 0 12px 32px rgba(23, 43, 77, .16); padding: 10px;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 12.5px; color: #24354f;
}
.ec-cmt-pop textarea {
  width: 100%; height: 68px; border: 1px solid #dfe7f2; border-radius: 7px; padding: 6px 8px;
  font-size: 12.5px; resize: vertical; font-family: inherit; color: #24354f;
}
.ec-cmt-pop .ec-cmt-ft { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.ec-cmt-pop .ec-cmt-ft button {
  height: 26px; padding: 0 10px; border-radius: 6px; border: 1px solid #dfe7f2; background: #fff;
  cursor: pointer; font-size: 12.5px; color: #3d557a; white-space: nowrap; flex: 0 0 auto;
}
.ec-cmt-pop .ec-cmt-ft button.pri { background: #2f5fa8; border-color: #2f5fa8; color: #fff; }
/* 非本人评论：不显示删除按钮，改一行灰色提示（2026-09-24） */
.ec-cmt-pop .ec-cmt-nodel { margin-right: auto; align-self: center; font-size: 11.5px; color: #a9b6c8; }
/* 评论回复（2026-09-24） */
.ec-cmt-pop .ec-cmt-replies { max-height: 168px; overflow-y: auto; margin-bottom: 8px; border-top: 1px solid #eef2f7; padding-top: 8px; }
.ec-cmt-pop .ec-cmt-replies-empty { color: #aebbcd; font-size: 11.5px; padding: 2px 0; }
.ec-cmt-pop .ec-cmt-reply { position: relative; background: #f6f9fd; border: 1px solid #eaf0f8; border-radius: 7px; padding: 6px 8px; margin-bottom: 6px; }
.ec-cmt-pop .ec-cmt-reply-del {
  position: absolute; right: 4px; top: 3px; width: 18px; height: 18px; line-height: 1;
  border: 0; background: transparent; color: #a9b6c8; font-size: 14px; cursor: pointer;
  border-radius: 4px; padding: 0;
}
.ec-cmt-pop .ec-cmt-reply-del:hover { color: #d64545; background: #feecec; }
/* 「编辑」和「×」并排挂在回复右上角（2026-09-24 优化6） */
.ec-cmt-pop .ec-cmt-reply-edit-b {
  position: absolute; right: 24px; top: 4px; line-height: 1; border: 0; background: transparent;
  color: #a9b6c8; font-size: 11px; cursor: pointer; border-radius: 4px; padding: 2px 4px;
}
.ec-cmt-pop .ec-cmt-reply-edit-b:hover { color: #2f5fa8; background: #eaf2fd; }
.ec-cmt-pop .ec-cmt-reply-meta { font-size: 11px; color: #7d8ea8; margin-bottom: 2px; padding-right: 48px; }
.ec-cmt-pop .ec-cmt-reply-text { font-size: 12.5px; color: #24354f; white-space: pre-wrap; word-break: break-word; }
/* 回复输入行：输入框铺满、按钮与字数计在下一条（2026-09-24 优化1/4） */
.ec-cmt-pop .ec-cmt-reply-row { display: block; margin-bottom: 8px; }
.ec-cmt-pop .ec-cmt-reply-in {
  width: 100%; height: 28px; min-height: 28px; max-height: 96px; border: 1px solid #dfe7f2; border-radius: 6px;
  padding: 5px 8px; font-size: 12.5px; font-family: inherit; color: #24354f; line-height: 1.4;
  resize: none; overflow-y: auto; box-sizing: border-box;
}
.ec-cmt-pop .ec-cmt-reply-edit {
  width: 100%; min-height: 30px; max-height: 96px; border: 1px solid #c9dbf1; border-radius: 6px;
  padding: 5px 8px; font-size: 12.5px; font-family: inherit; color: #24354f; line-height: 1.4;
  resize: none; overflow-y: auto; box-sizing: border-box;
}
.ec-cmt-pop .ec-cmt-reply-bar { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ec-cmt-pop .ec-cmt-reply-cnt { margin-right: auto; font-size: 11px; color: #a9b6c8; }
.ec-cmt-pop .ec-cmt-reply-bar button {
  flex: 0 0 auto; height: 24px; padding: 0 10px; border-radius: 6px; border: 1px solid #dfe7f2; background: #fff;
  cursor: pointer; font-size: 12px; color: #3d557a; white-space: nowrap;
}
.ec-cmt-pop .ec-cmt-reply-bar button.pri { background: #2f5fa8; border-color: #2f5fa8; color: #fff; }

/* 插入选项卡面板 */
.ec-ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; padding: 2px; }
.ec-ins-card {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid #e6ecf5;
  border-radius: 9px; cursor: pointer; background: #fbfcfe; color: #3d557a; font-size: 12.5px;
}
.ec-ins-card:hover { background: #eef4fd; border-color: #b8d2ef; color: #14528f; }
.ec-ins-card .ec-ins-ic { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; color: #2f5fa8; }
.ec-ins-card .ec-ins-ic svg { width: 17px; height: 17px; }

/* 格式刷光标 */
body.ec-painter { cursor: crosshair; }
body.ec-painter .doc-editor { cursor: crosshair; }

/* 窄屏收敛 */
@media (max-width: 900px) {
  .ec-groups { overflow-x: auto; flex-wrap: nowrap; }
  .ec-group { flex: none; }
  .ec-ribbon { overflow: hidden; }
}

/* ============================================================
   Excel 侧增强
   ============================================================ */
/* ribbon 宿主：去掉原 .excel-toolbar 的灰底与外框 */
.excel-toolbar.ec-ribbon-host {
  display: block; background: transparent; border: 0; padding: 0; margin: 0 0 10px; gap: 0; flex-wrap: nowrap;
}
.ec-ribbon-host .ec-groups { align-items: stretch; }
.ec-ribbon-host .ec-b b.ec-fwb { font-weight: 800; }
.ec-ribbon-host .ec-b i.ec-fit { font-style: italic; font-family: Georgia, serif; }
.ec-ribbon-host .ec-b u.ec-ful { text-decoration: underline; }
.ec-ribbon-host .ec-b s.ec-fst { text-decoration: line-through; }

/* 单元格选区 */
.excel-table td.excel-cell.ec-selc { outline: 2px solid #2f5fa8; outline-offset: -2px; }
.excel-table td.excel-cell.ec-selc-first { outline: 2px solid #14528f; outline-offset: -2px; }
.excel-table td.excel-cell.ec-found { background-image: linear-gradient(#fff2b8, #ffe58a) !important; }
body.ec-dragging, body.ec-dragging #excelGrid { user-select: none; }

/* 状态栏 */
.ec-status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 8px; padding: 7px 12px; font-size: 12px; color: #5b7ba6;
  background: #f8fafc; border: 1px solid #e8eef7; border-radius: 10px;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.ec-status .ec-st-addr { font-weight: 700; color: #1e40af; min-width: 54px; }
.ec-status .ec-st-sp { flex: 1; }
.ec-status .ec-st-msg { color: #15803d; }

/* 图表面板 */
.ec-chart {
  margin-top: 10px; padding: 10px 12px; background: #fff; border: 1px solid #e8eef7;
  border-radius: 12px; box-shadow: 0 4px 18px rgba(30, 58, 138, .05);
}
.ec-chart-hd { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: #1e40af; margin-bottom: 4px; }
.ec-chart-svg { width: 100%; height: auto; display: block; }

/* 浮层标题 / 表单 / 底部 */
.ec-pop-hd { font-size: 11px; font-weight: 700; color: #9aabc2; letter-spacing: .4px; padding: 4px 9px 6px; }
.ec-pop-ft { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; border-top: 1px solid #edf1f7; padding-top: 7px; }
.ec-pop .ec-b.pri { background: #2f5fa8; border-color: #2f5fa8; color: #fff; }
.ec-pop .ec-b.pri:hover { background: #25518f; color: #fff; }
.ec-fmt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 2px 4px 6px; }
.ec-fmt-grid label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #5b7ba6; white-space: nowrap; }
.ec-fmt-grid select { flex: 1; height: 26px; border: 1px solid #dfe7f2; border-radius: 6px; font-size: 12px; color: #24354f; background: #fff; }
.ec-fmt-grid input[type="color"] { width: 44px; height: 26px; border: 1px solid #dfe7f2; border-radius: 6px; background: #fff; padding: 1px; }
.ec-fmt-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 5px 4px; border-top: 1px solid #f1f5fb; font-size: 12px; color: #5b7ba6; }
.ec-fmt-row input[type="color"] { width: 40px; height: 24px; border: 1px solid #dfe7f2; border-radius: 6px; background: #fff; padding: 1px; }
.ec-sw-grid .ec-sw-cell.ec-sw-none { background: #fff; position: relative; }
.ec-sw-grid .ec-sw-cell.ec-sw-none::after {
  content: ""; position: absolute; inset: 0; display: block;
  background: linear-gradient(45deg, transparent 44%, #ef4444 44% 56%, transparent 56%);
}
.ec-pop { max-height: 78vh; overflow: auto; }

/* ============================================================
   模块右上角的 ✕ 删除钮彻底隐藏（用户三轮反馈：常驻乱/悬停也嫌乱）。
   删除入口：① 段落右键菜单 → 删除  ② 点模块左侧 ⠿ 抓手 → 删除  ③ 空模块里按 Backspace
   ============================================================ */
#docEditor > .block > .block-remove { display: none !important; }

/* ============================================================
   缩略框标题补丁：原版 CSS 完全没有 .collapse-title 规则，
   空标题高度为 0 → 插入后根本点不中、没法输入标题。
   ============================================================ */
#docEditor .collapse-title { min-height: 20px; flex: 1; outline: none; }
#docEditor .collapse-title:empty::before { content: '输入标题…'; color: #94a3b8; pointer-events: none; }

/* ============================================================
   空字段零尺寸导致「点不中、没法输入」的补丁
   （原版 CSS 里 .todo-text 无 flex/min-height；缩略框正文行字段也无高度）
   ============================================================ */
#docEditor .block.todo .todo-text { flex: 1; min-height: 20px; }
#docEditor .collapse-body .block.mini > [data-field] { min-height: 22px; }

/* ============================================================
   无输入框模块（图片 / 附件 / 分隔线）的「对象选中态」
   点一下选中 → Delete/Backspace 直接删除，Enter / ↓ / → 光标落到它后面。
   图片块本身还有原版 .img-selected 蓝框 + 缩放手柄，这里是给附件/分隔线
   这类没有原版选中样式的块一个统一的可见反馈。
   ============================================================ */
#docEditor > .block.ec-void-sel {
  outline: 2px solid rgba(91, 140, 255, .65);
  outline-offset: 2px;
  border-radius: 8px;
  background: rgba(91, 140, 255, .07);
}
#docEditor > .block.ec-void-sel > .block-remove { display: none !important; }

/* ============================================================
   顶栏动作按钮去底色（20260922e 用户反馈）：
   保存(蓝底) / 分享(描边) / 撤回分享(橙底) / 删除(红底) → 全部改为无底色纯文字，
   悬停给一层极淡的灰作反馈；「删除」保留红字以示危险操作。
   ============================================================ */
#docEditorPage .doc-editor-actions button.btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #334155;
  font-weight: 600;
}
#docEditorPage .doc-editor-actions button.btn:hover { background: rgba(15, 37, 64, .06) !important; }
#docEditorPage .doc-editor-actions button.btn:active { background: rgba(15, 37, 64, .1) !important; }
#docEditorPage .doc-editor-actions button[onclick*="deleteCurrentDoc"] { color: #d64545; }
#docEditorPage .doc-editor-actions button[onclick*="deleteCurrentDoc"]:hover { background: rgba(214, 69, 69, .08) !important; }

/* ============================================================
   左上角工具条：保存 / 撤销 / 重做（20260922w → 20260922z Excel 风格改版）
   位置：顶栏「← 返回文档列表」之后、标题之前。
   交互参考 Excel 工具栏：
     · 保存 = 蓝底白字主按钮（软盘图标 + 文字）；
     · 撤销/重做 = SVG 图标按钮 + 右侧 ▾（split button）：
       点图标走一步，点 ▾ 开历史下拉，不可用时整体置灰；
     · Word / Excel 两类文档都显示（Excel 有自己的快照栈）。
   ============================================================ */
.ec-qbar { display: flex; align-items: center; gap: 2px; flex: none; }
.ec-qbar .ec-qbtn,
.ec-qbar .ec-qcaret {
  border: none; background: transparent; cursor: pointer; color: #334155;
  font-family: inherit; border-radius: 7px; transition: background .12s, color .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.ec-qbar .ec-qbtn { font-size: 15px; line-height: 1; padding: 6px 8px; font-weight: 600; }
.ec-qbar .ec-qbtn svg { display: block; }
.ec-qbar .ec-qsave {
  background: #2f5fa8; color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 5px 12px 5px 10px; gap: 5px;
  box-shadow: 0 1px 2px rgba(15, 37, 64, .18);
}
.ec-qbar .ec-qsave:hover:not(:disabled) { background: #295290; }
.ec-qbar .ec-qsave:active:not(:disabled) { background: #24477e; }
.ec-qbar .ec-qsave:disabled { background: #b9c6da; box-shadow: none; cursor: default; }
.ec-qbar .ec-qbtn:hover:not(:disabled):not(.ec-qsave) { background: rgba(15, 37, 64, .07); }
.ec-qbar .ec-qbtn:active:not(:disabled):not(.ec-qsave) { background: rgba(15, 37, 64, .11); }
.ec-qbar .ec-qbtn:disabled { color: #c3ccdb; cursor: default; background: transparent; }
.ec-qbar .ec-qline { width: 1px; height: 18px; background: #e3e9f2; margin: 0 7px; flex: none; }
.ec-qbar .ec-qgrp { display: inline-flex; align-items: center; flex: none; }
.ec-qbar .ec-qgrp .ec-qbtn { padding-right: 3px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ec-qbar .ec-qcaret { font-size: 10px; line-height: 1; padding: 8px 5px; color: #7c88a3; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ec-qbar .ec-qcaret:hover { background: rgba(15, 37, 64, .07); color: #2f5fa8; }
.ec-qbar .ec-qcaret:disabled { color: #d4dbe7; cursor: default; background: transparent !important; }

/* 撤销/重做历史下拉 */
.ec-qhist {
  position: fixed; z-index: 4000; min-width: 216px; max-width: 300px;
  background: #fff; border: 1px solid #e3e9f2; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 37, 64, .16); padding: 6px;
}
.ec-qhist-h { font-size: 11px; color: #97a3bd; padding: 3px 8px 6px; letter-spacing: .3px; }
.ec-qhist-i { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.ec-qhist-i:hover { background: rgba(47, 95, 168, .09); }
.ec-qhist-n { flex: none; width: 26px; font-size: 11px; font-weight: 700; color: #2f5fa8; }
.ec-qhist-l { flex: 1; min-width: 0; font-size: 13px; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-qhist-t { flex: none; font-size: 11px; color: #97a3bd; }
.ec-qhist-empty { padding: 10px 8px; font-size: 12.5px; color: #97a3bd; }

/* ===== Excel O365 外观骨架（20261013a）：绿主题 + fx 编辑栏 + 工作表条 ===== */
.excel-toolbar.ec-ribbon-host { background: #f3f2f1; }
.ec-ribbon-host .ec-ribbon { border-color: #d6d3cc; background: #f3f2f1; }
.ec-ribbon-host .ec-tabs { background: #217346; border-bottom: none; gap: 0; padding: 0; overflow: hidden; }
.ec-ribbon-host .ec-tab { color: #eaf3ee; border-bottom: 2px solid transparent; border-radius: 0; }
.ec-ribbon-host .ec-tab:hover { background: rgba(255,255,255,.14); color: #fff; }
.ec-ribbon-host .ec-tab.active { background: #f3f2f1; color: #217346; border-bottom-color: transparent; font-weight: 600; }
.ec-ribbon-host .ec-tab.ec-tab-file { background: #185c38; color: #fff; margin-right: 0; }
.ec-ribbon-host .ec-tab.ec-tab-file:hover { background: #124a2e; color: #fff; }
.ec-ribbon-host .ec-group { border-right: 1px solid #d9d6cf; }
.ec-ribbon-host .ec-gtitle { color: #797775; }
.ec-ribbon-host .ec-b { border-color: transparent; }
.ec-ribbon-host .ec-b:hover { background: #e1dfdd; border-color: transparent; color: #333; }
.ec-ribbon-host .ec-b.on { background: #d6d3cc; border-color: transparent; color: #333; }
.ec-ribbon-host .ec-sel { border-color: #d6d3cc; background: #fff; }
.ec-fxbar { display: flex; align-items: center; border-top: 1px solid #d6d3cc; background: #fff; border-radius: 0 0 12px 12px; padding: 4px 8px; }
.ec-fxbar .ec-namebox { min-width: 76px; box-sizing: border-box; text-align: center; border: 1px solid #d6d3cc; border-radius: 3px; padding: 4px 8px; font-size: 12.5px; color: #333; background: #fff; }
.ec-fxbar .ec-fxbtn { width: 22px; text-align: center; color: #6b6b6b; cursor: pointer; font-size: 12px; border-radius: 3px; line-height: 20px; flex: none; }
.ec-fxbar .ec-fxbtn:hover { background: #e1dfdd; color: #217346; }
.ec-fxbar .ec-fxfx { font-style: italic; font-weight: 600; color: #555; padding: 0 6px; border-right: 1px solid #d6d3cc; margin-right: 6px; flex: none; }
.ec-fxbar input { flex: 1; min-width: 0; border: none; outline: none; font-size: 13px; color: #24354f; background: transparent; font-family: Consolas, monospace; }
.ec-nogrid td.excel-cell { border-color: transparent !important; }
.ec-sheetbar { display: flex; align-items: center; gap: 2px; padding: 3px 8px; background: #f3f2f1; border: 1px solid #d6d3cc; border-radius: 10px; margin-bottom: 6px; }
.ec-sheetbar .ec-sheet { font-size: 12px; padding: 3px 14px; border-radius: 4px 4px 0 0; color: #444; border-bottom: 2px solid #217346; cursor: pointer; user-select: none; }
.ec-sheetbar .ec-sheet:hover { background: #e6f2ea; }
.ec-sheetbar .ec-sheet.active { background: #fff; color: #217346; font-weight: 600; }
.ec-sheetbar .ec-sheet-add { width: 22px; text-align: center; color: #217346; cursor: pointer; font-size: 14px; border-radius: 4px; }
.ec-sheetbar .ec-sheet-add:hover { background: #e1dfdd; }
.ec-sheetbar .ec-sheet-spring { flex: 1; }
.ec-filemenu { position: absolute; z-index: 60; background: #fff; border: 1px solid #d6d3cc; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.14); padding: 4px; min-width: 172px; }
.ec-filemenu .ec-mi { padding: 7px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; color: #333; }
.ec-filemenu .ec-mi:hover { background: #e1dfdd; color: #217346; }

/* ===== 20261013e 第二批手感：填充柄 / 冻结窗格 ===== */
/* 表格区内在滚动（O365 一致：网格自己滚，列标题常驻） */
#excelGrid.excel-wrap { position: relative; max-height: calc(100vh - 300px); min-height: 240px; overflow: auto; }
.ec-fillh { position: absolute; width: 9px; height: 9px; background: #217346; border: 1px solid #fff; box-shadow: 0 0 0 1px #217346; border-radius: 1px; z-index: 7; display: none; cursor: crosshair; }
.ec-fillh.on { display: block; }
.ec-fillprev { position: absolute; border: 2px dashed #217346; background: rgba(33,115,70,.05); pointer-events: none; z-index: 6; display: none; }
.ec-fillprev.on { display: block; }
body.ec-filling, body.ec-filling * { cursor: crosshair !important; }

/* 列标题恒吸顶；冻结首行 = 数据首行吸在列标题下；冻结首列 = 行号槽 + A 列吸左 */
#excelGrid > table > thead th { position: sticky; top: 0; z-index: 4; background: #eff6ff; background-clip: padding-box; }
#excelGrid.ec-frz-row > table > tbody tr:first-child > td.excel-cell { position: sticky; top: var(--ec-frz-top, 33px); z-index: 3; background: #fff; background-clip: padding-box; }
#excelGrid.ec-frz-col > table > thead th.excel-corner,
#excelGrid.ec-frz-col > table > tbody th.excel-rownum { position: sticky; left: 0; z-index: 5; background: #eff6ff; }
#excelGrid.ec-frz-col > table > thead th:nth-child(2),
#excelGrid.ec-frz-col > table > tbody td.excel-cell[data-c="0"] { position: sticky; left: 34px; z-index: 4; background: #fff; }
#excelGrid.ec-frz-row.ec-frz-col > table > tbody tr:first-child > th.excel-rownum { top: var(--ec-frz-top, 33px); z-index: 6; }
#excelGrid.ec-frz-row.ec-frz-col > table > tbody tr:first-child > td.excel-cell[data-c="0"] { z-index: 5; }

/* ===== 20261013i ③图标集（条件格式扩展）：走 ::before，不进 textContent，collect 取不到图标 ===== */
#excelGrid td.excel-cell[data-ecicon]::before { content: ""; display: inline-block; margin-right: 5px; vertical-align: middle; }
#excelGrid td.excel-cell[data-ecicon^="arrows"]::before { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
#excelGrid td.excel-cell[data-ecicon="arrows-3"]::before { border-bottom: 8px solid #16a34a; }
#excelGrid td.excel-cell[data-ecicon="arrows-2"]::before { border-bottom: 8px solid #f59e0b; transform: rotate(90deg); }
#excelGrid td.excel-cell[data-ecicon="arrows-1"]::before { border-top: 8px solid #dc2626; }
#excelGrid td.excel-cell[data-ecicon^="flags"]::before { width: 10px; height: 9px; border-radius: 1px; }
#excelGrid td.excel-cell[data-ecicon^="circles"]::before { width: 9px; height: 9px; border-radius: 50%; }
#excelGrid td.excel-cell[data-ecicon^="flags"][data-ecicon$="-3"]::before,
#excelGrid td.excel-cell[data-ecicon^="circles"][data-ecicon$="-3"]::before { background: #16a34a; }
#excelGrid td.excel-cell[data-ecicon^="flags"][data-ecicon$="-2"]::before,
#excelGrid td.excel-cell[data-ecicon^="circles"][data-ecicon$="-2"]::before { background: #f59e0b; }
#excelGrid td.excel-cell[data-ecicon^="flags"][data-ecicon$="-1"]::before,
#excelGrid td.excel-cell[data-ecicon^="circles"][data-ecicon$="-1"]::before { background: #dc2626; }

/* ===== ④ 操作手感（20261013k）：选区拖动预览 / 工作表标签拖动排序 ===== */
.ec-moveprev { position: absolute; border: 2px solid #217346; background: rgba(33,115,70,.08); pointer-events: none; z-index: 6; display: none; }
.ec-moveprev.on { display: block; }
body.ec-moving, body.ec-moving #excelGrid, body.ec-moving #excelGrid * { cursor: move !important; }
.ec-sheetbar .ec-sheet.ec-sheet-drag { opacity: .45; }
.ec-sheetbar .ec-sheet.ec-sheet-drop { background: #d7ecdf; outline: 2px dashed #217346; outline-offset: -2px; }

/* ===== 20261019d ① 左侧 H1 大纲 ===== */
.ec-outline { position: fixed; left: 14px; z-index: 900; width: 186px; max-height: calc(100vh - 220px);
  display: none; flex-direction: column; background: #fff; border: 1px solid #e2e8f2; border-radius: 10px;
  box-shadow: 0 6px 22px rgba(15,40,80,.10); padding: 8px 6px 10px; box-sizing: border-box; }
.ec-outline .ec-ol-head { display: flex; align-items: center; justify-content: space-between;
  padding: 2px 6px 7px; font-size: 12px; font-weight: 600; color: #64748b; letter-spacing: .5px; }
.ec-outline .ec-ol-x { border: 0; background: transparent; color: #94a3b8; font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0 2px; border-radius: 4px; }
.ec-outline .ec-ol-x:hover { background: #f1f5f9; color: #475569; }
.ec-outline .ec-ol-list { overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.ec-outline .ec-ol-item { display: flex; align-items: flex-start; gap: 6px; width: 100%; text-align: left;
  border: 0; background: transparent; cursor: pointer; padding: 5px 6px; border-radius: 6px;
  font-size: 12.5px; color: #334155; line-height: 1.35; font-family: inherit; }
.ec-outline .ec-ol-item:hover { background: #f1f6fd; color: #1d4ed8; }
.ec-outline .ec-ol-item.active { background: #eaf2ff; color: #1d4ed8; font-weight: 600; }
.ec-outline .ec-ol-n { flex: 0 0 16px; color: #94a3b8; font-size: 11px; line-height: 1.5; text-align: right; }
.ec-outline .ec-ol-item.active .ec-ol-n { color: #2f5fa8; }
.ec-outline .ec-ol-t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-ol-show { position: fixed; left: 4px; top: 50%; transform: translateY(-50%); z-index: 900;
  writing-mode: vertical-rl; border: 1px solid #e2e8f2; border-left: 0; background: #fff; color: #64748b;
  border-radius: 0 6px 6px 0; padding: 10px 4px; font-size: 12px; cursor: pointer; font-family: inherit;
  box-shadow: 2px 0 8px rgba(15,40,80,.06); }
.ec-ol-show:hover { color: #1d4ed8; background: #f1f6fd; }
.doc-editor .block.ec-ol-flash { animation: ecOlFlash .7s ease; }
@keyframes ecOlFlash { 0% { background: #fff6d6; } 100% { background: transparent; } }
/* 20261020g：窄屏不再整体藏掉大纲（用户 1053px 视口下「一直没有大纲」的根因）。
   改为窄面板 + 正文右移让位；<960px（手机）才隐藏。 */
@media (max-width: 1180px) {
  .ec-outline { width: 150px; left: 8px; }
  body.ec-ol-on #docEditorPage .doc-editor-wrap { margin: 0 16px 0 168px; }
}
@media (max-width: 960px) { .ec-outline { display: none !important; } }

/* ===== 20261020g 大纲打开时正文整体右移到面板右侧（Word 导航窗格式），
   否则居中的正文会被 186px 固定面板盖住左缘 ===== */
body.ec-ol-on #docEditorPage .doc-editor-wrap { margin: 0 24px 0 210px; }

/* ===== 20261020g Word 式多级大纲：缩进层级 + 空态提示 ===== */
.ec-outline .ec-ol-item.lv1 { padding-left: 8px; font-weight: 600; }
.ec-outline .ec-ol-item.lv2 { padding-left: 22px; }
.ec-outline .ec-ol-item.lv3 { padding-left: 36px; font-size: 12px; }
.ec-outline .ec-ol-empty { padding: 16px 8px; font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.8; }
.ec-outline .ec-ol-empty span { font-size: 11px; color: #b6c2d4; }

/* ===== 20261020i：跟顶栏「在线文档」牢牢固定 —— 编辑页去掉顶部 24px 内边距，
   卡片一开始就贴住顶栏（原来滚动前 24px 会跟着正文往上滑一下才吸住） ===== */
#docEditorPage.content-page { padding-top: 0; }
#docEditorPage .doc-editor-header { margin-top: 0; }

/* ===== 20261020g 顶区三合一：header + 选项卡 + 工具条 融成一张卡片 ===== */
/* 1) header 单行紧凑：返回/保存/撤销重做/标题/已保存/分享/撤回/删除 一行放下 */
#docEditorPage .doc-editor-header { flex-wrap: nowrap; padding: 7px 10px; gap: 8px;
  margin-bottom: 0; border-radius: 12px 12px 0 0; border-bottom: none; }
#docEditorPage .doc-title-input { font-size: 17px; padding: 2px 0; min-width: 0; }
@media (max-width: 860px) { #docEditorPage .doc-editor-header { flex-wrap: wrap; } }
/* 2) 提示条撤掉（内容是引导文案，不是功能；省一行的同时让 header 和工具条贴合成一张卡） */
#docEditorPage .doc-editor-tip { display: none; }
/* 3) 选项卡改回顶部横排（20261022 用户反馈：左列竖排不好用）；header+tabs+工具条仍融成一张卡 */
#docEditorPage .ec-ribbon { display: block; margin-top: 0;
  border-top-left-radius: 0; border-top-right-radius: 0; }
.ec-tabs { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 0; padding: 0 4px;
  border-right: none; border-radius: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.ec-tab { padding: 5px 13px; text-align: center; border-left: none; white-space: nowrap; border-radius: 0; }
.ec-tab.active { border-left-color: transparent; }
.ec-panel { min-width: 0; }
/* Excel 主题的绿 tab 同步改回顶部横排 */
.ec-ribbon-host .ec-tabs { border-right: none; border-radius: 0; }
.ec-ribbon-host .ec-tab { border-left: none; }
.ec-ribbon-host .ec-tab.active { border-left-color: transparent; }

/* ===== 20261019d ③ 工具条瘦身：竖向占用从 ~98px 压到 ~78px ===== */
.ec-tab { padding: 5px 13px; font-size: 12.5px; }
.ec-panel { padding: 5px 8px 7px; }
.ec-group { gap: 3px; padding: 0 8px; }
.ec-gtitle { font-size: 10px; line-height: 1; }
.ec-b { height: 26px; min-width: 26px; font-size: 12.5px; }
.ec-b svg { width: 14px; height: 14px; }
.ec-sel { height: 26px; font-size: 12px; }
.ec-vsep { height: 18px; }
.ec-ribbon { margin-bottom: 6px; }

/* 专注模式：只留标题行 + 正文（Ctrl+Shift+F） */
body.ec-focus .topbar { display: none !important; }
body.ec-focus #docEditorPage .doc-editor-header { top: 0 !important; }
body.ec-focus .ec-ribbon { display: none !important; }
body.ec-focus #wordEditorArea { padding-top: 6px; }
.ec-focus-exit { display: none; position: fixed; right: 14px; top: 10px; z-index: 10002; align-items: center;
  background: rgba(20, 40, 70, .88); color: #fff; border: 0; border-radius: 999px; padding: 6px 13px;
  font-size: 12px; cursor: pointer; font-family: inherit; box-shadow: 0 4px 14px rgba(20,40,70,.22); }
.ec-focus-exit:hover { background: rgba(20, 40, 70, 1); }

/* 20261019d ③ 单排显示：允许横向滚动，绝不换行（换行才是 124px 的主因） */
.ec-ribbon .ec-groups { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 1px; }
.ec-ribbon .ec-groups::-webkit-scrollbar { height: 5px; }
.ec-ribbon .ec-groups::-webkit-scrollbar-thumb { background: #d7e1ee; border-radius: 3px; }
.ec-ribbon .ec-groups::-webkit-scrollbar-thumb:hover { background: #b9c9dd; }
.ec-ribbon .ec-group { flex: none; }
.ec-ribbon .ec-b { padding: 0 5px; }
.ec-ribbon .ec-gbody { gap: 2px; }
.ec-ribbon .ec-tab { padding: 4px 12px; }

/* 20261019f 大纲显示期间让开左侧导航（桌面端） */
@media (min-width: 901px) {
  body.ec-ol-on .sidebar { display: none; }
}
