/* 公文收發系統 視覺系統(票 01 定案；色票與元件沿用公文收發系統，兩套都是「整理乾淨的紙本夾」)
 *
 * 方向：像一份放在桌上、翻開就能批的公文夾。暖白紙底、深墨綠字、庭芳洋紅只用在「要你動手」的地方
 * (主要按鈕、目前分頁、焦點)。狀態色各司其職不混用：
 *   待辦的期限：正常綠(--ok)、三天內到期琥珀(--due)、逾期紅(--late)
 *   會簽的終點「已閱」用藍(--info)，待辦的終點「完成」用綠(--ok)：兩個按鈕顏色與字樣要明顯不同(規格)
 *   敏感公文打開時的紅字提醒用 --late
 * 手機優先：單欄、大觸控區(最小 44px)、整頁捲動(iPhone Safari 不做整頁 fixed 版面)；
 * 電腦版內容置中、最寬 880px。管理介面只在電腦(720px 以上)。
 *
 * token 分四組：顏色、字級、間距、圓角與陰影。元件只准用 token，不寫死數值。
 */
:root {
  /* 顏色：底與字 */
  --bg: #F6F4EF; --surface: #FFFFFF; --surface-2: #F0EEE8; --surface-3: #E9E6DE;
  --ink: #1E2926; --ink-2: #3F4A46; --muted: #6A746F; --ph: #9CA39F;
  --line: #E4E1D9; --line-2: #D3CFC5;
  /* 品牌：庭芳洋紅(按鈕底用深一階，白字對比 5:1 以上) */
  --brand: #E4007F; --primary: #C8006F; --primary-hover: #A8005D; --primary-soft: #FCEAF3; --on-primary: #FFFFFF;
  /* 狀態 */
  --late: #B42318; --late-soft: #FDECEA; --late-line: #F4C7C2;
  --due: #9A5800; --due-soft: #FFF4DF; --due-line: #F1D9A6;
  --ok: #1D6B45; --ok-soft: #E5F3EB;
  --info: #2A5B9A; --info-soft: #E8F0FA;
  --focus: rgba(200, 0, 111, .24);
  /* 字級(手機基準 16px，不小於 13px) */
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 21px; --fs-2xl: 26px;
  /* 間距：4 的倍數 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;
  /* 圓角與陰影 */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(30, 41, 38, .05), 0 2px 10px rgba(30, 41, 38, .04);
  --shadow-2: 0 2px 4px rgba(30, 41, 38, .06), 0 10px 28px rgba(30, 41, 38, .08);
  --shadow-3: 0 18px 50px rgba(30, 41, 38, .22);
  --wrap: 880px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141716; --surface: #1C201F; --surface-2: #232826; --surface-3: #2B312F;
    --ink: #ECEFEC; --ink-2: #CBD1CD; --muted: #98A29D; --ph: #6C7571;
    --line: #2C3230; --line-2: #3A413E;
    --brand: #FF4DA6; --primary: #FF5CAD; --primary-hover: #FF85C1; --primary-soft: #3A1B2B; --on-primary: #1B0912;
    --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
    --due: #F4B860; --due-soft: #372A12; --due-line: #54401C;
    --ok: #6FD19A; --ok-soft: #16301F; --info: #8DB6F2; --info-soft: #1A2638;
    --focus: rgba(255, 92, 173, .32);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 8px 24px rgba(0, 0, 0, .35); --shadow-3: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141716; --surface: #1C201F; --surface-2: #232826; --surface-3: #2B312F;
  --ink: #ECEFEC; --ink-2: #CBD1CD; --muted: #98A29D; --ph: #6C7571;
  --line: #2C3230; --line-2: #3A413E;
  --brand: #FF4DA6; --primary: #FF5CAD; --primary-hover: #FF85C1; --primary-soft: #3A1B2B; --on-primary: #1B0912;
  --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
  --due: #F4B860; --due-soft: #372A12; --due-line: #54401C;
  --ok: #6FD19A; --ok-soft: #16301F; --info: #8DB6F2; --info-soft: #1A2638;
  --focus: rgba(255, 92, 173, .32); color-scheme: dark;
}

/* ── 基礎 ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* [hidden] 的預設權重最低，任何自己寫的 display 都蓋得過它，所以要 !important */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: var(--fs-md); line-height: 1.6; color: var(--ink); background: var(--bg);
       min-height: 100vh; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.view { max-width: var(--wrap); margin: 0 auto;
        padding: var(--s5) max(var(--s4), env(safe-area-inset-right)) calc(var(--s8) + env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left)); }

/* ── 頂欄：用 sticky 黏在上方 (Jacky 2026-09-30)；整頁照常捲動、不用 fixed，iPhone Safari 的工具列才不會蓋住內容 ── */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, var(--surface)); border-bottom: 1px solid var(--line); }
.top-in { max-width: var(--wrap); margin: 0 auto; height: 60px; display: flex; align-items: center; gap: var(--s3);
          padding: 0 max(var(--s4), env(safe-area-inset-right)) 0 max(var(--s4), env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: var(--fs-lg);
         letter-spacing: .02em; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 右邊：電腦是一排文字連結「名字｜管理｜臉或指紋綁定｜登出」(照物資系統、FB 回覆系統)，手機是名字按鈕加選單。
   斷點 720px 跟物資系統、管理儀表板、交班系統同一個數字；app.js 的 寬螢幕() 也用 720px。 */
.me { margin-left: auto; position: relative; }
.me-links { display: flex; align-items: center; gap: var(--s4); font-size: var(--fs-sm); white-space: nowrap; }
.me-links b { color: var(--ink); }
.me-role { color: var(--muted); font-size: var(--fs-xs); margin-left: -8px; }
.me-links a, .me-links button { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0;
                                padding: 4px 0; font: inherit; cursor: pointer; }
.me-links a:hover, .me-links button:hover { color: var(--primary); }
.me-links a[aria-current="page"] { color: var(--primary); font-weight: 700; }
.me-links [hidden] { display: none; }
.me-btn { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px solid var(--line-2);
          background: var(--surface); border-radius: var(--r-pill); cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2);
          max-width: 10em; }
.me-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn:hover { border-color: var(--primary); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 200px; background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 6px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
                        padding: 12px; border-radius: var(--r-sm); color: var(--ink); font-size: var(--fs-md); }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
@media (min-width: 720px) { .me-btn, .menu { display: none !important; } }
/* 手機不出現「管理」(跨系統既定規則)：管理連結只在電腦那一排裡，手機整排藏起來 */
@media (max-width: 719px) { .me-links { display: none; } .brand { font-size: var(--fs-md); } }

/* ── 按鈕 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
       border: 0; border-radius: var(--r-pill); cursor: pointer; font-weight: 700; white-space: nowrap;
       background: var(--primary); color: var(--on-primary); transition: background .15s, transform .06s, box-shadow .15s;
       box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 12px color-mix(in srgb, var(--primary) 22%, transparent); }
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn.quiet { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.quiet:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.actions { display: flex; gap: var(--s2); margin-top: var(--s5); }
.actions .btn { flex: 1; }

/* ── 輸入 ── */
.field { display: block; }
.field + .field { margin-top: var(--s4); }
.field > span { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 48px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 10px 14px; outline: none; font-size: var(--fs-md); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
input::placeholder, textarea::placeholder { color: var(--ph); }

/* ── 卡片、標籤、提示條 ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: var(--s5); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
        font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.chip.late { background: var(--late-soft); color: var(--late); }
.chip.due { background: var(--due-soft); color: var(--due); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brand { background: var(--primary-soft); color: var(--primary); }
.chip svg { width: 14px; height: 14px; }
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md);
          font-size: var(--fs-sm); background: var(--info-soft); color: var(--info); }
.banner.warn { background: var(--due-soft); color: var(--due); }
.banner.late { background: var(--late-soft); color: var(--late); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ── 頁首(每一頁的標題列) ── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.page-head h1 { font-size: var(--fs-2xl); line-height: 1.25; letter-spacing: .01em; }
.page-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

/* ── 分頁(清單的四個分頁)：平均分配寬度，不換行 ── */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill);
        overflow: hidden; margin-bottom: var(--s5); }
.tab { flex: 1 1 auto; min-width: 0; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 12px;
       border-radius: var(--r-pill); color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.tab .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: inline-grid; place-items: center;
              font-size: 12px; background: var(--surface-3); color: var(--muted); }
.tab.on .count { background: var(--primary-soft); color: var(--primary); }
/* 手機：四個分頁依內容寬度分配 (未完成、進行中最多 2 位數，已完成 4 位數，不用處理 3 位數)，一排全部看得到、跟卡片同寬、不左右滑 (Jacky 2026-09-30，390 與 360px 都要放得下) */
@media (max-width: 719.98px) {
  .tabs { gap: 2px; padding: 3px; }
  .tab { gap: 3px; padding: 0 2px; min-height: 38px; font-size: 13px; letter-spacing: -.01em; }
  .tab .count { min-width: 17px; height: 17px; padding: 0 4px; font-size: 10.5px; }
}

/* ── 待處理事項卡片(票 02 起用)：左邊一條狀態色，一眼分出逾期、今天到期 ── */
.items { display: grid; gap: var(--s3); }
.item { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
        box-shadow: var(--shadow-1); padding: var(--s4) var(--s4) var(--s4) calc(var(--s4) + 4px); color: var(--ink); overflow: hidden;
        transition: box-shadow .15s, border-color .15s, transform .06s; }
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-2); }
.item:hover { text-decoration: none; box-shadow: var(--shadow-2); border-color: var(--line-2); }
.item:active { transform: scale(.995); }
.item.late { border-color: var(--late-line); } .item.late::before { background: var(--late); }
.item.due::before { background: var(--due); }
.item.done { opacity: .78; } .item.done::before { background: var(--ok); }
.item-top { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: 6px; }
.item h3 { font-size: var(--fs-lg); line-height: 1.45; font-weight: 800; }
.item .act { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 4px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: var(--s3); font-size: var(--fs-xs); color: var(--muted); }
.item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.item .meta svg { width: 14px; height: 14px; opacity: .8; }
.deadline { margin-left: auto; font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.item.late .deadline { color: var(--late); } .item.due .deadline { color: var(--due); }
@media (min-width: 720px) {
  .item { display: grid; grid-template-columns: 1fr auto; column-gap: var(--s5); padding: var(--s5) var(--s5) var(--s5) calc(var(--s5) + 4px); }
  .item-top { grid-column: 1 / -1; }
  .item .meta { grid-column: 1 / -1; }
}

/* ── 空狀態 ── */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s8) var(--s5);
         background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty .art { width: 96px; height: 96px; margin-bottom: var(--s2); }
.empty h2 { font-size: var(--fs-xl); }
.empty p { color: var(--muted); font-size: var(--fs-sm); max-width: 28em; }

/* ── 登入與門口(尚未開通)頁 ──
   版面、文字、配色逐項照人事帳號系統示範站 demo.tinfun.org.tw(Jacky 指定的各系統登入範本)，只有系統名稱不同。
   示範站只有亮色，所以登入頁不跟著深色模式走：html.gate-mode 時整組色票換成示範站的(app.js 的 門口() 掛上、畫外框() 拿掉)。
   選擇器多掛一個 :root 是為了壓過上面深色模式那條 :root:not([data-theme="light"])。 */
html.gate-mode:root {
  --bg: #F7F7F3; --surface: #FFFFFF; --ink: #303735; --ink-2: #303735; --muted: #66706D; --ph: #929996;
  --primary: #E4007F; --primary-hover: #B10063; --primary-soft: #FDEEF6; --on-primary: #FFFFFF;
  --line: #E0E4DF; --line-2: #D9DED9; --focus: rgba(228, 0, 127, .12);
  --ok: #1B5E33; --late: #A32C15;
  color-scheme: light;
}
html.gate-mode body { line-height: 1.7; }
/* 上方留白刻意小(示範站：logo 上面不要空太多)，不做垂直置中 */
.gate { max-width: 26rem; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; text-align: center; }
html.gate-mode .view { padding-top: 0; }
.gate .logo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto .7rem;
              box-shadow: 0 6px 18px rgba(48, 55, 53, .16); }
.gate h1 { font-size: 1.45rem; margin-bottom: .25rem; line-height: 1.7; }
/* 卡片寬度跟著裡面那條 200px 直欄走(--欄寬 只寫這裡一處，標籤、輸入框、兩顆按鈕、忘記登入碼都切齊它) */
.gate .card { --欄寬: 200px; max-width: 16rem; margin: 0 auto; padding: 1.5rem 1.4rem; text-align: left; border-radius: 16px;
              box-shadow: 0 1px 2px rgba(48, 55, 53, .05), 0 8px 24px rgba(48, 55, 53, .06); }
.gate .field { width: var(--欄寬); margin: 0 auto 1.1rem; }
.gate .field + .field { margin-top: 0; }
.gate .field > span { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; color: var(--muted); }
.gate input[type=text], .gate input[type=tel] { min-height: 0; font-size: 1rem; line-height: 1.7; border: 1.5px solid var(--line-2);
              border-radius: 10px; padding: .55em .75em; }
.gate input:focus { box-shadow: 0 0 0 3px var(--focus); }
/* 四位數字碼：固定寬置中、四個點的 placeholder；左邊多 12px 補 letter-spacing 在最後一字後面多的那格 */
.gate #code { font-size: 28px; letter-spacing: 12px; text-align: center; padding: 10px 0 10px 12px; border-width: 2px; border-radius: 12px; }
/* 登入那一列：左半「登入」、右半臉或指紋的圖示鈕，兩顆同色同高；忘記登入碼是右下角一行底線文字 */
.gate .btn { min-height: 0; font-weight: 600; box-shadow: 0 2px 8px rgba(177, 0, 99, .22); }
.gate .login-actions { display: flex; gap: .6rem; width: var(--欄寬); margin: 0 auto; }
.gate .login-actions .btn { flex: 1 1 0; font-size: 1.05rem; padding: .85em 0; }
.gate .login-actions .btn svg { width: 30px; height: 30px; }
.gate #passkey[aria-busy="true"] { opacity: .45; }
.gate .forgot { width: var(--欄寬); margin: 1rem auto 0; text-align: right; font-size: .875rem; }
.gate .forgot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.gate-closed { text-align: center; }
.gate-closed .art { width: 88px; height: 88px; margin: 0 auto var(--s3); }
.gate-closed h2 { font-size: var(--fs-xl); }
.gate-closed p { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--s2); }
.gate-closed .btn.ghost { box-shadow: none; padding: .45em 1em; }
/* 登入頁的彈窗照示範站：置中、上緣色帶就是語氣(綠＝成功、紅＝失敗)，一顆「關閉」 */
html.gate-mode .modal-bg { background: rgba(48, 55, 53, .45); align-items: center; padding: 1.25rem; }
.modal.gate-modal { max-width: 19rem; padding: 1.5rem 1.4rem; text-align: center; border-radius: 16px; border-top: 5px solid var(--line);
                    box-shadow: 0 12px 40px rgba(48, 55, 53, .28); }
.modal.gate-modal.ok { border-top-color: var(--ok); }
.modal.gate-modal.no { border-top-color: var(--late); }
.modal.gate-modal .modal-msg { font-size: 1rem; line-height: 1.75; margin-bottom: 1.25rem; word-break: break-word; }
.modal.gate-modal .btn { font-size: 1.05rem; padding: .85em 1.6em; }

/* ── 彈窗、提示、載入 ── */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20, 23, 22, .45); display: grid; place-items: center; padding: var(--s4); }
.modal { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: var(--s6) var(--s5) var(--s5); }
.modal p { font-size: var(--fs-md); line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
         background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: var(--r-pill); font-size: var(--fs-sm);
         font-weight: 700; box-shadow: var(--shadow-3); max-width: calc(100vw - 32px); }
.loading { display: grid; place-items: center; min-height: 160px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 2s !important; } }

/* ── 樣式頁(#/style)：視覺系統的樣張，截圖自查用 ── */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s2); }
.swatch { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); font-size: var(--fs-xs); }
.swatch i { display: block; height: 44px; }
.swatch b, .swatch span { display: block; padding: 0 10px; }
.swatch b { padding-top: 6px; } .swatch span { color: var(--muted); padding-bottom: 8px; }
.section-title { font-size: var(--fs-sm); font-weight: 800; color: var(--muted); letter-spacing: .08em; margin: var(--s7) 0 var(--s3); }
.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ── 詳細頁(票 02)：上面是這件事(要做什麼、什麼時候前)，下面是原信全文與附件 ── */
.muted { color: var(--muted); }
.deadline.muted { color: var(--muted); font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: calc(-1 * var(--s2)) 0 var(--s2) -6px;
        color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); }
.back svg { width: 20px; height: 20px; }
.back:hover { color: var(--primary); text-decoration: none; }
.detail h1 { font-size: var(--fs-xl); line-height: 1.4; margin-top: var(--s2); }
.todo { margin-top: var(--s4); padding: var(--s3) var(--s4); background: var(--primary-soft); border-radius: var(--r-md); }
.todo span { display: block; font-size: var(--fs-xs); font-weight: 800; color: var(--primary); letter-spacing: .08em; }
.todo p { margin-top: 2px; font-weight: 700; color: var(--ink); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s4); }
.facts dt, .mail-meta dt { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.facts dd { font-weight: 800; font-variant-numeric: tabular-nums; }
.mail { padding: var(--s5) var(--s4); }
.mail-subject { font-size: var(--fs-lg); line-height: 1.45; margin-bottom: var(--s2); }
.mail-meta { display: grid; gap: var(--s2); margin: var(--s3) 0 var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mail-meta > div { display: grid; grid-template-columns: 5em 1fr; gap: var(--s2); align-items: baseline; }
.mail-meta dd { font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.addr { color: var(--muted); font-size: var(--fs-xs); }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--r-pill); margin-bottom: var(--s3); }
.seg button { border: 0; background: none; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
/* 原信 HTML 放 sandbox iframe，量不到內容高度，所以給固定高度、框內自己捲 */
.mail-frame { display: block; width: 100%; height: 62vh; min-height: 320px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-md); line-height: 1.75; }
.att-title { display: flex; align-items: center; gap: 6px; margin-top: var(--s5); font-size: var(--fs-sm); font-weight: 800; color: var(--ink-2); }
.att-title svg { width: 16px; height: 16px; }
.atts { list-style: none; display: grid; gap: var(--s2); margin-top: var(--s2); }
.att { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.att.bad { background: var(--late-soft); border-color: var(--late-line); }
.att-name { flex: 1; min-width: 0; display: grid; }
.att-name b { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.att-name span { font-size: var(--fs-xs); color: var(--muted); }
.mail-foot { margin-top: var(--s4); font-size: var(--fs-xs); color: var(--ph); text-align: right; }

/* 票 03：期限與國定假日 */
.facts dd.facts-note { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin-top: 2px; }
.late-text { color: var(--late); } .due-text { color: var(--due); }

/* 票 04：勾選與修正 */
/* 未完成清單上的「勾完成」：卡片右下角一顆 48px 圓鈕(手機拇指按得到)，卡片本身仍整張可點進詳細頁 */
.item-wrap { position: relative; transition: opacity .25s, transform .25s; }
.item-wrap.gone { opacity: 0; transform: translateX(24px); }
.item.has-quick .meta, .item.has-quick h3 { padding-right: 56px; }
@media (min-width: 720px) { .item.has-quick { padding-right: calc(var(--s5) + 60px); } .item.has-quick .meta, .item.has-quick h3 { padding-right: 0; } }
.quick { position: absolute; right: var(--s3); bottom: var(--s3); width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
         display: grid; place-items: center; border: 2px solid var(--line-2); background: var(--surface); color: var(--muted);
         transition: background .15s, color .15s, border-color .15s, transform .06s; }
.quick svg { width: 24px; height: 24px; }
.quick:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.quick:active { transform: scale(.92); background: var(--ok); color: #fff; border-color: var(--ok); }
@media (min-width: 720px) { .quick { top: 50%; bottom: auto; margin-top: -24px; right: var(--s5); } .quick:active { transform: scale(.92); } }
/* 已完成、不用處理的卡片：誰何時勾的 */
.item .by { grid-column: 1 / -1; display: flex; gap: 6px; align-items: flex-start; margin-top: var(--s3); padding-top: var(--s2);
            border-top: 1px dashed var(--line); font-size: var(--fs-xs); color: var(--ink-2); }
.item .by svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.item .by.done svg { color: var(--ok); }
.item .by b { color: var(--muted); }
/* 詳細頁的動作列：手機上兩顆並排、滿寬 */
.act-bar { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s2); margin-top: var(--s5); }
.act-bar .btn { min-height: 52px; font-size: var(--fs-md); }
@media (min-width: 720px) { .act-bar { display: flex; } .act-bar .btn { min-width: 160px; } }
.state-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s5);
             padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); }
.state-box.done { background: var(--ok-soft); }
.state-box > div { display: flex; gap: var(--s2); align-items: flex-start; min-width: 0; }
.state-box svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.state-box.done > div svg { color: var(--ok); }
.btn.small svg { width: 16px; height: 16px; }
/* 處理紀錄 */
.timeline { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s3) var(--s4); }
.timeline li { position: relative; display: grid; grid-template-columns: 6.5em 1fr; gap: var(--s3); padding: 8px 0 8px 18px; font-size: var(--fs-sm); }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 6.5px; top: 25px; bottom: -9px; width: 1px; background: var(--line); }
.timeline li.done::before { background: var(--ok); } .timeline li.dismissed::before { background: var(--muted); } .timeline li.open::before { background: var(--primary); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline span { overflow-wrap: anywhere; }
/* 原信底部的「手動加入事項」 */
.add-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s5);
           padding: var(--s4); border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.add-row > div { display: grid; min-width: 0; flex: 1 1 14em; }
.add-row b { font-size: var(--fs-sm); } .add-row span { font-size: var(--fs-xs); color: var(--muted); }
.add-row .btn { flex: 1 0 auto; }
/* 彈窗表單 */
.modal-title { font-size: var(--fs-xl); line-height: 1.35; }
.modal-sub { color: var(--muted); font-size: var(--fs-sm) !important; margin: 4px 0 var(--s4); overflow-wrap: anywhere; }
.modal .hint { font-size: var(--fs-xs) !important; color: var(--muted); margin-top: var(--s2); }
.modal .field + .field { margin-top: var(--s3); }
textarea { resize: vertical; line-height: 1.6; }
@media (max-width: 480px) { .modal-bg { align-items: end; padding: 0; } .modal { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom)); } }
/* 提示條上的「復原」 */
.toast { display: flex; align-items: center; gap: var(--s3); width: max-content; }
.toast > span { white-space: nowrap; }
.toast-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--primary-soft); font-weight: 800;
             cursor: pointer; min-height: 32px; padding: 0 4px; font-size: var(--fs-sm); white-space: nowrap; flex: none; }
.toast-btn svg { width: 16px; height: 16px; }
/* 管理頁：判斷依據升版素材 */
.cor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.cor-head .seg { margin-bottom: 0; }
.cor-reason { color: var(--ink-2); }

/* ── 後續來信(票 05)：有新來信用藍色(狀態色「有新來信」)，不跟逾期紅、今天到期琥珀搶 ── */
.item.new-mail { border-color: var(--info); box-shadow: 0 0 0 1px var(--info), var(--shadow-1); }
.item.new-mail:not(.late):not(.due)::before { background: var(--info); }
.new-mail-note { margin-bottom: var(--s3); }
.new-mail-bar { align-items: center; margin-bottom: var(--s3); }
.new-mail-bar > div { flex: 1; min-width: 0; }
.new-mail-bar .btn { flex: none; }
.follow-ups { list-style: none; display: grid; gap: var(--s2); }
.follow-ups a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); color: var(--ink); }
.follow-ups a:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-1); }
.follow-ups .fu-top { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; }
.follow-ups .fu-top span { display: inline-flex; align-items: center; gap: 4px; }
.follow-ups .fu-top svg { width: 14px; height: 14px; opacity: .8; }
.follow-ups time { font-variant-numeric: tabular-nums; }
.follow-ups b { display: block; overflow-wrap: anywhere; }
.follow-ups p { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 2px; }
.follow-ups .fu-tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.follow-ups .fu-tags .chip { height: auto; min-height: 24px; padding: 2px 10px; }
.timeline li.info::before { background: var(--info); }
@media (max-width: 480px) { .new-mail-bar { flex-wrap: wrap; } .new-mail-bar .btn { margin-left: 32px; } }

/* ── 略過規則(票 09)：管理頁一段清單加原信頁的「建立略過規則」 ── */
.skip-help { list-style: none; display: grid; gap: 6px; margin: 0 0 var(--s4); padding: var(--s3) var(--s4); background: var(--surface-2); border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--ink-2); }
.skip-help b { color: var(--ink); }
.btn.danger { color: var(--late); }
.btn.danger:hover { background: var(--late-soft); }
.btn.danger-fill { background: var(--late); color: #fff; box-shadow: none; }
.btn.danger-fill:hover { background: color-mix(in srgb, var(--late) 85%, #000); }
.skip-preview:not(:empty) { display: flex; gap: var(--s2); align-items: flex-start; margin-top: var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--primary-soft); font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; }
.skip-preview svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--primary); }
.modal #skipErr { margin-top: var(--s3); }
.skip-row { margin-top: var(--s3); }
/* 收件處理人(票 10) */
.rcp-mail { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.rcp-warn { display: inline-flex; gap: 6px; align-items: flex-start; color: var(--late); }
.rcp-warn svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.rcp-fill { display: flex; gap: var(--s2); margin-top: var(--s2); }
.rcp-fill input { min-height: 40px; padding: 6px 12px; font-size: var(--fs-sm); }
.rcp-fill .btn { flex: none; min-height: 40px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger-fill { color: #1B0912; } }
:root[data-theme="dark"] .btn.danger-fill { color: #1B0912; }

/* 票 14：「我來處理」進行中 */
/* 別人處理中：沉穩的深色小標；我處理中：庭芳洋紅，一眼看得出是自己的 */
.chip.claim { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.chip.mine { background: var(--primary); color: var(--on-primary); }
/* 卡片上的「我來處理」：有字的膠囊鈕，跟勾完成的圓鈕同一個位置(手機拇指按得到) */
.quick.claim { width: auto; height: 44px; padding: 0 16px 0 12px; gap: 6px; border-radius: var(--r-pill); display: inline-flex; align-items: center;
               border-color: var(--primary); color: var(--primary); background: var(--surface); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.quick.claim svg { width: 18px; height: 18px; }
.quick.claim:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.quick.claim:active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.item.has-quick-wide .meta, .item.has-quick-wide h3 { padding-right: 124px; }
@media (max-width: 719px) { .item.has-quick-wide h3 { padding-right: 0; } .item.has-quick-wide .meta { padding-right: 124px; } }
@media (min-width: 720px) { .quick.claim { margin-top: -22px; } .item.has-quick-wide { padding-right: calc(var(--s5) + 136px); } .item.has-quick-wide .meta, .item.has-quick-wide h3 { padding-right: 0; } }
/* 詳細頁：三顆按鈕。手機上主要那顆一整排，另外兩顆並排 */
.act-bar.three { grid-template-columns: 1fr 1fr; }
.act-bar.three .btn:first-child { grid-column: 1 / -1; }
@media (min-width: 720px) { .act-bar.three .btn:first-child { grid-column: auto; } }
.act-hint { margin-top: var(--s2); font-size: var(--fs-xs); color: var(--muted); }
.admin-row { margin-top: var(--s2); }
.state-box.claim { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.state-box.claim.mine { background: var(--primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent); }
.state-box.claim > div svg { color: var(--ink-2); }
.state-box.claim.mine > div svg, .state-box.claim.mine b { color: var(--primary); }
.timeline li.claim::before { background: var(--ink-2); }
/* 改派的選人清單 */
.pick { display: grid; gap: var(--s2); margin-top: var(--s4); max-height: 50vh; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: var(--s2) var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-md); cursor: pointer; background: var(--surface); }
.pick-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pick-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.pick-row span { display: grid; }
.pick-row small { color: var(--muted); font-size: var(--fs-xs); }

/* 票 13：處理人名單 (開通／停用) */
.mem-ava { display: grid; place-items: center; width: 40px; height: 40px; margin: 2px 0 0 2px; border-radius: 50%;
           background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: var(--fs-sm); }
.mem-row.off .mem-ava { background: var(--surface); color: var(--muted); }
.mem-effects { margin-top: var(--s3); }
.pick-list { list-style: none; display: grid; gap: 6px; max-height: 280px; overflow-y: auto; margin-top: var(--s2); }
.pick-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 8px 8px 8px 12px;
                border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.pick-list li[hidden] { display: none; }
.pick-list li > div { display: grid; min-width: 0; }
.pick-list li .muted { font-size: var(--fs-xs); }
.pick-list .btn { flex: none; }
#memFind { margin-top: 2px; }
.mem-byid summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--primary); min-height: 40px; display: flex; align-items: center; gap: 6px; list-style: none; }
.mem-byid summary::-webkit-details-marker { display: none; }
.mem-byid summary svg { width: 16px; height: 16px; }
.mem-ava { font-size: var(--fs-md, 1rem); }
.modal #memErr { margin-top: var(--s3); }

/* 管理功能只在電腦版 (跟管理頁同一條規則，720px)：手機上藏起改派與建立略過規則 */
@media (max-width: 719.98px) { .pc-only { display: none !important; } }
@media (min-width: 720px) { .mobile-only { display: none !important; } }

/* 清單頁的標題與分頁、詳細頁的「回清單」黏在頂欄下方 (Jacky 2026-09-30)。只用 sticky，整頁仍正常捲動 */
.stick-head { position: sticky; top: 60px; z-index: 20; background: var(--bg);
              margin: 0 calc(-1 * var(--s4)); padding: var(--s3) var(--s4) 0; }
.stick-head .tabs { margin-bottom: var(--s3); }
.stick-back { padding-top: var(--s2); padding-bottom: var(--s1); }
.stick-back .back { margin-top: 0; margin-bottom: 0; }

/* 手機：卡片右下的按鈕 (勾完成 48px、我來處理 44px) 只跟最底下的寄件者時間列並排，不往上蓋到建議動作 (Jacky 2026-09-30) */
@media (max-width: 719.98px) {
  .item.has-quick .meta { min-height: 48px; align-content: center; }
  .item.has-quick-wide .meta { min-height: 44px; align-content: center; }
}

/* ── 上次讀取信件 (2026-09-30)：清單頁標題右邊一行小字；手機在標題下方，仍在黏住的那一塊裡 ──
   正常：綠點加時間。超過 30 分鐘：字變黃 (今天到期同一個琥珀色) 加「讀取信件可能中斷」。還沒有回報：灰點「尚未讀取」。 */
.list-head { align-items: baseline; flex-wrap: wrap; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sync:empty { display: none; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.sync b { font-weight: 700; color: var(--ink-2); }
.sync.none i { background: var(--ph); }
.sync.stale, .sync.stale b { color: var(--due); }
.sync.stale i { background: var(--due); }
.sync-warn { font-weight: 800; padding: 1px 8px; border-radius: var(--r-pill); background: var(--due-soft); }
/* 手機：上次讀取信件跟標題同一行 (Jacky 2026-09-30，少一行讓清單多露一點)；中斷警示放不下時才換到下一行 */
@media (max-width: 719.98px) { .list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; column-gap: var(--s3); row-gap: 2px; margin-bottom: var(--s3); } .list-head .sync { flex-wrap: wrap; row-gap: 2px; } .list-head .sync:empty { display: none; } }

/* ── 管理頁 (2026-09-30 改版)：左側導覽列六塊，右邊只顯示一塊 ──
   只在電腦版 (720px 以上)。1100 以上：左欄 232px 固定在頂欄下；720 到 1099 (含 1024)：導覽列收成頂部 3 × 2 分段。
   管理頁整頁放寬到 1240px (頂欄跟著放寬，左右切齊)，其他頁照舊 880px。 */
html.admin-wide { --wrap: 1240px; }
.adm { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: var(--s7); align-items: start; }
.adm-side { position: sticky; top: calc(60px + var(--s5)); }
.adm-title { font-size: var(--fs-2xl); line-height: 1.25; margin: 2px 0 var(--s4) var(--s3); }
.adm-nav { display: grid; gap: 2px; }
.adm-link { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px 0 12px; border-radius: var(--r-md);
            color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); transition: background .15s, color .15s; }
.adm-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.adm-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.adm-link.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.adm-link.on svg { color: var(--primary); }
.adm-link.on::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--primary); }
.adm-name { flex: 1; min-width: 0; white-space: nowrap; }
.adm-badge { min-width: 24px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center;
             font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.adm-badge svg { width: 13px; height: 13px; color: inherit; }
.adm-link.on .adm-badge { background: var(--primary-soft); color: var(--primary); }
.adm-link .adm-badge.warn { background: var(--due-soft); color: var(--due); }
.adm-link .adm-badge.late { background: var(--late-soft); color: var(--late); }
.adm-link .adm-badge.ok { background: var(--ok-soft); color: var(--ok); padding: 0 6px; }
.adm-link .adm-badge.ok svg { color: var(--ok); }

/* 每一塊統一結構：標題列 (標題、一句說明、主要按鈕在右上)，下面是對齊的表格 */
.adm-main { min-width: 0; }
.adm-sec { display: grid; gap: var(--s4); }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); padding: 4px 0 var(--s4); border-bottom: 1px solid var(--line); }
.adm-head h2 { font-size: var(--fs-xl); line-height: 1.3; }
.adm-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; max-width: 46em; }
.adm-head p b { color: var(--ink-2); font-weight: 700; }
.adm-tools { display: flex; align-items: center; gap: var(--s3); flex: none; }
.adm-meta { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-meta:empty { display: none; }
.adm-foot { font-size: var(--fs-xs); color: var(--muted); line-height: 1.75; max-width: 60em; }
.adm-foot b { color: var(--ink-2); }
#memList, #calState { display: grid; gap: var(--s3); }
.adm-empty { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s7) var(--s5);
             background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.adm-empty .art { width: 72px; height: 72px; margin-bottom: var(--s1); }
.adm-empty h3 { font-size: var(--fs-lg); }
.adm-empty p { color: var(--muted); font-size: var(--fs-sm); max-width: 34em; }

/* 表格：表頭淡底、黏在頂欄下；數字靠右等寬；列操作固定在最右欄 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tbl th { position: sticky; top: 60px; z-index: 2; background: var(--surface-2); text-align: left; font-size: var(--fs-xs); font-weight: 700;
          color: var(--muted); letter-spacing: .06em; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
.tbl th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--r-lg) - 1px); }
.tbl tbody tr:last-child td:last-child { border-bottom-right-radius: calc(var(--r-lg) - 1px); }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.tbl tr.click { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .ops { text-align: right; white-space: nowrap; width: 1%; }
.tbl .ops .btn { vertical-align: middle; }
.tbl .ops .btn + .btn { margin-left: 2px; }
.tbl .mono { font-family: var(--font); font-size: var(--fs-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tbl select { width: auto; min-height: 36px; padding: 4px 30px 4px 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.tbl tr.off td, .tbl tr.off b { color: var(--muted); }
.cell-title { display: block; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; line-height: 1.5; }
a.cell-title:hover { color: var(--primary); text-decoration: none; }
.cell-sub { display: block; margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; line-height: 1.55; }
.cell-sub b { font-weight: 700; color: var(--ink-2); margin-right: 6px; }
.wrap { overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.who { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.who b { white-space: nowrap; }
.mid-only { display: none; }
.who .mem-ava { width: 32px; height: 32px; margin: 0; font-size: var(--fs-sm); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.state.on { color: var(--ok); font-weight: 700; }
.state.on::before { background: var(--ok); }
.ops-note { font-size: var(--fs-xs); padding-right: 14px; }
.c-time { width: 7.5em; white-space: nowrap; }
.tbl-unl .c-from { width: 26%; color: var(--ink-2); }
.c-att { width: 4.5em; }
.att-n { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-2); }
.att-n svg { width: 14px; height: 14px; }
.tbl-mem .c-role { width: 9em; }
.c-state { width: 9.5em; }
.tbl-mem .c-n { width: 8.5em; }
.tbl-mem .c-rcp { width: 8.5em; }
.tbl-rcp .c-who { width: 30%; }
.tbl-rcp tr.rcp-row.on td { background: color-mix(in srgb, var(--primary-soft) 38%, var(--surface)); }
.tbl-rcp .rcp-fill { max-width: 26em; }
.tbl-skip .c-hits { width: 7.5em; white-space: nowrap; }
.sr-sender { overflow-wrap: anywhere; }
.sr-kw { width: 24%; color: var(--ink-2); overflow-wrap: anywhere; }
.sr-hits b { font-size: var(--fs-lg); color: var(--ink); }
.sr-hits span { font-size: var(--fs-xs); color: var(--muted); margin-left: 4px; }
.tbl-cor .c-time .mono { display: block; }
.tbl-cor .c-reason { width: 30%; color: var(--ink-2); overflow-wrap: anywhere; }
.c-now { width: 8.5em; white-space: nowrap; }
.tbl-cal .c-year b { font-size: var(--fs-lg); color: var(--ink); }
.c-file { overflow-wrap: anywhere; color: var(--ink-2); }
.cor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
/* 略過規則怎麼寫：四條並成兩欄 */
.adm-sec .skip-help { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s6); margin: 0; padding: var(--s4) var(--s5); border: 1px solid var(--line); }
.adm-sec .skip-help li { display: grid; gap: 2px; align-content: start; }
.adm-sec .skip-help li > span { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.65; }
/* 收彙整信的開關 (還是一個 checkbox，只換外觀) */
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; cursor: pointer; vertical-align: middle; margin-right: 10px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line-2); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
                      box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { cursor: default; }
.switch input:disabled + span { opacity: .4; }
/* 未列入的信：勾選後刪除 (2026-10-01)。勾選框一欄、勾到的列淡紅底，刪除鈕在標題列右上 */
.c-pick { width: 44px; padding-right: 0 !important; }
.pick { width: 18px; height: 18px; margin: 0; accent-color: var(--late); cursor: pointer; vertical-align: middle; }
.tbl-unl tr.picked td { background: color-mix(in srgb, var(--late-soft) 55%, var(--surface)); }
.tbl-unl tr.picked:hover td { background: var(--late-soft); }
.adm-tools .btn.danger-fill svg { width: 16px; height: 16px; }
/* 國定假日：檔名可點，打開那一年的放假日與補班日 */
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; margin: -4px -8px; border: 0; border-radius: var(--r-sm); background: none;
            color: var(--primary); font: inherit; font-weight: 700; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.link-btn svg { width: 16px; height: 16px; flex: none; }
.link-btn:hover { background: var(--primary-soft); text-decoration: underline; text-underline-offset: 3px; }
.link-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.modal.cal-modal { max-width: 780px; max-height: calc(100vh - 2 * var(--s6)); overflow: auto; padding: var(--s5) var(--s6) var(--s6); }
.cal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.cal-top .modal-sub { margin-bottom: 0; }
.cal-top .btn { flex: none; min-height: 36px; width: 36px; padding: 0; }
.cal-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin: var(--s4) 0 var(--s2); }
.cal-stat { display: grid; gap: 2px; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); }
.cal-stat b { font-size: var(--fs-2xl); line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.cal-stat span { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }
.cal-stat small { font-size: var(--fs-xs); color: var(--muted); }
.cal-stat.off { background: var(--late-soft); } .cal-stat.off b { color: var(--late); }
.cal-stat.work { background: var(--info-soft); } .cal-stat.work b { color: var(--info); }
.cal-h { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-md); margin: var(--s5) 0 var(--s3); }
.cal-h span { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.cal-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.cal-month { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s3) var(--s2); background: var(--surface); }
.cal-month h4 { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s1); letter-spacing: .04em; }
.cal-month ul, .cal-work { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cal-work { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2) var(--s3); }
.cal-day { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-sm); line-height: 1.6; }
.cal-date { flex: none; min-width: 5.6em; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day.off .cal-date { color: var(--late); }
.cal-day.work .cal-date { color: var(--info); }
.cal-work .cal-day { padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--info-soft); }
.cal-note { color: var(--ink-2); overflow-wrap: anywhere; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.cal-foot p { font-size: var(--fs-xs) !important; color: var(--muted); line-height: 1.65; }
.cal-foot .btn { flex: none; }
@media (max-width: 760px) { .cal-months, .cal-work { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cal-foot { flex-wrap: wrap; } }
/* 720 到 1099：導覽列收成頂部 3 × 2 分段；處理人名單的「進行中、彙整信」併到姓名下面，表格不超出畫面 */
@media (max-width: 1099.98px) {
  .adm { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .adm-side { position: static; }
  .adm-title { margin: 0 0 var(--s3); }
  .adm-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-lg); }
  .adm-link { justify-content: center; min-height: 42px; padding: 0 10px; }
  .adm-link.on::before { display: none; }
  .adm-name { flex: none; }
  .adm-head { flex-wrap: wrap; align-items: flex-start; }
  .adm-sec .skip-help { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding-left: 12px; padding-right: 12px; }
  .tbl-unl .c-from { width: 22%; }
  .tbl-mem .c-n, .tbl-mem .c-rcp { display: none; }
  .mid-only { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; padding-left: 40px; }
  .mid-only:empty { display: none; }
  .c-state { width: auto; }
}


/* ── 票 01：首頁空殼與角色卡 ── */
.home-hello { margin-bottom: var(--s5); }
.home-hello h1 { font-size: var(--fs-2xl); line-height: 1.25; }
.home-hello p { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.role-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
             background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: var(--fs-sm); }
.sections { display: grid; gap: var(--s3); }
@media (min-width: 720px) { .sections { grid-template-columns: 1fr 1fr; } }
.section-card h2 { font-size: var(--fs-lg); margin-bottom: 4px; }
.section-card p { color: var(--muted); font-size: var(--fs-sm); }
.section-card .soon { margin-top: var(--s3); }

/* ── 管理介面：行政名單與挑人 ── */
.admin-tabs { margin-bottom: var(--s5); }
.people { display: grid; gap: var(--s2); }
.person { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line);
          border-radius: var(--r-md); }
.person .who { min-width: 0; flex: 1; }
.person .who b { display: block; }
.person .who small { color: var(--muted); font-size: var(--fs-xs); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.dim { opacity: .55; }
.search { margin-bottom: var(--s3); }
.dept-head { font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: .06em; margin: var(--s4) 0 var(--s2); }

/* ── 票 02：上傳 ── */
.section-card.link { display: block; color: var(--ink); }
.section-card.link:hover { text-decoration: none; box-shadow: var(--shadow-2); border-color: var(--line-2); }
.person.link { color: var(--ink); } .person.link:hover { text-decoration: none; border-color: var(--primary); }
.drop { display: grid; justify-items: center; gap: 4px; padding: var(--s6) var(--s4); border: 2px dashed var(--line-2); border-radius: var(--r-lg);
        background: var(--surface-2); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop.small { padding: var(--s4); grid-auto-flow: column; justify-content: start; gap: var(--s3); text-align: left; }
.drop-ic svg { width: 28px; height: 28px; color: var(--primary); }
.drop b { font-size: var(--fs-md); } .drop-hint { color: var(--muted); font-size: var(--fs-xs); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--s3); margin-top: var(--s3); }
.thumb { margin: 0; }
.thumb img { width: 100%; aspect-ratio: 210 / 297; object-fit: contain; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); display: block; }
.thumb.dup img { border-color: var(--due); box-shadow: 0 0 0 3px var(--due-soft); }
.thumb figcaption { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; text-align: center; }
.thumb figcaption small { display: block; font-size: 11px; }
.person.link svg, .file-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.file-link { display: inline-flex; align-items: center; gap: 6px; }

/* ── 票 03：核對頁 ── */
.review { display: grid; gap: var(--s4); }
@media (min-width: 960px) { .review { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } .review-pages { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; padding-right: 4px; } }
.review h2 { font-size: var(--fs-lg); margin-bottom: var(--s2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review .hint { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.pages { display: grid; gap: var(--s3); }
.page { margin: 0; }
.page img { width: 100%; display: block; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.page figcaption { font-size: var(--fs-xs); color: var(--muted); text-align: center; margin-top: 4px; }
.grid2 { display: grid; gap: var(--s3); } @media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2 .field + .field { margin-top: 0; } }
.fld .hint { display: block; margin-top: 4px; }
.src { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: var(--r-pill); margin-left: 4px; vertical-align: 1px; }
.src.ai { background: var(--info-soft); color: var(--info); } .src.human { background: var(--due-soft); color: var(--due); } .src.manual { background: var(--surface-3); color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin-top: var(--s4); font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.item-row { border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--r-md); padding: var(--s3); margin-top: var(--s3); background: var(--surface); }
.item-row.todo { border-left-color: var(--primary); }
.item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; } .item-head .del { margin-left: auto; min-height: 32px; padding: 0 8px; } .item-head .del svg { width: 16px; height: 16px; }
.item-row .title { margin-bottom: 6px; }
.item-dl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.item-dl select, .item-dl input[type=date] { width: auto; min-height: 40px; padding: 6px 10px; }
.item-dl .days { width: 72px; min-height: 40px; padding: 6px 8px; display: inline-block; }
.rel { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); }
input[readonly], textarea[readonly], select:disabled { background: var(--surface-2); color: var(--ink-2); }
.banner.sensitive b { color: var(--late); }
.adm-tools { display: flex; gap: var(--s2); }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ── 票 04：選人 ── */
.ppl-sec { margin-top: var(--s4); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.ppl-sec h3 { font-size: var(--fs-md); margin-bottom: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ppl-dept { font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: .06em; margin: var(--s3) 0 4px; }
.ppl-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ppl { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); }
.ppl input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.ppl:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.ppl.dim { opacity: .55; cursor: not-allowed; } .ppl small { color: var(--muted); font-size: 11px; }
.ppl.fixed { border-style: dashed; cursor: default; }

/* ── 票 05：首頁清單與動作 ── */
.sec-title { font-size: var(--fs-lg); margin-bottom: var(--s3); display: flex; align-items: center; gap: 8px; }
.count-pill { min-width: 24px; height: 24px; padding: 0 8px; border-radius: var(--r-pill); display: inline-grid; place-items: center; font-size: 13px; background: var(--surface-3); color: var(--muted); }
.empty.small { padding: var(--s5); } .empty.small .art { width: 64px; height: 64px; } .empty.small h2 { font-size: var(--fs-md); }
.item.ok::before { background: var(--ok); }
.todo-actions { display: grid; gap: var(--s3); margin-top: var(--s4); }
.act-card { border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: var(--r-md); padding: var(--s4); background: var(--surface); box-shadow: var(--shadow-1); }
.act-card.cosign { border-left-color: var(--info); }
.act-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; } .act-title b { font-size: var(--fs-md); }
.act-card .btn { margin-top: var(--s3); }
.act-card textarea { margin-top: var(--s3); }
.evid-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3); } .evid-row .btn { margin-top: 0; }
/* 「完成」綠、「已閱」藍：兩個終點按鈕顏色與字樣要明顯不同(規格) */
.btn.done { background: var(--ok); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px color-mix(in srgb, var(--ok) 25%, transparent); }
.btn.done:hover { background: color-mix(in srgb, var(--ok) 85%, black); }
.btn.read { background: var(--info); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px color-mix(in srgb, var(--info) 25%, transparent); }
.btn.read:hover { background: color-mix(in srgb, var(--info) 85%, black); }
.item-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; } .item-who svg { width: 14px; height: 14px; }
.evid { color: var(--ink-2); }
