/* 泰賀營造表單系統：版面與表單紙張樣式 */
:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #1c2530;
  --muted: #66727f;
  --line: #d5dbe1;
  --brand: #1f4e79;
  --brand-dark: #173b5c;
  --brand-soft: #e6eef6;
  --accent: #b7791f;
  --danger: #b42318;
  --ok: #1a7f4b;
  --field: #f2f7fd;          /* 可填寫欄位的底色 */
  --field-focus: #fff9db;
  --calc: #f6f6f4;           /* 自動計算欄位的底色 */
  --paper-line: #222;
  --ui-font: "Microsoft JhengHei", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --form-font: "DFKai-SB", "BiauKai", "標楷體", "Microsoft JhengHei", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--ui-font); font-size: 15px; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1, h2, h3, h4 { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 80px 20px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--danger); }

/* ---------- 按鈕 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: #9aa7b4; background: #f7f9fb; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 9px; font-size: 13px; }
button.link { border: 0; background: none; padding: 2px 4px; color: var(--brand); cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link:disabled { color: #aab3bc; cursor: default; text-decoration: none; }
button.link.danger { color: var(--danger); }
:focus-visible { outline: 2px solid #3b82c4; outline-offset: 1px; }

/* ---------- 簽核 ---------- */
.status-badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12.5px; white-space: nowrap; background: #eef1f4; color: var(--muted); }
.status-badge.pending { background: #fff4d6; color: #8a5a00; font-weight: 600; }
.status-badge.approved { background: #e4f3ea; color: var(--ok); font-weight: 600; }
.approval-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 20px; background: #f6f8fa; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.approval-bar .steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.approval-bar .step { display: inline-flex; flex-direction: column; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); background: #fff; line-height: 1.3; }
.approval-bar .step + .step::before { content: none; }
.approval-bar .step small { font-size: 11.5px; color: var(--muted); }
.approval-bar .step.done { border-color: #bfe3cd; background: #e4f3ea; }
.approval-bar .step.done .step-name { color: var(--ok); font-weight: 600; }
.approval-bar .step.current { border-color: #e8c76a; background: #fff4d6; }
.approval-bar .step.current .step-name { color: #8a5a00; font-weight: 600; }
.approval-bar .flow-note { font-size: 13px; }
.approval-bar .flow-note.danger { color: var(--danger); font-weight: 600; }
.approval-bar .flow-actions { margin-left: auto; display: flex; gap: 6px; }
.paper.locked { pointer-events: none; }
.paper.locked .aux.live { pointer-events: auto; }
.approval-bar .step.skipped { opacity: .5; }
.approval-bar .step.skipped.collapsed { opacity: 1; border-style: dashed; background: transparent; color: var(--muted); font-size: 12px; padding: 2px 8px; }
.approval-bar .step.skipped.collapsed small { font-size: 10.5px; }
.ncr-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: #e8eef7; color: #2b4f7e; font-size: 11.5px; font-family: var(--ui-font); text-decoration: none; vertical-align: 1px; }
.ncr-tag:hover { background: #d6e2f3; }
.paper.locked::after { content: "已送出簽核，內容鎖定"; position: sticky; bottom: 8px; display: block; width: max-content; margin: 8px auto 0; padding: 4px 14px; border-radius: 12px; background: rgba(28, 37, 48, .75); color: #fff; font-size: 12.5px; font-family: var(--ui-font); }
.home .inbox .section-title .count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12.5px; text-align: center; margin-left: 4px; }
.home .inbox .section-title .count.danger { background: var(--danger); }
.home .recent-row.returned { border-left: 3px solid var(--danger); }
.home .recent-row.stalled { border-left: 3px solid var(--danger); }
.member-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 6px 0 10px; }
.member-pick { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.member-pick .member-name { font-weight: 600; }
.grid td.members-cell { white-space: normal; font-size: 13px; line-height: 1.4; }
.home .recent-row.mine { border-left: 3px solid var(--accent); background: #fffaf0; }
.home .recent-row.proxy { opacity: .72; }
.home .recent-row.proxy:hover { opacity: 1; }
.home .mine-tag, .home .proxy-tag { display: inline-block; padding: 0 6px; border-radius: 9px; font-size: 11.5px; line-height: 17px; }
.home .mine-tag { background: var(--accent); color: #fff; font-weight: 600; }
.home .proxy-tag { background: #eef1f4; color: var(--muted); }
.approval-bar .flow-note.mine { color: var(--accent); font-weight: 600; }
.approval-bar .flow-note.proxy { color: var(--muted); }
.home .recent-meta .wait { white-space: nowrap; }
.home .recent-meta .wait.danger, .home .danger { color: var(--danger); font-weight: 600; }
.home .warn { color: #d9822b; }
.home .defect-brief { flex: none; max-height: 40vh; overflow-y: auto; margin-bottom: 10px; padding: 8px 12px; border: 1px solid #e3c9b0; border-radius: 6px; background: #fff8f0; }
.home .defect-brief.overdue { border-color: var(--danger); }
.home .defect-brief > a { color: inherit; text-decoration: none; font-size: 14px; }
.home .defect-brief > a:hover { text-decoration: underline; }
.home .defect-brief-projects { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; }
.home .defect-brief-projects a { color: var(--ink); text-decoration: none; }
.home .defect-brief-projects a:hover { text-decoration: underline; }
.home .defect-brief .defect-row { margin-top: 6px; background: #fff; }
.home .defect-brief .defect-row.overdue { border-left: 3px solid var(--danger); }
.home .defect-brief .defect-row .recent-type { color: #d9822b; font-weight: 600; }
.home .defect-brief .defect-row.overdue .recent-type { color: var(--danger); }

/* ---------- 缺失追蹤清單 ---------- */
.defect-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.defect-summary .chip { padding: 4px 12px; border-radius: 14px; background: #f1f3f5; font-size: 13.5px; color: var(--muted); }
.defect-summary .chip.open { background: #fdecea; color: var(--danger); font-weight: 600; }
.defect-summary .chip.fixed { background: #fff4d6; color: #8a5a00; font-weight: 600; }
.defect-summary .chip.overdue { background: var(--danger); color: #fff; font-weight: 600; }
.defect-table .status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12.5px; white-space: nowrap; }
.defect-table .status.open { background: #fdecea; color: var(--danger); }
.defect-table .status.fixed { background: #fff4d6; color: #8a5a00; }
.defect-table .status.closed { background: #e4f3ea; color: var(--ok); }
.defect-table .overdue-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11.5px; }
.defect-table td.overdue { color: var(--danger); font-weight: 600; }
.defect-summary .chip.soon { background: #d9822b; color: #fff; font-weight: 600; }
.defect-table .soon-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 10px; background: #d9822b; color: #fff; font-size: 11.5px; }
.defect-table td.soon { color: #d9822b; font-weight: 600; }
.defect-table tr.closed td { color: var(--muted); }
.defect-table .row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.defect-table .row-link:hover { text-decoration: underline; }
.defect-form { grid-template-columns: 1fr 1fr; }
.defect-form h4 { grid-column: 1 / -1; margin: 6px 0 0; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--brand); }
.defect-form h4:first-child { margin-top: 0; }
.defect-form .defect-source { padding: 8px 12px; background: #f6f8fa; border-radius: 6px; line-height: 1.7; font-size: 14px; }
.defect-form .defect-source small { color: var(--muted); }
.defect-form textarea.auto { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; width: 100%; resize: none; }
.app-side nav a.sub { padding-left: 28px; font-size: 13.5px; }
@media (max-width: 720px) { .defect-form { grid-template-columns: 1fr; } }

/* ---------- 登入 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 340px; background: var(--panel); border-radius: 10px; padding: 32px 30px; box-shadow: 0 8px 30px rgba(20, 40, 60, .12);
  display: flex; flex-direction: column; gap: 14px; }
.login-box h1 { font-size: 22px; line-height: 1.4; color: var(--brand); text-align: center; margin-bottom: 6px; }
.login-box label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--muted); }
.login-box input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.login-box .btn { justify-content: center; padding: 9px; }
.login-note { margin: 0; font-size: 13.5px; color: var(--accent); }
.login-box .error { margin: 0; font-size: 13.5px; }

/* ---------- 部門選擇 ---------- */
.dept-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.dept-top { height: 56px; flex: none; background: #1b2b3a; color: #fff; display: flex; align-items: center; padding: 0 24px; }
.dept-top .top-right button.link { color: #c9d3dd; }
.dept-brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.dept-brand small { font-size: 12px; font-weight: 400; color: #8fa1b3; letter-spacing: 2px; margin-left: 10px; }
.dept-body { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 5vh 24px 60px; }
.dept-cal { margin-top: 34px; }
/* 首頁一頁式（2026-10-16 副理拍板）：五個部門一列、共用資料一列各自縮薄，行事曆填滿剩餘高度、整頁不捲動 */
.dept-wrap.one-page { height: 100vh; min-height: 0; overflow: hidden; }
.dept-body.one-page { display: flex; flex-direction: column; min-height: 0; max-width: 1480px; padding: 26px 32px 20px; }
.dept-body.one-page h1 { font-size: 20px; margin: 0 0 14px; }
.one-page .dept-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.one-page .dept-card { flex-direction: row; align-items: baseline; gap: 12px; padding: 16px 20px 14px; border-top-width: 3px; }
.one-page .dept-name { font-size: 19px; letter-spacing: 1.5px; }
.one-page .dept-count { font-size: 12.5px; }
.one-page .dept-shared { margin-top: 22px; }
.one-page .section-title { font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }
.one-page .shared-grid { gap: 16px; }
.one-page .shared-card { flex-direction: row; align-items: baseline; gap: 10px; padding: 11px 16px; min-width: 0; }
.one-page .shared-name { font-size: 15px; white-space: nowrap; }
.one-page .shared-hint { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.one-page .dept-cal { margin-top: 22px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.one-page .dept-cal .section-title { flex: none; }
.one-page .cal { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px 14px; }
.one-page .cal-head { flex: none; margin-bottom: 10px; }
.one-page .cal-grid { flex: 1; min-height: 0; grid-template-rows: auto; grid-auto-rows: minmax(0, 1fr); }
.one-page .cal-cell { min-height: 0; }
.one-page .cal-detail { flex: none; max-height: 30vh; overflow-y: auto; margin-top: 10px; }
/* 螢幕不夠高（筆電 768p）時不硬塞：行事曆格子保底高度，頁面允許捲動 */
@media (max-height: 860px) {
  .dept-wrap.one-page { height: auto; min-height: 100vh; overflow: visible; }
  .one-page .cal-cell { min-height: 84px; }
  .one-page .cal-detail { max-height: none; }
}
@media (max-width: 900px) {
  .dept-wrap.one-page { height: auto; overflow: visible; }
  .dept-body.one-page { display: block; }
  .one-page .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .one-page .shared-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .one-page .cal-cell { min-height: 72px; }
  .one-page .cal-detail { max-height: none; }
}
.dept-shared { margin-top: 30px; }
.shared-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.shared-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); transition: box-shadow .15s; }
.shared-card:hover { box-shadow: 0 6px 18px rgba(20, 40, 60, .12); }
.shared-name { font-size: 16px; font-weight: 700; color: var(--brand); }
.shared-hint { font-size: 12.5px; color: var(--muted); }
.dept-body.shared-page { max-width: 1400px; padding-top: 18px; }
.shared-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.shared-bar .crumb-shared { font-size: 13px; color: var(--muted); }
.nav-shared a { color: #9fc4e4; font-size: 13px; }
@media (max-width: 900px) { .shared-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dept-body h1 { font-size: 22px; margin-bottom: 22px; }
.dept-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.dept-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 28px 24px 22px; background: var(--panel); border: 1px solid var(--line);
  border-top: 4px solid var(--brand); border-radius: 8px; cursor: pointer; text-align: left; transition: box-shadow .15s, transform .15s; }
.dept-card:hover { box-shadow: 0 8px 24px rgba(20, 40, 60, .14); transform: translateY(-2px); }
.dept-name { font-size: 22px; font-weight: 700; color: var(--brand); letter-spacing: 2px; }
.dept-count { font-size: 13px; color: var(--muted); }
.dept-switch { display: block; width: 100%; text-align: left; padding: 9px 18px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04); color: #9fc4e4; font-size: 13px; cursor: pointer; }
.dept-switch:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.linked-note { margin: 0 0 12px; padding: 7px 12px; background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 4px; font-size: 13.5px; color: var(--brand-dark); }

/* ---------- 外框 ---------- */
.layout { display: flex; min-height: 100vh; }
.app-side { width: 208px; flex: none; background: #1b2b3a; color: #c9d3dd; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; padding: 16px 18px 14px; color: #fff; font-size: 18px; font-weight: 700; text-decoration: none; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand small { display: block; font-size: 13px; font-weight: 400; color: #9fc4e4; letter-spacing: 2px; margin-top: 2px; }
.app-side nav { padding: 8px 0 24px; }
.app-side nav a { display: block; padding: 6px 18px; color: #c9d3dd; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.app-side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-side nav a.on { background: rgba(255, 255, 255, .1); color: #fff; border-left-color: #6fb1e6; }
.nav-title { padding: 14px 18px 4px; font-size: 12px; color: #7f92a5; letter-spacing: 1px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top { height: 50px; flex: none; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 30; }
.project-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.project-pick select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; min-width: 300px; max-width: 46vw; font-weight: 600; color: var(--ink); }
.top-right { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-left: auto; }
.user-name { font-weight: 600; }
.busy { color: var(--accent); font-size: 12.5px; }
main { flex: 1; min-width: 0; }
.page { padding: 22px 26px 60px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.search { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; width: 180px; }
.empty-state { background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); margin-bottom: 8px; font-size: 19px; }
.empty-state .btn { margin-top: 8px; }

/* ---------- 清單表格 ---------- */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.grid th { background: #f4f6f8; text-align: left; font-weight: 600; font-size: 13px; color: #4a5663; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid #e8ecf0; vertical-align: top; font-size: 14px; }
table.grid tbody tr:hover { background: #f8fafc; }
table.grid tbody tr:last-child td { border-bottom: 0; }
.row-link { font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.row-actions { white-space: nowrap; }
.empty-row { text-align: center; color: var(--muted); padding: 28px 10px !important; }
.tabs { display: flex; gap: 4px; margin: 10px 0 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- 首頁 ---------- */
.project-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; margin-bottom: 20px; }
.project-code { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 1px; }
.project-card h2 { font-size: 20px; margin: 2px 0 12px; }
.project-facts { display: flex; flex-wrap: wrap; gap: 8px 36px; margin: 0; }
.project-facts dt { font-size: 12px; color: var(--muted); }
.project-facts dd { margin: 0; font-weight: 600; }
/* 首頁三欄：行事曆、待我簽核、最近修改（由左至右）；窄螢幕時行事曆獨占一列，再窄全部單欄 */
.page.home { max-width: none; padding-bottom: 24px; }
.home .project-card { padding: 12px 22px 14px; margin-bottom: 14px; }
.home-cols { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
/* 右兩欄不撐長頁面：高度對齊行事曆，超過的部分在欄內捲動 */
.home-cols .side { display: flex; flex-direction: column; max-height: calc(100vh - 250px); }
.home-cols .side .section-title { flex: none; }
.home-cols .side-list { overflow-y: auto; min-height: 0; padding-right: 4px; }
.home-cols.single { grid-template-columns: 1fr; }
.home-cols .side .recent-row { grid-template-columns: 1fr auto; gap: 2px 10px; }
.home-cols .side .recent-title { grid-column: 1 / -1; white-space: normal; line-height: 1.4; }
@media (max-width: 1500px) {
  .home-cols:not(.single) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .home-cols:not(.single) > section:first-child { grid-column: 1 / -1; }
}
.empty-state.slim { padding: 22px 20px; margin-bottom: 20px; }
.section-title { font-size: 14px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.group-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; }
.group-card h4 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.form-link { display: inline-block; margin: 3px 14px 3px 0; text-decoration: none; font-weight: 600; }
.form-link:hover { text-decoration: underline; }
.recent-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; margin-bottom: 6px; text-decoration: none; color: var(--ink); font-size: 13.5px; align-items: center; }
.recent-row:hover { border-color: #9aa7b4; }
.recent-type { color: var(--brand); font-weight: 600; }
.recent-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- 對話框與一般欄位表單 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 30, 40, .45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--panel); border-radius: 10px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 16px 50px rgba(0, 0, 0, .25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16.5px; }
.modal-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal-foot:empty { display: none; }
.field-form { display: grid; gap: 12px; }
.field-form.two-col { grid-template-columns: 1fr 1fr; }
.field-form .wide { grid-column: 1 / -1; }
.field-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field-form input[type=text], .field-form input[type=password], .field-form select, .field-form textarea, .field-form .roc-date input[type=text],
.field-form input.num { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; width: 100%; }
.field-form small { color: var(--muted); }
.field-form .name-input, .field-form .roc-date { width: 100%; }
.field-form .check-group { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field-form .check-group .checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.field-form .check-group label { flex-direction: row; align-items: center; gap: 5px; font-size: 14px; color: var(--ink); cursor: pointer; }

/* ---------- 輸入元件 ---------- */
input.num { text-align: right; font-variant-numeric: tabular-nums; }
.roc-date { display: inline-flex; align-items: center; position: relative; }
.roc-date input[type=text] { min-width: 0; width: 100%; padding-right: 26px; }
.roc-date .picker { position: absolute; right: 2px; width: 22px; height: 22px; border: 0; padding: 0; background: transparent; color: transparent; cursor: pointer; }
.roc-date .picker::-webkit-datetime-edit { display: none; }
.roc-date .picker::-webkit-calendar-picker-indicator { margin: 0; padding: 3px; cursor: pointer; opacity: .55; }
.roc-month { display: inline-flex; gap: 6px; }
.roc-month select { flex: 1; }
.name-input { display: inline-flex; }
.name-input input { width: 100%; min-width: 0; }
textarea.auto { resize: none; overflow: hidden; display: block; width: 100%; line-height: 1.45; }

/* ---------- 編輯外框 ---------- */
.editor-bar { position: sticky; top: 50px; z-index: 20; background: #fbfcfd; border-bottom: 1px solid var(--line); padding: 8px 20px;
  display: flex; align-items: center; gap: 12px; }
.editor-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.editor-title span { font-weight: 400; color: var(--muted); }
.save-state { font-size: 12.5px; color: var(--ok); white-space: nowrap; }
.save-state.dirty { color: var(--accent); font-weight: 600; }
.editor-actions { display: flex; gap: 6px; }
.editor-body { padding: 20px; overflow-x: auto; }

/* ---------- 紙張（表單本體） ---------- */
.paper { background: #fff; margin: 0 auto; padding: 26px 30px 34px; box-shadow: 0 2px 12px rgba(20, 40, 60, .13); border: 1px solid #cfd6dd;
  font-family: var(--form-font); font-size: 15px; color: #000; }
.paper-a4p { width: 900px; }      /* A4 直式 */
.paper-a4l { width: 1240px; }     /* A4 橫式 */
.paper-wide { width: 1480px; }
.paper h1.form-title { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 3px; margin-bottom: 4px; }
.paper h2.form-subtitle { text-align: center; font-size: 19px; font-weight: 400; letter-spacing: 2px; margin-bottom: 10px; }
.paper .form-company { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.paper .form-company-en { text-align: center; font-size: 12px; letter-spacing: 1px; margin-bottom: 6px; font-family: "Times New Roman", serif; }

/* 表單格線表格：ft = form table */
table.ft { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.ft th, table.ft td { border: 1px solid var(--paper-line); padding: 0; height: 26px; vertical-align: middle; font-weight: 400; overflow: hidden; }
table.ft th, table.ft td.label, table.ft td.c { text-align: center; }
table.ft th, table.ft td.label { padding: 2px 4px; }
table.ft td.text { padding: 2px 6px; }
table.ft td.r { text-align: right; }
table.ft td.calc { background: var(--calc); padding: 2px 6px; font-variant-numeric: tabular-nums; }
table.ft td.calc.r, table.ft td.num-cell { text-align: right; }
table.ft td.no-border, table.ft th.no-border { border: 0; }
table.ft.thick { border: 2px solid var(--paper-line); }
table.ft .thick-top td, table.ft .thick-top th { border-top: 2px solid var(--paper-line); }
/* 格內輸入欄位：填滿整格、無外框、淡藍底提示可填寫 */
.paper input[type=text], .paper input.num, .paper textarea, .paper select {
  border: 0; background: var(--field); width: 100%; padding: 3px 6px; font-family: inherit; font-size: inherit; color: #000; border-radius: 0; min-height: 26px; }
.paper input[type=text]:focus, .paper input.num:focus, .paper textarea:focus, .paper select:focus { background: var(--field-focus); outline: 1px solid #c9a227; outline-offset: -1px; }
.paper input[readonly], .paper textarea[readonly] { background: transparent; }
.paper td > input, .paper td > textarea, .paper td > select, .paper td > .roc-date, .paper td > .name-input { display: flex; width: 100%; height: 100%; }
.paper td > textarea.auto { display: block; height: auto; }
.paper .roc-date, .paper .name-input { width: 100%; }
.paper .inline { display: inline-block; width: auto; }
.paper input.center, .paper .center input { text-align: center; }
.paper label.check { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; cursor: pointer; white-space: nowrap; }
.paper label.check input { width: 15px; height: 15px; margin: 0; accent-color: #000; }
.form-meta { display: flex; justify-content: space-between; gap: 16px; margin: 6px 0; align-items: center; }
.form-sign { display: flex; justify-content: space-between; margin-top: 14px; gap: 10px; }
.form-note { font-family: var(--ui-font); font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
/* 表單下方的輔助區（非紙本內容：照片、附件、操作按鈕），改回一般介面字體 */
.aux { font-family: var(--ui-font); font-size: 14px; margin-top: 22px; padding-top: 16px; border-top: 2px dashed var(--line); color: var(--ink); }
.aux h3 { font-size: 15px; margin-bottom: 4px; }
.aux .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.row-tools { font-family: var(--ui-font); font-size: 12.5px; margin: 6px 0 0; display: flex; gap: 10px; align-items: center; color: var(--muted); }
td.row-tool { border: 0 !important; width: 26px; padding: 0 0 0 4px !important; background: #fff; }
td.row-tool button { border: 0; background: none; cursor: pointer; color: #b0b8c0; font-size: 15px; padding: 2px 4px; line-height: 1; }
td.row-tool button:hover { color: var(--danger); }

/* ---------- 照片與附件 ---------- */
.photo-grid { display: grid; gap: 12px; font-family: var(--ui-font); }
.photo-cell { border: 1px solid var(--paper-line); background: #fff; display: flex; flex-direction: column; }
.photo-img { aspect-ratio: 4 / 3; background: #f1f3f5; display: grid; place-items: center; overflow: hidden; }
.photo-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.paper .photo-caption { border-top: 1px solid var(--paper-line); text-align: center; font-family: var(--form-font); }
.photo-tools { display: flex; justify-content: center; gap: 6px; font-size: 12.5px; padding: 2px; background: #fafbfc; border-top: 1px solid #e3e7eb; }
.photo-add, .file-add { border: 2px dashed #b9c3cd; border-radius: 6px; display: grid; place-items: center; cursor: pointer; color: var(--brand);
  text-align: center; min-height: 120px; background: #fafcfe; }
.photo-add:hover, .file-add:hover { border-color: var(--brand); background: var(--brand-soft); }
.photo-add input, .file-add input { display: none; }
.photo-add small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.file-list { font-family: var(--ui-font); font-size: 14px; }
.file-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: #fff; }
.file-add { min-height: 44px; padding: 8px; }

/* ---------- 提示訊息 ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 420px; }
.toast { background: #24323f; color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); font-size: 14px; line-height: 1.45; }
.toast.error { background: var(--danger); }
.toast.warn { background: #b45309; }

.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; padding: 2px 8px; margin-right: 4px; color: var(--ink); }
.side-mask { display: none; }

/* 手機／平板：側邊選單收起來，按左上角 ☰ 展開 */
@media (max-width: 900px) {
  .app-side { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .18s; }
  .app-side.open { transform: none; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); }
  .side-mask { display: block; position: fixed; inset: 0; background: rgba(20, 30, 40, .4); z-index: 80; }
  .menu-btn { display: inline-block; }
  .app-top { padding: 0 10px; }
  .project-pick select { min-width: 0; width: 46vw; }
  .pick-label, .user-name { display: none; }
  .home-cols { grid-template-columns: 1fr; }
  .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dept-top { padding: 0 12px; }
  .dept-top .user-name { display: inline; }
  .page { padding: 16px 12px 50px; }
  .editor-bar { flex-wrap: wrap; padding: 8px 10px; }
  .editor-body { padding: 10px 6px; }
  table.grid { display: block; overflow-x: auto; }
}

/* ---------- 行事曆 ---------- */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { font-size: 17px; min-width: 100px; text-align: center; }
.cal-kinds { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 13px; }
.cal-kinds label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.cal-kinds label::before { content: ''; width: 10px; height: 10px; border-radius: 2px; background: var(--brand); }
.cal-kinds label.kind-meeting::before { background: #2a7f62; }
.cal-kinds label.kind-site::before { background: #4a90d9; border-radius: 50%; }
.cal-kinds label.kind-milestone::before { background: var(--accent); }
.cal-kinds label.kind-schedule::before { background: #7b4fa3; }
.cal-kinds label.kind-defect::before { background: #d9822b; }
.cal-kinds label.kind-action::before { background: #0e7490; }
.cal-kinds input { margin: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal-wd { text-align: center; font-size: 12.5px; color: var(--muted); padding: 5px 0; background: #f4f6f8; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-wd.weekend { color: #b42318; }
.cal-cell { min-height: 92px; padding: 4px 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px; overflow: hidden; }
.cal-cell:hover { background: #f8fafc; }
.cal-cell.weekend { background: #f7f8fa; }
.cal-cell.holiday { background: #fff3f1; }
.cal-cell.other { color: #aab3bc; background: #fbfbfc; }
.cal-cell.other .cal-chip, .cal-cell.other .cal-dot { opacity: .55; }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--brand); background: var(--brand-soft); }
.cal-daynum { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; margin-bottom: 3px; font-weight: 600; }
.cal-cell.weekend .cal-daynum > span:first-child, .cal-cell.holiday .cal-daynum > span:first-child { color: #b42318; }
.cal-cell.today .cal-daynum > span:first-child { background: var(--brand); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-grid; place-items: center; }
.cal-holi { font-size: 11px; color: #b42318; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip { border-radius: 3px; padding: 1px 5px; margin-bottom: 2px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; background: var(--brand); }
.cal-chip.cont { opacity: .75; }
.cal-chip.done { text-decoration: line-through; opacity: .6; }
.cal-chip.more { background: #e3e7eb; color: var(--muted); text-align: center; }
.cal-chip.urgent { outline: 2px solid #c0392b; outline-offset: -2px; }
.ev-all { background: #1b2b3a; }
.ev-sales { background: #2f6f8f; }
.ev-purchasing { background: #a65f1a; }
.ev-construction { background: var(--brand); }
.ev-management { background: #6b5b95; }
.k-meeting { background: #2a7f62; }
.k-milestone { background: var(--accent); }
.k-schedule { background: #7b4fa3; }
.k-defect { background: #d9822b; }
.k-action { background: #0e7490; }
.k-site { background: #4a90d9; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.cal-dot { display: inline-grid; place-items: center; min-width: 12px; height: 12px; border-radius: 6px; padding: 0 3px; font-size: 9px; color: #fff; line-height: 1; }
.cal-detail { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.cal-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-detail-head .btn { margin-left: auto; }
.cal-holi-tag { font-size: 12px; color: #b42318; background: #fff3f1; border: 1px solid #f5c6c0; border-radius: 4px; padding: 1px 6px; }
.cal-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; font-size: 13.5px; color: var(--ink); text-decoration: none; }
.cal-row.link:hover { border-color: #9aa7b4; background: #f8fafc; }
.cal-row-text { flex: 1; min-width: 0; }
.cal-row-text.done { text-decoration: line-through; color: var(--muted); }
.cal-badge { flex: none; font-size: 11.5px; color: #fff; border-radius: 3px; padding: 2px 6px; white-space: nowrap; margin-top: 1px; background: var(--brand); }
.cal .row-actions button { padding: 0 4px; }
.cal .field-form textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; width: 100%; resize: vertical; }
@media (max-width: 900px) {
  .cal-cell { min-height: 64px; padding: 3px; font-size: 11px; }
  .cal-holi { display: none; }
  .cal-chip { padding: 0 3px; }
}

/* ---------- PDF 預覽 ---------- */
.modal.preview { width: min(96vw, 1180px); height: 94vh; max-height: 94vh; }
.modal.preview .modal-head { padding: 10px 14px 10px 18px; }
.preview-actions { display: flex; align-items: center; gap: 8px; }
.preview-frame { flex: 1; width: 100%; border: 0; background: #525659; border-radius: 0 0 10px 10px; }

/* 修改紀錄 */
.history-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 14px; min-height: 320px; }
.history-list { border-right: 1px solid var(--line); padding-right: 10px; max-height: 60vh; overflow: auto; }
.history-row { display: grid; grid-template-columns: 1fr; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.history-row:hover { background: #f4f6f8; }
.history-row.on { background: #e8f0fa; }
.history-at { color: var(--muted); font-size: 12px; }
.history-act small { color: var(--muted); }
.history-detail { max-height: 60vh; overflow: auto; }
.history-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.diff-table td { font-size: 13px; word-break: break-all; }
.diff-path { color: #4a5663; white-space: nowrap; }
.diff-old { color: #a33; background: #fff4f4; }
.diff-new { color: #1b6b2a; background: #f2fbf3; }
@media (max-width: 700px) { .history-wrap { grid-template-columns: 1fr; } .history-list { border-right: 0; max-height: 30vh; } }

/* 填寫說明 */
.guide-body { max-height: 70vh; overflow: auto; line-height: 1.7; font-size: 14.5px; }
.guide-section h3 { font-size: 16px; margin: 10px 0 6px; }
.guide-section h4 { font-size: 15px; margin: 10px 0 4px; }
.guide-section p { margin: 6px 0; }
.guide-section ul, .guide-section ol { margin: 4px 0 8px 22px; }
.guide-section li { margin: 2px 0; }
.guide-section code { background: #f1f3f5; padding: 0 4px; border-radius: 3px; font-size: 13px; }
.guide-box { color: var(--brand); font-weight: 700; }
.guide-common { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.guide-common summary { cursor: pointer; color: var(--brand); font-weight: 600; }

/* 公司資訊設定頁（2026-11-04） */
.company-form { max-width: 600px; }
.company-form .req { color: var(--danger, #c0392b); margin-left: 2px; }
.company-form .form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.company-logo { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-width: 600px; }
.company-logo h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.company-logo .logo-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.company-logo .logo-box { min-width: 200px; min-height: 64px; max-width: 320px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 6px; padding: 6px; background: #fafafa; }
.company-logo .logo-box img { max-width: 300px; max-height: 110px; object-fit: contain; }
.company-logo .logo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.company-logo .logo-actions .btn { align-self: flex-start; cursor: pointer; }

/* 公司資訊：職級表 */
.level-table { margin-top: 28px; }
.level-table .levels-grid { max-width: 900px; }
.level-table .levels-grid td input { width: 100%; min-height: 26px; padding: 2px 6px; font-size: 13px; }
.level-table .levels-grid tr.mgr td:first-child { font-weight: 600; background: #f4f6f9; }
.level-table .form-actions { display: flex; gap: 10px; margin-top: 8px; }


/* ---------- 施工照片庫（A30） ---------- */
.ph-lib { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.ph-lib.pick { grid-template-columns: 180px 1fr; }
.ph-tree { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13.5px; position: sticky; top: 8px; max-height: 85vh; overflow-y: auto; }
.ph-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px; text-align: center; }
.ph-stats div { background: #f4f6f9; border-radius: 6px; padding: 6px 2px; }
.ph-stats b { display: block; font-size: 17px; }
.ph-stats span { font-size: 11.5px; color: var(--muted); line-height: 1.25; display: block; }
.ph-stats .warn b { color: #b45309; }
.ph-tree-all, .ph-tree-name, .ph-days button { border: 0; background: none; cursor: pointer; text-align: left; padding: 3px 6px; border-radius: 4px; font: inherit; color: inherit; }
.ph-tree-all { display: block; width: 100%; font-weight: 600; margin-bottom: 4px; }
.ph-tree-all.on, .ph-tree-name.on, .ph-days button.on { background: var(--brand-soft); color: var(--brand); }
.ph-tree-row { display: flex; align-items: center; }
.ph-caret { border: 0; background: none; cursor: pointer; width: 18px; color: var(--muted); padding: 0; }
.ph-tree-name small, .ph-days small, .ph-tree-all small { color: var(--muted); margin-left: 4px; }
.ph-months { margin-left: 14px; }
.ph-days { margin-left: 22px; display: flex; flex-direction: column; }
.ph-main { min-width: 0; }
.ph-toolbar { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.ph-filter { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; font-size: 13px; }
.ph-filter label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.ph-filter label > * { color: var(--text); }
.ph-filter select, .ph-filter input[type=text] { min-height: 28px; }
.ph-filter input[type=text] { width: 190px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; }
.ph-upload-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ph-grid.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ph-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; font-size: 13px; }
.ph-card.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ph-card.picked { opacity: .55; }
.ph-card-head { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: #f7f9fb; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px; color: var(--muted); }
.ph-picked { margin-left: auto; color: var(--brand); font-weight: 600; }
.ph-thumb { display: block; aspect-ratio: 4 / 3; background: #eef1f4; overflow: hidden; }
.ph-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.ph-cap b { margin-right: 6px; }
.ph-trade { color: var(--brand); font-weight: 600; }
.ph-text { min-height: 1.4em; }
.ph-meta { color: var(--muted); font-size: 11.5px; word-break: break-all; }
.ph-use { display: inline-block; margin-right: 6px; color: var(--brand); }
.ph-tools { display: flex; gap: 8px; margin-top: 4px; }
.ph-tools .btn.small, .photo-tools .btn.small, .photo-pick-add .btn.small { min-height: 30px; padding: 3px 12px; }
.photo-tools { padding: 5px; gap: 8px; }
.ph-tree-mode { display: flex; gap: 2px; margin-bottom: 8px; background: #eef1f4; border-radius: 6px; padding: 2px; }
.ph-tree-mode button { flex: 1; border: 0; background: none; font: inherit; font-size: 12.5px; padding: 4px 2px; border-radius: 4px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.ph-tree-mode button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ph-group { display: block; width: 100%; }
.ph-note { background: #fff8e6; border: 1px solid #f1d58a; color: #8a5a00; border-radius: 6px; padding: 6px 10px; font-size: 13px; margin: 0 0 10px; }
.ph-batch-toggle { margin: 6px 0 0; font-size: 13px; text-align: right; }
.ph-uploader.batch .ph-drop { border-color: #8fb4d9; background: #f3f8fd; }
.ph-pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.ph-empty { padding: 30px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }
.ph-uploader .ph-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; font-size: 13px; margin-bottom: 10px; }
.ph-uploader .ph-fields label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.ph-uploader .ph-fields label small { font-size: 11.5px; }
.ph-area-pick { display: flex; gap: 6px; align-items: center; }
.ph-area-pick select, .ph-area-pick input { flex: 1; min-width: 0; }
.ph-drop { border: 2px dashed #b9c3cd; border-radius: 8px; padding: 22px; display: block; text-align: center; cursor: pointer; color: var(--brand); background: #fff; }
.ph-drop.over, .ph-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.ph-drop input { display: none; }
.ph-drop small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.ph-pending { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ph-pending-item { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.ph-pending-item img { width: 90px; height: 68px; object-fit: cover; border-radius: 4px; background: #eef1f4; }
.ph-pending-item.done { border-color: #86c38a; background: #f3faf3; }
.ph-pending-item.error { border-color: #e39a9a; background: #fdf3f3; }
.ph-pending-item.skip { opacity: .6; }
.ph-pending-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ph-pending-name { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-pending-msg { font-size: 12px; color: var(--muted); }
.ph-pending-actions { display: flex; gap: 8px; margin-top: 4px; }
.ph-edit { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
.ph-edit img { width: 100%; border-radius: 6px; background: #eef1f4; }
.ph-edit-fields { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.ph-edit-fields label { display: flex; flex-direction: column; gap: 2px; }
.ph-edit-fields label small { color: var(--muted); font-size: 11.5px; }
.photo-pick-add { padding: 14px; gap: 6px; }
.photo-pick-add button { font-size: 14px; }
.photo-pick-add small { display: block; color: var(--muted); font-size: 11.5px; }
.photo-picker .photo-img a { display: block; width: 100%; height: 100%; display: grid; place-items: center; }
@media (max-width: 900px) {
  .ph-lib, .ph-lib.pick { grid-template-columns: 1fr; }
  .ph-tree { position: static; max-height: none; }
  .ph-edit { grid-template-columns: 1fr; }
}
.ph-actions .check-line { white-space: nowrap; }
.ph-src-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ph-src-chips button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 1px 9px; font: inherit; font-size: 12px; cursor: pointer; color: var(--muted); }
.ph-src-chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.ph-date-fixed { display: inline-block; font-weight: 600; color: var(--text); padding: 4px 0; }
.ph-pending-fields { display: grid; grid-template-columns: 130px 150px 1fr; gap: 6px; }
.ph-pending-fields.batch { grid-template-columns: 112px 130px 150px 1fr; }
.ph-pending-fields .roc-date input[type=text] { width: 100%; min-height: 28px; }
.ph-pending-fields select, .ph-pending-fields input { min-height: 28px; min-width: 0; }
@media (max-width: 700px) { .ph-pending-fields { grid-template-columns: 1fr; } .ph-pending-item { grid-template-columns: 70px 1fr auto; } }
.ph-dates-row { display: flex; align-items: center; gap: 4px; }
.ph-dates-row i { font-style: normal; color: var(--muted); }
.ph-dates-row .roc-date input[type=text] { width: 110px; }

/* 系統備份頁 */
.backup-page .danger { color: var(--danger); font-weight: 600; }
.backup-page table.kv th { width: 90px; }
.backup-page table.kv td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.backup-page section { margin-top: 18px; }
.backup-page code { background: #f4f6f8; padding: 1px 5px; border-radius: 4px; }
.status-badge.rejected { background: #fdecea; color: var(--danger); font-weight: 600; }

/* 帳號管理：登入中的裝置、登入紀錄 */
.sessions, .login-log { margin-top: 22px; }
.sessions h3 small, .login-log h3 small { font-weight: normal; font-size: 12.5px; }
.login-log .toolbar { display: flex; gap: 8px; margin: 6px 0 10px; }
.login-log .toolbar input { width: 220px; }
.login-log .danger, .sessions .danger { color: var(--danger); }
.sessions .status-badge { margin-left: 6px; }

/* 系統授權 */
.license-banner { padding: 8px 16px; font-size: 14px; text-align: center; }
.license-banner.warn { background: #fff4d6; color: #8a5a00; }
.license-banner.danger { background: #fdecea; color: var(--danger); font-weight: 600; }
.license-banner a { color: inherit; text-decoration: underline; }
.license-block { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.license-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 32px; max-width: 560px; }
.license-box h2 { margin-top: 0; color: var(--danger); }
.license-page .danger { color: var(--danger); font-weight: 600; }
.license-page table.kv th { width: 90px; }
.license-page section { margin-top: 18px; }
