/* 基本：參考 Notion／GitBook，重排版呼吸感與字體對比，不用漸層與動畫 */
:root {
  --fg: #1f2328; --fg-soft: #3d444d; --muted: #656d76; --line: #e3e6ea; --line-strong: #d0d7de;
  --accent: #0b5cad; --accent-soft: #eaf2fb; --bg-soft: #f6f8fa; --side-bg: #fbfbfa;
}
* { box-sizing: border-box; }
/* 網站只有淺色主題：連嵌入的 draw.io 等 SVG 也固定用淺色（否則深色模式下線條變白、看不見） */
:root { color-scheme: light; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--fg); background: #fff; line-height: 1.75; font-size: 16px;
  font-family: "Noto Sans CJK TC", "Noto Sans TC", "Source Han Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
.muted { color: var(--muted); font-size: .9em; }

/* 頂欄 */
.topbar { display: flex; gap: 1.4rem; align-items: center; height: 3.25rem; padding: 0 1.5rem; position: sticky; top: 0; background: var(--accent); color: #fff; z-index: 2; font-size: .92rem; }
.brand { font-weight: 700; font-size: 1.05rem; color: #fff; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.switch { color: rgba(255, 255, 255, .85); display: flex; align-items: center; gap: .5rem; }
.switch select { font: inherit; color: #fff; padding: .2rem 1.6rem .2rem .55rem; border: 1px solid rgba(255, 255, 255, .55); border-radius: 6px; background-color: transparent; }
.switch select option { color: var(--fg); background: #fff; }
.topbar .user { color: rgba(255, 255, 255, .85); font-size: .92rem; }
.topbar-right { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.topbar-right a { color: #fff; }
.topbar-right a:hover { color: #fff; text-decoration: underline; text-underline-offset: .25em; }
/* Tag 面板（tag-panel） */
/* 頂欄按鈕：無外框，圖示＋文字＋▾；滑鼠移上或開啟時淡底色 */
.topbar .topbar-btn { display: inline-flex; align-items: center; gap: .45rem; height: 2.1rem; font: inherit; font-size: .92rem; color: #fff; background: none; border: 0; border-radius: 6px; padding: 0 .6rem; cursor: pointer; text-decoration: none; }
.topbar .topbar-btn:hover, .topbar .topbar-btn.on, .topbar .topbar-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .16); color: #fff; text-decoration: none; }
.topbar-btn .tb-ico { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar-btn .tb-chev { width: .75rem; height: .75rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.topbar-btn[aria-expanded="true"] .tb-chev { transform: rotate(180deg); }
body.pe-full .topbar-btn { display: none; }
.tag-panel { position: fixed; top: 3.25rem; right: 0; bottom: 0; width: 21rem; z-index: 4; display: flex; flex-direction: column; background: #fbfbfa; border-left: 1px solid var(--line); font-size: .9rem; line-height: 1.6; }
.tag-panel[hidden] { display: none; }
body.tag-panel-open:not(.pe-full) .content { padding-right: calc(21rem + 2rem); }
.tp-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem .3rem; }
.tp-close { font: inherit; font-size: 1.1rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: .1rem .4rem; border-radius: 4px; }
.tp-close:hover { background: #eef0f3; color: var(--fg); }
.tp-tools { display: flex; gap: .3rem; padding: 0 .8rem .4rem; }
.tp-tool { font: inherit; font-size: .8rem; background: none; border: 1px solid transparent; border-radius: 4px; color: var(--muted); cursor: pointer; padding: .05rem .5rem; }
.tp-tool:hover { background: #eef0f3; color: var(--fg); }
.tp-search { margin: 0 1rem .5rem; font: inherit; font-size: .85rem; padding: .3rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
.tp-search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.tp-tree { list-style: none; margin: 0; padding: 0 .5rem .5rem; overflow: auto; flex: 1; min-height: 6rem; }
.tp-tree ul { list-style: none; margin: 0 0 0 .75rem; padding: 0 0 0 .4rem; border-left: 1px solid var(--line); }
.tp-row { display: flex; align-items: center; gap: .15rem; border-radius: 5px; padding: .05rem .2rem; }
.tp-row:hover { background: #eef0f3; }
.tp-row.selected { background: var(--accent-soft); }
.tp-twisty, .tp-twisty-space { flex: none; width: 1.2rem; height: 1.2rem; }
.tp-twisty { background: none; border: 0; cursor: pointer; border-radius: 4px; position: relative; padding: 0; }
.tp-twisty::before { content: ""; position: absolute; left: .4rem; top: .35rem; width: .35rem; height: .35rem; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); }
.tp-twisty.open::before { transform: rotate(45deg); left: .38rem; top: .3rem; }
.tp-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; font: inherit; text-align: left; background: none; border: 0; color: var(--fg); cursor: pointer; padding: .1rem .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-row.current .tp-name { font-weight: 700; color: var(--accent); }
.tp-row.has-current .tp-name { color: var(--accent); }
.tp-dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%; }
.tp-dot[class*="tag-c"] { background: currentColor !important; }
.tp-count { flex: none; font-size: .78rem; color: var(--muted); padding-right: .3rem; font-variant-numeric: tabular-nums; }
.tp-empty { color: var(--muted); padding: .5rem; }
.tp-tree .tp-pages { list-style: none; margin: .1rem 0 .3rem 1.35rem; padding: 0 0 0 .6rem; border-left: 2px solid var(--accent-soft); }
.tp-pages li { padding: .2rem .3rem; display: flex; flex-direction: column; line-height: 1.4; border-radius: 4px; }
.tp-pages li:hover { background: #eef0f3; }
.tp-pages a { font-size: .86rem; }
.tp-projects { font-size: .75rem; color: var(--muted); }
@media (max-width: 900px) { .tag-panel { width: 100%; } body.tag-panel-open:not(.pe-full) .content { padding-right: 1.25rem; } }
.button { display: inline-block; border: 1px solid var(--line-strong); border-radius: 6px; padding: .15rem .8rem; font-size: .88rem; color: var(--fg-soft); background: #fff; }
.button:hover { text-decoration: none; border-color: var(--muted); color: var(--fg); }

/* 版面 */
.layout { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); min-height: calc(100vh - 3.25rem); }
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }

/* 側欄頁面樹 */
.sidebar { background: var(--side-bg); border-right: 1px solid var(--line); padding: 1.6rem 1rem 2rem; font-size: .92rem; line-height: 1.6;
  position: sticky; top: 3.25rem; height: calc(100vh - 3.25rem); overflow: auto; }
.sidebar ul { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 1px solid var(--line); margin-left: .65rem; }
.sidebar > ul { padding: 0; border: 0; margin: 0; }
.sidebar li { margin: 1px 0; }
.sidebar a, .sidebar .group { display: block; padding: .3rem .65rem; border-radius: 6px; color: var(--fg-soft); }
.sidebar a:hover { background: #f0f1f3; text-decoration: none; color: var(--fg); }
.sidebar > ul > li { margin-top: .15rem; }
.sidebar .group { color: var(--muted); font-weight: 600; cursor: default; }
.sidebar > ul > li + li > .group { margin-top: .5rem; }
.sidebar a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 內文 */
.content { padding: 2.75rem 3rem 5rem; min-width: 0; }
.content > article { max-width: none; margin: 0; }  /* 不限寬度：圖片多且大 */
article { font-size: 1.03rem; }
article h1 { font-size: 2.15rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .6rem; }
/* 內文標題：階層以大小與顏色區分（深藍 → 品牌藍 → 青綠 → 灰） */
article h2 { font-size: 1.6rem; line-height: 1.35; font-weight: 700; color: var(--accent); margin: 2.8rem 0 .9rem; padding-bottom: .4rem; border-bottom: 2px solid #d6e4f3; }
article h3 { font-size: 1.3rem; line-height: 1.45; font-weight: 650; color: #1769c2; margin: 2.1rem 0 .6rem; }
article h4 { font-size: 1.1rem; line-height: 1.5; font-weight: 650; color: #2a78cc; margin: 1.7rem 0 .5rem; }
article h5 { font-size: 1rem; line-height: 1.55; font-weight: 600; color: var(--fg-soft); margin: 1.5rem 0 .4rem; }
article h6 { font-size: .92rem; line-height: 1.55; font-weight: 600; color: var(--muted); margin: 1.4rem 0 .4rem; letter-spacing: .02em; }
article p { margin: 0 0 1.1rem; }
article ul, article ol { padding-left: 1.5rem; margin: 0 0 1.1rem; }
article li { margin: .25rem 0; }
article li::marker { color: var(--muted); }
article blockquote { margin: 1.2rem 0; padding: .1rem 1.1rem; border-left: 3px solid var(--line-strong); color: var(--fg-soft); }
/* 註腳（footnotes） */
.footnote-ref { font-size: .75em; line-height: 0; vertical-align: super; }
.footnote-ref a { padding: 0 .1em; text-decoration: none; font-weight: 600; }
.footnote-ref a::before { content: "["; } .footnote-ref a::after { content: "]"; }
hr.footnotes-sep { margin: 2.5rem 0 1rem; border: 0; border-top: 1px solid var(--line); }
/* SVG 圖中文字的透明文字層（svg-text）：Ctrl+F 找得到，不攔截滑鼠 */
.svgt { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.svgt > img { display: block; }
.svgt-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.svgt-layer > span { position: absolute; color: transparent; line-height: 1.1; white-space: normal; overflow-wrap: anywhere; overflow: hidden; }
.svgt-layer > span::selection { color: transparent; background: rgba(11, 92, 173, .25); }
.fn-card { position: absolute; z-index: 40; max-width: min(32rem, calc(100vw - 16px)); max-height: 18rem; overflow: auto; padding: .7rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(15, 23, 42, .16); font-size: .92rem; line-height: 1.7; color: var(--fg); }
.fn-card[hidden] { display: none; }
.fn-card > p:first-child { margin-top: 0; } .fn-card > p:last-child { margin-bottom: 0; }
section.footnotes { font-size: .9em; color: var(--fg-soft); line-height: 1.7; }
section.footnotes ol { padding-left: 1.6em; margin: 0; }
section.footnotes li { margin: .3rem 0; }
section.footnotes li p { margin: 0; }
section.footnotes li:target { background: var(--accent-soft); border-radius: 4px; }
.footnote-backref { margin-left: .3em; text-decoration: none; }
/* Obsidian callout（obsidian-callouts） */
.callout { margin: 1.2rem 0; padding: .7rem 1rem; border-left: 4px solid; border-radius: 6px; color: var(--fg); }
.callout-title { display: flex; align-items: center; gap: .5rem; font-weight: 600; line-height: 1.6; }
.callout-icon { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.callout-content { margin-top: .35rem; line-height: 1.75; }
.callout-content > :first-child { margin-top: 0; }
.callout-content > :last-child { margin-bottom: 0; }
details.callout > summary { cursor: pointer; list-style: none; }
details.callout > summary::-webkit-details-marker { display: none; }
details.callout > summary::after { content: ""; margin-left: auto; width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
details.callout[open] > summary::after { transform: rotate(45deg); }
.callout[data-callout="note"] { border-left-color: rgb(8, 109, 221); background: rgba(8, 109, 221, .08); } .callout[data-callout="note"] > .callout-title { color: rgb(6, 85, 172); }
.callout[data-callout="abstract"] { border-left-color: rgb(0, 191, 188); background: rgba(0, 191, 188, .08); } .callout[data-callout="abstract"] > .callout-title { color: rgb(0, 148, 146); }
.callout[data-callout="info"] { border-left-color: rgb(8, 109, 221); background: rgba(8, 109, 221, .08); } .callout[data-callout="info"] > .callout-title { color: rgb(6, 85, 172); }
.callout[data-callout="todo"] { border-left-color: rgb(8, 109, 221); background: rgba(8, 109, 221, .08); } .callout[data-callout="todo"] > .callout-title { color: rgb(6, 85, 172); }
.callout[data-callout="tip"] { border-left-color: rgb(0, 191, 188); background: rgba(0, 191, 188, .08); } .callout[data-callout="tip"] > .callout-title { color: rgb(0, 148, 146); }
.callout[data-callout="success"] { border-left-color: rgb(8, 185, 78); background: rgba(8, 185, 78, .08); } .callout[data-callout="success"] > .callout-title { color: rgb(6, 144, 60); }
.callout[data-callout="question"] { border-left-color: rgb(236, 117, 0); background: rgba(236, 117, 0, .08); } .callout[data-callout="question"] > .callout-title { color: rgb(184, 91, 0); }
.callout[data-callout="warning"] { border-left-color: rgb(236, 117, 0); background: rgba(236, 117, 0, .08); } .callout[data-callout="warning"] > .callout-title { color: rgb(184, 91, 0); }
.callout[data-callout="failure"] { border-left-color: rgb(233, 49, 71); background: rgba(233, 49, 71, .08); } .callout[data-callout="failure"] > .callout-title { color: rgb(181, 38, 55); }
.callout[data-callout="danger"] { border-left-color: rgb(233, 49, 71); background: rgba(233, 49, 71, .08); } .callout[data-callout="danger"] > .callout-title { color: rgb(181, 38, 55); }
.callout[data-callout="bug"] { border-left-color: rgb(233, 49, 71); background: rgba(233, 49, 71, .08); } .callout[data-callout="bug"] > .callout-title { color: rgb(181, 38, 55); }
.callout[data-callout="example"] { border-left-color: rgb(120, 82, 238); background: rgba(120, 82, 238, .08); } .callout[data-callout="example"] > .callout-title { color: rgb(93, 63, 185); }
.callout[data-callout="quote"] { border-left-color: rgb(158, 158, 158); background: rgba(158, 158, 158, .08); } .callout[data-callout="quote"] > .callout-title { color: rgb(123, 123, 123); }
article hr { border: 0; border-top: 1px solid var(--line); margin: 2.2rem 0; }
.page-actions { float: right; margin: .55rem 0 0 1rem; display: flex; gap: .5rem; position: sticky; top: 4rem; z-index: 1; }
.page-actions.stuck { background: rgba(255, 255, 255, .94); padding: .3rem; margin-right: -.3rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(31, 35, 40, .08); }
.content .page-actions .button { font-size: .88rem; line-height: 1.6; padding: .15rem .8rem; }
.tags { margin: 0 0 1.8rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { display: inline-block; font-size: .8rem; line-height: 1.6; padding: 0 .6rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); }
/* tag（tags）：同一個 tag 固定一種顏色 */
.tagchip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; line-height: 1.6; padding: 0 .55rem; border-radius: 6px; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
a.tagchip:hover { filter: brightness(.96); text-decoration: none; }
.tagchip.small { font-size: .74rem; padding: 0 .45rem; }
.tag-c0 { background: #e7f0fb; color: #0b5cad; } .tag-c1 { background: #e6f4ea; color: #1a7f37; }
.tag-c2 { background: #f1ecfb; color: #6b3fb9; } .tag-c3 { background: #fdf0e1; color: #9a5300; }
.tag-c4 { background: #fbe9ef; color: #b0245a; } .tag-c5 { background: #e3f5f4; color: #0e7470; }
.tag-c6 { background: #fbf6dc; color: #7a6000; } .tag-c7 { background: #eef0f3; color: #4b5563; }

/* 頁面標題下的屬性：Project 與標籤各一列 */
.page-meta { margin: 0 0 1.8rem; display: grid; gap: .35rem; font-size: .85rem; }
.page-meta-row { display: grid; grid-template-columns: 4.2rem 1fr; align-items: center; gap: .6rem; }
.page-meta dt { color: var(--muted); font-size: .8rem; }
/* 標題上方的麵包屑、標題下方的 tag（像 Notion） */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .4rem 0 .35rem; font-size: .85rem; color: var(--muted); }
.content .crumbs a { color: var(--muted); text-decoration: none; border-radius: 4px; padding: .05rem .25rem; margin: 0 -.25rem; }
.content .crumbs a:hover { color: var(--fg); background: #eef0f3; }
.crumb-sep { color: var(--line-strong); }
.crumb-also { margin-left: .6rem; padding-left: .6rem; border-left: 1px solid var(--line); display: inline-flex; gap: .5rem; }
.page-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 1.6rem; }
/* 公開狀態（page-visibility） */
/* 標題旁的鎖：點開看狀態與操作 */
.vis { position: relative; display: inline-block; margin-left: .5rem; vertical-align: .12em; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0; }
.content .vis-lock { display: inline-grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.content .vis-lock:hover, .content .vis-lock[aria-expanded="true"] { background: var(--bg-soft); }
.vis-lock svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vis-lock.lock-private svg { stroke: #8c959f; } .vis-lock.lock-pending svg { stroke: #bf8700; } .vis-lock.lock-public svg { stroke: #1a7f37; } .vis-lock.lock-modified svg { stroke: #d97706; }
.vis-pop { position: absolute; top: calc(100% + .35rem); left: 0; z-index: 30; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; min-width: 17rem; max-width: 26rem; padding: .8rem .9rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .16); }
.vis-pop[hidden] { display: none; }
.vis-help { font-size: .82rem; color: var(--muted); }
.vis-extra, .vis-warn { display: flex; flex-direction: column; gap: .3rem; width: 100%; }
.vis-extra:empty { display: none; }
.vis-sub { font-size: .8rem; font-weight: 600; color: var(--fg-soft); }
.vis-refs { display: flex; flex-direction: column; gap: .2rem; max-height: 12rem; overflow: auto; }
.vis-ref { display: flex; align-items: center; gap: .45rem; font-size: .85rem; }
.vis-ref input { margin: 0; }
.vis-ref .vis-badge { font-size: .7rem; padding: 0 .45rem; }
.vis-warn .vis-ref::before { content: "•"; color: var(--muted); }
.vis-badge { font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .05rem .6rem; }
.vis-private { color: #57606a; background: #eef0f3; }
.vis-pending { color: #7a5b00; background: #fff4cc; }
.vis-public { color: #1a7f37; background: #dafbe1; }
.vis-modified { color: #9a6700; background: #fff8c5; }
.vis-note { font-size: .8rem; color: var(--muted); }
.vis-actions, .vis-ask { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.vis-actions[hidden] { display: none; }
.content .vis-btn { font: inherit; font-size: .8rem; padding: .1rem .65rem; border-radius: 6px; }
.content .vis-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.content .vis-btn.danger { color: #b42318; border-color: #f0c4c0; }
.content .vis-ask input { font: inherit; font-size: .82rem; padding: .2rem .5rem; width: 100%; min-width: 0; }
.vis-ask { width: 100%; }
.vis-msg { font-size: .8rem; color: #b42318; }
.umenu-badge { display: inline-block; margin-left: .4rem; min-width: 1.2rem; padding: 0 .35rem; border-radius: 999px; background: #d1242f; color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.2rem; }
/* 待審核頁 */
.rv-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; }
.rv-item { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; background: #fff; }
.rv-item.done { opacity: .6; }
.rv-top { display: flex; align-items: baseline; gap: .7rem; }
.rv-title { font-weight: 600; }
.rv-kind { font-size: .75rem; color: var(--muted); }
.rv-meta { margin: .2rem 0; font-size: .82rem; color: var(--muted); }
.rv-note { margin: .3rem 0; padding: .4rem .7rem; background: var(--bg-soft); border-radius: 6px; font-size: .9rem; }
.rv-diff { max-height: 22rem; overflow: auto; font-size: .78rem; line-height: 1.5; margin: .4rem 0; }
.rv-diff .add { color: #1a7f37; background: #e6ffec; display: block; }
.rv-diff .del { color: #b42318; background: #ffebe9; display: block; }
.rv-diff .hunk { color: #6639ba; display: block; }
.rv-diff .meta { color: var(--muted); display: block; }
.content .rv-reason { font: inherit; font-size: .88rem; width: 100%; max-width: 32rem; margin: .4rem 0; }
.rv-actions { display: flex; gap: .5rem; }
.rv-refs { margin: .5rem 0; display: grid; gap: .25rem; }
.rv-refs:empty { display: none; }
.rv-sub { margin: 0; font-size: .85rem; font-weight: 600; }
.rv-ref { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.rv-status { font-size: .85rem; color: var(--muted); margin: .3rem 0 0; }
.page-meta dd { margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; }

.tag-groups[hidden], .tag-pages[hidden] { display: none; }
.tag-group-sec { margin-top: 1.4rem; }
.tag-group-sec h2 { font-size: .95rem; margin: 0 0 .3rem; border: 0; padding: 0; }
.tag-others { margin-top: 1.5rem; font-size: .88rem; }
.tag:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
code { font-family: "JetBrains Mono", "Noto Sans Mono CJK TC", "DejaVu Sans Mono", monospace; font-size: .86em; }
:not(pre) > code { background: #f0f1f3; padding: .12em .38em; border-radius: 4px; color: #b42318; }
pre { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1.1rem; overflow: auto; line-height: 1.6; margin: 0 0 1.2rem; }
pre.mermaid { background: none; border: 0; text-align: center; }
img { max-width: 100%; border-radius: 6px; }
table { border-collapse: collapse; margin: 0 0 1.2rem; font-size: .95rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: .45rem .8rem; text-align: left; }
th { background: var(--bg-soft); font-weight: 600; }
/* 表格排序與篩選 */
th.tf-th { position: relative; padding-right: 2rem; white-space: nowrap; }
.content .tf-btn { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 1.4rem; height: 1.4rem; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; opacity: .55; }
.content th.tf-th:hover .tf-btn, .content .tf-btn.on { opacity: 1; }
.content .tf-btn:hover { border-color: var(--line-strong); background: #fff; }
.content .tf-btn.on { color: var(--accent); background: var(--accent-soft); }
.tf-btn svg { width: .75rem; height: .75rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tf-btn[data-state="asc"] svg { transform: rotate(180deg); }
.tf-bar { font-size: .82rem; color: var(--muted); margin: 0 0 .35rem; }
.tf-bar[hidden] { display: none; }
.content .tf-clear { font: inherit; font-size: .82rem; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }
.content .tf-clear:hover { text-decoration: underline; }
.tf-menu { position: absolute; z-index: 50; width: 15rem; padding: .4rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(15, 23, 42, .16); font-size: .88rem; }
.tf-item { display: block; width: 100%; text-align: left; font: inherit; border: 0; background: none; padding: .35rem .55rem; border-radius: 6px; cursor: pointer; color: var(--fg); }
.tf-item:hover { background: #eef0f3; } .tf-item.on { color: var(--accent); font-weight: 600; }
.tf-sep { border: 0; border-top: 1px solid var(--line); margin: .35rem 0; }
.tf-search { width: 100%; box-sizing: border-box; font: inherit; font-size: .85rem; padding: .3rem .5rem; border: 1px solid var(--line-strong); border-radius: 6px; margin: 0 0 .3rem; }
.tf-list { max-height: 14rem; overflow: auto; }
.tf-opt { display: flex; align-items: center; gap: .45rem; padding: .2rem .45rem; border-radius: 5px; cursor: pointer; }
.tf-opt:hover { background: #eef0f3; }
.tf-opt[hidden] { display: none; }
.tf-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-all { font-weight: 600; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: .15rem; }
.tf-actions { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .4rem; }
.tf-actions button { font: inherit; font-size: .82rem; padding: .25rem .8rem; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; }
.tf-actions .tf-ok { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.broken { color: #b42318; text-decoration: line-through dotted; }
.broken::after { content: "（失效連結）"; font-size: .8em; display: inline-block; text-decoration: none; margin-left: .2em; }
/* 閱讀頁面補上失效引用（page-fix-refs D4）：右側清單與可點的失效處 */
.fix-panel { position: fixed; bottom: 1rem; right: 1rem; width: 21rem; max-height: min(60vh, calc(100vh - 6rem)); display: flex; flex-direction: column; background: #fff; border: 1px solid #f5c2c0; border-radius: 8px; box-shadow: 0 4px 16px rgba(31, 35, 40, .08); z-index: 2; font-size: .9rem; line-height: 1.6; }
.fix-head { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .6rem .9rem; border: 0; background: #fff1f0; border-radius: 8px 8px 0 0; font: inherit; font-weight: 600; color: #b42318; cursor: pointer; text-align: left; }
.fix-panel.collapsed .fix-head { border-radius: 8px; }
.fix-count { background: #b42318; color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
.fix-caret { margin-left: auto; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.fix-panel.collapsed .fix-caret { transform: rotate(-135deg); }
.fix-panel ul { list-style: none; margin: 0; padding: .5rem .9rem; overflow: auto; display: grid; gap: .55rem; }
.fix-panel.collapsed ul, .fix-panel.collapsed .fix-status { display: none; }
.fix-panel li { display: grid; grid-template-columns: auto 1fr; gap: .25rem .5rem; align-items: center; }
.fix-kind { font-size: .76rem; color: #b42318; border: 1px solid #f5c2c0; border-radius: 999px; padding: 0 .5rem; }
.fix-panel code { font-size: .82rem; overflow-wrap: anywhere; color: var(--fg); }
.fix-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.fix-btn { font: inherit; font-size: .84rem; padding: .15rem .8rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.fix-btn:hover { border-color: var(--accent); color: var(--accent); }
.fix-status { margin: 0; padding: 0 .9rem .7rem; color: var(--muted); font-size: .84rem; }
.fix-status:empty { display: none; }
.fix-status.bad { color: #b42318; }
.content .fixable, #page-body .fixable { cursor: pointer; }
#page-body img.fixable { display: inline-block; min-width: 10rem; min-height: 2.6rem; outline: 2px dashed #f0a8a4; outline-offset: 2px; border-radius: 4px; }
#page-body .fixable:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) { .fix-panel { left: 1rem; width: auto; max-height: 50vh; } }
.exports { padding-left: 1.2rem; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 1.8rem 1.25rem 3rem; }
}

/* 工具頁共用：表單控制項、按鈕、卡片 */
.content:has(.tool-head) { padding: 2.25rem 3rem 4rem; }
.tool-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 1.6rem; }
.tool-head h1 { font-size: 1.75rem; line-height: 1.35; margin: 0; letter-spacing: -.01em; }
.tool-head p { margin: .3rem 0 0; }
.tool-crumb { margin: 0 0 .35rem; font-size: .9rem; display: flex; gap: .8rem; align-items: center; }
.tool-crumb a { color: var(--muted); }
.tool-crumb code { color: var(--muted); background: none; padding: 0; }
.tool-head-actions { margin: 0; flex: none; }
.content input:not([type=checkbox]):not([type=radio]), .content select, .content textarea {
  font: inherit; color: var(--fg); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: .35rem .6rem; line-height: 1.5; }
.content input:focus, .content select:focus, .content textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.content button { font: inherit; font-size: .9rem; line-height: 1.5; color: var(--fg-soft); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: .35rem .9rem; cursor: pointer; }
.content button:hover { border-color: var(--muted); color: var(--fg); }
.content button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.content button.primary:hover { background: #094c90; }
.content button.danger { color: #b42318; border-color: #f0c4c0; }
.content button.danger:hover { border-color: #b42318; }
.content button.danger.solid { background: #b42318; border-color: #b42318; color: #fff; }
.content details > summary { cursor: pointer; font-weight: 600; color: var(--fg-soft); padding: .2rem 0; }
.ed-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem 1.4rem; }
.ed-card h2 { font-size: 1.1rem; margin: 0 0 .4rem; border: 0; padding: 0; display: flex; gap: .6rem; align-items: baseline; }
.ed-card h3 { font-size: .95rem; margin: 1.3rem 0 .4rem; }
.ed-error { color: #b42318; background: #fff1f0; border: 1px solid #f5c2c0; border-radius: 6px; padding: .45rem .75rem; margin: .6rem 0; font-size: .92rem; }
.ed-error:empty { display: none; }

/* 匯出編輯器 */
.ed-toolbar, .ed-meta, .ed-actions { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; margin: 0 0 1.2rem; }
.ed-toolbar label, .ed-meta label { display: flex; align-items: center; gap: .5rem; font-size: .92rem; color: var(--fg-soft); }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.ed-grid > .ed-card:last-child { position: sticky; top: 4.5rem; max-height: calc(100vh - 6rem); overflow: auto; }
.ed-tree ul, .pv-tree { list-style: none; padding-left: 1.1rem; margin: 0; }
.ed-tree ul ul { border-left: 1px solid var(--line); margin-left: .5rem; padding-left: .8rem; }
.ed-tree > ul { padding-left: 0; }
.ed-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .3rem .5rem; border-radius: 6px; line-height: 1.6; }
.ed-row:hover { background: var(--bg-soft); }
.ed-group > .ed-title, li.ed-group { color: var(--muted); font-weight: 600; }
.ed-seg { display: inline-flex; flex-shrink: 0; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.content .ed-seg button { font-size: .78rem; border: 0; border-radius: 0; background: #fff; padding: .1rem .55rem; color: var(--muted); }
.content .ed-seg button + button { border-left: 1px solid var(--line-strong); }
.content .ed-seg button.on.include { background: #dafbe1; color: #116329; font-weight: 600; }
.content .ed-seg button.on.none { background: var(--bg-soft); color: var(--fg); font-weight: 600; }
.content .ed-seg button.on.exclude { background: #ffebe9; color: #b42318; font-weight: 600; }
#preview .pv-tree { margin: .4rem 0 .8rem; padding: .6rem .8rem; background: var(--bg-soft); border-radius: 8px; font-size: .92rem; line-height: 1.7; }
#preview ul:not(.pv-tree) { padding-left: 1.2rem; font-size: .92rem; }
#preview li button { font-size: .78rem; padding: 0 .5rem; margin-left: .3rem; }
.ed-actions { margin-top: 1.4rem; }
#yaml-box pre { margin-top: .6rem; }
.content:has(#editor) { max-width: none; }
@media (max-width: 900px) { .ed-grid { grid-template-columns: 1fr; } .ed-grid > .ed-card:last-child { position: static; max-height: none; } }

/* 頁面編輯器：全螢幕，參考 wiki.js（深色頂欄＋格式工具列＋深色原始碼／淺色預覽＋狀態列） */
body.pe-full { overflow: hidden; }
body.pe-full .topbar { display: none; }
body.pe-full .layout { display: block; min-height: 0; }
body.pe-full .content { padding: 0; max-width: none; }
.pe-app { --ed-bg: #1e2228; --ed-fg: #e6e8eb; --ed-bar: #262b33; --ed-line: #353b45; --ed-muted: #9aa4b2;
  display: grid; grid-template-rows: auto auto auto 1fr auto; grid-template-columns: minmax(0, 1fr); height: 100vh; }
.pe-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 3.5rem; padding: 0 1rem 0 1.25rem; background: var(--accent); color: #fff; }
.pe-bar-title { display: flex; align-items: baseline; gap: .8rem; min-width: 0; }
.pe-bar-name { font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-bar-name[contenteditable] { cursor: text; border-radius: 5px; padding: .05rem .35rem; margin-left: -.35rem; outline: none; border-bottom: 1px dashed transparent; }
.pe-bar-name[contenteditable]:hover { border-bottom-color: rgba(255, 255, 255, .55); }
.pe-bar-name[contenteditable]:focus { background: rgba(255, 255, 255, .14); box-shadow: 0 0 0 2px rgba(255, 255, 255, .45); text-overflow: clip; }
.pe-bar-path { color: rgba(255, 255, 255, .75); font-size: .8rem; background: none; padding: 0; }
.pe-bar-actions { display: flex; align-items: center; gap: .5rem; flex: none; }
.pe-bar-status { color: rgba(255, 255, 255, .85); font-size: .85rem; margin-right: .5rem; }
.content .pe-bar-btn, .pe-bar-btn { font: inherit; font-size: .88rem; font-weight: 600; letter-spacing: .03em; color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, .55); border-radius: 6px; padding: .35rem .95rem; line-height: 1.5; cursor: pointer; }
.content .pe-bar-btn:hover, .pe-bar-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; border-color: #fff; text-decoration: none; }
.content .pe-bar-btn.pe-save { background: #fff; border-color: #fff; color: var(--accent); }
.content .pe-bar-btn.pe-save:hover { background: #eaf2fb; color: #094c90; }
.pe-error { background: #fff1f0; color: #a8201a; border-bottom: 1px solid #f5c2c0; padding: .45rem 1.25rem; font-size: .9rem; }
.pe-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .35rem .75rem; background: #fff; border-bottom: 1px solid var(--line); }
.content .pe-toolbar button { border: 0; background: none; border-radius: 6px; padding: .2rem .6rem; font-size: .85rem; color: var(--fg-soft); min-width: 2rem; }
.content .pe-toolbar button:hover { background: var(--bg-soft); color: var(--fg); }
.pe-toolbar .pe-ico { width: 1.05rem; height: 1.05rem; vertical-align: -.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pe-sep { width: 1px; height: 1.2rem; background: var(--line); margin: 0 .35rem; }
.pe-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
.pe-pane { display: flex; flex-direction: column; min-height: 0; }
.pe-pane-head { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: .35rem 1.25rem; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--bg-soft); }
.pe-pane-src .pe-pane-head { background: var(--ed-bar); color: var(--ed-muted); border-color: var(--ed-line); }
.content #source { flex: 1; width: 100%; min-height: 0; resize: none; border: 0; border-radius: 0; outline: none; margin: 0;
  background: var(--ed-bg); color: var(--ed-fg); caret-color: #fff; padding: 1.1rem 1.4rem 40vh;
  font-family: "JetBrains Mono", "Noto Sans Mono CJK TC", "DejaVu Sans Mono", monospace; font-size: .92rem; line-height: 1.75; tab-size: 2; }
.content #source::selection { background: #3d5a80; }
.pe-pane-preview { border-left: 1px solid var(--line); }
/* 屬性列（properties-panel）：深色，與原始碼區一致 */
.pp { flex: none; max-height: 42%; overflow: auto; background: var(--ed-bg); color: var(--ed-fg); border-bottom: 1px solid var(--ed-line); font-size: .86rem; line-height: 1.6; }
.pp-head { display: flex; align-items: center; justify-content: space-between; padding: .35rem 1rem .2rem; }
.pp-head button { font: inherit; background: none; border: 0; color: var(--ed-muted); cursor: pointer; padding: .1rem .3rem; border-radius: 4px; }
.pp-head button:hover { color: var(--ed-fg); background: var(--ed-bar); }
.pp-toggle { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600 !important; }
.pp-caret { width: .4rem; height: .4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: 0 .15rem .15rem 0; }
.pp.collapsed .pp-caret { transform: rotate(-45deg); margin: 0 .2rem 0 0; }
.pp-count { font-size: .75rem; color: var(--ed-muted); font-weight: 400; }
.pp-rawbtn.on { color: #fff !important; background: var(--ed-line) !important; }
.pp.collapsed .pp-body, .pp.collapsed .pp-yaml { display: none; }
.pp-body { display: grid; gap: .2rem; padding: .1rem 1rem .6rem; }
.pp-body[hidden], .pp-yaml[hidden], .pp-err[hidden] { display: none; }
.pp-row { display: grid; grid-template-columns: minmax(6rem, 9rem) 4.6rem 1fr 1.6rem; gap: .4rem; align-items: start; }
.content .pp input:not([type=checkbox]), .content .pp select, .content .pp textarea { font: inherit; color: var(--ed-fg); background: transparent; border: 1px solid transparent; border-radius: 4px; padding: .12rem .4rem; min-width: 0; width: auto; box-shadow: none; }
.content .pp input:not([type=checkbox]):hover, .content .pp select:hover, .content .pp textarea:hover { border-color: var(--ed-line); }
.content .pp input:focus, .content .pp select:focus, .content .pp textarea:focus { outline: none; border-color: #5b8bd6; background: var(--ed-bar); }
.content .pp button { font: inherit; font-size: inherit; line-height: 1.6; color: var(--ed-muted); background: none; border: 0; border-radius: 4px; padding: .1rem .35rem; }
.content .pp button:hover { color: var(--ed-fg); background: var(--ed-bar); }
.content .pp .pp-del:hover { color: #ff8b8b; }
.content .pp .pp-chip-x { padding: 0 .25rem; color: inherit; }
.content .pp .pp-chip-x:hover { background: none; color: #fff; }
.content .pp .pp-yaml { width: calc(100% - 2rem); background: var(--ed-bar); border-color: var(--ed-line); }
.content .pp .pp-chip-input { border: 0; background: transparent; }
.pp-key { color: var(--ed-muted) !important; }
.pp-type { color: var(--ed-muted) !important; font-size: .78rem !important; cursor: pointer; }
.pp-type option { background: var(--ed-bar); color: var(--ed-fg); }
.pp-check { justify-self: start; margin: .35rem .4rem; accent-color: #5b8bd6; }
.pp-rawval { font-family: "JetBrains Mono", monospace !important; font-size: .8rem !important; resize: vertical; }
.pp-chips { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; padding: .1rem .2rem; border: 1px solid transparent; border-radius: 4px; cursor: text; }
.pp-chips:hover { border-color: var(--ed-line); }
.pp-chip { display: inline-flex; align-items: center; gap: .15rem; background: #2f3a4a; color: #cfe0ff; border-radius: 999px; padding: 0 .2rem 0 .55rem; font-size: .8rem; }
.pp-chip-x { font: inherit; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0 .2rem; }
.pp-chip-x:hover { opacity: 1; }
.pp-chip-input { flex: 1; min-width: 5rem; border: 0 !important; background: transparent !important; }
.pp-del { font: inherit; background: none; border: 0; color: var(--ed-muted); cursor: pointer; border-radius: 4px; opacity: .5; }
.pp-row:hover .pp-del { opacity: 1; }
.pp-del:hover { color: #ff8b8b; background: var(--ed-bar); }
.pp-add { justify-self: start; font: inherit; background: none; border: 0; color: var(--ed-muted); cursor: pointer; padding: .15rem .4rem; border-radius: 4px; }
.pp-add:hover { color: var(--ed-fg); background: var(--ed-bar); }
.pp-yaml { display: block; width: calc(100% - 2rem); margin: 0 1rem .6rem; font-family: "JetBrains Mono", monospace; font-size: .82rem; color: var(--ed-fg); background: var(--ed-bar); border: 1px solid var(--ed-line); border-radius: 4px; padding: .4rem .6rem; resize: vertical; }
.pp-err { margin: 0 1rem .5rem; color: #ff8b8b; font-size: .82rem; }
.pe-preview-scroll { flex: 1; overflow: auto; padding: 1.4rem 2.2rem 40vh; }
.pe-preview { max-width: none; margin: 0; font-size: 1.02rem; }
.pe-broken { color: #b42318; background: #fff1f0; border: 1px solid #f5c2c0; border-radius: 6px; padding: .45rem .75rem; margin: 0 0 1rem; font-size: .9rem; }
/* 失效引用清單與預覽中可點的標記（obsidian-refs D5） */
.pe-broken ul { list-style: none; margin: .35rem 0 0; padding: 0; display: grid; gap: .3rem; }
.pe-broken li { display: flex; align-items: center; gap: .5rem; line-height: 1.6; color: var(--fg-soft); }
.pe-broken code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .84rem; background: #fff; padding: .05rem .35rem; border-radius: 4px; }
.pe-fix-kind { flex: none; font-size: .78rem; color: #b42318; border: 1px solid #f5c2c0; background: #fff; border-radius: 999px; padding: 0 .5rem; }
.pe-fix-btn { flex: none; font: inherit; font-size: .82rem; padding: .1rem .7rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.pe-fix-btn:hover { border-color: var(--accent); color: var(--accent); }
.pe-preview .pe-fixable { cursor: pointer; }
.pe-preview img.pe-fixable { display: inline-block; min-width: 10rem; min-height: 2.6rem; outline: 2px dashed #f0a8a4; outline-offset: 2px; border-radius: 4px; }
.pe-preview .pe-fixable:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
.pe-statusbar { display: flex; gap: 1.4rem; align-items: center; height: 1.9rem; padding: 0 1.25rem; font-size: .78rem; color: var(--muted); background: var(--bg-soft); border-top: 1px solid var(--line); }
.pe-statusbar-right { margin-left: auto; }
.pe-dialog { width: min(34rem, 92vw); border: 1px solid var(--line); border-radius: 10px; padding: 0; color: var(--fg); }
.pe-dialog::backdrop { background: rgba(15, 18, 22, .45); }
.pe-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.3rem; border-bottom: 1px solid var(--line); margin: 0; }
.pe-dialog-head h2 { font-size: 1.1rem; margin: 0; border: 0; padding: 0; }
.content .pe-dialog-x, .pe-dialog-x { font-size: 1.4rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 .2rem; }
.pe-dialog-body { font-size: .95rem; padding: 1.1rem 1.3rem 1.4rem; display: grid; gap: .8rem; line-height: 1.7; }
.pe-dialog-body > label { display: grid; gap: .25rem; font-size: .9rem; color: var(--fg-soft); }
.pe-dialog-body select, .pe-dialog-body input:not([type=checkbox]) { font: inherit; padding: .35rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px; }
.pe-dialog-body .pe-check { display: flex; gap: .5rem; align-items: center; }
.pe-dialog-body h3 { font-size: .95rem; margin: .8rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line); }
.pe-dialog-body button { font: inherit; font-size: .9rem; border: 1px solid var(--line-strong); background: #fff; border-radius: 6px; padding: .35rem .9rem; cursor: pointer; color: var(--fg-soft); }
.pe-dialog-body button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pe-dialog-body button.danger { color: #b42318; border-color: #f0c4c0; }
.pe-dialog-body button.danger.solid { background: #b42318; border-color: #b42318; color: #fff; }
.pe-row { display: flex; gap: .5rem; } .pe-row input { flex: 1; }
#delete-box { display: grid; gap: .5rem; justify-items: start; } #delete-box[hidden] { display: none; }
.pe-conflict { position: fixed; inset: 0; background: rgba(15, 18, 22, .45); display: grid; place-items: center; z-index: 10; }
.pe-conflict[hidden] { display: none; }
.pe-conflict-box { width: min(70rem, 94vw); background: #fff; border-radius: 10px; padding: 1.3rem 1.5rem; border: 1px solid #f0c4c0; }
.pe-conflict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pe-conflict-grid h3 { font-size: .95rem; margin: .4rem 0; }
.content .pe-conflict textarea { width: 100%; min-height: 45vh; font-family: "JetBrains Mono", "Noto Sans Mono CJK TC", monospace; font-size: .85rem; line-height: 1.6; padding: .7rem; }
.pe-conflict button { margin: .9rem .5rem 0 0; }
@media (max-width: 900px) { .pe-main { grid-template-columns: minmax(0, 1fr); } .pe-pane-preview { display: none; } .pe-statusbar-right { display: none; } }

.pe-new { max-width: 36rem; display: grid; gap: 1rem; }
.pe-new > label { display: grid; gap: .3rem; font-size: .92rem; color: var(--fg-soft); }
.pe-new .with-suffix { display: flex; gap: .5rem; align-items: center; } .pe-new .with-suffix input { flex: 1; }
.pe-new fieldset { font-size: .92rem; border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem .9rem; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; }
.pe-new fieldset legend { font-size: .92rem; color: var(--fg-soft); padding: 0 .3rem; }
.pe-new fieldset label { display: inline-flex; gap: .4rem; align-items: center; }
/* 從 Markdown 匯入（md-upload-images） */
.pe-new fieldset.mi { display: grid; gap: .55rem; line-height: 1.7; }
.mi-row { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; }
.mi-row[hidden], .mi-refs[hidden], .mi-row select[hidden] { display: none; }
.mi-row button, .mi-dir { font: inherit; font-size: .88rem; padding: .25rem .85rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.mi-row button:hover, .mi-dir:hover { border-color: var(--accent); color: var(--accent); }
.mi-row select { font: inherit; font-size: .88rem; max-width: 100%; }
.mi-refs { border-top: 1px solid var(--line); padding-top: .5rem; }
.mi-refs p { margin: 0 0 .3rem; }
.mi-sum { color: var(--fg); }
.mi-refs ul { list-style: none; margin: 0; padding: 0; max-height: 14rem; overflow: auto; font-size: .86rem; }
.mi-refs li { display: flex; gap: .45rem; align-items: baseline; padding: .1rem 0; overflow-wrap: anywhere; }
.mi-refs .mi-mark { width: 1em; flex: none; font-weight: 700; }
.mi-refs li.ok .mi-mark { color: #1a7f37; }
.mi-refs li.miss .mi-mark { color: #a8201a; }
.mi-refs code { font-size: .84rem; background: var(--bg-soft); padding: 0 .3rem; border-radius: 4px; }
.pe-new-actions { display: flex; gap: .6rem; }
@media (max-width: 900px) { .pe-grid { grid-template-columns: 1fr; } .tool-head { flex-direction: column; align-items: flex-start; } }

/* 登入頁 */
.login-page { min-height: 100vh; background: var(--bg-soft); }
.login-wrap { min-height: calc(100vh - 3.25rem); display: flex; align-items: center; justify-content: center; padding: 2rem 0; }
.login-card { width: min(23rem, 90vw); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 2.4rem 2.2rem 2rem; line-height: 1.7; }
.login-brand { font-size: 1.6rem; font-weight: 700; letter-spacing: .02em; }
.login-sub { margin: .1rem 0 1.2rem; }
.login-card form { display: grid; gap: .9rem; }
.login-card label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
.login-card input { font: inherit; color: var(--fg); padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 6px; }
.login-card input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.login-card button { font: inherit; font-weight: 600; margin-top: .3rem; padding: .55rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.login-card button:hover { background: #094c90; }
.login-error { background: #fff1f0; border: 1px solid #f5c2c0; color: #a8201a; border-radius: 6px; padding: .45rem .7rem; margin-bottom: .9rem; font-size: .9rem; }
/* 頂欄選單（名字 ▾）：新增頁面、匯出編輯器、使用者資訊、人員管理、登出 */
.umenu { position: relative; display: inline-flex; }
.umenu-list { position: absolute; top: calc(100% + .45rem); right: 0; z-index: 30; min-width: 11rem; display: flex; flex-direction: column; padding: .35rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, .16); }
.umenu-list[hidden] { display: none; }
.topbar .umenu-list a, .topbar .umenu-list form.logout button { display: block; width: 100%; text-align: left; font: inherit; font-size: .92rem; line-height: 1.5; color: var(--fg); background: none; border: 0; border-radius: 5px; padding: .4rem .7rem; cursor: pointer; text-decoration: none; }
.topbar .umenu-list a:hover, .topbar .umenu-list a:focus-visible, .topbar .umenu-list form.logout button:hover, .topbar .umenu-list form.logout button:focus-visible { background: #eef0f3; color: var(--fg); text-decoration: none; outline: none; }
.topbar .umenu-list form.logout { display: block; margin: 0; }
.umenu-sep { display: block; height: 1px; margin: .3rem .2rem; background: var(--line); }
.umenu-sep:first-child, .umenu-sep + .umenu-sep { display: none; }
/* 首頁卡片 */
.home-head { margin-top: 1rem; }
.home-head h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.home-head p { margin: .4rem 0 0; font-size: 1rem; }
.view-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1.25rem; margin: 2rem 0 3rem; }
.view-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.4rem 1.5rem 1.3rem; transition: border-color .12s; }
.view-card:hover { border-color: #afb8c1; }
.view-card-link { position: absolute; inset: 0; border-radius: inherit; }
.view-card-head { display: flex; gap: .8rem; align-items: center; }
.view-card h2 { font-size: 1.15rem; margin: 0; line-height: 1.3; border: 0; padding: 0; }
.view-badge { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff); }
.view-card-all .view-badge { color: var(--muted); background: var(--bg-soft); }
.view-sections { list-style: none; margin: 1.1rem 0 0; padding: .9rem 0 0; border-top: 1px solid var(--line); font-size: .94rem; line-height: 1.75; }
.view-sections a { color: var(--fg); } .view-sections a:hover { color: var(--accent); }
.view-sections li::before { content: "›"; color: var(--muted); margin-right: .45rem; }
.view-sections li.muted::before { content: ""; margin: 0; }
.view-sections a, .view-exports a { position: relative; z-index: 1; }
.view-exports { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.view-pdf { font-size: .8rem; padding: .1rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.view-pdf::before { content: "PDF · "; font-weight: 600; }
.view-pdf:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.no-sidebar .content:has(.view-cards) { margin: 0 auto; width: 100%; max-width: 68rem; padding: 3rem 2.5rem; }
.content .pe-dialog-body input:not([type=checkbox]) { font-size: .92rem; } #move-result:empty { display: none; }

/* 評論（page-comments）：淡黃底色標示原文，右側面板列出討論；無漸層與動畫 */
mark.qc-hl { background: #fff1b8; color: inherit; border-bottom: 2px solid #f0c94a; padding: 0; cursor: pointer; border-radius: 2px; }
mark.qc-hl.qc-active { background: #ffd666; }
.qc-fab { position: fixed; z-index: 20; font: inherit; font-size: .85rem; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 6px; padding: .3rem .8rem; cursor: pointer; box-shadow: 0 2px 6px rgba(31, 35, 40, .18); }
.qc-fab:hover { background: #094c90; }
.content .qc-toggle .qc-count:not(:empty), .qc-toggle .qc-count:not(:empty) { display: inline-block; min-width: 1.3em; padding: 0 .35em; margin-left: .2em; border-radius: 999px; background: #f0c94a; color: #3b2f00; font-size: .78em; font-weight: 700; line-height: 1.5; text-align: center; }
.qc-panel { position: fixed; top: 3.25rem; right: 0; bottom: 0; width: 23rem; background: #fff; border-left: 1px solid var(--line); overflow: auto; padding: 0 1.1rem 2rem; z-index: 3; line-height: 1.7; font-size: .93rem; }
.qc-panel[hidden] { display: none; }
body.qc-open:not(.pe-full) .content { padding-right: calc(23rem + 2rem); }
.qc-head { position: sticky; top: 0; background: #fff; display: flex; align-items: baseline; gap: .7rem; padding: 1rem 0 .7rem; border-bottom: 1px solid var(--line); margin-bottom: .9rem; z-index: 1; }
.qc-head h2 { font-size: 1.05rem; margin: 0; border: 0; padding: 0; }
.qc-sub { color: var(--muted); font-size: .85rem; }
.content .qc-close, .qc-close { margin-left: auto; background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 .2rem; }
.qc-thread { border: 1px solid var(--line); border-radius: 8px; padding: .75rem .9rem .6rem; margin-bottom: .8rem; background: #fff; cursor: default; }
.qc-thread.qc-active { border-color: #f0c94a; box-shadow: 0 0 0 1px #f0c94a; }
.qc-thread.qc-new { border-color: var(--accent); }
.qc-quote { margin: 0 0 .5rem; padding: 0 0 0 .6rem; border-left: 3px solid #f0c94a; color: var(--muted); font-size: .86rem; max-height: 4.4em; overflow: hidden; white-space: pre-wrap; }
/* 圖片評論與整頁評論（comment-anchors） */
.qc-quote-page { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.qc-page-row { margin: 0 0 .75rem; }
.content img.qc-img-hl, img.qc-img-hl { outline: 3px solid #f0c94a; outline-offset: 3px; border-radius: 2px; }
img.qc-img-hl.qc-active { outline-color: #e0a800; box-shadow: 0 0 0 8px rgba(240, 201, 74, .25); }
.qc-imgbar { position: fixed; z-index: 20; display: flex; gap: .35rem; }
.qc-imgbar[hidden] { display: none; }
/* 與「替換」、放大按鈕同一組（右上角、白底、34px 高） */
.qc-imgbtn { display: inline-flex; align-items: center; gap: .35rem; height: 34px; font: inherit; font-size: .85rem; font-weight: 600; color: var(--accent); background: rgba(255, 255, 255, .94); border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 .8rem; cursor: pointer; box-shadow: 0 2px 8px rgba(31, 35, 40, .12); }
.qc-imgbtn:hover { border-color: var(--accent); background: #fff; }
.qc-imgbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
/* 滑鼠移到可評論的圖片上：虛線外框，表示這張圖可以評論 */
.content img.qc-img-hover, img.qc-img-hover { outline: 2px dashed var(--accent); outline-offset: 4px; }
.content img.qc-img-hl.qc-img-hover, img.qc-img-hl.qc-img-hover { outline: 3px solid #e0a800; }
.qc-imgbtn-view { color: #7a5b00; background: #fff4cc; border-color: #f0c94a; }
.qc-imgbtn-view:hover { background: #ffe999; border-color: #e0a800; }
.qc-is-orphan .qc-quote { border-left-color: var(--line-strong); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.qc-is-resolved .qc-quote { border-left-color: var(--line-strong); }
.qc-msg { padding: .35rem 0; }
.qc-msg + .qc-msg { border-top: 1px solid var(--line); }
.qc-meta { display: flex; gap: .55rem; align-items: baseline; font-size: .82rem; color: var(--muted); }
.qc-meta b { color: var(--fg); font-size: .88rem; }
.qc-edited { font-style: italic; }
.qc-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); margin-top: .1rem; }
.qc-deleted { color: var(--muted); font-style: italic; font-size: .88rem; }
.qc-tools { display: flex; gap: .8rem; margin-top: .15rem; }
.qc-row { display: flex; gap: .5rem; align-items: center; }
.qc-actions { gap: 1rem; margin-top: .35rem; }
.content .qc-link, .qc-link { background: none; border: 0; padding: 0; font: inherit; font-size: .82rem; color: var(--accent); cursor: pointer; }
.content .qc-link:hover, .qc-link:hover { text-decoration: underline; color: var(--accent); }
.content .qc-link.qc-danger, .qc-link.qc-danger { color: #b42318; }
.qc-composer { display: grid; gap: .45rem; margin-top: .4rem; position: relative; }
/* @提及（comment-mentions） */
.qc-mention { position: absolute; left: 0; right: 0; top: calc(100% - 2.2rem); z-index: 6; list-style: none; margin: 0; padding: .25rem; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 6px 20px rgba(15, 23, 42, .12); max-height: 15rem; overflow: auto; }
.qc-mention[hidden] { display: none; }
.qc-mention li { display: flex; align-items: baseline; gap: .5rem; padding: .3rem .55rem; border-radius: 5px; cursor: pointer; }
.qc-mention li.on, .qc-mention li:hover { background: var(--accent-soft); }
.qc-mention li b { font-weight: 600; color: var(--fg); }
.qc-mention li span { font-size: .78rem; color: var(--muted); }
.qc-at { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 .2rem; }
.content .qc-input, .qc-input { width: 100%; font: inherit; font-size: .9rem; line-height: 1.6; padding: .45rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px; resize: vertical; color: var(--fg); background: #fff; }
.content .qc-btn, .qc-btn { font: inherit; font-size: .85rem; padding: .25rem .8rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.content .qc-btn.qc-primary, .qc-btn.qc-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.qc-resolved-by { font-size: .8rem; color: #116329; margin-top: .3rem; }
.qc-section { font-size: .88rem; margin: 1.4rem 0 .2rem; color: var(--fg-soft); }
.qc-hint, .qc-empty { color: var(--muted); font-size: .86rem; margin: 0 0 .7rem; }
.qc-resolved-list { margin-top: 1.2rem; }
.qc-resolved-list > summary { cursor: pointer; font-weight: 600; color: var(--fg-soft); margin-bottom: .6rem; }
.qc-error { color: #a8201a; background: #fff1f0; border: 1px solid #f5c2c0; border-radius: 6px; padding: .4rem .7rem; margin-bottom: .8rem; font-size: .88rem; }
/* 編輯器：面板在預覽欄內以抽屜呈現 */
.pe-pane-preview { position: relative; }
.pe-pane-preview .qc-panel { position: absolute; top: 0; height: 100%; width: min(23rem, 100%); box-shadow: -4px 0 12px rgba(31, 35, 40, .06); }
@media (max-width: 860px) {
  body.qc-open:not(.pe-full) .content { padding-right: 1.25rem; }
  .qc-panel { width: 100%; }
}

/* draw.io（drawio-diagrams）：全螢幕嵌入編輯器、預覽中的「編輯圖表」 */
body.dio-open { overflow: hidden; }
/* 圖片放大檢視 */
main.content article img.zoomable, main.content article svg.zoomable { cursor: zoom-in; }
/* 替換圖片（replace-image） */
.img-replace-btn { position: absolute; z-index: 4; height: 34px; padding: 0 .8rem; font: inherit; font-size: .85rem; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255, 255, 255, .94); color: var(--fg-soft); cursor: pointer; box-shadow: 0 2px 8px rgba(31, 35, 40, .12); }
.img-replace-btn[hidden] { display: none; }
.img-replace-btn:hover { color: var(--accent); border-color: var(--accent); }
.img-replace-toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 70; padding: .5rem 1rem; border-radius: 8px; background: #1f2328; color: #fff; font-size: .9rem; line-height: 1.6; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); }
.img-replace-toast[hidden] { display: none; }
.img-replace-toast.bad { background: #b42318; }
.zoom-btn { position: absolute; z-index: 4; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255, 255, 255, .94); color: var(--fg-soft); cursor: pointer; box-shadow: 0 2px 8px rgba(31, 35, 40, .12); }
.zoom-btn[hidden] { display: none; }
.zoom-btn:hover { color: var(--accent); border-color: var(--accent); }
.zoom-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
body.zoom-open { overflow: hidden; }
.zoom-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(22, 25, 30, .88); }
.zoom-stage { position: absolute; inset: 0 0 72px 0; overflow: hidden; cursor: grab; touch-action: none; }
.zoom-stage.dragging { cursor: grabbing; }
.zoom-stage > * { position: absolute; top: 0; left: 0; transform-origin: 0 0; background: #fff; border-radius: 4px; user-select: none; }
.zoom-bar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: .35rem; padding: .35rem .5rem; background: #fff; border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); font-size: .9rem; line-height: 1.6; }
.zoom-bar button { font: inherit; min-width: 2.2rem; padding: .2rem .7rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.zoom-bar button:hover { border-color: var(--accent); color: var(--accent); }
.zoom-pct { min-width: 3.4rem; text-align: center; color: var(--fg); font-variant-numeric: tabular-nums; }
.dio-overlay { position: fixed; inset: 0; z-index: 50; background: #fff; }
.dio-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.dio-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .8rem; color: var(--muted); font-size: .95rem; background: #fff; z-index: 1; line-height: 1.7; text-align: center; padding: 2rem; }
.dio-loading[hidden] { display: none; }
.dio-loading.dio-error { color: #a8201a; }
.dio-close { font: inherit; font-size: .9rem; padding: .35rem 1rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
/* Excalidraw 編輯器覆蓋層（excalidraw-diagrams D3） */
.exd-overlay { position: fixed; inset: 0; z-index: 50; background: #fff; }
.exd-shell { position: absolute; inset: 0; display: flex; flex-direction: column; }
.exd-bar { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; border-bottom: 1px solid var(--line); background: #fff; font-size: .92rem; line-height: 1.7; }
.exd-title { color: var(--fg); font-weight: 600; }
.exd-status { flex: 1; color: var(--muted); }
.exd-bar button { font: inherit; font-size: .9rem; padding: .3rem .95rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.exd-bar button:hover { border-color: var(--accent); color: var(--accent); }
.exd-bar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.exd-bar button.primary:hover { color: #fff; filter: brightness(1.08); }
.exd-canvas { position: relative; flex: 1; min-height: 0; }
.dio-wrap { position: relative; display: inline-block; max-width: 100%; }
.content .dio-edit, .dio-edit { position: absolute; top: -.2rem; right: -.2rem; transform: translateY(-100%); font: inherit; font-size: .78rem; font-weight: 600; line-height: 1.6; padding: .05rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--fg-soft); cursor: pointer; }
.dio-wrap { margin-top: 1.8rem; outline: 1px dashed transparent; outline-offset: 4px; }
.dio-wrap:hover { outline-color: var(--line-strong); }
.content .dio-edit:hover { border-color: var(--accent); color: var(--accent); }
.pe-dialog .with-suffix { display: flex; gap: .5rem; align-items: center; } .pe-dialog .with-suffix input { flex: 1; }

/* 公式（math-formulas） */
.math-display { display: block; text-align: center; margin: 1.1rem 0; overflow-x: auto; overflow-y: hidden; }
.math-display .katex-display { margin: 0; }
.math-error, .katex-error { color: #b42318; }

/* 新增頁面：「放在」搜尋下拉 */
.combo { position: relative; display: block; }
.combo input { width: 100%; box-sizing: border-box; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .3rem 0; list-style: none; max-height: 18rem; overflow-y: auto; background: var(--bg, #fff); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.combo-list li { display: flex; gap: .8rem; align-items: baseline; padding: .4rem .8rem; cursor: pointer; color: var(--fg); line-height: 1.5; }
.combo-list li.active, .combo-list li:hover { background: var(--accent-soft, #eaf2fb); }
.combo-list .combo-path { font-family: var(--mono, ui-monospace, monospace); font-size: .88rem; }
.combo-list li .muted { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-list .combo-empty { cursor: default; }
.pe-new .small { font-size: .82rem; }

/* PlantUML 降級說明 */
.plantuml-note { font-size: .85rem; color: var(--muted); margin-top: -.6rem; }

/* 側欄樹操作（tree-editing） */
.sidebar [draggable="true"] { display: flex; align-items: center; gap: .3rem; }
.sidebar .tree-more { margin-left: auto; visibility: hidden; border: 0; background: none; color: var(--muted); font: inherit; line-height: 1; padding: 0 .3rem; border-radius: 4px; cursor: pointer; }
.sidebar [draggable="true"]:hover .tree-more, .sidebar .tree-more:focus-visible { visibility: visible; }
.sidebar .tree-more:hover { background: #e6e8eb; color: var(--fg); }
.sidebar li.dragging > [draggable] { opacity: .45; }
.sidebar .drop-inside { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sidebar .drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.sidebar .drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.tree-menu { position: absolute; z-index: 50; min-width: 9rem; padding: .3rem 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); display: grid; }
.tree-menu[hidden] { display: none; }
.tree-menu button { text-align: left; font: inherit; font-size: .9rem; padding: .4rem .9rem; border: 0; background: none; color: var(--fg); cursor: pointer; }
.tree-menu button:hover, .tree-menu button:focus-visible { background: var(--accent-soft); outline: none; }
.tree-menu button.danger { color: #b42318; }
.tree-dialog .tree-actions { display: flex; gap: .6rem; }
.tree-dialog .small { font-size: .82rem; }
.pe-dialog-body button.danger.solid { background: #b42318; border-color: #b42318; color: #fff; }
.tree-toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--fg); color: #fff; padding: .55rem 1rem; border-radius: 8px; font-size: .9rem; max-width: 90vw; }
.tree-toast[hidden] { display: none; }

/* 側欄折疊 */
.sidebar li.has-children { position: relative; }
.sidebar li.has-children > a, .sidebar li.has-children > .group { padding-right: 1.9rem; }
.sidebar li.collapsed > ul { display: none; }
.sidebar .twisty { position: absolute; right: .2rem; top: .3rem; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 1; }
.sidebar .twisty::before { content: ""; width: .42rem; height: .42rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.sidebar li.open > .twisty::before { transform: rotate(45deg) translate(-1px, -1px); }
.sidebar .twisty:hover { background: #e6e8eb; color: var(--fg); }

/* 本頁大綱（文章右側） */
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: .22rem 0; color: var(--fg-soft); }
.toc a:hover { color: var(--accent); text-decoration: none; }
.toc a.active { color: var(--accent); font-weight: 600; }
.toc .toc-sub a { padding-left: .9rem; font-size: .83rem; }
.toc-backdrop { display: none; }
@media (min-width: 1240px) {
  .content.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 13.5rem; column-gap: 2.5rem; align-items: start; }
  .content.has-toc > article { width: 100%; }
  .toc { position: sticky; top: 5.25rem; max-height: calc(100vh - 7rem); overflow: auto; font-size: .86rem; line-height: 1.55; border-left: 1px solid var(--line); padding: .2rem 0 .2rem .9rem; }
}
/* 窄螢幕：大綱是右側抽屜（在文件上往左滑打開） */
@media (max-width: 1239px) {
  .toc { position: fixed; top: 3.25rem; right: 0; bottom: 0; width: min(80vw, 18rem); z-index: 31; overflow: auto;
    background: #fff; border-left: 1px solid var(--line); box-shadow: -4px 0 16px rgba(0, 0, 0, .08);
    padding: 1rem 1.1rem 2rem; font-size: .95rem; line-height: 1.55;
    transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
  body.toc-open .toc { transform: none; visibility: visible; }
  .toc a { padding: .45rem 0; }
  .toc .toc-sub a { font-size: .9rem; }
  body.toc-open .toc-backdrop { display: block; position: fixed; inset: 3.25rem 0 0 0; background: rgba(0, 0, 0, .3); z-index: 30; }
}

/* 首頁：未分類頁面 */
.unclassified-list { max-width: 64rem; margin: 2.8rem auto 0; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.unclassified-list h2 { font-size: 1.1rem; margin: 0 0 .3rem; border: 0; padding: 0; color: var(--fg-soft); }
.unclassified-list ul { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .3rem; }
.unclassified-list li { display: flex; gap: .7rem; align-items: baseline; }
.unclassified-list .muted { font-size: .85rem; }
.sidebar .unclassified, article .unclassified { color: var(--muted); border-bottom: 1px dotted var(--line-strong); }

/* project 首頁標記與側欄 PDF */
.sidebar .home-badge { font-size: .7rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 .35rem; margin-left: .45rem; line-height: 1.5; }
.sidebar-pdf { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; gap: .15rem; }
.sidebar-pdf-title { font-size: .78rem; font-weight: 600; color: var(--muted); margin: 0 0 .3rem .65rem; letter-spacing: .04em; }
.sidebar-pdf a { padding: .3rem .65rem; border-radius: 6px; color: var(--fg-soft); }
.sidebar-pdf a::before { content: "PDF"; font-size: .66rem; font-weight: 700; color: #b42318; margin-right: .45rem; }
.pe-home { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .9rem .6rem; margin: 0; font-size: .9rem; }
.pe-home legend { color: var(--fg-soft); padding: 0 .3rem; }
.pe-home #f-home { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }

/* 頁面歷史 */
.hist { display: grid; grid-template-columns: 20rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .hist { grid-template-columns: 1fr; } }
.hist-list ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; max-height: 75vh; overflow: auto; }
.hist-list li + li { border-top: 1px solid var(--line); }
.content .hist-list li button { display: grid; gap: .15rem; width: 100%; text-align: left; border: 0; border-radius: 0; background: none; padding: .55rem .8rem; }
.content .hist-list li button:hover { background: #f6f8fa; }
.hist-list li.active button { background: var(--accent-soft); }
.hist-subject { color: var(--fg); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .small { font-size: .8rem; }
.hist-list #hist-more { margin-top: .6rem; }
.hist-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .8rem; }
.hist-tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.content .hist-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .45rem .8rem; }
.content .hist-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.hist-diff { font-family: var(--mono, ui-monospace, monospace); font-size: .85rem; line-height: 1.6; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.hist-diff > div { white-space: pre-wrap; word-break: break-word; padding: 0 .8rem; }
.hist-diff .d-add { background: #e6f4ea; color: #14532d; }
.hist-diff .d-del { background: #fdecea; color: #7f1d1d; }
.hist-diff .d-hunk { background: #f1f5f9; color: var(--muted); padding: .2rem .8rem; }
.hist-content { border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.4rem; }

/* 長網址在內文中可斷行（autolink） */
article a { overflow-wrap: anywhere; }

/* 首頁：刪除 project */
.content .view-delete { position: absolute; top: 1rem; right: 1rem; z-index: 1; font-size: .8rem; padding: .1rem .6rem; color: var(--muted); background: #fff; border: 1px solid transparent; opacity: 0; transition: opacity .12s; }
.view-card:hover .view-delete, .content .view-delete:focus-visible { opacity: 1; }
.content .view-delete:hover { color: #b42318; border-color: #f0c4c0; }
.pd-list { margin: 0 0 .4rem; padding-left: 1.2rem; max-height: 9rem; overflow: auto; font-size: .88rem; }
.pd-modes { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .9rem .6rem; margin: 0; display: grid; gap: .3rem; }
.pd-modes legend { color: var(--fg-soft); padding: 0 .3rem; }
.pd-dialog .pe-dialog-body p { margin: 0; }
.pd-dialog .tree-actions { display: flex; gap: .6rem; }

/* 標題錨點 */
article [id] { scroll-margin-top: 4.5rem; }
.heading-anchor { margin-left: .45rem; font-weight: 400; color: var(--muted); text-decoration: none; opacity: 0; transition: opacity .12s; font-size: .85em; }
article h2:hover .heading-anchor, article h3:hover .heading-anchor, article h4:hover .heading-anchor,
article h5:hover .heading-anchor, article h6:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent); text-decoration: none; }
.anchor-toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--fg); color: #fff; padding: .5rem 1rem; border-radius: 8px; font-size: .9rem; }
.anchor-toast[hidden] { display: none; }

.me-notice { color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px; padding: .45rem .75rem; margin: .6rem 0 0; font-size: .9rem; }
.me-admin { margin: 1rem 0 0; }
/* AI 搜尋與問答（ai-search） */
.ai-form { display: grid; gap: .6rem; margin: 1rem 0 1.25rem; }
.content .ai-form textarea { font: inherit; font-size: 1rem; line-height: 1.6; padding: .7rem .9rem; border: 1px solid var(--line-strong); border-radius: 10px; resize: vertical; min-height: 3.4rem; }
.content .ai-form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.ai-actions { display: flex; gap: .5rem; align-items: center; }
.ai-scope { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); margin-right: auto; }
.content .ai-scope select { font: inherit; font-size: .88rem; padding: .3rem .5rem; border: 1px solid var(--line-strong); border-radius: 6px; }
.ai-h { font-size: .85rem; font-weight: 600; color: var(--muted); margin: 1.4rem 0 .5rem; letter-spacing: .02em; }
.ai-answer { border: 1px solid var(--line); border-radius: 12px; padding: .4rem 1.2rem 1rem; background: #fbfcfe; }
.ai-steps { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .15rem; font-size: .84rem; color: var(--fg-soft); }
.ai-steps:empty { display: none; }
.ai-steps li { display: flex; align-items: center; gap: .45rem; }
.ai-steps li::before { content: ""; width: .7rem; height: .7rem; flex: none; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: ai-spin .8s linear infinite; }
.ai-steps li.done { color: var(--muted); }
.ai-steps li.done::before { content: "✓"; border: 0; animation: none; color: #1a7f37; font-size: .8rem; line-height: .7rem; text-align: center; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-text { white-space: pre-wrap; line-height: 1.8; font-size: .98rem; }
.ai-text.busy::after { content: "▍"; color: var(--accent); animation: ai-blink 1s steps(1) infinite; }
@keyframes ai-blink { 50% { opacity: 0; } }
.content a.ai-cite { font-size: .75em; vertical-align: super; line-height: 0; font-weight: 600; text-decoration: none; padding: 0 .1em; }
.ai-sources { margin: .8rem 0 0; padding-left: 1.4rem; font-size: .88rem; }
.ai-sources:empty { display: none; }
.ai-sources li { margin: .15rem 0; }
.ai-sources li[hidden] { display: none; }
.ai-text code { font-size: .88em; background: #eef0f3; padding: .05rem .35rem; border-radius: 4px; }
.ai-text .ai-pre { white-space: pre; overflow-x: auto; margin: .4rem 0; padding: .6rem .8rem; font-size: .85rem; line-height: 1.5; background: #f6f8fa; border: 1px solid var(--line); border-radius: 8px; }
.ai-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.ai-item { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: #fff; }
.ai-item:hover { border-color: var(--accent); }
.content .ai-item > a { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; text-decoration: none; }
.ai-title { font-weight: 600; }
.ai-head { color: var(--fg-soft); }
.ai-proj { margin-left: auto; font-size: .78rem; color: var(--muted); }
.ai-snip { margin: .25rem 0 0; font-size: .88rem; color: var(--fg-soft); line-height: 1.6; }

/* 我的評論（my-comments） */
.mc-bar { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0 1.25rem; }
.mc-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.content .mc-seg button { font: inherit; font-size: .9rem; border: 0; border-radius: 0; background: #fff; color: var(--fg-soft); padding: .35rem .9rem; cursor: pointer; }
.content .mc-seg button + button { border-left: 1px solid var(--line-strong); }
.content .mc-seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mc-n { font-size: .78rem; font-weight: 600; }
.mc-n:empty { display: none; }
.mc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.mc-empty { color: var(--muted); padding: 2rem 0; text-align: center; }
.mc-item { border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.mc-item:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(15, 23, 42, .06); }
.mc-item.resolved { opacity: .75; }
.content a.mc-link { display: grid; gap: .35rem; padding: .8rem 1rem; color: var(--fg); text-decoration: none; }
.mc-top { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.mc-title { font-weight: 600; color: var(--accent); }
.mc-projects { font-size: .8rem; color: var(--muted); }
.mc-tags { margin-left: auto; display: inline-flex; gap: .35rem; }
.mc-tag { font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .05rem .55rem; }
.mc-tag.at { color: var(--accent); background: var(--accent-soft); }
.mc-tag.mine { color: #57606a; background: #eef0f3; }
.mc-quote { font-size: .86rem; color: var(--muted); border-left: 3px solid #f0c94a; padding-left: .6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-quote.page { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.mc-latest { font-size: .92rem; line-height: 1.6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; }
.mc-meta { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }
/* 人員（people） */
.ppl-add h2 { font-size: 1rem; margin: 0 0 .6rem; }
.ppl-add-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.ppl-add-row label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
.ppl-add-row input { font: inherit; font-size: .92rem; padding: .35rem .55rem; border: 1px solid var(--line-strong); border-radius: 6px; min-width: 12rem; color: var(--fg); }
.ppl-list { margin-top: 1.25rem; overflow-x: auto; }
.content .ppl-table { display: table; width: 100%; margin: 0; border-collapse: collapse; font-size: .92rem; }
.content .ppl-table th, .content .ppl-table td { border: 0; background: none; }
.content .ppl-table th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: .45rem .5rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.content .ppl-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.content .ppl-table td input:not([type]), .content .ppl-table td input[type="email"] { font: inherit; width: 100%; min-width: 9rem; padding: .25rem .45rem; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--fg); }
.content .ppl-table td input:not([type]):hover, .content .ppl-table td input[type="email"]:hover { border-color: var(--line); }
.content .ppl-table td input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); background: #fff; }
.content .ppl-table button { font: inherit; font-size: .82rem; padding: .2rem .6rem; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--fg); cursor: pointer; white-space: nowrap; }
.content .ppl-table button:disabled { opacity: .4; cursor: default; }
.content .ppl-table button.ppl-off { color: #b42318; border-color: #fecdca; background: #fef3f2; }
.content .ppl-center { text-align: center; }
.content .ppl-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.content .ppl-disabled td input { color: var(--muted); text-decoration: line-through; }

/* Release notes */
.rn-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; max-height: 55vh; overflow: auto; }
.rn-versions li { display: flex; align-items: center; gap: .8rem; padding: .4rem .2rem; border-bottom: 1px solid var(--line); }
.rn-versions .rn-name { font-weight: 600; min-width: 5rem; }
.rn-versions button { margin-left: auto; }
.rn-done { font-size: .78rem; color: #166534; background: #dcfce7; border-radius: 4px; padding: 0 .4rem; }
.content .button-quiet { color: var(--muted); }
.me-roles { margin-top: 1.5rem; max-width: 36rem; }
.me-roles h2 { font-size: 1.05rem; margin: 0 0 .3rem; border: 0; padding: 0; }
.me-roles form { display: grid; gap: .5rem; margin-top: .6rem; }
.rn-foot { border-top: 1px solid var(--line); padding-top: .6rem; }
.content .rn-foot .qc-link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: .88rem; }

/* 程式碼語法上色（code-highlighting，Pygments default 配色） */
code[class*="language-"] .c { color: #3D7B7B; font-style: italic } /* Comment */
code[class*="language-"] .err { border: 1px solid #F00 } /* Error */
code[class*="language-"] .k { color: #008000; font-weight: bold } /* Keyword */
code[class*="language-"] .o { color: #666 } /* Operator */
code[class*="language-"] .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
code[class*="language-"] .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
code[class*="language-"] .cp { color: #9C6500 } /* Comment.Preproc */
code[class*="language-"] .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
code[class*="language-"] .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
code[class*="language-"] .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
code[class*="language-"] .gd { color: #A00000 } /* Generic.Deleted */
code[class*="language-"] .ge { font-style: italic } /* Generic.Emph */
code[class*="language-"] .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
code[class*="language-"] .gr { color: #E40000 } /* Generic.Error */
code[class*="language-"] .gh { color: #000080; font-weight: bold } /* Generic.Heading */
code[class*="language-"] .gi { color: #008400 } /* Generic.Inserted */
code[class*="language-"] .go { color: #717171 } /* Generic.Output */
code[class*="language-"] .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
code[class*="language-"] .gs { font-weight: bold } /* Generic.Strong */
code[class*="language-"] .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
code[class*="language-"] .gt { color: #04D } /* Generic.Traceback */
code[class*="language-"] .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
code[class*="language-"] .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
code[class*="language-"] .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
code[class*="language-"] .kp { color: #008000 } /* Keyword.Pseudo */
code[class*="language-"] .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
code[class*="language-"] .kt { color: #B00040 } /* Keyword.Type */
code[class*="language-"] .m { color: #666 } /* Literal.Number */
code[class*="language-"] .s { color: #BA2121 } /* Literal.String */
code[class*="language-"] .na { color: #687822 } /* Name.Attribute */
code[class*="language-"] .nb { color: #008000 } /* Name.Builtin */
code[class*="language-"] .nc { color: #00F; font-weight: bold } /* Name.Class */
code[class*="language-"] .no { color: #800 } /* Name.Constant */
code[class*="language-"] .nd { color: #A2F } /* Name.Decorator */
code[class*="language-"] .ni { color: #717171; font-weight: bold } /* Name.Entity */
code[class*="language-"] .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
code[class*="language-"] .nf { color: #00F } /* Name.Function */
code[class*="language-"] .nl { color: #767600 } /* Name.Label */
code[class*="language-"] .nn { color: #00F; font-weight: bold } /* Name.Namespace */
code[class*="language-"] .nt { color: #008000; font-weight: bold } /* Name.Tag */
code[class*="language-"] .nv { color: #19177C } /* Name.Variable */
code[class*="language-"] .ow { color: #A2F; font-weight: bold } /* Operator.Word */
code[class*="language-"] .w { color: #BBB } /* Text.Whitespace */
code[class*="language-"] .mb { color: #666 } /* Literal.Number.Bin */
code[class*="language-"] .mf { color: #666 } /* Literal.Number.Float */
code[class*="language-"] .mh { color: #666 } /* Literal.Number.Hex */
code[class*="language-"] .mi { color: #666 } /* Literal.Number.Integer */
code[class*="language-"] .mo { color: #666 } /* Literal.Number.Oct */
code[class*="language-"] .sa { color: #BA2121 } /* Literal.String.Affix */
code[class*="language-"] .sb { color: #BA2121 } /* Literal.String.Backtick */
code[class*="language-"] .sc { color: #BA2121 } /* Literal.String.Char */
code[class*="language-"] .dl { color: #BA2121 } /* Literal.String.Delimiter */
code[class*="language-"] .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
code[class*="language-"] .s2 { color: #BA2121 } /* Literal.String.Double */
code[class*="language-"] .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
code[class*="language-"] .sh { color: #BA2121 } /* Literal.String.Heredoc */
code[class*="language-"] .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
code[class*="language-"] .sx { color: #008000 } /* Literal.String.Other */
code[class*="language-"] .sr { color: #A45A77 } /* Literal.String.Regex */
code[class*="language-"] .s1 { color: #BA2121 } /* Literal.String.Single */
code[class*="language-"] .ss { color: #19177C } /* Literal.String.Symbol */
code[class*="language-"] .bp { color: #008000 } /* Name.Builtin.Pseudo */
code[class*="language-"] .fm { color: #00F } /* Name.Function.Magic */
code[class*="language-"] .vc { color: #19177C } /* Name.Variable.Class */
code[class*="language-"] .vg { color: #19177C } /* Name.Variable.Global */
code[class*="language-"] .vi { color: #19177C } /* Name.Variable.Instance */
code[class*="language-"] .vm { color: #19177C } /* Name.Variable.Magic */
code[class*="language-"] .il { color: #666 } /* Literal.Number.Integer.Long */

/* AI 品質看板（ai-board） */
.aib { margin-top: 0; }
.aib h2 { font-size: 1.25rem; margin: 0 0 .3rem; border: 0; padding: 0; }
.aib-bank { margin: 1rem 0; }
.aib-head { display: flex; align-items: baseline; gap: .8rem; }
.aib-head h3 { font-size: 1.05rem; margin: 0; }
.aib-stats { display: flex; gap: 2.5rem; margin: .7rem 0 .3rem; flex-wrap: wrap; }
.aib-stat { display: flex; flex-direction: column; gap: .1rem; }
.aib-stat strong { font-size: 1.5rem; line-height: 1.2; }
.aib-label { font-size: .8rem; color: var(--muted); }
.aib-bad { color: #b42318; }
.aib-good { color: #1a7f37; }
p.aib-bad, p.aib-good { margin: .3rem 0; font-size: .92rem; }
.aib-more { margin-top: .6rem; }
.aib-more summary { cursor: pointer; color: var(--accent); font-size: .92rem; }
.aib-table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .88rem; }
.aib-table th, .aib-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.aib-table th { font-weight: 600; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.aib-q { display: block; }
.aib-id { display: block; font-size: .78rem; color: var(--muted); }
.aib-tip { cursor: help; border-bottom: 1px dotted currentColor; }
/* 從網頁跑評估（ai-eval-ui-run） */
.aib-run { margin: 0 0 1.5rem; }
.aib-run-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.aib-run-btn { font: inherit; font-size: .92rem; padding: .45rem .9rem; border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 6px; cursor: pointer; }
.aib-run-btn:hover:not(:disabled) { background: var(--accent-soft); }
.aib-run-btn:disabled { color: var(--muted); border-color: var(--line); background: var(--bg-soft); cursor: not-allowed; }
.aib-run-note { margin: .6rem 0 0; font-size: .85rem; }
.aib-state { font-size: .9rem; color: var(--accent); }
.aib-sub { font-size: 1rem; margin: 1.3rem 0 .4rem; border: 0; padding: 0; }
.aib-run ol.aib-log-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.aib-run ol.aib-log-list > li { list-style: none; margin: 0; border-bottom: 1px solid var(--line); }
.aib-run .aib-log-head { border-radius: 0; box-shadow: none; display: grid; grid-template-columns: 1rem 9.5rem 5.5rem 1fr; gap: .6rem; align-items: center; width: 100%; font: inherit; font-size: .9rem; text-align: left; background: none; border: 0 !important; padding: .55rem .3rem; cursor: pointer; color: var(--fg); }
.aib-run .aib-log-head:hover { background: var(--bg-soft); }
.aib-log-caret { color: var(--muted); transition: transform .15s; }
.aib-log-row.open .aib-log-caret { transform: rotate(90deg); }
.aib-log-when { font-variant-numeric: tabular-nums; }
.aib-log-mode { color: var(--muted); }
.aib-log-res.run { color: var(--accent); }
.aib-log-text { max-height: 28rem; overflow: auto; background: var(--bg-soft); border-top: 1px solid var(--line); margin: 0; padding: .8rem 1rem; font-size: .82rem; line-height: 1.6; white-space: pre-wrap; }
.aib-run .aib-link-btn { box-shadow: none; font: inherit; font-size: .88rem; color: var(--accent); background: none; border: 0 !important; padding: .5rem 0; cursor: pointer; }
/* AI 品質頁分頁 */
.aib-tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin: 0 0 1.4rem; flex-wrap: wrap; }
.aib-tabs [role=tab] { border-radius: 0; box-shadow: none; font: inherit; font-size: .95rem; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: .55rem 1rem; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.aib-tabs [role=tab]:hover { color: var(--fg); }
.aib-tabs [role=tab][aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.aib-tab-dot { width: .45rem; height: .45rem; border-radius: 50%; background: #b42318; }
.aib-panel > .aib-intro { margin-top: 0; }
.aib-file { font-size: .82rem; color: var(--muted); font-family: var(--mono, monospace); }
/* 題庫管理與新題候選（ai-propose） */
.aib-tab-count { font-size: .75rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .45rem; line-height: 1.4; }
.aib-qhead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1.2rem 0 .3rem; }
.aib-qhead h4 { margin: 0; font-size: 1rem; }
.aib-tools { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.aib-tool { font: inherit; font-size: .85rem; padding: .3rem .7rem; border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 6px; cursor: pointer; box-shadow: none; }
.aib-tool:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.aib-tool:disabled { color: var(--muted); background: var(--bg-soft); cursor: not-allowed; }
.aib-tool-new { border-color: var(--accent); color: var(--accent); }
.aib-msg { font-size: .85rem; color: var(--muted); }
.aib-ck { width: 1.6rem; }
.aib-check { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.aib-newform { display: grid; gap: .6rem; margin: .6rem 0 1rem; }
.aib-newform label { display: grid; gap: .2rem; font-size: .88rem; }
.aib-newform label.aib-check { display: inline-flex; }
.aib-newform input:not([type=checkbox]) { font: inherit; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 6px; }
.aib-form-actions { display: flex; gap: .5rem; }
.aib-cand-tools { margin: 1rem 0 .4rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.aib-run ul.aib-cand-list, ul.aib-cand-list { list-style: none; padding: 0; margin: 0; }
ul.aib-cand-list > li { list-style: none; margin: 0; }
.aib-cand { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .2rem; border-bottom: 1px solid var(--line); }
.aib-cand input { margin-top: .35rem; }
.aib-cand-body { flex: 1; min-width: 0; }
.aib-cand-meta { font-size: .82rem; color: var(--muted); margin-top: .2rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.aib-kw { margin-right: .35rem; font-size: .8rem; background: var(--accent-soft); color: var(--accent); padding: 0 .35rem; border-radius: 4px; }
.aib-cand-more { font-size: .85rem; margin-top: .3rem; }
.aib-cand-more summary { cursor: pointer; color: var(--accent); }
.aib-cand-more p { margin: .3rem 0; }
/* 答錯的題：正確答案／模型回答 */
.aib-why { margin-top: .35rem; font-size: .85rem; }
.aib-why summary { cursor: pointer; color: #b42318; }
.aib-why dl { margin: .4rem 0 0; display: grid; grid-template-columns: 4.5rem 1fr; gap: .35rem .6rem; }
.aib-why dt { color: var(--muted); }
.aib-why dd { margin: 0; }
.aib-answer { white-space: pre-wrap; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; margin-bottom: .3rem; max-height: 16rem; overflow: auto; }
.aib-newform[hidden] { display: none; }
/* AI 品質：執行中動畫（標題旁） */
.aib-title { display: flex; align-items: center; gap: .8rem; }
.aib-busy { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 500; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .2rem .75rem .2rem .55rem; }
.aib-busy[hidden] { display: none; }
.aib-spin { width: .95rem; height: .95rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .aib-spin { animation-duration: 2.4s; } }
.aib-busy { font-variant-numeric: tabular-nums; }
/* 編輯器：資產管理（assets） */
.as-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.as-filter { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.as-filter button { font: inherit; font-size: .85rem; border: 0; border-radius: 0; background: #fff; padding: .3rem .8rem; cursor: pointer; box-shadow: none; color: var(--fg); }
.as-filter button[aria-pressed=true] { background: var(--accent); color: #fff; }
#as-search { font: inherit; font-size: .88rem; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 6px; min-width: 12rem; }
.as-danger { margin-left: auto; font: inherit; font-size: .85rem; padding: .35rem .8rem; border: 1px solid #b42318; color: #b42318; background: #fff; border-radius: 6px; cursor: pointer; }
.as-danger:disabled { border-color: var(--line); color: var(--muted); cursor: not-allowed; }
ul.as-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.as-item { display: grid; grid-template-columns: 1.4rem 4.5rem 1fr; gap: .7rem; align-items: center; padding: .5rem .2rem; border-bottom: 1px solid var(--line); list-style: none; }
.as-item img { width: 4.5rem; height: 3.2rem; object-fit: contain; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; }
.as-info { min-width: 0; }
.as-name { font-size: .88rem; word-break: break-all; }
.as-meta { font-size: .78rem; color: var(--muted); }
.as-item.unused .as-meta { color: #b54708; }
.as-insert { font: inherit; font-size: .82rem; padding: .25rem .7rem; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; box-shadow: none; }
.as-insert:hover { border-color: var(--accent); color: var(--accent); }
.as-empty { padding: 1.2rem .2rem; list-style: none; }
.as-page { margin-bottom: 2rem; }
.as-thumb { display: block; line-height: 0; }
/* 網站維護：系統測試（system-checks） */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; margin: .8rem 0 1rem; }
.sys-card h3 { font-size: 1rem; margin: 0 0 .5rem; }
.sys-card .aib-stat strong { font-size: 1.6rem; }
.sys-list { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .85rem; max-height: 16rem; overflow: auto; }
.sys-list li { margin: .15rem 0; word-break: break-all; }
.sys-note { font-size: .8rem; margin: .7rem 0 0; }
/* 網站維護：總覽（quality-overview） */
.ov-group { font-size: 1rem; margin: 1.4rem 0 .6rem; }
.ov-group .muted { font-weight: 400; font-size: .85rem; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .9rem; }
.ov-card { display: flex; flex-direction: column; gap: .35rem; text-align: left; font: inherit; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: .9rem 1rem; cursor: pointer; box-shadow: none; color: var(--fg); }
.ov-card:hover { border-color: var(--accent); }
.ov-ok { border-left-color: #1a7f37; }
.ov-bad { border-left-color: #b42318; }
.ov-warn { border-left-color: #b54708; }
.ov-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ov-title { font-weight: 600; }
.ov-pill { font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: var(--bg-soft); color: var(--muted); white-space: nowrap; }
.ov-ok .ov-pill { background: #e6f4ea; color: #1a7f37; }
.ov-bad .ov-pill { background: #fde8e7; color: #b42318; }
.ov-warn .ov-pill { background: #fef3e6; color: #b54708; }
.ov-big { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ov-sub { font-size: .82rem; color: var(--muted); }

/* ---- 手機版（mobile-ui） ---- */
.side-toggle, .pe-mobile-only { display: none; }
.side-backdrop { display: none; }
@media (max-width: 720px) {
  /* 頂欄：只留圖示 */
  .topbar { gap: .4rem; padding: 0 .6rem; }
  .topbar .topbar-btn > span:not(.umenu-list) { display: none; }
  .topbar .topbar-btn { padding: 0 .45rem; gap: .2rem; }
  .topbar { gap: .15rem; }
  .topbar .brand { margin-right: auto; }
  .topbar .topbar-right { gap: 0; }
  .topbar .tb-chev { display: none; }
  .switch.in-drawer { display: flex; flex-direction: column; align-items: stretch; gap: .3rem; color: var(--muted);
    font-size: .8rem; margin: 0 .3rem 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
  .switch.in-drawer select { color: var(--fg); border-color: var(--line-strong, #c8ccd2); background: #fff; font-size: .95rem; padding: .45rem .6rem; }
  .topbar .user.muted { display: none; }
  .side-toggle { display: inline-flex; }
  .umenu-list { right: 0; left: auto; max-width: calc(100vw - 1rem); }
  /* 側欄：左側抽屜 */
  .layout, .layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 3.25rem; left: 0; bottom: 0; height: auto; width: min(85vw, 20rem); z-index: 30;
    border-right: 1px solid var(--line); border-bottom: 0; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 24px rgba(0, 0, 0, .15); }
  body.side-open .sidebar { transform: none; }
  body.side-open { overflow: hidden; }
  .side-backdrop { display: block; position: fixed; inset: 3.25rem 0 0 0; background: rgba(0, 0, 0, .3); z-index: 29; }
  .side-backdrop[hidden] { display: none; }
  /* 內文 */
  .content, .content:has(.tool-head) { padding: 1.4rem 1rem 3rem; }
  article { font-size: 1rem; }
  article h1 { font-size: 1.7rem; }
  article h2 { font-size: 1.35rem; margin-top: 2rem; }
  article table { display: block; max-width: 100%; overflow-x: auto; }
  article pre { max-width: 100%; overflow-x: auto; }
  article img, article svg { max-width: 100%; height: auto; }
  .tool-head h1 { font-size: 1.45rem; }
  /* 對話框 */
  dialog.pe-dialog { width: calc(100vw - 1.5rem); max-width: none; }
  /* 網站維護等分頁列：左右滑動 */
  .aib-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .aib-tabs [role=tab] { white-space: nowrap; padding: .55rem .7rem; margin-bottom: 0; }
  .aib-table { display: block; overflow-x: auto; }
  /* 編輯器 */
  .pe-bar { height: auto; min-height: 3.25rem; flex-wrap: wrap; padding: .4rem .6rem; gap: .4rem; }
  .pe-bar-title { min-width: 0; flex: 1 1 100%; }
  .pe-bar-path { display: none; }
  .pe-bar-actions { flex: 1 1 100%; flex-wrap: wrap; gap: .3rem; justify-content: flex-start; }
  .pe-bar .pe-bar-btn { padding: .25rem .55rem; font-size: .85rem; min-height: 2rem; }
  .pe-bar .pe-save { margin-left: auto; }
  .pe-bar-status { flex-basis: 100%; order: 9; font-size: .8rem; }
  .pe-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .pe-toolbar > * { flex: none; }
  .pp-row { grid-template-columns: minmax(4.5rem, 6rem) 4.2rem minmax(0, 1fr) 1.4rem; gap: .3rem; }
  .pp-row .pp-del { opacity: 1; }
}
@media (max-width: 900px) {  /* 窄螢幕只顯示一個窗格：Markdown／預覽切換 */
  .pe-mobile-only { display: inline-flex; }
  body.pe-show-preview .pe-pane-src { display: none; }
  body.pe-show-preview .pe-pane-preview { display: flex; }
}
.umenu-head { font-size: .72rem; color: var(--muted); padding: .3rem .7rem .1rem; letter-spacing: .04em; }
