:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --text: #25201b;
  --muted: #6b635b;
  --line: #e4dfd8;
  --brand: #e8601c;
  --brand-ink: #ffffff;
  --brand-soft: #fdeee4;
  --ok: #1d7a46;       --ok-bg: #e3f4ea;
  --warn: #9a5b00;     --warn-bg: #fff1d6;
  --bad: #b3261e;      --bad-bg: #fde7e5;
  --info: #1c5fa8;     --info-bg: #e3eefa;
  --off: #5f6b76;      --off-bg: #eceff2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(37, 32, 27, .06), 0 4px 14px rgba(37, 32, 27, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412; --surface: #211d1a; --surface-2: #2a2521; --text: #f1ece6; --muted: #aaa196; --line: #3a342f;
    --brand: #f07a3d; --brand-ink: #1a1007; --brand-soft: #3a2619;
    --ok: #62d08f; --ok-bg: #173324; --warn: #f2bf62; --warn-bg: #3a2c10; --bad: #ff8a80; --bad-bg: #3f1d1a;
    --info: #86b8f0; --info-bg: #172c44; --off: #a5b0ba; --off-bg: #2a2f34;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- 版面 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; min-width: 0; }
.brand-mark-img { width: 40px; height: 40px; border-radius: 10px; flex: none; display: block; object-fit: cover; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: .04em; }
.brand-sub { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.logo-chip { display: inline-block; background: #fff; border-radius: 14px; padding: 10px 16px; max-width: 100%; }
.logo-chip img { display: block; max-width: 100%; height: auto; }
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--muted); }
/* 右上角自己的名字：點了打開「我的個人資料」改顯示名稱 */
.who-btn { background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 13px; }
.who-btn:hover, .who-btn:focus-visible { border-color: var(--line, #ddd); color: var(--text, #222); }
.who-edit { opacity: .6; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 16px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tab {
  border: 0; background: none; padding: 12px 14px; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pill-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.pill-btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--text); border-color: var(--brand); }

/* ---------- 按鈕與表單 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600;
  min-height: 38px;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .tab:focus-visible, .pill-btn:focus-visible, .row:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field[hidden] { display: none; }   /* 2026-11-18 AC228：藏起來的欄位真的藏（例：業績的「原本是誰」只有選公司那一列才出現） */
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.check input { width: 18px; height: 18px; }
.picker { border: 1px solid var(--line); border-radius: 8px; max-height: 160px; overflow: auto; padding: 6px 10px; background: var(--surface); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 提示條 ---------- */
.banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-size: 14px; border: 1px solid transparent; }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner ul { margin: 0; padding-left: 18px; }

/* ---------- 總覽卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 8px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
}
.card .num { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card .label { font-size: 13px; color: var(--muted); }
.card.bad .num { color: var(--bad); }
.card.ok .num { color: var(--ok); }
.card.warn .num { color: var(--warn); }
.card.info .num { color: var(--info); }
.card.sep { border-style: dashed; }
.card .num.small { font-size: 20px; line-height: 1.5; }
.card .sub { font-size: 12px; color: var(--muted); }
.alert-bar { background: #fdecea; color: var(--bad); border: 1px solid var(--bad); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin: 0 0 8px; }
.formula { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 10px; }
.toolbar input[type=search] { max-width: 240px; }
.toolbar select, .toolbar input[type=date], .toolbar input[type=text] { width: auto; }
.section-head input[type=text] { width: 100px; }
.toolbar .check { margin: 0; }

/* ---------- 案場列表 ---------- */
.sitelist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(190px, 1.5fr) minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px 14px; padding: 12px 14px;
  border-top: 1px solid var(--line); align-items: start; cursor: pointer;
}
.row:first-child { border-top: 0; }
.sitelist.nonotif .row { grid-template-columns: minmax(0, 2.6fr) minmax(190px, 1.5fr) minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.1fr); }
.row:hover { background: var(--surface-2); }
.row.head { cursor: default; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); text-transform: none; }
.row.head:hover { background: var(--surface-2); }
.cell .k { display: none; font-size: 12px; color: var(--muted); font-weight: 600; }
.site-name { font-weight: 700; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-missing { background: var(--bad-bg); color: var(--bad); }
.b-pending { background: var(--info-bg); color: var(--info); }
.b-on_time { background: var(--ok-bg); color: var(--ok); }
.b-late { background: var(--warn-bg); color: var(--warn); }
.b-off { background: var(--off-bg); color: var(--off); }
.tag { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; background: var(--off-bg); color: var(--off); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; border-radius: 6px; padding: 1px 7px; border: 1px solid var(--line); background: var(--surface-2); }
.chip.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.chip.fail { border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.chip.sim { color: var(--info); }
.chip.cancel { color: var(--muted); text-decoration: line-through; }

/* ---------- 表格（管理頁）---------- */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; background: var(--surface-2); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
tr.inactive td { color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-error { color: var(--bad); font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.field.invalid input, .field.invalid select { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 2px solid var(--line); }
.tree > ul { border-left: 0; padding-left: 0; }
.tree li { margin: 6px 0; }
.node { display: inline-flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.node.off { opacity: .55; }

/* ---------- 對話框與抽屜 ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20, 15, 10, .5); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-body { padding: 16px 18px; max-height: min(70vh, 640px); overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.dlg-foot .dlg-left { margin-right: auto; }
/* 刪除案場的垃圾桶（AC168） */
.trash-box { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.trash-box > summary { padding: 10px 14px; font-weight: 700; cursor: pointer; }
.trash-in { padding: 0 14px 14px; }
.trash-soon { color: #B42318; font-weight: 700; }
.code-box { font: 700 26px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; background: var(--brand-soft); border-radius: 10px; padding: 16px; text-align: center; margin: 10px 0; user-select: all; }
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.hday { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; background: var(--surface-2); }
.hday b { display: block; font-size: 12px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 0 0 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.dsec { margin: 18px 0 8px; font-size: 14px; font-weight: 700; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); border-radius: 10px; padding: 10px 16px; z-index: 50; max-width: calc(100vw - 32px); }

/* ---------- 登入 ---------- */
.login { max-width: 420px; margin: 12vh auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); text-align: center; }
.login h1 { font-size: 22px; margin: 12px 0 6px; }
.login .btn { width: 100%; margin-top: 10px; }
.btn.line { background: #06c755; border-color: #06c755; color: #fff; }

details.others { margin-top: 18px; }
details.others summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
details.others .toolbar { margin: 8px 0; }
.kwbox { flex: 1 1 320px; min-height: 64px; max-width: 560px; }
.checklist { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 6px; }
.card + .card { margin-top: 14px; }

/* ---------- 依現場管理分組的標題列 ---------- */
.ghead {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 14px;
  background: var(--brand-soft); border-top: 1px solid var(--line); font-size: 14px;
}
.ghead strong { font-size: 15px; }
.ghead .btn { margin-left: auto; }
.ghead.mine { background: var(--accent-mine, #ffe2cc); border-left: 4px solid var(--brand); }
.tag.mine { background: var(--brand); color: var(--brand-ink); }
.gsum { color: var(--muted); font-size: 13px; }
.gdate { color: var(--muted); font-size: 13px; }
.gsub { color: var(--muted); font-size: 13px; }
.gnote { color: var(--muted); font-size: 12.5px; }
.sched-tag { font-weight: 600; }
.sched-tag .st-short { display: none; }
.sched-edit input[type=date] { min-width: 130px; }
.sched-tbl th:first-child, .sched-tbl td:first-child { min-width: 190px; }   /* 手機上案名欄不要被擠成一個字一行，改成可左右滑 */
.sched-edit tr.grp td { background: var(--accent-mine, #ffe2cc); padding: 8px 14px; }
.sched-edit tr.grp .gsum { margin: 0 10px; }
.sitetbl tr.grp-row td { background: var(--accent-mine, #ffe2cc); padding: 8px 14px; font-size: 14px; }
.sitetbl tr.grp-row .gsum { margin-left: 10px; color: var(--muted); font-size: 13px; }
.mgr-note { color: var(--muted); font-size: 12.5px; margin-left: 8px; }

/* ---------- 編號與負責角色 ---------- */
.serial {
  display: inline-block; min-width: 1.9em; margin-right: 8px; padding: 0 6px; text-align: center; border-radius: 6px;
  background: var(--brand-soft); color: var(--text); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.count { margin: 0 0 6px; }
.roles { display: grid; gap: 1px; font-size: 13.5px; }
.role { display: flex; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.rl { flex: none; width: 6.6em; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sitetbl td.p { display: none; }
.matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.matrix th, .matrix td { padding: 6px 4px; text-align: center; border-top: 1px solid var(--line); }
.matrix th:first-child, .matrix td:first-child { text-align: left; white-space: nowrap; }
.matrix input[type=checkbox] { width: 18px; height: 18px; }

/* ---------- 區間統計 ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sq { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid transparent; flex: none; }
.q-on_time { background: var(--ok); }
.q-late { background: var(--warn); }
.q-missing { background: var(--bad); }
.q-pending { background: var(--info); }
.q-off { background: var(--off-bg); border-color: var(--line); }
.q-na { background: transparent; border: 1px dashed var(--line); }
.rrow {
  display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) .6fr .6fr .7fr .7fr .7fr minmax(0, 2.4fr); gap: 8px 12px; padding: 12px 14px;
  border-top: 1px solid var(--line); align-items: center; cursor: pointer;
}
.rrow:hover { background: var(--surface-2); }
.rrow.head { cursor: default; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-top: 0; }
.rrow.head:hover { background: var(--surface-2); }
.cell.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.cell.num.ok { color: var(--ok); }
.cell.num.warn { color: var(--warn); }
.cell.num.bad { color: var(--bad); }
.cell.strip { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }

/* ---------- 回報紀錄與內容 ---------- */
.rlog { display: grid; gap: 14px; }
.rday { display: grid; gap: 6px; }
.rdate { font-weight: 700; font-size: 14px; }
.rmsg { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); min-width: 0; }
.rmsg.dim { background: var(--surface-2); }
.rmeta { font-size: 13px; color: var(--muted); }
.rtext { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }

/* ---------- 手機 ---------- */
@media (max-width: 900px) {
  .sched-tag .st-full { display: none; }
  .sched-tag .st-short { display: inline; }
  .rrow { grid-template-columns: repeat(5, 1fr); }
  .rrow.head { display: none; }
  .rrow .cell.name, .rrow .cell.strip, .rrow .cell:nth-child(2) { grid-column: 1 / -1; }
  /* 手機案場列：薄薄一條。第一行案名；第二行狀態、回報者、聯絡按鈕；第三行四個角色（可左右滑） */
  .row, .sitelist.nonotif .row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 12px; }
  .row.head { display: none; }
  .row .cell .k { display: none; }
  .row .cell.name { flex: 1 1 100%; }
  .row .cell:nth-child(3) { flex: none; }
  .row .cell:nth-child(4) { flex: 1 1 0; min-width: 0; font-size: 13.5px; }
  .row .cell.trk { flex: none; display: flex; align-items: center; gap: 6px; }
  .row .cell.trk .muted, .row .cell.trk .tag.ok { display: none; }
  .row .cell.trk .btn { white-space: nowrap; }
  .row .cell.wide:not(.trk) { flex: 1 1 100%; order: 6; }
  .row .cell:nth-child(2) { flex: 1 1 100%; order: 5; min-width: 0; }
  .row .roles { display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .row .roles::-webkit-scrollbar { display: none; }
  .row .role { flex: none; display: inline-flex; gap: 4px; padding: 1px 9px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
  .row .rl { width: auto; font-size: 12px; }
  .rrow .cell .k { display: block; }
  /* 設定 → 案場管理：同樣改成薄條（案名＋編輯一行、角色可左右滑一行、狀態與群組摘要一行） */
  .sitetbl, .sitetbl tbody { display: block; }
  .sitetbl thead { display: none; }
  .sitetbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
  .sitetbl tbody tr:first-child { border-top: 0; }
  .sitetbl td { display: block; border: 0; padding: 0; }
  .sitetbl td.d:not(.k) { display: none; }
  .sitetbl td.c-no { flex: none; }
  .sitetbl td.c-name { flex: 1 1 0; min-width: 0; }
  .sitetbl td.c-edit { flex: none; }
  .sitetbl td.p { display: block; flex: 1 1 100%; min-width: 0; }
  .sitetbl .roles { display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .sitetbl .roles::-webkit-scrollbar { display: none; }
  .sitetbl .role { flex: none; display: inline-flex; gap: 4px; padding: 1px 9px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
  .sitetbl .rl { width: auto; font-size: 12px; }
  .sitetbl .p-meta { color: var(--muted); white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sitetbl .p-meta::-webkit-scrollbar { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .wrap { padding: 12px; }
  .kv { grid-template-columns: 92px 1fr; }
}
@media (max-width: 520px) {
  .card .num { font-size: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .row, .pill-btn { transition: background-color .12s, filter .12s; }
}

/* 表格裡看起來像連結的按鈕（KPI 點姓名、點欄名排序） */
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; font-weight: 600; cursor: pointer; text-decoration: underline dotted; }
.linkbtn:hover { color: var(--brand); }
.section-head select { width: auto; }

.tag.tagbtn { cursor: pointer; border: 0; font-family: inherit; }
.report-text { white-space: pre-wrap; word-break: break-word; }
.section-head input[type=date] { width: auto; }

.rangepick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.rangepick .check { border: 0.5px solid var(--border-strong); border-radius: 8px; padding: 6px 12px; background: var(--surface-2); }
.rangepick .check.on { border-color: var(--border-accent); background: var(--bg-accent); color: var(--text-accent); }
.inline-date { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.inline-date input { width: auto; }
.sched-line { margin-top: 2px; }

.kpitbl tr.grp td { background: var(--accent-mine, #ffe2cc); padding: 8px 14px; }
.kpitbl tr.grp .gsum { margin-left: 10px; color: var(--text-secondary); font-size: 13px; }

/* ===== 甘特圖總表===== */
.gc-blue { background: #E6F1FB; color: #0C447C; } .gc-amber { background: #FAEEDA; color: #633806; } .gc-teal { background: #E1F5EE; color: #085041; }
.gc-coral { background: #FAECE7; color: #712B13; } .gc-purple { background: #EEEDFE; color: #3C3489; } .gc-green { background: #EAF3DE; color: #27500A; }
.gc-pink { background: #FBEAF0; color: #72243E; } .gc-gray { background: #F1EFE8; color: #444441; }
@media (prefers-color-scheme: dark) {
  .gc-blue { background: #0C447C; color: #B5D4F4; } .gc-amber { background: #633806; color: #FAC775; } .gc-teal { background: #085041; color: #9FE1CB; }
  .gc-coral { background: #712B13; color: #F5C4B3; } .gc-purple { background: #3C3489; color: #CECBF6; } .gc-green { background: #27500A; color: #C0DD97; }
  .gc-pink { background: #72243E; color: #F4C0D1; } .gc-gray { background: #444441; color: #D3D1C7; }
}
.gt-chip { display: block; border-radius: 5px; padding: 2px 5px; margin: 2px 0; font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.gt-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.gt-bar input[type=text], .gt-bar select, .gt-bar input[type=date] { width: auto; }
.gt-table { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 1100px; }
.gt-table th, .gt-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 3px 4px; vertical-align: top; }
.gt-table thead th { background: var(--surface-2); font-weight: 600; text-align: center; padding: 5px 4px; color: var(--muted); }
.gt-s1, .gt-s2, .gt-s3 { position: sticky; background: var(--surface); z-index: 2; text-align: left; }
.gt-s1 { left: 0; min-width: 250px; max-width: 250px; } .gt-s2 { left: 250px; min-width: 88px; max-width: 88px; } .gt-s3 { left: 338px; min-width: 100px; max-width: 100px; }
.gt-table thead .gt-s1, .gt-table thead .gt-s2, .gt-table thead .gt-s3 { background: var(--surface-2); }
/* 表格自己捲動（高度限制在視窗內），左右拉條才會一直貼在畫面下方看得到；日期列固定在上面 */
.gt-wrap { overflow: auto; max-height: calc(100vh - 300px); min-height: 280px; }
.gt-table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); }
.gt-table thead th.gt-s1, .gt-table thead th.gt-s2, .gt-table thead th.gt-s3 { z-index: 5; }
.gt-day { min-width: 104px; }
.gt-cell { min-width: 104px; max-width: 104px; }
.gt-cell.edit, .gt-mcell.edit { cursor: pointer; } .gt-cell.edit:hover, .gt-mcell.edit:hover { background: var(--brand-soft); }
.gt-cell.lock, .gt-mcell.lock { cursor: not-allowed; }
.we { background: #FBF3CF; } @media (prefers-color-scheme: dark) { .we { background: #4a4320; } }
.td { outline: 2px solid var(--info); outline-offset: -2px; }
/* 現場管理標題列：跟今日回報總覽的人名標題同一套（淡橘底；我的案場深一點＋橘色粗邊） */
.gt-gh { background: var(--brand-soft); border-top: 1px solid var(--line); border-left: 4px solid var(--brand-soft); padding: 0; }
.gt-mine .gt-gh { background: var(--accent-mine, #ffe2cc); border-left-color: var(--brand); }
.gt-gh-in { position: sticky; left: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 14px; width: max-content; max-width: 100vw; font-size: 14px; }
.gt-gh-in strong { font-size: 15px; }
.gt-gsum { color: var(--muted); font-size: 13px; font-weight: 400; }
.gt-link { color: var(--info); text-decoration: underline; cursor: pointer; font-weight: 400; font-size: 12px; margin-right: 8px; }
.gt-name { font-weight: 600; line-height: 1.35; } .gt-no { display: inline-block; min-width: 16px; text-align: center; border-radius: 4px; background: var(--surface-2); margin-right: 4px; font-size: 11px; font-weight: 400; }
.gt-site { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.gt-sub { font-size: 11px; color: var(--muted); line-height: 1.35; }
.gt-head { padding: 12px 14px; margin-bottom: 10px; } .gt-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.gt-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.gt-month > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; min-height: 86px; position: relative; }
.gt-month > div:nth-child(7n) { border-right: 0; }
.gt-month .gt-wd { min-height: 0; background: var(--surface-2); text-align: center; font-weight: 600; color: var(--muted); padding: 5px; font-size: 12px; }
.gt-month .out { opacity: .55; } .gt-month .sm { min-height: 76px; cursor: pointer; }
.gt-dn { font-size: 12px; color: var(--muted); margin-bottom: 2px; } .gt-hol { margin-left: 4px; font-size: 11px; color: var(--bad); }
.gt-plus { color: var(--muted); font-size: 11px; }
.gt-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.gt-wcell { border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-height: 120px; background: var(--surface); cursor: pointer; }
.gt-wc { margin-bottom: 4px; }
.gt-drow, .gt-prow { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gt-drow:last-child, .gt-prow:last-child { border-bottom: 0; }
.gt-prow .nm, .gt-drow .nm { flex: 1; min-width: 170px; line-height: 1.5; } .gt-prow .nm .gt-chip { display: inline-block; margin: 0 4px 0 0; }
.gt-prow.sub { padding-top: 0; } .gt-prow.cancelled .nm { color: var(--muted); }
.gt-time { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.gt-time select.gt-t { width: auto; min-width: 0; height: 28px; padding: 0 4px; font-size: 13px; border-radius: 6px; }
.gt-done { display: flex; gap: 10px; font-size: 13px; }
.gt-reason, .gt-evtext { flex: 1; min-width: 160px; }
.gt-leave { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 7px 10px; margin: 4px 0 6px; font-size: 13px; }
.gt-pre { white-space: pre-wrap; font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 12px; line-height: 1.6; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; }
.gt-pick { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 8px 0; }
.gt-pick-h { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 2px; }
.gt-quick { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.gt-range { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; } .gt-range input[type=date] { width: auto; }
.gt-mrow { display: flex; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.card .h { font-size: 14px; font-weight: 600; margin: 0 0 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .gt-week { grid-template-columns: 1fr; } .gt-month > div { min-height: 64px; padding: 2px; } }
.gt-prow[hidden] { display: none; }
.gt-mform { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.gt-mform .btn { margin-bottom: 12px; }
.gt-msearch { margin: 4px 0 8px; }
.gt-mrow input { width: auto; }
@media (max-width: 640px) { .gt-mform { grid-template-columns: 1fr; } }

/* ===== 甘特圖：格子下拉選單、備註、提早與延宕、驗收提示 ===== */
.gt-note { opacity: .7; margin-left: 2px; }
.gt-tri { position: absolute; right: 3px; top: 1px; color: var(--muted); font-size: 10px; pointer-events: none; }
.gt-cell, .gt-mcell { position: relative; }
.gt-cell { padding-right: 14px; }
.gt-cell.open, .gt-mcell.open { outline: 2px solid var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.gt-mbody { min-height: 28px; position: relative; padding-right: 12px; }
.gt-pop { position: fixed; z-index: 60; width: 270px; max-height: min(70vh, 460px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.gt-pop-search { width: 100%; margin-bottom: 6px; }
.gt-pop-list { max-height: 300px; overflow: auto; }
.gt-pop-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 6px; cursor: pointer; flex-wrap: wrap; }
.gt-pop-row:hover { background: var(--surface-2); }
.gt-pop-row.on { background: var(--brand-soft); }
.gt-pop-ck { width: 14px; color: var(--brand); font-weight: 700; flex: none; }
.gt-pop-name { padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.gt-pop-note { flex: 1 1 100%; margin: 2px 0 2px 20px; font-size: 12px; height: 26px; width: auto; }
.gt-pop-empty { padding: 8px; }
.gt-pop-foot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.gt-pop-hint { font-size: 11px; color: var(--muted); }
/* 工進表匯入（AC164）：未選廠商＝灰色虛線框；案名下的匯入狀態 */
.gt-chip.gt-unassigned { background: #F1F1F1; color: #555; border: 1px dashed #9A9A9A; }
.gt-imp { color: #3B6D11; }
.gt-imp.bad { color: #B42318; font-weight: 700; }
.imp-ok { color: #3B6D11; font-weight: 700; }
.imp-warn { color: #9A5B00; }
.imp-chip { display: inline-block; max-width: none; }
.imp-acc { margin-top: 6px; background: var(--surface); }
.imp-pick { margin-bottom: 12px; background: #F3F8EE; border-color: #CFE3BF; }
.imp-pick .hint:empty { display: none; }
/* 複製貼上：清單上方兩個按鈕、格子右鍵選單 */
.gt-pop-cp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.gt-pop-cp .gt-pop-hint { flex: 1 1 100%; }
.gt-menu { position: fixed; z-index: 70; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); }
.gt-menu-it { display: flex; width: 100%; justify-content: space-between; gap: 12px; background: none; border: 0; border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; }
.gt-menu-it:hover:not(:disabled) { background: var(--bg, #f4f1ec); }
.gt-menu-it:disabled { color: var(--muted); cursor: default; }
.gt-menu-k { color: var(--muted); font-size: 11px; }
.gt-menu-why { font-size: 11px; color: var(--muted); padding: 2px 10px 6px; }
.gt-next { font-size: 11px; color: var(--muted); margin-top: 2px; }
.gt-next.soon { color: var(--warn); font-weight: 600; }
.gt-next.today { color: var(--bad); font-weight: 700; }
.gt-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; gap: 14px; align-items: center; background: #25201b; color: #fff; border-radius: 12px; padding: 10px 16px; max-width: 90vw; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.gt-toast-btn { background: none; border: 0; color: #ffd9b8; text-decoration: underline; font-weight: 700; cursor: pointer; }
.gt-opt { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; cursor: pointer; }
.gt-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.gt-ms { border-bottom: 1px solid var(--line); padding: 6px 0; }
.gt-ms:last-child { border-bottom: 0; }
.gt-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.gt-seg span { padding: 3px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.gt-seg span.on { background: var(--brand); color: var(--brand-ink); }
.gt-err { color: var(--bad); font-size: 12px; }
.gt-mform.two { grid-template-columns: 1fr auto auto; }
.gt-mrow input[type=text] { width: auto; }
.accept-soon { color: var(--warn); font-weight: 600; }
.accept-today { color: var(--bad); font-weight: 700; }
.row-inline { display: flex; gap: 8px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.row-inline input[type=date] { width: auto; }
.acc-n { display: inline-block; min-width: 96px; font-weight: 600; }

/* 工項的階段（丈量｜安裝） */
.gt-pills { display: flex; gap: 6px; margin: 2px 0 4px 20px; flex-wrap: wrap; }
.gt-pill { border: 1px solid var(--line); border-radius: 6px; padding: 1px 10px; font-size: 12px; cursor: pointer; background: var(--surface-2); }
.gt-pill.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.gt-pill.lock { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.gt-pop-row.static { cursor: default; } .gt-pop-row.static:hover { background: none; }
.gt-pop-phased { border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.gt-pop-phasenote { display: flex; gap: 6px; align-items: center; margin: 0 0 2px 20px; }
.gt-pop-phasenote .gt-pop-note { margin: 0; flex: 1; }
.gt-mbox { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.gt-tn { min-width: 84px; }
.gt-mform.phase { grid-template-columns: 1fr 1.6fr auto auto; }
@media (max-width: 640px) { .gt-mform.phase { grid-template-columns: 1fr; } }

/* 甘特圖總表用寬版（左右空間用滿）、人員分類標題 */
.wrap.wide { max-width: none; padding-left: 20px; padding-right: 20px; }
.gt-table { width: 100%; }
.ghead.dept { background: var(--brand-soft); border-left: 4px solid var(--brand); }
.gt-dept td { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: 0; }

/* 手機：固定欄太寬會把整個畫面佔滿，日期欄永遠看不到（左右滑看起來沒反應）。只固定案名欄、縮窄，業務與主管欄跟著捲走 */
@media (max-width: 760px) {
  .gt-s1 { min-width: 150px; max-width: 150px; }
  .gt-s2, .gt-s3 { position: static; }
  /* 表頭：日期列固定在表格上方（往下看別人的案場，還是看得到日期）；只有案名欄左右固定，業務／設計、責任主管欄跟著捲走（不然會卡在畫面中間蓋住日期）。
     表格自己上下捲，日期列才貼得住；高度留一點空間，往上滑（表格外）還是可以捲回頁面上方 */
  .gt-wrap { max-height: 78vh; max-height: 78dvh; min-height: 0; -webkit-overflow-scrolling: touch; }
  .gt-table thead th { position: sticky; top: 0; z-index: 3; }
  .gt-table thead th.gt-s1 { left: 0; z-index: 5; }
  .gt-table thead th.gt-s2, .gt-table thead th.gt-s3 { left: auto; }
  .gt-name { font-size: 12px; }
  .gt-cell { min-width: 96px; max-width: 96px; }
}
/* 下拉選單裡「這格已排」：每項前面一個 ✕ */
.gt-pop-sel { display: flex; align-items: center; gap: 8px; padding: 3px 10px; }
.gt-x { border: 1px solid var(--line); background: var(--surface); color: var(--bad, #c0392b); border-radius: 6px; width: 24px; height: 24px; line-height: 1; cursor: pointer; font-size: 13px; padding: 0; }
.gt-x:hover { background: #fdecea; border-color: var(--bad, #c0392b); }
/* 提早／延宕視窗：白話舉例 */
.gt-eg { background: var(--brand-soft); border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.6; margin: 8px 0; }
/* 工班資料庫：工項標題用該工項的顏色 */
.gt-mtag { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; }
/* 總覽資訊列：標題旁邊，固定兩行高，放不下就在裡面捲動（表格不會跳動） */
.gt-info { flex: 1 1 320px; min-width: 0; height: 54px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 4px 10px; font-size: 13px; line-height: 1.6; }
.gt-info-h { color: var(--muted); font-size: 12px; }
.gt-info-b { display: flex; flex-wrap: wrap; gap: 2px 6px; }
.gt-info .gt-chip { white-space: normal; max-width: none; overflow: visible; text-overflow: clip; }
@media (max-width: 760px) { .gt-info { display: none; } }
/* 手機：下拉選單貼在畫面下方，選項放大好點（電腦版不變） */
@media (max-width: 760px) {
  .gt-pop.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 58vh; border-radius: 14px 14px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); z-index: 70; }
  .gt-pop.sheet .gt-pop-list { max-height: calc(58vh - 150px); -webkit-overflow-scrolling: touch; }
  .gt-pop.sheet .gt-pop-row { padding: 9px 6px; }
  .gt-pop.sheet .gt-pop-name { font-size: 14px; padding: 3px 8px; }
  .gt-pop.sheet .gt-pill { padding: 6px 14px; font-size: 14px; }
  .gt-pop.sheet .gt-x { width: 34px; height: 34px; }
  .gt-pop.sheet .gt-pop-search, .gt-pop.sheet .gt-pop-note { font-size: 16px; }   /* 16px 以上，iPhone 點進去才不會自動放大畫面 */
}
.gt-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.gt-pop-head .btn { min-width: 84px; padding: 9px 16px; font-size: 15px; }
/* 標題列：線上人員（滑鼠移到頭像看名字與正在看的分頁） */
.presence { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.pr-av { display: flex; align-items: center; }
.pr-a { position: relative; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; border: 2px solid var(--surface); margin-left: -6px; cursor: default; }
.pr-a:first-child { margin-left: 0; }
.pr-a i { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: #2ea44f; border: 2px solid var(--surface); }
.pr-a.c1 { background: #E6F1FB; color: #0C447C; } .pr-a.c2 { background: #EAF3DE; color: #27500A; } .pr-a.c3 { background: #FAEEDA; color: #633806; } .pr-a.c4 { background: #FCEBEB; color: #791F1F; }
.pr-tip { display: none; position: absolute; top: 34px; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 400; white-space: nowrap; color: var(--text); z-index: 30; line-height: 1.5; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.pr-a:hover .pr-tip, .pr-a:focus .pr-tip { display: block; }
.pr-more { margin-left: 6px; }
@media (max-width: 760px) { .pr-count { display: none; } }
/* 驗收：舊案場提示、案名下面可點的驗收文字、下拉選單裡鎖定（灰色）的驗收 */
.gt-unset { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
.gt-acc { cursor: pointer; border-radius: 6px; }
.gt-acc:hover { background: var(--brand-soft); }
.gt-pop-row.dis { opacity: .5; cursor: not-allowed; }
.gt-pop-row.dis:hover { background: none; }
.gt-pop-why { font-size: 11px; color: var(--muted); }
.gt-x.lock { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface-2); cursor: default; font-size: 12px; }
/* 批次輸入驗收 */
.ab-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.ab-d { display: flex; flex-direction: column; gap: 2px; }
.ab-d input { width: 150px; }
.gt-pop-head .btn { min-width: 0; }
.gt-pop:not(.sheet) .gt-pop-head { margin-bottom: 6px; }
.gt-pop:not(.sheet) .gt-pop-head .btn { padding: 4px 14px; font-size: 13px; }
dialog p { white-space: pre-line; }
/* 各工地總表追蹤進度頁的小頁籤：業主驗收&內驗｜每項進度追蹤&退群依據。字不折行，手機上一排放不下就左右滑 */
.viewsw { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; }
.viewsw::-webkit-scrollbar { display: none; }
.viewsw button { flex: none; white-space: nowrap; border: 0; background: var(--surface); padding: 7px 16px; font-size: 14px; cursor: pointer; color: var(--text); }
.viewsw button + button { border-left: 1px solid var(--line); }
.viewsw button.on { background: var(--brand); color: #fff; font-weight: 700; }
.acc-filters select { width: auto; }
tr.acc-today td { background: #fdecea; }
.acc-tbl th, .acc-tbl td { white-space: nowrap; }
.acc-td { text-align: center; }
.acc-td.clickable { cursor: pointer; }
.acc-td.clickable:hover { background: var(--brand-soft); }
.acc-c { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.acc-c.fut { background: #E6F1FB; color: #0C447C; }
.acc-c.tdy { background: #FAEEDA; color: #633806; font-weight: 700; }
.acc-c.pend { background: var(--surface-2); color: #3B6D11; border: 1px dashed #97C459; }
.acc-c.hint { background: #FAC775; color: #633806; }
.acc-c.done { background: #3B6D11; color: #fff; font-weight: 700; }
.acc-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.acc-pend { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.acc-q { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.acc-q > div:first-child { flex: 1 1 100%; }
.acc-q.hint { border-color: #EF9F27; background: #FFF8EC; }
.acc-msg { flex: 1 1 auto; font-size: 13px; }
@media (prefers-color-scheme: dark) { tr.acc-today td { background: #4a1f1f; } .acc-q.hint { background: #3a2a10; } }

.acc-tbl td.acc-addr, .sched-tbl td.acc-addr { white-space: normal; min-width: 220px; max-width: 360px; }
/* 合約展延紀錄 */
.ext-cell.ext-stack { flex-direction: column; align-items: flex-start; gap: 4px; white-space: normal; }   /* 展延過：列出每一次，再展延在下面（2026-11-03） */
.ext-list { font-size: 12px; line-height: 1.5; }
.ext-stack { min-width: 330px; }
.sched-tbl td > .ext-list { min-width: 300px; }
.ext-li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 2px 0; }
.ext-li + .ext-li { border-top: 1px dashed var(--line); }
.ext-li .tag { font-size: 11px; padding: 0 6px; margin: 0; }
.ext-cell { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; white-space: nowrap; }   /* 展延欄排一行（AC123） */
.ext-cell .tag { font-size: 11.5px; padding: 0 6px; }
.ext-hist { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 6px 0 10px; background: var(--surface-2); }
.ext-row { padding: 4px 0; font-size: 13px; line-height: 1.6; }
.ext-row + .ext-row { border-top: 1px dashed var(--line); }
.ext-row .tag { margin-left: 6px; }
/* 施工結案／結案移去歷史案件 */
.gt-finish { float: right; margin: 0 0 4px 6px; font-size: 11px; padding: 2px 8px; color: var(--bad, #c0392b); border-color: #e7b1aa; }
.acc-close { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
tr.acc-finished td { background: #FFF8EC; }
@media (prefers-color-scheme: dark) { tr.acc-finished td { background: #3a2a10; } }
@media (max-width: 760px) { .gt-finish { float: none; display: block; margin: 0 0 3px; font-size: 10px; padding: 1px 6px; } }
.ro-box { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; color: var(--muted); background: var(--surface-2); }
/* 提早／延宕視窗：之前／之後的小甘特圖 */
.rp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 6px; }
.rp-tbl { border-collapse: collapse; font-size: 11px; min-width: 100%; }
.rp-tbl th, .rp-tbl td { border: 1px solid var(--line); padding: 3px; vertical-align: top; min-width: 74px; }
.rp-tbl thead th { background: var(--surface-2); font-weight: 600; text-align: center; }
.rp-tbl th.rp-side { min-width: 40px; background: var(--surface-2); white-space: nowrap; }
.rp-tbl .we { background: #FDF6DD; }
.rp-tbl .gt-chip { display: block; margin: 1px 0; white-space: normal; }
.rp-new { outline: 2px solid #1D9E75; outline-offset: -1px; }
.rp-mv { outline: 2px solid #EF9F27; outline-offset: -1px; }
.rp-del { text-decoration: line-through; opacity: .55; }
.rp-legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; margin-bottom: 6px; }
@media (prefers-color-scheme: dark) { .rp-tbl .we { background: #3a3420; } }
/* 近 30 天回報：月曆排法（一到日七欄，舊的在上、新的在下） */
.history.cal { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.hwd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.hday.blank { border: none; background: none; }
.hday.today { outline: 2px solid var(--brand); }
@media (max-width: 760px) { .history.cal { gap: 4px; } .history.cal .hday { padding: 4px 3px; font-size: 10px; } .history.cal .badge { font-size: 10px; padding: 1px 4px; } }
/* 追蹤表：案名欄固定在左邊（不透明、有分隔線），標題兩排固定，欄位往右滑 */
.acc-tbl { border-collapse: separate; border-spacing: 0; }
.acc-tbl th, .acc-tbl td { white-space: nowrap; }
.acc-tbl thead th { position: sticky; top: 0; z-index: 6; background: var(--surface-2); text-align: center; }
.acc-tbl thead tr:nth-child(2) th { top: 31px; }
.acc-tbl thead th.acc-h:first-child, .acc-tbl tbody td.acc-addr { position: sticky; left: 0; z-index: 4; background: var(--surface); box-shadow: 1px 0 0 var(--line), 4px 0 6px -4px rgba(0, 0, 0, .25); white-space: normal; min-width: 190px; max-width: 260px; }
.acc-tbl thead th.acc-h:first-child { z-index: 8; }
.acc-tbl tbody tr.acc-finished td.acc-addr { background: #FFF8EC; }
.acc-tbl tbody tr.gt-grp td, .acc-tbl tbody tr.gt-mine td { position: static; }
/* 表頭顏色＝誰負責：橘＝行政、青＝會計、紫＝行銷（上下兩排同色） */
.acc-tbl .o-admin, .acc-owner.o-admin { background: #FBEAD0; color: #633806; }
.acc-tbl .o-acct, .acc-owner.o-acct { background: #DDF1E9; color: #085041; }
.acc-tbl .o-mkt, .acc-owner.o-mkt { background: #E6E0F4; color: #3C3489; }
.acc-owner { display: inline-block; padding: 2px 10px; border-radius: 4px; font-weight: 600; font-size: 12px; }
.acc-tbl .trk { min-width: 70px; text-align: center; font-size: 12px; }
.acc-tbl .trk-todo { color: var(--muted); }
.acc-tbl .trk-na { color: var(--muted); }
.acc-tbl .trk-done { color: #3B6D11; font-weight: 600; }
.acc-tbl .trk.clickable:hover { background: var(--brand-soft); }
@media (prefers-color-scheme: dark) { .acc-tbl tbody tr.acc-finished td.acc-addr { background: #3a2a10; } }
/* 追蹤表：撐滿整個視窗寬度；表格自己在視窗高度內上下左右捲，左右捲軸一直貼在畫面下方 */
.acc-wide { width: calc(100vw - 32px); margin-left: calc(50% - 50vw + 16px); }
.acc-wide .acc-q > div:first-child { flex: 1 1 520px; }
.acc-wide .acc-q .acc-msg { flex: 1 1 300px; }
.acc-wide .acc-q .btn { margin-left: auto; }
.acc-wrap { max-height: calc(100vh - 150px); overflow: auto; }
@media (max-width: 760px) { .acc-wide { width: auto; margin-left: 0; } .acc-wrap { max-height: calc(100vh - 120px); } }

/* 操作稽核：最下面「再載入 200 筆」 */
.more-row { text-align: center; margin: 12px 0; }
/* 業主驗收&內驗：群組驗收紀錄欄（有文字＝綠、沒有文字紀錄＝紅），這一欄可以換行 */
.rec-ok { color: var(--ok); }
.rec-none { color: var(--bad); font-weight: 700; }
.acc-list td.rec { white-space: normal; min-width: 200px; max-width: 340px; }
.acc-list td:last-child { white-space: nowrap; }
/* 每項進度追蹤：兩大區標題（橘黃＝已結案・待歸檔、綠＝施工中案場），跟淡橘的現場管理分組區分 */
.acc-sec .gt-gh { background: #F6D58E; border-left: 6px solid #C77D0A; }
.acc-sec.live .gt-gh { background: #D6EBC6; border-left-color: #3B6D11; }
.acc-sec .gt-gh-in strong { font-size: 15.5px; }
@media (prefers-color-scheme: dark) { .acc-sec .gt-gh { background: #5a4310; } .acc-sec.live .gt-gh { background: #24401a; } }
/* 待歸檔那一列：「10/21 結案」＋兩個小按鈕排一行、不折字 */
.fin-mini { display: flex; flex-wrap: nowrap; align-items: center; gap: 5px; margin-top: 4px; white-space: nowrap; }
.fin-mini .tag { font-size: 11.5px; padding: 0 6px; }
.fin-mini .btn { padding: 1px 8px; font-size: 12px; line-height: 1.6; }
/* 淡淡的格線（分區、分組標題那一整條不加） */
.acc-tbl.grid tbody td:not(.gt-gh), .acc-tbl.grid thead th { border: 1px solid #E7E1D8; }
@media (prefers-color-scheme: dark) { .acc-tbl.grid tbody td:not(.gt-gh), .acc-tbl.grid thead th { border-color: #3a3631; } }
/* 「場數」欄（2026-10-22，AC122）：最左邊、跟案場欄一起固定；標題下面寫目前列出的總場數 */
.gt-total { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.gt-s0 { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 40px; max-width: 40px; text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.gt-table thead th.gt-s0 { z-index: 5; background: var(--surface-2); }
.gt-s1 { left: 40px; } .gt-s2 { left: 290px; } .gt-s3 { left: 378px; }
@media (max-width: 760px) {
  .gt-s0 { min-width: 34px; max-width: 34px; }
  .gt-s1, .gt-table thead th.gt-s1 { left: 34px; }
  .gt-table thead th.gt-s2, .gt-table thead th.gt-s3 { left: auto; }
}
.acc-tbl th.acc-no, .acc-tbl td.acc-no { position: sticky; left: 0; z-index: 4; min-width: 40px; max-width: 40px; width: 40px; text-align: center; font-weight: 700; color: var(--muted); background: var(--surface); }
.acc-tbl thead th.acc-no { z-index: 6; background: var(--surface-2); }
.acc-tbl thead th.acc-h.acc-site, .acc-tbl tbody td.acc-addr { position: sticky; left: 40px; z-index: 4; background: var(--surface); box-shadow: 1px 0 0 var(--line), 4px 0 6px -4px rgba(0, 0, 0, .25); white-space: normal; min-width: 190px; max-width: 260px; }
.acc-tbl thead th.acc-h.acc-site { z-index: 6; background: var(--surface-2); }
.acc-tbl tbody tr.acc-finished td.acc-no { background: #FFF8EC; }
@media (prefers-color-scheme: dark) { .acc-tbl tbody tr.acc-finished td.acc-no { background: #3a2a10; } }/* 罐頭文：頁籤紅色數字、追蹤表格子、確認視窗 */
.viewsw .vsw-n { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: #D93025; color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.acc-tbl .trk-can { min-width: 84px; white-space: nowrap; }
.cn { font-size: 12px; }
.cn.sent { color: #3B6D11; font-weight: 600; }
.cn.today { color: #C77D0A; font-weight: 700; }
.cn.overdue { color: #D93025; font-weight: 700; }
.cn.future { color: #185FA5; }
.cn.unsent { color: #C77D0A; }
.cn.none, .cn.na { color: var(--muted); }
.cn-lines { display: flex; flex-direction: column; gap: 1px; text-align: left; }
.cn-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cn-row-a { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 6px; }
.cn-btns { display: flex; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
/* 機器人判斷規則視窗 */
.ar-sec { margin: 0 0 14px; }
.ar-sec h4 { font-size: 14px; margin: 0 0 2px; }
.ar-sec p { margin: 0 0 6px; }
.ar-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ar-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--brand-soft); font-size: 13px; }
.ar-chip.no { background: #FCEBEB; color: #791F1F; }
.ar-chip button { border: 0; background: transparent; cursor: pointer; color: inherit; font-size: 15px; line-height: 20px; padding: 0 6px; }
.ar-add { display: inline-flex; gap: 4px; }
.ar-add input { width: 110px; padding: 3px 8px; font-size: 13px; }
.ar-test { border-top: 1px solid var(--line); padding-top: 12px; }
.ar-res { margin-top: 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.ar-res.ok { background: #EAF3DE; color: #27500A; }
.ar-res.no { background: #FAEEDA; color: #633806; }
.ar-ex a { margin-right: 12px; }
.ar-item { margin: 0; border-top: 1px solid var(--line); padding: 8px 0; }
.ar-head { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 4px 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.ar-head strong { font-size: 14px; }
.ar-arrow { width: 14px; color: var(--muted); }
.ar-body { padding: 4px 0 4px 22px; }
.ar-tpl { width: 100%; box-sizing: border-box; font-size: 13px; resize: vertical; }
.ar-throw { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.ar-th { width: 180px; max-width: 50vw; }
@media (prefers-color-scheme: dark) { .ar-chip.no { background: #4a1f1f; color: #F7C1C1; } .ar-res.ok { background: #24401a; color: #C0DD97; } .ar-res.no { background: #4a3410; color: #FAC775; } }
/* 罐頭文：舊案轉入（啟用前、轉入前、舊案待核對） */
.cn.skipped { color: var(--muted); }
.cn.legacy { color: #854F0B; background: #FAEEDA; padding: 1px 6px; border-radius: 6px; }
.cn-setup { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cn-setup .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (prefers-color-scheme: dark) { .cn.legacy { background: #4a3410; color: #FAC775; } }
/* 罐頭文規則視窗 */
.cr-trial { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cr-trial h4 { margin: 0 0 2px; font-size: 14px; }
.cr-trial select { margin: 4px 0 8px; }
.cr-col { padding: 10px 0; border-top: 1px solid var(--line); }
.cr-head { margin-bottom: 6px; }
.cr-fields { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-start; }
.cr-field { min-width: 180px; }
.cr-flabel { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.cr-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.cr .banner { margin: 6px 0; }
/* 罐頭文：機器人看到 */
.cn-wrap { display: inline-flex; flex-direction: column; gap: 2px; align-items: center; }
.cn-bot { font-size: 11px; color: #27500A; background: #EAF3DE; padding: 0 6px; border-radius: 999px; }
.cn-hint { margin: 4px 0 6px; padding: 6px 10px; border-radius: 8px; background: #FAEEDA; color: #633806; font-size: 13px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
tr.cn-seen td { background: #FFF8EC; }
.acc-list td.rec { white-space: normal; min-width: 220px; max-width: 360px; }
@media (prefers-color-scheme: dark) { .cn-bot { background: #24401a; color: #C0DD97; } .cn-hint { background: #4a3410; color: #FAC775; } tr.cn-seen td { background: #3a2a10; } }
/* 罐頭文規則：發文日設定（下拉選單） */
.cr-defhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cr-def.off { opacity: .6; }
.cr-rule { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.cr-rule .cr-fields { gap: 8px 14px; align-items: flex-start; }
.cr-rule select { max-width: 340px; }
.cr-new { margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cr-trial-out { margin-top: 6px; }
.cr-trial-out .banner { display: block; }
.cn.wait { color: #854F0B; background: #FAEEDA; padding: 1px 6px; border-radius: 6px; }
@media (prefers-color-scheme: dark) { .cn.wait { background: #4a3410; color: #FAC775; } }
/* 罐頭文機器人：範本與相似度 */
.cd-group { margin: 6px 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.cd-glabel { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.cd-tpl { margin-top: 8px; }
.cd-tpl-row { display: flex; gap: 6px; align-items: flex-start; margin: 4px 0; }
.cd-scores { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.cd-score { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cd-name { width: 140px; flex: none; }
.cd-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; max-width: 260px; }
.cd-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #B4B2A9; }
.cd-bar i.pass { background: #3B6D11; }
/* 每日行程表（我的行程、全公司個人行程） */
.bd-notebox { margin-top: 8px; }
.bd-note { width: 100%; font-size: 13px; }
.bd-sendday { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.tag.bd-ok { background: #EAF3DE; color: #27500A; }
.tag.bd-up { background: #FAEEDA; color: #633806; }
.tag.bd-no { background: #FCEBEB; color: #791F1F; }
.bd-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.bd-bad { color: var(--bad); }
.bd-dept { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.bd-dh { padding: 7px 12px; font-weight: 700; font-size: 14px; }
.bd-d1 .bd-dh { background: #FAECE7; color: #712B13; }
.bd-d2 .bd-dh { background: #E1F5EE; color: #085041; }
.bd-d3 .bd-dh { background: #EEEDFE; color: #3C3489; }
.bd-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.bd-card { padding: 8px 10px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin: 0 0 -1px -1px; min-height: 110px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.bd-card.me { background: #FFF8EC; }
.bd-name { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }
.bd-text { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 12.5px; line-height: 1.55; margin: 2px 0; background: transparent; padding: 0; }
.bd-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 4px; }
.bd-btns .btn { padding: 2px 8px; font-size: 12px; }
.bd-edit { width: 100%; font-size: 12.5px; }
.bd-post { border-top: 1px solid var(--line); padding: 8px 0; }
.bd-card .bd-post { border-top: 0; padding: 0; display: flex; flex-direction: column; flex: 1; }
.bd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bd-settings summary { cursor: pointer; }
@media (max-width: 760px) { .bd-cols { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) { .bd-card.me { background: #3a2a10; } }
/* 我的行程：每列工班後面的補充說明小框 */
.gt-prow .gt-remark { flex: 1 1 180px; min-width: 160px; max-width: 420px; height: 30px; font-size: 13px; padding: 2px 8px; }

/* 罐頭文格子視窗：狀況一句話、為什麼／群組紀錄、範本、按鈕 */
.cn-status { padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; margin: 4px 0 6px; }
.cn-status.bad { background: #FCEBEB; color: #A32D2D; } .cn-status.warn { background: #FAEEDA; color: #854F0B; } .cn-status.ok { background: #EAF3DE; color: #3B6D11; }
.cn-status.info { background: #E6F1FB; color: #185FA5; } .cn-status.muted { background: var(--surface-2); color: var(--muted); }
.cn-kv { display: grid; grid-template-columns: 72px 1fr; gap: 4px 10px; margin: 6px 0; font-size: 14px; }
.cn-kv dt { color: var(--muted); } .cn-kv dd { margin: 0; }
.cn-tpl { margin: 6px 0; } .cn-tpl-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.cn-tpl-b { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; max-height: 160px; overflow: auto; }
.cn-pick { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 6px; }
.cn-pick[hidden] { display: none; }
@media (prefers-color-scheme: dark) { .cn-status.bad { background: #501313; color: #F7C1C1; } .cn-status.warn { background: #412402; color: #FAC775; } .cn-status.ok { background: #173404; color: #C0DD97; } .cn-status.info { background: #042C53; color: #B5D4F4; } }

/* 追蹤表直接打字的格子：寬 140，按 Enter 換行、打幾行格子就長多高（最少 56）；右下角小圓圈＝最後打的人 */
.acc-tbl td.trk-txt { padding: 0; min-width: 140px; width: 140px; vertical-align: top; text-align: left; white-space: normal; }
.acc-tbl .trk-box { position: relative; min-height: 56px; }
.acc-tbl .trk-mirror { font-size: 12px; line-height: 1.45; padding: 6px 7px 20px; white-space: pre-wrap; word-break: break-all; min-height: 56px; box-sizing: border-box; }
.acc-tbl .trk-box .trk-mirror:not(.trk-text) { visibility: hidden; }
.acc-tbl .trk-in { position: absolute; left: 0; top: 0; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; background: transparent; resize: none; overflow: hidden;
  font: inherit; font-size: 12px; line-height: 1.45; padding: 6px 7px 20px; color: var(--text); box-sizing: border-box; white-space: pre-wrap; word-break: break-all; }
.acc-tbl td.trk-txt:hover { background: var(--brand-soft); }
.acc-tbl td.trk-txt.editing .trk-in { background: var(--surface); box-shadow: inset 0 0 0 2px #378ADD; outline: none; }
.trk-who { position: absolute; right: 4px; bottom: 4px; width: 17px; height: 17px; border-radius: 50%; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; pointer-events: auto; cursor: default; }
.acc-tbl td.trk-txt.editing .trk-who { display: none; }

/* 每日行程的複製預覽：可以直接改字；改過時顯示「你改過了」「還原成系統產生的」，並藏起「只複製今日＋明日」（改過就只送改過的那份） */
textarea.gt-pre-edit { display: block; width: 100%; min-height: 160px; resize: vertical; overflow: hidden; line-height: 1.6; box-sizing: border-box; border: 1px solid var(--line); color: var(--text); }
.card .gt-edit-flag { display: none; }
.card.gt-edited .gt-edit-flag { display: inline-flex; }
.card.gt-edited p.gt-edit-flag { display: block; }
.card.gt-edited .gt-edit-tip, .card.gt-edited .bd-short { display: none; }
/* 追蹤表的合約金額、總期數：顯示案場資料，點了開案場編輯視窗 */
.acc-tbl td.trk-site { min-width: 90px; text-align: center; font-weight: 600; }

/* 甘特圖免回報選項：免回報中的日子淡灰色斜線；下拉選單的免回報選項區標題黃色 */
.gt-cell.gt-exempt, .gt-mcell.gt-exempt { background-image: repeating-linear-gradient(135deg, rgba(120, 120, 120, .14) 0 4px, transparent 4px 9px); }
.gt-pick-h.gt-pick-ex { background: #FAEEDA; color: #854F0B; }
@media (prefers-color-scheme: dark) { .gt-pick-h.gt-pick-ex { background: #412402; color: #FAC775; } }
.ex-nudge { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.ex-nudge .tag { white-space: normal; }

/* 當天回報內容、人工補登 */
.tag.manual { background: #E6F1FB; color: #185FA5; }
.tag-link { border: 0; cursor: pointer; font: inherit; }
.tag-link:hover { text-decoration: underline; }
.history.cal .hday.pick { cursor: pointer; }
.history.cal .hday.pick:hover { outline: 2px solid var(--brand); }
.dayrep .rmsg { margin-top: 8px; }
.manual-box { border-left: 3px solid #378ADD; padding-left: 10px; border-radius: 0; }
.miss-list .ml-row { display: grid; grid-template-columns: 110px 1fr 90px 16px; gap: 10px; align-items: center; padding: 9px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.miss-list .ml-row.head { cursor: default; color: var(--muted); font-size: 13px; border-top: 0; }
.miss-list .ml-row:not(.head):hover { background: var(--brand-soft); }
@media (prefers-color-scheme: dark) { .tag.manual { background: #042C53; color: #B5D4F4; } }
@media (max-width: 600px) { .miss-list .ml-row { grid-template-columns: 78px 1fr 62px 8px; gap: 6px; font-size: 13px; } }
/* 追蹤表公司內驗那一格下面的內驗人 */
.acc-tbl .acc-inspector { font-size: 12px; color: var(--muted); margin-top: 3px; }
/* 同仁管理：離職移除按鈕、沒綁案場的群組清單 */
.btn.leave-btn { color: #A32D2D; border-color: #F09595; }
.banner.unbound summary { cursor: pointer; }
.banner.unbound .row-inline { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 4px 0; border-top: 1px solid rgba(0,0,0,.06); }
/* 今日回報總覽的數字可以點：列出哪幾個案場 */
.cards .card-link { cursor: pointer; }
.cards .card-link:hover { outline: 2px solid var(--brand); }
.miss-list .ml-row.st-row { grid-template-columns: minmax(0, 1.4fr) 90px minmax(0, 1.2fr) 16px; }
@media (max-width: 600px) { .miss-list .ml-row.st-row { grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr) 8px; } }

/* 功能授權分組、權限總覽、依權限設定（2026-10-31） */
.fg-item { align-items: flex-start; }
.fg-item input { flex: none; margin-top: 2px; }
.fg-item .tag { margin-left: auto; white-space: nowrap; }
.people-views { margin: 4px 0 12px; }
.fg-overview td, .fg-overview th { white-space: normal; min-width: 70px; }
.fp { display: grid; grid-template-columns: 230px 1fr; gap: 12px; align-items: start; }
.fp-left, .fp-right { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 8px; }
.fp-group { font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 6px 4px; }
.fp-f { display: flex; justify-content: space-between; gap: 8px; width: 100%; border: 0; border-radius: 6px; background: transparent; padding: 6px 8px; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.fp-f:hover { background: var(--off-bg); }
.fp-f[aria-pressed="true"] { background: var(--brand-soft); font-weight: 700; }
.fp-right h3 { margin: 2px 4px 8px; }
.fp-tool { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 4px 8px; }
.fp-tool input { flex: 1; min-width: 120px; }
.fp-dhead { display: flex; align-items: center; gap: 8px; margin: 10px 4px 2px; font-size: 13px; font-weight: 700; color: var(--muted); }
.fp-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; }
.fp-row:hover { background: var(--off-bg); }
.fp-row.off { opacity: .55; }
.fp-row.changed { background: var(--warn-bg); }
.fp-row .tag { margin-left: auto; white-space: nowrap; }
.fp-dhead input, .fp-row input { width: 18px; height: 18px; flex: none; }
.fp-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 8px; padding: 8px 4px 2px; }
.fp-chg { flex: 1; min-width: 160px; }
@media (max-width: 700px) {
  .fp { grid-template-columns: 1fr; }
  .fp-left { display: flex; flex-wrap: wrap; gap: 4px; }
  .fp-left > div { display: contents; }
  .fp-group { align-self: center; margin: 0 2px 0 8px; }
  .fp-f { padding: 4px 8px; font-size: 13px; }
  .fp-f { width: auto; border: 1px solid var(--line); }
}

/* 行銷四格下拉選項、總工作天數（2026-11-03） */
.acc-tbl td.trk-ok .trk-mirror, .acc-tbl td.trk-ok .trk-in { color: var(--ok); font-weight: 600; }
.acc-tbl td.trk-bad .trk-mirror, .acc-tbl td.trk-bad .trk-in { color: var(--bad); }
.acc-tbl .trk-pick { position: absolute; right: 2px; top: 2px; z-index: 2; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1; padding: 0; cursor: pointer; }
.acc-tbl .trk-pick:hover { color: var(--text); border-color: var(--brand); }
.acc-tbl td.trk-txt.editing .trk-pick { display: none; }
.trk-menu { position: absolute; z-index: 50; min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.trk-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; padding: 7px 8px; border-radius: 5px; cursor: pointer; }
.trk-menu button:hover { background: var(--brand-soft); }
.trk-menu .muted { padding: 4px 8px 2px; }
.acc-tbl td.trk-days { text-align: center; vertical-align: middle; min-width: 80px; }
.trk-days-n { font-weight: 700; color: var(--info); text-decoration: underline; }
.wd-row { display: grid; grid-template-columns: 110px 56px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.trk-miss { margin: 6px 0; padding-left: 20px; }
.hist-forced { display: inline-block; margin-top: 4px; cursor: pointer; border: 0; font: inherit; font-size: 12px; white-space: nowrap; }
.hist-forced-list { columns: 2; margin: 4px 0 8px; padding-left: 1.4em; }
@media (max-width: 520px) { .wd-row { grid-template-columns: 84px 48px 1fr; } }
.hist-tbl thead th.acc-h.acc-site, .hist-tbl tbody td.acc-addr { left: 0; }   /* 歷史案件沒有「場數」欄，案名貼齊最左邊 */

/* 罐頭文、驗收格右下角「誰按的」小圓圈（2026-11-03） */
.acc-tbl td.has-who { position: relative; padding-bottom: 22px; }
.cn-who { display: block; position: relative; min-height: 34px; padding-bottom: 18px; }
.cn-who > .trk-who { right: 0; bottom: 0; }
.cn-lines .cn .trk-who { position: static; display: inline-flex; vertical-align: middle; margin-left: 4px; width: 15px; height: 15px; font-size: 9px; }

/* 追蹤表格子像 Excel：點一下選取（藍框、不顯示游標），點兩下才編輯（2026-11-03） */
.acc-tbl td.trk-txt.sel { box-shadow: inset 0 0 0 2px #378ADD; }
.acc-tbl td.trk-txt.sel .trk-in { caret-color: transparent; cursor: cell; outline: none; }

.gt-cell.gt-sel, .gt-mcell.gt-sel { outline: 2px solid #378ADD; outline-offset: -2px; }   /* 選取框：方向鍵移動（2026-11-03） */

/* 「驗收待行政確認 N 筆」點開的清單（2026-11-04） */
button.acc-wait { border: 1px solid var(--warn); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
button.acc-wait:hover { filter: brightness(.95); }
.pw-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.pw-item:last-child { border-bottom: 0; }
.pw-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pw-today { color: var(--warn); } .pw-late { color: var(--bad); } .pw-hint { color: var(--warn); }
@keyframes accFlash { 0%, 100% { box-shadow: inset 0 0 0 3px #378ADD; } 50% { box-shadow: inset 0 0 0 3px #378ADD; background: #dbe8fb; } }
.acc-tbl td.acc-flash { animation: accFlash 0.7s ease 3; }
@media (max-width: 520px) { .pw-item { grid-template-columns: 1fr; } .pw-btns { justify-content: flex-start; } }

/* 行程提早規劃率（2026-11-04）：綠＝17:00 前完成、紫＝送出後改、黃＝17:00 後送出、紅＝未傳行程、灰＝不計算 */
.pk-early { --pk-bg: #EAF3DE; --pk-fg: #27500A; }
.pk-changed { --pk-bg: #EEEDFE; --pk-fg: #3C3489; }
.pk-late { --pk-bg: #FAEEDA; --pk-fg: #633806; }
.pk-missing { --pk-bg: #FCEBEB; --pk-fg: #791F1F; }
.pk-excluded { --pk-bg: #F1EFE8; --pk-fg: #444441; }
@media (prefers-color-scheme: dark) {
  .pk-early { --pk-bg: #173404; --pk-fg: #C0DD97; } .pk-changed { --pk-bg: #26215C; --pk-fg: #CECBF6; }
  .pk-late { --pk-bg: #412402; --pk-fg: #FAC775; } .pk-missing { --pk-bg: #501313; --pk-fg: #F7C1C1; } .pk-excluded { --pk-bg: #2C2C2A; --pk-fg: #D3D1C7; }
}
.pk-chip { display: inline-block; background: var(--pk-bg); color: var(--pk-fg); border: 0; border-radius: 6px; padding: 2px 9px; font: inherit; font-size: 13px; }
button.pk-chip { cursor: pointer; } button.pk-chip:hover { filter: brightness(.96); }
.tag.pk-tag { background: var(--pk-bg); color: var(--pk-fg); }
.pk-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.bd-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 6px; }
.bd-chiplist { flex-basis: 100%; }
.bd-chiplist:empty { display: none; }
.pk-tbl td, .pk-tbl th { text-align: center; }
.pk-tbl td:nth-child(-n+2), .pk-tbl th:nth-child(-n+2), .pk-tbl tr.grp td { text-align: left; }
.pk-num { font-weight: 600; color: var(--pk-fg, var(--text)); }
.pk-months { display: flex; flex-wrap: wrap; gap: 16px; margin: 8px 0; }
.pk-month { flex: 1 1 300px; max-width: 420px; }
.pk-mh { font-weight: 600; margin-bottom: 4px; }
.pk-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.pk-wh { text-align: center; font-size: 12px; color: var(--muted); }
.pk-c { min-height: 46px; border-radius: 6px; padding: 3px 2px; display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; border: 0; background: var(--pk-bg, transparent); color: var(--pk-fg, var(--text)); }
button.pk-c { cursor: pointer; } button.pk-c:hover { outline: 2px solid #378ADD; }
.pk-c.pk-off { color: var(--muted); }
.pk-c.pk-focus { outline: 2px solid var(--pk-fg); }
.pk-d { font-size: 13px; font-weight: 600; }
.pk-t { font-size: 11px; line-height: 1.2; text-align: center; white-space: pre-line; overflow-wrap: anywhere; }
.pk-day { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 6px; }
.pk-text { max-height: 260px; overflow: auto; }
.pk-fix { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 6px; }
.pk-err { color: var(--bad); min-height: 1em; }

.pk-mk { font-size: 10px; line-height: 1.2; border: 1px solid currentColor; border-radius: 4px; padding: 0 3px; }   /* 月曆格子：補登、今天 */
.pk-rank { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.pk-form { display: grid; gap: 6px; }
.pk-form input[type=date], .pk-form input[type=time] { width: auto; }

/* 同仁 KPI 排行榜（2026-11-05）：前三名整列淡底色＋左側色條＋獎牌；比上週 ▲▼；上週冠軍 */
.kpitbl tr.rk-top1 td { background: #FFF7DB; } .kpitbl tr.rk-top1 td:first-child { box-shadow: inset 4px 0 0 #D9A514; }
.kpitbl tr.rk-top2 td { background: #F0F4F8; } .kpitbl tr.rk-top2 td:first-child { box-shadow: inset 4px 0 0 #94A3B8; }
.kpitbl tr.rk-top3 td { background: #FFF0E5; } .kpitbl tr.rk-top3 td:first-child { box-shadow: inset 4px 0 0 #C77D45; }
@media (prefers-color-scheme: dark) {
  .kpitbl tr.rk-top1 td { background: #3a3010; } .kpitbl tr.rk-top2 td { background: #2a313a; } .kpitbl tr.rk-top3 td { background: #3a2616; }
}
.kpitbl tr.rk-top .rk-rate { font-size: 1.2em; }
.kpitbl tr.rk-top1 .rk-rate { color: #9a7400; } .kpitbl tr.rk-top3 .rk-rate { color: #9a4f1c; }
.rk-name { display: flex; align-items: center; gap: 8px; }
.rk-medal { font-size: 22px; line-height: 1; }
.rk-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 5px; font-size: 12px; color: #fff; vertical-align: 1px; }
.rk-t1 { background: #D9A514; } .rk-t2 { background: #94A3B8; } .rk-t3 { background: #C77D45; }
.rk-up { color: var(--ok); } .rk-down { color: var(--bad); }
.rk-sub { display: block; font-size: 11px; }
.rk-champ { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 10px; }
.rk-champ-in { background: #FFF7DB; color: #5a4300; box-shadow: inset 4px 0 0 #D9A514; border-radius: 8px; padding: 6px 12px; }
@media (prefers-color-scheme: dark) { .rk-champ-in { background: #3a3010; color: #FAC775; } }
.rk-hist td, .rk-hist th { text-align: left; }
.rk-hist tr.rk-now td { background: var(--surface-2); }
.kpitbl .rk-name { min-width: 150px; }   /* 手機：姓名欄不要被擠成一字一行（表格本來就可以左右滑） */
.rk-name .linkbtn, .rk-tag, .kpitbl .pk-rank { white-space: nowrap; }
.rk-sep { margin: 0 6px; color: var(--muted); }
.kp-mode { margin-bottom: 8px; }   /* 本週排名（預設）／歷史排名：選到的橘色（.viewsw .on） */
.kp-week strong { font-size: 15px; }

/* 採購行事曆（AC186，public/purchase.js） */
.pc-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pc-wd { font-size: 12px; color: var(--muted); text-align: center; padding: 2px; }
.pc-day { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 92px; padding: 4px; font-size: 11.5px; min-width: 0; }
.pc-day.we { background: #FBF3D6; }
.pc-day.out { opacity: .45; }
.pc-day.td { outline: 2px solid #2563EB; }
.pc-dn { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.pc-po { display: block; border-radius: 5px; padding: 2px 5px; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-wait { background: #FFF4D6; color: #7A5200; border: 1px solid #F0D58A; }
.pc-late { background: #FCE4E1; color: #B42318; font-weight: 700; border: 1px solid #F3B5AD; }
.pc-done { background: #E3F2DA; color: #2E5A10; }
.pc-ask { background: #EDE4FB; color: #4B2C8A; font-weight: 700; border: 1px dashed #8B6BD1; }
.pc-dot { display: inline-block; width: 14px; height: 10px; margin: 0 4px 0 0; padding: 0; vertical-align: middle; }
.pc-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; margin: 6px 0 10px; }
.pc-lk { color: var(--text); text-decoration: underline; text-decoration-color: #b9b2a8; text-underline-offset: 3px; cursor: pointer; }   /* 2026-11-06 使用者：藍色不舒服，改黑字＋淡灰底線 */
.pc-lk:hover { text-decoration-color: currentColor; }
.pc-po .pc-lk { color: inherit; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.pc-chips button { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; background: var(--surface); cursor: pointer; }
.pc-chips button.on { background: #0B5CAD; color: #fff; border-color: #0B5CAD; }
.pc-sec { font-weight: 700; margin: 14px 0 6px; padding: 6px 10px; border-radius: 8px; }
.pc-sec.s-late { background: #FCE4E1; color: #B42318; }
.pc-sec.s-today { background: #FFF4D6; color: #7A5200; }
.pc-sec.s-ask { background: #EDE4FB; color: #4B2C8A; }
.pc-sec.s-next { background: #EEF4FF; color: #0C447C; }
.pc-sec.s-miss { background: #F1EFEA; color: #555; }
.pc-none { padding: 2px 10px; }
.pc-prev { font-size: 11.5px; color: #4B2C8A; background: #F6F1FF; border-radius: 6px; padding: 3px 6px; margin-top: 4px; }
.pc-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pc-tag-ask { background: #EDE4FB; color: #4B2C8A; }
.pc-num { width: 70px; }
.pc-add { margin: 10px 0; }
.pc-addrow { gap: 8px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 760px) { .pc-day { min-height: 70px; font-size: 10.5px; } .pc-po { white-space: normal; } }
/* 未傳行程但格子有別人填的文字（AC187） */
.pk-byother { color: #9A5B00; background: #FFF4D6; border-radius: 6px; padding: 4px 8px; margin: 6px 0; }

/* 採購：接下來要下單的篩選（2026-11-06） */
.pc-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 2px 0 8px; }
.pc-range { margin: 0; }
.pc-range button.on { background: var(--brand); border-color: var(--brand); }
.pc-custom { display: inline-flex; align-items: center; gap: 4px; }
.pc-date { width: auto; }
.pc-vsel { width: auto; max-width: 100%; }

/* 採購：已詢問待數量確認、已同步甘特圖提醒（2026-11-06） */
.pc-qty { background: #E1F5EE; color: #085041; font-weight: 700; border: 1px dashed #1D9E75; }
.pc-sec.s-qty { background: #E1F5EE; color: #085041; }
.tag.pc-tag-qty { background: #E1F5EE; color: #085041; }
.pc-sync { font-size: 12px; color: #2E5A10; }
.pc-reply { font-size: 12px; color: #185FA5; }
.pc-overdue { font-size: 12px; color: var(--bad); font-weight: 600; }
/* 甘特圖：進料日需更改 */
.gt-mat-ask { display: inline-block; background: #FCEBEB; color: #A32D2D; border: 1px solid #F09595; border-radius: 6px; font-size: 11px; padding: 0 6px; margin-right: 4px; cursor: pointer; font: inherit; font-size: 11px; }
.gt-cell.gt-mat-cell, .gt-mcell.gt-mat-cell { outline: 2px dashed #E24B4A; outline-offset: -3px; }
.gt-mat-banner { margin-top: 6px; }

/* 採購：工地進料總表（2026-11-06） */
.pc-matrix th, .pc-matrix td { vertical-align: top; text-align: center; font-size: 12px; }
.pc-matrix th.pc-site, .pc-matrix td.pc-site { text-align: left; min-width: 200px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.pc-matrix th { white-space: nowrap; }
.pc-mcell { min-width: 92px; }
.pc-c { display: block; width: 100%; margin: 2px 0; padding: 3px 4px; border-radius: 6px; font: inherit; font-size: 11px; line-height: 1.3; cursor: pointer; white-space: nowrap; }
.pc-none-c { color: var(--muted); }
.cn-sentmsg { margin-top: 6px; }   /* 罐頭文已傳：傳出的文字（2026-11-06） */
.cn-sentmsg .cn-tpl-b { white-space: pre-wrap; }

/* 工地進料總表：格線、分組、小色塊（2026-11-06，使用者要像模擬圖那樣有格線、乾淨） */
.pc-matrix { border-collapse: collapse; width: 100%; font-size: 12px; }
.pc-matrix th, .pc-matrix td { border: 1px solid var(--line); padding: 4px 6px; }
.pc-matrix thead th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; }
.pc-matrix tr.pc-grp td { background: #fde4cf; color: #4a2a10; text-align: left; font-size: 13px; position: sticky; left: 0; }
@media (prefers-color-scheme: dark) { .pc-matrix tr.pc-grp td { background: #4a2e18; color: #f5d7bd; } }
.pc-matrix td.pc-site .pc-lk { font-weight: 600; }
.pc-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.pc-matrix .pc-c { border: 0; border-radius: 4px; padding: 1px 4px; margin: 2px 0; font-size: 11px; font-weight: 400; }
.pc-matrix .pc-c.pc-late, .pc-matrix .pc-c.pc-ask, .pc-matrix .pc-c.pc-qty { font-weight: 600; }

/* 採購清單排版（2026-11-06，使用者：按鈕、狀態被擠成直的）：按鈕一行靠右、字不拆開；窄的時候整顆按鈕換行 */
.pc-tbl td.pc-act { width: 1%; }
.pc-tbl .pc-btns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: max-content; }
@media (max-width: 760px) { .pc-tbl .pc-btns { min-width: 0; } }
.pc-tbl .btn, .pc-tbl .tag, .pc-tbl td.pc-st, .pc-tbl td.pc-vend .pc-lk { white-space: nowrap; }
.pc-tbl td.pc-vend { min-width: 7em; }
.pc-matrix td.pc-mcell { cursor: pointer; }
.pc-matrix td.pc-mcell.pc-sel { outline: 2px solid #378ADD; outline-offset: -2px; }   /* 工地進料總表選取框（2026-11-06） */
/* 採購的清單視窗（點案場、點廠商、點格子）：加寬；按鈕排不下就整顆換行，不要被切掉（2026-11-06，使用者回報畫面卡到） */
dialog.wide:has(.pc-tbl) { width: min(1000px, calc(100vw - 24px)); }
dialog .pc-tbl .pc-btns { min-width: 0; }
dialog .pc-tbl td.pc-act { width: 22em; }   /* 視窗夠寬時三個按鈕一行；不夠寬才整顆換行 */

/* ---------- 工班案量（AC202，2026-11-09） ---------- */
.cl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.cl-head h2 { margin: 0; font-size: 22px; }
.cl-bar { display: inline-block; width: 5px; height: 26px; background: var(--brand); }
.cl-bar.sm { width: 4px; height: 18px; }
.cl-ctl { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.cl-f { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cl-f select { min-width: 9em; width: auto; }
.cl-ctl label.cl-f { flex-direction: row; margin: 0; }
.cl-f input[type="date"] { width: 10.5em; flex: none; padding-top: 6px; padding-bottom: 6px; }   /* 期間的日期格不用撐滿一整行（2026-11-09） */
.cl-month { min-width: 6.5em; text-align: center; }
.cl-view { margin: 0 0 0 auto; }
.btn.cl-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.cl-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.cl-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 0 12px 12px 0; padding: 10px 14px; box-shadow: var(--shadow); }
.cl-ico { font-size: 22px; background: var(--brand-soft); border-radius: 10px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; flex: none; }
.cl-num { font-size: 26px; font-weight: 700; color: var(--brand); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cl-num small { font-size: 14px; margin-left: 4px; font-weight: 600; }
.cl-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.cl-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cl-dh { background: var(--surface-2); text-align: center; padding: 7px 0; font-weight: 700; }
.cl-d { background: var(--surface); min-height: 84px; padding: 5px 6px; cursor: pointer; font-size: 12.5px; min-width: 0; }
.cl-d:hover { background: var(--surface-2); }
.cl-d.cl-off { background: var(--cl-off); }
.cl-d.cl-out { background: var(--surface-2); cursor: default; }
.cl-d.cl-sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cl-dn { font-weight: 700; }
.cl-d.cl-today .cl-dn { color: var(--brand); }
.cl-chip { display: flex; justify-content: space-between; gap: 4px; border-radius: 6px; padding: 1px 6px; margin-top: 3px; white-space: nowrap; font-size: 12px; }
.cl-chip b { font-weight: 700; }
.cl-cn { overflow: hidden; text-overflow: ellipsis; }
.cl-cnt { display: inline-flex; float: right; margin-top: -18px; }
.cl-site { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.cl-chip.c0, .cl-strip .c0 { background: var(--surface-2); color: var(--muted); }
.cl-chip.c1, .cl-strip .c1, .cl-sw.c1 { background: var(--ok-bg); color: var(--ok); }
.cl-chip.c2, .cl-strip .c2, .cl-sw.c2 { background: var(--warn-bg); color: var(--warn); }
.cl-chip.c3, .cl-strip .c3, .cl-sw.c3 { background: var(--bad-bg); color: var(--bad); }
.cl-strip .c1 { background: var(--ok); opacity: .55; }
.cl-strip .c2 { background: #e5a42b; }
.cl-strip .c3 { background: var(--bad); }
.cl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 2px 0; }
.cl-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }
.cl-offsw { background: var(--cl-off); }
.cl-side { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.cl-side-h { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.cl-tot { margin: 0 0 0 auto; font-size: 12px; font-weight: 400; }
.cl-crew { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.cl-crew-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.cl-crew-top .cl-chip { margin: 0; }
.cl-st { display: flex; flex-direction: column; align-items: flex-start; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 5px; }
.cl-st-n::before { content: '⌂ '; color: var(--brand); }
.cl-go { width: 100%; margin-top: 12px; border: 1.5px solid var(--brand); color: var(--brand); font-weight: 700; }
.cl-tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.cl-tbl th, .cl-tbl td { border: 1px solid var(--line); padding: 7px 8px; text-align: center; }
.cl-tbl th { background: var(--surface-2); white-space: nowrap; }
.cl-tbl td.cl-l { text-align: left; white-space: nowrap; }
.cl-tbl td:last-child { min-width: 260px; width: 45%; }
.cl-row { cursor: pointer; }
.cl-row:hover td { background: var(--surface-2); }
.cl-more td { text-align: left; background: var(--surface-2); font-size: 13px; line-height: 1.8; }
.cl-strip { display: flex; gap: 1px; }
.cl-strip span { flex: 1; height: 16px; border-radius: 2px; min-width: 3px; }
:root { --cl-off: #fbf5ec; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cl-off: #26211c; } }
:root[data-theme="dark"] { --cl-off: #26211c; }
@media (max-width: 1000px) { .cl-wrap { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .cl-cards { gap: 6px; }
  .cl-card { padding: 6px 8px; gap: 0; }
  .cl-ico { display: none; }
  .cl-num { font-size: 18px; }
  .cl-num small { font-size: 12px; }
  .cl-view { margin-left: 0; }
  .cl-d { min-height: 58px; padding: 3px; font-size: 11px; }
  .cl-cn { display: none; }
  .cl-chip { justify-content: center; padding: 0 3px; }
  .cl-site { display: none; }
  .cl-cnt { float: none; margin-top: 2px; }
}

/* 承接總表（AC203） */
.cl-tk-tbl { width: 100%; border-collapse: collapse; background: var(--surface); table-layout: fixed; }
.cl-tk-tbl th, .cl-tk-tbl td { border: 1px solid var(--line); padding: 5px 8px; vertical-align: middle; }
.cl-tk-tbl th { background: var(--surface-2); text-align: left; white-space: nowrap; }
.cl-tk-c1 { width: 150px; }
.cl-tk-c2 { width: 60px; }
.cl-tk-g td { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.cl-tk-name { font-weight: 700; }
.cl-tk-n { text-align: center; font-size: 20px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.cl-tk-cell { display: flex; gap: 6px; align-items: flex-start; }
.cl-chips { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); grid-auto-rows: 36px; gap: 4px; max-height: 76px; overflow: hidden; }
.cl-chips.open { max-height: none; }
.cl-tk { display: block; text-align: left; font: inherit; font-size: 11.5px; line-height: 1.3; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--off); border-radius: 0 6px 6px 0; padding: 2px 6px; overflow: hidden; cursor: pointer; min-width: 0; }
.cl-tk b, .cl-tk span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-tk b { font-size: 12.5px; }
.cl-tk span { color: var(--muted); }
.cl-tk:hover { border-color: var(--brand); }
.cl-tk-now { border-left-color: var(--brand); background: var(--brand-soft); }
.cl-tk-next { border-left-color: var(--ok); }
.cl-tk-gap { border-left-color: var(--off); }
.cl-tk-done { border-left-color: var(--line); }
.cl-tk-done b { color: var(--muted); }
.cl-sw.cl-tk-now { background: var(--brand); } .cl-sw.cl-tk-next { background: var(--ok); } .cl-sw.cl-tk-gap { background: var(--off); } .cl-sw.cl-tk-done { background: var(--line); }
.cl-more-btn { flex: none; color: var(--brand); border-color: var(--brand); white-space: nowrap; }
@media (max-width: 640px) { .cl-tk-c1 { width: 92px; } .cl-tk-c2 { width: 44px; } .cl-tk-cell { flex-direction: column; } .cl-chips { width: 100%; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); } }

/* 工班案量：可點的數字卡、展開區、日曆每家色塊列出案場（2026-11-09） */
.cl-card-click { cursor: pointer; }
.cl-card-click:hover, .cl-card.on { box-shadow: 0 0 0 2px var(--brand) inset, var(--shadow); }
.cl-card-body { min-width: 0; }
.cl-free-sum { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 18px; }
.cl-free-sum b { font-size: 24px; }
.cl-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: -2px 0 12px; }
.cl-panel-h { font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.cl-sc-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-sc { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--surface-2); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.cl-sc:hover { border-color: var(--brand); }
.cl-sc span { color: var(--muted); font-size: 12px; }
.cl-free-row { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; border-top: 1px dashed var(--line); }
.cl-free-row:first-of-type { border-top: 0; }
.cl-free-row > b { min-width: 110px; }
.cl-fd { background: var(--ok-bg); color: var(--ok); border: 0; border-radius: 6px; padding: 2px 7px; margin: 2px 4px 2px 0; cursor: pointer; font: inherit; font-size: 12.5px; }
.cl-fd:hover { outline: 1px solid var(--ok); }
.cl-cb { border-radius: 6px; padding: 2px 6px 3px; margin-top: 3px; font-size: 12px; min-width: 0; }
.cl-cb.c1 { background: var(--ok-bg); color: var(--ok); }
.cl-cb.c2 { background: var(--warn-bg); color: var(--warn); }
.cl-cb.c3 { background: var(--bad-bg); color: var(--bad); }
.cl-cb-h { display: flex; justify-content: space-between; gap: 4px; font-weight: 700; white-space: nowrap; }
.cl-cb-s { color: var(--text); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }
.cl-cb-s::before { content: '• '; color: var(--muted); }
.cl-cb-more { color: var(--muted); font-size: 11px; padding-left: 2px; }
@media (max-width: 760px) {
  .cl-cb-s, .cl-cb-more { display: none; }
  .cl-free-sum { font-size: 13px; } .cl-free-sum b { font-size: 16px; }
}
/* 工班案量日曆（2026-11-09）：週六日欄窄一點；今天以前的格子蓋淡斜線＝不用看 */
.cl-cal { grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .55fr)); }
.cl-d.cl-past { background-image: repeating-linear-gradient(135deg, rgba(120, 110, 100, .13) 0 1.5px, transparent 1.5px 9px); }
.cl-d.cl-past > *:not(.cl-dn) { opacity: .55; }
.cl-sw.cl-pastsw { background-image: repeating-linear-gradient(135deg, rgba(120, 110, 100, .35) 0 1.5px, transparent 1.5px 5px); background-color: var(--surface); border: 1px solid var(--line); }
.cl-gap { margin-left: 10px; }
@media (max-width: 760px) { .cl-cal { grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .7fr)); } }
/* 行銷行事曆（AC207） */
.mk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.mk-bar select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-height: 34px; }
.mk-month { font-size: 18px; min-width: 120px; text-align: center; font-variant-numeric: tabular-nums; }
.mk-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mk-h { padding: 6px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mk-d { min-height: 104px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mk-d:nth-child(7n) { border-right: 0; }
.mk-d.wk { background: var(--cl-off, var(--surface-2)); }
.mk-d.out .mk-dn { opacity: .45; }
.mk-dn { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.mk-d.today .mk-dn span { background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 0 7px; }
.mk-ev { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 0 6px 6px 0; background: var(--surface); padding: 2px 5px; font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-ev:hover { border-color: var(--brand); }
.mk-ev.late { background: var(--bad-bg); }
.mk-ev.done { border-left-color: var(--ok); background: var(--ok-bg); }
.mk-ev.oth { border-left-color: var(--off); background: var(--surface-2); color: var(--muted); }
.mk-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.mk-sw { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 0 3px 3px 0; vertical-align: -2px; margin-right: 4px; }
.mk-sw.late { background: var(--bad-bg); } .mk-sw.done { border-left-color: var(--ok); background: var(--ok-bg); } .mk-sw.oth { border-left-color: var(--off); background: var(--surface-2); }
.mk-stock { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-top: 8px; }
.mk-stock-list, .mk-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.mk-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--surface); font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.mk-chip:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.mk-chip.all { border-color: var(--brand); color: var(--brand); }
.mk-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 13px; }
.mk-x:hover { color: var(--bad); }
.mk-chips input[type=text] { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0; width: 190px; max-width: 100%; }
.mk-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.mk-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.mk-type { background: var(--brand-soft); color: var(--brand); }
.mk-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; margin-bottom: 10px; }
.mk-facts > div { display: grid; gap: 1px; min-width: 0; }
.mk-facts > div > span:first-child { font-size: 12px; color: var(--muted); font-weight: 600; }
.mk-prog { display: flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.mk-bar-o { flex: 1; height: 7px; background: var(--off-bg); border-radius: 999px; overflow: hidden; min-width: 60px; }
.mk-bar-o i { display: block; height: 100%; background: var(--info); }
.mk-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.mk-move { background: var(--surface-2); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.mk-err { color: var(--bad); font-size: 13px; }
.mk-tasks { width: 100%; border-collapse: collapse; font-size: 14px; }
.mk-tasks th, .mk-tasks td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
.mk-tasks th { background: var(--surface-2); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mk-tasks tr.off td, .mk-tasks tr.done td:nth-child(2) { color: var(--muted); }
.mk-tasks input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.mk-tasks select { padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.mk-tasks select.mk-other { color: var(--brand); border-color: var(--brand); }
.mk-late { color: var(--bad); font-weight: 700; } .mk-soon { color: var(--warn); font-weight: 700; }
.mk-choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.mk-choose button { display: grid; gap: 4px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.mk-choose button:hover { border-color: var(--brand); background: var(--brand-soft); }
.mk-set { padding: 14px 16px; margin-bottom: 14px; }
.mk-set h3 { font-size: 16px; margin-bottom: 8px; }
.mk-set-h { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.btn.mk-on { background: var(--brand-soft); border-color: var(--brand); }
.mk-days { width: 64px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.mk-ops { white-space: nowrap; text-align: right; }
.mk-ops .btn { margin-left: 4px; }
.mk-add { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.mk-add input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
@media (max-width: 640px) {
  .mk-d { min-height: 60px; padding: 2px; }
  .mk-ev { font-size: 11px; padding: 1px 3px; }
  .mk-ops .btn { padding: 3px 6px; }
}
/* 行銷行事曆 AC208：清單、行銷進度儀表板（版面照原型「影片製作進度」）、主管審核 */
.mk-badge { display: inline-block; margin-left: 5px; background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 0 6px; font-size: 11px; line-height: 1.6; }
.mk-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mk-seg button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.mk-seg button.on { background: var(--brand); color: var(--brand-ink); }
.mk-pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mk-s0 { background: var(--off-bg); color: var(--off); } .mk-s1 { background: var(--info-bg); color: var(--info); }
.mk-s2 { background: var(--ok-bg); color: var(--ok); } .mk-s3 { background: var(--bad-bg); color: var(--bad); }
.mk-t1 { background: var(--brand-soft); color: var(--brand); } .mk-t2 { background: var(--info-bg); color: var(--info); }
.mk-bar-o i.full { background: var(--ok); }
.mk-list { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
.mk-list th, .mk-list td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
.mk-list th { background: var(--surface-2); font-size: 13px; color: var(--muted); white-space: nowrap; }
.mk-list .mk-prog { min-width: 130px; }
.mk-click { cursor: pointer; } .mk-click:hover td { background: var(--surface-2); }
.mk-list tr.today td { background: var(--brand-soft); }
.mk-head-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.mk-head-row h2 { font-size: 20px; }
.mk-sec { margin-bottom: 18px; }
.mk-sec-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.mk-sec-h h3 { font-size: 17px; }
.mk-mxw { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.mk-mx { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.mk-mx th, .mk-mx td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 4px 6px; text-align: center; white-space: nowrap; }
.mk-mx thead th { background: var(--surface-2); font-weight: 700; }
.mk-mx .l { text-align: left; }
.mk-mx .stk { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.mk-mx thead .stk { background: var(--surface-2); z-index: 2; }
.mk-mx tr.hl td, .mk-mx tr.hl td.stk { background: var(--brand-soft); }
.mk-mx td.cell { padding: 2px; min-width: 56px; }
.mk-mx .mk-prog { min-width: 110px; }
.mk-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; text-align: left; }
.mk-name:hover { color: var(--brand); text-decoration: underline; }
.mk-c { width: 100%; min-height: 40px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; display: grid; place-items: center; line-height: 1.15; padding: 2px; font: inherit; color: var(--text); }
.mk-c:hover { border-color: var(--brand); }
.mk-c .ic { font-size: 15px; font-weight: 900; min-height: 1em; }
.mk-c .dd { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mk-c.st-sent { background: var(--warn-bg); } .mk-c.st-sent .ic { color: var(--warn); }
.mk-c.st-ok { background: var(--ok-bg); } .mk-c.st-ok .ic, .mk-c.st-ok .dd { color: var(--ok); }
.mk-c.st-back { background: var(--bad-bg); } .mk-c.st-back .ic { color: var(--bad); }
.mk-c.st-skip .ic { color: var(--muted); }
.mk-c.late { box-shadow: inset 0 0 0 2px var(--bad); } .mk-c.late .dd { color: var(--bad); font-weight: 700; }
.mk-c-sent b { color: var(--warn); } .mk-c-ok b { color: var(--ok); } .mk-c-back b { color: var(--bad); }
.mk-rv { padding: 12px 14px; margin-bottom: 12px; }
.mk-rv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.mk-rv-row .mk-acts { margin: 0; }
@media (max-width: 640px) { .mk-rv-row { grid-template-columns: minmax(0, 1fr); } }
/* AC209：篩選排成一行、行事曆上方數字卡、全部完成刪除 */
.mk-bar select, .mk-tasks select { width: auto; }
.mk-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.mk-kpi { text-align: left; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; box-shadow: var(--shadow); display: grid; gap: 2px; font: inherit; color: var(--text); }
.mk-kpi:hover { border-color: var(--brand); }
.mk-kpi span { font-size: 13px; color: var(--muted); font-weight: 700; }
.mk-kpi b { font-size: 26px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.mk-kpi b small { font-size: 14px; font-weight: 700; }
.mk-kpi em { font-style: normal; font-size: 12px; color: var(--muted); }
.mk-kpi.k-brand { border-top-color: var(--brand); } .mk-kpi.k-info { border-top-color: var(--info); }
.mk-kpi.k-warn { border-top-color: var(--warn); } .mk-kpi.k-bad { border-top-color: var(--bad); }
.mk-kpi.hot b { color: var(--bad); }
.mk-fin { white-space: nowrap; color: var(--muted); }
.mk-fin.ready { color: var(--ok); border-color: var(--ok); }
.mk-left { margin: 6px 0 0; padding-left: 20px; }
@media (max-width: 1100px) { .mk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .mk-kpi b { font-size: 20px; } }

/* 業績&管理業績（AC210） */
.pf-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pf-head h2 { font-size: 20px; }
.pf-head select { width: auto; }
.pf-badge { display: inline-block; margin-left: 6px; background: var(--brand-ink); color: var(--brand); border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 1.7; }
.pf-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 280px)); gap: 10px; margin-bottom: 12px; }
.pf-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.pf-card.ok { border-top-color: var(--ok); }
.pf-card span { font-size: 13px; color: var(--muted); font-weight: 700; }
.pf-card b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pf-card em { font-style: normal; font-size: 12px; color: var(--muted); }
.pf-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pf-tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.pf-tbl th, .pf-tbl td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; text-align: right; white-space: nowrap; }
.pf-tbl th { background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; }
.pf-tbl th.hit { background: var(--ok-bg); color: var(--ok); }
.pf-tbl .l { text-align: left; }
.pf-tbl td.n { cursor: pointer; min-width: 56px; }
.pf-tbl td.n:hover { background: var(--brand-soft); }
.pf-tbl td.tot { font-weight: 700; }
.pf-tbl tr.sum td { background: var(--surface-2); font-weight: 700; }
.pf-ok { color: var(--ok); } .pf-bad { color: var(--bad); }
.pf-addp { border-style: dashed; }
.pf-pend { background: var(--warn-bg); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; display: grid; gap: 6px; }
.pf-pend button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; color: var(--text); }
.pf-pend button:hover, .pf-pend button.on { border-color: var(--brand); background: var(--brand-soft); }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.pf-ops { white-space: nowrap; } .pf-ops .btn { margin-left: 4px; }
/* AC212：自填、公司業績、年度目標剩餘 */
.pf-tbl td.self { color: var(--info); }
.pf-tbl tr.pf-co td { background: var(--surface-2); }
.pf-tbl tr.pf-goal td { background: var(--brand-soft); font-weight: 700; }
.pf-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; text-align: left; }
.pf-name:hover { color: var(--brand); text-decoration: underline; }
.pf-self { margin-top: 12px; display: grid; gap: 6px; }
.pf-self-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pf-self-row input { width: 200px; max-width: 100%; }
.pf-list { margin: 0; padding-left: 20px; }
.pf-pend-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.pf-pend input[type=search] { width: 100%; }
.pf-done:not(:empty) { background: var(--ok-bg); color: var(--ok); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; font-weight: 700; }
.pf-pend-bar { display: flex; gap: 8px; align-items: center; }
.pf-pend-bar input { flex: 1; min-width: 0; }
.pf-done button { margin-left: 8px; }
/* AC215：業務業績＋管理業績兩張表、防重複合併、工地名稱選系統案場 */
.pf-sec { margin-bottom: 22px; }
.pf-sec-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
.pf-sec-h h3 { font-size: 18px; }
.pf-card.mg { border-top-color: var(--info); }
.pf-dup { border: 1px solid var(--bad); background: var(--surface); border-radius: 8px; padding: 6px 10px; display: grid; gap: 4px; }
.pf-tag { font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--warn-bg); color: var(--warn); justify-self: start; }
.pf-dup-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-sug { display: grid; gap: 4px; margin: -4px 0 8px; }
.pf-sug button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: inherit; color: var(--text); }
.pf-sug button:hover { border-color: var(--brand); background: var(--brand-soft); }
/* AC216：公司業績／公司管理明細 */
.pf-co-list { display: grid; gap: 0; }
.pf-co-li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--line); }
.pf-co-li:last-child { border-bottom: 0; }
.pf-add-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 工地進料總表：往下拉時表頭（工地、各廠商）固定在上面（2026-11-17 使用者要求）。表格在自己的框裡捲動，跟追蹤總表一樣 */
.pc-mwrap { max-height: calc(100vh - 150px); overflow: auto; }
.pc-matrix thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--line); }
.pc-matrix thead th.pc-site { z-index: 4; background: var(--surface-2); }

/* 罐頭文預打（2026-11-17，AC224）：預打頁＋甘特圖的 📨 */
.gt-cn { display: block; width: 100%; margin: 2px 0 0; padding: 1px 5px; border: 0; border-radius: 9px; font: inherit; font-size: 11px; line-height: 1.4; color: #fff; background: #2D6CDF; cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-cn.s-late { background: #D93025; }
.gt-cn.s-bot { background: #8A4FD0; }
.gt-cn.s-sent { background: var(--ok); }
.gt-cn:hover { filter: brightness(1.1); }
.pt-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pt-site { min-width: 280px; max-width: 100%; }
.pt-sub { margin: 14px 0 6px; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 16px; padding: 4px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.pt-chip small { color: var(--muted); margin-left: 2px; }
.pt-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pt-chip.on small { color: #fff; opacity: .85; }
.pt-chip.dashed { border-style: dashed; }
.pt-chip:disabled { cursor: default; opacity: .7; }
.pt-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; background: var(--surface); }
.pt-box.new { border-style: dashed; }
.pt-box-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.pt-box-f { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.pt-box-f .check { margin: 0; }
.pt-when { font-size: 13px; color: var(--ok); }
.pt-when.no { color: #A86A00; }
.pt-ta { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.pt-save { margin-top: 14px; display: flex; justify-content: flex-end; }
.pt-checks { margin: 8px 0; font-size: 14px; }
.pt-text { max-height: 260px; font-size: 14px; }
.pt-issue { margin-top: 10px; display: grid; gap: 6px; }
.pt-issue textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
/* 甘特圖小視窗：點「未選廠商」直接換廠商（2026-11-18，AC225） */
.gt-assign-btn { font: inherit; cursor: pointer; text-align: left; border: 1px dashed #9A9A9A; border-radius: 5px; padding: 1px 6px; }
.gt-assign-btn.open { outline: 2px solid #378ADD; outline-offset: 1px; }
.gt-assign { margin: 2px 10px 6px 42px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: grid; gap: 2px; }
.gt-assign-opt { font: inherit; font-size: 13px; text-align: left; border: 0; background: transparent; padding: 4px 6px; border-radius: 5px; cursor: pointer; color: var(--text); }
.gt-assign-opt:hover, .gt-assign-opt:focus-visible { background: #e6f1fb; color: #0c447c; }
.gt-assign-none { color: var(--bad, #c0392b); }
.gt-assign .check { margin-top: 4px; }

/* 罐頭文進度：表格／日曆（2026-11-18，AC227）。顏色：綠已傳、紫機器人看到、藍已預打、橘框還沒預打、紅框到了沒傳、灰等改甘特圖 */
.pg-bar { margin: 4px 0 8px; }
.pg-bar .pc-legend { margin: 0; }
.pg-seg .btn { border-radius: 0; }
.pg-c { display: block; border-radius: 4px; padding: 1px 4px; margin: 2px 0; font-size: 11px; line-height: 1.35; white-space: nowrap; }
.pg-sent { background: #EAF3DE; color: #27500A; }
.pg-bot { background: #EEEDFE; color: #3C3489; }
.pg-ready { background: #E6F1FB; color: #0C447C; }
.pg-todo { background: #FAEEDA; color: #633806; box-shadow: inset 0 0 0 1px #BA7517; }
.pg-late { background: #FCEBEB; color: #791F1F; box-shadow: inset 0 0 0 1px #E24B4A; font-weight: 600; }
.pg-wait { background: #F1EFE8; color: #444441; box-shadow: inset 0 0 0 1px #888780; }
.pg-matrix td.pg-now { text-align: left; font-size: 12px; min-width: 150px; white-space: nowrap; }
.pg-done { color: var(--ok); }
.pg-barline { height: 5px; background: var(--line); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.pg-barline i { display: block; height: 100%; background: #639922; }
.pg-calbar { margin: 4px 0 8px; }
.pg-calbar input[type=date] { width: 10.5em; }
.pg-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.pg-hd { background: var(--surface-2); color: var(--muted); text-align: center; font-size: 12px; padding: 4px; }
.pg-day { min-height: 92px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 3px; min-width: 0; }
.pg-day:nth-child(7n+1) { border-left: 0; }
.pg-day.past { background: var(--surface-2); }
.pg-day.today { background: #fff6e0; }
.pg-day.out { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.03) 6px 12px); }
.pg-dn { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.pg-day.today .pg-dn { color: var(--bad); font-weight: 700; }
button.pg-cal-c { width: 100%; border: 0; text-align: left; font: inherit; font-size: 11px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.pt-chips button.pg-cal-c { width: auto; }
@media (prefers-color-scheme: dark) { .pg-day.today { background: #3a2c10; } }
@media (max-width: 760px) { .pg-day { min-height: 70px; } button.pg-cal-c { white-space: normal; } }

/* 新增業績：地址很像，是否為同一筆（2026-11-18，AC229） */
.pf-sim { border: 1px solid #EF9F27; background: #FAEEDA; color: #633806; border-radius: 8px; padding: 6px 10px; display: grid; gap: 6px; }
.pf-sim .pf-dup-acts { align-items: center; }
.pf-dup-amtl { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; margin: 0; }
.pf-dup-amt { width: 110px; padding: 3px 6px; }
.pf-diff { background: #FAC775; color: inherit; border-radius: 3px; padding: 0 2px; }
