/* ==========================================================================
   課程簽到系統 — 原型樣式
   純靜態 demo，不依賴任何外部字型或 CDN
   ========================================================================== */

:root {
  --primary: #004b87;
  --primary-dark: #003a69;
  --primary-mid: #0068af;
  --primary-soft: #cfe0ee;
  --primary-soft-2: #eaf1f8;
  --ink: #1f2328;
  --ink-2: #3f4650;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f7f6;
  --card: #ffffff;
  --ok: #2e7d5b;
  --ok-soft: #e7f3ed;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --err: #b3261e;
  --err-soft: #fbeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .06), 0 1px 8px rgba(31, 35, 40, .04);
}

* { box-sizing: border-box; }

/* 表單預設有 margin，放進 flex 列（導覽列、表格列）時要歸零 */
.m-0 { margin: 0; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

/* ---------- demo 提示條 ---------- */
.demo-bar {
  background: #2b2f36;
  color: #e8e6e3;
  font-size: 12.5px;
  padding: 6px 16px;
  text-align: center;
  letter-spacing: .02em;
}
.demo-bar strong { color: #f0b79c; font-weight: 600; }

/* ---------- 版面 ---------- */
.topbar {
  background: var(--primary);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--ink);
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
/* topbar 底色是深藍，品牌列改成白字＋小圓點；.brand／.brand-mark 的預設樣式是給登入頁白底卡片用的 */
.topbar .brand { color: #fff; }
.topbar .brand-mark {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  opacity: .8;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 10px;
  border-radius: 7px;
  color: rgba(255,255,255,.8);
  font-size: 14px;
  white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav a.on { color: #fff; font-weight: 700; }
.topbar .spacer { flex: 1; }
.who { font-size: 13.5px; color: rgba(255,255,255,.8); white-space: nowrap; }
.topbar .btn-ghost { color: rgba(255,255,255,.85); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.12); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-head .spacer { flex: 1; }
/* 頁首右側的篩選／查詢列 */
.head-search { display: flex; gap: 8px; margin: 0; }
/* select 預設寬度是 100%（見表單區塊），在 flex 列裡會把整條擠開，這裡改成看內容決定。
   flex-shrink 要關掉：不然頁首一擠，「尚未回寫 ERP」會被壓成「尚未回寫 E…」。 */
.head-search select { width: auto; flex: 0 0 auto; }
/* 空間不夠時整條查詢列換行，而不是把欄位壓扁 */
.head-search { flex-wrap: wrap; justify-content: flex-end; }
.head-search input { flex: 0 1 200px; }

/* 清單上方的動作列：左邊主要動作，右邊篩選與查詢。
   下緣留得比較開，讓這一列明顯屬於「操作」而不是清單的一部分。 */
.list-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 30px; flex-wrap: wrap;
}
/* 篩選列整條靠右、查詢固定在最右。這裡要關掉 .head-search 自己的換行，
   不然它會在寬度還夠的時候就先把「查詢」折到第二行；空間真的不夠時，
   是由 .list-toolbar 把整條篩選列折到下一行，而不是拆散它。 */
.list-toolbar .head-search { margin-left: auto; flex-wrap: nowrap; }

/* 清單上方的筆數摘要 */
.list-summary {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; font-size: 13px; color: var(--muted);
}
.list-summary a { margin-left: auto; }

/* 表格儲存格裡的單鈕表單（例如「帶入」）。form 預設是 block，會把按鈕擠到下一行。 */
.inline-form { display: inline; }

/* 只拿 fieldset 的 disabled 行為（一次停用整組欄位，select 也管得到），不要它的外框與內距。 */
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* 鎖住時要一眼看得出來。瀏覽器對 disabled 空欄位幾乎不改外觀，
   不上色的話人資只會覺得「這格怎麼打不進去」。 */
.plain-fieldset:disabled input,
.plain-fieldset:disabled select,
.plain-fieldset:disabled textarea {
  background: var(--bg); color: var(--ink-2); cursor: not-allowed;
}
.plain-fieldset:disabled label { color: var(--muted); }

/* 清單下方的翻頁列 */
.pager { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.pager .pager-info { font-size: 13px; color: var(--muted); }
.pager .spacer { flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid var(--primary-soft);
  background: var(--card);
  color: var(--primary-dark);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--primary-soft-2); border-color: var(--primary-mid); text-decoration: none; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger-outline { border-color: var(--err); color: var(--err); }
.btn-danger-outline:hover { background: var(--err-soft); border-color: var(--err); }
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); }

/* ---------- 表單 ---------- */
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 5px;
}
.field label .req { color: var(--primary-dark); }
.field.has-error label { color: var(--err); }
/* .hint 也會單獨用在欄位之外（學員端／講師端的表單說明），所以樣式不能綁在 .field 底下，
   否則那幾處會退回預設的黑色正常字級。.field 內的只多一點上邊距。 */
.hint { font-size: 12.5px; color: var(--muted); }
.field .hint { margin-top: 4px; }
input[type=text], input[type=password], input[type=date],
input[type=time], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%;
  height: 38px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(0, 104, 175, .15);
}
input[readonly] { background: #f3f4f5; color: var(--ink-2); }
textarea { height: auto; resize: vertical; min-height: 72px; }
/* 欄位少的表單（變更密碼）不要拉滿版面寬度，一行太長反而難讀 */
.form-narrow { max-width: 420px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 620px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}

/* ---------- 分頁籤（建檔模式） ---------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); padding: 0 18px; }
.tab {
  padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--muted);
  border: none; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.on { color: var(--primary-dark); border-bottom-color: var(--primary); }
/* 分頁籤底下的內容。籤本身已經有下框線，這裡只負責留白。 */
.tab-body { padding-top: 22px; }
/* 模式說明是一行灰字，與下面的表單之間要留一點距離，但不要留到像另一個區塊。 */
.tab-body > .hint { margin-bottom: 18px; }

/* ---------- 標籤 ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge-open { background: var(--ok-soft); color: var(--ok); }
.badge-soon { background: var(--warn-soft); color: var(--warn); }
.badge-closed { background: #eef0f2; color: var(--muted); }
.badge-src { background: #eef2f7; color: #45577a; }
.badge-info { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; font-size: 14px; }
td:not(:last-child) { white-space: nowrap; }
/* 補登原因選「其他」時是手填的長句子，就這一欄要能換行；其餘欄位（工號、姓名、時間）維持不斷字。
   注意不要取名 .wrap——那是上面版面容器用掉的名字（帶 padding: 24px 20px 64px），撞名會把列高撐成兩倍。 */
td.cell-wrap { white-space: normal; }
/* 簽到名單列尾的操作鈕：最後一欄預設可換行，會把「作廢」兩個字排成直的。 */
#rows td:last-child { white-space: nowrap; }
th {
  background: #fafafa; color: var(--muted); font-weight: 600; font-size: 12.5px;
  letter-spacing: .04em; border-bottom: 1px solid var(--line);
  white-space: nowrap;                 /* 欄位一多，表頭就會被擠成兩行 */
}
tbody tr { border-bottom: 1px solid #f0f1f2; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fcfbfa; }
td.num { font-variant-numeric: tabular-nums; }
th.ta-r, td.ta-r { text-align: right; }
/* 表格列裡的次要資訊（公司別／講師、上課時間），掛在主要值底下 */
td .row-sub { font-size: 12.5px; color: var(--muted); }
td.cell-sm { font-size: 13px; }

/* ---------- 定義列表（課程資訊） ---------- */
.dl { display: grid; grid-template-columns: 108px 1fr; gap: 9px 14px; }
.dl dt { color: var(--muted); font-size: 13.5px; }
.dl dd { margin: 0; font-size: 14.5px; }
@media (max-width: 480px) { .dl { grid-template-columns: 92px 1fr; } }

/* ---------- QRcode ---------- */
.qr-box { text-align: center; }
.qr-frame {
  display: inline-block; padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}
.qr-frame svg { display: block; width: 100%; height: auto; }
.qr-url {
  margin-top: 10px; font-size: 12px; color: var(--muted);
  word-break: break-all; font-family: Consolas, Menlo, monospace;
}
.qr-fallback {
  padding: 26px 18px; border: 1px dashed var(--line); border-radius: 10px;
  color: var(--muted); font-size: 13px; background: #fafafa;
}

/* ---------- 提示訊息 ---------- */
.alert {
  padding: 11px 14px; border-radius: 8px; font-size: 14px;
  margin-bottom: 14px; border: 1px solid transparent;
}
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #cfe6dc; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #f2ddb8; }
.alert-err { background: var(--err-soft); color: var(--err); border-color: #f2cdca; }
.alert-info { background: #eef2f7; color: #3c4b63; border-color: #d8e0ea; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- 自訂確認彈窗（取代原生 confirm()） ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 32, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--card); border-radius: 12px; padding: 22px 24px;
  max-width: 360px; width: 100%; box-shadow: var(--shadow);
}
.modal-msg { font-size: 14.5px; color: var(--ink); line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ==========================================================================
   登入頁
   ========================================================================== */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 372px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 32px 28px;
}
.login-title {
  text-align: center; font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 4px;
}
.login-card .tagline {
  text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 24px;
}

/* 錯誤頁沿用登入頁的卡片版型，只差訊息區的間距 */
.err-alert { margin: 18px 0; }
.err-ref { margin-bottom: 14px; }

/* ==========================================================================
   學員端（手機優先）
   ========================================================================== */
.s-page {
  max-width: 460px; margin: 0 auto; padding: 0 0 40px;
  min-height: 100vh; background: var(--bg);
}
.s-head {
  background: var(--primary); color: #fff; padding: 18px 20px 20px;
}
.s-head .s-kicker {
  font-size: 12.5px; opacity: .9; letter-spacing: .06em; margin-bottom: 3px;
}
.s-head h1 { font-size: 19px; line-height: 1.45; }
/* 表頭的次要資訊（日期、主辦單位）。刻意比標題小一階、降透明度，不搶標題 */
.s-head .s-meta { font-size: 12.5px; opacity: .88; margin-top: 5px; }
.s-body { padding: 18px 16px 0; }
.s-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.s-card h2 {
  font-size: 14px; color: var(--muted); font-weight: 600;
  letter-spacing: .04em; margin-bottom: 12px;
}
.s-me {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--ink-2);
  padding: 10px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 14px;
}
.s-me .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.s-me .spacer { flex: 1; }
.s-me a { font-size: 13px; }
.s-me .sub { color: var(--muted); }

/* 講師端：外部講師的「登記講師為 ○○○」那一段 */
.sig-who { font-size: 15px; line-height: 1.9; margin-bottom: 14px; }
.sig-who .name { font-size: 17px; font-weight: 700; }
.sig-who .org { color: var(--muted); }
.sig-actions { display: flex; gap: 8px; margin-top: 10px; }
.sig-actions .btn { flex: 1; }

.s-status {
  text-align: center; padding: 26px 18px;
  border-radius: 12px; margin-bottom: 14px;
}
.s-status .icon { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.s-status .title { font-size: 19px; font-weight: 700; margin-bottom: 3px; }
.s-status .desc { font-size: 13.5px; opacity: .85; }
.s-status.done { background: var(--ok-soft); color: var(--ok); border: 1px solid #cfe6dc; }
.s-status.blocked { background: var(--err-soft); color: var(--err); border: 1px solid #f2cdca; }
/* 「尚未開放」不是錯誤，只是還沒到時間——照功能色的分工走黃色，紅色留給真的不能簽的狀況。 */
.s-status.soon { background: var(--warn-soft); color: var(--warn); border: 1px solid #f2ddb8; }

/* 簽到時段那一行。可以簽的時候也要看得到截止時間：現場同仁只有手機，
   投影幕的倒數不一定看得到，不講截止時間他不知道還剩多久。 */
.s-window {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font-size: 13px; color: var(--ink-2);
}
.s-window .lbl { color: var(--muted); }
.s-window .val { font-variant-numeric: tabular-nums; }

/* 表單說明文字與上方內容之間要有距離（原本靠 inline style 的 margin-top）。
   手機端的 hint 都是獨立一段，不是欄位的附註，所以間距比 .field .hint 大；
   .field 內的仍維持 4px（選擇器多一層，優先權蓋得過這條）。 */
.s-page .hint { margin-top: 12px; }
.s-page .field .hint { margin-top: 4px; }
.hint.center { text-align: center; }

/* 課程資訊的定義列表在手機上標題欄再窄一點，值才不會被擠到換行 */
.dl-s { grid-template-columns: 76px 1fr; }

/* 純資訊卡（講師端底部的課程資訊）：不要陰影、底色與頁面相同，份量比操作卡片輕 */
.s-card.plain { background: var(--bg); box-shadow: none; }

.s-empty { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

.s-checkin-form { margin-bottom: 14px; }

/* 已簽到人數：標題是灰色小字，人數本身要用正常字色才看得出來 */
.s-card h2 .count { color: var(--ink); }

.s-list { list-style: none; margin: 0; padding: 0; }
.s-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #f0f1f2; font-size: 14.5px;
}
.s-list li:last-child { border-bottom: none; }
.s-list .co {
  font-size: 12px; color: var(--muted); background: var(--bg);
  padding: 1px 7px; border-radius: 5px; white-space: nowrap;
}
.s-list .t { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.s-list li.mine { font-weight: 700; }
.s-foot {
  text-align: center; color: var(--muted); font-size: 12px; padding: 18px 20px 0;
}

/* ==========================================================================
   投影用 QRcode 頁
   ========================================================================== */
.proj {
  min-height: 100vh; background: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 4vh 4vw; text-align: center;
}
.proj .p-kicker {
  color: var(--primary-dark); font-size: 1.4vw; font-weight: 700;
  letter-spacing: .2em; margin-bottom: 1vh;
}
.proj h1 { font-size: 3.4vw; margin-bottom: 1vh; }
.proj .p-meta { color: var(--muted); font-size: 1.5vw; margin-bottom: 3vh; }
/* text-align:center 只管文字；.p-qr 是固定寬度的區塊，要靠 auto margin 才會置中 */
.proj .p-qr { width: 46vh; max-width: 82vw; margin-left: auto; margin-right: auto; }
.proj .p-qr svg { display: block; width: 100%; height: auto; }
.proj .p-hint { margin-top: 2.5vh; font-size: 1.6vw; color: var(--ink-2); }
.proj .p-stats {
  margin-top: 2vh; display: flex; gap: 4vw; justify-content: center;
  font-size: 1.4vw; color: var(--muted);
}
.proj .p-stats b { color: var(--ink); font-size: 2.2vw; display: block; font-variant-numeric: tabular-nums; }
.proj .p-back {
  position: fixed; top: 14px; right: 18px; font-size: 13px;
}
@media (max-width: 900px) {
  .proj .p-kicker, .proj .p-meta, .proj .p-hint, .proj .p-stats { font-size: 14px; }
  .proj h1 { font-size: 22px; }
  .proj .p-stats b { font-size: 22px; }
}

/* ==========================================================================
   講師簽核（0908 demo 沒有這一頁，講師簽到是當時人資指出缺少的部分）
   ========================================================================== */
.sig-box {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  height: 190px;
  overflow: hidden;
  touch-action: none;            /* 簽名時不要讓瀏覽器捲動頁面 */
}
.sig-pad { display: block; width: 100%; height: 100%; cursor: crosshair; }

/* 手機橫放時簽名板加高：簽名本來就是橫向動作，講師多半會把手機轉橫再簽。
   直放 190px 夠用，橫放時可視高度變矮，用 vh 讓簽名區跟著縮但不會只剩一條縫。 */
@media (orientation: landscape) and (max-height: 520px) {
  .sig-box { height: min(190px, 46vh); }
}
.sig-baseline {
  position: absolute; left: 24px; right: 24px; bottom: 44px;
  border-bottom: 1px dashed var(--line);
  pointer-events: none;
}
.sig-hint {
  position: absolute; left: 0; right: 0; bottom: 16px;
  text-align: center; color: var(--muted); font-size: 13px;
  pointer-events: none;
}

/* 管理端顯示已簽核的簽名圖 */
.sig-preview {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 8px; display: block; width: 100%; height: auto;
}

/* ==========================================================================
   列印版簽到表
   螢幕上是 A4 比例的預覽，列印時只留紙面本身（工具列、瀏覽器背景都不印）
   ========================================================================== */
.print-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.print-bar-hint { font-size: 12.5px; color: var(--muted); }

.sheet {
  max-width: 820px; margin: 22px auto; padding: 26px 30px;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
}
.sheet-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px;
}
.sheet-head h1 { font-size: 20px; letter-spacing: .08em; }
.sheet-no { margin-left: auto; font-size: 12.5px; color: var(--muted); }

.sheet-info { border: 1px solid var(--line); margin-bottom: 14px; }
.sheet-info th, .sheet-info td {
  border: 1px solid var(--line); padding: 7px 10px; font-size: 13px;
}
.sheet-info th { background: #f6f5f4; color: var(--ink-2); width: 86px; white-space: nowrap; }

.sheet-list { border: 1px solid var(--line); }
.sheet-list th, .sheet-list td {
  border: 1px solid var(--line); padding: 6px 8px; font-size: 12.5px;
}
.sheet-list th { background: #f6f5f4; color: var(--ink-2); }
.sheet-list tbody tr:hover { background: none; }   /* 紙本不需要 hover */
.sheet-list tr.blank td { height: 26px; }

.sheet-foot { display: flex; gap: 18px; margin-top: 16px; }
.sheet-sign { flex: 1; border: 1px solid var(--line); padding: 8px 10px; min-height: 92px; }
.sheet-sign .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sheet-sign img { display: block; max-height: 58px; width: auto; }
.sheet-sign .meta { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.sheet-sign .blank-sign { height: 58px; }

.sheet-note { margin-top: 10px; font-size: 11.5px; color: var(--muted); text-align: right; }

@media print {
  /* 工具列不進紙；紙面本身不要邊框與陰影，靠印表機的邊界就好 */
  .print-bar { display: none; }
  body { background: #fff; }
  .sheet { border: none; border-radius: 0; margin: 0; padding: 0; max-width: none; }
  .sheet-list tr { break-inside: avoid; }
  .sheet-foot { break-inside: avoid; }
}

/* ==========================================================================
   課程詳情頁（2026-09-15 改版）：拿掉滿版卡片，改用留白＋分隔線＋淡色底塊分區
   ========================================================================== */
.d-crumb { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.d-crumb a { color: var(--primary-mid); }

.d-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.d-title-row h1 { font-size: 24px; }
.d-title-row .spacer { flex: 1; }

.d-meta { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.d-meta .lbl { color: var(--muted); margin-right: 6px; }
/* 課程事實有兩行（時間／單位、講師／主辦），第二行跟第一行靠緊一點 */
.d-meta + .d-meta { margin-top: 6px; }

/* 建檔人員：推到該行最右，對齊標題列的「修改」。
   它是稽核用的附屬資訊不是課程事實，所以字級縮小、顏色變淡。
   align-self 讓它跟同一行較大的字體對齊在中線，不會浮在上緣。 */
.d-meta .d-meta-note {
  margin-left: auto;
  align-self: center;
  font-size: 12.5px;
  color: var(--muted);
}

.d-divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

.qr-clickable { cursor: pointer; transition: box-shadow .12s; }
.qr-clickable:hover { box-shadow: 0 0 0 3px var(--primary-soft); }

/* 點 QRcode 展開的投影模式覆蓋層：iframe 四周留深色邊，點得到才能收起來（點背景 = 關閉）。
   關鍵是「限制 iframe 的寬度」，不是調 overlay 的 padding：投影頁的 QRcode 寬度是用 vh 算的，
   iframe 拉多寬 QRcode 都不會變寬，只會讓 QRcode 左右多出一大片白。
   固定成直式面板（<=720px）之後，iframe 內部會落在投影頁 max-width:900px 的斷點裡，
   字級改吃固定 px，不再隨寬度浮動，版面就穩定了。 */
.projector-overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .85);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 5vh 4vw;
}
.projector-overlay[hidden] { display: none; }
.projector-overlay iframe {
  width: min(92vw, 720px); height: 100%; max-height: 720px;
  border: 0; border-radius: 12px; background: #fff;
}
.projector-close {
  position: fixed; top: 24px; right: 28px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .3); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.projector-close:hover { background: rgba(255, 255, 255, .22); }

.grid-2.d-grid { grid-template-columns: 2fr 1fr; }

.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 16px; }
.section-head .spacer { flex: 1; }

/* 收合區塊（QRcode／講師簽核）：標題列固定放按鈕與徽章，展開/收合只影響下方內容 */
details.collapsible { background: var(--primary-soft-2); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
details.collapsible summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
details.collapsible summary::-webkit-details-marker { display: none; }
details.collapsible summary .pin { margin-left: auto; display: flex; gap: 6px; align-items: center; }
details.collapsible summary .chev { color: var(--muted); transition: transform .15s; }
details.collapsible[open] summary .chev { transform: rotate(90deg); }
details.collapsible .d-body { margin-top: 14px; }

/* 人資補簽收合列：純文字連結樣式，不用淡色底塊，放在名單下面比較輕 */
/* 標題列用一般深色粗體，不用連結色：藍字會讓人以為點下去是跳到別頁，
   但它其實是上面那份簽到名單底下的一個子區塊。上緣一條分隔線交代從屬關係。 */
details.inline-collapsible { border-top: 1px solid var(--line); margin-top: 18px; }
details.inline-collapsible summary {
  list-style: none; cursor: pointer; color: var(--ink); font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; padding: 14px 0;
}
details.inline-collapsible summary::-webkit-details-marker { display: none; }
details.inline-collapsible summary:hover .s-title { color: var(--primary-mid); }
details.inline-collapsible summary .plus { color: var(--muted); font-weight: 400; }
details.inline-collapsible summary .chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
details.inline-collapsible[open] summary .chev { transform: rotate(90deg); }
details.inline-collapsible .d-body { margin-top: 4px; padding-bottom: 6px; }

/* 「?」說明點：說明文字平常收起來，只有真的想知道「什麼情況該用」的人才需要讀，
   不必長駐在標題列上佔一整行。 */
.help-dot {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 16px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 11px; font-weight: 700; cursor: help;
}
.help-dot .help-body {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: 260px; padding: 10px 12px; border-radius: 8px;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.6;
  text-align: left; z-index: 20; opacity: 0; visibility: hidden; transition: opacity .12s;
}
.help-dot:hover .help-body, .help-dot:focus .help-body, .help-dot:focus-within .help-body {
  opacity: 1; visibility: visible;
}

/* 表格列尾的「作廢」：是破壞性操作但不是頁面主動作，用文字連結的份量，滑過才轉紅 */
.btn-link-danger {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 13px; color: var(--muted); font-family: inherit;
}
.btn-link-danger:hover { color: var(--err); text-decoration: underline; }

/* 表單的動作區：跟上面的輸入欄位用分隔線隔開，按鈕自己一行，旁邊不再掛說明文字 */
.form-actions {
  display: flex; gap: 10px; align-items: center;
  border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px;
}

/* ==========================================================================
   Create／Edit 表單（2026-09-15 改版；2026-09-16 改雙欄）
   課程資訊＋簽到時段放左欄、講師放右欄，區塊標題＋分隔線取代卡片
   ========================================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 860px) { .form-grid { grid-template-columns: 1fr; } }

.form-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.form-section:first-child { padding-top: 0; }
.form-section:last-of-type { border-bottom: none; }
.form-section h2 { font-size: 15px; margin-bottom: 16px; }

/* 課程資訊底下的「簽到時段」：同一欄、同一個主題，用小標題輕輕分隔，不再整段隔開 */
.sub-section { margin-top: 20px; }
.sub-section h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; letter-spacing: .03em; }

/* 日期＋開始／結束時間＋時數：本質是同一段區間，固定小寬度並排，不拉滿整行 */
.field-inline-fixed { display: flex; gap: 10px; }
.field-inline-fixed .f-date { flex: 0 0 140px; }
.field-inline-fixed .f-time { flex: 0 0 128px; }
.field-inline-fixed .f-hours { flex: 0 0 84px; }
.field-inline-fixed .f-hours input[readonly] { background: var(--bg); color: var(--ink-2); }
.field-inline-fixed .f-year { flex: 0 0 110px; }
/* ERP 課程下拉要吃掉剩下的寬度：課程名稱長，壓窄了看不出在選什麼。 */
.field-inline-fixed .f-grow { flex: 1 1 auto; min-width: 0; }

/* ---------- 時／分數字輸入（取代原生 time / datetime-local，也取代下拉選單） ---------- */
.time-picker, .dt-picker { display: flex; align-items: center; gap: 6px; }
.time-picker input[type=number], .dt-picker input[type=number] {
  width: 52px; flex: 0 0 52px; text-align: center; padding-left: 4px; padding-right: 4px;
}
.dt-picker input[type=date] { flex: 1 1 auto; min-width: 128px; }
.tp-sep { color: var(--muted); font-weight: 600; }

/* ---------- QRcode 複製連結：下拉選單 ---------- */
.copy-menu { position: relative; display: inline-flex; }
.copy-menu-list {
  position: absolute; top: 100%; left: 0; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); min-width: 180px; overflow: hidden; z-index: 10;
}
.copy-menu-list button {
  display: block; width: 100%; text-align: left; padding: 9px 13px;
  border: none; background: none; font-family: inherit; font-size: 13.5px;
  color: var(--ink-2); cursor: pointer;
}
.copy-menu-list button:hover { background: var(--primary-soft-2); }
