/* 審計網路程式樣式 — Google 設計語言（Material 3 / Workspace）
 *
 * 取自 Google 自家產品的實際數值，不是「藍色 + 圓角」的近似：
 *   主色 #0b57d0、選取態 #d3e3fd、導覽底 #f0f4f9、分隔線 #dadce0
 *   陰影用 Google 的灰調 rgba(60,64,67,…)，不是純黑加透明度
 *   按鈕與頁籤為全圓角藥丸；懸停/按下用 8%/12% 狀態層疊加
 * 字型優先 Google Sans / Roboto，沒安裝時退回系統字，不外連 CDN
 * （事務所內網或離線時仍要正常顯示）。
 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 顏色 */
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --on-primary: #ffffff;
  --primary-container: #d3e3fd;
  --on-primary-container: #041e49;

  --surface: #ffffff;
  --surface-1: #f8fafd;
  --surface-2: #f0f4f9;
  --surface-3: #e9eef6;
  --nav: #f0f4f9;

  --text: #1f1f1f;
  --muted: #444746;
  --muted-2: #5f6368;
  --border: #dadce0;
  --outline: #c4c7c5;

  --success: #188038;
  --warning: #e37400;
  --danger: #b3261e;
  --danger-soft: #fce8e6;

  /* 檢視器背板：Google Drive 預覽用的深灰 */
  --viewer-bg: #3c4043;

  /* 陰影（Google 的灰調，不是純黑） */
  --e1: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  --e2: 0 1px 2px 0 rgba(60,64,67,.30), 0 2px 6px 2px rgba(60,64,67,.15);
  --e3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px 0 rgba(60,64,67,.30);

  /* 形狀 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 999px;

  --font: "Google Sans", Roboto, "Noto Sans TC", "Microsoft JhengHei",
          "Segoe UI", system-ui, sans-serif;
  --font-mono: "Roboto Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--surface-1);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── 未登入頁 ── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--surface-2);
}
.login-card {
  background: var(--surface); color: var(--text);
  padding: 48px 44px; border-radius: 28px; max-width: 460px;
  text-align: center; box-shadow: var(--e2);
}
.login-card h1 { margin-bottom: 12px; font-size: 24px; font-weight: 500; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; line-height: 1.7; font-size: 14px; }
.login-card a.btn { display: inline-block; text-decoration: none; }

/* 只有系統設定的進入畫面（管理者從人員管理系統的「審計系統設定」進來）。
   沿用登入卡的置中版面，只是內容換成設定入口。 */
.settings-only {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--surface-2);
}
.settings-card {
  background: var(--surface); color: var(--text);
  padding: 44px 40px; border-radius: 28px; max-width: 520px;
  text-align: center; box-shadow: var(--e2);
}
.settings-card h1 { margin-bottom: 12px; font-size: 22px; font-weight: 500; }
.settings-card .sub { color: var(--muted); margin-bottom: 24px; line-height: 1.7; font-size: 14px; }
.settings-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.settings-card a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.settings-card .hint { color: var(--muted-2); font-size: 12px; line-height: 1.7; margin: 0; }

/* ── 版面 ── */
.layout { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); color: var(--text);
  padding: 8px 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 200px; }
/* 番茄圖示（原本是 emoji，改成圖檔後不需要字級，改用固定尺寸） */
.brand .logo { width: 26px; height: 26px; display: block; flex: 0 0 auto; }
.login-logo { display: flex; justify-content: center; margin-bottom: 10px; }
.brand .client { font-weight: 500; font-size: 15px; letter-spacing: -.01em; }
.brand .meta { font-size: 12px; color: var(--muted-2); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions .username { font-size: 13px; color: var(--muted); }
.save-state { font-size: 12px; color: var(--success); min-width: 52px; text-align: right; }
.badge.role {
  background: var(--primary-container); color: var(--on-primary-container);
  padding: 5px 12px; border-radius: var(--r-full); font-size: 12px; font-weight: 500;
}

.main { display: flex; flex: 1; min-height: 0; }

/* ── 側欄檔案樹（Gmail 導覽的淺色調） ── */
.sidebar {
  width: 280px; background: var(--nav); color: var(--text);
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.tree-head { padding: 12px 10px 8px; }
.tree-head input {
  width: 100%; padding: 9px 14px; border-radius: var(--r-full);
  border: 1px solid transparent; background: var(--surface-3);
  color: var(--text); font-family: var(--font); font-size: 13px; outline: none;
}
.tree-head input:focus { background: var(--surface); border-color: var(--primary); }
.tree { flex: 1; overflow-y: auto; padding: 0 8px 20px; font-size: 13px; }
.tree .empty { color: var(--muted-2); text-align: center; padding: 30px 10px; }
.tree .empty .btn { margin-top: 12px; }
.tree-group-head {
  padding: 10px 10px 6px; color: var(--muted); font-weight: 500;
  cursor: pointer; user-select: none; font-size: 12px; letter-spacing: .03em;
}
.tree-group-files.collapsed { display: none; }
/* 導覽項目為右側全圓角的藥丸，是 Gmail/Drive 的招牌形狀 */
.tree-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--r-full);
  cursor: pointer; transition: background .12s;
  /* --d = 索引階數（A=0、A-2=1、A-2-1=2），由 renderTree 寫在 style 上。
     沒設的列（問題紙）走預設 0，縮排就跟以前一樣。 */
  padding-left: calc(12px + var(--d, 0) * 15px);
}
.tree-row:hover { background: rgba(11,87,208,.08); }
.tree-row.active { background: var(--primary-container); color: var(--on-primary-container); }
.tree-row.active .name { font-weight: 500; }
.tree-row.picked { box-shadow: inset 0 0 0 2px var(--primary); }
/* 拖曳中的放置目標：整個資料夾框起來，讓人清楚是放進「這一個」而不是某一列 */
.tree-group.drop-target {
  outline: 2px dashed var(--primary); outline-offset: 2px;
  border-radius: var(--r-sm); background: rgba(11,87,208,.06);
}
.tree-group.drop-target .tree-group-head .cat::after { content: " ← 放這裡"; color: var(--primary); font-size: 11px; }
.tree-row[draggable="true"] { cursor: grab; }
.tree-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tree-row .tag-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.tree-row .idx { color: var(--muted-2); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }
.tree-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .conf-time { font-size: 11px; color: var(--success); flex-shrink: 0; }

/* 多選時才出現的操作列 */
.sel-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 4px 2px 10px; padding: 8px 10px;
  background: var(--primary-container); color: var(--on-primary-container);
  border-radius: var(--r-md);
}
.sel-bar .sel-count { font-size: 13px; font-weight: 500; margin-right: auto; }
.sel-bar .btn.ghost { background: transparent; border-color: rgba(11,87,208,.35); color: var(--primary); }

/* ── 中央檢視器 ── */
.center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.viewer-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view-controls { display: flex; gap: 4px; align-items: center; }
.page-indicator { font-size: 12px; color: var(--muted); min-width: 50px; text-align: center; }
/* position:relative 是必要的：讓 .page-wrap 的 offsetParent 是本容器而非 body，
   否則 offsetTop 會含頂欄高度，使頁碼判定與 E/D 換頁捲動位置全部偏移。 */
.viewer { flex: 1; overflow: auto; background: var(--viewer-bg); padding: 18px 0; position: relative; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.page-wrap { position: relative; background: #fff; box-shadow: var(--e3); border-radius: 2px; }
.page-img { display: block; user-select: none; pointer-events: none; }
.page-overlay { position: absolute; inset: 0; }
.sticky-editor {
  position: absolute; border: 1px dashed var(--outline); padding: 3px;
  font-family: var(--font); resize: none; z-index: 5;
}
.text-editor {
  position: absolute; border: 1px dashed var(--outline); background: rgba(255,255,255,.92);
  font-family: var(--font); font-weight: 500; padding: 0 2px; z-index: 5; min-width: 160px;
}

/* ── 右側工具面板 ── */
.toolpane {
  width: 216px; background: var(--surface); border-left: 1px solid var(--border);
  overflow-y: auto; flex-shrink: 0; padding-bottom: 30px;
  position: relative; transition: width .15s ease;
}
/* 收合鍵貼在面板左上角，收起來之後它是唯一還看得到的東西 */
.toolpane-toggle {
  position: sticky; top: 0; left: 0; z-index: 2;
  display: block; width: 100%; padding: 6px 0;
  border: none; border-bottom: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: 12px;
}
.toolpane-toggle:hover { background: rgba(11,87,208,.08); color: var(--text); }
body.toolpane-collapsed .toolpane { width: 28px; overflow: hidden; }
body.toolpane-collapsed .toolpane .pane-section { display: none; }
/* 面板裡成排的按鈕（確認／取消確認、定稿工具） */
.pane-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pane-btns .btn { width: 100%; justify-content: center; }
/* 按鈕被鎖住時說明為什麼（確認鍵只有原按的人能取消） */
.pane-note { font-size: 11px; line-height: 1.5; color: var(--muted, #94a3b8); }
.pane-section { padding: 14px 14px 4px; }
.pane-title {
  font-size: 11px; font-weight: 500; color: var(--muted-2);
  margin-bottom: 10px; letter-spacing: .08em; text-transform: uppercase;
}
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tool-btn {
  padding: 9px 2px; font-size: 12px; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--font); color: var(--text); transition: background .12s;
}
.tool-btn:hover { background: rgba(11,87,208,.08); }
.tool-btn.active {
  background: var(--primary-container); color: var(--on-primary-container);
  border-color: transparent; font-weight: 500;
}
.color-row { display: flex; gap: 7px; flex-wrap: wrap; }
.color-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-swatch.active { border-color: var(--primary); transform: scale(1.12); }
.color-swatch.transparent { background: repeating-conic-gradient(var(--border) 0 25%, #fff 0 50%) 0 0/10px 10px; }
.size-row { display: flex; align-items: center; gap: 8px; }
.size-row input[type=range] { flex: 1; accent-color: var(--primary); }
.size-val { font-family: var(--font-mono); width: 20px; text-align: right; }
.field-mini { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.stamp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.stamp-cell {
  border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff;
  padding: 4px; cursor: pointer; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.stamp-cell img { max-width: 100%; max-height: 100%; }
.stamp-cell.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-container); }
.stamp-cell.add { font-size: 20px; color: var(--muted-2); }

/* ── 通用元件：Material 的 filled / tonal / text 三種按鈕 ── */
.btn {
  background: var(--primary); color: var(--on-primary); border: none;
  border-radius: var(--r-full); padding: 9px 20px; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: var(--font);
  letter-spacing: .01em; transition: background .12s, box-shadow .12s;
}
.btn:hover { background: var(--primary-hover); box-shadow: var(--e1); }
.btn:active { box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { background: rgba(31,31,31,.12); color: rgba(31,31,31,.38); cursor: default; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn.ghost:hover { background: rgba(11,87,208,.08); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8c1d18; }
.btn.ghost.danger { background: transparent; color: var(--danger); border-color: rgba(179,38,30,.4); }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 6px 14px; font-size: 12px; }
.btn.done { background: var(--success); }   /* 已標記完成的分類進度按鈕 */
.btn.done:hover { background: #146c2e; }
.btn.block { width: 100%; }
.inline-select {
  padding: 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--border);
  font-family: var(--font); font-size: 13px; background: var(--surface); color: var(--text);
}
.hint { font-size: 12px; color: var(--muted-2); line-height: 1.6; margin-bottom: 10px; }

/* 吐司 */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #303030; color: #f2f2f2; padding: 12px 18px; border-radius: var(--r-sm);
  font-size: 13px; opacity: 0; transform: translateX(20px); transition: all .25s;
  max-width: 380px; box-shadow: var(--e2);
}
.toast.show { opacity: 1; transform: none; }
.toast.success { border-left: 4px solid #81c995; }
.toast.warn { border-left: 4px solid #fdd663; }
.toast.error { border-left: 4px solid #f28b82; }
.toast.info { border-left: 4px solid #8ab4f8; }

/* 對話框 */
.modal-overlay { position: fixed; inset: 0; background: rgba(32,33,36,.6); display: flex; align-items: center; justify-content: center; z-index: 900; }
.modal {
  background: var(--surface); border-radius: 28px; width: min(560px, 92vw);
  max-height: 88vh; overflow-y: auto; padding: 24px; box-shadow: var(--e3);
}
.modal h3 { margin-bottom: 16px; font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.modal-body { display: flex; flex-direction: column; gap: 4px; }
.modal-error { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 8px; }
.modal-foot { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 10px 14px; border: 1px solid var(--outline); border-radius: var(--r-sm);
  font-size: 14px; font-family: var(--font); color: var(--text); background: var(--surface);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary);
}
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field input[type=checkbox] { accent-color: var(--primary); }
.json-editor {
  width: 100%; height: 320px; font-family: var(--font-mono); font-size: 12px;
  padding: 12px; border: 1px solid var(--outline); border-radius: var(--r-sm);
}

/* 右鍵選單 */
.ctx-menu {
  position: fixed; background: var(--surface); border: none; border-radius: var(--r-sm);
  box-shadow: var(--e2); z-index: 950; min-width: 180px; overflow: hidden; padding: 8px 0;
}
.ctx-item { padding: 10px 18px; font-size: 13px; cursor: pointer; }
.ctx-item:hover { background: rgba(11,87,208,.08); }
.ctx-item.danger { color: var(--danger); }

/* 拆分表 */
.split-table { border: 1px solid var(--border); border-radius: var(--r-md); margin-top: 6px; max-height: 320px; overflow-y: auto; }
.split-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.split-row:last-child { border-bottom: none; }
.split-row .code { font-family: var(--font-mono); color: var(--muted-2); width: 26px; }
.split-row .sec-name { flex: 1; }
.split-row input { width: 70px; padding: 5px 10px; border: 1px solid var(--outline); border-radius: var(--r-sm); font-family: var(--font); }
.split-row .remain { font-weight: 500; color: var(--success); }

/* 上傳進度 */
.progress-bar {
  height: 4px; border-radius: var(--r-full); background: var(--primary-container);
  overflow: hidden; margin: 14px 0;
}
.progress-bar > i { display: block; height: 100%; background: var(--primary); transition: width .2s ease; }

/* ── 年度 × 分類頁籤（兩行） ── */
.tabs { display: flex; flex-direction: column; gap: 5px; flex: 1; overflow-x: auto; }
.tab-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab-row.readonly .tab { opacity: .85; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 6px 14px; cursor: pointer;
  white-space: nowrap; font-size: 13px; font-family: var(--font);
  transition: background .12s;
}
.tab:hover { background: rgba(11,87,208,.08); }
.tab.active {
  background: var(--primary-container); color: var(--on-primary-container);
  border-color: transparent; font-weight: 500;
}
.year-chip {
  font-size: 11px; font-weight: 500; letter-spacing: .03em;
  padding: 4px 12px; border-radius: var(--r-full); white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.year-chip.active { background: var(--primary); color: var(--on-primary); }
/* 往年唯讀：用鎖取代「唯讀」兩個字——六個分類排一列，字太佔位子。
   「使用中」則改用人形（見 renderDocTabs），兩個符號不會撞在一起。 */
.tab.readonly::after { content: " 🔒"; font-size: 10px; opacity: .75; }
.ro-banner {
  font-size: 12px; font-weight: 500; color: #a8500a;
  background: #fef7e0; border: 1px solid #fdd663;
  padding: 4px 12px; border-radius: var(--r-full); white-space: nowrap;
}
/* 往年唯讀：標了 data-write 的操作直接不顯示（伺服器另有 require_writable 擋著）。
   用明確標記而不是靠 .ghost 之類的外觀 class 推斷——「取消確認」是 ghost 卻會寫入。 */
/* 不能只限 .viewer-bar：確認／簽名這些控制項已經搬到右側工具欄，
   限定在檢視列的話，往年唯讀時它們會照常顯示，按下去才被伺服器打回來。 */
body.year-readonly [data-write] { display: none; }

/* 樹狀分類：收合鍵 */
.tree-group-head { display: flex; align-items: center; gap: 6px; }
.tree-group-head .caret { width: 12px; color: var(--muted-2); font-size: 11px; flex-shrink: 0; }
.tree-group-head .cat { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-group-head .cnt { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.tree-group-head:hover { color: var(--text); }
.tree-tools { display: flex; gap: 6px; margin-top: 8px; }
.tree-tools .btn { flex: 1; padding: 5px 8px; font-size: 11.5px; }

/* ---------- 註解與問題紙 ---------- */
.sheet-group { margin: 2px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.tree-row.sheet-row { font-weight: 500; }
/* 空的就安靜地待著：不放大、不搶眼。淡化到看得見但不會誤以為裡面有東西。
   （class 名字刻意不叫 empty，避免撞到上面 .tree .empty 那塊置中大留白的提示） */
.tree-row.sheet-row.sheet-empty { opacity: .55; font-weight: 400; }
.tree-row.sheet-row.sheet-empty .sheet-icon { filter: grayscale(1); }
.tree-row.sheet-row .sheet-icon { flex-shrink: 0; }
.tree-row.sheet-row .sheet-count {
  min-width: 20px; text-align: center; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--muted); flex-shrink: 0;
}
/* 有註解才是該被看見的那一張——用未讀標記的橘色，不必點開就知道有事情待辦 */
.tree-row.sheet-row.has-note .sheet-count { background: #fef7e0; color: #b06000; }
.tree-row.sheet-row.active.has-note .sheet-count { background: var(--primary); color: #fff; }
.cmt-badge {
  min-width: 18px; text-align: center; font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: var(--r-full);
  background: #fef7e0; color: #b06000; flex-shrink: 0;
}

/* 註解的打字框：跟在圈選下方 */
.comment-editor {
  position: absolute; z-index: 6; width: 260px;
  background: var(--surface); border: 1px solid var(--primary);
  border-radius: var(--r-sm); box-shadow: var(--e2); padding: 8px;
}
.comment-editor textarea {
  width: 100%; height: 70px; resize: vertical; border: none; outline: none;
  font-family: var(--font); font-size: 13px; color: var(--text);
}
.comment-editor .hint { margin: 4px 0 0; font-size: 11px; color: var(--muted-2); }

/* 問題紙：蓋在檢視區上 */
.sheet-pane {
  position: absolute; inset: 0; z-index: 4; overflow-y: auto;
  background: var(--surface-1); padding: 18px 22px;
}
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-head h3 { font-size: 18px; font-weight: 500; }
.sheet-head .sheet-sub { color: var(--muted-2); font-size: 13px; margin-right: auto; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-item {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px; transition: background .12s, border-color .12s;
}
.sheet-item:hover { background: rgba(11,87,208,.06); border-color: var(--primary); }
.sheet-no {
  min-width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-container); color: var(--on-primary-container);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.sheet-body { flex: 1; min-width: 0; }
.sheet-where { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.sheet-code { font-weight: 500; font-size: 13px; }
.sheet-page { font-size: 12px; color: var(--muted-2); }
.sheet-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* ---------- 系統設定：標記設定 ---------- */
.marks-role { border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px; margin-bottom: 12px; }
.marks-title { font-weight: 500; font-size: 14px; margin-bottom: 10px; }
.marks-role .color-row { gap: 8px; margin-bottom: 6px; }
.marks-role .color-swatch { width: 28px; height: 28px; opacity: .28;
  border: 2px solid var(--border); transition: opacity .12s, box-shadow .12s; }
.marks-role .color-swatch.active { opacity: 1; border-color: var(--text);
  box-shadow: 0 0 0 3px var(--primary-container); }
.marks-role .stamp-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.marks-role .stamp-cell { position: relative; }
.stamp-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px;
  line-height: 1; border: none; cursor: pointer; opacity: 0; transition: opacity .12s; }
.stamp-cell:hover .stamp-del { opacity: 1; }
details > summary { cursor: pointer; font-size: 13px; color: var(--muted);
  padding: 8px 0; user-select: none; }
