/* 設計 token 照 backtesting 專案 frontend/src/style.css 的淡色 monday 風格（登入頁＋登入後所有頁），文字色都挑到對白底 ≥ 4.5:1。
   原本另有一組沒有頁面使用的深色 token，計畫 20260930-full-refactor 刪除（要深色模式時再加）。
   本專案沒有 Tailwind／建置工具，所以直接寫 CSS；字型不載外部資源，改用系統字型堆疊。 */
:root {
  --font-sans: 'Inter', 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;

  --c-canvas: #f6f7fb;
  --c-surface: #ffffff;
  --c-border: #d0d4e4;
  --c-text-primary: #323338;
  --c-text-secondary: #676879;
  --c-accent: #e6e9ef;
  --c-portfolio: #0073ea;
  --c-positive: #007f4e;
  --c-negative: #c9364e;
  --c-benchmark: #9699a6;
  --c-surface-muted: #f0f1f5;

  /* 狀態色（計畫 20261009-full-refactor-4 從散在各處的色碼抽出）：成功／完成的綠、待處理的橘、錯誤的紅（淡底＋深字成對）、
     警告的琥珀、進行中的淡藍底。地圖 .sm-* 的資料色不用這組（顏色剛好一樣也不併，各自的意思不同） */
  --c-success-bg: #dff5ea;
  --c-success-text: #005c39;
  --c-pending-bg: #fff1d6;
  --c-pending-text: #8a4b00;
  --c-error-bg: #fdecea;
  --c-error-text: #b3261e;
  --c-warning: #b4690e;
  --c-info-bg: #e6f0fb;

  /* 角色色：角色標籤（.role-*）與會員管理的群組色條（.grp-*）共用，「色＝角色」兩處一致；會員用 --c-benchmark */
  --role-manager: #a25ddc;
  --role-leader: #00c875;
  --role-staff: #fdab3d;

  /* 店面圖的六種底色：圖例（.legend-*）與地圖格子（.sm-*）共用（計畫 20261007-full-refactor-2 從兩處各寫一份的色碼抽出） */
  --map-freezer: #d6f5ef;
  --map-freezer-end: #e3d9f7;
  --map-chilled: #dff5ea;
  --map-promo: #fde8ec;
  --map-produce: #fff9c4;
  --map-rice: #ffe0b2;

  /* 同一個顏色在兩處以上用、要一起改的（計畫 20261026-full-refactor-7 C4-09）：說明小字的藍、急件的深橘、Stock「一直拿著」的灰（圖線與圖例要同色） */
  --c-detail-blue: #3a6ea5;
  --c-urgent: #9a3412;
  --c-stock-hold: #8a8f98;

  /* 浮在手機底部分頁列上方的東西（排序完成鈕、背景上傳）離底部多遠：分頁列約 52px＋一點空隙 */
  --tabbar-clearance: 64px;

  /* 疊放層級（z-index，數字大的蓋在上面；計畫 20261026-full-refactor-7 C4-04 把散在各處的數字集中）。元件內部只跟兄弟比的 1 不列。 */
  --z-list-count: 4;    /* 資料庫清單的筆數列：釘在篩選表單底下 */
  --z-sticky: 5;        /* 釘頂的篩選、新版提示、側欄收合鈕 */
  --z-bar: 6;           /* 釘頂／釘底的列：‹ 返回、開發頁籤、摺疊標題、底部按鈕列 */
  --z-mail-top: 7;      /* 交辦頁頂列：比底部那組（--z-bar）高，⋯ 的下拉才蓋得住對話 */
  --z-menu: 20;         /* 頂列 ⋯ 的下拉 */
  --z-press-menu: 30;   /* 長按留言的選單 */
  --z-toast: 31;        /* 提示泡泡：蓋過長按選單 */
  --z-upload-dock: 40;  /* 背景上傳的照片 */
  --z-floating: 50;     /* 浮在畫面下方中間的按鈕（首頁排序完成） */
  --z-dropdown: 60;     /* 語言下拉 */
  --z-skip-link: 1000;  /* 鍵盤「跳到主內容」：永遠最上面 */
}

*, *::before, *::after { box-sizing: border-box; }
/* iPhone 橫放會自己把字放大、轉回直的有時縮不回來（計畫 20261027-phone-portrait-lock 第 2 輪，使用者實測）：固定 100% */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* 帶 hidden 的一律藏起來（計畫 20261008-global-hidden-guard）：瀏覽器內建的 [hidden] 權重最低，元素自己設了 display（flex／grid／
   inline-block）就會蓋掉它、帶著 hidden 照樣出現——以前靠逐條補 X[hidden]，漏一條就出 bug（2026-10-08 踩兩次）。
   !important 贏過所有一般規則與行內 style，所以以後設 display 不必再補。要顯示就拿掉 hidden，不要用 CSS 硬撐。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--c-canvas);
  color: var(--c-text-primary);
  line-height: 1.5;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.muted { color: var(--c-text-secondary); }
.small { font-size: 0.875rem; }

:focus-visible { outline: 2px solid var(--c-portfolio); outline-offset: 2px; }

/* 觸控基礎：manipulation 去掉行動瀏覽器 300ms 點擊延遲與雙擊縮放；關掉 iOS 灰色點擊高亮。
   所有 :hover 規則都包在 @media (hover: hover) 裡——觸控裝置點一下 hover 會「黏住」不放，
   按下去的回饋改用 :active。 */
button, a, summary, .input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn:active:not(:disabled), .icon-btn:active, .nav-link:active, .seg button:active, .sidebar-toggle:active,
.pager button:active:not(:disabled), .google-btn:active, .lang-switch summary:active, .lang-menu a:active {
  filter: brightness(0.9);
}

/* ---------- 按鈕與輸入 ---------- */
.btn {
  font: inherit; font-size: 0.875rem; color: var(--c-text-primary);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 6px;
  padding: 0.375rem 0.75rem; cursor: pointer;
}
@media (hover: hover) { .btn:hover { background: var(--c-accent); } }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { font-size: 0.75rem; font-weight: 500; padding: 0.25rem 0.75rem; }
.btn-primary { background: var(--c-portfolio); border-color: var(--c-portfolio); color: #fff; font-weight: 500; }
@media (hover: hover) { .btn-primary:hover { background: var(--c-portfolio); filter: brightness(0.92); } }
/* 紅色鈕（刪除、確定刪除、退回）一律 .btn-danger。
   .btn-positive（綠色確定鈕）只有 members.js 的升級確認視窗用，模板裡沒有——掃描看不到 JS 字串，別當沒人用刪掉 */
.btn-danger { background: var(--c-negative); border-color: var(--c-negative); color: #fff; font-weight: 500; }
.btn-positive { background: var(--c-positive); border-color: var(--c-positive); color: #fff; font-weight: 500; }
/* hover 要補回自己的底色：.btn:hover（權重較高）會把底色換成 --c-accent，紅綠鈕就變灰底白字（同 .btn-primary:hover） */
@media (hover: hover) {
  .btn-danger:hover { background: var(--c-negative); filter: brightness(0.92); }
  .btn-positive:hover { background: var(--c-positive); filter: brightness(0.92); }
}
.icon-btn { background: none; border: 0; color: var(--c-text-secondary); cursor: pointer; font-size: 1rem; }
@media (hover: hover) { .icon-btn:hover { color: var(--c-text-primary); } }

.input {
  font: inherit; font-size: 0.875rem; color: var(--c-text-primary);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 6px; padding: 0.5rem 0.75rem;
}
.input-sm { padding: 0.25rem 0.5rem; }
.input-block { width: 100%; }

/* ---------- 首頁功能卡片（第 8 輪，使用者選的 home 01：兩欄方格，圖示上、標題下；說明只剩「管理」頁的列表有） ----------
   每張卡都是 <a>（促銷提醒原本的「即將推出」灰卡已上線，計畫 20260929-promo-reminders）；≥ 768px 改三欄。 */
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.5rem; margin: 0 0 0.75rem; }
.who h1 { margin: 0; font-size: 1rem; font-weight: 600; }
.who-head { display: flex; align-items: center; gap: 0.5rem; }
/* 手機通知小鈴鐺（「我的」頁；計畫 20261003-web-push；改成鈴鐺：計畫 20261004-push-bell-tag）：開＝主色藍底白鈴（同 dev 標籤的藍）、
   關＝灰底灰鈴加斜線；兩個 svg 都輸出，依 data-state 只顯示一個（push.js 切換） */
.push-bell { display: inline-flex; align-items: center; justify-content: center; width: 1.875rem; height: 1.5rem; padding: 0;
             border: 0; border-radius: 999px; background: #eceef2; color: #6b7280; cursor: pointer; flex: none; }
.push-bell:disabled { opacity: 0.6; cursor: default; }
.push-bell svg { width: 0.95rem; height: 0.95rem; }
.push-bell[data-state="on"] { background: var(--c-portfolio); color: #fff; }
.push-bell[data-state="on"] .push-bell-off, .push-bell[data-state="off"] .push-bell-on { display: none; }
.who p { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0; font-size: 0.8125rem; }
/* 鈴鐺的提示（iPhone 要先加入主畫面／通知被封鎖）：點鈴鐺才出現、自己一行 */
.who .push-hint { flex-basis: 100%; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 768px) { .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.home-card {
  display: flex; flex-direction: column; gap: 0.5rem; min-height: 132px; padding: 1rem 0.875rem;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px;
  color: var(--c-text-primary); text-decoration: none;
}
@media (hover: hover) { a.home-card:hover { border-color: var(--c-portfolio); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06); } }
.home-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; }
.home-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-icon-members { background: var(--c-portfolio); }
.home-icon-promos { background: #e07b00; }
.home-icon-rules { background: #2e7d6b; }
.home-icon-memos { background: #b7791f; }
.home-icon-products { background: #7a5af8; }
.home-icon-dev { background: var(--c-text-primary); }
.home-icon-audit { background: #5b6b8c; }
.home-icon-trash { background: #8a4b38; }
.home-icon-dashboard { background: #1f6f8b; }
.home-icon-permissions { background: #037f4c; }
.home-icon-map { background: #1f8a7a; }
.home-icon-reviews { background: #0b7a75; }
.home-icon-expiry { background: var(--c-negative); }
.home-icon-stale { background: #8a6d3b; }
.home-icon-restock { background: #b7591f; }
.home-icon-stock { background: #455a8a; }
.home-icon-manage { background: #5b6170; }
/* 管理看板（計畫 20261006-admin-dashboard）：數字卡 2×2（手機 390 也是兩欄）、期間 chip 沿用 is-on、各人表沿用 .perm-table 但名字靠左 */
.dash-section { margin-bottom: 1.5rem; }
.dash-section h2 { margin: 0 0 0.25rem; }
.dash-stats { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
/* 數字卡扁一點（計畫 20261006-dash-cards-flat，使用者「完整度四張卡也可以扁一點」）：上下內距、大數字、兩行間距都收小 */
.dash-stat { display: flex; flex-direction: column; gap: 0; padding: 0.45rem 0.7rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; min-width: 0; }
.dash-stat-n { font-size: 1.35rem; font-weight: 700; line-height: 1.1; display: flex; align-items: baseline; gap: 0.35rem; }
.dash-stat-n small { font-size: 0.85rem; font-weight: 600; color: var(--c-text-secondary); }
.dash-stat-l { font-size: 0.85rem; color: var(--c-text-secondary); overflow-wrap: anywhere; }
.dash-period { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.5rem 0 0.6rem; }
/* 手機上 chip 被觸控規則撐到 44px（見「手機優先 1／2」）；看板的期間 chip 跟按鈕一樣 36px（計畫 20261006-dash-cards-flat，同 filter-fold-tight 選的 36）。桌機照舊 32 */
@media (max-width: 767px), (pointer: coarse) {
  .dash-period .chip { min-height: 36px; }
}
.dash-people th[scope=row] { text-align: left; }
/* 缺貨總表（計畫 20261003-restock-board）：列上「誰標的」一行 */
.restock-by { color: var(--c-text-secondary); }
/* 第 3 輪：列＝連結＋右邊按鈕（連結不巢狀）；已完成的列淡綠底＋綠字「已完成：誰」。待審核列（計畫 20260929-own-pending-visible）同一套排法，
   計畫 20261007-full-refactor-2 起兩個 class 合寫在這裡 */
.shelf-list .restock-row, .shelf-list .review-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.65rem;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px;
}
.shelf-list .restock-row > a.restock-row-link, .shelf-list .review-row > a.review-row-link { flex: 1; min-width: 0; padding: 0; border: 0; background: none; }
.shelf-list .restock-row.is-done { background: #eef8f1; }
.restock-actions { display: flex; flex-direction: column; gap: 0.3rem; flex-shrink: 0; }
.restock-actions form { margin: 0; }
.restock-done { color: #1f7a44; font-weight: 600; }

/* ---------- 首頁卡片排序（計畫 20260929-home-card-order 第 3 輪：iPhone 主畫面式；每個人排自己的，計畫 20261007-notes-title-personal-order） ----------
   長按進入編輯模式：卡片左右小角度抖動、各卡錯開節奏；「完成」固定在畫面下方（避開手勢列）。
   開發者頁面的卡片關掉 iOS 長按連結預覽與選字，長按才會交給排序 JS。 */
[data-order-grid] .home-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@keyframes home-card-jiggle {
  0% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.2deg); }
  100% { transform: rotate(-1.2deg); }
}
/* 抖動與拖拉樣式：首頁卡片、工作守則列與管理頁卡片（計畫 20261007-batch-five E）共用（long-press-sort.js 加 is-ordering／is-chosen／is-ghost） */
.home-grid.is-ordering .home-card, .rule-list.is-ordering .rule-open, .manage-list.is-ordering > li > a { animation: home-card-jiggle 0.28s ease-in-out infinite; cursor: grab; }
.home-grid.is-ordering .home-card:nth-child(2n), .rule-list.is-ordering .rule-row:nth-child(2n) .rule-open,
.manage-list.is-ordering > li:nth-child(2n) > a { animation-delay: -0.14s; animation-duration: 0.3s; }
.home-grid.is-ordering .home-card:nth-child(3n) { animation-delay: -0.07s; }
.home-grid .home-card.is-chosen, .rule-list .rule-row.is-chosen .rule-open, .manage-list > li.is-chosen > a { animation: none; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18); }
.home-grid .home-card.is-ghost, .rule-list .rule-row.is-ghost, .manage-list > li.is-ghost { opacity: 0.35; }
@media (prefers-reduced-motion: reduce) {
  .home-grid.is-ordering .home-card, .rule-list.is-ordering .rule-open, .manage-list.is-ordering > li > a { animation: none; border-style: dashed; }
}
.home-order-done {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: var(--z-floating); margin: 0;
  bottom: calc(1rem + env(safe-area-inset-bottom));
}
.home-order-done .btn { padding: 0.6rem 2rem; border-radius: 999px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); }
/* 手機底部有分頁列（約 52px＋安全區）：「完成」放在它上面，不蓋住「待辦」（計畫 20261007-batch-five E 在管理頁 Chrome 看到；首頁排序同一顆鈕一起改） */
@media (max-width: 767px) {
  .home-order-done { bottom: calc(var(--tabbar-clearance) + env(safe-area-inset-bottom)); }
}

/* ---------- 角色權限頁（計畫 20260929-role-permissions） ---------- */
.perm-scroll { overflow-x: auto; margin: 1rem 0; }
.perm-table { border-collapse: collapse; width: 100%; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px; }
.perm-table th, .perm-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--c-border); text-align: center; }
.perm-table th[scope=row] { text-align: left; font-weight: 600; }
.perm-table input[type=checkbox] { width: 1.25rem; height: 1.25rem; }
.perm-desc { display: block; font-weight: 400; }
.perm-fixed th[scope=row] { color: var(--c-text-secondary); }
.perm-flash { margin: 0.5rem 0; padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--c-success-bg); color: var(--c-success-text); font-weight: 700; }
/* 待審核（計畫 20260928-product-review-queue）：首頁卡筆數、產品頁待審 pill、審核頁對照表與種類 pill */
.count-badge { display: inline-block; min-width: 1.4em; padding: 0 0.4em; border-radius: 999px; background: var(--c-negative); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; }
.pill-review { background: #ece6ff; color: #4b2fb3; }
/* project demo（計畫 20261003-project-demo）：示範用、不可刪除。品名藍勾旁的淺綠小 tag（計畫 20261008-scroll-top-button 併入，
   使用者「改成一個小tag寫demo放在藍勾勾旁，用淺綠色」）：有設＝實心、沒設（只有開發者看得到）＝框線；開發者那顆是 button，
   視覺維持小小的、用 ::after 把點擊區撐到約 44px（手機可點元素的下限） */
.demo-tag { display: inline-block; position: relative; vertical-align: 0.2em; margin-left: 0.4em; padding: 0.05em 0.55em; border: 1px solid #7fcf9a;
  border-radius: 999px; background: transparent; color: #1b7a3f; font: inherit; font-size: 0.6em; font-weight: 700; line-height: 1.4; }
.demo-tag.is-on { background: var(--c-success-bg); border-color: var(--c-success-bg); color: var(--c-success-text); }
button.demo-tag { cursor: pointer; }
button.demo-tag::after { content: ''; position: absolute; inset: -12px -8px; }
button.demo-tag:active { background: #bfe9d0; }
@media (hover: hover) { button.demo-tag:hover { background: #cdeedb; } }
.review-kind-create { background: var(--c-success-bg); color: var(--c-success-text); }
.review-kind-update { background: var(--c-pending-bg); color: var(--c-pending-text); }
.review-kind-delete { background: #fde2e2; color: #8a1c1c; }
.review-diff { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.85rem; }
.review-diff th, .review-diff td { border: 1px solid var(--c-border); padding: 0.4rem 0.5rem; vertical-align: top; text-align: left; }
.review-diff thead th { background: var(--c-accent); }
.review-diff tbody th { width: 5rem; font-weight: 600; color: var(--c-text-secondary); }
.review-diff .product-thumb { display: inline-block; margin: 0 0.25rem 0.25rem 0; }
.review-diff .chip { margin: 0 0.25rem 0.25rem 0; }
/* 會員管理：「禁止編輯」標記、編輯視窗的開關列（ADR 0012）；開發頁：分頁籤與原文區（計畫 20260928-member-name-editor-dev） */
.editor-pill { background: #e6f4ff; color: #0b5cad; margin-left: 0.3rem; }
.disabled-pill { background: var(--c-error-bg); color: var(--c-error-text); margin-left: 0.3rem; }
/* 申請刪除中（計畫 20261009-member-self-deletion）：比「已停用」更重的實心紅，30 天後就匿名化 */
.deletion-pill { background: var(--c-negative); color: #fff; margin-left: 0.3rem; }
/* 不可逆的動作用紅字小按鈕（「我的」頁的刪除帳號、會員管理的幫人申請刪除）：不跟一般按鈕搶眼，按了一定有紅色確認 */
.link-danger { background: none; border: 0; padding: 0.25rem 0; color: var(--c-error-text); font-size: 0.875rem; text-decoration: underline; cursor: pointer; }
.danger-zone { margin-top: 2rem; text-align: center; }
/* 資料庫清單篩選（計畫 20260929-db-list-filter）：手機一列放得下關鍵字＋按鈕、兩個下拉並排、勾選自動換行 */
/* 整個表單黏在頂端（第 27 輪；第 25 輪曾用 display: contents 只黏搜尋列，iOS Safari 算錯位置、收合鈕被蓋住） */
.db-filter { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.6rem; }
.db-filter-row { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
/* 篩選區黏在捲動區頂端（第 25 輪，使用者四頁都要「篩選要固定」）：資料庫清單搜尋列、備忘錄篩選列、會員管理篩選區、操作紀錄分類列共用；
   手機 .dash-main 自己捲、桌機整頁捲，sticky 兩種都黏得住（同 .dev-tabs）；底色不透明免得清單透出來 */
.sticky-filter { position: sticky; top: 0; z-index: var(--z-sticky); padding: 0.5rem 0; background: var(--c-canvas); }
/* 第 26 輪再套五頁：待辦分類鈕、交辦分段、久沒確認排序、找貨 chip（本身橫向捲動，黏住照樣能捲）、工作守則部門篩選 */
/* 可收合的篩選（第 28 輪，使用者「八頁全部加收合」「上下箭頭」）：details 當外殼、summary 一行「篩選 ▴」，收起＝▾；收合狀態 dashboard.js 記在 localStorage */
/* 箭頭緊貼「篩選」右邊、不推到最右（計畫 20261006-drive-and-excel-import 第 7 輪，使用者「篩選的箭頭應該貼在篩選右邊，其他頁也要一樣」）；全站共用 */
/* 資料庫清單的「篩選 ▾」（.db-filter-more，第 6 輪）是同一種按鈕：外觀合寫，箭頭與間距各自 */
.filter-fold > summary, .db-filter-more summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none;
  font-size: 0.9rem; color: var(--c-text-secondary); }
.filter-fold > summary { justify-content: flex-start; gap: 0.3rem; }
.filter-fold > summary::-webkit-details-marker, .db-filter-more summary::-webkit-details-marker { display: none; }
.filter-fold > summary::after { content: '▴'; font-size: 1rem; }
.filter-fold:not([open]) > summary::after { content: '▾'; }
/* 收起時不墊上下 padding（計畫 20261006-filter-fold-tight，使用者「為什麼篩選上方還有空間？每個有篩選的頁面都這樣」）：
   summary 本身 44px 高、字置中，再加這裡的 8px 與頁面頂端 12px，收起後只剩一行字時空白很明顯；打開時照舊留給 chip／輸入框 */
.filter-fold.sticky-filter:not([open]) { padding-block: 0; }
/* 下方也一樣（第 3 輪，使用者「篩選跟下方的空白也是一樣太多」「每頁都要調整」）：summary 字下面本來就有約 15px，
   後面那一段（或它開頭的標題，上邊距會疊合穿出來）再墊 6-16px 就太多；把這幾層的上邊距歸零，收起時上下都約 15px。
   展開時同理（計畫 20261006-remove-extra-text，使用者「篩選展開後下方的空白太多」）：chip 列自己的下邊距 12px＋下一段標題 16px＋篩選區 8px＝36px，
   前兩層拿掉、只留 8px */
.filter-fold > :last-child { margin-bottom: 0; }
.filter-fold.sticky-filter + *,
.filter-fold.sticky-filter + * > :first-child,
.filter-fold.sticky-filter + * > :first-child > :first-child { margin-top: 0; }
/* 篩選裡的 chip 扁一點（計畫 20261008-mail-history-purge 第 8 輪，使用者「上面三個tag要扁一點」「其他頁的tag都要統一扁一點」「我指的是在篩選裡的tag」）：
   手機觸控規則把 .chip 撐到 44px，篩選裡統一 30px（仍高於 WCAG 2.5.8 的 24px）；篩選以外的 chip（看板期間、商品頁位置…）不動 */
.filter-fold .chip { min-height: 30px; padding-top: 0.1rem; padding-bottom: 0.1rem; }
/* 「‹ 管理」也釘住（第 28 輪，使用者「回管理頁也卷跑了」）；它後面的篩選列排在它底下 */
.back-bar { position: sticky; top: 0; z-index: var(--z-bar); display: flex; min-height: 44px; align-items: center; background: var(--c-canvas); }
.back-bar ~ * .sticky-filter { top: var(--back-bar-h, 44px); }
/* 搬進「‹ 管理」列的頁面說明（計畫 20261007-batch-five B，dashboard.js）：小字，太長就換行。
   緊接膠囊靠左（計畫 20261007-import-shelf-flow，使用者「<管理 旁邊的話要置左」）；膠囊不縮不換行——說明太長時曾把它擠成「管／理」兩行 */
.back-bar .back-note { margin: 0; padding-left: 0.75rem; min-width: 0; text-align: left; font-size: 0.8rem; line-height: 1.35; color: var(--c-text-secondary); }
.back-bar .back-link { flex-shrink: 0; white-space: nowrap; }
.db-filter-q { flex: 1; min-width: 0; }
.db-filter-select { flex: 1; min-width: 8rem; }
.db-filter-checks label { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 32px; font-size: 0.9rem; }
/* 篩選收合（第 6 輪）：summary 當按鈕，手指點得到；展開後的列照舊 */
.db-filter-more { display: flex; flex-direction: column; gap: 0.45rem; }
.db-filter-more summary::after { content: '▾'; margin-left: 0.35rem; font-size: 1rem; } /* 上下箭頭（第 28 輪，使用者「篩選旁要有箭頭」） */
.db-filter-more[open] summary::after { content: '▴'; }
/* 資料庫清單的「篩選 ▾」收起時也不多留空白（計畫 20261006-filter-fold-tight 第 3 輪，使用者「這頁還是很多空白」）：
   收起的 details 仍會留一段 gap 給看不見的內容（51px），表單底部的 8px、下一段開頭的上邊距也拿掉——「篩選」字到「共 N 件」44→24px */
.db-filter-more:not([open]) { gap: 0; }
.db-filter.sticky-filter:has(.db-filter-more:not([open])) { padding-bottom: 0; }
.db-filter.sticky-filter:has(.db-filter-more:not([open])) + *,
.db-filter.sticky-filter:has(.db-filter-more:not([open])) + * > :first-child { margin-top: 0; }
/* 「共 N 件／符合 N 件」釘在篩選表單正下方（計畫 20261006-remove-extra-text 第 2 輪，使用者「共幾件商品應該要固定住不能移動」）：
   原本捲進表單底下只露半截。它在 live 區塊裡不能搬進表單，所以自己 sticky，top＝products-list.js 量到的表單高度；
   沒有 JS 就沒有 --db-filter-h，退回不釘。不透明底色讓清單從底下捲過，z-index 低於表單。
   不靠剛好對齊（第 3 輪，使用者 iPhone「符合59件上方怎麼有漏洞，看得到後面？」：Chrome 量剛好、iOS 露一條縫）：
   往上塞進表單 1px，再用 box-shadow 往上補 16px 同底色，表單蓋在上面看不到重疊；底下留 4px 讓清單的字不貼著 */
.page[style*="--db-filter-h"] .list-count { position: sticky; top: calc(var(--db-filter-h) - 1px); z-index: var(--z-list-count); background: var(--c-canvas);
  box-shadow: 0 -16px 0 var(--c-canvas); padding-bottom: 0.25rem; }
/* 工作守則與部門（計畫 20260929-work-rules） */
.dept-pill { background: #e8f3ef; color: #1f5f50; margin: 0 0.3rem 0.2rem 0; }
.dept-general { background: #eef0f3; color: #3b4450; }
.dept-fieldset { border: 0; margin: 0.6rem 0 0; padding: 0; }
.dept-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem 0.8rem; }
.dept-grid label { display: flex; align-items: center; gap: 0.35rem; min-height: 32px; }
.rules-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.rules-head p { margin: 0; }
.rules-head > .btn:first-child { margin-left: auto; }
/* 頁首按鈕放進「篩選」那一列右邊（計畫 20261006-remove-extra-text，使用者「篩選可以跟新交辦同列嗎」：交辦列表、工作守則）：
   頁首本身高 0、跟篩選一起釘頂，按鈕往下凸到 summary 那一列；收起時 summary 44px、按鈕 36px → 下移 4px，展開時篩選上面多 8px padding → 12px。
   不用外層包住兩者：包了 sticky 只會黏在外層裡、捲過就跑掉；不放進 summary：summary 是按鈕角色，裡面再放連結螢幕閱讀器念不到。
   要寫在 .rules-head 後面：同權重後寫的贏，不然它的下邊距 6px 會把篩選往下推、按鈕就偏高 */
.fold-head { position: sticky; top: 0; z-index: var(--z-bar); height: 0; margin: 0; align-items: flex-start; }
.fold-head > .btn { position: relative; top: 4px; margin-left: auto; }
.fold-head:has(+ .filter-fold[open]) > .btn { top: 12px; }
.rules-filter { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.rules-filter .chip { cursor: pointer; }
/* 久沒確認的排法切換（計畫 20261002-stale-walk-order）：同工作守則的篩選鈕 */
.stale-sort { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.rule-open {
  display: block; width: 100%; min-height: 44px; padding: 0.7rem 0.9rem; text-align: left; font: inherit; font-weight: 700;
  color: var(--c-text-primary); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; cursor: pointer;
  -webkit-touch-callout: none; user-select: none;
}
.rule-dialog { width: min(34rem, 94vw); }
.rule-dialog .modal-head h2 { overflow-wrap: anywhere; }
.rule-tags { margin: 0 0 0.5rem; }
.rule-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; max-height: 60vh; overflow-y: auto; }
.rule-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.8rem; }
.rule-actions form { margin: 0; }
.rule-textarea { min-height: 10rem; resize: vertical; }
.check-row { margin: 0.5rem 0; }
.check-row label { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; }
/* 檔名 tag 固定在內容區頂端（計畫 20261001-product-page-tags）：手機是 .dash-main 自己捲、桌機是整頁捲，sticky 兩種都黏得住；
   背景不透明免得內容透出來；跳到的標題留出這列的高度不被蓋住。
   「‹ 管理」膠囊也在這一列最左邊（計畫 20261006-dev-tabs-row）：之前 fragment 的 .back-bar 也釘 top:0、z-index 6，籤一捲就滑到它底下；
   z-index 跟 .back-bar 一樣高；五個膠囊放不下就整列橫向捲、不換行（換行會變高、蓋住內容） */
.dev-tabs { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; position: sticky; top: 0; z-index: var(--z-bar); padding: 0.5rem 0; background: var(--c-canvas);
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.dev-tabs::-webkit-scrollbar { display: none; }
.dev-tabs .back-link { margin: 0; flex-shrink: 0; }
.dev-section h2 { scroll-margin-top: 3.5rem; }
.dev-tabs a:not(.back-link) { padding: 0.35rem 0.6rem; /* 0.6 而不是 0.7：五個膠囊在 390 寬量到 351px，0.7 是 363、超出 358 的預算 */ border: 1px solid var(--c-border); border-radius: 999px; text-decoration: none; color: var(--c-text-primary); font-size: 0.9rem; white-space: nowrap; flex-shrink: 0; }
.dev-tabs a.is-on { background: var(--c-portfolio); border-color: var(--c-portfolio); color: #fff; }
.dev-section { margin-bottom: 1.25rem; }
/* 開發頁 backup 分頁（計畫 20261002-auto-backup）：沿用 .perm-table；表單不撐高列、手機上只有時間不斷行（第二行大小可換行，第 8 輪）；標題與「立即備份」同一列；文字靠左（第 16 輪，.perm-table 預設置中） */
.backup-table { margin-bottom: 1rem; }
.backup-head { display: flex; align-items: center; gap: 0.75rem; }
.backup-head form { margin: 0; }
.backup-table form { margin: 0; }
.backup-table td { vertical-align: middle; }
.backup-table th, .backup-table td:first-child { text-align: left; }
.backup-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.backup-time { white-space: nowrap; }
.backup-size { margin-top: 0.15rem; }
.dev-doc { white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; line-height: 1.45; padding: 0.75rem; border-radius: 12px; background: var(--c-surface); border: 1px solid var(--c-border); }
/* 開發頁易讀模式（計畫 20260928-dev-page-markdown）：commonmark 輸出的標題／清單／表格；表格外層可橫捲免撐破手機版面 */
.dev-md { font-size: 0.8rem; line-height: 1.5; padding: 0.75rem; border-radius: 12px; background: var(--c-surface); border: 1px solid var(--c-border); overflow-x: auto; word-break: break-word; }
.dev-md h1 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.dev-md h2 { font-size: 0.95rem; margin: 1rem 0 0.4rem; padding-top: 0.6rem; border-top: 1px solid var(--c-border); }
/* backlog 分頁從「## 清單」開始（計畫 20261006-dev-backlog-list-only）：第一個就是 h2 時不畫上方分隔線、不留上方空白 */
.dev-md > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.dev-md h3 { font-size: 0.85rem; margin: 0.8rem 0 0.3rem; }
.dev-md p { margin: 0.4rem 0; }
.dev-md ul, .dev-md ol { margin: 0.3rem 0; padding-left: 1.2rem; }
.dev-md li { margin: 0.15rem 0; }
.dev-md table { border-collapse: collapse; margin: 0.5rem 0; font-size: 0.75rem; }
.dev-md th, .dev-md td { border: 1px solid var(--c-border); padding: 0.3rem 0.45rem; vertical-align: top; text-align: left; }
.dev-md th { background: var(--c-accent); }
.dev-md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; background: var(--c-accent); padding: 0 0.2rem; border-radius: 4px; }
.dev-md pre { overflow-x: auto; padding: 0.5rem; background: var(--c-accent); border-radius: 8px; }
.dev-md pre code { background: none; padding: 0; }
.dev-md blockquote { margin: 0.4rem 0; padding-left: 0.6rem; border-left: 3px solid var(--c-border); color: var(--c-text-secondary); }
.dev-md hr { border: 0; border-top: 1px solid var(--c-border); margin: 0.8rem 0; }
.dev-raw { margin-top: 0.5rem; }
.dev-raw summary { cursor: pointer; font-size: 0.8rem; color: var(--c-text-secondary); }
.home-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; font-size: 0.9375rem; font-weight: 600; }
.home-desc { font-size: 0.75rem; line-height: 1.4; color: var(--c-text-secondary); }

/* ---------- 角色 pill：一定帶文字，顏色只是輔助。monday 原色對白字不足，綠／橘配深字、藍配白字。 ---------- */
.role-pill {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  border-radius: 999px; padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 600;
  background: var(--c-accent); color: var(--c-text-primary);
}
/* 開發者標籤（計畫 20261004-developer-flag）：開發者照自己的角色顯示，旁邊多這個 dev 標籤；沿用原本 ADMIN 角色的藍色 */
/* 用 .pill.dev-pill：後面的通用 .pill（同權重、寫在後面）會蓋掉單獨的 .dev-pill 底色（實測變灰） */
.pill.dev-pill { background: var(--c-portfolio); color: #fff; margin: 0 0.3rem 0.2rem 0; }
/* 經理（計畫 20261001-manager-role）：紫色，介於開發者藍（dev 標籤）與組長綠之間 */
.role-manager { background: var(--role-manager); color: #fff; }
.role-leader { background: var(--role-leader); color: var(--c-text-primary); }
.role-staff { background: var(--role-staff); color: var(--c-text-primary); }
.role-member { background: color-mix(in oklab, var(--c-benchmark) 35%, transparent); color: var(--c-text-primary); }

/* ---------- dashboard 殼 ---------- */
.dash { display: flex; flex-direction: column; min-height: 100vh; }

/* 頂欄三欄（第 16 版）：左語言圖示、中品牌、右純文字登出；左右等寬讓品牌真正置中 */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: 0.5rem 0.75rem;
}
/* 三格都是 44px 高、內容垂直置中（第 9 輪，使用者「要跟超市助手一樣水平」）：地球、品牌名、登出的中線一定同一條 */
.topbar > .lang-switch, .topbar > .brand, .topbar > .topbar-logout { display: flex; align-items: center; height: 44px; }
.brand { font-size: 1.125rem; font-weight: 600; text-align: center; justify-content: center; }
.topbar-logout { margin: 0; justify-self: end; }
.btn-ghost { border-color: transparent; background: none; color: var(--c-text-secondary); }
@media (hover: hover) { .btn-ghost:hover { background: var(--c-accent); color: var(--c-text-primary); } }

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

.sidebar {
  position: relative; flex-shrink: 0; width: 280px; padding: 1rem;
  background: var(--c-surface); border-right: 1px solid var(--c-border);
  transition: width 0.4s ease-in-out, padding 0.4s ease-in-out;
}
.sidebar[data-collapsed='true'] { width: 72px; padding-left: 0.75rem; padding-right: 0.75rem; }
/* 電腦版功能列不跟著內容捲（使用者 2026-10-04）：側欄本身照舊撐滿整頁高（背景、右框線不變），裡面的選單黏在畫面頂端；
   手機版（≤ 767px 橫向導覽列）在下面的 media query 改回 static */
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; position: sticky; top: 1rem; }

.nav-link {
  display: flex; align-items: center; gap: 0.5rem; overflow: hidden; white-space: nowrap;
  border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.875rem; font-weight: 500;
  color: var(--c-text-secondary); text-decoration: none;
}
@media (hover: hover) { .nav-link:hover { background: var(--c-accent); color: var(--c-text-primary); } }
/* 目前這一格的字比主色深兩成（計畫 20261009-commercial-batch-2 B13）：主色 #0073ea 放在自己 10% 的淡底上只有 3.95:1，
   底部分頁列的字又只有 11px，達不到 WCAG AA 的 4.5:1（axe color-contrast，BrowserSmokeIT 鎖）；深兩成約 5.6:1。不改 --c-portfolio 色票。 */
.nav-link.active { background: color-mix(in oklab, var(--c-portfolio) 10%, transparent); color: color-mix(in srgb, var(--c-portfolio) 80%, black); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { transition: opacity 0.4s ease-in-out; }
.sidebar[data-collapsed='true'] .nav-label { opacity: 0; }

/* 收合鈕固定在畫面中間高度、壓在側欄右框線上（使用者 2026-10-04「收功能列表的箭頭也不應該跟著信件長度而下移」）：
   原本 absolute 在側欄（整頁高）的 50%，頁面一長就跑到下面看不到。側欄永遠在最左邊，所以 left＝側欄寬 − 半顆鈕，跟著收合動畫一起移 */
.sidebar-toggle {
  position: fixed; top: 50vh; left: calc(280px - 18px); transform: translateY(-50%); z-index: var(--z-sticky);
  transition: left 0.4s ease-in-out;
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 999px; border: 1px solid var(--c-border); background: var(--c-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); cursor: pointer; color: var(--c-text-primary);
}
@media (hover: hover) { .sidebar-toggle:hover { background: var(--c-accent); } }
.sidebar-toggle svg { width: 18px; height: 18px; transition: transform 0.4s ease-in-out; }
.sidebar[data-collapsed='true'] .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar[data-collapsed='true'] .sidebar-toggle { left: calc(72px - 18px); }

.dash-main { flex: 1; min-width: 0; padding: 1.5rem; }
/* 頁尾版權聲明（計畫 20261001-site-footer-notice）：小字灰色、跟內容一起捲；長句可換行，不撐出左右捲動 */
.site-footer { margin-top: 2rem; padding-top: 0.75rem; border-top: 1px solid var(--c-border); color: var(--c-text-secondary);
  font-size: 0.75rem; line-height: 1.5; overflow-wrap: anywhere; }
.site-footer p { margin: 0 0 0.25rem; }
.login-page > .site-footer { width: 100%; max-width: 28rem; margin: 0 auto; padding: 0.75rem 1.25rem 1.5rem; }
.page { max-width: 72rem; margin: 0 auto; }

/* 手機版的覆寫集中在「手機優先 1／2、2／2」兩個 @media 區塊（排在它們蓋過的桌機規則之後，同 specificity 才蓋得過）；
   之後新增的桌機規則若要被手機版覆寫，選擇器要更具體（例如 #product-page …），或寫在它自己那段的 @media 裡。 */

/* ---------- 會員群組看板（第 4 輪，使用者選的 04：monday 群組——色條＋彩色標題＋人數，原生 <details> 收合） ---------- */
/* 角色分段切換（第 16 版）：「全部」＋看得到的角色，按鈕平分一列，選中的浮起來 */
.seg { display: flex; gap: 0; padding: 3px; margin-bottom: 0.625rem; background: var(--c-accent); border-radius: 10px; }
.seg button {
  flex: 1; min-width: 0; min-height: 36px; padding: 0.375rem 0; border: 0; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 0.8125rem; color: var(--c-text-primary); background: none; white-space: nowrap;
}
.seg button[aria-pressed='true'] { background: var(--c-surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* minmax(0, …)＋min-width 0：<input> 有內建最小寬度，純 1fr 在 390px 會把第二格擠出畫面 */
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; }
.filters .input { min-width: 0; }
/* 只剩一個框時佔滿整行：會員管理的 Email 框只給開發者（計畫 20261009-member-email-dev-only），經理只有姓名框 */
.filters > :only-child { grid-column: 1 / -1; }
.count-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0.75rem 0 0.25rem; font-size: 0.8125rem; color: var(--c-text-secondary); }

/* 群組色條沿用角色 pill 的顏色，讓「色＝角色」在兩處一致 */
.grp { --gc: var(--c-benchmark); margin-bottom: 1.125rem; }
.grp-manager { --gc: var(--role-manager); }
.grp-leader { --gc: var(--role-leader); }
.grp-staff { --gc: var(--role-staff); }
.grp-member { --gc: var(--c-benchmark); }
.grp-head {
  display: flex; align-items: center; gap: 0.5rem; list-style: none; cursor: pointer;
  min-height: 44px; padding: 0.375rem 0; font-weight: 600;
}
.grp-head::-webkit-details-marker { display: none; }
/* 角色色當字太淡（對淺灰底：組長綠 2.1、員工橘 1.8、經理紫 3.8、會員灰 2.7:1，要 4.5；axe 掃 /manage/members，
   計畫 20261026-commercial-standard-2 B13）：字調深一半（都 6:1 以上），色條與 pill 照舊用原色，仍看得出同一個顏色 */
.grp-title { color: color-mix(in srgb, var(--gc) 50%, black); }
.grp-count { font-weight: 400; font-size: 0.8125rem; color: var(--c-text-secondary); }
.grp-chevron { margin-left: auto; color: var(--c-text-secondary); transition: transform 0.2s ease-in-out; }
.grp:not([open]) .grp-chevron { transform: rotate(-90deg); }
.grp-list {
  overflow: hidden; border-radius: 6px; background: var(--c-surface);
  border: 1px solid var(--c-border); border-left: 6px solid var(--gc);
}
.grp-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.5rem 1rem; align-items: center;
  min-height: 52px; padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--c-border); font-size: 0.875rem;
}
.grp-row:last-child { border-bottom: 0; }
@media (hover: hover) { .grp-row:hover { background: var(--c-canvas); } }
.grp-act { justify-self: end; }
/* 會員列第 2 輪（計畫 20261003-last-login，使用者 2026-10-03）：名稱是按鈕（點了開會員資料），長得像文字；email、最後登入收進視窗 */
.member-name {
  justify-self: start; max-width: 100%; padding: 0.25rem 0; border: 0; background: none; color: var(--c-text-primary);
  font: inherit; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 部門篩選改下拉（第 25 輪，使用者「篩選也要用下拉式選單」）：下拉＋「只看禁止編輯」同一列 */
.member-filter { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.5rem; }
.member-filter .input { flex: 1; min-width: 0; }
.member-filter .chip { cursor: pointer; }
.member-filter-toggle { margin-left: auto; }
.member-detail { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.5rem 1rem; margin: 0; font-size: 0.9rem; }
.member-detail dt { color: var(--c-text-secondary); }
.member-detail dd { margin: 0; }
.member-detail-email { overflow-wrap: anywhere; }

.empty { padding: 1rem 0; text-align: center; }

.table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.table-footer label { display: flex; align-items: center; gap: 0.5rem; }
.pager { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; }
.pager button {
  font: inherit; background: none; border: 0; border-radius: 6px; padding: 0.25rem 0.75rem;
  color: var(--c-text-secondary); cursor: pointer;
}
@media (hover: hover) { .pager button:hover:not(:disabled) { background: var(--c-accent); } }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager button[aria-current='page'] {
  background: color-mix(in oklab, var(--c-portfolio) 10%, transparent); color: var(--c-portfolio); font-weight: 500;
}
.pager .gap { padding: 0 0.5rem; color: var(--c-text-secondary); }

/* ---------- modal（原生 <dialog>：Esc 關閉與 focus 由瀏覽器處理） ---------- */
.modal {
  width: min(28rem, calc(100vw - 2rem)); padding: 1.5rem;
  background: var(--c-surface); color: var(--c-text-primary);
  border: 1px solid var(--c-border); border-radius: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.4); }
.modal p { margin: 0 0 0.25rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

/* ---------- 登入頁（第 4 輪，使用者選的 08：淡色、插圖、三張特色卡、底部固定 Google 按鈕） ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.login-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.25rem;
}
/* 通知（成功訊息、登入頁提示）：淡綠底；登入頁的 info 只換底線色；錯誤（登入失敗、帳號已停用）淡紅 */
.notice {
  margin: 0 0 0.6rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid; border-radius: 10px;
  text-align: center; font-size: 0.875rem; font-weight: 700; background: var(--c-success-bg); color: var(--c-success-text);
}
.notice-info { border-color: color-mix(in oklab, var(--c-portfolio) 40%, transparent); }
.notice.notice-error { background: var(--c-error-bg); color: var(--c-error-text); border-color: #f4c7c3; }
/* 首頁「加到主畫面」提示（計畫 20261008-install-guide）：字與「看教學」tag 同一列置中，放不下就換行 */
.install-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.25rem 0.5rem; }
/* 安裝與通知教學頁：兩段可收合的卡片，標題列可點；步驟編號清單 */
.guide { margin: 0 0 0.75rem; padding: 0 1rem; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface); }
.guide > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; list-style: none; }
.guide > summary::-webkit-details-marker { display: none; }
/* summary 設了 flex 就沒有內建三角形，看不出能點：比照篩選列（.filter-fold）自己畫箭頭，放在右邊 */
.guide > summary::after { content: '▾'; margin-left: auto; color: var(--c-text-secondary); }
.guide[open] > summary::after { content: '▴'; }
.guide h2 { margin: 0.5rem 0 0.25rem; font-size: 1rem; }
.guide ol, .guide ul { margin: 0 0 0.5rem; padding-left: 1.4rem; }
.guide li { margin: 0.25rem 0; line-height: 1.5; }
.guide .guide-tips { color: var(--c-text-secondary); font-size: 0.875rem; }
.guide p.guide-tips { margin: 0.5rem 0 0.25rem; }
.guide ul.guide-tips { padding-bottom: 0.5rem; }
/* 產品頁／改資料頁「已被別人更新」（計畫 20261003-live-refresh）：黏在頂端，捲到哪都看得到；「重新載入」是 chip（計畫 20261006-text-links-to-chips），這裡只給間距 */
.notice.freshness { position: sticky; top: 0; z-index: var(--z-sticky); }
.notice.freshness a { margin-left: 0.5rem; }
.login-main { flex: 1; width: 100%; max-width: 28rem; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.login-illustration {
  display: flex; align-items: center; justify-content: center; width: 150px; height: 150px; margin: 1rem auto 0;
  border-radius: 999px; background: var(--c-surface); color: var(--c-portfolio);
  box-shadow: 0 10px 30px color-mix(in oklab, var(--c-portfolio) 15%, transparent);
}
.login-illustration svg { width: 80px; height: 80px; }
.login-headline { margin: 1rem 0 0.25rem; text-align: center; font-size: 1.75rem; font-weight: 700; }
.login-lead { margin: 0 0 1.5rem; text-align: center; color: var(--c-text-secondary); }
.login-features { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.login-features li {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px;
}
.login-features b { display: block; font-size: 0.9375rem; }
.login-features small { display: block; font-size: 0.8125rem; color: var(--c-text-secondary); }
.feature-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; color: #fff; }
.feature-icon svg { width: 20px; height: 20px; }
.feature-google { background: var(--c-portfolio); }
.feature-search { background: var(--c-positive); }
.feature-languages { background: #fdab3d; color: var(--c-text-primary); }
/* CTA：桌機是靜態置中欄；手機改固定底部（見檔尾手機區塊） */
.login-cta { width: 100%; max-width: 28rem; margin: 0 auto; padding: 1rem 1.25rem 1.5rem; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem; min-height: 52px;
  border-radius: 999px; padding: 0 1.25rem; font-size: 1rem; font-weight: 600; text-decoration: none;
  background: var(--c-portfolio); color: #fff;
}
@media (hover: hover) { .google-btn:hover { filter: brightness(0.92); } }
.google-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; background: #fff; }
.login-hint { margin: 0.75rem 0 0; text-align: center; font-size: 0.8125rem; color: var(--c-text-secondary); }

/* ---------- 語言切換（登入頁與登入後各頁共用） ---------- */
.lang-switch { position: relative; }
.lang-switch summary {
  display: flex; align-items: center; gap: 0.375rem; list-style: none; cursor: pointer;
  font-size: 0.875rem; color: var(--c-text-secondary);
  border: 1px solid var(--c-border); border-radius: 6px; padding: 0.375rem 0.625rem;
}
.lang-switch summary::-webkit-details-marker { display: none; }
/* compact（頂欄）：只留地球圖示，44×44 無框；語言名仍在 DOM 供輔助技術 */
.lang-switch[data-compact='true'] summary { width: 44px; height: 44px; justify-content: center; padding: 0; border-color: transparent; }
.lang-switch[data-compact='true'] summary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.lang-switch[data-compact='true'] .lang-icon { width: 22px; height: 22px; }
.lang-switch[data-compact='true'] .lang-menu { left: 0; right: auto; }
@media (hover: hover) { .lang-switch summary:hover { background: var(--c-accent); color: var(--c-text-primary); } }
.lang-icon { width: 16px; height: 16px; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 0.25rem); z-index: var(--z-dropdown); min-width: 9rem;
  margin: 0; padding: 0.25rem; list-style: none;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.lang-menu a {
  display: block; padding: 0.375rem 0.75rem; border-radius: 6px;
  font-size: 0.875rem; color: var(--c-text-primary); text-decoration: none;
}
@media (hover: hover) { .lang-menu a:hover { background: var(--c-accent); } }
.lang-menu a[aria-current='true'] {
  background: color-mix(in oklab, var(--c-portfolio) 10%, transparent); color: var(--c-portfolio); font-weight: 500;
}
.field-row { display: flex; gap: 0.5rem; }

/* ---------- 產品（計畫 20260927-product-database）：掃描頁、產品頁、編輯表單、位置精靈 ---------- */
/* <a class="btn"> 與 <button class="btn"> 要長得一樣：去底線、置中、可撐滿 */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.product-head { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }
.product-thumb {
  width: 52px; height: 52px; flex-shrink: 0; border-radius: 12px; background: var(--c-accent); color: var(--c-text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.product-thumb svg { width: 26px; height: 26px; }
/* 產品照片（計畫 20260928-product-photo）：縮圖填滿圓角方塊；改資料頁兩格（商品照／周遭照）；周遭照一張寬的 */
.product-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
a.product-thumb { text-decoration: none; overflow: hidden; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.25rem 0 1rem; }
/* 整個方框可點（計畫 20260928-edit-page-mobile-fixes）：.photo-cell 是 <label>，file input 藏在 .sr-only，按鈕只是視覺；
   relative：.sr-only 的 file input 才定位在方框內（required 提示才指對地方） */
.photo-cell {
  display: flex; flex-direction: column; gap: 0.35rem; padding: 0.6rem; min-width: 0;
  border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface);
  position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.photo-cell img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.photo-cell:active { background: var(--c-accent); }
.photo-cell .photo-take { margin-top: auto; pointer-events: none; }
.find-card-context { display: block; width: 100%; border-radius: 12px; margin-top: 0.35rem; }
.photo-error { color: var(--c-negative); font-weight: 700; }
.product-title h1 { margin: 0; font-size: 1.125rem; }
.product-title p { margin: 0.125rem 0 0; }
.mono { font-family: var(--font-mono); }
/* 產品頁版面（計畫 20260928-product-page-rework）：商品照｜標題｜周遭照同一列；彈窗放大；促銷三狀態 */
.product-head .product-title { flex: 1; min-width: 0; }
/* 照片直欄（計畫 20261001-product-page-tags 第 2、3 輪）：兩欄都撐滿整列高度；「確認沒變」在商品照那欄最上面、跟品名同高；
   兩張照片都貼齊整列底部，所以不管上面有沒有確認鈕，商品照與周遭照都在同一條水平線上 */
.product-photo-col { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.product-photo-col > .product-thumb { margin-top: auto; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.82); }
.lightbox img { display: block; max-width: 96vw; max-height: 90vh; border-radius: 12px; }
/* 條碼號碼可點與條碼彈窗（計畫 20260929-product-barcode-memo）：號碼仍像號碼（點線底線提示可點）；彈窗純白底、條碼依畫面寬縮放 */
.product-codes { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.barcode-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; min-height: 32px; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px; }
.barcode-dialog { background: #fff; color: #000; width: min(30rem, 94vw); text-align: center; }
/* 最後更新「誰更新的」（計畫 20261001-updated-by-popup）：員工以上那一行是按鈕，樣子同條碼號碼（點線底線提示可點）；視窗內三列「欄名：值」。
   不撐高（第 2 輪，使用者「兩張照片底部要跟最後更新日切齊」）：照片對齊標題欄底部，按鈕若撐到 32／44px、字在中間，照片就會比字低一截；
   所以只有文字高、也不進手機 44px 觸控規則（整行寬，仍好點） */
.updated-open { font: inherit; color: inherit; background: none; border: 0; padding: 0; min-height: 0; line-height: inherit; text-align: left; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px; }
.updater-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; margin: 0 0 1rem; }
.updater-list dt { color: var(--c-text-secondary); }
.updater-list dd { margin: 0; font-weight: 600; }
.barcode-title, .memo-title { margin: 0; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.barcode-title { margin-bottom: 0.5rem; }
.barcode-dialog svg { display: block; width: 100%; height: auto; }
.barcode-number { font-size: 1.25rem; letter-spacing: 0.1em; margin: 0.25rem 0; }
/* 個人備忘錄：產品頁小按鈕（已加入＝亮起）、彈窗裡的標籤 checkbox 做成可點的 chip、清單列的筆記與標籤 */
/* tag 樣式（計畫 20261001-product-page-tags，使用者要跟「確認沒變」一樣小）：字級、內距同 .pill，保留外框與圖示；不套手機 44px */
.memo-btn { display: inline-flex; align-items: center; gap: 0.2rem; font: inherit; font-size: 0.72rem; font-weight: 700; line-height: inherit;
  padding: 0.1rem 0.55rem; border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-surface);
  color: var(--c-text-secondary); cursor: pointer; }
.memo-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.memo-btn.is-on { background: #fdf3e1; border-color: #b7791f; color: #7a4f0e; }
.memo-btn.is-on svg { fill: currentColor; }
.memo-dialog { width: min(30rem, 94vw); }
.memo-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; border: 0; padding: 0; margin: 0 0 0.75rem; }
.memo-tags legend { padding: 0; margin-bottom: 0.35rem; }
.memo-tags label { position: relative; }
/* 原生 input 藏起來但留著可聚焦、可被 label 點到（標籤 chip 的 checkbox、硬碟上傳框的 file input 共用；計畫 20261028-full-refactor-8 C002） */
.memo-tags input, .drive-drop input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.memo-tags span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 0.75rem; border-radius: 999px;
  border: 1px solid var(--c-border); background: var(--c-surface); cursor: pointer; font-size: 0.875rem; }
.memo-tags input:checked + span { background: var(--c-portfolio); border-color: var(--c-portfolio); color: #fff; }
.memo-tags input:focus-visible + span { outline: 2px solid var(--c-portfolio); outline-offset: 2px; }
.memo-remove { margin-top: 0.75rem; }
.memo-search { margin-bottom: 0.5rem; }
.memo-pills { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.memo-note { white-space: pre-line; overflow-wrap: anywhere; color: var(--c-text-primary); }
.promo { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 0.75rem; }
.promo-active .pill { background: var(--c-success-bg); color: var(--c-success-text); }
.promo-upcoming .pill { background: var(--c-pending-bg); color: var(--c-pending-text); }
.promo-expired { opacity: 0.55; }
.promo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; margin-bottom: 0.5rem; }
/* iOS 的 date 欄有固有最小寬度，1fr 撐不住會重疊（使用者 2026-09-28 截圖）：子格允許縮、欄位吃滿 */
.promo-grid > div { min-width: 0; }
.promo-grid input[type="date"] { width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
.product-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
/* 再扁一點（計畫 20261001-product-page-tags）：兩個 class 的選擇器比手機觸控區塊的 .btn 優先，手機也是 36px */
.product-actions .btn { flex: 1; min-height: 36px; padding-top: 0.25rem; padding-bottom: 0.25rem; }
/* 新增／改資料頁的「取消」「儲存」黏在底部（計畫 20261008-edit-sticky-save-bar，使用者 2026-10-08「選完位置還要往下滑才能按儲存」）：
   同 .mail-dock 用 sticky 不用 fixed（不必自己算底部分頁列與 safe-area）；它在 <form> 裡，捲到表單結尾就停在最後、不蓋欄位。
   上排是「↑」（.top-dock 片段搬進來，才不會疊在「取消」上），那排透明、不吃點擊，點得到底下的欄位 */
.edit-dock { position: sticky; bottom: 0; z-index: var(--z-bar); margin-top: 1rem; pointer-events: none; }
.edit-dock .top-dock { position: static; }
.edit-dock .product-actions { margin-top: 0; padding: 0.5rem 0; background: var(--c-canvas); pointer-events: auto; }
.product-crumb { margin: 0 0 0.5rem; }
/* 改位置頁標題列（計畫 20261001-location-cancel）：條碼・品名在左（長品名可換行），取消在右、不被擠扁 */
.loc-crumb { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.loc-crumb p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.loc-crumb .btn { flex-shrink: 0; }
.field-label { display: block; margin: 0.875rem 0 0.3rem; font-size: 0.8125rem; font-weight: 600; color: var(--c-text-secondary); }
.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--c-accent); }
.pill-new { background: var(--c-pending-bg); color: var(--c-pending-text); }
.pill-ok { background: var(--c-success-bg); color: var(--c-success-text); }
/* 待覆核（計畫 20261006-todo-review）：還沒結束、等人看一眼，用淡黃，跟完成的綠、刪除的紅分開 */
.pill-warn { background: #fff3d6; color: #7a4b00; }
/* 交辦商品列的「待覆核＋覆核」排同一行（Chrome 量到原本 form 自己一行、看起來散） */
.mail-review { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mail-review form { margin: 0; }
/* 小標籤當按鈕（計畫 20260930-promo-clear-button 第 2、3 輪）：刪除促銷、刪除已有效期（紅）、效期再加一個（綠）。
   是按鈕，所以補字型、去邊框。.field-head＝表單標題右邊放小標籤 */
button.pill { border: 0; font-family: inherit; line-height: inherit; cursor: pointer; }
.pill-danger { background: var(--c-negative); color: #fff; }
.pill-add { background: var(--c-positive); color: #fff; }
/* 產品頁「確認沒變」（計畫 20261001-product-page-tags）：外框款，跟實心的新增／刪除分得出來 */
.pill-confirm { background: var(--c-surface); color: var(--c-text-primary); box-shadow: inset 0 0 0 1px var(--c-border); }
/* 備份釘子（計畫 20261007-batch-five C）：沒釘＝外框、淡；釘住＝黃底亮起 */
.pill-pin { background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border); opacity: 0.55; }
.pill-pin.is-on { background: #fff3d6; box-shadow: inset 0 0 0 1px #e0b44a; opacity: 1; }
.field-head .pill { margin-left: 0.5rem; }
/* 「+」開小視窗（計畫 20260930-edit-plus-dialogs）：頁面上的促銷摘要；搬進小視窗的欄位不要多出下邊距 */
.promo-summary { margin: 0 0 0.5rem; }
.modal .promo-grid, .modal .best-before-inputs { margin-bottom: 0; }
.modal-head h2:focus { outline: none; } /* 打開時焦點在標題（第 3 輪），不畫外框 */
.scan-row { display: flex; gap: 0.5rem; }
.scan-row .input { flex: 1; min-width: 0; font-size: 1.25rem; letter-spacing: 0.04em; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; padding: 0.2rem 0.7rem; border-radius: 999px;
  background: #e5f0ff; color: #0b4aa3; font-weight: 600; font-size: 0.875rem;
}
.chip small { font-weight: 400; color: var(--c-detail-blue); }
/* 連到別頁的小連結做成 chip（計畫 20261006-text-links-to-chips）：全站沒有 a 的規則，不去底線就是瀏覽器預設的底線 */
a.chip { text-decoration: none; }
/* 選中的 chip（篩選列、期間、排法、找貨的位置 chip 都一樣）：計畫 20261007-full-refactor-2 把五個容器各寫一份的同一條合成這一條 */
.chip.is-on { background: var(--c-portfolio); color: #fff; }
/* 位置短標籤一列排、放不下換行（產品頁、審核頁；說明文字只在 title） */
.loc-chips { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
/* 位置 tag 右邊的「✕」（計畫 20261101-location-quick-remove）：同 chip 的淡藍，緊貼在 tag 後面；32px 好按 */
.loc-chips li { display: inline-flex; align-items: center; gap: 0.15rem; }
.chip-remove-form { display: inline-flex; margin: 0; }
.chip-remove { min-width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 999px; background: #e5f0ff; color: #0b4aa3;
  font-size: 0.875rem; font-weight: 700; cursor: pointer; }
.loc-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.loc-list li { display: flex; align-items: center; gap: 0.6rem; }
.card-list { gap: 0; padding: 0.25rem 0.75rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; }
.card-list li { justify-content: space-between; min-height: 52px; border-bottom: 1px solid var(--c-border); }
.card-list li:last-child { border-bottom: 0; }
.steps { display: flex; gap: 0.4rem; margin: 0.25rem 0 0.75rem; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--c-border); }
.steps i.on { background: var(--c-portfolio); }
.wiz-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.wiz-actions .btn { flex: 1; }
.wiz-actions .btn-primary { flex: 2; }
.opt { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.5rem 0 0.75rem; }
/* 面按鈕只選 [data-face]：同一欄底下的段按鈕走 .seg 樣式（計畫 20260929-location-wizard-rework：兩面可同選、每面多段） */
.opt [data-face] {
  width: 100%; min-height: 56px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface);
  font: inherit; font-weight: 700; color: var(--c-text-primary); cursor: pointer;
}
.opt [data-face] small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--c-text-secondary); }
.opt [data-face][aria-pressed='true'] { background: var(--c-portfolio); border-color: var(--c-portfolio); color: #fff; }
.opt [data-face][aria-pressed='true'] small { color: #dbe9ff; }
.face-col { display: grid; gap: 0.4rem; align-content: start; min-width: 0; }
.face-col .seg { margin-bottom: 0; }
/* 第 3 步：走道面那列整塊可點（回第 2 步改面／段），右側 ✕ 仍是刪除 */
.loc-edit { flex: 1; min-width: 0; padding: 0.4rem 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.loc-edit::after { content: '›'; float: right; color: var(--c-text-secondary); font-size: 1.1rem; }
.btn-dashed { border-style: dashed; margin-top: 0.6rem; }
/* 有底色的小標用主要文字色：外層 .muted 的灰字疊在淡紫、淡橘底上對比不到 4.5（計畫 20261114-full-refactor-9 B8，axe 抓到） */
.legend span { display: inline-block; margin-right: 0.25rem; padding: 0 0.4rem; border-radius: 4px; color: var(--c-text-primary); }
.legend-freezer { background: var(--map-freezer); }
.legend-freezer-end { background: var(--map-freezer-end); }
.legend-chilled { background: var(--map-chilled); }
.legend-promo { background: var(--map-promo); }
.legend-produce { background: var(--map-produce); }
.legend-rice { background: var(--map-rice); }

/* 找貨頁（templates/find.html）：四顆模式鈕（掃條碼／打名稱／看貨架／找類似，計畫 20260928-product-delete 之 B、20260929-find-similar）永遠都在，
   按下的那顆 aria-pressed=true；四個 section[data-panel] 只顯示對應的一個 */
.find-entry { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 0.6rem; }
.find-entry-btn[aria-pressed="true"] { background: var(--c-portfolio); border-color: var(--c-portfolio); color: #fff; }
.find-entry-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.find-entry-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; min-height: 64px;
  border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface); font: inherit; font-weight: 700;
  color: var(--c-text-primary); cursor: pointer;
}
/* 相機：一條 3:1 的橫框（條碼形狀，使用者要求），影片 cover 裁滿；框內先放「開相機」鈕（iOS 要手勢），
   開了才顯示影片＋右上角「關閉相機」（44px，拇指按得到）；虛線是視覺引導，ZXing 仍拿整格解碼 */
.scan-stage { position: relative; aspect-ratio: 3 / 1; overflow: hidden; margin: 0 0 0.5rem; border-radius: 12px; background: #111; }
.scan-stage::after {
  content: ""; position: absolute; inset: 14% 8%; border: 2px dashed rgba(255, 255, 255, 0.6); border-radius: 8px; pointer-events: none;
}
.scan-video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* 效期巡檢同頁（計畫 20261008-expiry-scan-one-page）：下面在填日期時相機暫停（不關、不解碼結果），變暗讓人知道現在不會掃 */
.scan-stage.is-paused .scan-video { opacity: 0.35; }
.scan-open {
  position: absolute; inset: 0; margin: auto; width: 60%; max-width: 240px; height: 48px; border: 0; border-radius: 999px;
  background: var(--c-portfolio); color: #fff; font: inherit; font-weight: 700; cursor: pointer; z-index: 1;
}
.scan-close {
  position: absolute; top: 0.5rem; right: 0.5rem; min-height: 44px; padding: 0 1rem; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: var(--c-text-primary); font: inherit; font-weight: 700; cursor: pointer;
}
.find-count { margin: 0.6rem 0 0.3rem; }
/* 看貨架：商品列（縮圖、名稱、在所選貨架的位置標籤） */
.shelf-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.shelf-list a {
  display: flex; gap: 0.75rem; align-items: center; padding: 0.6rem 0.75rem; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: 12px; color: var(--c-text-primary); text-decoration: none;
}
.shelf-list .product-thumb { width: 44px; height: 44px; }
.shelf-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.shelf-spots { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
/* 找類似的位置 chip（計畫 20260929-find-similar 第 3 輪）：在名稱下面佔整列、靠左換行；手機上 .shelf-name 是 row wrap，所以要 flex-basis 100% */
.similar-spots { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; flex-basis: 100%; }
.list-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; white-space: nowrap; }
.find-chips { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 0.4rem; scrollbar-width: none; }
.find-chips::-webkit-scrollbar { display: none; }
.find-chips .chip { flex-shrink: 0; }
.chip-sm { min-height: 24px; padding: 0 0.5rem; font-size: 0.78rem; }
.find-card {
  display: flex; gap: 0.75rem; align-items: flex-start; margin-top: 0.6rem; padding: 0.75rem 0.875rem;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; color: var(--c-text-primary); text-decoration: none;
}
.find-card-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.find-card-locs { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.2rem; }
.find-card-open { color: var(--c-portfolio); font-weight: 600; font-size: 0.875rem; margin-top: 0.2rem; }
.find-none { margin-top: 1rem; }

/* 店面圖（fragments/storemap.html）：顏色照溫度（backlog「產品資料庫」規則）；.is-on＝選到；亮條 .sm-bar 只亮所選段 */
.storemap { display: block; width: 100%; height: auto; font-family: var(--font-sans); }
.storemap-wrap { margin: 0.5rem 0; }
/* 改資料頁的位置區（計畫 20260930-location-on-edit-page）：小地圖是按鈕（點了開小視窗改位置）。
   小視窗放得下整張地圖＋三步（手機上照 .modal 的底部抽屜，最高 90% 視窗、內部捲動） */
.location-preview { display: block; width: 100%; padding: 0.25rem; border: 1px solid var(--c-border); border-radius: 8px;
  background: var(--c-surface); cursor: pointer; }
.loc-dialog { width: min(40rem, calc(100vw - 2rem)); }
.loc-use-last { margin: 0 0 0.5rem; }
.sm-floor { fill: #f6f7fb; stroke: #323338; stroke-width: 3; }
.sm-window { stroke: #22d3ee; stroke-width: 6; }
.sm-entry { stroke: #323338; stroke-width: 10; }
.sm-zone text { font-size: 22px; font-weight: 700; text-anchor: middle; fill: #323338; pointer-events: none; }
.sm-zone :is(rect, polygon) { stroke: #676879; }
.sm-chilled :is(rect, polygon), :is(rect, polygon).sm-chilled { fill: var(--map-chilled); stroke: #007f4e; }
.sm-chilled text { fill: #004d30; }
/* 純顯示格子（DECOR，例如左側冷藏櫃「9B Dairy」）的字也從中心往兩邊排：原本只有 .sm-zone text 有 middle，這類從中心往一邊長、整串偏掉（計畫 20261007-map-label-center） */
/* 不寫 .storemap > g：地圖編輯器把形狀包在一層圖層 g 裡 */
.storemap g:not(.sm-zone):not(.sm-aisle) > text { text-anchor: middle; }
.sm-freezer :is(rect, polygon), :is(rect, polygon).sm-freezer, .sm-gondola.sm-freezer { fill: var(--map-freezer); stroke: #1f8a7a; } /* 冷凍＝淡青綠：淺藍會跟「已選」的藍混淆（使用者 2026-09-28） */
.sm-freezer text { fill: #0f5c51; }
.sm-promo :is(rect, polygon), :is(rect, polygon).sm-promo { fill: var(--map-promo); stroke: #c9364e; }
.sm-promo text { fill: #7a1f2e; }
.sm-produce :is(rect, polygon), :is(rect, polygon).sm-produce { fill: var(--map-produce); stroke: #c9a800; }
.sm-produce text { fill: #6b5d00; }
.sm-rice :is(rect, polygon), :is(rect, polygon).sm-rice { fill: var(--map-rice); stroke: #e07b00; }
.sm-rice text { fill: #8a4b00; }
.sm-endcap :is(rect, polygon), :is(rect, polygon).sm-endcap { fill: #fff1d6; stroke: #e07b00; }
.sm-endcap-freezer :is(rect, polygon), :is(rect, polygon).sm-endcap-freezer { fill: var(--map-freezer-end); stroke: #7c5cbf; }
.sm-gondola { fill: #fff; stroke: #676879; stroke-width: 2; }
.sm-walk { fill: #fbfbfd; }
.sm-badge { fill: #e07b00; }
.sm-badge-text { fill: #fff; font-size: 18px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.sm-bar { fill: var(--c-portfolio); }
.sm-zone.is-on :is(rect, polygon) { fill: var(--c-portfolio); stroke: #0b4aa3; }
.sm-zone.is-on text { fill: #fff; }
.sm-aisle.is-on .sm-walk { fill: #dbe9ff; stroke: var(--c-portfolio); stroke-width: 3; }
/* 店內地圖編輯器（/dev/map，計畫 20260930-store-map-editor；map-editor.js 自己畫）：地圖上拖拉要關掉觸控捲動（只這張圖，頁面其他地方照常捲）。
   :is(rect, polygon) 那些顏色規則讓「自訂形狀」（polygon）跟方形同色。地板只有邊能點（整片可點會一點空地就拖到地板）；
   線條另畫一條透明粗線當點擊範圍；選取框、四角把手、旋轉把手、錨點、對齊線畫在最上層。 */
.map-editor .storemap { touch-action: none; user-select: none; -webkit-user-select: none; }
.map-editor .map-edit-shape { cursor: move; }
.map-editor .sm-floor { pointer-events: none; }
.map-edit-hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; }
.sm-edit-outline { fill: none; stroke: var(--c-portfolio); stroke-width: 3; stroke-dasharray: 8 5; pointer-events: none; }
.sm-edit-handle { fill: #fff; stroke: var(--c-portfolio); stroke-width: 3; cursor: nwse-resize; }
.sm-edit-handle[data-handle="ne"], .sm-edit-handle[data-handle="sw"] { cursor: nesw-resize; }
.sm-edit-stem { stroke: var(--c-portfolio); stroke-width: 2; pointer-events: none; }
.sm-edit-rotate { fill: #fff; stroke: var(--c-portfolio); stroke-width: 3; cursor: grab; }
.sm-edit-anchor { fill: var(--c-portfolio); stroke: #fff; stroke-width: 2; cursor: crosshair; }
.sm-edit-guide { stroke: #e2445c; stroke-width: 1.5; stroke-dasharray: 6 4; pointer-events: none; }
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }
.map-selection { padding: 0.5rem; border: 1px solid var(--c-border); border-radius: 8px; }
.map-field { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; }
.map-field input[type="number"] { width: 5.5rem; }
.map-field input[type="text"] { width: 9rem; }
.map-names { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.map-editor-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.sm-aisle.is-on .sm-badge { fill: #0b4aa3; }
.is-interactive .sm-zone, .is-interactive .sm-aisle { cursor: pointer; }

/* ---------- 手機優先 1／2：觸控尺寸 ----------
   手機（≤ 767px）或任何粗指標裝置（平板、觸控筆電）一起套：可點元素最小 44px（Apple HIG／WCAG 2.5.8 目標尺寸），
   輸入框 16px（iOS 聚焦時字級 < 16px 會自動放大整頁，很惱人）。桌機＋滑鼠完全不受影響。 */
@media (max-width: 767px), (pointer: coarse) {
  .nav-link, .lang-switch summary, .lang-menu a, .pager button, .seg button, .input, .opt button, .chip, .find-entry-btn,
  .barcode-btn, .memo-tags span {
    min-height: 44px;
  }
  /* 按鈕 36px（計畫 20261006-filter-fold-tight，使用者「新交辦按鈕上下藍色太多…所有頁面按鈕也要一併處理」，選 36）：比 Apple 建議的 44 小、
     仍高於 WCAG 2.5.8 的 24；跟輸入框同一排時被 flex 拉到同高。其他可點元素維持 44 */
  .btn, .btn-sm { min-height: 36px; padding-top: 0.25rem; padding-bottom: 0.25rem; }
  /* 排在輸入框（44px）後面的按鈕也 44，同一排才不會一高一低（篩選列多半是 align-items: center，不會自己拉高）；
     用 min-height 不用 align-self: stretch——直排的容器裡 stretch 會把按鈕撐成整排寬（第 2 輪，review） */
  .input ~ .btn, .input ~ .btn-sm { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .lang-menu a { display: flex; align-items: center; }
  .input { font-size: 1rem; }
  .google-btn { min-height: 48px; }
}

/* ---------- 手機優先 2／2：≤ 767px 排版 ----------
   側欄變成頂欄下方可橫向捲動的導覽列，收合鈕隱藏；會員表格改卡片；對話框改底部抽屜；登入頁縮留白。
   桌機規則一律不改，只在這裡覆寫；env(safe-area-inset-*) 讓瀏海／底部手勢列不吃到內容（需 viewport-fit=cover）。 */
@media (max-width: 767px) {
  .topbar {
    padding: calc(0.5rem + env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) 0.25rem max(0.5rem, env(safe-area-inset-left));
  }
  .dash-body { flex-direction: column; overflow: hidden; }
  /* 底部分頁列（計畫 20261005-home-redesign，使用者看過草圖選定）：側欄在手機變成固定在最下面的 5 格（圖示＋字），
     取代原本上排一排沒有字的小圖示。order 讓它排在內容區之後；底部留 iPhone 手勢區（safe-area），按鈕不會被手勢條擋到。
     關掉桌機收合用的 width／padding 動畫（計畫 20260929-product-barcode-memo 第 8 輪：主畫面 App 載入時可能先以桌機尺寸算一次）。 */
  .sidebar, .sidebar[data-collapsed='true'] {
    order: 2; width: auto; border-right: 0; border-top: 1px solid var(--c-border);
    padding: 0.125rem max(0.25rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(0.25rem, env(safe-area-inset-left));
    transition: none;
  }
  .sidebar-nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; position: static; }
  .nav-link { position: relative; flex-direction: column; justify-content: center; gap: 0.125rem; padding: 0.375rem 0.125rem; }
  .nav-icon { width: 22px; height: 22px; }
  .nav-label, .sidebar[data-collapsed='true'] .nav-label { font-size: 0.6875rem; line-height: 1.2; opacity: 1; white-space: nowrap; }
  .sidebar-toggle { display: none; }
  .dash-main {
    /* 底部的 safe-area 由底部分頁列留（計畫 20261005-home-redesign），內容區只留一般間距。
       上下 padding 歸零、改給第一個／最後一個子元素（第 28 輪）：iOS Safari 算 sticky 的 top: 0／bottom: 0 用的是內容盒（padding 裡面），
       有 padding 時篩選列停在頂端下方 12pt、輸入列浮在底部上方 16pt（使用者三張截圖量到）；左右 padding 不影響 sticky，照舊 */
    padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  .dash-main > :first-child { margin-top: 0.75rem; }
  /* 頁面一開頭就是釘頂列時不再墊 12px：不然一進來它低 12px、一捲就貼到 0，看起來沒貼頂又跳一下。
     可收合篩選列（備忘錄、久沒確認、待辦；計畫 20261006-filter-fold-tight）；計畫 20261008-dev-tabs-top 補上漏掉的三種：
     「‹ 管理」列（管理子頁）、開發頁籤列（開發、硬碟、匯入）、不可收合的篩選列（資料庫清單）——.filter-fold 本身也是 .sticky-filter，一條涵蓋。
     這些列都自帶上下內距或 44px 高、字置中，不會貼到螢幕邊 */
  .dash-main > .back-bar:first-child,
  .dash-main > .page:first-child:has(> .dev-tabs:first-child),
  .dash-main > .page:first-child:has(> .sticky-filter:first-child),
  .dash-main > .page:first-child:has(> .fold-head:first-child + .filter-fold),
  .dash-main > .page:first-child:has(> .mail-top:first-child) { margin-top: 0; }
  .dash-main > :last-child { margin-bottom: 1rem; }

  /* 群組看板的列（第 16 版）：手機單行——姓名（過長省略；email 自計畫 20261003-last-login 第 2 輪收進會員資料視窗）、右邊標籤與編輯鈕；
     角色 pill 藏起來（群組色條與標題已經說了角色）。 */
  .grp-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0 0.5rem; min-height: 0; padding: 0.2rem 0.75rem; }
  .grp-row .role-pill { display: none; }
  .member-filter-toggle { margin-left: 0; }

  .table-footer { justify-content: center; }
  .pager { flex-wrap: wrap; justify-content: center; }

  /* 對話框 → 底部抽屜：全寬、上圓角、最高 90% 視窗；按鈕直向堆疊，主要動作在最下面靠拇指。 */
  .modal {
    width: 100%; max-width: none; max-height: 90dvh; overflow: auto;
    margin: auto 0 0; border-radius: 12px 12px 0 0; border-bottom: 0;
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }

  /* 登入頁：CTA 固定在底部（拇指位置），內容區留出等高的底部空間免得被蓋住。 */
  .login-header { padding: calc(0.875rem + env(safe-area-inset-top)) 1.25rem 0.875rem; }
  .login-page { padding-bottom: 8.5rem; }
  .login-cta {
    position: fixed; left: 0; right: 0; bottom: 0; max-width: none;
    background: var(--c-surface); border-top: 1px solid var(--c-border);
    padding: 1rem max(1.25rem, env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  }

  /* 手機一個畫面（計畫 20260929-mobile-one-screen，使用者 2026-09-29） ----------
     目標：iPhone 390×844 的主畫面 App（扣狀態列 47＋手勢列 34 ≈ 可用 763px）上，首頁、登入、找貨、產品頁、位置精靈、改資料盡量不用上下滑。
     只縮尺寸／間距、藏次要文字，功能不變；觸控目標仍 ≥ 44px；輸入框字級不低於 16px（iOS 才不會自動放大）。量測方法見 docs/skills/product.md「手機一個畫面」。 */

  /* 殼固定（第 2 輪，使用者要求功能列不能跟著上下滑）：整個殼＝一個螢幕高，頂欄與功能列不捲，只有內容區捲動（像 App）。
     iOS 點狀態列捲回頂端對內部捲動區無效（取捨）；首頁排序的「完成」是 position: fixed，不受影響。
     殼用 fixed＋inset 0 釘滿 viewport（計畫 20261005-home-redesign 第 3 輪）。 */
  .dash { position: fixed; inset: 0; height: auto; min-height: 0; overflow: hidden; }
  /* iPhone 主畫面 App 底部分頁列下面會空一塊（第 3～6 輪，使用者截圖）：第 5 輪把殼加高 safe-area-inset-top 結果底部列被推出畫面、
     空隙仍在；第 6 輪除錯框量到 viewport 812／螢幕 874、差 62＝狀態列高度——black-translucent 時 iOS 給的 viewport 少了狀態列那段，
     那塊是 WebKit 在 viewport 外畫的「畫布」底色，CSS 的盒子畫不到。正解是 dashboard.html 的狀態列改回 default；
     這裡是保底（使用者選「兩個都做」）：第 6 輪把 html 底色改白沒效（第 7 輪截圖空隙仍灰），改成 body 白、內容區（.dash-main）灰——
     萬一還有空隙，看起來像底部列延伸到底。頂欄與底部列本來就是白的。 */
  @media (display-mode: standalone) {
    body.dash { background: var(--c-surface); }
    .dash-main { background: var(--c-canvas); }
  }
  .sidebar { flex-shrink: 0; }

  /* 首頁：三欄小卡（圖示＋標題，像手機主畫面） */
  .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
  .home-card { min-height: 0; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.75rem 0.25rem; text-align: center; }
  .home-title { justify-content: center; font-size: 0.8125rem; }

  /* 登入：插圖與間距縮小 */
  .login-illustration { width: 104px; height: 104px; margin-top: 0.25rem; }
  .login-illustration svg { width: 56px; height: 56px; }
  .login-headline { margin-top: 0.75rem; font-size: 1.5rem; }
  .login-lead { margin-bottom: 1rem; }
  .login-features { gap: 0.5rem; }
  .login-features li { padding: 0.625rem 0.75rem; }

  /* 找貨：模式鈕改一行（圖示在字旁邊）、地圖限高、卡片的位置改橫排 */
  /* 四顆模式鈕（計畫 20260929-find-similar）：手機一列放四個，圖示在上、字小一點 */
  .find-entry-btn { flex-direction: column; gap: 0.1rem; min-height: 48px; font-size: 0.78rem; padding-left: 0.2rem; padding-right: 0.2rem; }
  .find-entry { gap: 0.35rem; margin-bottom: 0.4rem; }
  .storemap { max-height: 28vh; }
  .storemap-wrap { margin: 0.25rem 0; }
  .find-count { margin: 0.25rem 0; }
  .find-card { position: relative; margin-top: 0.4rem; padding: 0.6rem 1.75rem 0.6rem 0.75rem; }
  .find-card-locs { flex-direction: row; flex-wrap: wrap; gap: 0.3rem; }
  /* 周遭照只露中間一段（點卡片進產品頁看完整照片）；整張卡本來就是連結，「看產品頁」字改成右上角的 › */
  .find-card-context { max-height: 88px; object-fit: cover; }
  /* 卡片裡的位置標籤只是文字（整張卡才是連結），不需要 44px 觸控高度 */
  .find-card .chip { min-height: 0; }
  .find-card-open { display: none; }
  .find-card::after { content: '›'; position: absolute; top: 0.5rem; right: 0.75rem; font-size: 1.25rem; color: var(--c-portfolio); }

  /* 位置精靈：標題字縮小、地圖限高 */
  #loc-wizard h1 { margin: 0.25rem 0; font-size: 1.25rem; }
  #loc-wizard .storemap { max-height: 30vh; }

  /* 改資料：欄位間距縮小、照片改 4:3 */
  #product-edit .field-label { margin: 0.5rem 0 0.2rem; }
  #product-edit .photo-grid { margin-bottom: 0.5rem; }
  #product-edit .photo-cell { padding: 0.45rem; gap: 0.25rem; }
  #product-edit .photo-cell img { aspect-ratio: 16 / 9; }

  /* 清單頁（計畫 20260929-mobile-one-screen-lists；使用者選「清單本身可以滑」）：不藏資訊，只縮間距與列高，一打開看得到較多列。
     資料庫清單、待審核：名稱一行（order -1，待審核的「新增／修改」標籤因此排到第二行），條碼與標籤併在第二行；
     縮圖 36px（整列才是點擊目標）。 */
  .shelf-list { margin-top: 0.25rem; gap: 0.35rem; }
  .shelf-list a { gap: 0.6rem; padding: 0.4rem 0.6rem; }
  /* 多帶 li 提高權重：後面交辦段的 .shelf-list .mail-card 同權重又排在後面，會把這條蓋回 0.6rem，卡片比一般列高 6px（第 8 輪 Chrome 量到） */
  .shelf-list li.mail-card { padding: 0.4rem 0.6rem; }
  .shelf-list .product-thumb { width: 36px; height: 36px; border-radius: 10px; }
  .shelf-list .product-thumb svg { width: 20px; height: 20px; }
  .shelf-list .shelf-name { flex-flow: row wrap; column-gap: 0.5rem; align-items: baseline; }
  .shelf-list .shelf-name > b { flex-basis: 100%; order: -1; }
  .shelf-list .list-meta { gap: 0; }
  /* 會員管理：分段、篩選、筆數、群組之間的空白縮小；列的上下 padding 縮小（編輯鈕仍 44px） */
  .seg { margin-bottom: 0.4rem; }
  .count-line { margin: 0.4rem 0 0; }
  .grp { margin-bottom: 0.5rem; }
  .grp-head { padding: 0; }
}

/* ---------- 成功／通知訊息 3 秒後淡出（計畫 20260929-notice-autohide；autohide.js 加 is-hiding 後再 hidden） ----------
   新建商品的條碼查名結果（計畫 20260929-barcode-name-lookup 第 3 輪）同樣淡出，但不標 data-autohide：那支 JS 在開頁時就計時，
   這則訊息是查完才出現（products-suggest.js 自己計時）。 */
[data-autohide], [data-suggest-result] { transition: opacity 0.4s ease; }
[data-autohide].is-hiding, [data-suggest-result].is-hiding { opacity: 0; }
/* 查名結果：查不到／失敗用中性色（不是錯誤，照舊手打就好） */
[data-suggest-result] { margin: 0.4rem 0 0; }
[data-suggest-result].is-muted { background: var(--c-accent); color: var(--c-text-primary); font-weight: 500; }

/* ---------- 促銷提醒頁（計畫 20260929-promo-reminders）：兩段標題；快到期的天數用橘色提醒 ---------- */
.promo-heading { margin: 1rem 0 0.25rem; font-size: 1rem; }
.promo-heading:first-child { margin-top: 0; }
.promo-days { color: #b45309; font-weight: 600; }
/* 每列＝整列連結＋右邊「已撤牌」鈕（連結不能包表單） */
.promo-row { display: flex; align-items: center; gap: 0.5rem; }
.promo-row > a { flex: 1; min-width: 0; }
.promo-row form { margin: 0; flex-shrink: 0; }
/* 最佳賞味期（計畫 20260930-best-before）：產品頁區塊（快過期橘、已過期紅）；提醒頁沿用 .shelf-list／.promo-row */
.best-before { margin-top: 0.75rem; }
.best-before-title { font-weight: 700; margin: 0 0 0.25rem; }
.best-before-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.25rem; }
.best-before-list li { display: flex; align-items: center; gap: 0.5rem; }
.best-before-list li form { margin: 0 0 0 auto; }
.best-before-list li.is-soon .best-before-days { color: #c26e00; font-weight: 600; }
.best-before-list li.is-expired .best-before-days, .promo-row.is-expired .best-before-days { color: var(--c-negative); font-weight: 700; }
/* 效期巡檢（計畫 20261002-expiry-scan）：商品狀態的頭（小圖＋名稱）與日期列；掃描區重用找貨頁的 .scan-stage／.scan-row */
.expiry-scan-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.expiry-scan-head .shelf-name { color: var(--c-text-primary); text-decoration: none; }
.expiry-scan-add { margin: 0.5rem 0 0.75rem; }
.expiry-scan-add .scan-row .input { font-size: 1rem; letter-spacing: 0; }
.expiry-scan-top { display: flex; justify-content: flex-end; margin-bottom: 0.25rem; }
.best-before-add { display: flex; gap: 0.5rem; align-items: center; }
/* 產品頁位置紀錄（計畫 20260930-location-history）：一筆兩行——時間與誰、原本 → 改成 */
.location-history { margin-top: 0.75rem; }
.location-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.location-history-list li { display: grid; gap: 0.125rem; }
/* 改資料頁的效期格（計畫 20260930-best-before-on-edit）：多格時一格一行、間距同表單 */
.best-before-inputs { display: grid; gap: 0.375rem; margin-bottom: 0.375rem; }
/* 改資料頁已有的效期：一個一行、日期右邊紅色「刪除」；按了整列藏起來 */
.best-before-edit-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.375rem; }
.best-before-edit-list li { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- 待審核列表／我的送審的列（計畫 20260929-own-pending-visible）：縮圖（點了放大）＋列連結＋（我的送審）取消鈕並排；
   列本身當卡片，裡面的連結不再各自有框（連結不能巢狀，所以拆開） ---------- */
.shelf-list .review-row > a.product-thumb { display: block; padding: 0; border: 0; background: none; flex-shrink: 0; }
.shelf-list .review-row > form { margin: 0; flex-shrink: 0; }

/* 勾多筆一次同意／退回（計畫 20261002-review-batch）：勾選框排在縮圖前、不被擠扁；操作列在清單下方，捲動時黏在畫面底部 */
.shelf-list .review-row > input[type="checkbox"] { flex-shrink: 0; width: 20px; height: 20px; margin: 0; }
.review-batch-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; padding: 0.5rem 0.65rem;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px;
  position: sticky; bottom: 0.5rem;
}
.review-batch-bar label { display: flex; align-items: center; gap: 0.35rem; }
.review-batch-bar [data-batch-count] { flex: 1; }

/* 計畫 20260930-context-photo-same-as-last（使用者 2026-09-30 截圖「這三個按鈕小一點，不要佔這麼多高度」「區域tag一樣也要小一點」）：
   只覆寫產品頁這兩處——選擇器比手機通用的 .btn／.chip（44px 觸控高度）具體，不影響其他頁（.product-actions 改資料／刪除／審核頁也有、.loc-chips 審核頁也有，所以都加 #product-page）。按鈕高度見下面那段（32px 例外，計畫 20261008-product-actions-spacing）；位置標籤不是按鈕。 */
#product-page .product-actions .btn { min-height: 32px; padding-top: 0.2rem; padding-bottom: 0.2rem; font-size: 0.875rem; }
/* 按鈕列跟地圖拉開、按鈕 32px（計畫 20261008-product-actions-spacing，使用者 2026-10-08 截圖「貼太近」「扁一點」並選 32）：
   32 是全站「按鈕 ≥ 36px」的例外（project-bpa 驗收條件）。地圖是 th:replace 進來的 <svg>（.storemap-wrap 的 margin 被換掉），
   原本用 .product-actions + .storemap 補間距，但開發者頁面中間夾著隱藏的 demo 表單（有暫存列時還有「可補」表單），緊鄰選擇器對不到、
   地圖直接貼上來——改成按鈕列自己帶下邊距，跟中間夾什麼無關 */
#product-page .product-actions { margin-bottom: 0.75rem; }
#product-page .loc-chips .chip { min-height: 26px; padding: 0.1rem 0.55rem; font-size: 0.8rem; }
.location-history .history-open { margin-top: 0.25rem; }
/* 周遭照跟上一個一樣：格子裡的小鈕（小圖＋字）；.photo-cell img 的滿版方圖規則要蓋掉 */
.use-last-photo { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
.photo-cell .use-last-photo img, #product-edit .photo-cell .use-last-photo img {
  width: 28px; height: 28px; aspect-ratio: 1; object-fit: cover; border-radius: 4px; flex-shrink: 0;
}
.use-last-photo[aria-pressed="true"] { border-color: var(--c-portfolio); color: var(--c-portfolio); }

/* 照片旋轉鈕（計畫 20261002-photo-rotate）：格子裡的小鈕，拍好才出現 */
.photo-rotate { align-self: center; }

/* 品名後面的 AI 驗證標記（計畫 20260930-ai-verified-name）：藍勾＝名稱 AI 驗證過（不可逆）、黃問號＝還沒；小圓形，跟著品名最後一個字 */
.ai-mark { display: inline-flex; align-items: center; justify-content: center; width: 1.1em; height: 1.1em; margin-left: 0.3em;
  border-radius: 999px; font-size: 0.75em; font-weight: 700; line-height: 1; vertical-align: 0.15em; }
.ai-mark.is-verified { background: var(--c-portfolio); color: #fff; }
.ai-mark.is-unverified { background: #f5b400; color: #3b2a00; }

/* 周遭照上的圈（計畫 20260930-context-photo-mark）：百分比定位在照片上（left／top＝圓心、width＝直徑佔照片寬），紅框加白邊在任何背景都看得到。
   放大彈窗與改資料頁的拖圈區共用；拖圈區 touch-action: none，拖的時候整頁不會跟著捲。 */
.mark-ring { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #e02424; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); pointer-events: none; }
/* 未確認＝虛線（計畫 20261007-import-auto-mark，使用者選「全部一致」：AI 估的、小幫手建議的都一樣）；確認後回到實線。
   白色光暈改成跟著每一段虛線走（drop-shadow）：box-shadow 是一整圈實心白，在紅色包裝上紅虛線看不到、只剩白實線（Chrome 實測） */
.mark-ring.is-unconfirmed { border-style: dashed; box-shadow: none; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.mark-stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; border-radius: 8px; overflow: hidden; }
.mark-stage img { display: block; width: 100%; height: auto; -webkit-user-drag: none; }
.mark-actions { display: flex; gap: 0.5rem; margin: 0.5rem 0 0; }
/* 圈的人工確認狀態（計畫 20260930-mark-confirmed）：未確認＝橘色提示；已確認＝綠色 */
.mark-status { margin: 0 0 0.375rem; color: #a15c00; font-weight: 600; }
.mark-status.is-confirmed { color: var(--c-positive); }
/* 備忘錄分組（計畫 20260930-memo-tag-groups）：每組一個小標題 */
.memo-group { margin-top: 1rem; }
.memo-group-title { margin: 0 0 0.25rem; font-size: 0.9375rem; font-weight: 700; }
/* 組標題一排：左邊分類名（筆數），右邊「全部移出」（計畫 20261016-memo-group-remove） */
.memo-group-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.25rem; }
.memo-group-head .memo-group-title { margin: 0; min-width: 0; }
.memo-group-head form { margin: 0; flex-shrink: 0; }
/* 工作筆記（計畫 20261001-work-notes）：備忘錄頁選「全部」或「工作筆記」時出現（計畫 20261006-memos-notes-in-all）；左邊打勾框、中間內容（保留換行）、右邊修改／刪除 tag；完成的變灰、刪除線 */
.work-notes { margin-bottom: 1.25rem; }
/* 備忘錄篩選列（第 25 輪）：[下拉][搜尋][篩選][清除] 一列（全部清除紅鈕在計畫 20261006-memos-notes-in-all 拿掉） */
.memo-filter { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-bottom: 0.6rem; }
.memo-filter .memo-search { flex: 1 1 100%; margin-bottom: 0; }
.memo-tag-select { flex: 0 1 9rem; min-width: 7rem; }
.work-note-form { margin: 0.25rem 0 0.75rem; }
.work-note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.work-note { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem 0.75rem; border: 1px solid var(--c-border);
  border-radius: 12px; background: var(--c-surface); }
.work-note-box { width: 26px; height: 26px; flex-shrink: 0; border: 2px solid var(--c-border); border-radius: 7px; background: var(--c-surface);
  color: #fff; font: inherit; font-weight: 700; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.work-note.is-done .work-note-box { background: var(--c-positive); border-color: var(--c-positive); }
.work-note-main { flex: 1; min-width: 0; }
.work-note-body { margin: 0; }
/* 標題（計畫 20261007-notes-title-personal-order）：列表只顯示一行標題、點了開小視窗；長的截成「…」。按鈕外觀拿掉、靠左 */
.work-note-title { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600;
  text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-note-title-input { margin-bottom: 0.5rem; }
.work-note.is-done .work-note-body { color: var(--c-text-secondary); text-decoration: line-through; }
.work-note-actions { display: flex; gap: 0.35rem; align-items: center; flex-shrink: 0; }
/* 操作紀錄（計畫 20260930-audit-log）：一筆三行——時間與誰、做了什麼與對象、變更清單 */
.audit-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.audit-list > li { display: grid; gap: 0.125rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--c-border); }
.audit-changes { margin: 0; padding-left: 1.1rem; }
/* 垃圾桶（計畫 20261003-product-trash）：沿用 .audit-list 的列；「救回」「永久刪除」同一排靠左、不撐滿（計畫 20261016-trash-permanent-delete） */
.trash-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-self: start; margin-top: 0.25rem; }
.audit-pager { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1rem; }

/* 交辦（原信箱，計畫 20261001-mailbox；畫面改成交辦清單：計畫 20261005-home-redesign 第 10 輪，使用者看草圖選定）：
   列表沿用 .shelf-list，每列標題、誰 → 誰、進度條；未讀＝藍點＋粗體；做完的灰掉。
   一件交辦頁：商品列（大勾選鈕）在上、一條留言串在下（一則一塊、自己的靠右淡藍、針對商品的帶小標籤）。內文保留換行、長字串可斷行。 */
.mail-h1 { margin: 0; font-size: 1.25rem; }
.mail-h2 { margin: 0.75rem 0 0.4rem; font-size: 0.95rem; color: var(--c-text-secondary); display: flex; gap: 0.5rem; align-items: baseline; }
.mail-list { margin-top: 0.5rem; }
/* 列＝兩行（第 13 輪，使用者「三行太佔空間」）：.shelf-list a 預設置中（align-items: center），這裡改成撐滿——
   選擇器要帶 .shelf-list 才贏得過它（第 14 輪，單寫 .mail-row 優先權不夠、畫面照樣置中） */
.shelf-list .mail-row { display: flex; flex-direction: column; align-items: stretch; gap: 0.1rem; }
/* 交辦列的每一行與留言泡泡那一行共用（計畫 20261007-full-refactor-2：原本兩段各寫一條 .mail-line、後者蓋前者，這裡就是實際生效的值） */
.mail-line { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.35rem; min-width: 0; }
.mail-title { display: flex; align-items: center; gap: 0.4rem; min-width: 0; overflow-wrap: anywhere; }
.mail-who { flex: 1; min-width: 0; margin: 0; }
/* 交辦列表擠掉空白（計畫 20261008-mail-history-purge 第 5 輪，使用者「1/1和進度條中間空白太多導致每列都太高」選「維持三行」）：
   列的 gap（上面 .mail-row 的 0.1rem）、第二行改垂直置中（進度條不再貼在最底下）、行距與「誰 · 時間」行高縮小；留言泡泡的 .mail-line 不動。
   Chrome 390 寬實測：1/1 到進度條 22 → 11px；歷史卡 99 → 91px、進行中卡 64 → 59px */
.mail-list .mail-line { align-items: center; }
.mail-list .mail-who { line-height: 1.3; }
/* 進度條靠右（第一行時緊貼 1/1 左邊、第二行時在 1/1 正下方；margin-left: auto 推過去）——第 6～8 輪 */
.mail-list .mail-line .mail-bar { flex: 0 0 30%; max-width: 7rem; margin-left: auto; }
.mail-dot { width: 0.6rem; height: 0.6rem; flex-shrink: 0; border-radius: 999px; background: var(--c-portfolio); }
.mail-row.is-unread b { font-weight: 800; }
.mail-row.is-finished { opacity: 0.6; }
/* 歷史三種列（計畫 20261008-mail-history-purge：第 2 輪「樣式不一致，很醜」、第 4 輪「按鈕要放進商品列內」、第 6 輪「改兩行」、
   第 8 輪「我發出的那頁就不用顯示按鈕，只留跟進行中一樣的樣式，維持反白」）：整個 li 當卡片 .mail-card（外框照抄 .shelf-list a），
   裡面的列拿掉自己的外框、只有內容灰掉（同 .is-finished）。
   **只有「歷史」分頁**（ul 的 data-current-seg="history"）用兩欄格線（內容｜按鈕）：裡面的列用 subgrid 對齊同一組欄——第一行（標題、
   進度條、1/1）跨兩欄，第二行（誰 · 時間）只佔左欄，按鈕放右欄第二列、疊在連結框上方（z-index 才點得到）；按鈕多長左欄就讓多少。
   其他分頁（含沒 JS 的預設 open）卡片照一般樣子、按鈕藏起來、進度條用第二行那條。已撤回／已移除不是連結（點了會 404） */
.shelf-list .mail-card { padding: 0.6rem 0.75rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; }
.shelf-list .mail-card > .mail-row { padding: 0; background: none; border: 0; border-radius: 0; }
.shelf-list[data-current-seg="history"] .mail-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0.4rem; row-gap: 0.1rem; }
.shelf-list[data-current-seg="history"] .mail-card > .mail-row {
  grid-column: 1 / -1; grid-row: 1 / 3; display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; row-gap: 0.1rem;
}
.shelf-list[data-current-seg="history"] .mail-card > .mail-row > .mail-line:first-child { grid-column: 1 / -1; grid-row: 1; }
.shelf-list[data-current-seg="history"] .mail-card > .mail-row > .mail-line:last-child { grid-column: 1; grid-row: 2; }
.shelf-list[data-current-seg="history"] .mail-card > .mail-actions { grid-column: 2; grid-row: 2; align-self: center; margin: 0; position: relative; z-index: 1; }
/* 已完成列畫兩條進度條：歷史分頁用第一行那條（1/1 左邊），其他分頁用第二行那條（1/1 正下方） */
.shelf-list[data-current-seg="history"] .mail-bar-list,
.shelf-list:not([data-current-seg="history"]) .mail-bar-history,
.shelf-list:not([data-current-seg="history"]) .mail-actions { display: none; }
.shelf-list .mail-row.is-history { opacity: 0.6; cursor: default; }
.mail-state { background: var(--c-surface-muted); color: var(--c-text-secondary); margin-left: 0.35rem; }
/* 已撤回＝紅（大家都看不到），已移除維持灰（只有自己看不到）——第 4 輪「撤回和移除在歷史中無法分辨」 */
.mail-state.is-withdrawn { background: var(--c-negative); color: #fff; }
/* 按鈕列：列表裡的按鈕矮一半（手機 36px → 18px，第 4 輪「按鈕也壓扁一半」）；讀信頁的「結束」不受影響 */
.mail-actions { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.3rem; }
.mail-actions form { margin: 0; }
.shelf-list .mail-actions .btn { min-height: 18px; padding: 0 0.6rem; font-size: 0.75rem; line-height: 1.5; }
/* 讀信頁的「已重啟」＋「結束」（第 3 輪）：同一套按鈕列，標籤靠左、結束靠右 */
.mail-reopened { justify-content: space-between; align-items: center; margin: 0.25rem 0 0.5rem; }
.mail-progress { display: flex; align-items: center; gap: 0.6rem; }
.mail-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--c-accent); overflow: hidden; }
/* 交辦列表的進度條細一半（第 4 輪「進度可以壓扁一半」，所有列一致）；讀信頁上方那條不變 */
.mail-list .mail-bar { height: 3px; }
.mail-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--c-portfolio); }
.mail-bar.is-ok > span { background: var(--c-positive); }
.mail-count { font-size: 0.8125rem; font-weight: 600; min-width: 2.2rem; text-align: right; }
.mail-progress-head { margin: 0.5rem 0; }
/* 一件交辦：‹ 交辦 與右上 ⋯（原生 details 下拉：撤回、移除） */
/* 固定標題列（計畫 20261018-mail-thread-drawer，像 LINE）：‹ 交辦＋標題（一行、太長截掉）＋⋯ 黏在捲動區頂端；底色不透明免得對話透出來；
   z-index（--z-mail-top）比底部那組（.mail-dock 的 --z-bar）高，⋯ 的下拉才蓋得住對話 */
.mail-top { position: sticky; top: 0; z-index: var(--z-mail-top); display: flex; align-items: center; gap: 0.25rem; background: var(--c-canvas); }
.mail-menu { position: relative; }
.mail-menu summary { list-style: none; cursor: pointer; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; letter-spacing: 1px; color: var(--c-text-secondary); border-radius: 8px; }
.mail-menu summary::-webkit-details-marker { display: none; }
.mail-menu-list { position: absolute; right: 0; top: 100%; z-index: var(--z-menu); min-width: 12rem; background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); padding: 0.25rem; display: flex; flex-direction: column; }
.mail-menu-list form { margin: 0; }
.mail-menu-item { width: 100%; text-align: left; border: 0; background: none; min-height: 44px; padding: 0 0.75rem; font-size: 0.9375rem;
  color: var(--c-text-primary); border-radius: 8px; cursor: pointer; }
.mail-menu-item.is-danger { color: var(--c-negative); }
.mail-subject { flex: 1; min-width: 0; margin: 0; font-size: 1.0625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 商品列：大勾選鈕（收件人是按鈕、寄件人是灰框）、名稱與位置、標籤、筆記、誰完成；右邊「留言 N」與寄件人的刪除 */
.mail-item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.mail-item { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem 0.75rem; border: 1px solid var(--c-border); border-radius: 12px;
  background: var(--c-surface); }
.mail-item form { margin: 0; }
.mail-box { width: 30px; height: 30px; flex-shrink: 0; border: 2px solid var(--c-portfolio); border-radius: 9px; background: var(--c-surface);
  color: #fff; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-top: 2px; padding: 0; }
.mail-item.is-done { opacity: 0.65; }
.mail-item.is-done .mail-box { background: var(--c-positive); border-color: var(--c-positive); }
.mail-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
/* 商品名連到產品頁：用本文色、不加底線（第 14 輪：沒設就吃到瀏覽器 visited 的紫色） */
.mail-item-main .shelf-name { color: var(--c-text-primary); text-decoration: none; }
.mail-item-main .memo-note { margin: 0; }
.mail-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; flex-shrink: 0; }
/* 「留言 N」＋紅點（別人說的我還沒看）；抽屜＝既有 .modal（手機是底部抽屜），對話可捲、輸入列在最下面 */
.mail-chat-open { position: relative; display: inline-flex; align-items: center; gap: 0.2rem; }
.mail-chat-open .count-badge { margin-left: 0.3rem; }
/* 懸浮鈕「商品（N）」＋底部商品清單（第 15 輪）：商品區滑出畫面才出現；手機要浮在底部分頁列上面 */
/* 懸浮鈕（第 25／28 輪，使用者「商品按鈕要半透明，不能低於送出按鈕」「透明度不明顯，位置也怪怪的」）：放在 .mail-dock 的上排、不再 fixed；
   底色真的半透明（rgba 的主色 #0073ea）＋背景模糊，看得到底下的留言；按住才實色 */
.fab { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0 1rem; border: 0; border-radius: 999px;
  background: rgba(0, 115, 234, 0.4); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); font-size: 0.9375rem;
  font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); cursor: pointer; }
/* 第 30 輪：拿掉 backdrop-filter（模糊把底下的字糊掉、看起來像實色）、alpha .6→.4——使用者「要略可看到背後的字才叫半透明」 */
/* 實色只在按住當下；hover 只給真的有滑鼠的裝置——iOS 點過後 :hover 會黏住、半透明就「失效」（第 29 輪，使用者） */
.fab:active, .fab:focus-visible { background: var(--c-portfolio); }
@media (hover: hover) { .fab:hover { background: var(--c-portfolio); } }
/* 回到最上面：左邊同高的圓鈕，捲下去才出現（mail.js） */
.fab-top { width: 44px; padding: 0; justify-content: center; font-size: 1.25rem; line-height: 1; }
.fab svg { width: 20px; height: 20px; }
.fab .count-badge { background: #fff; color: var(--c-negative); }
/* 寬度只限桌機（第 16 輪，使用者「抽屜我希望與螢幕同寬」）：寫在手機 .modal 規則後面的話會把手機的滿寬蓋掉 */
@media (min-width: 768px) {
  .items-sheet, .chat-dialog { width: min(32rem, calc(100vw - 2rem)); }
}
.items-sheet .mail-item-list { max-height: 60vh; overflow-y: auto; padding: 0.25rem 0; }
/* 「缺標籤 N 件 …… barcodes」（計畫 20261027-mail-label-barcodes）：標題下面一行，字靠左、鈕靠右，跟清單分開 */
.mail-barcodes { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.5rem; }
/* 寄件人再加商品（計畫 20261016-mail-add-items）：清單最下面整排的「＋ 加商品」；加商品抽屜的備忘錄清單自己捲，按鈕留在下面 */
.mail-add-open { margin-top: 0.75rem; }
.add-sheet .mail-pick-list { max-height: 50vh; overflow-y: auto; padding: 0.25rem 0; }
.add-sheet .add-actions { margin-top: 1rem; }
.chat-title { font-size: 1rem; min-width: 0; overflow-wrap: anywhere; }
/* 抽屜標題的商品名連結（計畫 20261006-chat-title-link）：跟商品清單的商品名同樣子（.mail-item-main .shelf-name），不要瀏覽器預設紫色底線 */
.chat-title-link { color: var(--c-text-primary); text-decoration: none; }
.chat-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 55vh; overflow-y: auto; padding: 0.25rem 0; }
/* 「↓ 新訊息」（計畫 20261017-mail-chat-smooth 第 4 輪）：往上看舊的時收到別人的話才出現，置中、浮在清單底部（抽屜）或黏底那排中間（整封對話）；
   用 .fab 的半透明藍，不擠左右的 ↑ 與「商品」 */
.chat-list-wrap { position: relative; }
.new-below { position: absolute; left: 50%; bottom: 0.5rem; transform: translateX(-50%); white-space: nowrap; pointer-events: auto; }
/* 整封對話：放在 ↑／「商品」那排的上面，不放同一排——窄螢幕會跟「商品（N）」疊在一起（Chrome 500 寬實測） */
.mail-fabs .new-below { bottom: calc(100% + 0.25rem); }
.chat-form { margin-top: 0.75rem; }
/* 信的對話＋輸入框 */
.mail-talk { margin-top: 0.5rem; }
.mail-messages { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.25rem 0 0.75rem; }
.mail-messages .mail-message { scroll-margin-bottom: 7.5rem; } /* 捲到最後一則時停在黏底那組（懸浮鈕排＋輸入列，約 7rem）上方（第 28 輪） */
/* LINE 樣式（計畫 20261006-mail-line-bubbles，使用者 LINE 截圖）：外框不畫框，泡泡在 .mail-bubble；
   別人說的＝左邊頭像、右邊名字（群組才有）＋（泡泡、右下時間）；自己說的＝靠右，左邊（已讀、時間）疊在一起、右邊綠色泡泡 */
.mail-message { max-width: 90%; display: flex; gap: 0.5rem; }
.mail-message.is-mine { align-self: flex-end; }
.mail-message.is-theirs { align-items: flex-start; }
.mail-message p { margin: 0; }
.mail-message .mail-body { white-space: pre-line; overflow-wrap: anywhere; }
.mail-avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--c-accent); }
svg.mail-avatar { padding: 6px; color: var(--c-text-secondary); }
.mail-col { min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.mail-name { font-size: 0.78rem; color: var(--c-text-secondary); }
/* 長按要擋掉 iOS 系統選單與選字，自己的選單才開得出來；因此選單補「複製」 */
.mail-bubble { min-width: 0; padding: 0.5rem 0.75rem; border: 1px solid var(--c-border); border-radius: 4px 18px 18px 18px; background: var(--c-surface);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.is-mine .mail-bubble { border-color: transparent; border-radius: 18px 4px 18px 18px; background: #8de055; color: #111; }
.mail-side { flex-shrink: 0; display: flex; flex-direction: column; font-size: 0.7rem; line-height: 1.3; color: var(--c-text-secondary); white-space: nowrap; }
.is-mine .mail-side { align-items: flex-end; }
.mail-side .mail-read { margin-left: 0; color: var(--c-text-secondary); font-weight: 400; }
/* 換天的日期分隔線（伺服器 MessageRow.newDay、mail.js messageNodes）：置中的淡灰膠囊 */
.mail-day { width: fit-content; margin: 0.4rem auto; padding: 0.1rem 0.7rem; border-radius: 999px; background: rgba(0, 0, 0, 0.06);
  font-size: 0.75rem; color: var(--c-text-secondary); }
/* 交辦列表也用同一條分隔線（計畫 20261007-batch-five A）：清單本身有 gap，上下 margin 收小 */
.mail-list > .mail-day { margin: 0.15rem auto 0; }
/* 輸入列黏在捲動區底部（手機 .dash-main 捲、桌機整頁捲都黏得住），底色不透明免得留言透出來（第 25 輪） */
.mail-dock { position: sticky; bottom: 0; z-index: var(--z-bar); }
.mail-fabs { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 0.5rem; padding-bottom: 0.5rem; pointer-events: none; }
.mail-fabs .fab { pointer-events: auto; }
.mail-fabs .fab:last-child { margin-left: auto; }
/* 「↑ 回到最上面」共用 dock（計畫 20261008-scroll-top-button）：同 .mail-dock／.mail-fabs 的做法，只有左下一顆；
   dock 本身不吃點擊，右邊空白透下去照樣能點到底下的列 */
.top-dock { position: sticky; bottom: 0; z-index: var(--z-bar); display: flex; padding-bottom: 0.5rem; pointer-events: none; }
.top-dock .fab { pointer-events: auto; }
/* 懸浮的返回膠囊（計畫 20261015-floating-back-pill，使用者「back 按鈕要懸浮的」；隱私頁用，公開 CV 在 cv.css 照抄）：同 .top-dock，
   sticky 不用 fixed——捲動時黏在畫面左下，捲到最後停回原位、不蓋頁尾；dock 不吃點擊，旁邊的字照樣點得到；陰影只加在這裡，其他頁的返回膠囊不變 */
/* 第 2 輪（使用者手機截圖「不明顯，太底部了」，選 A 深色）：主色藍底白字、44px 高好按，離底部 24px＋安全區 */
.back-dock { position: sticky; bottom: 0; z-index: var(--z-bar); display: flex; padding: 0.5rem 0 calc(1.5rem + env(safe-area-inset-bottom)); pointer-events: none; }
.back-dock .back-link { pointer-events: auto; min-height: 44px; padding: 0 1.1rem 0 0.7rem; background: var(--c-portfolio); color: #fff; font-size: 0.9375rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.mail-say { margin: 0; padding: 0.5rem 0; background: var(--c-canvas); }
.mail-say-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.mail-say-row .input { flex: 1; min-width: 0; }
/* 多行留言框（計畫 20261018-mail-thread-drawer，像 LINE）：一行高起跳、mail.js 依內容長到 5 行，再多框內捲；
   長高時相機與送出鈕貼底（同 LINE），不跟著置中 */
.mail-say-text { display: block; resize: none; overflow-y: auto; line-height: 1.4; }
.mail-say-row:has(.mail-say-text) { align-items: flex-end; }
/* 對話照片（計畫 20261008-mail-chat-photo-and-note）：相機鈕在留言框左邊；選好的預覽自己一行在上面（flex-basis 100%）；
   泡泡裡的縮圖最寬 220px、點了看大圖；過期是灰色小框 */
.mail-camera { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
.mail-camera svg { width: 24px; height: 24px; }
/* 一次多張（計畫 20261017-mail-chat-smooth）：小圖一排、太多就左右滑（不換行、不撐寬頁面），每張右上角一顆小 ✕；最後「N/9」；
   滿了相機鈕變淡（.is-disabled，input 也 disabled 所以按了不會開）；送出中鈕是 disabled（同全站 .btn:disabled） */
.mail-photo-pick { display: flex; align-items: center; gap: 0.4rem; flex-basis: 100%; min-width: 0; }
/* 上、右各留 6px：✕ 凸出小圖外 6px，overflow-x: auto 會把凸出的部分切掉（Chrome 看到最後一張的 ✕ 少半邊） */
.mail-photo-list { display: flex; gap: 0.4rem; overflow-x: auto; min-width: 0; padding: 6px 6px 0 0; -webkit-overflow-scrolling: touch; }
.mail-photo-thumb { position: relative; flex-shrink: 0; }
.mail-photo-thumb img { display: block; width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-border); }
.mail-photo-remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; min-width: 0; min-height: 0; padding: 0;
  border-radius: 50%; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.7rem; line-height: 1; }
.mail-photo-count { flex-shrink: 0; }
.mail-camera.is-disabled { opacity: 0.35; cursor: default; }
.mail-photo { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.mail-photo img { display: block; max-width: min(220px, 100%); max-height: 260px; border-radius: 10px; }
.mail-photo + .mail-text { display: block; margin-top: 0.35rem; }
.mail-photo-expired { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 6px; background: var(--c-surface-muted);
  color: var(--c-text-secondary); font-size: 0.8rem; }
.mail-photo-expired + .mail-text { display: block; margin-top: 0.35rem; }
/* 九宮格（計畫 20261018-mail-thread-drawer，使用者「一次多張照片不是應該 9 宮格方式顯示嗎」）：同一次送出的幾張放進一個泡泡；
   2、4 張排 2 欄（並排／2×2），其他每列 3 格；方格裁切，點了看整張大圖；過期的那格灰色小字 */
.mail-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: min(240px, 62vw); border-radius: 10px; overflow: hidden; }
.mail-photo-grid[data-n="2"], .mail-photo-grid[data-n="4"] { grid-template-columns: repeat(2, 1fr); }
.mail-photo-grid .mail-photo, .mail-photo-grid .mail-photo-expired { aspect-ratio: 1; width: 100%; }
.mail-photo-grid .mail-photo img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 0; }
.mail-photo-grid .mail-photo-expired { display: flex; align-items: center; justify-content: center; padding: 0.2rem; border-radius: 0;
  font-size: 0.65rem; text-align: center; }
.mail-photo-grid + .mail-text { display: block; margin-top: 0.35rem; }
/* 連續訊息緊湊（同計畫，像 LINE）：同一個人連著說的第二句起不畫頭像名字、間距變小；頭像位置留同寬的空白，泡泡才對齊 */
.mail-message.is-cont { margin-top: -0.3rem; }
.mail-avatar-gap { width: 32px; flex-shrink: 0; }
/* 未讀分隔線（同計畫）：「以下為尚未閱讀的訊息」置中、兩側細線 */
.mail-unread-line { display: flex; align-items: center; gap: 0.6rem; margin: 0.4rem 0; font-size: 0.75rem; color: var(--c-text-secondary); }
.mail-unread-line::before, .mail-unread-line::after { content: ""; flex: 1; border-top: 1px solid var(--c-border); }
/* 長按選單（.mail-bubble 擋掉了 iOS 系統選單與選字，見上面） */
.mail-press-menu { position: fixed; z-index: var(--z-press-menu); display: flex; flex-direction: column; min-width: 9rem; padding: 0.25rem 0;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
.mail-press-menu button { padding: 0.6rem 1rem; border: 0; background: none; text-align: left; font: inherit; color: var(--c-text-primary); cursor: pointer; }
.mail-toast { position: fixed; left: 50%; bottom: 6rem; z-index: var(--z-toast); transform: translateX(-50%); margin: 0; padding: 0.5rem 0.9rem;
  border-radius: 999px; background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 0.875rem; }
/* 看大圖（第 2 輪，使用者「點擊照片應該要置中顯示，抽屜型不好看」「希望能接近全螢幕，且根據圖片長寬自動轉向」）：
   整個畫面、黑底、照片置中放到約 96%。它也有 .modal，所以要把手機版 .modal 的底部抽屜樣式（貼底、圓角、全寬、留底部安全區）全部蓋回來；
   權重帶 dialog 才贏得過寫在 media 裡的 .modal。display: flex 只給 [open]，不然關著的 dialog 也會顯示（同 [hidden] 的坑）。
   照片照原方向（計畫 20261018-mail-thread-drawer 起不再自動轉 90 度，使用者選「改成像 LINE」）；手機轉橫時 96vw／96dvh 跟著變，大圖自然變大 */
dialog.photo-viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; overflow: hidden;
  border: 0; border-radius: 0; box-shadow: none; background: rgba(0, 0, 0, 0.92);
}
dialog.photo-viewer[open] { display: flex; align-items: center; justify-content: center; }
.photo-viewer::backdrop { background: rgba(0, 0, 0, 0.92); }
.photo-viewer img { display: block; max-width: 96vw; max-height: 96dvh; object-fit: contain; }
.photo-viewer-close { position: absolute; top: calc(0.5rem + env(safe-area-inset-top)); right: 0.5rem; z-index: 1; color: #fff; }
/* 相簿控制（計畫 20261018-mail-thread-drawer，像 LINE）：上方中間「2／5」、✕ 左邊「存圖」、左右兩側半透明 ‹ ›（第一張沒有 ‹、最後一張沒有 ›） */
.photo-viewer-count { position: absolute; top: calc(0.9rem + env(safe-area-inset-top)); left: 50%; z-index: 1; transform: translateX(-50%);
  color: #fff; font-size: 0.875rem; }
.photo-viewer-save { position: absolute; top: calc(0.5rem + env(safe-area-inset-top)); right: 3.25rem; z-index: 1; min-height: 36px; padding: 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 999px; background: rgba(0, 0, 0, 0.35); color: #fff; font: inherit; font-size: 0.875rem; cursor: pointer; }
.photo-viewer-step { position: absolute; top: 50%; z-index: 1; width: 44px; height: 44px; transform: translateY(-50%); border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.4); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.photo-viewer-step.is-prev { left: 0.5rem; }
.photo-viewer-step.is-next { right: 0.5rem; }
/* 新交辦：部門與同事都是 chip 勾選框（勾了變藍）；同事、商品有搜尋框（只藏不刪）；底部黏著的「寄出（N 件 → M 人）」 */
.mail-pick { border: 0; margin: 0.6rem 0 0; padding: 0; }
.mail-pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.mail-pick-list label { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0.65rem; border: 1px solid var(--c-border);
  border-radius: 12px; background: var(--c-surface); cursor: pointer; }
.mail-pick-list input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.mail-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0; }
.chip-check { cursor: pointer; gap: 0.3rem; }
.chip-check input { margin: 0; width: 1rem; height: 1rem; }
.chip-check:has(input:checked) { background: var(--c-portfolio); border-color: var(--c-portfolio); color: #fff; }
.chip-check.is-off { opacity: 0.5; }
.mail-search { margin: 0.35rem 0; }
.mail-pick > .muted.small, .mail-depts > .muted.small { margin: 0.6rem 0 0.35rem; }
.mail-pick [data-mail-to-none] { margin-top: 0.5rem; }
/* 部門預設收起來（計畫 20261018-mail-thread-drawer）：摘要列像一顆可點的列，寫勾了幾個 */
.mail-depts { margin: 0.35rem 0 0.5rem; border: 1px solid var(--c-border); border-radius: 12px; padding: 0 0.65rem; background: var(--c-surface); }
.mail-depts-summary { cursor: pointer; padding: 0.55rem 0; font-weight: 600; }
.mail-depts[open] { padding-bottom: 0.4rem; }
/* 同事只先列常用＋勾了的，搜尋框有字（is-searching）才全部參與比對；提示「其他 N 位同事請用搜尋」搜尋時收起 */
.mail-chips[data-filter-rest]:not(.is-searching) > .chip-check:not([data-frequent]):not(:has(input:checked)) { display: none; }
.mail-chips.is-searching + .mail-rest-hint { display: none; }
.mail-pick > .mail-rest-hint { margin: 0.1rem 0 0.35rem; }
.mail-foot { position: sticky; bottom: 0; display: flex; gap: 0.6rem; padding: 0.6rem 0 0.25rem; background: var(--c-canvas); }
.mail-send { flex: 1; }
.memo-pick { width: 1.2rem; height: 1.2rem; flex-shrink: 0; }
.memo-mail-bar { display: flex; justify-content: flex-end; margin: 0.75rem 0 0; }
.memo-mail-bar .count-badge { margin-left: 0.35rem; }
/* 導覽列「交辦」的進行中封數、「待辦」的總數（計畫 20261006-mail-badge-open-count、20261005-home-redesign）：展開的側欄排在最右；
   收合側欄與手機底部分頁列（只剩圖示）改貼在圖示右上角 */
.nav-badge { margin-left: auto; }
.sidebar[data-collapsed='true'] .nav-link { position: relative; }
.sidebar[data-collapsed='true'] .nav-badge { position: absolute; top: 0.15rem; right: 0.15rem; margin: 0; }
/* 手機：徽章疊在格子右上——left 從圖示中線偏右起算、right 貼邊，兩邊都給＝寬度跟著格子算（計畫 20261007-full-refactor-2：原本兩條 .nav-badge
   互相蓋，這一條就是當時實際生效的值） */
@media (max-width: 767px) {
  .nav-badge { position: absolute; top: 0.1rem; left: calc(50% + 0.5rem); right: 0.1rem; margin: 0; font-size: 0.62rem; }
}
/* 我說的那則對方看過了（第 4 輪）：時間後面一個小小的「已讀」 */
.mail-read { margin-left: 0.4rem; color: var(--c-portfolio); font-weight: 600; }
/* 群組信（計畫 20261004-group-mail）：「N 人已讀」點開看名字（<details>，不用 JS）；附件下面的「誰完成」 */
.mail-read-by { display: inline; }
.mail-read-by summary { display: inline; cursor: pointer; list-style: none; }
.mail-read-by summary::-webkit-details-marker { display: none; }
.mail-read-by[open] summary::after { content: '：'; }
.mail-read-by span { font-weight: 400; }
.mail-done-by { margin: 0; }
/* 點商品＝跳視窗（計畫 20261001-product-modal）：整個畫面的視窗，上面一條放關閉鈕（避開瀏海），下面 iframe 就是產品頁本身、自己捲動 */
.product-modal { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--c-canvas); }
.product-modal[open] { display: flex; flex-direction: column; }
/* 透明（計畫 20261023-label-barcode-sheet 第 5 輪，使用者 iPhone「一樣有灰色」）：視窗本身蓋滿畫面，40% 黑背景唯一露出來的是狀態列，
   iPhone 取到灰色、關掉後要捲一下才變回白 */
.product-modal::backdrop { background: transparent; }
.product-modal-bar { display: flex; justify-content: flex-end; flex-shrink: 0; padding: calc(0.4rem + env(safe-area-inset-top)) 0.75rem 0.4rem;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.product-modal-close { width: 44px; height: 44px; border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-surface);
  color: var(--c-text-primary); font: inherit; font-size: 1.1rem; cursor: pointer; }
.product-modal-frame { display: block; flex: 1; width: 100%; min-height: 0; border: 0; }

/* ---------- 首頁三層、待辦、我的、管理（計畫 20261005-home-redesign，使用者看過草圖選定） ---------- */
.who-head .role-pill, .who-head .dev-pill { font-size: 0.75rem; font-weight: 500; }
.home-search { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 1rem; padding: 0.375rem; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: 14px; }
.home-search .input { flex: 1; min-width: 0; border: 0; background: transparent; }
.home-scan { display: inline-flex; align-items: center; gap: 0.375rem; }
.home-scan svg { width: 18px; height: 18px; }
/* 首頁效期巡檢整列按鈕（計畫 20261008-home-expiry-button）：搜尋框下、「今天要做」上；下邊距跟搜尋框一樣 1rem，圖示同掃描鈕 */
.home-expiry-scan { gap: 0.5rem; margin: 0 0 1rem; min-height: 44px; font-weight: 700; }
/* 圖示用效期的紅（同 .home-icon-expiry），醒目但不跟藍色掃描鈕搶 */
.home-expiry-scan svg { width: 18px; height: 18px; color: var(--c-negative); }
.home-section { margin: 0 0 1.25rem; }
.home-section h2 { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 700; }
/* 標題列：下方間距由整列給（計畫 20261006-text-links-to-chips）；右邊原本的「全部待辦」已拿掉（計畫 20261006-remove-extra-text），日後再放東西照這個排 */
.home-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.home-section-head h2 { margin: 0; }
.today-list { list-style: none; margin: 0; padding: 0; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.today-list li + li { border-top: 1px solid var(--c-border); }
.today-row { display: flex; align-items: center; gap: 0.75rem; min-height: 52px; padding: 0.375rem 1rem; color: inherit; text-decoration: none; }
.today-row .home-icon { width: 32px; height: 32px; border-radius: 9px; }
.today-row .home-icon svg { width: 18px; height: 18px; }
.today-title { flex: 1; font-size: 0.9375rem; }
.today-row.is-urgent .count-badge { background: #fde7d9; color: var(--c-urgent); }
.today-none { margin: 0.5rem 0 0; }
.todo-types { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
.todo-group { margin: 1rem 0 0.375rem; font-size: 0.875rem; font-weight: 700; color: var(--c-text-secondary); }
.todo-row { display: flex; align-items: center; gap: 0.5rem; }
.todo-main { flex: 1; min-width: 0; }
.todo-detail { display: block; color: var(--c-detail-blue); }
.todo-detail.is-late { color: var(--c-urgent); }
/* 待辦頁的備忘錄列（計畫 20261023-todo-memos）：標籤 pill、筆記、幾天前排成一行、放不下就換行；pill 用備忘錄頁的灰底 */
.todo-memo { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; color: var(--c-text-secondary); }
.todo-actions { display: flex; gap: 0.375rem; flex-shrink: 0; padding-right: 0.5rem; }
.manage-list a { display: flex; align-items: center; gap: 0.75rem; }
.manage-text { display: flex; flex-direction: column; gap: 0.125rem; }
/* 手機版首頁小卡把 .home-title 置中；管理頁是一列一項，標題要跟說明一樣靠左（第 4 輪，使用者「文字排版太亂」） */
.manage-list .home-title { justify-content: flex-start; font-size: 0.9375rem; }
/* 回上一頁：小膠囊＋線條 ‹（第 28 輪，使用者「回管理、回交辦這兩個連結都好醜」）；外面 44px 高好按，膠囊本身 36px */
.back-link { display: inline-flex; align-items: center; gap: 0.1rem; min-height: 36px; margin: 4px 0; padding: 0 0.85rem 0 0.45rem;
  border-radius: 999px; background: var(--c-accent); color: var(--c-text-primary); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.back-link svg { width: 18px; height: 18px; flex-shrink: 0; }
/* 頁面標題（計畫 20261101-page-title-consistency，全站 QA 找到守則、刪除產品等頁是瀏覽器預設 32px）：直接放在 .page 裡、沒 class 的 <h1>
   一律跟「新交辦」（.mail-h1）一樣大——新頁照這樣寫就對。:not([class]) 排除自己定過樣式的標題（drive-headline、sr-only…），
   只管直接子元素，商品頁那種放在 .product-title 裡的、位置精靈 #loc-wizard 的都不動 */
.page > h1:not([class]) { margin: 0 0 0.5rem; font-size: 1.25rem; }

/* dev 雲端硬碟（計畫 20261006-drive-and-excel-import，ADR 0030）：公開頁 /drive 借登入頁的外框（無導覽列）；開發者頁 /dev/drive 走一般殼 */
.drive-headline { margin: 0.5rem 0 0.25rem; font-size: 1.5rem; font-weight: 700; }
.drive-unlock { display: flex; flex-direction: column; gap: 0.5rem; }
.otp-input { width: 100%; padding: 0.75rem 0.5rem; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface);
  font-family: var(--font-mono); font-size: 2rem; letter-spacing: 0.6em; text-align: center; text-indent: 0.6em; }
.drive-submit { min-height: 48px; font-size: 1rem; }
.drive-notes { margin: 1.5rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }
.drive-ticket { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0 0; }
.drive-upload { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.drive-drop { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 1.25rem 1rem; border: 2px dashed var(--c-portfolio); border-radius: 14px;
  background: color-mix(in oklab, var(--c-portfolio) 6%, var(--c-surface)); text-align: center; cursor: pointer; }
/* file input 藏起來的規則跟 .memo-tags input 合寫在一起（搜 C002） */
.drive-drop b { color: var(--c-portfolio); }
.drive-chosen { font-size: 0.875rem; font-weight: 600; }
.drive-chosen:empty { display: none; }
.drive-sub { margin: 1rem 0 0.5rem; font-size: 1rem; }
.drive-list li { display: flex; align-items: center; gap: 0.75rem; }
.drive-list li > div:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drive-list b { overflow-wrap: anywhere; }
.drive-foot { margin-top: 1.5rem; text-align: center; }
.drive-code-box { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px; padding: 1rem; }
.drive-code-current { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin: 0.5rem 0 1rem; }
.drive-code { font-family: var(--font-mono); font-size: 2.75rem; font-weight: 700; letter-spacing: 0.3em; text-indent: 0.3em; line-height: 1; }
.drive-code.is-expired { color: var(--c-benchmark); }
.drive-bar { width: 100%; max-width: 20rem; height: 8px; border-radius: 999px; background: var(--c-accent); overflow: hidden; }
.drive-bar-fill { height: 100%; background: var(--c-portfolio); transition: width 1s linear; }
.drive-bar-fill.is-warning { background: var(--c-warning); }
.drive-bar-fill.is-expired { background: var(--c-border); }
[data-countdown].is-expired { color: var(--c-warning); font-weight: 600; }
.drive-modes { border: 0; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.drive-modes label { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 44px; }
.drive-code-form { display: flex; flex-direction: column; gap: 0.25rem; }
form.inline { display: inline; }
.drive-view-title { margin: 0.5rem 0 0.25rem; overflow-wrap: anywhere; }
.drive-view-actions { margin: 0.5rem 0 0.75rem; }
.drive-preview { width: 100%; height: 70vh; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface); }

/* Excel 匯入（同計畫，ADR 0031）：入口（統計卡、批次列表、匯入視窗）、欄位確認、明細表 */
.import-head { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.75rem; }
.import-head p { flex: 1; margin: 0; }
.import-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin: 0 0 1rem; }
@media (min-width: 720px) { .import-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.import-stat { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.75rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; }
.import-stat b { font-size: 1.5rem; }
.is-ok { color: var(--c-positive); }
.is-bad { color: var(--c-negative); }
.is-info { color: var(--c-portfolio); }
.is-warn { color: var(--c-warning); }
.import-empty { padding: 2rem 1rem; text-align: center; border: 2px dashed var(--c-border); border-radius: 14px; }
.import-batches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.import-batches li { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; }
.import-batches li.is-running { border-color: var(--c-portfolio); }
.import-ring { flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; background: var(--c-accent); color: var(--c-text-secondary); }
.import-ring.is-running { background: var(--c-info-bg); color: var(--c-portfolio); }
.import-ring.is-done { background: var(--c-success-bg); color: var(--c-success-text); }
.import-batch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.import-batch-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.import-nums { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.import-batch-actions { display: flex; flex-direction: column; gap: 0.35rem; flex-shrink: 0; }
.pill-status-running { background: var(--c-info-bg); color: var(--c-portfolio); }
.pill-status-queued, .pill-status-paused { background: var(--c-accent); color: var(--c-text-secondary); }
.pill-status-done { background: var(--c-success-bg); color: var(--c-success-text); }
.import-dialog { width: min(36rem, calc(100vw - 2rem)); }
.import-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--c-border); margin: 0 0 0.75rem; }
.import-tabs button { padding: 0.5rem 0.75rem; border: 0; background: none; font: inherit; color: var(--c-text-secondary); border-bottom: 3px solid transparent; }
.import-tabs button.is-on { color: var(--c-portfolio); font-weight: 600; border-bottom-color: var(--c-portfolio); }
.import-new-form { display: flex; flex-direction: column; gap: 0.5rem; }
.import-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.import-cols select { width: 100%; min-height: 44px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.import-preview td, .import-preview th { text-align: left; white-space: nowrap; font-size: 0.8125rem; }
.import-batch-head h2 { margin: 0.5rem 0 0; }
.import-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.75rem 0; }
.import-progress .drive-bar { flex: 1; min-width: 8rem; max-width: none; }
.import-filters { margin: 0 0 0.5rem; }
.import-search { margin-top: 0.5rem; }
.import-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; }
.import-note { flex-basis: 100%; }
.import-table td, .import-table th { text-align: left; font-size: 0.8125rem; white-space: nowrap; padding: 0.4rem 0.5rem; }
.import-table .import-name { width: 11rem; min-height: 36px; padding: 0.25rem 0.4rem; border: 1px solid var(--c-border); border-radius: 6px; font: inherit; font-size: 0.8125rem; }
.import-table .import-name.is-missing { border-color: var(--c-warning); }
.import-table .import-name.is-saved { border-color: var(--c-positive); box-shadow: 0 0 0 2px var(--c-success-bg); }
.import-table .import-name.is-failed { border-color: var(--c-negative); }
.import-thumb { display: inline-block; width: 36px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--c-accent); vertical-align: middle; }
.import-thumb.is-empty { border: 1px dashed var(--c-border); background: none; }
/* 匯入第 2 段（計畫 20261007-import-shelf-flow）：明細頁的周遭照縮圖疊紅圈（同 .mark-ring 的比例畫法，圈線改細）、待公開列藍底、公開列；
   上架頁的三格檢查；產品頁的照片來源與「暫存區可補」卡 */
.import-shot { position: relative; display: inline-block; line-height: 0; border-radius: 6px; overflow: hidden; vertical-align: middle; }
.import-shot .mark-ring { border-width: 2px; }
.import-table tr.row-shelf-ready td { background: #eaf3ff; }
.import-publish { display: flex; justify-content: flex-end; margin: 0 0 0.75rem; }
/* 快速建檔（計畫 20261013-quick-shelf）：找貨頁掃描區下方的開關列（開著＝藍框藍底，一眼看得出在建檔模式）；明細頁「位置正確」與「調整」並排 */
.quick-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.75rem; padding: 0.6rem 0.75rem;
    border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); }
.quick-toggle.is-on { border-color: var(--c-portfolio); background: color-mix(in oklab, var(--c-portfolio) 8%, var(--c-surface)); }
.quick-toggle-label { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.quick-toggle.is-on .quick-toggle-label b { color: var(--c-portfolio); }
.quick-toggle .btn { flex-shrink: 0; }
.import-mark-actions { display: inline-block; margin: 0 0.25rem 0.25rem 0; }
.photo-cell-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.photo-cell-wrap .photo-cell { flex: 1; }
.shelf-checks { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.75rem 0; padding: 0; font-size: 0.9rem; }
.shelf-checks li { display: inline-flex; align-items: center; gap: 0.3rem; }
.shelf-checks .is-done { color: var(--c-positive); }
.shelf-checks .is-missing { color: var(--c-text-secondary); }
.shelf-missing { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
/* 快速建檔的上架頁（計畫 20261013-quick-shelf-slim，使用者「畫面希望不用下滑就能完成」）：只剩照片＋位置＋完成，
   再縮成 iPhone 一個畫面按得到「完成」——照片 2:1、上一張與警告同一行、小地圖限高、間距縮小。Excel 批的上架頁不受影響
   （.shelf-last 平常 display: contents＝跟沒包一樣） */
.shelf-last { display: contents; }
#import-shelf.is-quick .product-title p { margin: 0 0 0.25rem; }
#import-shelf.is-quick .photo-grid { margin: 0.25rem 0 0.5rem; }
#import-shelf.is-quick .photo-cell { padding: 0.45rem; gap: 0.25rem; }
#import-shelf.is-quick .photo-cell > img { aspect-ratio: 2 / 1; }
/* 剛選了照片（預覽出現）：「還沒拍」已經不對，收起來 */
#import-shelf.is-quick [data-preview-for]:not([hidden]) + .muted { display: none; }
#import-shelf.is-quick .shelf-last { display: flex; flex-wrap: wrap; gap: 0 0.4rem; font-size: 0.75rem; }
#import-shelf.is-quick .shelf-last > * { font-size: inherit; }
/* 小地圖只是「選了哪裡」的預覽（點了開小視窗改），用固定高度：vh 在 iPhone 會跟著網址列伸縮 */
#import-shelf.is-quick .location-preview .storemap { max-height: 64px; }
#import-shelf.is-quick .location-section .field-label { margin-top: 0.25rem; }
#import-shelf.is-quick .loc-use-last { margin-bottom: 0.25rem; }
#import-shelf.is-quick .shelf-checks { margin: 0.4rem 0; }
#import-shelf.is-quick .product-actions { margin-top: 0.4rem; }
/* 主畫面 App 舊設定提醒（計畫 20261013-webclip-stale-hint）：黃色、字在左、「知道了」在右下；不自動消失。
   在頂欄與 .dash-body 之間（不在 .dash-main 裡，第 2 輪 review），自己留外距、不被殼的 flex 壓扁 */
.webclip-stale { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem;
  flex-shrink: 0; margin: 0.5rem max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  text-align: left; font-weight: 400; color: var(--c-text-primary);
  border-color: color-mix(in oklab, #d97706 50%, transparent); background: color-mix(in oklab, #f59e0b 12%, var(--c-surface)); }
.webclip-stale > span { flex: 1 1 14rem; }
.photo-credit { margin: 0.25rem 0 0.5rem; }
.import-fill { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.75rem 0; padding: 0.75rem; border: 1px dashed var(--c-border); border-radius: 10px; }
.import-fill-item { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px; }
.import-fill .btn { align-self: flex-start; }
.import-photo-source { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--c-text-secondary); white-space: nowrap; }
.import-status { font-weight: 600; }
.import-status.is-pending { color: var(--c-benchmark); }
.import-status.is-querying { color: var(--c-portfolio); }
.import-status.is-found { color: var(--c-positive); }
.import-status.is-not_found, .import-status.is-error, .import-status.is-invalid_barcode { color: var(--c-negative); }
.import-status.is-duplicate { color: var(--c-text-secondary); }
.import-table tr.row-invalid_barcode td { background: var(--c-error-bg); }
.import-table tr.row-duplicate td { background: var(--c-surface-muted); color: var(--c-text-secondary); }
.import-table tr.row-pending td { color: var(--c-benchmark); }

/* 跳到主內容（計畫 20261007-commercial-standard B8）：平常移到畫面外，Tab 到它才滑進左上角，蓋在頂欄上面 */
.skip-link { position: absolute; top: -100px; left: 8px; z-index: var(--z-skip-link); padding: .5rem .9rem; border-radius: 8px;
             background: var(--c-surface); color: var(--c-portfolio); border: 2px solid var(--c-portfolio); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; outline: none; }
.dash-main:focus { outline: none; }
/* 送出中的鈕（submit-once.js）：灰掉之外再標一下，跟單純 disabled 的鈕分得開 */
.btn[data-busy] { cursor: progress; }

/* 錯誤頁（計畫 20261007-commercial-standard B2）：登入殼＋大狀態碼＋一顆回首頁 */
.error-page .login-main { text-align: center; }
.error-page .error-code { margin: 2.5rem 0 0; font-size: 4rem; font-weight: 800; line-height: 1; color: var(--c-text-secondary); letter-spacing: 0.05em; }
.error-page .login-main > .btn { margin-top: 0.5rem; }

/* 隱私說明（計畫 20261009-commercial-batch-2 B6）：登入殼的長文字頁。手機版登入頁底部要留 8.5rem 給固定的 Google 鈕，這頁沒有那顆鈕 */
.login-page.privacy-page { padding-bottom: 0; }
/* 登入頁的大標題是置中的；這頁內文都靠左，標題跟著靠左才不會一置中一靠左（Chrome 看過） */
.privacy-page .login-headline { text-align: left; }
.privacy-page .login-main h2 { margin: 1.5rem 0 0.5rem; font-size: 1rem; }
.privacy-page .login-main ul { margin: 0; padding-left: 1.25rem; }
.privacy-page .login-main li { margin-bottom: 0.375rem; line-height: 1.5; }
.privacy-page .login-main > .back-dock { margin-top: 1rem; }

/* 商品照背景上傳（計畫 20261023-photo-background-upload，ADR 0044）：
   照片格沒照片時的灰框（同縮圖大小，字縮小、可換行）：上傳中＝虛線灰、沒傳到＝黃底（同「缺照片」pill 的色）；
   已有照片、這支手機有新照片在傳＝照片下緣蓋一條半透明小標；角落小提示固定右下，手機版在底部分頁列上方（同 .home-order-done） */
.product-thumb.photo-awaited { padding: 0.2rem; border: 1px dashed var(--c-border); background: var(--c-surface-muted);
  font-size: 0.625rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; color: var(--c-text-secondary); text-decoration: none; }
/* 「沒傳到／請重拍」文案裡有換行（\n），照文案斷成兩行，不讓標點自己掉到下一行（Chrome 390 寬看過，計畫同上） */
.product-thumb.photo-awaited.is-late { border-style: solid; border-color: transparent; background: var(--c-pending-bg); color: var(--c-pending-text);
  font-weight: 600; white-space: pre-line; }
a.product-thumb[data-photo-kind] { position: relative; }
/* 小縮圖只有 52px：小標一行就好（折成兩行會蓋住半張照片） */
.photo-new-badge { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.1rem 0; background: rgba(0, 0, 0, 0.6); color: #fff;
  font-size: 0.5625rem; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.upload-dock { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: var(--z-upload-dock);
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.45rem 0.8rem; border-radius: 12px;
  background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 0.8125rem; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); pointer-events: none; }
.upload-dock-hint { font-size: 0.6875rem; opacity: 0.8; }
@media (max-width: 767px) {
  .upload-dock { bottom: calc(var(--tabbar-clearance) + env(safe-area-inset-bottom)); }
}

/* 臨時公開條碼頁（計畫 20261023-label-barcode-sheet，ADR 0045）：一張一列、白底、上下留大間距——掃描槍一次只框得到一張，不會掃到隔壁；
   條碼最寬 520px（電腦螢幕上也不要太長，掃描槍要退很遠）；號碼大字等寬，旁邊「第 n／N 張」。
   備忘錄頁的結果小視窗：網址大字、可換行（窄螢幕不撐破）。組標題列多一顆鈕：兩個表單並排 */
.barcode-sheet { list-style: none; margin: 1rem 0 2rem; padding: 0; display: flex; flex-direction: column; gap: 2.5rem; }
.barcode-sheet-item { display: flex; flex-direction: column; align-items: center; padding: 1rem 0.5rem; background: #fff;
  border: 1px solid var(--c-border); border-radius: 12px; }
.barcode-sheet-svg { display: block; width: 100%; max-width: 520px; height: auto; }
.barcode-sheet-caption { display: flex; gap: 1rem; align-items: baseline; margin: 0.5rem 0 0; }
.barcode-sheet-code { font-size: 1.25rem; letter-spacing: 0.08em; }
.sheet-url { margin: 0.75rem 0; font-size: 1.25rem; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
/* 視窗背景不蓋最上面一條（計畫 20261023-label-barcode-sheet 第 8 輪，使用者 iPhone「上方會有灰色」）：iPhone 照頁面最上面的顏色染狀態列，
   背景變暗時取到灰色，關掉後要使用者手指捲一下才重取（改 theme-color、程式捲動都試過無效，第 4–7 輪）。
   頂端留 6px 不變暗，取到的一直是白色頂欄。6px 是推論值，實機不夠再加大 */
dialog::backdrop { clip-path: inset(6px 0 0 0); }
.memo-group-head .memo-group-title + form { margin-left: auto; }
.memo-group-head form + form { margin-left: 0.4rem; }
/* Stock 抄底通知（計畫 20261024-stock-alerts）：切組與分頁兩排 chip、要確認的事件紅框卡、兩欄數字表、回測走勢圖（SVG 兩條線） */
/* 切組、分頁、報稅範圍、財年四排 chip：跟其他頁的篩選一樣 30px（手機觸控規則把 .chip 撐到 44px，使用者「Tag都太厚還黏在一起」），排與排之間留距離 */
.stock-nav { gap: 0.4rem; margin: 0 0 0.6rem; }
.stock-nav .chip { min-height: 30px; padding-top: 0.1rem; padding-bottom: 0.1rem; }
.stock-groups .count-badge { margin-left: 0.15rem; }
.stock-action { margin: 0 0 0.75rem; padding: 0.75rem; border: 2px solid var(--c-negative); border-radius: 12px; background: var(--c-surface); }
.stock-action-title { margin: 0 0 0.25rem; font-size: 1rem; }
.stock-action p { margin: 0.25rem 0; }
.stock-action-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.stock-confirm, .stock-delete { margin-top: 0.5rem; }
.stock-confirm > summary, .stock-delete > summary { display: inline-flex; cursor: pointer; list-style: none; }
.stock-confirm > summary::-webkit-details-marker, .stock-delete > summary::-webkit-details-marker { display: none; }
.stock-delete[open] > summary { display: none; }
/* 表單（使用者「欄位都黏在一起」）：列與列、格與格都留距離；送出鈕跟上面隔開、不撐滿整列 */
.stock-form { display: grid; gap: 0.5rem; margin: 0 0 1rem; }
.stock-form .field-row, .stock-confirm .field-row { gap: 0.75rem; }
.stock-form .field-row > label { flex: 1; min-width: 0; }
.stock-form .field-row .input, .stock-confirm .field-row .input { min-width: 0; width: 100%; }
.stock-form > .btn, .stock-form > button { justify-self: start; margin-top: 0.5rem; }
/* iPhone 的日期欄有自己的最小寬度，會撐出格子（起點、終點兩格黏住、終點超出畫面）：拿掉原生外觀、照格子寬 */
.stock-page input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; width: 100%; }
.stock-page input[type="date"]::-webkit-date-and-time-value { text-align: left; }
/* 一組欄位裡的小標（A／B／C、最高點…）：不要再空一大段 */
.stock-sub { margin-top: 0.25rem; }
/* 每一腿的金額（股數 × 每股價格，第 3 輪） */
.stock-leg-total { margin: 0.3rem 0 0; font-size: 0.875rem; font-weight: 600; color: var(--c-text-secondary); }
.stock-advanced > summary { cursor: pointer; }
.stock-table { width: 100%; margin: 0 0 0.75rem; border-collapse: collapse; font-size: 0.875rem; }
.stock-table th, .stock-table td { padding: 0.35rem 0.25rem; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
.stock-table th { width: 40%; font-weight: 600; color: var(--c-text-secondary); }
.stock-wide th, .stock-compare th { width: auto; white-space: nowrap; }
.stock-wide td { white-space: nowrap; }
.stock-hot { color: var(--c-negative); font-weight: 700; }
/* 報稅提醒框（計畫 20261112-stock-tax-ledger）：暫用匯率、2027 稅改還沒算、FITO 超過 A$1,000；黃色同 .pill-warn，跟紅色的錯誤分開 */
.stock-warn { margin: 0 0 0.6rem; padding: 0.5rem 0.75rem; border-radius: 10px; background: var(--c-pending-bg); color: var(--c-pending-text); font-size: 0.875rem; }
/* 匯入失敗的紅框：.notice 是置中，清單改成靠左、整塊置中，項目符號才會貼著字 */
.stock-error-list { display: inline-block; margin: 0.3rem 0 0; padding-left: 1.2rem; text-align: left; }
/* 18H 底下的「可打折／不能打折」兩列往右縮，看得出是拆開的 */
.stock-table th.stock-indent { padding-left: 1.25rem; font-weight: 400; }
/* 持股頁（第 8 輪）：未實現損益的顏色跟著設定的漲跌顏色（--stock-up／--stock-down，見檔尾 Stock 改版） */
.stock-profit { color: var(--stock-up); }
.stock-loss { color: var(--stock-down); }
/* 2027 起的賣出：列在明細裡但不算進總數，淡一點 */
.stock-table tr.stock-excluded td { color: var(--c-text-secondary); }
.stock-chart { margin: 0 0 0.75rem; }
.stock-chart svg { display: block; width: 100%; height: 160px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px; }
.stock-chart polyline { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.stock-line-strategy { stroke: var(--c-portfolio); }
.stock-line-hold { stroke: var(--c-stock-hold); }
.stock-chart figcaption { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.3rem; }
.stock-key::before { content: ""; display: inline-block; width: 0.9rem; height: 3px; margin-right: 0.3rem; vertical-align: middle; }
.stock-key-strategy::before { background: var(--c-portfolio); }
.stock-key-hold::before { background: var(--c-stock-hold); }

/* ===== Stock 改版（計畫 20261112-stock-ui-redesign 第 2 輪：使用者選 2 號深色券商風＋持股 A 版＋分頁放底部） =====
   app 沒有深色模式，所以只在 Stock 頁把全站顏色變數換成深色：內容區整塊（連頁尾）都深，app 的頂欄、側欄照舊白。
   賺賠用自己的兩個變數，設定選「紅漲綠跌」時 .stock-red-up 對調；全站的紅綠（刪除鈕、錯誤）不跟著換。 */
.stock-page, .dash-main:has(> .stock-page) {
  color-scheme: dark;
  --c-canvas: #10161d; --c-surface: #17202a; --c-surface-muted: #1d2833; --c-border: #2a3541;
  --c-text-primary: #e8edf2; --c-text-secondary: #97a4b2; --c-accent: #1f2b37; --c-portfolio: #3fb8a6;
  --c-positive: #3fcf8e; --c-negative: #ff6b6b; --c-benchmark: #8794a3;
  --c-success-bg: #12332a; --c-success-text: #8fe3bd; --c-pending-bg: #3b3115; --c-pending-text: #f2d58a;
  --c-error-bg: #3a1b1d; --c-error-text: #ffb4ad; --c-warning: #f2b544; --c-info-bg: #16283a;
  --c-detail-blue: #8cc0ea; --c-stock-hold: #8a95a3;
  --stock-up: #3fcf8e; --stock-down: #ff6b6b; --stock-on-color: #0b1116; --stock-on-accent: #07211d;
}
.stock-page.stock-red-up { --stock-up: #ff6b6b; --stock-down: #3fcf8e; }
.dash-main:has(> .stock-page) { background: var(--c-canvas); color: var(--c-text-primary); }
/* 青綠、亮紅底上白字太淡（Chrome 量到刪除鈕 2.8:1）：主要按鈕、刪除鈕、選中的 chip、切換都用深字 */
.stock-page .btn-primary, .stock-page .chip.is-on, .stock-seg a.is-on { color: var(--stock-on-accent); }
.stock-page .btn-danger { color: var(--stock-on-color); }

/* 頁首：‹ 首頁（手機這頁沒有 app 底部列）、標題、右邊切換 */
.stock-head { display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; margin: 0 0 0.75rem; }
.stock-home { display: inline-flex; align-items: center; gap: 0.15rem; min-height: 32px; color: var(--c-text-secondary); text-decoration: none; font-size: 0.9rem; }
.stock-title { flex: 1; min-width: 0; margin: 0; font-size: 1.15rem; }
.stock-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--c-surface-muted); }
.stock-seg a { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 30px; padding: 0 0.8rem; border-radius: 999px; color: var(--c-text-secondary); text-decoration: none; font-size: 0.85rem; }
.stock-seg a.is-on { background: var(--c-portfolio); font-weight: 700; }
/* 電腦：九個分頁一排；手機藏起來改用底部列 */
.stock-tabs { display: flex; gap: 0.25rem; margin: 0 0 1rem; overflow-x: auto; border-bottom: 1px solid var(--c-border); scrollbar-width: none; }
.stock-tabs a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.55rem 0.7rem; border-bottom: 2px solid transparent;
  color: var(--c-text-secondary); text-decoration: none; font-size: 0.92rem; }
.stock-tabs a.is-on { color: var(--c-text-primary); border-bottom-color: var(--c-portfolio); font-weight: 700; }
.stock-bottom { display: none; }

/* 持股 A 版：總市值（可切幣別）→ 圓餅 → 每一檔 */
.stock-hero { display: grid; gap: 0.15rem; margin: 0 0 0.9rem; }
.stock-hero p { margin: 0; }
.stock-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.stock-big { font-size: 2rem; font-weight: 700; line-height: 1.15; }
.stock-cur { display: inline-flex; overflow: hidden; border: 1px solid var(--c-border); border-radius: 8px; }
/* button：現金分頁的「幣別｜銀行」切換（計畫 20261113-stock-cash-pie），長相同幣別切換、去掉按鈕預設框與底色 */
.stock-cur a, .stock-cur button { display: inline-flex; align-items: center; min-height: 30px; padding: 0 0.7rem; color: var(--c-text-secondary); text-decoration: none; font-size: 0.8rem; }
.stock-cur button { border: 0; background: none; font-family: inherit; cursor: pointer; }
.stock-cur a.is-on, .stock-cur button.is-on { background: var(--c-surface-muted); color: var(--c-text-primary); font-weight: 700; }
/* 總資產下面兩行：持股／現金＋占比（計畫 20261112-stock-cash） */
.stock-split { display: grid; gap: 0.15rem; margin: 0.15rem 0 0.25rem; padding: 0; list-style: none; max-width: 22rem; }
.stock-split li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: baseline; color: var(--c-text-secondary); }
.stock-split b { color: var(--c-text-primary); }
.stock-subtotals { display: grid; gap: 0.25rem; margin: 0.4rem 0 0; padding: 0; list-style: none; }
.stock-subtotals li { display: flex; justify-content: space-between; gap: 1rem; }
.stock-card { display: grid; gap: 0.6rem; margin: 0 0 0.9rem; padding: 0.9rem; border-radius: 12px; background: var(--c-surface); }
.stock-card h2 { margin: 0; font-size: 0.95rem; }
.stock-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.stock-donut-wrap { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1rem; align-items: center; }
.stock-donut { position: relative; display: grid; place-items: center; width: 8rem; max-width: 100%; aspect-ratio: 1; border-radius: 50%; }
.stock-donut::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; background: var(--c-surface); }
.stock-donut > span { position: relative; z-index: 1; display: grid; justify-items: center; color: var(--c-text-secondary); font-size: 0.75rem; line-height: 1.3; }
.stock-donut b { color: var(--c-text-primary); font-size: 0.95rem; }
/* 圖例每項兩行：上行色塊＋代號＋%（% 靠右），下行金額對齊代號（計畫 20261112-sidebar-and-donut） */
/* 最寬 16rem：電腦上 % 靠右時才不會被推到整張卡片最右邊、離代號太遠（Chrome 看到的） */
.stock-legend { display: grid; gap: 0.45rem; margin: 0; padding: 0; list-style: none; font-size: 0.85rem; min-width: 0; max-width: 16rem; }
.stock-legend li { display: grid; gap: 0.05rem; min-width: 0; }
.stock-legend-top { display: flex; align-items: center; gap: 0.4rem; }
.stock-legend-pct { margin-left: auto; }
.stock-legend-value { padding-left: calc(10px + 0.4rem); color: var(--c-text-secondary); overflow-wrap: anywhere; }
.stock-legend i { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 2px; }
.stock-quotes { display: grid; }
.stock-quote { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.75rem; align-items: center; padding: 0.65rem 0; border-bottom: 1px solid var(--c-border); }
.stock-quote:last-child { border-bottom: 0; }
.stock-quote-sub { display: block; }
.stock-quote-price { display: grid; justify-items: end; text-align: right; }
.stock-tag { display: inline-block; margin-left: 0.25rem; padding: 0 0.35rem; border-radius: 4px; background: var(--c-surface-muted); color: var(--c-text-secondary); font-size: 0.7rem; vertical-align: 1px; }
.stock-badge { min-width: 4.6rem; padding: 0.3rem 0.4rem; border: 0; border-radius: 6px; color: var(--stock-on-color); font-size: 0.85rem; font-weight: 700; text-align: center; }
/* 可點的色塊（% ⇄ 金額）：手指好按、看得出能按 */
button.stock-badge { min-height: 32px; cursor: pointer; font-family: inherit; }
.stock-badge.is-up { background: var(--stock-up); }
.stock-badge.is-down { background: var(--stock-down); }
.stock-badge.is-flat { background: var(--c-surface-muted); color: var(--c-text-secondary); }
.stock-empty { display: grid; justify-items: center; gap: 0.75rem; margin: 0 0 1rem; padding: 2rem 1rem; border: 1px dashed var(--c-border); border-radius: 12px; }
.stock-empty p { margin: 0; color: var(--c-text-secondary); }

/* 設定：漲跌顏色（範例數字固定用綠／紅，看得出兩個選項的差別） */
.stock-radio { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-height: 40px; }
.stock-sample { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.stock-sample-green { color: #3fcf8e; }
.stock-sample-red { color: #ff6b6b; }
.stock-color-form .btn { justify-self: start; }

/* 手機：這頁不顯示 app 底部列（使用者選「分頁放底部（乙）」），換成 Stock 自己的固定底部列；「更多」往上展開 */
@media (max-width: 767px) {
  .dash:has(.stock-page) .sidebar { display: none; }
  .stock-tabs { display: none; }
  /* 留白加在內容區（不是 .stock-page）：頁尾在 .stock-page 後面，留白放錯地方頁尾最後一段會被固定的底部列蓋住（第 2 輪 review）。
     「↑」（.top-dock）是 sticky bottom: 0，算的是內容區扣掉這段留白之後的底，所以自動停在底部列上方，不用再另外往上移
     （第 3 輪 Chrome 量過：再加一次會離底部列 91px） */
  .dash-main:has(> .stock-page) { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
  .stock-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-bar); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); border-top: 1px solid var(--c-border); background: #131b23; }
  .stock-bottom > a, .stock-more > summary { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 56px;
    color: var(--c-text-secondary); text-decoration: none; font-size: 0.72rem; }
  .stock-bottom svg { width: 22px; height: 22px; }
  .stock-bottom > a.is-on, .stock-more.is-on > summary { color: var(--c-portfolio); font-weight: 700; }
  .stock-more > summary { list-style: none; cursor: pointer; }
  .stock-more > summary::-webkit-details-marker { display: none; }
  .stock-more > summary .count-badge { position: absolute; top: 4px; right: calc(50% - 24px); }
  .stock-more-menu { position: absolute; left: 0; right: 0; bottom: 100%; display: grid; border-top: 1px solid var(--c-border); background: var(--c-surface);
    padding: 0.25rem max(1rem, env(safe-area-inset-right)) 0.25rem max(1rem, env(safe-area-inset-left)); box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.35); }
  .stock-more-menu a { display: flex; align-items: center; gap: 0.4rem; min-height: 48px; border-bottom: 1px solid var(--c-border); color: var(--c-text-primary); text-decoration: none; }
  .stock-more-menu a:last-child { border-bottom: 0; }
  .stock-more-menu a.is-on { color: var(--c-portfolio); font-weight: 700; }
}
