/* 意外事件系統 視覺系統(票 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;
  /* 按鈕(2026-10-03 加強)：主按鈕用院徽亮桃紅，白字粗體(對比 4.5:1 以上)；次要按鈕白底框線，框線比 --line-2 深一階 */
  --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;
  /* 狀態(票 02 的狀態標籤用：逾期與已退回紅、已簽名綠、還沒填琥珀、已作廢灰) */
  --urgent: #C0271D; --urgent-soft: #FBE9E7; --on-urgent: #FFFFFF;
  --late: #B42318; --late-soft: #FDECEA; --late-line: #F4C7C2;
  --working: #9A5800; --working-soft: #FFF4DF; --working-line: #F1D9A6;
  --ok: #1D6B45; --ok-soft: #E5F3EB;
  --off: #5E6864; --off-soft: #ECEDE9;
  --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-2: 0 2px 4px rgba(38, 48, 45, .06), 0 10px 28px rgba(38, 48, 45, .08);
  --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;
    --urgent: #FF7B6E; --urgent-soft: #3C1A17; --on-urgent: #1B0912;
    --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
    --working: #F4B860; --working-soft: #372A12; --working-line: #54401C;
    --ok: #6FD19A; --ok-soft: #16301F;
    --off: #98A29D; --off-soft: #262B29;
    --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: #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;
  --urgent: #FF7B6E; --urgent-soft: #3C1A17; --on-urgent: #1B0912;
  --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
  --working: #F4B860; --working-soft: #372A12; --working-line: #54401C;
  --ok: #6FD19A; --ok-soft: #16301F;
  --off: #98A29D; --off-soft: #262B29;
  --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;
}

/* ── 基礎 ── */
* { 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; }
a.btn:hover { text-decoration: none; }  /* 做成按鈕的連結滑過去不要出現底線 */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.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 跟其他庭芳系統同一個數字。
   電腦上主選單與系統名稱不縮不截(票 12 審查修正)；右邊那一排放不下(印尼文比較長)時，app.js 的 量頂欄() 在 body 加 top-compact，
   右邊改成名字按鈕，點開的我的選單掛在頂欄下面靠右。 */
.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; }
/* 測試模式(票 16)：系統名稱旁邊一顆橘色膠囊，手機也看得到 */
.test-pill { flex: none; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-pill); white-space: nowrap;
  background: var(--working-soft); color: var(--working); border: 1px solid var(--working-line); font-size: var(--fs-xs); font-weight: 800; }
/* 窄手機(400px 以下)系統名稱放不下：膠囊只寫「測試」 */
.test-pill .tp-short { display: none; }
@media (max-width: 399.98px) { .test-pill .tp-long { display: none; } .test-pill .tp-short { display: inline; } }
.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); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
         background: var(--ink-2); color: var(--bg); font-style: normal; font-size: 12px; font-weight: 800; line-height: 1; }
.badge.late { background: var(--late); color: var(--on-urgent); }
.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: 8px; height: 44px; padding: 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: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-btn { max-width: 16em; }
  body.top-compact .menu { top: 64px; bottom: auto; left: auto; right: max(var(--s4), env(safe-area-inset-right)); width: 320px; max-width: calc(100vw - 2 * var(--s4)); }
}
@media (max-width: 719.98px) { .nav { display: none; } .me-links { display: none; } .brand { font-size: var(--fs-md); } .top-in { gap: var(--s3); } }
/* 最窄的手機(360 寬)：印尼文系統名稱加測試模式標示放不下，名字按鈕的左右留白與頂欄間距縮一點(票 12 合併票 16 時量到) */
@media (max-width: 399.98px) { .me-btn { padding: 0 10px; } .top-in { gap: var(--s2); } }

/* 我的選單(手機)：從底部分頁列上方打開，頂欄名字按鈕與底部「我的」開的是同一份 */
.menu { position: fixed; z-index: 40; left: max(var(--s3), env(safe-area-inset-left)); right: max(var(--s3), env(safe-area-inset-right));
        bottom: calc(68px + env(safe-area-inset-bottom)); 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, .tabbar button { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; height: 52px; padding: 0; border: 0; background: none;
                            color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; line-height: 1.2; border-radius: var(--r-md); cursor: pointer; 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"], .tabbar button[aria-expanded="true"] { color: var(--primary); }
.tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
@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)); } body.has-tabbar .toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* ── 按鈕：主按鈕 .btn 院徽桃紅；次要 .btn.ghost 白底框線(同高同圓角)；破壞性 .btn.danger 紅底。高度寫死 --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.danger { background: var(--urgent); color: var(--on-urgent); }
.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; }

/* ── 輸入：單行的一律寫死高度、拿掉原生外觀(Safari 的下拉不吃最小高度、日期框會自己長高)；下拉箭頭自己畫 ── */
.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=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 實測)。
   iPhone 版 WebKit 的原生日期框窄的時候字會被截掉：票 02 的共用日期元件不要直接露出原生日期框(照 ISP 系統的做法)。 */
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; }
textarea { width: 100%; min-height: 96px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
           padding: 10px 14px; outline: none; font-size: var(--fs-md); resize: vertical; line-height: 1.6; }
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); }
.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.ok { background: var(--ok-soft); color: var(--ok); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.sec-title { font-size: var(--fs-sm); font-weight: 800; color: var(--muted); letter-spacing: .06em; margin: 0 0 var(--s3); }

/* ── 首頁(票 01 空的；票 11 補開單按鈕、數字卡、清單) ── */
.home-sec + .home-sec { margin-top: var(--s7); }
.home-sec:first-child { margin-top: var(--s4); }
/* 沒有等我處理的項目時只寫一句話(規格 13.1)：圖示與字同一條中線 */
.quiet-line { display: flex; align-items: center; gap: var(--s2); min-height: 52px; padding: 0 var(--s4); background: var(--surface);
              border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink-2); font-size: var(--fs-md); }
.quiet-line svg { width: 22px; height: 22px; flex: none; color: var(--ok); }

/* ── 空狀態 ── */
.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 h3 { font-size: var(--fs-lg); color: var(--ink-2); }

/* ── 登入頁 ──
   版面、配色照人事帳號系統示範站 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-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 + .field { margin-top: 0; }
.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; }
@media (max-width: 480px) { html:not(.gate-mode) .modal-bg { align-items: end; padding: 0; }
  html:not(.gate-mode) .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 { 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); }
.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 可點區，同一列同高同中線。 */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.field-label { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field-err { display: block; margin-top: var(--s1); color: var(--working); font-weight: 700; font-size: var(--fs-sm); }
/* 吐司多行時圓角固定(膠囊圓角會切到字，票 07 審查修正)；日期時間欄離開框時拿掉的錯誤字先留位(版面不跳，ui.js 標錯) */
.field-err.keep { visibility: hidden; }
input.bad, select.bad, textarea.bad { border-color: var(--working); box-shadow: 0 0 0 3px var(--working-line); }
.quiet { color: var(--muted); font-size: var(--fs-sm); }
/* 只有圖示的方形鈕(跟輸入框同高)；小一號的文字鈕(44px，例如存檔提示的再試一次) */
.btn.icon { width: var(--ctl-h); padding: 0; flex: none; }
.btn.sm { height: 44px; padding: 0 14px; font-size: var(--fs-sm); }

/* 日期時間：文字框加「選日期」「選時間」方形鈕，原生框蓋在鈕上、看不見(iPhone WebKit 窄的原生框會截字) */
.dt-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.dt-part { display: flex; align-items: center; gap: var(--s2); }
.dt-part input[type=text] { font-variant-numeric: tabular-nums; }
.dt-date input[type=text] { width: 9.5em; }
.dt-time input[type=text] { width: 5.5em; }
/* 手機：日期與時間同一列放得下(日期框比時間框寬)，文字框跟著欄寬縮放 */
@media (max-width: 719.98px) {
  /* 時間那一欄至少放得下 64px 的時間框加選時間鈕(票 05 審查修正：360 寬時間框截字) */
  .dt-row.two { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(calc(64px + var(--s2) + var(--ctl-h)), 1fr); gap: var(--s2); }
  .dt-row.two .dt-part input[type=text] { width: auto; flex: 1 1 auto; min-width: 0; padding: 0 10px; }
  .dt-row.two .dt-time input[type=text] { min-width: 64px; }
}
/* 最窄的手機(360 寬)：日期與時間一列放不下完整的日期字，各占一列 */
@media (max-width: 380px) { .dt-row.two { grid-template-columns: minmax(0, 1fr); } }
.dt-btn { position: relative; overflow: hidden; border-radius: var(--r-md); }
.dt-btn svg { width: 22px; height: 22px; }
.dt-btn input[type=date], .dt-btn input[type=time] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0;
  border: 0; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.dt-part.off { opacity: .45; }
.dt-part.off input[type=text] { background: var(--surface-2); }
.dt-part.off .btn { box-shadow: none; cursor: default; }
.dt-unknowns { display: flex; flex-wrap: wrap; gap: 0 var(--s5); margin-top: var(--s1); }

/* 勾選框：自己畫(各家原生大小不一)；勾選框與字同一條中線，整列 44px 可點 */
.check { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; cursor: pointer; color: var(--ink); font-size: var(--fs-md); line-height: 1.3; }
input[type=checkbox] { -webkit-appearance: none; appearance: none; display: block; flex: none; width: 22px; height: 22px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--btn-line); border-radius: 6px; background: var(--surface) no-repeat center / 16px 16px; transition: background-color .12s, border-color .12s; }
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='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 12.5 4 4 9-9'/%3E%3C/svg%3E"); }
input[type=checkbox]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 狀態標籤：逾期實心紅最搶眼、已退回淡紅、已簽名綠、還沒填琥珀、免開與已結案中性、已作廢灰；圖示加字，不只靠顏色 */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 8px; border-radius: var(--r-pill); border: 1px solid transparent;
  font-size: var(--fs-xs); font-weight: 800; line-height: 1; white-space: nowrap; vertical-align: middle; }
.tag svg { width: 16px; height: 16px; flex: none; }
.tag-todo { background: var(--working-soft); color: var(--working); border-color: var(--working-line); }
.tag-signed { background: var(--ok-soft); color: var(--ok); }
.tag-late { background: var(--urgent); color: var(--on-urgent); }
.tag-returned { background: var(--late-soft); color: var(--late); border-color: var(--late-line); }
.tag-void { background: var(--off-soft); color: var(--off); }
.tag-waived { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-2); }
.tag-closed { background: var(--surface-3); color: var(--ink-2); }

/* 存檔提示：存檔中(轉圈)、已存檔 幾點幾分(綠勾)、沒有存到(紅)加「再試一次」 */
.save-hint { display: inline-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 svg { width: 18px; height: 18px; flex: none; }
.save-hint.ok { color: var(--ok); }
.save-hint.bad { color: var(--late); }
.spin { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }

/* 選同仁視窗：上面已選(一顆一顆，可移除)，下面「從在職名冊加人」，按了才出現搜尋與名單 */
.modal-title { font-size: var(--fs-lg); font-weight: 800; margin-bottom: var(--s2); }
.pk-head .sec-title { margin: 0 0 var(--s2); }
.pk-chosen { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-height: 44px; margin-bottom: var(--s3); }
.chip { display: inline-flex; align-items: center; max-width: 100%; height: 44px; padding-left: 14px; border-radius: var(--r-pill);
  background: var(--primary-soft); color: var(--ink); font-size: var(--fs-sm); font-weight: 700; }
.chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-x { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--ink-2); cursor: pointer; border-radius: var(--r-pill); }
.chip-x:hover { color: var(--primary); }
.chip-x svg { width: 18px; height: 18px; }
.pk-roster input[type=search] { margin-bottom: var(--s2); }
.pk-list { max-height: min(46vh, 360px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--r-md); }
.pk-list .quiet { padding: var(--s3); }
.pk-row { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 0 var(--s3); border-bottom: 1px solid var(--line); cursor: pointer; }
.pk-row:last-child { border-bottom: 0; }
.pk-row:hover { background: var(--surface-2); }
.pk-name { flex: 1 1 auto; min-width: 0; font-weight: 700; line-height: 1.3; }
.pk-row small { color: var(--muted); font-size: var(--fs-sm); line-height: 1.3; }
/* 頁面上「選同仁」那一格：已選的人一顆一顆排，旁邊一顆選人鈕 */
.pick-field { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.pick-field .pk-chosen { margin: 0; min-height: 0; }

/* 選服務對象：生活班與服務對象兩個下拉同一列 */
.res-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s2); }
@media (min-width: 720px) { .res-row { grid-template-columns: 200px 260px; } }
/* 印尼文窄手機：選人的下拉寫「Pilih kelas dulu」(第 6 步審查修正 UI/UX 3)，兩格並排放不下，一格一列 */
@media (max-width: 419.98px) { html[lang="id"] .res-row { grid-template-columns: minmax(0, 1fr); } }

/* 長文字：會自己長高；快滿時右下角顯示還可以寫幾字 */
textarea[data-grow] { overflow-y: hidden; resize: none; }
.count { display: block; margin-top: var(--s1); text-align: right; color: var(--muted); font-size: var(--fs-xs); }

/* 語言切換：中文｜Indonesia 兩顆，按下的那顆像目前分頁(按鈕不換字，寬度不跳) */
.lang-sw { display: inline-flex; align-items: center; gap: 2px; }
.lang-sw button { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  background: none; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; white-space: nowrap; }
.me-links .lang-sw button { text-decoration: none; padding: 0 12px; }
.lang-sw button:hover { color: var(--primary); }
.lang-sw button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.menu-lang { padding: 4px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .lang-sw { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); width: 100%; }
.menu .lang-sw button { justify-content: center; height: 48px; min-height: 48px; padding: 0 12px; background: var(--surface-2); color: var(--ink-2); }
.menu .lang-sw button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); box-shadow: none; }

/* 元件展示頁(只在本機開發，#/dev/ui)：給對齊量測與 e2e */
.dev-sec + .dev-sec { margin-top: var(--s6); }
.dev-card .field + .field { margin-top: var(--s5); }
.dev-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.dev-row + .dev-row { margin-top: var(--s3); }
.dev-out { margin-top: var(--s6); padding: var(--s3); background: var(--surface-2); border-radius: var(--r-md); font-family: var(--mono); font-size: var(--fs-xs);
  white-space: pre-wrap; word-break: break-all; }

/* ══ 管理頁(票 03，public/admin.js)：只在電腦、只有管理者 ══════════════
   頁首標題、五個分頁(切換不打後端)、名單卡(兩欄)、班別與地點表單、提醒與保存、送不出去的通知。 */
.page-title { font-size: var(--fs-2xl); font-weight: 800; margin: var(--s4) 0 var(--s4); }
/* 按鈕按完不停在焦點樣子(只有鍵盤操作才顯示焦點框) */
.btn:focus:not(:focus-visible) { outline: none; }
/* 分頁：一排膠囊按鈕，目前分頁白底桃紅字(跟頂欄主選單同一個樣子)；送不出去有數字、班別沒填時間有紅點 */
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; margin-bottom: var(--s5); background: var(--surface-2); border-radius: var(--r-pill); width: fit-content; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-pill); background: none;
  color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.seg .badge { margin-left: 2px; }
.seg .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--late); }
/* 名單卡：兩欄；卡頭角色名、已存檔、人數同一條中線；名字一顆一顆排 */
.adm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.adm-card { display: flex; flex-direction: column; gap: var(--s3); }
.adm-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.adm-h { font-size: var(--fs-lg); font-weight: 800; line-height: 1.3; }
.adm-h2 { margin-top: var(--s6); }
.adm-meta { display: inline-flex; align-items: center; gap: var(--s3); }
.adm-count { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.adm-saved { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-size: var(--fs-sm); font-weight: 700; }
.adm-saved svg { width: 16px; height: 16px; }
.adm-src { color: var(--muted); font-size: var(--fs-sm); margin-top: calc(-1 * var(--s2)); }
.adm-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-height: 44px; }
.adm-chips .chip-ro { padding-right: 14px; }
.chip-off { background: var(--off-soft); color: var(--off); }
.chip-pending { background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.chip-tag { height: 24px; margin-left: 6px; font-size: var(--fs-xs); }
.tag-pending { background: var(--surface); color: var(--muted); border-color: var(--line-2); }
.tag-extra { margin: 0 6px 0 -6px; background: var(--surface); color: var(--primary); border-color: var(--primary); }
/* 自動帶入的人：白底框線，旁邊一顆文字鈕(排除、不通知)；另外加的人：桃紅淡底加「另外加」標籤與叉叉；被排除的人：灰底虛線，旁邊「恢復」 */
.chip-auto { background: var(--surface); border: 1px solid var(--line-2); padding-left: 13px; }
.chip-gone { background: var(--surface-2); border: 1px dashed var(--line-2); color: var(--muted); padding-left: 13px; }
.chip-act { display: inline-flex; align-items: center; height: 44px; padding: 0 14px 0 10px; border: 0; background: none; cursor: pointer;
  color: var(--ink-2); font: inherit; font-size: var(--fs-xs); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; border-radius: var(--r-pill); }
.chip-act:hover { color: var(--primary); }
/* 名字太長時名字縮成刪節號，按鈕與標籤不換行 */
.adm-chips .chip-name { min-width: 0; }
.chip-act, .adm-chips .chip-tag, .adm-chips .chip-x { flex: none; white-space: nowrap; }
.adm-excluded { display: flex; flex-direction: column; gap: var(--s1); padding-top: var(--s2); border-top: 1px dashed var(--line); }
.adm-sub { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.banner.warn { background: var(--working-soft); color: var(--working); align-items: center; }
.adm-add { margin-top: auto; }
/* 班別與地點：一列一筆，名稱、上班、下班、刪除這列同高同中線(日期時間元件的標籤藏起來，欄名寫在最上面一列)。
   刪除這列是文字鈕(跟名單上立即生效的叉叉分開)，按存檔才算數 */
.adm-form + .adm-form { margin-top: var(--s4); }
.adm-form .adm-h { margin-bottom: var(--s3); }
.adm-row { display: grid; align-items: start; gap: var(--s3); }
.adm-row + .adm-row { margin-top: var(--s2); }
/* 上班欄寬 = 時間框(5.5em，16px 字) + 間距 + 選時間鈕；下班欄多留「隔天」標籤的位置；欄名列與資料列用同一組欄寬 */
.adm-row { --delw: 104px; }
.shift-row { --tcol: calc(88px + var(--s2) + var(--ctl-h)); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--tcol) calc(var(--tcol) + 96px) var(--delw); }
/* 名稱與印尼文名稱(票 05 審查修正，印尼文可空，空的畫面照中文顯示) */
.loc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--delw); max-width: 720px; }
/* 視窗不到 960px(頂欄以下的版面比 880px 窄)：班別一筆折成兩列，名稱、印尼文名稱、刪除這列在上，上班、下班在下(票 12 審查修正：名稱欄太窄字會被截)；
   欄名列照同一組位置排 */
@media (max-width: 959.98px) {
  .shift-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--delw); row-gap: var(--s2); }
  [data-rows] .shift-row + .shift-row { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
  .shift-row > :nth-child(3) { grid-row: 2; grid-column: 1; width: var(--tcol); }
  .shift-row > :nth-child(4) { grid-row: 2; grid-column: 2 / 4; }
  .shift-row > :nth-child(5) { grid-row: 1; grid-column: 3; }
}
.adm-endcell { display: flex; align-items: center; gap: var(--s2); height: var(--ctl-h); }
.adm-next { flex: none; background: var(--working-soft); color: var(--working); border-color: var(--working-line); font-size: var(--fs-xs); }
.adm-row .field + .field { margin-top: 0; }
.adm-row .field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.adm-cols { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.adm-del { width: 100%; padding: 0 12px; font-size: var(--fs-sm); color: var(--ink-2); box-shadow: none; }
.adm-form input.bad { border-color: var(--late); box-shadow: 0 0 0 3px var(--late-line); }
.adm-more { margin-top: var(--s3); }
.adm-more svg { width: 18px; height: 18px; }
.adm-save { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.adm-save .field-err { flex-basis: 100%; margin-top: 0; color: var(--late); }
.save-hint.dirty { color: var(--working); }
.save-hint.dirty svg, .save-hint.ok svg, .save-hint.bad svg { width: 18px; height: 18px; flex: none; }
/* 提醒與保存：三個時間一列 */
.adm-fields { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); }
.adm-fields .field + .field { margin-top: 0; }
.adm-select select { width: 240px; }
/* 送不出去的通知：一列一筆，時間、同仁與通知種類、原因與做法、已處理同一條中線 */
.adm-fails { padding: var(--s2) var(--s5); }
.fail-row { display: grid; grid-template-columns: auto minmax(0, 14em) minmax(0, 1fr) auto; align-items: center; gap: var(--s4); min-height: 72px; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.fail-row:last-child { border-bottom: 0; }
.fail-at { color: var(--muted); font-size: var(--fs-sm); }
.fail-who, .fail-why { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.fail-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fail-kind { color: var(--muted); font-size: var(--fs-sm); }
.fail-why { color: var(--ink-2); }
.fail-why small { color: var(--muted); font-size: var(--fs-sm); }
.adm-undo { align-items: center; justify-content: space-between; margin-bottom: var(--s3); background: var(--ok-soft); color: var(--ok); font-weight: 700; }
/* 確認窗 */
.confirm-msg { font-size: var(--fs-md); font-weight: 700; line-height: 1.6; }
/* 選同仁視窗：已在名單上的人(鎖住) */
.pk-lock { cursor: default; color: var(--muted); }
.pk-lock:hover { background: none; }
/* 手機打開管理頁網址：只有一句話 */
.adm-phone svg { width: 56px; height: 56px; color: var(--muted); }
/* ══ 電子簽名(票 04，public/sign.js) ══════════════════════════
 * 手寫板：整塊 touch-action: none(手指在板子上寫字，整頁與彈窗都不跟著捲)，也不讓 iPhone 長按跳出放大鏡或選字。
 * 筆跡顯示：SVG 向量，顏色跟字一樣(currentColor)，列印一律黑色；框的比例固定 5:2(跟存檔的 500 x 200 一樣)。 */
.modal.pad-modal { max-width: 640px; }
/* 板子的大小：比例固定 5:2；直式盡量寬，橫式(高度不夠)寬度改成「可視高度扣掉標題、按鈕與留白」乘 2.5，整個視窗不用捲 */
.pad-wrap { position: relative; width: min(100%, calc((100vh - 210px) * 2.5)); width: min(100%, calc((100dvh - 210px) * 2.5)); margin: 0 auto; aspect-ratio: 5 / 2; background: var(--surface); border: 1.5px dashed var(--btn-line); border-radius: var(--r-md);
  overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* 簽名基準線(只是畫面上的參考線，不會存進筆跡) */
.pad-wrap::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: 22%; border-bottom: 1.5px solid var(--line-2); pointer-events: none; }
.pad { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; color: var(--ink); }
.pad-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
/* 手機(底部彈出)：左右留白縮小讓板子更大；確定鈕(簽名、存起來)獨占下面一整列，印尼文也放得下 */
@media (max-width: 480px) {
  html:not(.gate-mode) .modal.pad-modal { padding-left: var(--s3); padding-right: var(--s3); }
  .pad-actions { flex-wrap: wrap; margin-top: var(--s4); }
  .pad-actions #padOk { flex: 1 0 100%; }
}
/* 橫放的手機：標題與按鈕靠近一點，把高度留給板子 */
@media (max-height: 480px) and (orientation: landscape) {
  .modal.pad-modal { padding-top: var(--s3); padding-bottom: var(--s3); }
  .pad-modal .modal-title { margin-bottom: var(--s1); }
  .pad-actions { margin-top: var(--s3); }
}
.ink { display: block; width: 100%; height: 100%; color: var(--ink); overflow: visible; }
/* 一個簽名：筆跡在上(底下一條簽名線)，下面一列 姓名、身分、時間 */
.sig { display: inline-grid; gap: var(--s1); margin: 0; vertical-align: top; }
.sig-ink { width: 200px; aspect-ratio: 5 / 2; border-bottom: 1px solid var(--line-2); }
.sig.sm .sig-ink { width: 140px; }
.sig-ink.lg { width: min(100%, 400px); }
.sig.pending .sig-ink { background: var(--surface-2); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.sig.pending { opacity: .6; }
.sig-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s2); font-size: var(--fs-sm); line-height: 1.4; color: var(--ink-2); }
.sig-cap b { color: var(--ink); }
.sig-cap time { color: var(--muted); font-variant-numeric: tabular-nums; }
.sig-list { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); }
.sig-list:not(:empty) { margin-top: var(--s4); }
/* 我的簽名頁 */
.ink-box { display: grid; place-items: center; min-height: 120px; }
.ink-none { padding: var(--s5) 0; }
.ink-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s4); }
/* 「重寫」與「手寫簽名」會換字：寬度固定，兩種語言都放得下 */
.ink-redo { min-width: 12em; }
/* 按鈕跟存檔提示同一列時，提示裡的「再試一次」跟旁邊的按鈕同高(介面對齊鐵律) */
.ctl-row .save-hint .btn.sm { height: var(--ctl-h); }
@media print {
  .ink, .pad { color: #000; }
  .sig-ink { border-bottom-color: #000; }
  .sig.pending { display: none; }
}
/* ══ 開單與意外事件單頁(票 05，public/incident.js、first.js、bodymap.js、photos.js) ══════════════
 * 手機優先：一欄由上往下填；同一列的下拉、輸入框、按鈕同高(--ctl-h)同中線；勾選格每格 48px 好點。 */
.home-new { display: flex; margin-top: var(--s4); }
.home-new .btn { min-width: 10em; }
.home-new .btn svg { width: 20px; height: 20px; }
/* 開單頁 */
.open-card .field + .field, .open-card .field + .dt, .open-card .dt + .dt, .open-card .dt + .banner { margin-top: var(--s5); }
.open-card .field-err:not([hidden]) { display: block; }
#opShift, .open-deadline { max-width: 28em; }
/* 第一段期限：放在班別選單正下方(票 05 審查修正，選了班別馬上看得到) */
.open-deadline { margin-top: var(--s2); align-items: center; background: var(--primary-soft); color: var(--ink); font-size: var(--fs-md); }
.open-deadline svg { margin-top: 0; color: var(--primary); }
.open-deadline.late { background: var(--late-soft); color: var(--late); }
.open-deadline.late svg { color: var(--late); }
.open-deadline div div { font-size: var(--fs-sm); font-weight: 700; }
.dup-list { list-style: none; display: grid; gap: var(--s2); margin: var(--s2) 0 0; }
.dup-list li { display: grid; }
.dup-list a { display: flex; align-items: center; min-height: 44px; font-weight: 700; }
.dup-list small { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
/* 開單鈕、第一段存草稿與簽名送出：黏在畫面底部(手機在底部分頁列上方)，填到哪裡都按得到(票 05 審查修正) */
.sticky-act { position: sticky; bottom: calc(var(--s3) + env(safe-area-inset-bottom)); z-index: 5; padding: var(--s3) 0; background: var(--surface); }
@media (max-width: 719.98px) { body.has-tabbar .sticky-act { bottom: calc(64px + env(safe-area-inset-bottom)); } }
/* 單頁：頁首 */
.inc-head { margin-top: var(--s4); }
.inc-top { display: flex; align-items: center; gap: var(--s2); min-height: 28px; color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.inc-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s3); font-size: var(--fs-2xl); font-weight: 800; line-height: 1.3; margin: var(--s1) 0 var(--s3); }
.inc-name small { font-size: var(--fs-md); color: var(--muted); font-weight: 700; }
.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19em), 1fr)); gap: var(--s2) var(--s5); }
.kv { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); align-items: center; gap: var(--s2); min-height: 32px; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv-owner dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
/* 輪到你：醒目入口(桃紅淡底；第一段逾期時紅) */
.turn { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s4); padding: var(--s3) var(--s4);
  background: var(--primary-soft); border: 1.5px solid var(--primary); border-radius: var(--r-lg); }
.turn.late { background: var(--late-soft); border-color: var(--late); }
.turn-txt { display: flex; flex-direction: column; flex: 1 1 14em; min-width: 0; line-height: 1.4; }
.turn-txt b { font-size: var(--fs-lg); }
.turn-txt span { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }
.turn.late .turn-txt span { color: var(--late); }
/* 手機上一顆一列；字太長(印尼文 360 寬「Isi ulang bagian pertama (dikembalikan)」)就在鈕裡折行，不撐破卡片(d57 收尾量測踩到：
   撐寬整頁後手機 Chromium 會縮放畫面，點的位置都會偏掉) */
@media (max-width: 719.98px) { .turn .btn { flex: 1 1 100%; min-width: 0; max-width: 100%; white-space: normal; height: auto; min-height: var(--ctl-h); padding-block: 10px; line-height: 1.3; text-align: center; } }
/* 單頁：每一段一張卡；頭是段名、狀態、期限(同一條中線) */
.inc-sec { margin-top: var(--s4); scroll-margin-top: 72px; }
.sec-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 32px; }
.sec-h h2 { font-size: var(--fs-lg); font-weight: 800; line-height: 1.3; margin-right: auto; }
.sec-due { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.sec-body:not(:empty) { margin-top: var(--s4); }
.sec-rows { list-style: none; display: grid; gap: var(--s1); }
.sec-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 44px; border-top: 1px solid var(--line); padding-top: var(--s1); }
.sec-rows li:first-child { border-top: 0; padding-top: 0; }
.sec-row-name { font-weight: 700; margin-right: auto; }
/* 異動紀錄 */
.log { list-style: none; display: grid; gap: 0; font-size: var(--fs-sm); }
.log li { display: grid; grid-template-columns: 11.5em minmax(0, 12em) minmax(0, 1fr); gap: var(--s1) var(--s3); align-items: baseline; padding: var(--s2) 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); }
.log-who, .log-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); min-width: 0; }
.log small { color: var(--muted); font-size: var(--fs-xs); }
.log q { flex-basis: 100%; color: var(--ink-2); quotes: none; }
@media (max-width: 719.98px) { .log li { grid-template-columns: minmax(0, 1fr); gap: 0; } }
/* ── 退回與作廢(票 09)：作廢鈕靠頁首右邊、退回鈕在區塊頭最右邊；作廢橫幅；打開紀錄(只有管理者) ── */
.inc-top .inc-void-btn { margin-left: auto; }
/* 審查修正：單號不拆行；放不下時(已結案又有作廢鈕的手機、印尼文)讓作廢鈕掉到下一列 */
.inc-top { flex-wrap: wrap; }
.inc-top .inc-no { white-space: nowrap; flex: none; }
/* 被退回、還沒重新簽名的段：區塊頭下面一列(誰、何時、原因)，跟作廢橫幅同款 */
.banner.ret-note { margin-top: var(--s3); align-items: flex-start; }
.ret-who { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.ret-note q { display: block; margin-top: var(--s1); color: var(--ink-2); quotes: none; overflow-wrap: anywhere; }
.inc-top #incTag:empty { display: none; }
.hl-top .ret-btn { margin-left: auto; }
.inc-void { margin-top: var(--s4); }
.inc-void q { display: block; margin-top: var(--s1); color: var(--ink-2); quotes: none; overflow-wrap: anywhere; }
.ret-warn { margin-bottom: var(--s3); }
.log-h { font-size: var(--fs-md); font-weight: 800; margin: var(--s5) 0 var(--s2); }
.log-views li { grid-template-columns: 11.5em minmax(0, 1fr); }
@media (max-width: 719.98px) { .log-views li { grid-template-columns: minmax(0, 1fr); } }
/* 第一段表單 */
.f1 .field + .field, .f1 .field + div, .f1 div + .field, .f1 .dt + .field { margin-top: var(--s5); }
.ctl-pair { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.ctl-pair > select { flex: 0 1 15em; }
.ctl-pair > input[type=text] { flex: 1 1 12em; min-width: 0; }
@media (max-width: 719.98px) { .ctl-pair > select, .ctl-pair > input[type=text] { flex: 1 1 100%; } }
/* 就醫：兩顆並排的選擇鈕(跟輸入框同高) */
.seg2 { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(7em, 1fr); gap: var(--s2); }
.seg2 button { height: var(--ctl-h); padding: 0 var(--s4); border: 1.5px solid var(--btn-line); border-radius: var(--r-md); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.seg2 button[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
@media (max-width: 719.98px) { .seg2 { display: grid; width: 100%; } }
/* 受傷類型、部位：勾選格，至少 48px，勾了變桃紅淡底。字長(印尼文)可以折兩行不截字(票 05 審查修正)；每一列一樣高(grid-auto-rows 1fr) */
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); grid-auto-rows: 1fr; gap: var(--s2); }
.chk { display: flex; align-items: center; gap: var(--s2); min-height: var(--ctl-h); padding: var(--s1) var(--s3); border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; font-weight: 700; line-height: 1.2; }
.chk span { min-width: 0; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
@media (max-width: 380px) { .chk { gap: 6px; padding: var(--s1) 8px; font-size: 15px; } }
.chk:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.f1-other { margin-top: var(--s2); }
/* 必填沒填齊：那一格紅框 */
.miss > .field-label, .miss .field-label { color: var(--late); }
.miss select, .miss input[type=text], .miss textarea, .miss .chk-grid .chk, .miss .seg2 button { border-color: var(--late); }
.f1-missing { margin-top: var(--s4); color: var(--late); font-size: var(--fs-md); }
.f1-sig:not(:empty) { margin-top: var(--s5); }
/* 存草稿、簽名送出：同一列同高。手機黏在底部分頁列上方(票 05 審查修正：存檔狀態、存草稿、簽名送出隨時看得到)，
 * 存檔狀態在上一列，兩顆各半；底色往左右蓋到卡片邊(卡片的 padding)，捲過去的內容不會從兩邊透出來 */
.f1-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.f1-save { min-width: 8em; }
.f1-sign { min-width: 10em; }
.f1-save svg { display: none; width: 22px; height: 22px; }
@media (max-width: 719.98px) {
  .f1-foot { position: sticky; z-index: 5; bottom: calc(64px + env(safe-area-inset-bottom)); margin: var(--s5) calc(-1 * var(--s5)) 0; padding: var(--s3) var(--s5);
    background: var(--surface); box-shadow: 0 -6px 12px -10px rgba(20, 23, 22, .35); }
  /* 只管底部那兩顆(直接子層)：存檔提示裡的「再試一次」不能被當成存草稿、簽名分寬度(票 06 審查修正：斷網時被擠成小圓) */
  .f1-foot > .btn { flex: 1 1 0; min-width: 0; }
  .f1-foot .save-hint { order: -1; flex-basis: 100%; }
}
/* 窄手機(印尼文「Tanda tangan dan kirim」放不下半寬)：存草稿只留圖示(方形鈕，字留給讀螢幕軟體)，簽名送出占其餘的寬 */
@media (max-width: 480px) {
  .f1-foot .f1-save { flex: none; width: var(--ctl-h); min-width: 0; padding: 0; }
  .f1-foot .f1-save svg { display: block; }
  .f1-foot .f1-save span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* 第一段只能看 */
.f1-block { margin-top: var(--s5); }
.f1-text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* 人體圖：電腦正面背面並排；手機一次一張大圖，上面切換正面背面(票 05 審查修正)。比例寫死(跟 viewBox 160 x 380 一樣)，點的位置才會跟紅點一致 */
.bm-row { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: var(--s4); justify-content: start; }
.bm-switch { display: none; margin-bottom: var(--s3); }
@media (max-width: 719.98px) {
  .bm-switch { display: grid; }
  .bm-row { grid-template-columns: minmax(0, 210px); justify-content: center; }
  .bm[data-show="f"] .bm-fig[data-v="b"], .bm[data-show="b"] .bm-fig[data-v="f"] { display: none; }
}
.bm-fig { margin: 0; display: grid; gap: var(--s1); justify-items: center; }
/* 框線用 outline(不佔版面)：用 border 的話內容框比 viewBox 窄 2px，圖會被等比縮小置中，點的位置跟紅點差 1 到 2px */
.bm-svg { display: block; width: 100%; height: auto; aspect-ratio: 160 / 380; background: var(--surface); outline: 1px solid var(--line); outline-offset: -1px; border-radius: var(--r-md); }
.bm-svg.edit { cursor: crosshair; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bm-ol > *, .bm-ol-limb > * { fill: var(--muted); stroke: var(--muted); stroke-width: 3; }
.bm-ol-limb > * { fill: none; stroke-width: 18; stroke-linecap: round; stroke-linejoin: round; }
.bm-fill > * { fill: var(--surface-2); stroke: none; }
.bm-fill-limb > * { fill: none; stroke: var(--surface-2); stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.bm-detail > * { fill: none; stroke: var(--line-2); stroke-width: 1.5; stroke-linecap: round; }
.bm-detail circle { fill: var(--line-2); }
.bm-lr { fill: var(--ink-2); font-size: 13px; font-weight: 800; text-anchor: middle; font-family: var(--font); }
.bm-dot { fill: var(--urgent); stroke: #fff; stroke-width: 1.6; }
.bm-fig figcaption { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.bm-count { margin-top: var(--s1); color: var(--muted); font-size: var(--fs-sm); }
/* 照片：縮圖照原比例放在方格裡(直式、橫式都不裁)，右上角刪除；排隊中的半透明加狀態 */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.ph { position: relative; aspect-ratio: 1; background: var(--surface-2); border-radius: var(--r-md); overflow: hidden; }
.ph-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ph img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ph-x { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 0 var(--r-md) 0 var(--r-md);
  background: rgba(20, 23, 22, .55); color: #fff; cursor: pointer; }
.ph-x svg { width: 18px; height: 18px; }
.ph.pending img { opacity: .55; }
.ph-state { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px; min-height: 28px;
  background: rgba(20, 23, 22, .6); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
.ph-bar { display: flex; align-items: center; gap: var(--s3); }
/* 被擋下的照片：那一格留著、紅框，點一下重選(票 05 審查修正) */
.ph.failed { outline: 2px solid var(--late); outline-offset: -2px; }
.ph.failed img { opacity: .45; }
.ph.failed .ph-state { background: var(--late); }
.ph-retry { display: block; width: 100%; height: 100%; cursor: pointer; }
.ph-add { position: relative; }
.ph-add.off { opacity: .45; pointer-events: none; box-shadow: none; }
.ph-n { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.modal.ph-modal { max-width: min(920px, 100%); }
.ph-view { margin: 0; display: grid; place-items: center; }
.ph-view img { display: block; max-width: 100%; max-height: calc(100vh - 180px); max-height: calc(100dvh - 180px); width: auto; height: auto; border-radius: var(--r-sm); }
@media print { .bm-dot { fill: #c00; } .ph-x, .ph-bar { display: none; } }

/* ── 票 16 管理頁「測試模式」分頁：狀態、開關、清空測試資料(乾跑列表、確認字加清空鈕同一列) ── */
.adm-test-act { margin-top: var(--s3); }
#admTest .adm-head .adm-h { margin-bottom: 0; }
.adm-test-sub { display: block; margin: var(--s5) 0 var(--s2); }
.purge-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s6); max-width: 720px; }
.purge-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 40px; border-bottom: 1px solid var(--line); }
.purge-row dt { color: var(--ink-2); }
.purge-row dd { font-weight: 700; }
.purge-keep { color: var(--ink-2); max-width: 720px; }
/* 乾跑警告：服務對象不是假的單(票 16 審查修正)，跟列表同寬、上面留空 */
#purgeReal { max-width: 720px; margin-top: var(--s4); }
.purge-act { align-items: flex-end; }
.purge-word { flex: 0 1 320px; }
.purge-word input { width: 100%; }
/* ══ 各組處置情形(票 06，public/second.js) ══════════════════════════
 * 四個角色各一塊(護理、社工、教保組長、院長意見)，塊與塊之間一條線；每塊的頭是名稱、狀態、期限(同一條中線)。
 * 表單照第一段(存草稿、簽名黏在手機分頁列上方)；選擇鈕跟輸入框同高；三顆的選擇鈕(家屬聯繫、通知方式)字長可以折兩行，不截字。 */
.s2-sub + .s2-sub { margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--line); }
.s2-sub { scroll-margin-top: 72px; }
.sub-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 32px; }
.sub-h h3 { font-size: var(--fs-md); font-weight: 800; line-height: 1.3; margin-right: auto; }
.sub-body:not(:empty) { margin-top: var(--s3); }
.s2-note { display: block; margin-top: var(--s1); color: var(--muted); font-size: var(--fs-sm); }
.s2-fam > div + div, .s2-fam > .field + .field, .rp-done > * + * { margin-top: var(--s4); }
.s2-fam:not([hidden]) { display: block; margin-top: var(--s5); }
.f1-block + .s2-form, .hl { margin-top: var(--s5); }
.seg2 button:disabled { opacity: .45; cursor: default; }
.seg2.seg-3 { grid-auto-columns: minmax(6.5em, 1fr); }
/* 字長(印尼文)可以折行，按鈕跟著長高；同一列的其他按鈕一起拉高(grid 同列等高) */
.s2 .seg2 button { white-space: normal; line-height: 1.15; height: auto; min-height: var(--ctl-h); padding: 4px var(--s2); }
@media (max-width: 719.98px) { .seg2.seg-3 { grid-auto-columns: minmax(0, 1fr); } }
/* 健康追蹤：每一筆一張小卡；可以改的那一筆框線桃紅 */
.hl-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 44px; }
.hl-h h4, .rp-h h4 { font-size: var(--fs-md); font-weight: 800; margin-right: auto; }
.hl-h.miss h4 { color: var(--late); }
.hl-list { display: grid; gap: var(--s3); margin-top: var(--s2); }
.hl-rec { padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.hl-rec.edit { border-color: var(--primary); }
.hl-rec > * + * { margin-top: var(--s3); }
.hl-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 28px; }
.hl-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.hl-foot .save-hint { flex: 1 1 12em; }
@media (max-width: 719.98px) { .hl-foot > .btn { flex: 1 1 0; min-width: 0; } .hl-foot .save-hint { order: -1; flex-basis: 100%; } }
/* 通報那一小塊(只給社工、院長、管理者)：淡灰底框起來，標保密 */
.rp { margin-top: var(--s5); padding: var(--s4); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-2); }
.rp-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 32px; margin-bottom: var(--s3); }
.rp .field + .field, .rp .field + div, .rp div + .field, .rp .rp-done + .field-err, .rp .banner + .field { margin-top: var(--s4); }
.rp-due { align-items: center; margin-bottom: var(--s3); }
.rp-due:not(.late) { background: var(--working-soft); color: var(--working); }
.rp .hl-foot { margin-top: var(--s4); }
/* 院長：免開檢討會議 */
.wv { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
/* 免開那一列在院長那一塊最上面(審查修正)，下面接院長意見、等三個的說明或只能看的意見 */
.wv + .s2-form, .wv + .s2-wait, .wv + .f1-block { margin-top: var(--s5); }
.wv .banner { flex: 1 1 100%; align-items: center; }
.wv-on { background: var(--surface-3); color: var(--ink-2); }
@media (max-width: 719.98px) { .wv .btn { flex: 1 1 100%; } }

/* ══ 自動翻譯(票 12，public/translate.js) ══════════════════════════
 * 印尼文寫的長文字：原文下面一格中文譯文(左邊一條線、淡灰底，跟原文分得開)。翻譯中轉圈；失敗寫一句加「再試一次」(同一條中線)。 */
.tr:not([hidden]) { display: block; margin-top: var(--s2); padding: var(--s2) var(--s3); border-left: 3px solid var(--line-2); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2); }
.tr-label { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; line-height: 1.4; }
.tr-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tr-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 28px; color: var(--muted); font-size: var(--fs-sm); }
.tr-spin { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.tr-failed { border-left-color: var(--late-line); }
.tr-fail > span { color: var(--late); font-weight: 700; flex: 1 1 12em; }
.wv .tr { flex: 1 1 100%; margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .tr-spin { animation: none; } }
@media print { .tr-retry, .tr-spin { display: none; } }

/* ══ 家屬說明擬稿(票 13，public/draft.js) ══════════════════════════
 * 社工那一塊的家屬聯繫下面：說明框，下面一列「擬稿」「複製」加存檔狀態(同高同中線，手機兩顆各半)。失敗寫一句加「再試一次」。 */
.dr { margin-top: var(--s5); }
.dr .dr-act { margin-top: var(--s3); }
.dr-fail:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s2); }
.dr-fail > span { color: var(--late); font-weight: 700; flex: 1 1 12em; }
/* 不是錯的說明(別人剛擬好，已換成最新的)：一般字色 */
.dr-fail.note > span { color: var(--ink); }
.dr-gen[aria-busy="true"] { cursor: progress; }
/* 列印：給家屬的說明整塊不印(只給社工、護理、院長、管理者看；單頁直接用瀏覽器列印時也不能帶出去，審查修正) */
@media print { .dr { display: none !important; } }
/* ══ 檢討紀錄(票 07，public/review.js) ══════════════════════════
 * 三塊(檢討會議、紀錄、送出後的簽名)，塊與塊之間一條線(照各組處置情形)。與會人員一人一列：名字、簽名格別下拉、叉叉同一條中線；
 * 三項改進措施各一個框；送出後的簽名一人一列(名字與格別在左，簽名或「還沒簽名」與按鈕在右)。 */
.rv .s2-sub { scroll-margin-top: 72px; }
.rv-form > * + * { margin-top: var(--s5); }
.rv-att { list-style: none; display: grid; gap: var(--s2); margin: var(--s2) 0 0; padding: 0; }
.rv-att-row { display: flex; align-items: center; gap: var(--s2) var(--s3); min-height: var(--ctl-h); }
.rv-att-name { flex: 1 1 auto; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.rv-att-row select { flex: 0 1 13em; width: 13em; min-width: 0; }
.rv-att-row .chip-x { flex: none; }
.rv-att-ro { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: var(--s1) 0 0; padding: 0; }
.rv-att-ro li, .rv-sig-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); }
.rv-att-ro small, .rv-sig-who small { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.rv-ms { display: grid; gap: var(--s3); margin-top: var(--s2); }
.rv-m { padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.rv-m h4 { font-size: var(--fs-md); font-weight: 800; margin-right: auto; }
.rv-m > * + *, .rv-m-body > * + * { margin-top: var(--s3); }
.rv-m.none { background: var(--surface-2); }
.rv-m.miss { border-color: var(--late); }
.rv-sigs { list-style: none; display: grid; gap: var(--s3); margin: 0; padding: 0; }
.rv-sig-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); min-height: var(--ctl-h); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.rv-sig-row:last-child { border-bottom: 0; padding-bottom: 0; }
.rv-sig-who { flex: 1 1 10em; min-width: 0; }
.rv-sig-what { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.rv-sig-row .save-hint { flex-basis: 100%; }
@media (max-width: 719.98px) {
  .rv-att-row select { flex: 1 1 0; width: auto; }
  .rv-att-row .rv-att-name { flex: 1 1 100%; }
  .rv-att-row { flex-wrap: wrap; }
  .rv-sig-who { flex-basis: 100%; }
}
/* 還沒選主席、執行人員時，空的那一格不佔位置(選人鈕靠左對齊) */
.rv .pick-field .pk-chosen:empty { display: none; }

/* ══ 列印(票 15，public/print.js、print-rule.js；規格 14.2，PDF 格式鐵律) ══════════════════════
 * 紙張：A4 直式、邊界 10mm，可列印寬 190mm；表的內容寬 186mm(少 4mm：Chrome 換算像素時剛好等寬會把最右邊的框線切掉一半)。
 * 印出來的表一律白底黑字(不吃深色模式的變數)，框線 1px 黑；人體圖紅點與表頭底色要印出來(print-color-adjust: exact)。
 * 畫面上：一張 A4 紙的預覽(紙寬 210mm、內距 10mm)，手機比紙窄就用 --pr-zoom 整張縮小(public/print-rule.js 的 預覽縮放)，不左右捲。 */
@page { size: A4 portrait; margin: 10mm; }
.inc-print { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s4); }
.pr-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--s3); margin: var(--s3) 0 var(--s4); }
.pr-stage { overflow-x: auto; }
.pr-paper { width: 210mm; min-height: 297mm; padding: 10mm; margin: 0 auto; background: #fff; color: #000; box-shadow: var(--shadow-2, 0 8px 24px rgba(0, 0, 0, .12)); }
/* 手機預覽整張縮小時 1px 的框線會細到看不見：畫面上框線照縮小比例加粗(縮完約 1px)；印的時候一律 1px */
@media screen { .pr-paper { zoom: var(--pr-zoom, 1); --pr-line: calc(1px / var(--pr-zoom, 1)); } .pr-back { margin-top: 14mm; padding-top: 10mm; border-top: 1px dashed #888; } }

.pr-sheet { width: 186mm; color: #000; background: #fff; font-size: 10pt; line-height: 1.45; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pr-sheet .ink { color: #000; }
.pr-head { display: grid; grid-template-columns: 15mm minmax(0, 1fr) auto; align-items: center; gap: 3mm; margin-bottom: 3mm; break-inside: avoid; }
.pr-logo { display: block; width: 14mm; height: 14mm; object-fit: contain; }
.pr-title b { display: block; font-size: 10pt; font-weight: 700; letter-spacing: .08em; }
.pr-title h1 { margin: 0; font-size: 16pt; font-weight: 800; line-height: 1.25; letter-spacing: .12em; }
.pr-title h1 small { margin-left: 3mm; font-size: 11pt; font-weight: 700; letter-spacing: .04em; }
.pr-meta { display: grid; justify-items: end; gap: 1mm; font-size: 9pt; font-variant-numeric: tabular-nums; }
.pr-void { padding: .3mm 2.5mm; border: 1.5px solid #000; font-size: 12pt; letter-spacing: .2em; }
.pr-h2 { margin: 3mm 0 1.5mm; font-size: 11pt; font-weight: 800; break-after: avoid; }

.pr-t { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0 0 3mm; }
.pr-t th, .pr-t td { border: var(--pr-line, 1px) solid #000; padding: 1.2mm 1.8mm; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.pr-t th { font-weight: 700; background: #EFEFEF; font-size: 9.5pt; }
.pr-t col.c-l { width: 28mm; }
.pr-t col.c-sig { width: 44mm; }
.pr-t col.c-d { width: 22mm; }
.pr-t col.c-item { width: 22mm; }
/* 換頁：長文字的列可以跨頁(不然一大段整列被推到下一頁，前一頁留一大片白)；短的列(人體圖、簽名、表頭列)不拆開 */
.pr-t tr.pr-keep, .pr-t tr.pr-colh { break-inside: avoid; }
.pr-t th.pr-row-h { break-after: avoid; }
.pr-t td.pr-long { height: 22mm; }
.pr-t th.pr-row-h { background: #EFEFEF; }
.pr-t .pr-colh th { text-align: center; }
.pr-t td.pr-sigc { height: 18mm; }
.pr-t td.pr-sigc.sm { height: 12mm; }
.pr-t td.pr-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-t td.pr-nest { padding: 0; height: 12mm; }
.pr-in { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pr-in td { border: 0; border-left: var(--pr-line, 1px) solid #000; border-bottom: var(--pr-line, 1px) solid #000; padding: 1.2mm 1.8mm; vertical-align: top; }
.pr-in td:first-child { border-left: 0; }
.pr-in tr:last-child td { border-bottom: 0; }
.pr-in col.c-d { width: 22mm; }
.pr-in col.c-sig { width: 44mm; }
.pr-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pr-sub { margin-top: 1mm; font-size: 8.5pt; font-weight: 700; color: #333; }
.pr-sub:first-child { margin-top: 0; }
.pr-note { display: block; font-size: 8pt; color: #444; }
.pr-dim { color: #444; }
.pr-sep { display: inline-block; width: 4mm; }
.pr-unsigned { color: #333; font-size: 9pt; }

/* 受傷位置：左邊正面背面兩張人體圖(紅點)，右邊受傷類型、部位的勾選格與受傷大小 */
.pr-injury { display: grid; grid-template-columns: 62mm minmax(0, 1fr); gap: 3mm; }
.pr-map .bm-print { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm; }
.pr-sheet .bm-fig { display: grid; justify-items: center; gap: .5mm; }
.pr-sheet .bm-svg { width: 100%; background: #fff; outline: var(--pr-line, 1px) solid #000; border-radius: 0; }
.pr-sheet .bm-ol > *, .pr-sheet .bm-ol-limb > * { fill: #777; stroke: #777; }
.pr-sheet .bm-ol-limb > * { fill: none; }
.pr-sheet .bm-fill > * { fill: #fff; }
.pr-sheet .bm-fill-limb > * { stroke: #fff; }
.pr-sheet .bm-detail > * { stroke: #999; }
.pr-sheet .bm-detail circle { fill: #999; }
.pr-sheet .bm-lr { fill: #000; }
.pr-sheet .bm-dot { fill: #D00000; stroke: #fff; }
.pr-sheet .bm-fig figcaption { color: #000; font-size: 9pt; }
.pr-cks { display: flex; flex-wrap: wrap; gap: .8mm 3mm; margin-bottom: 1mm; }
.pr-ck { display: inline-flex; align-items: center; gap: 1mm; font-size: 9pt; white-space: nowrap; }
.pr-ck i { position: relative; display: inline-block; flex: none; width: 3.2mm; height: 3.2mm; border: var(--pr-line, 1px) solid #000; }
.pr-ck.on i::after { content: ""; position: absolute; left: .85mm; top: .1mm; width: 1mm; height: 1.9mm; border: solid #000; border-width: 0 .5mm .5mm 0; transform: rotate(45deg); }

/* 簽名：筆跡(向量，放大不糊)、名字、時間 */
.pr-sig { margin: 0; display: grid; gap: .5mm; break-inside: avoid; }
.pr-ink { width: 40mm; height: 16mm; border-bottom: 1px solid #999; }
.pr-sig figcaption { display: flex; flex-wrap: wrap; gap: 0 2mm; font-size: 8pt; line-height: 1.3; }
.pr-sig figcaption b { font-weight: 700; }
.pr-sig time { font-variant-numeric: tabular-nums; }
.pr-in .pr-ink { width: 30mm; height: 12mm; }
/* 六格簽核(決定 22)：一格 31mm，一格可以有好幾位 */
.pr-six { break-inside: avoid; }
.pr-six th { text-align: center; padding: 1mm .8mm; font-size: 9pt; }
.pr-six td { height: 24mm; padding: 1mm; }
.pr-six .pr-sig + .pr-sig, .pr-six .pr-unsigned + .pr-sig, .pr-six .pr-sig + .pr-unsigned { margin-top: 1.5mm; }
.pr-six .pr-ink { width: 100%; height: auto; aspect-ratio: 5 / 2; }
.pr-close { break-inside: avoid; }
/* 背面另起一頁(紙本是同一張紙的背面)；原文附錄接在最後 */
.pr-back { break-before: page; }
.pr-appendix { margin-top: 4mm; }

@media print {
  html.pr-mode, html.pr-mode body { background: #fff !important; }
  html.pr-mode .top, html.pr-mode .tabbar, html.pr-mode .menu, html.pr-mode .pr-bar, html.pr-mode .toast, html.pr-mode .modal-bg { display: none !important; }
  html.pr-mode .view { max-width: none; margin: 0; padding: 0; }
  html.pr-mode .pr-stage { overflow: visible; }
  html.pr-mode .pr-paper { width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none; }
}


/* ══ 最終追蹤與結案(票 08，public/followup.js) ══════════════════════════
 * 三項改進措施各一塊(照各組處置情形，塊與塊之間一條線)，頭是名稱、狀態、期限同一條中線；執行人員那一列名字與「改派」同一條中線。
 * 結案：還沒完成的項目一行，院長的「繼續追蹤」「結案」兩顆同高同中線(手機上各佔一半)。 */
.fu-item > * + * { margin-top: var(--s5); }
.fu-item.f1 > .f1-foot { margin-top: var(--s5); }
.fu .pick-field .pk-chosen:empty { display: none; }
.cl > * + * { margin-top: var(--s4); }
.cl-miss { color: var(--ink-2); }
.cl-act { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.cl-act .btn { min-width: 8em; }
.cl-act .save-hint { flex: 1 1 12em; }
@media (max-width: 719.98px) { .cl-act > .btn { flex: 1 1 0; min-width: 0; } .cl-act .save-hint { order: -1; flex-basis: 100%; } }
.tag-ready { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
/* 視窗裡被擋下的說明：原因加「重新整理」同一條中線 */
.re-err:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.tag-incomplete { background: var(--working-soft); color: var(--working); border-color: var(--working-line); }
/* 沒存到的字(兩人同時改，後存的人重新整理後)：列在表單最上面，帶入與不要了兩顆同高同中線 */
.banner.unsaved { align-items: flex-start; margin-bottom: var(--s4); }
.unsaved-body { flex: 1 1 auto; min-width: 0; }
.unsaved-body q { display: block; margin-top: var(--s2); overflow-wrap: anywhere; white-space: pre-wrap; }
.unsaved-act { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); }
@media (max-width: 719.98px) { .unsaved-act > .btn { flex: 1 1 0; min-width: 0; } }
.tag-following { background: var(--working-soft); color: var(--working); border-color: var(--working-line); }
/* ── 票 14 統計頁(public/stats.js) ──
 * 期間一列：開始日、結束日、查詢、匯出 Excel。電腦同一列靠下對齊(日期框、選日期鈕、兩顆按鈕同高 --ctl-h，中線一致)；手機兩格日期各一列、兩顆按鈕並排。
 * 匯出鈕會換字(匯出中)，寬度寫死(兩種語言的兩種字都放得下)。 */
.st-period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); }
.st-period .field + .field { margin-top: 0; }
.st-acts { display: flex; gap: var(--s2); margin-left: auto; }
.st-export { width: 10.5em; padding: 0 12px; }
@media (max-width: 719.98px) {
  .st-period { display: block; }
  .st-period .field + .field { margin-top: var(--s4); }
  .st-period .dt-part { width: 100%; }
  .st-period .dt-part input[type=text] { width: auto; flex: 1 1 auto; min-width: 0; }
  .st-acts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: var(--s5); }
  .st-acts .btn { width: auto; min-width: 0; padding: 0 12px; }
}
.st-out { margin-top: var(--s5); transition: opacity .15s; }
.st-out.busy { opacity: .5; }
.st-range { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; margin: 0 0 var(--s3); font-variant-numeric: tabular-nums; }
.st-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.st-card { display: grid; align-content: start; gap: 2px; padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.st-num { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--ink); }
.st-label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); overflow-wrap: anywhere; }
.st-sub { font-size: var(--fs-xs); font-weight: 700; color: var(--late); overflow-wrap: anywhere; }
#stOverdue .st-num { color: var(--late); }
.st-none { margin-top: var(--s4); }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s4); align-items: start; }
@media (max-width: 719.98px) { .st-cards { gap: var(--s2); } .st-card { padding: var(--s3); } .st-grid { grid-template-columns: minmax(0, 1fr); } }
.st-sec .sec-title { margin-bottom: var(--s2); }
.st-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.st-bars li { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) 2.5em; align-items: center; gap: var(--s3); min-height: 32px; }
.st-name { font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; line-height: 1.35; }
.st-bar { height: 10px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.st-bar i { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: var(--primary); }
.st-n { text-align: right; font-variant-numeric: tabular-nums; }
.st-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.st-table th, .st-table td { padding: 6px 0; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.st-table th:first-child { text-align: left; font-weight: 400; color: var(--ink); overflow-wrap: anywhere; padding-right: var(--s3); }
.st-table thead th { color: var(--muted); font-weight: 700; font-size: var(--fs-xs); }
.st-table td { width: 4.5em; font-weight: 700; }
.st-table tr:last-child th, .st-table tr:last-child td { border-bottom: 0; }
.st-and { margin: 0 6px; color: var(--muted); }

/* ══ 首頁(票 11，public/home.js)：數字卡、等我處理、全部意外事件(分頁、搜尋、期間、紅燈) ══════════════
 * 數字卡點了當篩選(按下去的那張桃紅框)；逾期的項目左邊一條紅、字標紅；篩選那一列的輸入框與日期框同高(--ctl-h)，底對齊所以同中線。 */
.home-new + .home-sec, .home-new + .hm-cards { margin-top: var(--s6); }
.hm-cards + .home-sec { margin-top: var(--s6); }
.hm-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: var(--s3); margin-bottom: var(--s4); }
.hm-cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hm-card { display: grid; align-content: start; justify-items: start; gap: 2px; min-width: 0; min-height: 80px; padding: var(--s3) var(--s4);
           font: inherit; text-align: left; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg);
           box-shadow: var(--shadow-1); cursor: pointer; }
.hm-card:hover { border-color: var(--btn-line); }
.hm-card[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.hm-num { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hm-label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); overflow-wrap: anywhere; }
.hm-card-late .hm-num, .hm-card-countdown .hm-num { color: var(--late); }
.hm-tabs { margin-bottom: 0; }
/* 分頁那一列：分頁加上數字卡篩選開著時的篩選鈕(「逾期 ×」，按了取消；審查修正 UX 先修 1)。篩選鈕跟分頁的按鈕同高 44px、同中線 */
.hm-tabrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s4); }
.hm-chip { display: inline-flex; align-items: center; gap: 6px; height: 44px; max-width: 100%; padding: 0 12px 0 16px; border: 1.5px solid var(--primary);
           border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; }
.hm-chip[hidden] { display: none; }
.hm-chip:hover { background: var(--surface); }
.hm-chip-name { white-space: nowrap; }
.hm-chip svg { width: 18px; height: 18px; flex: none; }
.nw { white-space: nowrap; }
#hAll { scroll-margin-top: 72px; }
.hm-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); margin-bottom: var(--s4); }
.hm-filter .field + .field { margin-top: 0; }
.hm-q input { width: 14em; }
.hm-mine, .hm-list { list-style: none; display: grid; gap: var(--s2); margin: 0; padding: 0; }
.hm-item, .hm-row { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); text-decoration: none; }
.hm-item:hover, .hm-row:hover { border-color: var(--btn-line); text-decoration: none; }
.hm-item.late, .hm-row.late { border-color: var(--late-line); box-shadow: inset 4px 0 0 var(--urgent), var(--shadow-1); }
.hm-item { display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: var(--s2) var(--s3) var(--s2) var(--s4); }
.hm-main { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.hm-main b { font-size: var(--fs-md); overflow-wrap: anywhere; }
.hm-item.late .hm-main b { color: var(--late); }
.hm-main small { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.hm-due { flex: none; }
.quiet-due { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.hm-go { width: 20px; height: 20px; flex: none; color: var(--muted); }
.hm-row { display: grid; gap: var(--s1); padding: var(--s3) var(--s4); }
.hm-row-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.hm-row-h .tag { margin-left: auto; }
.hm-name { font-size: var(--fs-md); overflow-wrap: anywhere; }
.hm-row-h small { font-size: var(--fs-sm); color: var(--muted); }
.hm-meta { display: flex; flex-wrap: wrap; gap: 2px var(--s3); font-size: var(--fs-sm); color: var(--muted); }
.hm-red { list-style: none; display: grid; gap: 2px; margin: var(--s1) 0 0; padding: 0; }
.hm-red li { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--late); overflow-wrap: anywhere; }
.hm-red svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
@media (max-width: 719.98px) {
  .hm-cards, .hm-cards.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .hm-card { min-height: 72px; padding: var(--s3); }
  .hm-tabs { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* 等我處理每一項(審查修正 UX 先修 2)：主欄佔滿，期限或逾期移到主欄底下靠左，箭頭留在右邊置中；單號、班別不從中間斷開 */
  .hm-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main go" "due go"; align-content: center; column-gap: var(--s3); row-gap: 0; }
  .hm-item > .hm-main { grid-area: main; }
  .hm-item > .hm-due { grid-area: due; justify-self: start; margin-top: var(--s1); }
  .hm-item > .quiet-due { text-align: left; }
  .hm-item > .hm-go { grid-area: go; align-self: center; }
  .hm-tabs button { justify-content: center; padding: 0 var(--s2); }
  .hm-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }
  .hm-q { grid-column: 1 / -1; }
  .hm-q input { width: 100%; }
  .hm-filter .dt-part { width: 100%; }
  .hm-filter .dt-part input[type=text] { width: auto; flex: 1 1 auto; min-width: 0; padding: 0 10px; }
}
/* 窄手機篩選區(之後改總表 38)：兩格並排，第一屏才看得到單。印尼文的日期提示字「thn-bln-tgl」比中文寬，左右留白縮成 6px
   (360 寬量過：字 84px、放得下 88px)；比 360 還窄才一格一列 */
@media (max-width: 419.98px) { html[lang="id"] .hm-filter .dt-part input[type=text] { padding: 0 6px; } }
@media (max-width: 359.98px) { html[lang="id"] .hm-filter { grid-template-columns: minmax(0, 1fr); } }

/* 決定 57：修改視窗的預覽(d57 UX 審查修正)：第一行新的發生當天，接著各段的新期限一段一行(段名與期限兩欄，期限不折行)，
   改了會立刻逾期的那幾行紅字，最後一行說紅字是什麼。不放圖示(iPhone 印尼文要不捲就看得到修改鈕) */
.f1w-due { margin-top: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--primary-soft); }
.f1w-due.late { background: var(--late-soft); }
.f1w-dues { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); line-height: 1.45; display: grid; grid-template-columns: minmax(0, max-content) max-content; gap: 0 var(--s3); }
.f1w-dues li { display: contents; }
.f1w-dues li > span:first-child { color: var(--muted); }
.f1w-dues .mono { white-space: nowrap; font-weight: 700; }
.f1w-dues li.f1w-day > span { color: var(--ink); font-weight: 700; }
.f1w-dues li.late > span { color: var(--late); }
.f1w-late { margin: 2px 0 0; font-size: var(--fs-sm); font-weight: 700; color: var(--late); }
/* 決定 59 管理頁「外號遮名」：一位服務對象一列(姓名、稱呼一顆一顆、加稱呼的框與鈕同高同中線) */
.al-note { margin-top: 0; margin-bottom: var(--s3); max-width: 60em; }
.al-row { display: grid; grid-template-columns: minmax(7em, 11em) minmax(0, 1fr); gap: var(--s2) var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.al-row:first-child { border-top: 0; }
.al-who { display: flex; flex-direction: column; justify-content: center; min-height: 44px; min-width: 0; }
.al-who b { overflow-wrap: anywhere; }
.al-who small { color: var(--muted); font-size: var(--fs-sm); }
.al-chips .chip { max-width: 100%; }
.al-add { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.al-add input { width: 18em; max-width: 100%; }
.al-add .save-hint { margin: 0; }
