/* 巡點簽到系統 視覺系統(票 01)
 *
 * 色票、字級、間距、圓角與陰影照意外事件系統(桃紅 #E4007F、米白底 #F7F7F3，跨系統慣例第六節)；頂欄主選單與手機底部分頁列也照它。
 * 庭芳桃紅只用在「要你動手」的地方(主要按鈕、目前分頁、焦點)。
 * 手機優先：單欄、大觸控區(最小 44px)、整頁捲動(iPhone Safari 不做整頁 fixed 版面)；720px 以上電腦版內容置中、最寬 880px。
 *
 * 介面對齊鐵律：同一列的輸入框、下拉、按鈕同高同中線(1px 內，Chrome 與 WebKit 都用 scripts/measure-ui.mjs 量)。
 * 單行輸入框、日期、下拉一律寫死高度 --ctl-h 並拿掉瀏覽器原生外觀(下拉箭頭自己畫)：Safari 的下拉不吃最小高度、日期框會自己長高。
 *
 * token 分四組：顏色、字級、間距、圓角與陰影。元件只准用 token，不寫死數值。
 */
:root {
  /* 一、顏色：底與字 */
  --bg: #F7F7F3; --surface: #FFFFFF; --surface-2: #F0F0EA; --surface-3: #E7E7DF;
  --ink: #26302D; --ink-2: #44504B; --muted: #5E6864; --ph: #9DA49F;
  --line: #E2E4DD; --line-2: #CFD3CB;
  /* 品牌：庭芳桃紅(按鈕底用深一階，白字對比 5:1 以上) */
  --brand: #E4007F; --primary: #C8006F; --primary-hover: #A8005D; --primary-soft: #FCE8F2; --on-primary: #FFFFFF;
  /* 按鈕：主按鈕用院徽亮桃紅，白字粗體；次要按鈕白底框線 */
  --btn-bg: #E4007F; --btn-bg-hover: #C8006F; --on-btn: #FFFFFF; --btn-weight: 800;
  --btn-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 6px 16px rgba(228, 0, 127, .32);
  --btn-line: #A9B0A7;
  /* 狀態 */
  --late: #B42318; --late-soft: #FDECEA; --late-line: #F4C7C2;
  --ok: #1D6B45; --ok-soft: #E5F3EB;
  --pause: #34556E; --pause-soft: #E6EEF4;
  --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(38, 48, 45, .05), 0 2px 10px rgba(38, 48, 45, .04);
  --shadow-3: 0 18px 50px rgba(38, 48, 45, .22);
  --wrap: 880px;
  /* 單行控制項(輸入框、日期、下拉、按鈕)的統一高度：同一列一定同高 */
  --ctl-h: 48px;
  color-scheme: light;
}
/* 深色：跟著系統(prefers-color-scheme)，也可以用 data-theme 強制。登入頁(gate-mode)不跟著走，見下方。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151817; --surface: #1D2120; --surface-2: #242928; --surface-3: #2C3230;
    --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;
    --btn-bg: #FF5CAD; --btn-bg-hover: #FF85C1; --on-btn: #1B0912; --btn-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(255, 92, 173, .28);
    --btn-line: #5A635F;
    --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
    --ok: #6FD19A; --ok-soft: #16301F;
    --pause: #9CC3E0; --pause-soft: #1B2A35;
    --focus: rgba(255, 92, 173, .32);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-3: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151817; --surface: #1D2120; --surface-2: #242928; --surface-3: #2C3230;
  --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;
  --btn-bg: #FF5CAD; --btn-bg-hover: #FF85C1; --on-btn: #1B0912; --btn-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(255, 92, 173, .28);
  --btn-line: #5A635F;
  --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
  --ok: #6FD19A; --ok-soft: #16301F;
  --pause: #9CC3E0; --pause-soft: #1B2A35;
  --focus: rgba(255, 92, 173, .32);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-3: 0 18px 50px rgba(0, 0, 0, .55);
  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; }
.view { max-width: var(--wrap); margin: 0 auto;
        padding: var(--s3) 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 黏在上方；整頁照常捲動、不用 fixed，iPhone Safari 的工具列才不會蓋住內容 ──
   中間是主選單(電腦)，右邊「名字｜臉或指紋綁定｜登出」(電腦)或名字按鈕(手機)。斷點 720px 跟其他庭芳系統同一個數字。
   電腦上右邊那一排放不下時，app.js 的 量頂欄() 在 body 加 top-compact，右邊改成名字按鈕，點開的我的選單掛在頂欄下面靠右。
   中央 /sso.js 的測試身分色帶在頁面最上面加進來時讓出 28 像素：頂欄是 sticky，跟著往下讓(範本 sso.js 第 9 點 h)。 */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, var(--surface)); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top-in { max-width: var(--wrap); margin: 0 auto; height: 60px; display: flex; align-items: center; gap: var(--s5);
          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; flex: 0 1 auto; }
.brand img { width: 32px; height: 32px; border-radius: 50%; flex: none; display: block; }
/* 點院徽開系統選單、點系統名稱回本系統首頁(跨系統鐵律)；院徽的點擊範圍撐到 44px，外觀照舊 32px */
.brand a { display: flex; align-items: center; min-width: 0; color: inherit; text-decoration: none; }
.brand a:hover { text-decoration: none; }
.brand-logo { height: 44px; padding: 0 6px; margin: 0 -6px; }
.brand-name { height: 44px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
@media (min-width: 720px) { .brand, .nav { flex: none; } .brand span { overflow: visible; text-overflow: clip; } }
.nav a { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border-radius: var(--r-pill);
         color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.me { margin-left: auto; position: relative; flex: none; display: flex; align-items: center; gap: var(--s2); }
.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-links a, .me-links button { display: inline-flex; align-items: center; height: 44px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px;
                                background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.me-links a:hover, .me-links button:hover { color: var(--primary); }
/* 登出是表單(只收 POST)：表單本身不佔版面，裡面的按鈕照連結的樣子排 */
.me-links form, .menu form { display: contents; }
.me-btn { display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 12px 0 16px; 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); max-width: 10em; }
.me-btn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 名字右邊的小箭頭：看得出點得開；打開時轉過來 */
.me-btn .me-caret { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform .15s; }
.me-btn[aria-expanded="true"] .me-caret { transform: rotate(180deg); }
.me-btn:hover { border-color: var(--primary); }
@media (min-width: 720px) {
  body:not(.top-compact) .me-btn, body:not(.top-compact) .menu { display: none !important; }
  body.top-compact .me-links { display: none; }
  body.top-compact .me { flex: 0 1 auto; min-width: 0; }
  body.top-compact .me-btn { min-width: 0; max-width: min(16em, 100%); }
  body.top-compact .menu { right: max(var(--s4), env(safe-area-inset-right)); width: 320px; max-width: calc(100vw - 2 * var(--s4)); }
}
@media (max-width: 719.98px) { .me-btn { max-width: 8em; } .nav { display: none; } .me-links { display: none; } .brand { font-size: var(--fs-md); } .top-in { gap: var(--s3); } }
/* 最窄的手機(360 寬以下)：名字按鈕左右留白與頂欄間距縮一點，系統名稱不被截 */
@media (max-width: 399.98px) { .me-btn { padding: 0 10px; max-width: 6.5em; } .top-in { gap: var(--s2); } }

/* 我的選單(手機)：點頂欄右上角的名字打開，掛在頂欄下面靠右(電腦放不下時一樣) */
.menu { position: fixed; z-index: 40; top: calc(64px + env(safe-area-inset-top)); left: auto; right: max(var(--s3), env(safe-area-inset-right));
        width: min(320px, calc(100vw - 2 * var(--s3))); background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 6px; }
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head b { display: block; }
.menu button, .menu a { display: flex; align-items: center; width: 100%; min-height: 48px; text-align: left; border: 0; background: none; cursor: pointer;
                        padding: 0 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; }

/* 底部分頁列(手機)：fixed bottom:0，整頁照常捲動；頁面底部多留 padding 給它。每格等寬 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
          background: color-mix(in srgb, var(--surface) 94%, var(--bg)); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
          padding: 6px max(var(--s2), env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(var(--s2), env(safe-area-inset-left)); }
.tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; height: 52px; padding: 0; border: 0; background: none;
            color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.2; border-radius: var(--r-md); text-decoration: none; min-width: 0; }
.tabbar span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--primary); }
@media (min-width: 720px) { .tabbar { display: none !important; } }
@media (max-width: 719.98px) { body.has-tabbar .view { padding-bottom: calc(var(--s8) + 64px + env(safe-area-inset-bottom)); } }

/* ── 按鈕：主按鈕 .btn 院徽桃紅；次要 .btn.ghost 白底框線(同高同圓角)。高度寫死 --ctl-h，跟單行輸入框同高 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--ctl-h); padding: 0 20px;
       border: 0; border-radius: var(--r-pill); cursor: pointer; font-weight: var(--btn-weight); white-space: nowrap; line-height: 1;
       background: var(--btn-bg); color: var(--on-btn); transition: background .15s, transform .06s, box-shadow .15s, border-color .15s;
       box-shadow: var(--btn-shadow); -webkit-appearance: none; appearance: none; }
.btn:hover { background: var(--btn-bg-hover); text-decoration: none; }
.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: 1.5px solid var(--btn-line); font-weight: 700; box-shadow: 0 1px 2px rgba(38, 48, 45, .08); }
.btn.ghost:hover { border-color: var(--btn-bg); background: var(--primary-soft); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* ── 輸入：單行的一律寫死高度、拿掉原生外觀(Safari 的下拉不吃最小高度、日期框會自己長高)；下拉箭頭自己畫 ── */
.field { display: block; }
.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=time], input[type=number], input[type=search], input[type=email], select {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: var(--ctl-h); margin: 0;
  background-color: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 0 14px; outline: none; font-size: var(--fs-md); line-height: normal; transition: border-color .15s, box-shadow .15s; }
select { padding-right: 40px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6864' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px 18px; }
/* Safari 的日期與時間框寫死高度後，字會貼在上緣：改成 flex 垂直置中(意外事件系統 2026-11-13 WebKit 實測) */
input[type=date], input[type=time] { display: flex; align-items: center; }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type=date]::-webkit-datetime-edit, input[type=time]::-webkit-datetime-edit { padding: 0; }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
input::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); }
.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(--surface-2); color: var(--ink-2); }
.banner.late { background: var(--late-soft); color: var(--late); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ── 頁面標題與首頁(第 6 步 UI/UX 審查：首頁標題是今天的日期，系統名稱與姓名只在頂欄) ── */
.page-title { font-size: var(--fs-xl); font-weight: 800; line-height: 1.4; margin: var(--s4) 0 var(--s2); }
#homeTitle { font-variant-numeric: tabular-nums; }
/* 同仁：最近 12 小時的簽到(卡片樣子跟我的簽到紀錄的一天同一個) */
.home-recent { margin-top: var(--s5); max-width: 560px; }
.rec-none { padding: var(--s4); color: var(--muted); }
/* 管理員的手機：開通手機、巡點網址兩張行動卡(整張可點，跟數字卡同高) */
.home-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.home-act { display: flex; flex-direction: column; justify-content: center; gap: var(--s2); min-height: 104px; padding: var(--s4) var(--s5);
            background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); color: var(--ink); font-weight: 800; line-height: 1.4; }
.home-act svg { width: 28px; height: 28px; color: var(--primary); }
.home-act:hover { text-decoration: none; border-color: var(--primary); }

/* ── 登入頁 ──
   版面、配色照人事帳號系統示範站 demo.tinfun.org.tw(各系統登入範本)，只有系統名稱不同。
   示範站只有亮色，所以登入頁不跟著深色模式走：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;
  --btn-bg: #E4007F; --btn-bg-hover: #B10063; --on-btn: #FFFFFF; --btn-weight: 700;
  --btn-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 12px color-mix(in srgb, #E4007F 22%, transparent); --btn-line: #D9DED9;
  --line: #E0E4DF; --line-2: #D9DED9; --focus: rgba(228, 0, 127, .12);
  --ok: #1B5E33; --late: #A32C15;
  color-scheme: light;
}
/* 簽到頁與開通頁(html.gate-follow，checkin.js 與 devices.js 掛上)跟著深色模式：夜班在暗處感應，整頁白底太刺眼(第 6 步 UI/UX 審查)。
   登入頁不掛 gate-follow，照示範站維持亮色。深色色票跟上面 :root 的深色同一組 */
@media (prefers-color-scheme: dark) {
  html.gate-mode.gate-follow:root:not([data-theme="light"]) {
    --bg: #151817; --surface: #1D2120; --surface-2: #242928; --ink: #ECEFEC; --ink-2: #CBD1CD; --muted: #98A29D; --ph: #6C7571;
    --line: #2C3230; --line-2: #3A413E; --primary: #FF5CAD; --primary-hover: #FF85C1; --primary-soft: #3A1B2B; --on-primary: #1B0912;
    --btn-bg: #FF5CAD; --btn-bg-hover: #FF85C1; --on-btn: #1B0912; --btn-line: #5A635F; --focus: rgba(255, 92, 173, .32);
    --ok: #6FD19A; --ok-soft: #16301F; --late: #FF8A7E; --late-soft: #3A1B18; color-scheme: dark;
  }
}
html.gate-mode.gate-follow:root[data-theme="dark"] {
  --bg: #151817; --surface: #1D2120; --surface-2: #242928; --ink: #ECEFEC; --ink-2: #CBD1CD; --muted: #98A29D; --ph: #6C7571;
  --line: #2C3230; --line-2: #3A413E; --primary: #FF5CAD; --primary-hover: #FF85C1; --primary-soft: #3A1B2B; --on-primary: #1B0912;
  --btn-bg: #FF5CAD; --btn-bg-hover: #FF85C1; --on-btn: #1B0912; --btn-line: #5A635F; --focus: rgba(255, 92, 173, .32);
  --ok: #6FD19A; --ok-soft: #16301F; --late: #FF8A7E; --late-soft: #3A1B18; color-scheme: dark;
}
html.gate-mode body { line-height: 1.7; }
.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 > span { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; color: var(--muted); line-height: 1.5; }
.gate input[type=text], .gate input[type=tel] { height: 48px; font-size: 1rem; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 0 .75em; }
.gate input:focus { box-shadow: 0 0 0 3px var(--focus); }
/* 四位數字碼：固定寬置中、四個點的 placeholder；左邊多 12px 補 letter-spacing 在最後一字後面多的那格 */
.gate #code { height: 64px; font-size: 28px; letter-spacing: 12px; text-align: center; padding: 0 0 0 12px; border-width: 2px; border-radius: 12px; }
/* 登入那一列：左半「登入」、右半臉或指紋的圖示鈕，兩顆同色同高；忘記登入碼是右下角一行底線文字 */
.gate .btn { 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; height: 52px; padding: 0; font-size: 1.05rem; }
.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; }
/* 登入頁的彈窗照示範站：置中、上緣色帶就是語氣(綠＝成功、紅＝失敗)，一顆「關閉」 */
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 { height: 52px; font-size: 1.05rem; padding: 0 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);
         max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.modal p { font-size: var(--fs-md); line-height: 1.7; }
.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; } }

/* ══ 共用元件(票 02，public/ui.js) ══════════════════════════
 * 後面每張票的畫面都用這些，不要另外再做一份。高度一律對齊 --ctl-h(48px)或 44px 可點區，同一列同高同中線(scripts/measure/02-components.json 量)。 */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.btn.sm { height: 44px; padding: 0 14px; font-size: var(--fs-sm); }
.btn.danger { background: var(--late); color: var(--on-btn); box-shadow: none; }
.btn.danger:hover { background: var(--late); filter: brightness(.92); }
/* 一列控制項(輸入框、日期、時間、按鈕)：同高同中線；放不下就換行 */
.ctl-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.ctl-row > input[type=text] { width: auto; flex: 1 1 12em; min-width: 0; }
.ctl-row > .btn { flex: none; }
/* 手機：文字框自己一整行，後面的按鈕下一行平分；日期框撐滿時間下拉以外的寬度(最窄 320 也跟時間同一行) */
@media (max-width: 719.98px) {
  .ctl-row > input[type=text] { flex-basis: 100%; }
  .ctl-row > input[type=text] ~ .btn { flex: 1 1 0; min-width: 0; }
  .ctl-row > .dt-date { flex: 1 1 7em; min-width: 0; }
  .ctl-row > .dt-date input[data-dt-show] { width: 100%; }
}

/* 彈窗開著時 body 固定在原位(ui.js 的 鎖背景)，iPhone 滑動捲的是前景的視窗；不用 JS 擋 touchmove */
body.bg-locked { overflow: hidden; overscroll-behavior: none; }
.modal-bg { overscroll-behavior: none; }
.modal { -webkit-overflow-scrolling: touch; }
.modal .actions { display: flex; justify-content: flex-end; gap: var(--s3); margin-top: var(--s5); }
/* 手機：按鈕平分整列(用格線：外框粗細不同的按鈕也一樣寬) */
@media (max-width: 719.98px) { .modal .actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
.confirm-msg { font-size: var(--fs-md); font-weight: 700; line-height: 1.6; }
/* 短提示：畫面下方置中；手機在底部分頁列上面 */
.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-lg); font-size: var(--fs-sm);
         font-weight: 700; box-shadow: var(--shadow-3); max-width: calc(100vw - 32px); width: max-content; text-align: center; }
/* width: max-content：left 50% 的框預設最寬只到半個畫面，短短一句也會折成兩行(第 6 步 UI/UX 審查，iPhone SE 的「已開通給 某某」) */
@media (max-width: 719.98px) { body.has-tabbar .toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* 日期：顯示框(民國年)上面整個蓋著看不見的系統日期框，點一下就跳月曆、不能打字(照意外事件 Q57)；電腦上連月曆鈕也撐滿整格 */
.dt-part { display: flex; align-items: center; gap: 6px; flex: none; }
.dt-date { position: relative; }
.dt-date input[data-dt-show] { width: 9em; cursor: pointer; caret-color: transparent; -webkit-user-select: none; user-select: none; font-variant-numeric: tabular-nums; }
.dt-date input[data-dt-show]::placeholder { color: var(--muted); }
.dt-date .dt-cal { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer;
                   -webkit-appearance: none; appearance: none; }
.dt-date .dt-cal::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.dt-date:focus-within input[data-dt-show] { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
/* 時間：「時」「分」兩個下拉，箭頭自己畫、寫死高度(input 的共用規則) */
.dt-hm select { width: 4.8em; padding: 0 24px 0 12px; background-position: right 7px center; background-size: 14px 14px; font-variant-numeric: tabular-nums; }
.dt-colon { flex: none; width: 6px; text-align: center; font-weight: 800; color: var(--ink-2); line-height: 1; }
@media (max-width: 399.98px) { .dt-hm select { width: 4.2em; padding: 0 22px 0 10px; background-position: right 6px center; } }

/* 狀態膠囊：不能點(只是標示)，高 28px；顏色就是語氣 */
.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--r-pill); white-space: nowrap;
        font-size: var(--fs-xs); font-weight: 800; line-height: 1; border: 1px solid transparent; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.late { background: var(--late-soft); color: var(--late); }
.pill.pause { background: var(--pause-soft); color: var(--pause); }
.pill.open { background: var(--primary-soft); color: var(--primary); }
.pill.off { background: var(--surface-2); color: var(--muted); border-color: var(--line-2); }
.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }

/* 數字卡：整張可點，進到對應清單；手機兩張並排 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); }
.stat { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 104px; padding: var(--s4) var(--s5);
        background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat-n { font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-t { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); line-height: 1.4; }
.stat.late .stat-n { color: var(--late); }

/* 存檔提示：存檔中、已存檔 幾點幾分(綠)、沒有存到(紅)加再試一次；固定留一行高，版面不跳 */
.save-hint { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); min-height: 44px; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.save-hint.ok { color: var(--ok); }
.save-hint.bad { color: var(--late); }

/* 清單翻頁：「較新」「較舊」固定寬度(換字也不變寬)，中間第幾頁 */
.pager { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-top: var(--s4); }
.pager .btn { width: 7em; padding: 0; }
.pager-n { min-width: 5em; text-align: center; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* 元件展示頁(只在本機，public/devui.js) */
.demo-h { font-size: var(--fs-md); font-weight: 800; margin: var(--s6) 0 var(--s3); color: var(--ink-2); }
.demo-list { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.demo-list li { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.demo-list li:last-child { border-bottom: 0; }

/* ══ 票 03：名單外的同仁、管理頁分頁、兩份名單、從在職名冊加人(public/lists.js) ══
 * 同列同高同中線由 scripts/measure/03-lists.json 量。 */
.banner.info { align-items: center; background: var(--surface-2); color: var(--ink-2); margin-top: var(--s4); }
.banner.info svg { margin-top: 0; }
/* 管理頁上面那一排分頁：底線標目前位置，點擊範圍 44px */
.subtabs { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 var(--s5); border-bottom: 1px solid var(--line); }
.subtabs a { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; margin-bottom: -1px; color: var(--ink-2); font-weight: 700;
             border-bottom: 3px solid transparent; }
.subtabs a:hover { color: var(--ink); text-decoration: none; }
.subtabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
/* 名單卡片：標題列(名單名稱、人數、存檔提示、從在職名冊加人)，下面一人一列 */
.list-card { padding: 0; }
.list-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-lg); font-weight: 800; line-height: 1.4; white-space: nowrap; }
.list-n { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.list-head .save-hint { margin-left: auto; }
.list-head .btn { flex: none; }
.list-rows { list-style: none; }
.list-row { display: flex; align-items: center; gap: var(--s3); min-height: 60px; padding: var(--s2) var(--s5); border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-name { min-width: 0; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.list-row .list-remove { margin-left: auto; flex: none; }
.list-empty { padding: var(--s5); color: var(--muted); }
/* 從在職名冊加人的視窗：搜尋、可捲動的勾選清單；「加入 n 位」會換字，寬度固定 */
.modal-title { font-size: var(--fs-lg); font-weight: 800; line-height: 1.4; margin-bottom: var(--s3); }
.modal input[type=search] { margin-bottom: var(--s3); }
.pk-list { max-height: min(50vh, 380px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--r-md); }
.pk-row { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 4px var(--s3); border-bottom: 1px solid var(--line); cursor: pointer; }
.pk-row:hover { background: var(--surface-2); }
.pk-name { font-weight: 700; line-height: 1.3; }
.pk-dept { color: var(--muted); font-size: var(--fs-sm); line-height: 1.3; }
.pk-in { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); font-weight: 700; line-height: 1.3; white-space: nowrap; }
.pk-lock { cursor: default; }
.pk-lock:hover { background: none; }
.pk-lock .pk-name { color: var(--muted); }
.pk-msg { padding: var(--s4); color: var(--muted); }
.pk-msg.bad { color: var(--late); }
.btn.pk-ok { width: 8.5em; padding: 0; }
/* 勾選框：自己畫(原生的在 Safari 與 Chrome 大小不一)，22px，跟同一列的字垂直置中 */
input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none; width: 22px; height: 22px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--btn-line); border-radius: 6px; background: var(--surface) center / 16px 16px no-repeat; }
input[type=checkbox]:checked { background-color: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
input[type=checkbox]:disabled { opacity: .5; cursor: default; }
input[type=checkbox]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ══ 票 04：巡點(public/points.js) ══════════════════════════
 * 巡點清單、明細只在電腦(720px 以上)；巡點網址清單手機與電腦都可以(規格 9.4 的例外)。高度一律對齊 --ctl-h 或 44px 可點區。 */
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); margin: var(--s4) 0 var(--s3); }
.page-head .page-title { margin: 0; }
.head-acts { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.back { display: inline-flex; align-items: center; gap: 4px; height: 44px; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 700; }
.back svg { width: 18px; height: 18px; }
.back:hover { color: var(--primary); text-decoration: none; }
.empty { color: var(--muted); padding: var(--s5) 0; }
.sec-h { font-size: var(--fs-md); font-weight: 800; color: var(--ink-2); margin-bottom: var(--s3); }
.modal .field + .field { margin-top: var(--s4); }
.form-err { min-height: 1.6em; margin-top: var(--s2); font-size: var(--fs-sm); font-weight: 700; color: var(--late); }
.modal .form-err + .actions { margin-top: var(--s3); }

/* 巡點清單：一列一個巡點(名稱、狀態、備註)，整列可點進明細 */
.pt-list { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.pt-list li + li { border-top: 1px solid var(--line); }
.pt-row { display: grid; grid-template-columns: minmax(8em, 1fr) 6.5em minmax(0, 2fr); align-items: center; gap: var(--s4);
          min-height: 56px; padding: var(--s2) var(--s5); color: var(--ink); }
.pt-row:hover { background: var(--surface-2); text-decoration: none; }
.pt-row.pending { opacity: .55; }
.pt-name { font-weight: 800; overflow-wrap: anywhere; }
.pt-pill { display: flex; align-items: center; }
.pt-note { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* 巡點明細 */
.pt-detail .page-head { margin-top: var(--s1); }
.pt-since { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.pt-card { margin-bottom: var(--s4); }
.pt-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s4); align-items: end; }
.pt-edit .ctl-row { grid-column: 1 / -1; }
.url-one { display: flex; align-items: center; gap: var(--s3); }
.url-text { font-family: var(--mono); font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; line-height: 1.5; }
.url-one .url-text { flex: 1 1 auto; min-width: 0; }
/* 複製鈕會換字(複製、已複製)：寬度固定 */
.btn.url-copy { width: 6.5em; padding: 0; flex: none; }
.copy-buffer { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* 暫停：一段一列(期間、暫停中、改結束與恢復或取消)；下面一列新增(開始、結束、設定暫停) */
.pz-list { list-style: none; margin-bottom: var(--s4); border-top: 1px solid var(--line); }
.pz-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); min-height: 60px; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.pz-when { font-weight: 700; font-variant-numeric: tabular-nums; }
.pz-pill { display: flex; align-items: center; }
.pz-pill:empty { display: none; }
.pz-acts { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.pz-acts .btn { width: 6em; padding: 0; }
.ctl-label { flex: none; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); line-height: 1; }
/* 新增暫停：「開始」「結束」各是一組(標籤、日期、時、分)不拆開；寬的電腦三樣排一行，720 到 1000 寬放不下時設定暫停鈕(或結束那一組)換到第二行 */
.pz-grp { display: flex; align-items: center; gap: var(--s2); flex: none; }
.pz-form .dt-date input[data-dt-show] { width: 7em; }
.pz-form #pzAdd { margin-left: auto; }
.modal .pz-when { margin-bottom: var(--s3); }

/* 停用、重新啟用(會換字，寬度固定)、刪除 */
.pt-acts { margin-top: var(--s2); }
.btn.act-toggle { width: 7.5em; padding: 0; }
.btn.act-del { width: 7.5em; padding: 0; color: var(--late); border-color: var(--late-line); }
.btn.act-del:hover { background: var(--late-soft); border-color: var(--late); }

/* 巡點網址清單(手機與電腦)：一列一個巡點，左邊名稱與完整網址、右邊複製鈕(垂直置中) */
.url-list { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.url-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); }
.url-row + .url-row { border-top: 1px solid var(--line); }
.url-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.url-name { font-weight: 800; overflow-wrap: anywhere; }
.url-row .url-text { font-size: var(--fs-xs); }

/* ══ 票 05：巡視規定(public/rules.js) ══════════════════════════
 * 清單與表單只在電腦(720px 以上)。高度一律對齊 --ctl-h(48px)或 44px 可點區，同一列同高同中線(scripts/measure/05-rules.json 量)。 */
/* 規定清單：一列一條規定(名稱、形式、摘要與「新設定從什麼時候開始算」、適用幾個巡點、狀態)，整列可點進表單 */
.rl-list { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.rl-list li + li { border-top: 1px solid var(--line); }
.rl-row { display: grid; grid-template-columns: minmax(7em, 1fr) 9.5em minmax(0, 1.6fr) 5.5em 6em; align-items: center; gap: var(--s4);
          min-height: 60px; padding: var(--s2) var(--s5); color: var(--ink); }
.rl-row:hover { background: var(--surface-2); text-decoration: none; }
.rl-row.pending { opacity: .55; }
.rl-name { font-weight: 800; overflow-wrap: anywhere; }
.rl-kind, .rl-count { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 700; }
.rl-sum { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rl-pending { color: var(--pause); font-weight: 700; }
.rl-pill { display: flex; align-items: center; }

/* 規定表單：左邊欄位名稱、右邊控制項；錯誤就寫在同一列的控制項後面(欄位旁) */
.rl-page .page-head { margin-top: var(--s1); }
.rl-form { --rl-label: 96px; margin-bottom: var(--s4); }
/* 欄位名稱對齊控制項的第一列(勾選鈕放不下會換行)：每一列控制項都是 48px 高，名稱也是 48px 高、垂直置中 */
.rl-line { display: grid; grid-template-columns: var(--rl-label) minmax(0, 1fr); align-items: start; gap: var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.rl-line[hidden] { display: none; }
/* 還沒選形式：只有形式那一列，不畫分隔線 */
.rl-form:has(#rlFields[hidden]) [data-line=form] { border-bottom: 0; }
.rl-label { display: flex; align-items: center; min-height: var(--ctl-h); font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); line-height: 1.4; }
.rl-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-height: var(--ctl-h); }
.rl-ctl > input[type=text] { flex: 0 1 20em; width: 20em; min-width: 0; }
.rl-ctl > .ctl-label + .dt-part { margin-left: calc(-1 * var(--s1)); }
.rl-ctl > .dt-part + .ctl-label { margin-left: var(--s3); }
.rl-iv .ctl-label { margin-right: var(--s1); }
.rl-err { font-size: var(--fs-sm); font-weight: 700; color: var(--late); line-height: 1.4; margin-left: var(--s1); }
.rl-err:empty { display: none; }
.rl-none { color: var(--muted); font-size: var(--fs-sm); }
.rl-preview { row-gap: 0; }
.rl-preview .rl-slot { margin: 8px 0; }
.rl-slot { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface-2);
           border: 1px solid var(--line); font-size: var(--fs-sm); font-weight: 700; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rl-from { min-height: 1.6em; margin: var(--s3) 0 0 calc(var(--rl-label) + var(--s4)); font-size: var(--fs-sm); font-weight: 800; color: var(--pause); line-height: 1.6; }
.rl-from:empty { margin-top: 0; }
.rl-save { margin: var(--s3) 0 0 calc(var(--rl-label) + var(--s4)); }

/* 勾選鈕(適用巡點、星期幾)與形式的選項：整顆是一個 label，勾選框、文字垂直置中；勾了換桃紅框(畫面上「要你動手」的地方) */
.chk { display: inline-flex; align-items: center; gap: 8px; height: var(--ctl-h); padding: 0 14px 0 12px; border: 1.5px solid var(--btn-line); border-radius: var(--r-pill);
       background: var(--surface); color: var(--ink); cursor: pointer; font-size: var(--fs-sm); font-weight: 700; line-height: 1; white-space: nowrap;
       -webkit-user-select: none; user-select: none; transition: border-color .15s, background .15s; }
.chk:hover { border-color: var(--btn-bg); }
.chk:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.chk:focus-within { box-shadow: 0 0 0 4px var(--focus); }
.chk input { -webkit-appearance: none; appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--line-2); border-radius: 6px;
             background: var(--surface) center / 14px 14px no-repeat; cursor: pointer; outline: none; }
.chk input:checked { border-color: var(--primary); background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.chk input[type=radio] { border-radius: 50%; }
.chk input[type=radio]:checked { background-image: none; box-shadow: inset 0 0 0 4px var(--surface); }
.chk.day { width: 60px; justify-content: center; padding: 0; gap: 6px; }
.chk.rl-opt { padding: 0 18px 0 14px; font-size: var(--fs-md); }
.chk.off > span:first-of-type { color: var(--muted); }
.chk-off { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }

/* ══ 票 06：手機開通(public/devices.js) ══════════════════════
 * 開通頁(手機，不用登入；照登入頁的版面與配色 gate-mode)、管理員的開通視窗(電腦與手機共用)、簽到名單的開通欄位、手機上的開通分頁。
 * 同列同高同中線由 scripts/measure/06-devices.json 量。 */
/* 開通頁：上面一張開通碼卡、下面個資告知(法規要求的內容，畫面精簡的例外)。單手可看完開通碼，告知往下捲 */
.gate.act .card { max-width: 22rem; text-align: center; }
.gate.act .act-card { min-height: 188px; display: flex; flex-direction: column; justify-content: center; gap: var(--s2); }
.act-label { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); line-height: 1.4; }
.act-code { font-size: 44px; font-weight: 800; line-height: 1.2; letter-spacing: .08em; font-variant-numeric: tabular-nums; color: var(--ink);
            font-family: var(--mono); white-space: nowrap; }
.act-gap { display: inline-block; width: .4em; }
.act-exp { font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; font-variant-numeric: tabular-nums; }
.act-msg { font-size: var(--fs-lg); font-weight: 700; line-height: 1.5; margin-bottom: var(--s2); }
.act-warn { text-align: left; margin-top: var(--s2); }
.act-done { display: flex; flex-direction: column; align-items: center; gap: var(--s1); color: var(--ok); }
.act-done svg { width: 64px; height: 64px; }
.act-done-t { font-size: var(--fs-xl); font-weight: 800; line-height: 1.4; }
.act-owner { font-size: var(--fs-lg); font-weight: 700; color: var(--ink); line-height: 1.4; }
.gate.act .act-notice { margin-top: var(--s4); text-align: left; padding: var(--s5); }
.notice-title { font-size: var(--fs-md); font-weight: 800; line-height: 1.5; margin-bottom: var(--s3); }
.notice { display: grid; gap: var(--s3); }
.notice dt { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); line-height: 1.5; }
.notice dd { font-size: var(--fs-sm); line-height: 1.7; color: var(--ink); }

/* 開通視窗：同仁姓名、開通碼(大字、等寬)、註記；核對頁一項一列(標題在上、內容與「確定後失效」膠囊同一列) */
.dv-who { font-size: var(--fs-lg); font-weight: 800; line-height: 1.4; margin-bottom: var(--s4); color: var(--ink); }
.dv-field { margin-bottom: var(--s4); }
.modal input.dv-code { font-size: 24px; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.dv-err { color: var(--late); font-size: var(--fs-sm); font-weight: 700; line-height: 1.5; margin: calc(-1 * var(--s2)) 0 var(--s2); }
.btn.dv-go { width: 7.5em; padding: 0; }
@media (max-width: 719.98px) { .modal .actions .btn.dv-go { width: auto; } }
/* 核對：一項一列(標題在左固定寬、內容在右)，「確定後失效」跟在內容後面；精簡排版讓 iPhone SE(375x667)不用捲也按得到確定 */
.dv-check { display: grid; background: var(--surface-2); border-radius: var(--r-md); padding: var(--s1) var(--s4); }
.dv-check > div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: var(--s3); align-items: center; padding: var(--s2) 0; }
.dv-check > div + div { border-top: 1px solid var(--line); }
.dv-check dt { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); line-height: 1.4; }
/* 內容一整行寬(手機上不被膠囊擠成好幾行)，「確定後失效」在內容下面 */
.dv-check dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); min-height: 28px; }
.dv-check dd .dv-v { flex: 1 1 100%; min-width: 0; }
.dv-check dd .pill { flex: none; }
.dv-code-v { font-family: var(--mono); font-size: var(--fs-lg); font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
/* 確定那一列黏在視窗底部：內容長時視窗裡捲動，按鈕一直看得到 */
.modal .actions.dv-sticky { position: sticky; bottom: calc(-1 * var(--s5)); margin: var(--s4) calc(-1 * var(--s5)) calc(-1 * var(--s5)); padding: var(--s3) var(--s5) var(--s5);
                           background: var(--surface); border-top: 1px solid var(--line); }
@media (max-width: 719.98px) { .modal:has(.dv-check) .modal-title { margin-bottom: var(--s1); } .modal:has(.dv-check) .dv-who { margin-bottom: var(--s3); } }
.dv-v { font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.dv-none { color: var(--muted); font-weight: 400; }
.dv-note { margin-left: var(--s2); font-weight: 400; color: var(--ink-2); }

/* 簽到名單的開通欄位：狀態膠囊、按鈕(固定寬度：開通手機與重新開通會換字)；第二行註記、手機資訊、開通時間 */
.list-row { flex-wrap: wrap; }
.list-row .dv-btns { margin-left: auto; display: flex; align-items: center; gap: var(--s2); flex: none; }
.list-row .dv-btns ~ .list-remove { margin-left: 0; }
.btn.dv-btn { width: 6.5em; padding: 0; }
.list-row .dv-info { order: 1; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0 var(--s3); margin-top: calc(-1 * var(--s1)); font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.dv-note-b { color: var(--ink); font-weight: 700; }
.dv-out { margin-top: var(--s5); }
/* 管理頁「手機開通」分頁：開通網址與複製、待用開通碼與清空 */
.dv-set { margin-bottom: var(--s4); }
.dv-set .list-title { margin-bottom: var(--s3); }
.dv-set-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.dv-set-row .list-title { margin-bottom: 0; }
.dv-set-row .save-hint { margin-left: auto; }

/* 手機上的開通分頁：搜尋、同仁一人一列(整列可點，至少 56px 高) */
.dv-mobile input[type=search] { margin-bottom: var(--s3); }
.dv-pick { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.dv-pick > li { border-bottom: 1px solid var(--line); }
.dv-pick > li:last-child { border-bottom: 0; }
.dv-pick-row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 60px; padding: var(--s2) var(--s4); background: none; border: 0;
               text-align: left; cursor: pointer; color: var(--ink); }
.dv-pick-row:active { background: var(--surface-2); }
.dv-pick-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.dv-pick-name { font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.dv-pick-note { font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.dv-pick .pill { flex: none; }

/* ══ 票 07：簽到頁(public/checkin.js)與我的簽到紀錄 ══════════════
 * 簽到頁照登入頁的版面(gate-mode，沒有頂欄)：院徽、一張卡片。成功頁與訊息頁單手、不用捲動(iPhone 寬度量過)；告知頁是法規要求的內容，可以往下捲。
 * 同列同高同中線由 scripts/measure/07-checkin.json 量。 */
.gate.ck { padding-top: var(--s4); padding-bottom: var(--s5); }
.gate.ck .logo { width: 64px; height: 64px; margin-bottom: var(--s3); }
.gate.ck .card { max-width: 22rem; text-align: center; }
.gate.ck .ck-card { min-height: 220px; display: flex; flex-direction: column; justify-content: center; gap: var(--s2); padding: var(--s6) var(--s5); }
.gate.ck .ck-card.notice { text-align: left; justify-content: flex-start; gap: var(--s4); padding: var(--s5); }
.ck-wait { display: flex; flex-direction: column; align-items: center; gap: var(--s3); color: var(--muted); }
.ck-wait .spinner { margin: 0; }
.ck-wait-t { font-size: var(--fs-md); font-weight: 700; line-height: 1.5; }
.ck-done { display: flex; flex-direction: column; align-items: center; gap: var(--s1); color: var(--ok); }
.ck-done svg { width: 80px; height: 80px; }
.ck-done-t { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.3; }
.ck-point { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; margin-top: var(--s2); }
.ck-time { font-size: 40px; font-weight: 800; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.ck-name { font-size: var(--fs-lg); font-weight: 700; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere; }
.gate.ck .ck-link { margin-top: var(--s3); height: 52px; font-size: var(--fs-md); }
/* 矮的手機(最窄 320x568)：成功頁一樣不用捲動 */
@media (max-height: 640px) {
  .gate.ck .ck-card { padding: var(--s4) var(--s4); gap: var(--s1); }
  .ck-done svg { width: 64px; height: 64px; }
  .ck-time { font-size: 34px; }
  .gate.ck .logo { width: 48px; height: 48px; margin-bottom: var(--s2); }
}
.ck-msg { display: flex; flex-direction: column; align-items: center; gap: var(--s3); color: var(--late); }
.ck-msg svg { width: 72px; height: 72px; }
.ck-msg-t { font-size: var(--fs-xl); font-weight: 800; line-height: 1.5; color: var(--ink); }
.gate.ck .ck-ack { height: 52px; font-size: 1.05rem; }
/* 別的網頁連過來時：一顆大的「簽到」按鈕，按了才送 */
.gate.ck .ck-card.manual { min-height: 0; }
.gate.ck .ck-go { height: 64px; font-size: var(--fs-xl); }

/* 我的簽到紀錄：期間一行，每天一張卡片(日期標題，下面一筆一列：時間、巡點)，最下面翻頁 */
.rec-range { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; margin-bottom: var(--s3); font-variant-numeric: tabular-nums; }
.rec-day { padding: 0; margin-bottom: var(--s3); overflow: hidden; }
.rec-date { font-size: var(--fs-md); font-weight: 800; line-height: 1.4; padding: var(--s3) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rec-list { list-style: none; }
.rec-row { display: flex; align-items: center; gap: var(--s4); min-height: 48px; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); }
.rec-row:last-child { border-bottom: 0; }
.rec-time { flex: none; width: 3.2em; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.4; }
.rec-point { min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
.rec-empty { color: var(--muted); padding: var(--s5) 0; }
.rec .pager { margin-top: var(--s4); }

/* 簽到名單每一列的最近一次簽到(第二行最後一項) */
.dv-last { font-variant-numeric: tabular-nums; }

/* ══ 票 08：管理員首頁的數字卡、達成情況、巡點明細、漏掉清單、用別人的手機簽到(public/stats.js) ══════════
 * 管理頁只在電腦(720px 以上)；數字卡也只在電腦畫。同列同高同中線、欄頭右緣對齊資料右緣由 scripts/measure/08-stats.json 量。
 * 欄寬一律用 rem(審查修正)：欄頭字比較小，用 em 的話欄頭與資料列的欄寬會不一樣，數字就對不到欄頭。 */
.home-stats { margin-top: var(--s5); }
.home-stats .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
.st-quiet { margin-top: var(--s2); color: var(--ink-2); font-weight: 700; line-height: 1.6; }
.st-lag-line { margin-top: var(--s3); }
/* 結算停住：數字旁寫結算到哪裡(資料，不是說明) */
.st-lag { display: inline-flex; align-items: center; min-height: var(--ctl-h); font-size: var(--fs-sm); font-weight: 800; color: var(--late); font-variant-numeric: tabular-nums; }
.st-link { margin-left: auto; display: inline-flex; align-items: center; height: 44px; font-weight: 700; font-size: var(--fs-sm); }
/* 期間列：下拉、自訂日期的兩個日期框與查詢鈕；同高同中線(--ctl-h) */
.st-period { margin-bottom: var(--s4); }
.st-period > select { width: 11rem; flex: none; }
.st-dates { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.st-dates[hidden] { display: none; }
.st-dates .dt-date input[data-dt-show] { width: 9rem; }
.st-to { display: inline-flex; align-items: center; height: var(--ctl-h); font-weight: 700; color: var(--ink-2); }
/* 選了自訂日期還沒按查詢：下面的資料先變淡 */
.st-dim { opacity: .45; transition: opacity .15s; }
/* 達成情況表：一列一個巡點(名稱、時格數、達成、漏掉、暫停、達成率)，整列點進明細。數字靠右、等寬數字 */
.st-table { padding: 0; overflow: hidden; }
.st-grid { display: grid; grid-template-columns: minmax(8rem, 1fr) repeat(4, 5rem) 6rem; align-items: center; gap: 12px; padding: 0 20px; }
.st-head { min-height: 44px; font-size: var(--fs-sm); font-weight: 800; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.st-row { min-height: 56px; color: var(--ink); border-bottom: 1px solid var(--line); }
.st-row:last-child { border-bottom: 0; }
.st-row:hover { background: var(--surface-2); text-decoration: none; }
.st-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); font-weight: 800; overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.bad { color: var(--late); font-weight: 800; }
.st-rate { font-weight: 800; }
.st-rate.none { color: var(--muted); font-weight: 700; font-size: var(--fs-sm); }
/* 巡點明細 */
.st-detail .page-head { margin-top: var(--s1); }
.st-card { margin-bottom: var(--s4); }
.st-rule + .st-rule { margin-top: var(--s5); }
.st-rule-h { font-size: var(--fs-md); font-weight: 800; margin-bottom: var(--s2); overflow-wrap: anywhere; }
.st-sum { display: grid; grid-template-columns: minmax(9rem, 1fr) repeat(4, 5rem); align-items: center; gap: 12px; padding: 0 12px; }
.st-sum.st-head { border-radius: var(--r-sm); border-bottom: 0; }
.st-sum-row { min-height: 44px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.st-sum-row:last-child { border-bottom: 0; }
/* 時格結果、簽到紀錄、漏掉、用別人的手機：一筆一列，最新的在前；每一列至少 48px 高 */
.st-list { list-style: none; }
.st-item { display: grid; align-items: center; gap: 12px; min-height: 52px; padding: var(--s1) 0; border-bottom: 1px solid var(--line); }
.st-item:last-child { border-bottom: 0; }
.st-when, .st-time, .st-span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-time, .st-span { font-weight: 800; }
.st-what { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
/* 巡點名稱的連結(漏掉、用別人的手機兩份清單同一個樣子) */
a.st-pt { display: inline-flex; align-items: center; min-height: 44px; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.st-owner, .st-rule-n { color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.st-item.st-slot { grid-template-columns: 20rem minmax(0, 1fr) auto; }
.st-item.st-miss { grid-template-columns: 20rem minmax(0, 1fr) minmax(0, 1fr); }
.st-item.st-ck { grid-template-columns: 8.5rem 3.5rem minmax(6rem, 9rem) minmax(0, 1fr); }
/* 用別人的手機：手機的主人與註記排在一行(給寬)，巡點欄窄一點 */
.st-item.st-borrow { grid-template-columns: 8.5rem 3.5rem 7rem minmax(0, 1fr) auto; }
.st-item.st-borrow a.st-pt { display: block; max-width: 12rem; line-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-item.st-borrow .st-owner { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* 太長才截，整句在 title */
.st-item.st-borrow .st-what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-other { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.st-item .pill { justify-self: start; }
