/* 行事曆系統 視覺系統(票 01 定案；色票與元件沿用設備報修系統，外框照公文收文系統的主選單)
 *
 * 方向：像一本攤在護理站桌上的院內行事曆。米白底(入口站同色)、深墨字，
 * 庭芳桃紅只用在「要你動手」的地方(主要按鈕、目前分頁、焦點)。
 * 月曆上的顏色跟著大類走(--cat-1 到 --cat-12，見下方「三、大類色」；種子 8 個大類用前 8 色，票 09 擴成 12 色給管理者新增大類用)；
 * 大類色只拿來分辨類別，不拿來表示狀態。狀態色另外一組：
 *   我的      桃紅標(跟我有關的場次)
 *   國定假日  琥珀
 *   已取消    灰、刪除線
 *   錯誤      紅
 * 手機優先：單欄、大觸控區(最小 44px)、整頁捲動(iPhone Safari 不做整頁 fixed 版面)，底部分頁列 fixed bottom:0；
 * 720px 以上電腦版內容置中、最寬 960px(月曆要寬一點)，主選單在頂欄。管理只在電腦。
 *
 * 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;
  /* 按鈕：主按鈕用院徽亮桃紅、白字粗體；次要按鈕白底框線 */
  --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;
  /* 狀態 */
  --mine: #C8006F; --mine-soft: #FCE8F2;
  --holiday: #9A5800; --holiday-soft: #FFF4DF; --holiday-line: #F1D9A6;
  --off: #6B7571; --off-soft: #ECEDE9;
  --late: #B42318; --late-soft: #FDECEA; --late-line: #F4C7C2;
  --ok: #1D6B45; --ok-soft: #E5F3EB;
  --info: #2A5B9A; --info-soft: #E8F0FA;
  --focus: rgba(200, 0, 111, .24);
  /* 二、字級(手機基準 16px，不小於 13px) */
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 21px; --fs-2xl: 26px;
  /* 三、大類色：12 色。前 8 色是種子的八個大類(活動、志工、參訪、護理、教保、行政、會議、總務，照現況檔 Q5 的順序)；
     票 09 加 9 到 12 給管理者新增大類(Jacky 定：12 色可重複使用，管理頁提示已被哪個大類用)。
     新加的四色挑色相上的空檔：橄欖(黃綠之間)、洋紅(紫與玫瑰之間)、咖啡(低彩度暖色，跟鮮橘、土黃分得開)、天藍(青與藍之間、比藍淺)；
     不用紅色系，免得跟錯誤狀態搞混。
     大類的顏色欄存色票編號 1 到 12，前端一律用 var(--cat-N) 與 var(--cat-N-soft)，深色模式自動換。
     深的那個當月曆色條與文字(白底與 soft 底對比都 4.5:1 以上)，soft 當底色。 */
  --cat-1: #C2185B; --cat-1-soft: #FCE4EE;   /* 活動 玫瑰 */
  --cat-2: #2E7D32; --cat-2-soft: #E4F2E5;   /* 志工 綠 */
  --cat-3: #6A4FB3; --cat-3-soft: #EEEAF8;   /* 參訪 紫 */
  --cat-4: #00796B; --cat-4-soft: #DFF2EF;   /* 護理 青 */
  --cat-5: #C25400; --cat-5-soft: #FFEEDD;   /* 教保 橘 */
  --cat-6: #1565C0; --cat-6-soft: #E3EEFA;   /* 行政 藍 */
  --cat-7: #546170; --cat-7-soft: #E9EDF1;   /* 會議 石板灰 */
  --cat-8: #7A6000; --cat-8-soft: #F6EFD3;   /* 總務 土黃 */
  --cat-9: #5A7000; --cat-9-soft: #EEF2D5;   /* 橄欖 */
  --cat-10: #9C2A97; --cat-10-soft: #F7E5F5; /* 洋紅 */
  --cat-11: #6D4C41; --cat-11-soft: #EFE6E2; /* 咖啡 */
  --cat-12: #00719E; --cat-12-soft: #DDF0F8; /* 天藍 */
  /* 四、間距：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: 960px;
  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;
    --mine: #FF5CAD; --mine-soft: #3A1B2B;
    --holiday: #F4B860; --holiday-soft: #372A12; --holiday-line: #54401C;
    --off: #98A29D; --off-soft: #262B29;
    --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
    --ok: #6FD19A; --ok-soft: #16301F; --info: #8DB6F2; --info-soft: #1A2638;
    --cat-1: #FF7FAF; --cat-1-soft: #3B1A27; --cat-2: #7FD48A; --cat-2-soft: #17301B;
    --cat-3: #B7A3F2; --cat-3-soft: #282340; --cat-4: #5FD3C2; --cat-4-soft: #12302C;
    --cat-5: #FFAA66; --cat-5-soft: #3A2512; --cat-6: #8DB6F2; --cat-6-soft: #1A2638;
    --cat-7: #AEB9C5; --cat-7-soft: #262C33; --cat-8: #E2C25A; --cat-8-soft: #322B12;
    --cat-9: #B9D35E; --cat-9-soft: #262E10; --cat-10: #E08BDA; --cat-10-soft: #361A34;
    --cat-11: #C9A797; --cat-11-soft: #2F2521; --cat-12: #6CC6EC; --cat-12-soft: #11303B;
    --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;
  --mine: #FF5CAD; --mine-soft: #3A1B2B;
  --holiday: #F4B860; --holiday-soft: #372A12; --holiday-line: #54401C;
  --off: #98A29D; --off-soft: #262B29;
  --late: #FF8A7E; --late-soft: #3A1B18; --late-line: #5B2A25;
  --ok: #6FD19A; --ok-soft: #16301F; --info: #8DB6F2; --info-soft: #1A2638;
  --cat-1: #FF7FAF; --cat-1-soft: #3B1A27; --cat-2: #7FD48A; --cat-2-soft: #17301B;
  --cat-3: #B7A3F2; --cat-3-soft: #282340; --cat-4: #5FD3C2; --cat-4-soft: #12302C;
  --cat-5: #FFAA66; --cat-5-soft: #3A2512; --cat-6: #8DB6F2; --cat-6-soft: #1A2638;
  --cat-7: #AEB9C5; --cat-7-soft: #262C33; --cat-8: #E2C25A; --cat-8-soft: #322B12;
  --cat-9: #B9D35E; --cat-9-soft: #262E10; --cat-10: #E08BDA; --cat-10-soft: #361A34;
  --cat-11: #C9A797; --cat-11-soft: #2F2521; --cat-12: #6CC6EC; --cat-12-soft: #11303B;
  --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; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.view { max-width: var(--wrap); margin: 0 auto;
        padding: var(--s5) max(var(--s4), env(safe-area-inset-right)) calc(var(--s8) + env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left)); }

/* ── 頂欄：sticky 黏在上方；整頁照常捲動、不用 fixed，iPhone Safari 的工具列才不會蓋住內容 ──
   電腦：院徽與系統名｜主選單(近期、月曆、我的)｜名字｜管理｜臉或指紋綁定｜登出。
   手機(719px 以下)：主選單收進底部分頁列，頂欄只剩院徽、系統名、名字按鈕。斷點 720px 跟其他庭芳系統同一個數字。 */
.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: none; }
.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; }
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.nav a { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: var(--r-pill);
         color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.me { margin-left: auto; position: relative; flex: none; display: flex; align-items: center; gap: var(--s2); }
/* 電腦：名字｜管理｜臉或指紋綁定｜登出，底線文字連結，跟物資、交班、電郵待處理、設備報修、公文一致 */
.me-links { display: flex; align-items: center; gap: var(--s4); font-size: var(--fs-sm); white-space: nowrap; }
.me-links b { color: var(--ink); }
.me-links a, .me-links button { 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-btn { display: flex; align-items: center; gap: 8px; 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); 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) { .me-btn, .menu { display: none !important; } }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px; background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); 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: 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 (max-width: 719px) { .nav { display: none; } .me-links { display: none; } .brand { font-size: var(--fs-md); } .top-in { gap: var(--s3); } }
/* 底部分頁列(手機)：fixed bottom:0，整頁照常捲動；頁面底部多留 padding 給它 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
          background: color-mix(in srgb, var(--surface) 94%, var(--bg)); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
          padding: 6px max(var(--s2), env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(var(--s2), env(safe-area-inset-left)); }
.tabbar a { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 48px; padding: 4px 0 2px;
            color: var(--muted); font-size: 12px; font-weight: 700; border-radius: var(--r-md); text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--primary); }
@media (min-width: 720px) { .tabbar { display: none !important; } }
@media (max-width: 719px) { body.has-tabbar .view { padding-bottom: calc(var(--s8) + 64px + env(safe-area-inset-bottom)); } body.has-tabbar .toast { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ── 按鈕 ── */
.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;
       box-shadow: var(--btn-shadow); }
.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, .btn.quiet { background: var(--surface); color: var(--ink); border: 1.5px solid var(--btn-line); box-shadow: none; }
.btn.ghost:hover, .btn.quiet:hover { border-color: var(--btn-bg); color: var(--primary); background: var(--primary-soft); }
.btn.danger { background: var(--late); color: #fff; box-shadow: none; }
.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=time], input[type=search], input[type=number], 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; }

/* ── 卡片、標籤、提示條 ── */
.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.mine { background: var(--mine-soft); color: var(--mine); }
.chip.holiday { background: var(--holiday-soft); color: var(--holiday); }
.chip.off { background: var(--off-soft); color: var(--off); text-decoration: line-through; }
.chip svg { width: 14px; height: 14px; }
/* 大類標籤：data-cat 是色票編號 1 到 12 */
.chip[data-cat] { background: var(--cat-soft); color: var(--cat); }
[data-cat="1"] { --cat: var(--cat-1); --cat-soft: var(--cat-1-soft); } [data-cat="2"] { --cat: var(--cat-2); --cat-soft: var(--cat-2-soft); }
[data-cat="3"] { --cat: var(--cat-3); --cat-soft: var(--cat-3-soft); } [data-cat="4"] { --cat: var(--cat-4); --cat-soft: var(--cat-4-soft); }
[data-cat="5"] { --cat: var(--cat-5); --cat-soft: var(--cat-5-soft); } [data-cat="6"] { --cat: var(--cat-6); --cat-soft: var(--cat-6-soft); }
[data-cat="7"] { --cat: var(--cat-7); --cat-soft: var(--cat-7-soft); } [data-cat="8"] { --cat: var(--cat-8); --cat-soft: var(--cat-8-soft); }
[data-cat="9"] { --cat: var(--cat-9); --cat-soft: var(--cat-9-soft); } [data-cat="10"] { --cat: var(--cat-10); --cat-soft: var(--cat-10-soft); }
[data-cat="11"] { --cat: var(--cat-11); --cat-soft: var(--cat-11-soft); } [data-cat="12"] { --cat: var(--cat-12); --cat-soft: var(--cat-12-soft); }
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md);
          font-size: var(--fs-sm); background: var(--info-soft); color: var(--info); }
.banner.warn { background: var(--holiday-soft); color: var(--holiday); }
.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; }
/* 時間重疊清單(票 05)：在表單最上面的紅色錯誤條裡逐列顯示 */
.clash { flex: 1; min-width: 0; }
.clash-head { margin: 0 0 var(--s2); font-weight: 700; }
.clash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.clash-list li { display: grid; gap: 2px; padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); border-left: 3px solid var(--late); overflow-wrap: anywhere; }
.clash-mine { font-size: var(--fs-xs); color: var(--late); font-weight: 600; }
.clash-who b { font-weight: 700; }
.clash-other { font-weight: 700; color: var(--late); text-decoration: underline; text-underline-offset: 2px; }
.clash-when { font-size: var(--fs-xs); color: var(--muted); }
.clash-when .nowrap { white-space: nowrap; }

/* ── 頁首(每一頁的標題列) ── */
.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; }

/* ── 場次卡片(近期、我的；票 02 起有資料)：左邊一條大類色，右上角時間 ── */
.items { display: grid; gap: var(--s3); }
.day-title { font-size: var(--fs-sm); font-weight: 800; color: var(--muted); letter-spacing: .04em; margin: var(--s5) 0 var(--s2); }
.day-title:first-child { margin-top: 0; }
.day-title.today { color: var(--primary); }
.item { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
        box-shadow: var(--shadow-1); padding: var(--s4) var(--s4) var(--s4) calc(var(--s4) + 6px); 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: 6px; background: var(--cat, var(--line-2)); }
.item:hover { text-decoration: none; box-shadow: var(--shadow-2); border-color: var(--line-2); }
.item:active { transform: scale(.995); }
.item-top { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: 4px; }
.item h3 { font-size: var(--fs-lg); line-height: 1.45; font-weight: 800; }
.item .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 .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: var(--s2); font-size: var(--fs-xs); color: var(--muted); }
.item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.item .meta svg { width: 14px; height: 14px; opacity: .8; }

/* ── 返回連結(新增、詳細頁的左上角) ── */
.back { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); margin-bottom: var(--s1); }
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--primary); text-decoration: none; }
.page-head > .btn { flex: none; }
/* 新增與詳細頁的內容最寬 640px 置中，頁首跟著對齊 */
.page-head.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }

/* ── 新增活動表單(票 02)：手機單欄、一段一張卡片，電腦置中最寬 640px ── */
.form { display: grid; gap: var(--s4); max-width: 640px; margin: 0 auto; }
.form-sec { display: grid; gap: var(--s4); }
.form-sec .field + .field { margin-top: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.sec-head h2 { font-size: var(--fs-lg); font-weight: 800; }
.req, .opt, .hint { font-style: normal; font-size: 12px; font-weight: 700; margin-left: 4px; }
.req { color: var(--primary); } .opt, .hint { color: var(--muted); font-weight: 500; }
.field-err { color: var(--late); font-size: var(--fs-xs); font-weight: 700; margin-top: 6px; }
.field-err:empty { display: none; }
.field.invalid input, .field.invalid select, .field.invalid .pick-field, .field.invalid .cat-pick { border-color: var(--late); box-shadow: 0 0 0 3px var(--late-soft); }
.field.invalid > span { color: var(--late); }
/* 類別：大類一排色塊按鈕，點了填滿大類色；有小類時下面再一排 */
.cat-pick { display: flex; flex-wrap: wrap; gap: var(--s2); border-radius: var(--r-md); }
.cat-btn { min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1.5px solid var(--cat-soft); background: var(--cat-soft);
           color: var(--cat); font-weight: 800; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.cat-btn:hover { border-color: var(--cat); }
.cat-btn[aria-pressed="true"] { background: var(--cat); border-color: var(--cat); color: var(--surface); box-shadow: var(--shadow-1); }
.minor-row { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--line-2); }
.sub-label { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); margin-bottom: 6px; }
/* 日期加時間並排；全天時時間藏起來，日期吃滿 */
.dt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); }
.dt:has(input[type=time][hidden]) { grid-template-columns: 1fr; }
.switch { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-1); transition: transform .15s; }
.switch input:checked { background: var(--btn-bg); }
.switch input:checked::after { transform: translateX(18px); }
/* 挑人的格子：看起來像輸入框，右邊「更換」 */
.pick-field { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
              background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 10px 14px; cursor: pointer; text-align: left; }
.pick-field:hover { border-color: var(--primary); }
.pick-name { font-weight: 700; }
.pick-act { color: var(--primary); font-size: var(--fs-sm); font-weight: 700; }
/* 院內／院外切換 */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; }
.seg button { min-height: 38px; padding: 0 18px; border: 0; background: none; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-sm); color: var(--muted); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
#fPlaceOther { margin-top: var(--s2); }
#fOutBox { display: grid; gap: var(--s4); }
.map-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 700; }
.map-link svg { width: 16px; height: 16px; }
.form-actions { display: flex; gap: var(--s2); }
.form-actions .btn { flex: 1; }
.form-actions .btn:last-child { flex: 2; }

/* ── 同仁挑選器(彈窗)：上面搜尋，下面可捲動的名單 ── */
.modal.modal-picker { max-width: 480px; padding: var(--s5); }
.picker { display: grid; gap: var(--s3); }
.picker-head { display: flex; align-items: center; justify-content: space-between; }
.picker-head h2 { font-size: var(--fs-xl); }
.pick-list { max-height: min(56vh, 420px); overflow-y: auto; display: grid; gap: 2px; align-content: start; margin: 0 calc(-1 * var(--s2)); padding: 0 var(--s2); }
.pick-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 48px; padding: 0 var(--s3);
            border: 0; background: none; border-radius: var(--r-md); cursor: pointer; text-align: left; }
.pick-row:hover { background: var(--surface-2); }
.pick-row.on { background: var(--primary-soft); color: var(--primary); }
.pick-row span { color: var(--muted); font-size: var(--fs-sm); }
.pick-none { color: var(--muted); text-align: center; padding: var(--s5) 0; }
.pick-list .btn { margin-top: var(--s3); }

/* ── 票 03：協辦同仁、參與院生、交通、院外地點建議 ── */
/* 欄位標題包在 label 裡時(院外名稱、交通方式)跟 .field > span 同一個樣子 */
.field > label > span { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
/* 已挑的人：一排可移除的膠囊 */
.pchips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pchips:empty { display: none; }
.pchip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px 0 14px; border-radius: var(--r-pill);
         background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: var(--fs-sm); }
.pchip small { color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.pchip-x { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; }
.pchip-x:hover { background: var(--surface-3); color: var(--late); }
.pchip-x svg { width: 14px; height: 14px; }
.add-btn { margin-top: var(--s2); justify-self: start; }
.pchips:not(:empty) + .add-btn { margin-top: var(--s3); }
.add-btn svg { width: 16px; height: 16px; }
#fResBox .sec-head { margin-bottom: var(--s3); }
.count-pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
              background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
/* 交通：備註在選單下面；外部派車的司機兩格，電腦並排 */
#fTransNote { margin-top: var(--s2); }
.driver { display: grid; gap: var(--s4); padding: var(--s4); border-radius: var(--r-md); background: var(--surface-2); }
.driver .field + .field { margin-top: 0; }
@media (min-width: 720px) { .driver { grid-template-columns: 1fr 1fr; } }
/* 院外地點建議：貼在名稱輸入框下面的清單 */
.suggest-wrap { position: relative; }
/* 清單捲進畫面時留出底部分頁列的高度 */
@media (max-width: 719px) { .suggest { scroll-margin-bottom: calc(80px + env(safe-area-inset-bottom)); } }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% - 2px); background: var(--surface); border: 1px solid var(--line-2);
           border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--s1); max-height: 300px; overflow-y: auto; }
.suggest-head { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; padding: var(--s1) var(--s3); }
.suggest-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s3); width: 100%; text-align: left; border: 0; background: none;
               border-radius: var(--r-sm); padding: var(--s2) var(--s3); cursor: pointer; }
.suggest-row:hover { background: var(--primary-soft); }
.suggest-row b { grid-column: 1; }
.suggest-row span { grid-column: 1; color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-row em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-size: var(--fs-xs); color: var(--muted); }
/* 多選挑選器：每列左邊一個勾選框；院生依生活班分段，段頭有「整班勾選」；底部已選幾位加完成 */
.ck-row { justify-content: flex-start; }
.ck-row span { margin-left: auto; }
.ck { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--surface); color: transparent; }
.ck svg { width: 14px; height: 14px; }
.ck-row[aria-checked="true"] { background: var(--primary-soft); }
.ck-row[aria-checked="true"] .ck { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--on-btn); }
.rp-class { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s3) var(--s2);
            background: var(--surface); border-bottom: 1px solid var(--line); margin-top: var(--s2); }
.rp-class:first-child { margin-top: 0; }
.rp-class b { font-size: var(--fs-md); }
.rp-class span { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.rp-class .btn { margin: 0 0 0 auto; min-height: 32px; }
.rp-class .btn[aria-pressed="true"] { color: var(--primary); border-color: var(--primary); }
.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.picker-foot span { color: var(--muted); font-weight: 700; font-size: var(--fs-sm); }
.picker-foot .btn { min-width: 120px; }
/* 詳細頁：院生名字是連結(點了看這位院生接下來的場次)；司機電話是撥號鈕 */
.r-links { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.r-link { display: inline-flex; gap: 4px; min-height: 36px; align-items: center; padding: 0 12px; border-radius: var(--r-pill);
          background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: var(--fs-sm); }
.r-link small { color: var(--ink-2); font-weight: 500; font-size: var(--fs-xs); }
.r-link:hover { text-decoration: none; background: var(--primary); color: var(--on-primary); }
.r-link:hover small { color: inherit; }
.driver-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s2); font-weight: 700; }
.tel-btn svg { width: 16px; height: 16px; }
.tel-btn { font-variant-numeric: tabular-nums; }
/* 院生頁：名字旁邊的外號；清單跟詳細頁一樣最寬 640px 置中 */
.nick { margin-left: var(--s2); font-size: var(--fs-md); font-weight: 600; color: var(--muted); }
.narrow-wrap { max-width: 640px; margin: 0 auto; }

/* ── 場次詳細頁：一張卡片，上緣一條大類色 ── */
.detail { position: relative; overflow: hidden; border-top: 6px solid var(--cat, var(--line-2)); max-width: 640px; margin: 0 auto; }
.d-title { font-size: var(--fs-2xl); line-height: 1.3; margin: var(--s2) 0 var(--s4); }
.d-list { display: grid; gap: 0; }
.d-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.d-row dt { display: inline-flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: var(--fs-sm); font-weight: 700; padding-top: 2px; }
.d-row dt svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.d-row dd { min-width: 0; overflow-wrap: anywhere; }
.d-sub { display: block; color: var(--muted); font-size: var(--fs-sm); }
.d-desc { white-space: pre-wrap; }
.map-btn { margin-top: var(--s2); }
.d-foot { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-xs); }

/* 票 04：詳細頁的動作按鈕(修改、取消這場活動)、已取消與已結束的說明條、管理者的異動紀錄 */
.d-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.d-actions .btn { flex: 1 1 160px; }
.btn.danger-ghost { color: var(--late); border-color: var(--late-line); }
.btn.danger-ghost:hover { color: var(--late); border-color: var(--late); background: var(--late-soft); }
.banner.off-banner { background: var(--off-soft); color: var(--off); }
#detail > .banner { max-width: 640px; margin: 0 auto var(--s3); }
.detail.is-off .d-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.d-log { max-width: 640px; margin: var(--s4) auto 0; }
.d-log h2 { font-size: var(--fs-lg); margin-bottom: var(--s3); }
.log { list-style: none; display: grid; gap: var(--s3); }
.log-item { padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
.log-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--fs-sm); }
.log-head time { color: var(--muted); font-size: var(--fs-xs); margin-left: auto; font-variant-numeric: tabular-nums; }
.chip.log-act { background: var(--info-soft); color: var(--info); }
.log-item[data-act="新增"] .log-act { background: var(--ok-soft); color: var(--ok); }
.log-item[data-act="取消"] .log-act { background: var(--off-soft); color: var(--off); }
.log-rows { list-style: none; display: grid; gap: var(--s1); margin-top: var(--s2); font-size: var(--fs-sm); }
.log-rows li { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: var(--s2); }
.log-rows b { color: var(--muted); font-weight: 700; }
.log-rows span { min-width: 0; overflow-wrap: anywhere; }
.log-diff s { color: var(--muted); }
.log-diff em { font-style: normal; color: var(--muted); margin: 0 6px; }
.nil { color: var(--ph); font-style: normal; }
.muted { color: var(--muted); }
.cat-old { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--holiday); }

/* 票 07：重複活動。表單的重複設定、改或取消系列時的範圍選擇、卡片標題前的重複小圖示、詳細頁的國定假日列 */
.rep-body { display: grid; gap: var(--s3); margin-top: var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
.wd-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wd-btn { min-height: 44px; border-radius: var(--r-md); border: 1.5px solid var(--line-2); background: var(--surface); font-weight: 800; color: var(--ink-2); cursor: pointer; }
.wd-btn:hover { border-color: var(--primary); }
.wd-btn[aria-pressed="true"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--on-btn); box-shadow: var(--shadow-1); }
.rep-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-weight: 700; }
.rep-row select { width: auto; flex: 1 1 8em; }
.rep-row > span { flex: none; }
.rep-skip { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.rep-end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.rep-end .sub-label { margin: 0; flex-basis: 100%; }
/* 重複區塊底色跟切換鈕的底同色(surface-2)，切換鈕改用線色當底才看得出來 */
.rep-body .seg { background: var(--line); }
.rep-end input[type=date] { flex: 1 1 10em; width: auto; }
.rep-count { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; flex: 1 1 8em; }
.rep-count input { max-width: 7em; }
.rep-note { font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.scope-choices { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.scope-btn { display: grid; gap: 2px; text-align: left; padding: var(--s3) var(--s4); border-radius: var(--r-md); border: 1.5px solid var(--line-2);
             background: var(--surface); cursor: pointer; min-height: 56px; }
.scope-btn b { font-size: var(--fs-md); color: var(--primary); }
.scope-btn span { font-size: var(--fs-sm); color: var(--muted); }
.scope-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.scope-btn:disabled { cursor: not-allowed; opacity: .55; }
.scope-btn.danger b { color: var(--late); }
.scope-btn.danger:hover:not(:disabled) { border-color: var(--late); background: var(--late-soft); }
.rep-mark { display: inline-flex; vertical-align: -2px; margin-right: 6px; color: var(--muted); }
.rep-mark svg { width: 16px; height: 16px; }
.chip.holiday svg { width: 13px; height: 13px; }
.d-row.d-holiday dt, .d-row.d-holiday dd b { color: var(--holiday); }
.chip.log-scope { background: var(--holiday-soft); color: var(--holiday); }
.modal-title { font-size: var(--fs-xl); margin-bottom: var(--s3); }
.modal .modal-text { font-size: var(--fs-sm); margin-bottom: var(--s3); }
.modal .modal-text.muted { color: var(--muted); }

/* ── 空狀態 ── */
.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: 104px; height: 104px; margin-bottom: var(--s2); }
.empty h2 { font-size: var(--fs-xl); }
.empty p { color: var(--muted); font-size: var(--fs-sm); max-width: 28em; }

/* ── 月曆(票 08)：月檢視與週檢視，一週從週一開始，週六週日字色淡一階，今天桃紅圈，國定假日琥珀 ──
   頁首：電腦左邊「上一個、標題、下一個」，右邊「月／週、今天、列印」；手機標題一列置中、工具一列在下。 */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.cal-title { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.cal-title-text { min-width: 0; }
.cal-title h1 { font-size: var(--fs-2xl); line-height: 1.25; white-space: nowrap; }
.cal-title p { color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.cal-tools { display: flex; align-items: center; gap: var(--s2); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
            background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }
/* 已在本期時按「今天」：今天那一格閃一下底色 */
@keyframes todayFlash { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 30% { box-shadow: inset 0 0 0 3px var(--primary); background-color: var(--primary-soft, rgba(228, 0, 127, .12)); } }
.flash { animation: todayFlash 1.2s ease-out 2; }
@media (max-width: 719px) {
  .cal-head { gap: var(--s3); }
  .cal-title { width: 100%; justify-content: space-between; }
  .cal-title-text { text-align: center; }
  .cal-title h1 { font-size: var(--fs-xl); }
  .cal-tools { width: 100%; }
  .cal-tools .seg { flex: 1; }
  .cal-tools .seg a { flex: 1; justify-content: center; }
}
/* 分段切換(月／週、接下來／已結束)：連結版，外觀跟表單的 .seg 按鈕一樣 */
.seg-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 18px; border-radius: var(--r-pill);
               font-weight: 700; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.seg-links a:hover { color: var(--ink); text-decoration: none; }
.seg-links a[aria-current="page"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.seg-n { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
         background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.seg-n:empty { display: none; }
.seg-links a[aria-current="page"] .seg-n { background: var(--primary-soft); color: var(--primary); }

/* 大類篩選：一顆一個大類，亮著＝看得到；按了變成空心＝藏起來。手機一排左右滑，不撐出整頁橫向捲動 */
.cat-filter { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s4); min-height: 36px; }
.cf-label { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); margin-right: 2px; }
.cf-label svg { width: 15px; height: 15px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: var(--r-pill); cursor: pointer;
         border: 1.5px solid var(--cat-soft); background: var(--cat-soft); color: var(--cat); font-size: var(--fs-sm); font-weight: 800; white-space: nowrap;
         transition: background .15s, color .15s, border-color .15s; }
.fchip i { width: 9px; height: 9px; border-radius: 50%; background: var(--cat); border: 1.5px solid var(--cat); }
.fchip:hover { border-color: var(--cat); }
.fchip[aria-pressed="false"] { background: var(--surface); border-color: var(--line-2); color: var(--ph); font-weight: 600; text-decoration: line-through; }
.fchip[aria-pressed="false"] i { background: transparent; border-color: var(--ph); }
.cf-reset { border: 0; background: none; color: var(--primary); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; padding: 0 6px; min-height: 34px; white-space: nowrap; }
@media (max-width: 719px) {
  .cat-filter { flex-wrap: nowrap; overflow-x: auto; margin-left: calc(-1 * var(--s4)); margin-right: calc(-1 * var(--s4));
                padding: 2px var(--s4); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .cat-filter::-webkit-scrollbar { display: none; }
  .fchip, .cf-label, .cf-reset { flex: none; }
}
.cal-missing { margin-bottom: var(--s3); font-size: var(--fs-xs); padding: var(--s2) var(--s3); }
.cal-missing svg { width: 16px; height: 16px; }

/* 電腦與手機各畫一份的版面(週檢視)：寬度切換時不用重抓資料 */
.only-wide { display: none !important; }
@media (min-width: 720px) { .only-wide { display: block !important; } .only-narrow { display: none !important; } }

/* ── 月檢視 ── */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--line); }
.cal-wd { padding: var(--s2) 0; text-align: center; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); background: var(--surface-2); }
.cal-wd.weekend { color: var(--ph); }
.cal-day { position: relative; min-height: 64px; padding: 4px 3px 6px; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums;
           cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; transition: background .12s; }
.cal-day:first-child { border-left: 0; }
.cal-day:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cd-num { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 50%; border: 0; background: none;
          font-size: var(--fs-sm); font-weight: 700; color: var(--ink); cursor: pointer; flex: none; }
.cal-day.other { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.cal-day.other .cd-num { color: var(--ph); font-weight: 500; }
.cal-day.weekend .cd-num { color: var(--muted); }
.cal-day.holiday { background: color-mix(in srgb, var(--holiday-soft) 70%, var(--surface)); }
.cal-day.holiday .cd-num { color: var(--holiday); font-weight: 800; }
.cal-day.today .cd-num { background: var(--brand); color: #fff; }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--primary); }
.cd-hol { display: none; }
.cd-evs { display: none; }
.cd-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; }
.cd-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cat); }
.cd-dots b { font-size: 10px; line-height: 7px; color: var(--muted); }
.cal-day.other .cd-dots { opacity: .55; }
@media (min-width: 720px) {
  .cal-day { min-height: 124px; padding: 6px; align-items: stretch; }
  .cd-num { align-self: flex-start; min-width: 28px; height: 28px; }
  .cd-hol { display: block; position: absolute; top: 10px; left: 40px; right: 6px; font-size: 12px; font-weight: 700; color: var(--holiday);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cd-evs { display: grid; gap: 2px; margin-top: 2px; min-width: 0; }
  .cd-dots { display: none; }
  .cal-day.other .cd-evs { opacity: .6; }
}
/* 格子裡的一場：一般場次「時間 標題」；全天與跨日填滿大類淡色 */
.ev { display: flex; align-items: baseline; gap: 4px; min-width: 0; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; line-height: 1.5;
      color: var(--ink); white-space: nowrap; overflow: hidden; }
.ev:hover { background: var(--surface-2); text-decoration: none; }
.ev-t { flex: none; font-weight: 800; color: var(--cat); font-variant-numeric: tabular-nums; }
.ev-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ev-fill { background: var(--cat-soft); color: var(--cat); }
.ev-fill .ev-n { font-weight: 800; }
.ev-fill:hover { background: var(--cat-soft); box-shadow: inset 0 0 0 1px var(--cat); }
.ev-more { border: 0; background: none; text-align: left; padding: 1px 6px; font-size: 12px; font-weight: 800; color: var(--muted); cursor: pointer; }
.ev-more:hover { color: var(--primary); }

/* 月曆下方：點的那一天的清單 */
.day-panel { margin-top: var(--s5); scroll-margin-top: 76px; }
.day-panel-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.day-panel-head h2 { font-size: var(--fs-lg); font-weight: 800; }
.day-count { margin-left: auto; font-size: var(--fs-sm); color: var(--muted); font-weight: 700; }
.day-empty { padding: var(--s5); text-align: center; color: var(--muted); font-size: var(--fs-sm); background: var(--surface);
             border: 1px dashed var(--line-2); border-radius: var(--r-lg); }

/* ── 週檢視(電腦)：左邊時間刻度加七欄；全天與跨日放最上面一條，同一場跨幾天就畫多長 ── */
.wk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.wk-row { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.wk-gutter { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; display: grid; place-items: center; }
.wk-heads { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.wk-dh { display: grid; justify-items: center; gap: 0; padding: 8px 4px; border-left: 1px solid var(--line); min-width: 0; text-align: center; }
.wk-dh span { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.wk-dh b { font-size: var(--fs-lg); font-weight: 800; line-height: 1.3; padding: 0 8px; border-radius: var(--r-pill); font-variant-numeric: tabular-nums; }
.wk-dh small { font-size: 12px; font-weight: 700; color: var(--holiday); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-dh.weekend b { color: var(--muted); }
.wk-dh.holiday b { color: var(--holiday); }
.wk-dh.today b { background: var(--brand); color: #fff; }
.wk-top { border-bottom: 1px solid var(--line-2); background: var(--surface); }
.wk-bars { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px 0; padding: 5px 0; min-height: 38px; }
.wk-bar { display: flex; align-items: center; gap: 4px; margin: 0 3px; padding: 0 8px; border-radius: 7px; min-width: 0;
          background: var(--cat-soft); color: var(--cat); border-left: 3px solid var(--cat); font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.wk-bar:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--cat); }
.wk-bar.cont-l { margin-left: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.wk-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.wk-bar .ev-t:empty { display: none; }
.wk-body { position: relative; }
.wk-hours { position: relative; display: block; }
.wk-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-hours span:first-child { transform: none; top: 2px !important; }
.wk-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); }
.wk-col.weekend { background-color: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.wk-col.today { background-color: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); }
.wk-ev { position: absolute; display: flex; flex-direction: column; gap: 0; padding: 3px 6px; border-radius: 8px; overflow: hidden; min-width: 0;
         background: var(--cat-soft); border-left: 3px solid var(--cat); color: var(--ink); font-size: 12.5px; line-height: 1.35; box-shadow: 0 0 0 1px var(--surface); }
.wk-ev:hover { text-decoration: none; box-shadow: 0 0 0 1px var(--cat), var(--shadow-2); z-index: 2; }
.wk-ev .ev-t { font-size: 12px; }
.wk-ev .ev-n { font-weight: 800; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wk-ev.short { flex-direction: row; align-items: baseline; gap: 4px; white-space: nowrap; }
.wk-ev.short .ev-n { display: block; white-space: nowrap; }

/* ── 週檢視(手機)：七段由上往下，一天一張卡，一場一列 ── */
.wk-list { display: grid; gap: var(--s3); }
.wd-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: var(--s2) var(--s4) var(--s3); }
.wd-sec.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-1); }
.wd-head { display: flex; align-items: center; gap: var(--s2); min-height: 36px; flex-wrap: wrap; }
.wd-head b { font-size: var(--fs-md); font-weight: 800; }
.wd-head > span:not(.chip) { color: var(--muted); font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.wd-head em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--on-primary); background: var(--primary); border-radius: var(--r-pill); padding: 1px 8px; }
.wd-head .chip.holiday { margin-left: auto; }
.wrow { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: var(--s3); min-height: 52px; padding: var(--s2) 0;
        border-top: 1px solid var(--line); color: var(--ink); }
.wrow:hover { text-decoration: none; }
.wrow:active { background: var(--surface-2); }
.wrow-time { display: grid; font-size: var(--fs-sm); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; color: var(--ink-2); }
.wrow-time small { font-size: 12px; font-weight: 600; color: var(--muted); }
.wrow-main { display: grid; min-width: 0; border-left: 3px solid var(--cat); padding-left: 10px; }
.wrow-main b { font-size: var(--fs-md); font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.wrow-main small { font-size: var(--fs-xs); color: var(--muted); }
.wd-empty { font-size: var(--fs-sm); color: var(--ph); padding: 2px 0 4px; }

/* ── 我的 ── */
.mine-seg { margin-bottom: var(--s4); }
.items.ended .item { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.items.ended .item h3 { color: var(--ink-2); }
.list-note { margin-top: var(--s4); text-align: center; color: var(--muted); font-size: var(--fs-xs); }

/* ── 管理頁：只在電腦(票 06、09) ──
   版面照設備報修系統：左邊分區選單(sticky)、右邊一次一個區塊；整頁放寬到 1180px，其他頁照原本 960px。 */
html.admin-wide { --wrap: 1180px; }
.adm { display: grid; grid-template-columns: 216px 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); }
.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(--s5); }
.adm-head h2 { font-size: var(--fs-xl); line-height: 1.3; }
.adm-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; max-width: 46em; }
.adm-head .btn { flex: none; }
.adm-card { display: grid; gap: var(--s4); }
.adm-note { color: var(--muted); font-size: var(--fs-sm); }
.adm-sec { margin-bottom: var(--s5); }
.cc-hint { color: var(--muted); font-size: var(--fs-xs); line-height: 1.6; }
.sec-title { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-md); }
.sec-title span { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; }
.chip.off-chip { background: var(--off-soft); color: var(--off); }
/* 小按鈕：列裡的改名、停用、刪除(滑過整列才清楚，平常淡一階) */
.tiny { min-height: 30px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid transparent; background: none; color: var(--ink-2);
        font-size: var(--fs-xs); font-weight: 700; cursor: pointer; white-space: nowrap; }
.tiny:hover { border-color: var(--line-2); background: var(--surface); color: var(--primary); }
.tiny.danger:hover { color: var(--late); border-color: var(--late-line); background: var(--late-soft); }
/* 排序：上下兩顆小箭頭 */
.ord { display: inline-grid; grid-auto-flow: row; gap: 1px; flex: none; width: 26px; }
.ord-btn { display: grid; place-items: center; width: 26px; height: 18px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.ord-btn svg { width: 15px; height: 15px; }
.ord-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--primary); }
.ord-btn:disabled { opacity: .25; cursor: default; }
.link-add { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--s2); padding: 4px 6px; border: 0; background: none; border-radius: var(--r-sm);
            color: var(--primary); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; }
.link-add svg { width: 15px; height: 15px; }
.link-add:hover { background: var(--primary-soft); }
.ava { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
       font-weight: 800; font-size: var(--fs-xs); }
.ava.big { width: 40px; height: 40px; font-size: var(--fs-md); }

/* 類別卡片：一個大類一張，左緣一條大類色；上半部名稱與動作，下半部左欄小類、右欄誰可以新增 */
.cc-list { display: grid; gap: var(--s4); }
.cc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden;
      border-left: 5px solid var(--cat); }
.cc.is-off { border-left-color: var(--line-2); }
.cc.is-off .cc-title h3 { color: var(--muted); }
.cc-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5) var(--s4) var(--s3);
           background: linear-gradient(90deg, var(--cat-soft), transparent 70%); }
.cc.is-off .cc-head { background: var(--surface-2); }
.cc-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--cat); flex: none; box-shadow: 0 0 0 3px var(--surface); }
.cc.is-off .cc-dot { background: var(--line-2); }
.cc-title { flex: 1; min-width: 0; }
.cc-title h3 { font-size: var(--fs-lg); line-height: 1.3; }
.cc-title p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.cc-meta { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.chip.who-all-chip { background: var(--ok-soft); color: var(--ok); }
.chip.who-list-chip { background: var(--holiday-soft); color: var(--holiday); }
.cc-acts { display: flex; gap: var(--s2); flex: none; }
.cc-acts .btn svg { width: 16px; height: 16px; }
.cc-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.cc-col { padding: var(--s4) var(--s5); display: grid; gap: var(--s2); align-content: start; }
.cc-col + .cc-col { border-left: 1px solid var(--line); }
.cc-col h4 { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: .06em; }
.cc-col h4 span { font-variant-numeric: tabular-nums; }
.cc-col .seg { justify-self: start; }
.cc-col > .btn { justify-self: start; }
.cc-empty { font-size: var(--fs-sm); }
.mn-list, .pl-list { list-style: none; display: grid; }
.mn, .pl { display: flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 4px 4px 4px 0; border-bottom: 1px solid var(--line); }
.mn:last-child, .pl:last-child { border-bottom: 0; }
.mn-name, .pl-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.mn.is-off .mn-name, .pl.is-off .pl-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.mn-uses { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mn-acts { display: flex; gap: 2px; opacity: .55; transition: opacity .12s; }
.mn:hover .mn-acts, .pl:hover .mn-acts, .mn-acts:focus-within { opacity: 1; }
.mn:hover, .pl:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.who-list { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2); }
.who-list li { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 4px 0 5px; border-radius: var(--r-pill);
               background: var(--surface); border: 1px solid var(--line-2); font-size: var(--fs-sm); }
.who-list b { font-weight: 700; }

/* 院內地點：一張卡片一份清單，最後一列「其他」固定在底下 */
.pl-card { padding: var(--s2) var(--s5); }
.pl { min-height: 52px; }
.pl-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--muted); flex: none; }
.pl-icon svg { width: 16px; height: 16px; }
.pl-other { background: var(--surface-2); margin: 0 calc(-1 * var(--s5)); padding-left: var(--s5); padding-right: var(--s5); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.pl-other .pl-name { color: var(--muted); }
.pl-other .mn-uses { white-space: normal; text-align: right; }
.pl-card .cc-hint { padding-bottom: var(--s3); }

/* 管理者名單 */
.ad-list { list-style: none; display: grid; }
.ad-list li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.ad-list li > div { flex: 1; min-width: 0; display: grid; }
.ad-list small { color: var(--muted); font-size: var(--fs-xs); }
.btn.add-big { min-height: 52px; font-size: var(--fs-md); }

/* 異動紀錄全覽：上面種類切換與「只看這一場」，下面一張表 */
.au-bar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.au-filter { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 4px 0 14px; border-radius: var(--r-pill);
             background: var(--primary-soft); color: var(--primary); font-size: var(--fs-sm); }
.au-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; border-collapse: separate; border-spacing: 0; }
.au-table tbody tr { cursor: default; }
.au-table td { vertical-align: top; }
.au-table th:first-child, .au-table td:first-child { padding-left: var(--s4); }
.au-table th { background: var(--surface-2); }
.au-table tbody tr:last-child td { border-bottom: 0; }
.au-table .chip { margin: 0 4px 4px 0; }
.au-who { font-weight: 700; white-space: nowrap; }
.au-what { min-width: 16em; overflow-wrap: anywhere; }
.au-what .log-diff { display: block; }
.au-what .log-diff b { color: var(--muted); font-weight: 700; margin-right: 6px; }
.au-detail { display: block; color: var(--ink-2); }
.au-what .log-diff + .au-detail { color: var(--muted); font-size: var(--fs-xs); }
.au-sum { color: var(--ink-2); }
.au-occ { min-width: 10em; }
.au-occ a { font-weight: 700; display: block; }
.au-occ small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.au-occ .tiny { margin: 2px 0 0 -10px; color: var(--primary); }

/* 大類窗：名稱、12 色色票(底下寫被哪個大類用)、預覽 */
.modal.modal-wide { max-width: 640px; }
.modal-wide .field + .field { margin-top: var(--s4); }
.pal { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s2); }
.pal-sw { display: grid; justify-items: center; gap: 2px; padding: var(--s2) 2px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface);
          cursor: pointer; min-width: 0; }
.pal-sw i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--cat); color: transparent;
            box-shadow: 0 0 0 4px var(--cat-soft); margin: 4px 0 6px; }
.pal-sw i svg { width: 16px; height: 16px; }
.pal-sw b { font-size: var(--fs-xs); font-weight: 800; color: var(--ink-2); }
.pal-sw small { font-size: 11px; color: var(--muted); line-height: 1.3; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sw:hover { border-color: var(--cat); }
.pal-sw[aria-checked="true"] { border-color: var(--cat); background: var(--cat-soft); box-shadow: var(--shadow-1); }
.pal-sw[aria-checked="true"] i { color: var(--surface); }
.maj-preview { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
.pv-bar { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-height: 34px; padding: 0 var(--s3); border-radius: var(--r-sm); background: var(--surface);
          border-left: 4px solid var(--cat); font-size: var(--fs-sm); }
.pv-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }
.modal-wide .actions, #nameForm .actions { margin-top: var(--s5); }
#nameForm .field { margin-top: var(--s2); }
.modal .banner { margin-top: var(--s3); }
.picker-sub { color: var(--muted); font-size: var(--fs-sm) !important; line-height: 1.6 !important; }
.pick-row.taken { cursor: default; opacity: .7; }
.pick-row.taken .ck { background: var(--surface-3); border-color: var(--surface-3); color: var(--muted); }
.pick-row.taken em { margin-left: var(--s2); font-style: normal; }
.fchip-off { font-size: 11px; font-weight: 700; opacity: .8; }
.adm-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); }
.adm-sec-head h2 { font-size: var(--fs-xl); line-height: 1.3; }
.adm-sec-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; max-width: 40em; }
.adm-sec-head .btn { flex: none; }
.adm-foot { color: var(--muted); font-size: var(--fs-xs); line-height: 1.7; border-top: 1px solid var(--line); padding-top: var(--s3); }
.adm-foot b { color: var(--ink-2); }
.adm-none { padding: var(--s5); text-align: center; color: var(--muted); font-size: var(--fs-sm); background: var(--surface-2); border-radius: var(--r-md); }
.adm-later { padding: var(--s6) var(--s5); }
.adm-later .art { width: 72px; height: 72px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.adm-table th { text-align: left; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.adm-table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table tbody tr { cursor: pointer; transition: background .12s; }
.adm-table tbody tr:hover { background: var(--surface-2); }
.adm-table tbody tr[aria-selected="true"] { background: var(--holiday-soft); }
.adm-table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--holiday); }
.adm-table tbody tr:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.adm-table .c-year b { display: block; font-weight: 800; }
.adm-table .c-year span, .adm-table .c-when span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.adm-table .c-num { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table .c-file { overflow-wrap: anywhere; color: var(--ink-2); }
.adm-table .c-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-table .chip.manual { background: var(--info-soft); color: var(--info); }
/* LINE 發送(票 10)：設定兩格並排、發送紀錄表(內容可展開成整則訊息，保留換行) */
.ln-set { margin-bottom: var(--s5); }
.ln-fields { display: grid; grid-template-columns: minmax(180px, 220px) 1fr; gap: var(--s4) var(--s5); align-items: start; }
.ln-fields .field + .field { margin-top: 0; }
.ln-fields .cc-hint { display: block; margin-top: 6px; }
.ln-fields input { font-variant-numeric: tabular-nums; }
#lnGroup { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ln-actions { display: flex; justify-content: flex-end; }
.ln-set code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; padding: 1px 6px; border-radius: 6px; background: var(--surface); }
.ln-table tbody tr { cursor: default; }
.ln-table td { vertical-align: top; }
.ln-text { width: 100%; min-width: 18em; }
.ln-text summary { cursor: pointer; font-weight: 700; color: var(--ink); list-style-position: outside; margin-left: 1.1em; }
.ln-text summary:hover { color: var(--primary); }
.ln-text pre { margin: var(--s2) 0 0; padding: var(--s3) var(--s4); white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.65;
               background: var(--surface-2); border-radius: var(--r-md); color: var(--ink-2); max-height: 420px; overflow: auto; }
.ln-res { white-space: nowrap; }
.ln-res small { display: block; margin-top: 4px; white-space: normal; color: var(--late); font-size: var(--fs-xs); max-width: 16em; }
.chip.ln-notice { background: var(--primary-soft); color: var(--primary); }
.chip.ln-fix { background: var(--holiday-soft); color: var(--holiday); }
.chip.ln-ok { background: var(--ok-soft); color: var(--ok); }
.chip.ln-info { background: var(--info-soft); color: var(--info); }
.chip.ln-late { background: var(--late-soft); color: var(--late); }
.chip.ln-off { background: var(--off-soft); color: var(--off); }
/* 某一年的國定假日：依月份一格一格，琥珀色(國定假日的狀態色) */
.hol-h { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-lg); margin: var(--s2) 0 var(--s3); }
.hol-h span { font-size: var(--fs-sm); font-weight: 700; color: var(--holiday); }
.hol-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); }
.hol-month { border: 1px solid var(--holiday-line); border-radius: var(--r-md); padding: var(--s3); background: var(--surface); }
.hol-month h4 { font-size: var(--fs-sm); font-weight: 800; color: var(--holiday); margin-bottom: var(--s2); }
.hol-month ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hol-month li { display: grid; grid-template-columns: 4.6em 1fr; gap: var(--s2); font-size: var(--fs-sm); }
.hol-date { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 700; white-space: nowrap; }
.hol-name { overflow-wrap: anywhere; }

/* ── 登入頁 ──
   版面、文字、配色逐項照人事帳號系統示範站 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;
  --btn-bg: #E4007F; --btn-bg-hover: #B10063; --on-btn: #FFFFFF; --btn-weight: 700; --btn-shadow: 0 2px 8px rgba(177, 0, 99, .22);
  --line: #E0E4DF; --line-2: #D9DED9; --focus: rgba(228, 0, 127, .12);
  --ok: #1B5E33; --late: #A32C15;
  color-scheme: light;
}
html.gate-mode body { line-height: 1.7; }
/* 上方留白刻意小(示範站：logo 上面不要空太多)，不做垂直置中 */
.gate { max-width: 26rem; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; text-align: center; }
html.gate-mode .view { padding-top: 0; }
.gate .logo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto .7rem;
              box-shadow: 0 6px 18px rgba(48, 55, 53, .16); }
.gate h1 { font-size: 1.45rem; margin-bottom: .25rem; line-height: 1.7; }
/* 卡片寬度跟著裡面那條 200px 直欄走(--欄寬 只寫這裡一處，標籤、輸入框、兩顆按鈕、忘記登入碼都切齊它) */
.gate .card { --欄寬: 200px; max-width: 16rem; margin: 0 auto; padding: 1.5rem 1.4rem; text-align: left; border-radius: 16px;
              box-shadow: 0 1px 2px rgba(48, 55, 53, .05), 0 8px 24px rgba(48, 55, 53, .06); }
.gate .field { width: var(--欄寬); margin: 0 auto 1.1rem; }
.gate .field + .field { margin-top: 0; }
.gate .field > span { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; color: var(--muted); }
.gate input[type=text], .gate input[type=tel] { min-height: 0; font-size: 1rem; line-height: 1.7; border: 1.5px solid var(--line-2);
              border-radius: 10px; padding: .55em .75em; }
.gate input:focus { box-shadow: 0 0 0 3px var(--focus); }
/* 四位數字碼：固定寬置中、四個點的 placeholder；左邊多 12px 補 letter-spacing 在最後一字後面多的那格 */
.gate #code { font-size: 28px; letter-spacing: 12px; text-align: center; padding: 10px 0 10px 12px; border-width: 2px; border-radius: 12px; }
/* 登入那一列：左半「登入」、右半臉或指紋的圖示鈕，兩顆同色同高(預設提示 Passkey)；忘記登入碼是右下角一行底線文字 */
.gate .btn { min-height: 0; }
.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); }
.modal p { font-size: var(--fs-md); line-height: 1.7; }
@media (max-width: 480px) { .modal-bg { align-items: end; padding: 0; } .modal:not(.gate-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-pill); font-size: var(--fs-sm);
         font-weight: 700; box-shadow: var(--shadow-3); max-width: calc(100vw - 32px); }
.loading { display: grid; place-items: center; min-height: 160px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 2s !important; } }

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

/* ── 列印(票 08)：A4 直式、窄邊界 10mm(PDF 鐵律)。只印 #printArea：月是一張 7 欄格子，週是一天一列。
   只有時間、類別(大類)、標題(Q24)；院生與人員的名字本來就不在月曆的回應裡。
   一律亮色印(深色模式下按列印也是白底黑字)，大類色條照印(print-color-adjust)。 */
@page { size: A4 portrait; margin: 10mm; }
@media screen { .print-area { display: none; } }
@media print {
  .top, .tabbar, .toast, .modal-bg { display: none !important; }
  :root { color-scheme: light !important; }
  html, body { background: #fff !important; color: #111 !important; }
  body.has-tabbar .view, .view { padding: 0 !important; max-width: none; }
  .view > :not(.print-area) { display: none !important; }
  .print-area { display: block; color: #111; font-size: 8.5pt; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact;
    --cat-1: #C2185B; --cat-2: #2E7D32; --cat-3: #6A4FB3; --cat-4: #00796B; --cat-5: #C25400; --cat-6: #1565C0; --cat-7: #546170; --cat-8: #7A6000;
    --cat-9: #5A7000; --cat-10: #9C2A97; --cat-11: #6D4C41; --cat-12: #00719E; }
  .pr-head h1 { font-size: 15pt; font-weight: 800; margin: 0 0 3mm; color: #111; }
  .print-area ul { list-style: none; margin: 0; padding: 0; }
  .print-area li { border-left: 0.9mm solid var(--cat); padding-left: 1.2mm; margin-top: 0.7mm; break-inside: avoid; }
  .pr-t { font-weight: 800; font-variant-numeric: tabular-nums; margin-right: 1mm; }
  .pr-c { color: var(--cat); font-weight: 800; margin-right: 1mm; }
  .pr-n { font-weight: 600; }
  .pr-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .pr-grid th { font-size: 9pt; padding: 1mm; border: 0.25mm solid #888; background: #eee; }
  .pr-grid td { border: 0.25mm solid #888; vertical-align: top; padding: 1mm; height: 38mm; overflow-wrap: anywhere; }
  .pr-grid tr { break-inside: avoid; }
  .pr-grid td.other { background: #f3f3f3; color: #777; }
  .pr-d { display: flex; align-items: baseline; gap: 1.5mm; }
  .pr-d b { font-size: 10.5pt; flex: none; }
  .pr-d span { font-size: 7.5pt; font-weight: 800; color: #9A5800; }
  .pr-grid td.holiday .pr-d b { color: #9A5800; }
  .pr-days { width: 100%; border-collapse: collapse; }
  .pr-days tr { break-inside: avoid; }
  .pr-days th, .pr-days td { border-top: 0.25mm solid #888; border-bottom: 0.25mm solid #888; vertical-align: top; padding: 2.5mm 2mm; text-align: left; }
  .pr-days th { width: 26mm; font-weight: 400; }
  .pr-days th b { display: block; font-size: 13pt; font-weight: 800; }
  .pr-days th span { font-size: 9pt; color: #555; }
  .pr-days th em { display: block; font-style: normal; font-size: 8.5pt; font-weight: 800; color: #9A5800; }
  .pr-days tr.holiday th b { color: #9A5800; }
  .pr-days td { font-size: 10.5pt; }
  .pr-days li { display: grid; grid-template-columns: 30mm 14mm 1fr; margin-top: 1.2mm; }
  .pr-days li:first-child { margin-top: 0; }
  .pr-none { color: #999; }
  .pr-foot { margin-top: 3mm; font-size: 7.5pt; color: #666; text-align: right; }
}
