/* 內建字型：全字庫正楷體（標楷體的替代，見 packaging/fetch-fonts.sh）。
   電腦上有真的標楷體就用 local() 的，沒有才用內建的；「TW-Kai」是內建
   字型本身的名字。編輯器字型選單的「標楷體」寫的是
   "DFKai-SB", "BiauKai", "TW-Kai"，所以三個名字都登記。 */
@font-face { font-family: "DFKai-SB"; src: local("DFKai-SB"), local("標楷體"), url("vpndoc://app/fonts/TW-Kai.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "標楷體"; src: local("DFKai-SB"), local("標楷體"), url("vpndoc://app/fonts/TW-Kai.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "BiauKai"; src: local("BiauKai"), url("vpndoc://app/fonts/TW-Kai.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "TW-Kai"; src: local("TW-Kai"), url("vpndoc://app/fonts/TW-Kai.ttf") format("truetype"); font-display: swap; }

:root {
  color-scheme: light;
  --accent: #1a73e8;
  --accent-dark: #1765cc;
  --bg: #f8f9fa;
  --side-bg: #f7f8fa;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --hover: #f1f3f4;
  --active: #e8f0fe;
  --active-text: #1967d2;
  --danger: #c5221f;
  --danger-bg: #fce8e6;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, "Segoe UI", "Noto Sans TC", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
button,
input,
select {
  font-family: inherit;
}
.layout {
  display: flex;
  height: 100vh;
}
.spacer {
  flex: 1;
}
.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--muted);
}
.icon-btn:hover {
  background: var(--hover);
}

/* ---------- 側欄：文件列表 ---------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--side-bg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.sidebar[hidden] {
  display: none;
}
#new-doc {
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
#new-doc:hover {
  background: var(--accent-dark);
}
.search {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  background: #fff;
  outline: none;
  flex-shrink: 0;
}
.search:focus {
  border-color: var(--accent);
}
.doc-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
.doc-item {
  position: relative;
  padding: 8px 30px 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
}
.doc-item:hover {
  background: #e8eaed;
}
.doc-item.active {
  background: var(--active);
  color: var(--active-text);
}
.doc-item .doc-title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-item .doc-excerpt {
  display: block;
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.doc-item .doc-time {
  display: block;
  font-size: 11px;
  opacity: 0.65;
  margin-top: 3px;
}
.doc-item .doc-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: none;
}
.doc-item:hover .doc-delete,
.doc-item.active .doc-delete {
  display: block;
}
.doc-item .doc-delete:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.12);
}
.empty-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
}
.sidebar-footer {
  font-size: 11px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* ---------- 編輯區 ---------- */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}

/* 頁首 */
.docs-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 16px 2px 12px;
  flex-shrink: 0;
}
.docs-logo {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
  border-radius: 8px;
  margin-top: 2px;
}
.docs-logo:hover {
  background: var(--hover);
}
.docs-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.docs-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.title-input {
  border: 1px solid transparent;
  border-radius: 4px;
  outline: none;
  font-size: 18px;
  padding: 2px 6px;
  color: var(--text);
  background: transparent;
  min-width: 120px;
  max-width: 520px;
  width: 40%;
}
.title-input:hover {
  border-color: var(--border);
}
.title-input:focus {
  border-color: var(--accent);
}
.title-input::placeholder {
  color: #9aa0a6;
}
.saved-at {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.docs-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.header-btn {
  height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.header-btn:hover,
.header-btn.on {
  background: var(--hover);
  color: var(--text);
}
.share-btn {
  height: 36px;
  padding: 0 18px;
  border: none;
  border-radius: 18px;
  background: #c2e7ff;
  color: #001d35;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.share-btn:hover {
  background: #a8dafb;
}

/* 選單列 */
.menubar {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  position: relative;
}
.menubar > button {
  height: 26px;
  padding: 0 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
}
.menubar > button:hover,
.menubar > button.open {
  background: var(--hover);
}
.dropdown {
  position: absolute;
  z-index: 20;
  min-width: 230px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
}
.dropdown .item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 32px;
  padding: 0 16px 0 32px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.dropdown .item:hover,
.dropdown .item.open {
  background: var(--hover);
}
.dropdown .item[disabled] {
  color: #b0b4ba;
  cursor: default;
}
.dropdown .item[disabled]:hover {
  background: transparent;
}
.dropdown .item.danger {
  color: var(--danger);
}
.dropdown .item .check {
  position: absolute;
  left: 12px;
  font-size: 12px;
}
.dropdown .item .label {
  flex: 1;
}
.dropdown .item .shortcut {
  color: var(--muted);
  font-size: 12px;
}
.dropdown .item .arrow {
  color: var(--muted);
  font-size: 11px;
}
.dropdown .sep {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.dropdown .submenu {
  position: absolute;
  left: 100%;
  top: -6px;
}

/* 工具列 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  margin: 6px 16px 0;
  padding: 0 10px;
  border-radius: 20px;
  background: #edf2fa;
  flex-shrink: 0;
  overflow: hidden;
}
.toolbar button {
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
}
.toolbar button:hover {
  background: #d3e3fd;
}
.toolbar button.active {
  background: #d3e3fd;
  color: var(--active-text);
}
.toolbar button small {
  font-size: 9px;
  vertical-align: super;
}
.toolbar .sep {
  width: 1px;
  height: 18px;
  background: #c4c7c5;
  margin: 0 4px;
  flex-shrink: 0;
}
.block-select {
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0 4px;
}
.block-select:hover {
  background: #d3e3fd;
}
.font-select {
  height: 28px;
  width: 150px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0 4px;
}
.font-select:hover {
  background: #d3e3fd;
}
.font-size {
  width: 40px;
  height: 26px;
  text-align: center;
  border: 1px solid #c4c7c5;
  border-radius: 6px;
  background: #fff;
  font-size: 12.5px;
  outline: none;
}
.font-size:focus {
  border-color: var(--accent);
}
.toolbar {
  overflow: visible;
}
.status {
  font-size: 12px;
  color: var(--muted);
  padding-right: 6px;
}
.status.error {
  color: var(--danger);
}

/* 頁面本體：灰底 + 白色紙張 */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  background: var(--bg);
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.page-scroll {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 60px;
  min-width: 0;
}
.page {
  background: #fff;
  max-width: 816px;
  min-height: 700px;
  margin: 0 auto;
  padding: 60px 72px;
  position: relative;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
  border-radius: 2px;
  font-size: 15px;
  line-height: 1.7;
  outline: none;
}
.page[contenteditable="false"] {
  background: #fffdf5;
}
.page:empty::before {
  content: "開始輸入…";
  color: #9aa0a6;
}
.page h1 {
  font-size: 26px;
  margin: 18px 0 8px;
}
.page h2 {
  font-size: 20px;
  margin: 16px 0 6px;
}
.page h3 {
  font-size: 16px;
  margin: 12px 0 4px;
}
.page .math { font-variant-numeric: lining-nums; }
.page .math-block { text-align: center; margin: .7em 0; }
.page .math sup, .page .math sub { line-height: 0; }
.page blockquote {
  margin: 8px 0;
  padding: 4px 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: #f8f9fa;
}
.page pre {
  background: #f1f3f4;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}
.page a {
  color: var(--active-text);
}
.page hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.page img {
  max-width: 100%;
}
.page table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
}
.page td,
.page th {
  border: 1px solid #bdc1c6;
  padding: 6px 10px;
  min-width: 40px;
}
.page ul.checklist {
  list-style: none;
  padding-left: 4px;
}
.page ul.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.page ul.checklist input[type="checkbox"] {
  margin-top: 7px;
}
.page ul.checklist li.done {
  color: var(--muted);
  text-decoration: line-through;
}
.preview-banner {
  max-width: 816px;
  margin: 0 auto 12px;
  background: #fef7e0;
  border: 1px solid #f9d976;
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.preview-banner[hidden] {
  display: none;
}
.preview-banner button {
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
#preview-restore {
  background: var(--accent);
  color: #fff;
}

/* 修改紀錄側板 */
.history-panel {
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
}
.history-panel[hidden] {
  display: none;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 8px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.panel-head .header-btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.history-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.history-item:hover {
  background: var(--hover);
}
.history-item.active {
  background: var(--active);
  color: var(--active-text);
}
.history-item .h-time {
  font-weight: 600;
}
.history-item .h-meta {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}
.history-item.current .h-time::after {
  content: "（目前版本）";
  font-weight: normal;
  font-size: 12px;
  opacity: 0.7;
}
.panel-foot {
  font-size: 11px;
  color: var(--muted);
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

/* 狀態列 */
.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 26px;
  padding: 0 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  background: #fff;
}

/* 尋找與取代 */
.find-panel {
  position: fixed;
  top: 110px;
  right: 40px;
  z-index: 15;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px;
  width: 360px;
}
.find-panel[hidden] {
  display: none;
}
.find-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.find-row input {
  flex: 1;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  outline: none;
}
.find-row input:focus {
  border-color: var(--accent);
}
.find-row button {
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: var(--hover);
  cursor: pointer;
  font-size: 12.5px;
}
.find-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 14px;
}

/* 對話框 */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(32, 33, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog[hidden] {
  display: none;
}
.dialog-box {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  width: 440px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-size: 13.5px;
  line-height: 1.55;
}
.dialog-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}
.dialog-body {
  margin-bottom: 12px;
}
.dialog-body:empty {
  display: none;
}
.dialog-body table {
  border-collapse: collapse;
  width: 100%;
}
.dialog-body th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 4px 10px 4px 0;
  white-space: nowrap;
  vertical-align: top;
}
.dialog-body td {
  padding: 4px 0;
  word-break: break-all;
}
.dialog-body kbd {
  background: #f1f3f4;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 12px;
}
.dialog-body .choice {
  display: block;
  width: 100%;
  text-align: left;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  margin-bottom: 6px;
  font-size: 13.5px;
}
.dialog-body .choice:hover {
  background: var(--hover);
}
.dialog-body .row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.dialog-body .row input[type="number"] {
  width: 70px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
}
#dialog-input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  margin-bottom: 14px;
}
#dialog-input:focus {
  border-color: var(--accent);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dialog-actions button {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: var(--hover);
  cursor: pointer;
  font-size: 13px;
}
#dialog-ok {
  background: var(--accent);
  color: #fff;
}
#dialog-ok.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
#dialog-cancel[hidden] {
  display: none;
}
.docs-logo.back { font-size: 22px; font-weight: 600; color: var(--muted); }
.docs-logo.back { font-size: 22px; font-weight: 600; color: var(--muted); }

/* ---------- 版面（editor-layout.js）：紙張、分頁線、頁首頁尾、目錄、分頁符號、大綱 ---------- */
.workspace { position: relative; }
.page-wrap { position: relative; width: max-content; max-width: none; margin: 0 auto; isolation: isolate; }
.page-wrap > .page { margin: 0; }
/* 分頁顯示：每一頁一張白紙，畫在編輯區後面（editor-layout.js 依頁數產生），編輯區本身透明 */
.page-sheets { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.page-sheet { position: absolute; left: 0; right: 0; background: #fff; border-radius: 2px; box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15); }
.page-wrap.paged > .page { background: transparent; box-shadow: none; border-radius: 0; }
.page-wrap.paged:has(> .page[contenteditable="false"]) .page-sheet { background: #fffdf5; }
.page-guides { position: absolute; inset: 0; pointer-events: none; }
.page-guide { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed #c4c7c5; }
/* 紙張外側的灰色缺口：一眼看出是兩張紙 */
.page-guide::before, .page-guide::after { content: ""; position: absolute; top: -3px; width: 14px; height: 6px; background: var(--bg); }
.page-guide::before { left: -14px; }
.page-guide::after { right: -14px; }
.page-guide .pg-label { position: absolute; right: 6px; top: -9px; font-size: 10.5px; line-height: 16px; color: #80868b; background: #fff; padding: 0 7px; border: 1px solid #e8eaed; border-radius: 8px; }
.hf-preview { position: absolute; display: flex; gap: 8px; height: 18px; font-size: 11px; line-height: 18px; color: #9aa0a6; pointer-events: auto; cursor: pointer; border-radius: 4px; }
.hf-preview:hover { background: #f1f3f4; color: var(--muted); }
.hf-preview span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-preview .hf-left { text-align: left; }
.hf-preview .hf-center { text-align: center; }
.hf-preview .hf-right { text-align: right; }
.page-info { font-size: 12px; color: var(--muted); margin-right: 14px; }

/* 分頁符號 */
.page .page-break { display: block; height: 0; margin: 20px 0; border-top: 1px dashed var(--accent); position: relative; user-select: none; cursor: default; }
.page .page-break::after { content: "分頁符號"; position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); background: #fff; color: var(--accent); font-size: 11px; line-height: 16px; padding: 0 8px; }

/* 目錄 */
/* 畫面跟列印的間距要一樣（分頁估算才準）：滑過的框用 outline，不佔位置 */
.page nav.toc { display: block; margin: 8px 0 14px; padding: 0; border-radius: 4px; user-select: none; cursor: default; }
.page nav.toc:hover { outline: 1px solid var(--border); outline-offset: 6px; background: #fafbfc; }
.page nav.toc p { margin: 0; }
.page nav.toc .toc-title { font-weight: 700; font-size: 1.15em; margin-bottom: 6px; }
.page nav.toc .toc-entry { display: flex; align-items: baseline; gap: 4px; padding: 1px 0; }
.page nav.toc .toc-l1 { font-weight: 600; }
.page nav.toc .toc-l2 { padding-left: 1.6em; }
.page nav.toc .toc-l3 { padding-left: 3.2em; }
.page nav.toc .toc-link { color: inherit; text-decoration: none; cursor: pointer; }
.page nav.toc .toc-link:hover { color: var(--active-text); text-decoration: underline; }
.page nav.toc[data-toc="links"] .toc-link { color: var(--active-text); text-decoration: underline; }
.page nav.toc .toc-dots { flex: 1; border-bottom: 1.5px dotted #9aa0a6; transform: translateY(-0.3em); min-width: 1em; }
.page nav.toc .toc-page { min-width: 1.6em; text-align: right; font-weight: 400; }
.page nav.toc .toc-empty { color: var(--muted); font-size: 0.9em; }
.toc-tools { position: absolute; z-index: 6; display: flex; gap: 2px; padding: 3px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 6px rgba(60, 64, 67, 0.2); }
.toc-tools[hidden] { display: none; }
.toc-tools button { height: 26px; padding: 0 10px; border: none; border-radius: 6px; background: transparent; cursor: pointer; font-size: 12.5px; color: var(--text); white-space: nowrap; }
.toc-tools button:hover { background: var(--hover); }

/* 文件大綱 */
.outline-panel { width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.outline-panel[hidden] { display: none; }
.outline-list { flex: 1; overflow-y: auto; padding: 8px 6px; }
.ol-item { display: flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 6px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ol-item:hover { background: var(--hover); }
.ol-item.current { color: var(--active-text); background: var(--active); }
.ol-l1 { font-weight: 600; }
.ol-l2 { padding-left: 20px; }
.ol-l3 { padding-left: 34px; font-size: 12.5px; }
.ol-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-page { font-size: 11px; color: #9aa0a6; font-weight: 400; }
.ol-acts { display: none; gap: 1px; flex-shrink: 0; }
.ol-item:hover .ol-acts { display: flex; }
.ol-item:hover .ol-page { display: none; }
.ol-acts button { width: 22px; height: 22px; padding: 0; border: none; border-radius: 4px; background: transparent; cursor: pointer; color: var(--muted); font-size: 12px; }
.ol-acts button:hover { background: #fff; color: var(--text); }
.ol-rename { flex: 1; min-width: 0; height: 24px; border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; font: inherit; }
.ol-empty { color: var(--muted); font-size: 12.5px; line-height: 1.6; padding: 12px 8px; }
.outline-toggle { position: absolute; left: 12px; top: 12px; z-index: 4; width: 34px; height: 34px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3); cursor: pointer; color: var(--muted); font-size: 15px; }
.outline-toggle:hover { color: var(--text); background: var(--hover); }
.outline-toggle[hidden] { display: none; }

/* 格式刷（文件頁不載 common.css，樣式跟試算表、簡報的那份一樣） */
:root { --brush-cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M4 21c2 0 4-1 4-3 0-1 1-2 2-2s2-1 2-2l8-8-3-3-8 8c-1 0-2 1-2 2s-1 2-2 2c-2 0-3 2-3 4 1 1 1 2 2 2z' fill='%231a73e8' stroke='white' stroke-width='1'/></svg>") 3 21; }
.toolbar .paint-btn.active { background: var(--tool-hover, #d3e3fd); color: var(--active-text); }
.toolbar .paint-btn.sticky { box-shadow: inset 0 0 0 2px var(--accent); }
.page.painting { cursor: var(--brush-cursor), text; }

/* 對話框裡的表單（頁面設定、頁首頁尾） */
.dialog-body .form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dialog-body .form-row > label:first-child { width: 72px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.dialog-body .form-row select, .dialog-body .form-row input[type="text"] { height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; font-size: 13px; background: #fff; }
.dialog-body .form-row input[type="text"] { flex: 1; min-width: 0; }
.dialog-body .form-row[hidden], .dialog-body #hf-num-opts[hidden] { display: none; }
.dialog-body .radio-row, .dialog-body .check { display: inline-flex; gap: 14px; align-items: center; font-size: 13px; }
.dialog-body .margin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.dialog-body .margin-grid input { width: 64px; height: 28px; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; }
.dialog-body .form-sep { height: 1px; background: var(--border); margin: 6px 0 12px; }
.dialog-body .form-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* ---------- 列印 / PDF：只印文件內容；紙張、邊界、頁首頁尾、頁碼在 @page（editor-layout.js 產生） ---------- */
@media print {
  .docs-header, .toolbar, .statusbar, .outline-panel, .outline-toggle, .history-panel, .find-panel, .dialog, .preview-banner, .page-guides, .page-sheets, .toc-tools { display: none !important; }
  html, body, .layout, .editor-area, .workspace, .page-scroll, .page-wrap { display: block !important; height: auto !important; overflow: visible !important; background: #fff !important; margin: 0 !important; padding: 0 !important; border: 0 !important; width: auto !important; }
  .page { width: auto !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
  .page .page-break { break-after: page; height: 0; margin: 0; border: 0; }
  .page .page-break::after { display: none; }
  .page nav.toc { outline: none !important; background: none !important; }
  .page nav.toc .toc-link { color: inherit !important; text-decoration: none !important; }
  .page tr, .page img { break-inside: avoid; }
  .page h1, .page h2, .page h3 { break-after: avoid; }
}
