/* 排班系統 視覺系統 (沿用設備報修系統的樣式基底)
 *
 * 方向：像一塊乾淨的工務白板。米白底(入口站同色)、深墨字，庭芳桃紅只用在「要你動手」的地方
 * (主要按鈕、目前分頁、焦點)。狀態色：違規與逾期紅、提醒與處理中琥珀、完成綠、停用灰。
 * 手機優先：單欄、大觸控區(最小 44px)、整頁捲動(iPhone Safari 不做整頁 fixed 版面)；
 * 720px 以上電腦版內容置中、最寬 880px，卡片改兩段式排版。
 *
 * token 分四組：顏色、字級、間距、圓角與陰影。元件只准用 token，不寫死數值。
 */
:root {
  /* 一、顏色：底與字 */
  --bg: #F7F7F3; --surface: #FFFFFF; --surface-2: #F0F0EA; --surface-3: #E7E7DF;
  --ink: #26302D; --ink-2: #44504B; --muted: #6B7571; --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;
  /* 狀態 */
  --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: #6B7571; --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;
  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; }

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

/* ── 按鈕(2026-10-03 加強：主按鈕院徽亮桃紅、字重 800、陰影加深；次要動作一律白底框線，跟主按鈕同高同圓角，一眼看得出是按鈕) ──
   主按鈕 .btn；次要 .btn.ghost 與 .btn.quiet 同一個樣子(quiet 是舊名，視窗與表單的「取消」「先不要」「關閉」都用它)；破壞性 .btn.danger 紅底。
   登入頁(gate-mode)照示範站，在下方把按鈕 token 換回示範站的值。 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
       border: 0; border-radius: var(--r-pill); cursor: pointer; font-weight: var(--btn-weight); white-space: nowrap;
       background: var(--btn-bg); color: var(--on-btn); transition: background .15s, transform .06s, box-shadow .15s, border-color .15s;
       box-shadow: var(--btn-shadow); }
.btn:hover { background: var(--btn-bg-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.btn.ghost, .btn.quiet { 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, .btn.quiet:hover { border-color: var(--btn-bg); background: var(--primary-soft); }
.btn.ghost:disabled, .btn.quiet:disabled { background: var(--surface); border-color: var(--btn-line); }
.btn.danger { background: var(--urgent); color: var(--on-urgent); box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 6px 16px color-mix(in srgb, var(--urgent) 30%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--urgent) 85%, #000); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.actions { display: flex; gap: var(--s2); margin-top: var(--s5); }
.actions .btn { flex: 1; }

/* ── 輸入 ── */
.field { display: block; }
.field + .field { margin-top: var(--s4); }
.field > span { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 48px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 10px 14px; outline: none; font-size: var(--fs-md); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
input::placeholder, textarea::placeholder { color: var(--ph); }
textarea { resize: vertical; line-height: 1.6; }
/* 開關(只看我報的) */
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: relative; width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--line-2); transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ── 卡片、標籤、提示條 ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: var(--s5); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
        font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.chip svg { width: 14px; height: 14px; }
/* 狀態標籤：待接單桃紅(要人動手)、處理中琥珀、已完成綠、不處理灰；急實心紅、逾期紅字 */
.chip.open { background: var(--primary-soft); color: var(--primary); }
.chip.working { background: var(--working-soft); color: var(--working); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.off { background: var(--off-soft); color: var(--off); }
.chip.urgent { background: var(--urgent); color: var(--on-urgent); }
.chip.late { background: var(--late-soft); color: var(--late); }
.chip.brand { background: var(--primary-soft); color: var(--primary); }
.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.warn { background: var(--working-soft); color: var(--working); }
.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; }

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

/* ── 清單頁：標題與分頁黏在頂欄下方(只用 sticky，整頁仍正常捲動) ── */

/* 分頁(三個)：平均分配寬度，不換行、不橫向捲動 */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; margin-bottom: var(--s4); }
.tab { flex: 1 1 auto; min-width: 0; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 12px;
       border-radius: var(--r-pill); color: var(--ink-2); font-weight: 700; font-size: var(--fs-md); }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.tab .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: inline-grid; place-items: center;
              font-size: 13px; background: var(--surface-3); color: var(--muted); }
.tab.on .count { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 719.98px) {
  .tabs { gap: 2px; padding: 3px; }
  .tab { gap: 5px; padding: 0 4px; min-height: 44px; font-size: var(--fs-md); }
  .tab .count { min-width: 20px; height: 20px; padding: 0 5px; font-size: 12px; }
}

/* ── 清單卡片 (首頁月份清單)：左邊一條狀態色 ── */
.items { display: grid; gap: var(--s3); }
.item { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
        box-shadow: var(--shadow-1); padding: var(--s3) var(--s4) var(--s3) calc(var(--s4) + 4px); color: var(--ink); overflow: hidden;
        transition: box-shadow .15s, border-color .15s, transform .06s; }
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-2); }
.item:hover { text-decoration: none; box-shadow: var(--shadow-2); border-color: var(--line-2); }
.item:active { transform: scale(.995); }
.item.open::before { background: var(--primary); }
.item.working::before { background: var(--working); }
.item.late { border-color: var(--late-line); } .item.late::before { background: var(--late); }
.item.done { opacity: .82; } .item.done::before { background: var(--ok); }

.item-top { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: 2px; }
.item .no { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.item h3 { font-size: var(--fs-lg); line-height: 1.3; font-weight: 800; }

.item .meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 2px; font-size: var(--fs-xs); line-height: 1.4; color: var(--muted); }
.item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.item .meta svg { width: 14px; height: 14px; opacity: .8; }
.when { margin-left: auto; font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.item.late .when { color: var(--late); } .item.working .when { color: var(--working); }
@media (min-width: 720px) {
  .item { display: grid; grid-template-columns: 1fr auto; column-gap: var(--s5); padding: var(--s4) var(--s5) var(--s4) calc(var(--s5) + 4px); }
  .item-top { grid-column: 1 / -1; }
  .item .meta { grid-column: 1 / -1; }
}

.hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; line-height: 1.5; }

.sec { font-size: var(--fs-sm); font-weight: 800; color: var(--muted); letter-spacing: .06em; margin-bottom: var(--s3); display: flex; align-items: baseline; gap: 8px; }
.sec .muted { font-weight: 600; letter-spacing: 0; }

/* 異動紀錄時間軸：左邊一條線，一點一則 */

@media (min-width: 900px) {
  .detail { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s5); }
  
  
}

/* ── 彈窗裡的標題 ── */
.modal-title { font-size: var(--fs-xl); line-height: 1.3; margin-bottom: var(--s3); }
.modal .field + .field { margin-top: var(--s4); }
.modal .banner { margin-top: var(--s4); }

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

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

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

/* ── 管理頁(電腦版，720px 以上；票 07 填內容)：左側導覽，右邊一塊；整頁放寬到 1240px ── */
html.admin-wide { --wrap: 1240px; }
.adm { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: var(--s7); align-items: start; }
.adm-side { position: sticky; top: calc(60px + var(--s5)); }
.adm-title { font-size: var(--fs-2xl); line-height: 1.25; margin: 2px 0 var(--s4) var(--s3); }
.adm-nav { display: grid; gap: 2px; }
.adm-link { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px 0 12px; border-radius: var(--r-md);
            color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); transition: background .15s, color .15s; }
.adm-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.adm-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.adm-link.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.adm-link.on svg { color: var(--primary); }
.adm-link.on::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--primary); }
.adm-main { min-width: 0; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); padding: 4px 0 var(--s4); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.adm-head h2 { font-size: var(--fs-xl); line-height: 1.3; }
.adm-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; max-width: 46em; }
.adm-empty { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s7) var(--s5);
             background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.adm-empty .art { width: 72px; height: 72px; margin-bottom: var(--s1); }
.adm-empty h3 { font-size: var(--fs-lg); }
.adm-empty p { color: var(--muted); font-size: var(--fs-sm); max-width: 34em; }
@media (max-width: 1099.98px) {
  .adm { grid-template-columns: 1fr; gap: var(--s4); }
  .adm-side { position: static; }
  .adm-nav { grid-template-columns: repeat(3, 1fr); }
}
/* 管理功能只在電腦版(跟管理頁同一條規則，720px) */
@media (max-width: 719.98px) { .pc-only { display: none !important; } }

/* ── 區段標題、橫排 ── */
.section-title { font-size: var(--fs-sm); font-weight: 800; color: var(--muted); letter-spacing: .08em; margin: var(--s7) 0 var(--s3); }
.section-title:first-of-type { margin-top: var(--s4); }

.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ── 清單與彈窗小字 ── */
.notes { list-style: none; display: grid; gap: var(--s2); }
.notes li { padding: var(--s3) var(--s4); background: var(--surface-2); border-radius: var(--r-md); border-left: 3px solid var(--working); }

.notes p { font-size: var(--fs-md); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

.banner.late b, .banner.warn b { color: inherit; }
.modal-sub { color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; margin: -4px 0 var(--s4); }
.modal-sub b { color: var(--ink); }
.field > span .muted { font-weight: 600; margin-left: 4px; }

/* ── 管理頁：「從在職名冊加人」窗的名冊勾選列、名單列 ── */
.roster-list { display: grid; gap: 6px; max-height: 56vh; overflow-y: auto; margin-top: var(--s3); padding: 2px; }
.pick-row { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: var(--s2) var(--s3); border: 1px solid var(--line-2);
            border-radius: var(--r-md); cursor: pointer; background: var(--surface); }
.pick-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pick-row.taken { cursor: default; opacity: .72; background: var(--surface-2); }
.pick-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin: 0; }
.pick-row .who { display: grid; min-width: 0; flex: 1; }
.pick-row small { color: var(--muted); font-size: var(--fs-xs); }
.pick-row .chip { flex: none; }
.byid { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); }
.byid summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--primary); min-height: 40px; display: flex; align-items: center; gap: 6px; list-style: none; }
.byid summary::-webkit-details-marker { display: none; }
.byid summary svg { width: 16px; height: 16px; }
.byid-row { display: flex; gap: var(--s2); margin-top: var(--s2); }
.byid-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-sm); }
.byid-row .btn { flex: none; }
#rosterErr { margin-top: var(--s3); }
.handler-list { list-style: none; display: grid; gap: var(--s2); }
.handler-list li { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.handler-list li > div { display: grid; min-width: 0; flex: 1; }
.handler-list small { color: var(--muted); font-size: var(--fs-xs); }
.handler-list .btn { flex: none; }
.ava { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; flex: none; }

/* ── 管理頁：名單卡片 (目前名單加滿寬的加人大按鈕，加人另開窗) ── */
.handler-card { max-width: 760px; }
.card-lead { color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; margin-bottom: var(--s4); }
.handler-card .adm-empty { margin: var(--s2) 0; }
.btn.add-big { margin-top: var(--s5); min-height: 52px; font-size: var(--fs-lg); }
.handler-card .hint { margin-top: var(--s4); }
.modal.pick-modal { max-width: 560px; }
.pick-modal .roster-list { max-height: 46vh; }
.pick-modal .pick-none { margin-top: var(--s3); font-size: var(--fs-sm); }
.pick-modal .actions { margin-top: var(--s5); }
.pick-modal #rosterErr { margin-top: var(--s3); }
.modal.pick-modal p.hint { font-size: var(--fs-xs); line-height: 1.5; }   /* .modal p 會把說明小字放大成內文大小 */

/* ── 管理頁：表格(稽核表用) ── */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl td small { display: block; font-size: var(--fs-xs); }

/* 1200px 以下(管理頁左側導覽改到上方，表格只剩六百多 px 寬，七欄會擠成一字一行)：每一列改成一張小卡，
   第一行「時間、誰、單號」，下面依序是動作與細節、欄位、由、改為；表頭藏起來，空格不佔位(不用固定的 grid 區塊，空的那幾行才不會留下間距) */
@media (max-width: 1199.98px) {

  
  
  
     /* 選擇器多一層 tr，才壓得過下面 td.bef、td.aft 的 display: grid */
  
  
  
  
  
  
  
  
  
  
  
}
.handler-list .chip { height: 20px; padding: 0 8px; font-size: 11px; margin-left: 4px; vertical-align: 2px; }

/* ── 排班系統 (票 06)：管理頁表格、檔案匯入 ───────────────────── */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tbl th { text-align: left; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.off td { color: var(--muted); }
.tbl .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; margin: 0 calc(var(--s5) * -1); padding: 0 var(--s5); }
.files { display: grid; gap: var(--s3); }
.file-row { display: grid; grid-template-columns: 9em 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3); border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.file-row b { font-size: var(--fs-sm); }
.file-row small { color: var(--muted); }
.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); margin-bottom: var(--s4); }
.count { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s3); }
.count b { display: block; font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.count span { font-size: var(--fs-xs); color: var(--muted); }
.home { display: grid; gap: var(--s4); }
.home-hero { display: flex; gap: var(--s4); align-items: center; }
.home-hero .art { width: 72px; height: 72px; flex: none; }

/* ── 班表格子 (票 07) ───────────────────────────────────────── */
.grid-wrap { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; text-align: center; min-width: 38px; height: 28px; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); padding: 4px 2px; vertical-align: bottom; line-height: 1.2; }
.grid thead th b { display: block; font-size: 12px; writing-mode: horizontal-tb; white-space: nowrap; }
.grid th small, .grid td small { display: block; font-size: 10px; color: var(--muted); font-weight: 500; }
.grid .g-date { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 56px; font-weight: 700; }
.grid thead .g-date { z-index: 3; background: var(--surface-2); }
.grid .g-gap { min-width: 10px; width: 10px; background: var(--surface-2); }
.grid .g-note { min-width: 120px; max-width: 160px; font-size: 11px; text-align: left; padding: 0 6px; color: var(--ink-2); white-space: pre-line; }
.grid .g-stat { min-width: 34px; background: var(--surface-2); font-weight: 700; }
.grid .g-low { color: var(--late); background: color-mix(in srgb, var(--late) 12%, var(--surface)); }
.grid tr.g-ref td:not(.g-date) { opacity: .55; }
.grid tr.g-we .g-date { color: var(--primary); }
.grid tbody tr:nth-child(7n) td { border-bottom: 2px solid var(--line-2); }
.grid .g-bold { font-weight: 900; text-decoration: underline; text-underline-offset: 2px; }
.grid .g-bad { box-shadow: inset 0 0 0 2px var(--late); }
.grid .g-diff { outline: 2px dashed var(--primary); outline-offset: -3px; }
.grid .g-warn { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--working) 70%, transparent); }
.c-a { background: color-mix(in srgb, #E4007F 10%, var(--surface)); }
.c-b { background: color-mix(in srgb, #F2B705 18%, var(--surface)); }
.c-c { background: color-mix(in srgb, #2E7D32 16%, var(--surface)); }
.c-d { background: color-mix(in srgb, #1565C0 14%, var(--surface)); }
.c-k { background: color-mix(in srgb, #6D4C41 14%, var(--surface)); }
.c-duty { background: color-mix(in srgb, #7B1FA2 14%, var(--surface)); }
.c-off { color: var(--muted); }
.c-other { color: var(--ink-2); }
.c-empty { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--surface-2) 4px 8px); }

/* ── 月份設定列 (票 08) ─────────────────────────────────────── */
.setup-bar { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.setup-bar .step { display: grid; grid-template-columns: 7em 1fr auto auto; gap: var(--s3); align-items: center; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.setup-bar .step small { color: var(--muted); font-size: var(--fs-xs); }
.setup-bar .step.done b::after { content: " ✓"; color: var(--ok); }
.grid .g-click { cursor: pointer; }
.grid .g-click:hover { background: var(--primary-soft); }
.grid .must { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 4px; background: var(--late); color: #fff; font-size: 10px; }
.grid .g-must { outline: 2px dashed var(--late); outline-offset: -3px; }
.hol-row { margin-bottom: var(--s2); }

/* ── 排班精靈 (票 09) ───────────────────────────────────────── */
.wiz { display: grid; gap: var(--s3); margin-bottom: var(--s4); }
.wiz-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.wiz-head .btn { margin-left: auto; }
.wiz-steps { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 0; }
.wiz-steps li { padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-sm); color: var(--muted); }
.wiz-steps li.done { color: var(--ok); }
.wiz-steps li.done::before { content: "✓ "; }
.wiz-steps li.on { background: var(--primary); color: var(--on-primary); font-weight: 800; }
.wiz-opts { display: grid; gap: var(--s2); }
.wiz-opts .btn { justify-content: flex-start; text-align: left; min-height: 56px; }
.wiz-opts small { display: block; color: var(--muted); font-weight: 500; }
.grid .g-plan { cursor: pointer; box-shadow: inset 0 0 0 2px #1565C0; font-weight: 800; }
.grid .g-plan.g-drop { box-shadow: inset 0 0 0 2px var(--line-2); background: repeating-linear-gradient(45deg, transparent 0 4px, var(--surface-2) 4px 8px); }
.grid .g-plan.g-edit { box-shadow: inset 0 0 0 3px var(--primary); }
.grid .g-editable { cursor: pointer; }
.grid .g-editable:hover { filter: brightness(.94); }

/* ── 同仁：我的班表與填假 (票 12) ───────────────────────────── */
.me-page .quota { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.days { list-style: none; display: grid; gap: 6px; padding: 0; }
.day { display: grid; grid-template-columns: 4.2em 1fr 3.2em; gap: var(--s2); align-items: center; min-height: 52px; padding: 6px var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.day.off { cursor: default; background: var(--surface-2); }
.day.we .d-date b { color: var(--primary); }
.day .d-date b { display: block; font-size: var(--fs-md); }
.day .d-date small, .day .d-info small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.day .d-info { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.day .d-cell { justify-self: end; min-width: 2.6em; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); font-weight: 700; }
.fill-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); }
.fill-opts .btn { flex-direction: column; min-height: 64px; gap: 2px; }
.fill-opts .btn small { font-weight: 500; font-size: var(--fs-xs); }
.grid-wrap.mini { max-height: calc(100vh - 260px); }
.grid-wrap.mini .grid th, .grid-wrap.mini .grid td { min-width: 34px; height: 30px; }
.grid .g-me { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ── 填假期間 (票 13) ─────────────────────────────────────── */
.setup-bar .step .row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); color: var(--ink); resize: vertical; }
ul.plain { list-style: none; display: grid; gap: 4px; padding: 0; margin-bottom: var(--s3); font-size: var(--fs-sm); }
.day .d-cell.g-bold { font-weight: 900; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }
.page-head .row { flex-wrap: wrap; justify-content: flex-end; }

/* ── 管理介面 (票 14) ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rule-type + .rule-type { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.rule-list { list-style: none; display: grid; gap: 6px; margin-bottom: var(--s2); }
.rule-list li { display: flex; align-items: center; gap: var(--s3); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.rule-list li.off { opacity: .6; }
.rule-list li.muted { border-style: dashed; }
.rule-main { flex: 1; min-width: 0; }
.rule-main b { margin-right: 6px; }
.rule-main small { display: block; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; margin-top: 2px; }
.rule-main .chip { height: 20px; font-size: 11px; vertical-align: 1px; margin-right: 4px; }
.sort-list { list-style: none; display: grid; gap: 6px; margin: var(--s2) 0 var(--s3); }
.sort-list li { display: flex; align-items: center; gap: var(--s3); padding: 6px 8px 6px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: grab; }
.sort-list li.dragging { opacity: .5; border-style: dashed; }
.sort-list .grip { color: var(--muted); letter-spacing: -2px; user-select: none; }
.sort-list .nm { flex: 1; min-width: 0; }
.sort-list .nm small { color: var(--muted); font-size: var(--fs-xs); margin-left: 8px; }
.sort-list .switch { min-height: 32px; }
.mv { display: inline-flex; gap: 2px; }
.mv .btn.small { min-height: 32px; padding: 0 10px; }
.field.inline { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }
.field.inline input { width: 80px; }
.chk-group { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); min-height: 32px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--primary); }
.modal.form-modal { max-width: 640px; max-height: calc(100dvh - 48px); overflow-y: auto; }
.form-modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s4); }
.form-modal .grid2 .field + .field { margin-top: 0; }
.form-modal .rule-flags { margin-top: var(--s4); gap: var(--s5); }
.form-modal #paPoolNew { margin-top: 6px; }
.ov-row { margin: 4px 0; font-size: var(--fs-sm); }
.ov-row select { width: auto; min-width: 120px; }
.rule-mini { list-style: none; display: grid; gap: 4px; font-size: var(--fs-sm); }
.rule-mini small { color: var(--muted); }
.tbl td.acts { white-space: nowrap; }
.tbl td.acts .btn + .btn { margin-left: 6px; }
.log-tbl code { font-size: var(--fs-xs); word-break: break-all; white-space: normal; }
.log-tbl details p { margin: 4px 0; font-size: var(--fs-xs); }
.imp-extra { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s4); margin-top: var(--s4); }
.imp-extra .field + .field { margin-top: 0; }
.countdown { font-weight: 700; color: var(--ink-2); margin-left: 4px; white-space: nowrap; }
.countdown.urgent { color: var(--late); }
.setup-bar .step.warn > b { color: var(--working); }
.short-list { display: grid; gap: 2px; font-size: var(--fs-sm); }
.short-list b { color: var(--working); }
.conflict-card { margin-top: var(--s3); border-color: color-mix(in srgb, var(--late) 50%, var(--line)); }
.conflict-head { justify-content: space-between; margin-bottom: var(--s2); }
.conflict-head b { color: var(--late); }
