/* AMI 營運案件管理中心 — B「精密儀器」互動驗收版（Owner 2026-11-13）。
   配色 ① 霧藍灰＋鋼藍；按壓立體（Neumorphism）；所有按鈕、導覽與頁籤為小圓角方形（7px），不使用膠囊形。
   Desktop First：1920×1080、1366×768、1280×720（Owner 2026-11-15 版面比例：所有頁面同一內容寬度與間距；欄寬依內容，數字／日期／狀態
   欄只佔需要的寬度，長文字欄取得其餘空間；卡片高度依內容；寬表格在窄容器內改為逐列堆疊，不裁切、不水平捲動）。CSP style-src 'self'：沒有 inline style，數值寬度由 JS 以 CSSOM 設定。
   對比（WCAG AA，文字 ≥ 4.5:1）：狀態色只用於圓點／色塊；狀態文字用加深色 --r-t／--o-t／--g-t；--aux 只用於刻度與裝飾線。 */
:root {
  --bg: #e6ebf0; --hi: #f5f8fb; --sh: #bfc9d4; --lt: #ffffff; --line: #d3dbe3; --line-strong: #c2ccd7;
  --a: #2c63a3; --a-lt: #5b8fca; --a-dk: #1b416e; --a-soft: #dce7f3;
  --ink: #17212c; --sub: #5a6876; --aux: #8a96a3;
  --r: #c23a4d; --o: #b56d00; --g: #147a55;
  --r-t: #a8323f; --o-t: #8f5600; --g-t: #126b4b; --r-soft: #f6e4e6; --o-soft: #f6ecda; --g-soft: #dff0e8;
  --ui: 'Segoe UI', 'Microsoft JhengHei', '微軟正黑體', sans-serif;
  --mono: Consolas, 'Cascadia Mono', 'Segoe UI Mono', monospace;
  --raise: 5px 5px 12px var(--sh), -5px -5px 12px var(--lt);
  --raise-sm: 3px 3px 7px var(--sh), -3px -3px 7px var(--lt);
  --raise-xs: 2px 2px 4px var(--sh), -2px -2px 4px var(--lt);
  --inset: inset 3px 3px 7px var(--sh), inset -3px -3px 7px var(--lt);
  --inset-sm: inset 2px 2px 5px var(--sh), inset -2px -2px 5px var(--lt);
  --rad: 7px; --pad: 20px; --gap: 12px; --topbar-h: 50px;
}
@media (max-width: 1500px) { :root { --pad: 14px; --gap: 10px; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--topbar-h) + 8px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--ui); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--a); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
h1 { font-size: 20px; margin: 0; line-height: 1.3; letter-spacing: .3px; }
h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; min-height: 22px; }
h3 { font-size: 13.5px; margin: 8px 0 6px; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 2px; color: var(--sub); text-transform: uppercase; font-weight: 400; }
.muted { color: var(--sub); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: 13px; }
.error { color: var(--r-t); } .ok { color: var(--g-t); }
.warn-text { color: var(--o-t); font-weight: 600; }
.empty-state { margin: 0; padding: 10px 12px; border-radius: var(--rad); box-shadow: var(--inset-sm); color: var(--sub); font-size: 13px; }

/* ---------- local acceptance preview control (NOT part of the system) ---------- */
#pv { position: sticky; top: 0; z-index: 60; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px var(--pad); background: #23303d; color: #eef2f6; font-size: 12.5px; }
#pv b { color: #ffd27a; font-weight: 600; }
#pv label.inline { color: #dfe6ec; flex-direction: row; gap: 6px; align-items: center; font-size: 12.5px; }
#pv select { background: #34465a; color: #fff; border: 0; border-radius: 5px; padding: 2px 6px; min-height: 26px; max-width: 360px; box-shadow: none; }
#pv button { min-height: 26px; padding: 2px 10px; background: #3b5168; color: #fff; box-shadow: none; border-radius: 5px; font-weight: 600; }
#pv button:hover { background: #4a6683; }
#pv .pv-code b { color: #9fe0bf; font-size: 14px; letter-spacing: 1px; }
#pv .pv-note { margin-left: auto; color: #b8c4cf; }

/* ---------- top bar & navigation ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; gap: 14px; align-items: center; min-height: var(--topbar-h); margin: 10px var(--pad) var(--gap); padding: 5px 10px 5px 14px;
  background: var(--bg); border-radius: 12px; box-shadow: var(--raise); }
#pv:not([hidden]) ~ .topbar { top: 34px; }
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: linear-gradient(135deg, var(--a-lt), var(--a-dk)); box-shadow: var(--raise-xs); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--o-soft); color: var(--o-t); font-size: 11.5px; font-weight: 600; font-family: var(--mono); }
#nav { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.navgroup { display: flex; align-items: center; gap: 6px; }
.navlabel { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px; color: var(--sub); }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; box-shadow: var(--inset-sm); background: var(--bg); flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: transparent; box-shadow: none; padding: 5px 12px; min-height: 30px; border-radius: 6px; color: var(--sub); text-decoration: none; white-space: nowrap; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.seg a:hover, .seg button:hover { color: var(--ink); background: rgba(255, 255, 255, .45); }
.seg a.active, .seg button[aria-selected="true"], .seg button.on { color: var(--a-dk); background: var(--bg); box-shadow: var(--raise-xs); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12.5px; white-space: nowrap; min-width: 0; }
#who { padding: 4px 10px; border-radius: 6px; box-shadow: var(--raise-xs); overflow-wrap: anywhere; white-space: normal; max-width: 420px; }
.banner { margin: 0 var(--pad) var(--gap); padding: 6px 12px; border-radius: var(--rad); background: var(--r-soft); color: var(--r-t); font-weight: 600; box-shadow: var(--inset-sm); }
.link { background: none; border: 0; box-shadow: none; color: var(--a); text-decoration: underline; cursor: pointer; padding: 0 4px; min-height: 0; font-weight: 400; }

main { padding: 0 var(--pad) 32px; max-width: 2000px; margin: 0 auto; }
.panel { background: var(--bg); border-radius: 12px; box-shadow: var(--raise); padding: 12px 14px; margin-bottom: var(--gap); min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .row.end { justify-content: flex-end; }
.mt { margin-top: 8px; } .spread { justify-content: space-between; }
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; margin: 0 2px var(--gap); }
.page-head p { margin: 2px 0 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.top-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--gap); align-items: start; margin-bottom: var(--gap); }
.top-row > .kpi-strip, .top-row > .panel { margin-bottom: 0; }
/* tiles keep about the same size on every page (系統管理: four in one row beside the management seats) */

/* ---------- form controls ---------- */
label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--sub); }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13.5px; }
.f-label { font-weight: 600; } .f-label .req { color: var(--r-t); }
.hint { font-size: 12px; color: var(--sub); }
.len-hint { font-size: 12px; color: var(--sub); } .len-hint.over { color: var(--r-t); font-weight: 600; }
input, select, textarea { padding: 6px 10px; border: 0; border-radius: var(--rad); background: var(--bg); box-shadow: var(--inset-sm); min-height: 34px; font-size: 13.5px; color: var(--ink); min-width: 0; }
input[type=checkbox] { min-height: 0; width: 16px; height: 16px; box-shadow: none; accent-color: var(--a); }
input[type=file] { padding: 5px 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--a-lt); outline-offset: 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { outline: 2px solid var(--r); background: #f3e6e8; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
textarea { min-height: 60px; resize: vertical; line-height: 1.45; }

/* ---------- buttons: small square (7px), raised; pressed = inset ---------- */
button, .btnlike { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: 6px 14px; border: 0; border-radius: var(--rad);
  background: var(--bg); color: var(--ink); box-shadow: var(--raise-sm); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13.5px; text-decoration: none; line-height: 1.2; }
button:hover:not(:disabled), .btnlike:hover { background: var(--hi); }
button:active:not(:disabled), .btnlike:active { box-shadow: var(--inset-sm); }
button.primary, .btnlike.primary { background: linear-gradient(180deg, #3570b4, var(--a)); color: #fff; box-shadow: var(--raise-sm), inset 0 1px 0 rgba(255, 255, 255, .25); }
button.primary:hover:not(:disabled), .btnlike.primary:hover { background: linear-gradient(180deg, #3b79c0, #2f6aad); }
button.danger { color: var(--r-t); box-shadow: var(--raise-sm), inset 3px 0 0 var(--r); }
button.danger:hover:not(:disabled) { background: var(--r-soft); }
button.danger-solid { background: linear-gradient(180deg, #c84557, var(--r)); color: #fff; }
button.blocked-btn { color: var(--sub); box-shadow: var(--raise-xs); background: repeating-linear-gradient(135deg, var(--bg) 0 8px, #dde3ea 8px 16px); }
button:disabled { opacity: .55; cursor: not-allowed; box-shadow: var(--raise-xs); }
button[aria-busy="true"]::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 5px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::before { animation: none; } }
.icon-x { min-height: 30px; width: 30px; padding: 0; font-size: 14px; color: var(--sub); }
.small-btn { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
#logout { min-height: 30px; padding: 4px 12px; }

/* ---------- tabs, filters, list ---------- */
.tabs { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; box-shadow: var(--inset-sm); margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { box-shadow: none; background: transparent; color: var(--sub); min-height: 30px; padding: 4px 12px; border-radius: 6px; }
.tabs button[aria-selected="true"] { background: var(--bg); color: var(--a-dk); box-shadow: var(--raise-xs); }
.tabs .count { display: inline-block; min-width: 22px; margin-left: 4px; padding: 0 6px; border-radius: 4px; background: var(--a-soft); color: var(--a-dk); font-size: 12px; font-family: var(--mono); text-align: center; }
.tabs .count:empty { display: none; }
.filter-bar { border-radius: 10px; box-shadow: var(--inset-sm); padding: 8px 10px; margin-bottom: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin: 6px 0 8px; }
.filter-row label { min-width: 120px; }
.filter-row .f-q { flex: 1 1 300px; }
.filter-actions { display: flex; gap: 8px; }
.filter-more { margin-top: 6px; } .filter-more summary { cursor: pointer; color: var(--a); font-size: 12.5px; }
.filter-note { margin: 6px 0 0; color: var(--o-t); font-size: 12.5px; }
.list-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 4px 0 6px; font-size: 12.5px; min-height: 18px; }
.list-meta .total { font-weight: 700; font-size: 13.5px; }
.list-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 8px; }
.pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pager button { min-width: 32px; min-height: 30px; padding: 3px 9px; }
.pager button.current { background: linear-gradient(180deg, #3570b4, var(--a)); color: #fff; }
.pager-gap { padding: 0 4px; color: var(--sub); }
.page-jump { width: 64px; }
.cat-seg { margin-bottom: 4px; }

/* ---------- data tables: no ellipsis anywhere; text wraps; titles clamp at 3 lines and open on hover / focus ---------- */
.table-wrap { position: relative; border-radius: 10px; box-shadow: var(--inset-sm); padding: 3px; overflow-x: auto; }
.table-wrap.loading { opacity: .6; pointer-events: none; }
.table-wrap.loading::after { content: "載入中…"; position: absolute; top: 40px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 6px; background: #23303d; color: #fff; font-size: 12.5px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; line-height: 1.45; }
tr:last-child > td, tr:last-child > th { border-bottom: 0; }
.data-table { font-size: 13.5px; }
.data-table thead th { color: var(--sub); font-weight: 600; font-size: 12px; letter-spacing: .3px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--bg); }
.data-table.compact th, .data-table.compact td { padding: 5px 8px; }
.data-table tbody tr { cursor: pointer; }
.data-table td.k-code, .data-table td.k-date, .data-table td.k-enum, .data-table td.k-act { white-space: nowrap; overflow-wrap: normal; }
.data-table td.k-dept, .data-table td.k-ref { word-break: keep-all; min-width: 6.5em; }
.data-table td.k-who { min-width: 9.5em; }
.data-table td.k-text { min-width: 8em; overflow-wrap: anywhere; }
.data-table td.k-todo { min-width: 6em; }
.data-table td.k-enum .sub, .data-table td.k-date .sub { white-space: normal; }
td .sub.narrow-only { display: none; } /* shown below 1500 px (see the media rule) */
.table-wrap { container-type: inline-size; }
@container (max-width: 900px) {
  .data-table.stack-wide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .data-table.stack-wide, .data-table.stack-wide tbody, .data-table.stack-wide tr { display: block; width: auto; }
  .data-table.stack-wide tr { padding: 6px 2px; border-bottom: 1px solid var(--line-strong); }
  .data-table.stack-wide tr:last-child { border-bottom: 0; }
  .data-table.stack-wide td { display: block; position: relative; border: 0; padding: 2px 8px 2px calc(7.5em + 18px); white-space: normal; min-width: 0; min-height: 1.6em; }
  .data-table.stack-wide td::before { content: attr(data-label); position: absolute; left: 8px; top: 3px; width: 7.5em; color: var(--sub); font-size: 12px; font-weight: 600; }
  .data-table.stack-wide td:not([data-label]) { padding-left: 8px; } .data-table.stack-wide td:not([data-label])::before { content: none; }
}
@container (max-width: 720px) {
  .data-table.stack-mid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .data-table.stack-mid, .data-table.stack-mid tbody, .data-table.stack-mid tr { display: block; width: auto; }
  .data-table.stack-mid tr { padding: 6px 2px; border-bottom: 1px solid var(--line-strong); }
  .data-table.stack-mid tr:last-child { border-bottom: 0; }
  .data-table.stack-mid td { display: block; position: relative; border: 0; padding: 2px 8px 2px calc(7.5em + 18px); white-space: normal; min-width: 0; min-height: 1.6em; }
  .data-table.stack-mid td::before { content: attr(data-label); position: absolute; left: 8px; top: 3px; width: 7.5em; color: var(--sub); font-size: 12px; font-weight: 600; }
  .data-table.stack-mid td:not([data-label]) { padding-left: 8px; } .data-table.stack-mid td:not([data-label])::before { content: none; }
}
.data-table tbody tr:hover > td, .data-table tbody tr:hover > th, .data-table tbody tr.open > td { background: var(--hi); }
.data-table tbody tr.empty { cursor: default; } .data-table tbody tr.empty td { padding: 18px 8px; text-align: center; }
.data-table tbody tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--r); }
.data-table td.crit, .data-table td.crit a { color: var(--r-t); font-weight: 700; }
.data-table td.warn, .data-table td.warn a { color: var(--o-t); font-weight: 700; }
th.sortable { padding: 0; }
.sort-btn { width: 100%; min-height: 30px; box-shadow: none; border-radius: 0; background: none; justify-content: space-between; color: inherit; padding: 5px 8px; font-size: 12px; font-weight: 600; }
.sort-btn:hover { background: var(--hi) !important; }
.sort-btn:active { box-shadow: none !important; }
.sort-ind { font-size: 10px; color: var(--aux); }
th[aria-sort="ascending"] .sort-ind, th[aria-sort="descending"] .sort-ind { color: var(--a); }
td.c-no, td.c-status, td.c-urg, td.c-date, td.c-upd, td.c-due, td.c-pct, td.nowrap { white-space: nowrap; }
td.c-no { overflow-wrap: normal; }
td.c-title { min-width: 220px; }
.title-text { overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; border-radius: 3px; }
.clamp.c2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp:hover, .clamp:focus { -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
.clamp:focus-visible { outline: 2px solid var(--a); }
td.c-todo { min-width: 100px; } .todo-text { color: var(--a-dk); font-weight: 600; }
td.c-dept, td.c-handler { min-width: 70px; white-space: nowrap; }
td.c-file { min-width: 160px; } td .sub { display: block; color: var(--sub); font-size: 12px; }
.fname { overflow-wrap: anywhere; word-break: break-all; border-radius: 3px; }
.hashc { overflow-wrap: anywhere; word-break: break-all; cursor: help; border-radius: 3px; }
.hashc .rest { display: none; }
.hashc::after { content: '…（移入看全部）'; font-family: var(--ui); color: var(--sub); font-size: 11.5px; }
.hashc:hover .rest, .hashc:focus .rest { display: inline; } .hashc:hover::after, .hashc:focus::after { content: ''; }
td.c-hash { min-width: 130px; max-width: 220px; }
td.c-who { min-width: 120px; overflow-wrap: normal; } td.c-who .email { overflow-wrap: anywhere; word-break: normal; }
.no-cell { display: inline-flex; align-items: center; gap: 4px; }
.expander { min-height: 22px; width: 22px; padding: 0; font-size: 11px; box-shadow: var(--raise-xs); }
.case-link { font-weight: 700; text-decoration: none; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.case-link:hover { text-decoration: underline; }
tr.row-detail > td { background: var(--bg); box-shadow: var(--inset-sm); padding: 10px 12px; cursor: default; }
.kv.detail { grid-template-columns: 78px minmax(0, 1fr) 78px minmax(0, 1fr) 78px minmax(0, 1fr); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--aux); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong); }
.status.REGISTERING::before, .status.SUBMITTED::before, .status.DEPT_REVIEW::before, .status.FINAL_ACCEPTANCE::before { background: var(--o); }
.status.ASSIGNED::before, .status.ACCEPTED::before, .status.IN_PROGRESS::before { background: var(--a); }
.status.CLOSED::before { background: var(--g); }
.urg { font-size: 12.5px; white-space: nowrap; } .urg.URGENT { color: var(--o-t); font-weight: 700; } .urg.MOST_URGENT { color: var(--r-t); font-weight: 700; }
.due { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.due.overdue { background: var(--r-soft); color: var(--r-t); }
.due.soon { background: var(--o-soft); color: var(--o-t); }
.due-cell { white-space: nowrap; }
.pct { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12.5px; }
.pct-bar { display: inline-block; width: 46px; height: 6px; border-radius: 3px; box-shadow: var(--inset-sm); overflow: hidden; }
.pct-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--a-lt), var(--a)); width: 0; }

/* ---------- feedback ---------- */
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; gap: 10px; align-items: flex-start; max-width: 480px; padding: 10px 12px; border-radius: 10px; box-shadow: 0 8px 26px rgba(23, 33, 44, .28); color: #fff; font-size: 13.5px; }
#toast.success { background: #165a43; } #toast.error { background: var(--r-t); }
#toast-icon { font-weight: 700; } #toast-text { flex: 1; overflow-wrap: anywhere; } #toast .link { color: #fff; font-size: 12px; }
.result-banner { display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: var(--gap); border-radius: 10px; font-weight: 600; box-shadow: var(--inset-sm); }
.result-banner.success { background: var(--g-soft); color: var(--g-t); }
.result-banner.error { background: var(--r-soft); color: var(--r-t); }
.result-banner .rb-text { flex: 1; overflow-wrap: anywhere; } .result-banner .rb-time { font-weight: 400; font-size: 12px; color: var(--sub); }
.result-banner .rb-close { min-height: 26px; }
.form-error, .inline-error { margin-top: 8px; padding: 7px 10px; border-radius: var(--rad); background: var(--r-soft); color: var(--r-t); font-weight: 600; overflow-wrap: anywhere; }
.mailbox { font-size: 12.5px; background: #fff7e6; border: 1px dashed #d9a441; padding: 8px; border-radius: var(--rad); margin-top: 8px; }

/* ---------- modal dialogs: never larger than the screen; the body scrolls ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 14px; background: var(--bg); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 10px 10px 30px rgba(80, 96, 114, .45), -6px -6px 18px rgba(255, 255, 255, .7); overflow: hidden; }
dialog.modal.wide { width: min(880px, calc(100vw - 32px)); }
dialog.modal.small { width: min(480px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(35, 48, 61, .45); }
dialog.modal > form, dialog.modal > .confirm-box { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--sub); }
.modal-body { padding: 12px 14px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-body p { margin: 4px 0; overflow-wrap: anywhere; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-status { min-height: 0; margin: 6px 0 0; font-size: 12.5px; } .modal-status:empty { display: none; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.form-grid .full, .form-grid > p.full { grid-column: 1 / -1; }
.cmd-summary { padding: 8px 10px; border-radius: var(--rad); box-shadow: var(--inset-sm); font-size: 13px; display: grid; gap: 2px; }
.cmd-title { font-weight: 600; overflow-wrap: anywhere; }
.blocked-banner { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin-bottom: 8px; border-radius: var(--rad); font-size: 13px; }
.blocked-banner b { font-family: var(--mono); letter-spacing: 1px; padding: 1px 6px; border-radius: 4px; color: #fff; white-space: nowrap; }
.blocked-banner.blocked { background: var(--r-soft); color: var(--r-t); } .blocked-banner.blocked b { background: var(--r-t); }
.blocked-banner.notyet { background: var(--o-soft); color: var(--o-t); } .blocked-banner.notyet b { background: var(--o-t); }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 6px; counter-reset: st; flex-wrap: wrap; }
.steps li { counter-increment: st; padding: 4px 10px; border-radius: 6px; box-shadow: var(--inset-sm); font-size: 12.5px; color: var(--sub); }
.steps li::before { content: counter(st) ". "; font-family: var(--mono); }
.steps li.current { color: var(--a-dk); box-shadow: var(--raise-xs); font-weight: 600; } .steps li.done { color: var(--g-t); } .steps li.done::before { content: "✓ "; }
#confirm-body p { margin: 4px 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--sub); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.full { grid-template-columns: 96px minmax(0, 1fr); }
ul.plain { margin: 4px 0; padding-left: 18px; font-size: 13px; } ul.plain li { margin: 3px 0; overflow-wrap: anywhere; }

/* ---------- login & second factor ---------- */
.login-wrap { max-width: 460px; margin: 36px auto; display: grid; gap: var(--gap); }
.login-card h1 { margin: 2px 0 6px; }
.qr-box { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
img.qr { width: 196px; height: 196px; padding: 8px; background: #fff; border-radius: 10px; box-shadow: var(--raise-sm); image-rendering: pixelated; }
.secret-key { font-size: 15px; letter-spacing: 1px; padding: 8px 10px; border-radius: var(--rad); box-shadow: var(--inset-sm); overflow-wrap: anywhere; }

/* ---------- overview (營運總覽) ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi-strip.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi-strip.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-strip.k8 { grid-template-columns: repeat(8, minmax(0, 1fr)); } .kpi-strip.k9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.kpi { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--bg); box-shadow: var(--raise); color: var(--ink); text-decoration: none; min-width: 0; }
a.kpi:hover { background: var(--hi); } a.kpi:active { box-shadow: var(--inset-sm); }
.knob { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 700 16px var(--mono); color: var(--ink); background: var(--bg);
  box-shadow: 3px 3px 7px var(--sh), -3px -3px 7px var(--lt), inset 0 0 0 3px var(--bg); }
.knob.a { color: var(--a-dk); } .knob.red { color: #fff; background: var(--r-t); } .knob.orange { color: #fff; background: var(--o-t); } .knob.g { color: var(--g-t); }
.kpi.red .kpi-lab b { color: var(--r-t); } .kpi.orange .kpi-lab b { color: var(--o-t); }
.kpi-lab { display: flex; flex-direction: column; min-width: 0; }
.kpi-lab b { font-size: 13.5px; line-height: 1.3; } .kpi-sub { font-size: 11.5px; color: var(--sub); line-height: 1.3; }
.ov-row { display: grid; gap: var(--gap); align-items: start; }
.ov-row > .panel, .ov-row > .ov-stack, .grid-wa > .panel { margin-bottom: var(--gap); }
.ov-a, .ov-c { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.ov-b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ov-stack { display: grid; gap: var(--gap); } .ov-stack > .panel { margin-bottom: 0; }
.gaugecard { display: flex; align-items: center; gap: 16px; padding: 10px 14px; }
.gauge-text { display: flex; flex-direction: column; gap: 2px; } .gauge-text b { font-size: 13.5px; }
.gauge { position: relative; width: 120px; height: 120px; }
.gauge-svg { width: 100%; height: 100%; }
.gauge-face { position: absolute; inset: 22px; border-radius: 50%; box-shadow: var(--raise-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-face b { font-size: 13.5px; letter-spacing: .5px; } .gauge-face span { font-family: var(--mono); font-size: 8.5px; letter-spacing: 1px; color: var(--sub); }
.ov-pipe p { margin: 6px 0 0; }
/* stages as rows: label · rail with instrument ticks · count; the three columns line up across rows (subgrid) */
.ptrack { display: grid; grid-template-columns: max-content minmax(80px, 1fr) 3.2em; gap: 2px 0; }
.pst { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; column-gap: 12px; text-decoration: none; color: var(--sub); border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.pst:hover { background: var(--hi); }
.pst-label { white-space: nowrap; }
.pst b { font: 700 15px var(--mono); color: var(--ink); text-align: right; } .pst.hot b { color: var(--a-dk); }
.pst .rail { display: block; height: 9px; border-radius: 4px; box-shadow: var(--inset-sm); overflow: hidden;
  background: repeating-linear-gradient(90deg, transparent 0 11px, rgba(138, 150, 163, .35) 11px 12px); }
.pst .rail i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--a-lt), var(--a)); } /* width: the w-NN class */
h2 .more { margin-left: auto; font-size: 12.5px; font-weight: 600; text-decoration: none; }
h2 .more:hover { text-decoration: underline; }
.data-table.mini td.c-title { width: auto; min-width: 160px; }
table.dept-sum { table-layout: fixed; }
table.dept-sum th.d-name { width: 30%; } table.dept-sum th.d-open, table.dept-sum th.d-work, table.dept-sum th.d-over { width: 10%; }
table.dept-sum th.d-soon { width: 12%; } table.dept-sum th.d-conf, table.dept-sum th.d-go { width: 14%; }
table.dept-sum th.num, table.dept-sum td.num { text-align: center; font-family: var(--mono); font-size: 14px; }
table.dept-sum td.num.strong a, table.dept-sum td.num.strong { font-weight: 700; font-size: 15px; }
table.dept-sum td.zero { color: var(--aux); }
table.dept-sum tbody th { font-weight: 600; white-space: nowrap; }
table.dept-sum .dept-link { text-decoration: none; color: var(--ink); } table.dept-sum .dept-link:hover { color: var(--a); text-decoration: underline; }
table.dept-sum tr.empty-dept th, table.dept-sum tr.empty-dept td { color: var(--sub); }
table.dept-sum td.status-cell, table.dept-sum th.d-go { text-align: right; white-space: nowrap; }
.grid-wa { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--gap); }
.workload { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.wcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who open" "flags open"; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 10px;
  background: var(--bg); box-shadow: var(--raise-sm); color: var(--ink); text-decoration: none; border-left: 4px solid var(--a-lt); }
.wcard.has-overdue { border-left-color: var(--r); }
.wcard:hover { background: var(--hi); } .wcard:active { box-shadow: var(--inset-sm); }
.w-who { grid-area: who; display: flex; flex-direction: column; min-width: 0; } .w-who b { overflow-wrap: anywhere; font-size: 13.5px; }
.w-dept { font-size: 12px; color: var(--sub); }
.w-open { grid-area: open; display: flex; flex-direction: column; align-items: flex-end; }
.w-num { font: 700 26px/1 var(--mono); color: var(--a-dk); } .w-lab { font-size: 11.5px; color: var(--sub); }
.w-flags { grid-area: flags; display: flex; gap: 6px; flex-wrap: wrap; }
.flag { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.flag.red { background: var(--r-t); color: #fff; } .flag.orange { background: var(--o-soft); color: var(--o-t); } .flag.zero { color: var(--sub); box-shadow: var(--inset-sm); font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr 40px; gap: 8px; align-items: center; font-size: 12.5px; }
.bar-value { text-align: right; font: 700 13px var(--mono); }
.bar-track { height: 8px; border-radius: 4px; box-shadow: var(--inset-sm); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--a-lt), var(--a)); }

/* ---------- department page ---------- */
.stage-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); } /* rows always filled: chips share each row */
.stage-row > .stage { flex: 1 1 150px; }
.stage { justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 12px; min-height: 0; }
.stage .stage-label { font-size: 12.5px; color: var(--sub); } .stage .stage-count { font: 700 19px var(--mono); }
.stage[aria-pressed="true"] { box-shadow: var(--inset-sm); background: var(--a-soft); } .stage[aria-pressed="true"] .stage-label { color: var(--a-dk); }
.stage.critical .stage-label, .stage.critical .stage-count { color: var(--r-t); }
.dept-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--gap); align-items: start; }
.dept-side { position: sticky; top: calc(var(--topbar-h) + 50px); }
.dept-side .steps-list { margin: 0 0 8px; padding-left: 1.4em; } .dept-side .steps-list li { margin: 6px 0; line-height: 1.6; }

/* ---------- case page ---------- */
.case-layout { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--gap); align-items: start; }
.case-layout.no-preview { grid-template-columns: minmax(0, 1fr); }
.doc-pane { position: sticky; top: calc(var(--topbar-h) + 50px); display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 70px); min-height: 420px; margin-bottom: 0; }
.doc-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; } .doc-head h2 { margin: 0; white-space: nowrap; }
.doc-head select { flex: 1; min-width: 0; max-width: 72%; }
.doc-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.doc-body { flex: 1; min-height: 0; border-radius: 10px; box-shadow: var(--inset); background: #525659; overflow: hidden; display: flex; }
.doc-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.doc-img { flex: 1; overflow: auto; background: #fff; text-align: center; } .doc-img img { max-width: 100%; }
.doc-text { flex: 1; margin: 0; padding: 12px; overflow: auto; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.doc-placeholder, .doc-loading { margin: auto; padding: 16px; color: #e5e7eb; text-align: center; }
.doc-body .inline-error, .doc-body .warn-text { margin: auto; background: #fff; padding: 12px; }
.back { margin: 0 0 var(--gap); display: flex; gap: 8px; }
.case-top { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.case-title { min-width: 0; flex: 1 1 420px; }
.case-head h1 { font-size: 17px; margin-top: 2px; overflow-wrap: anywhere; line-height: 1.4; }
.case-no-inline { white-space: nowrap; font-size: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.tag { font: 600 12px var(--mono); padding: 3px 8px; border-radius: 5px; box-shadow: var(--raise-xs); overflow-wrap: anywhere; max-width: 100%; }
.rev { position: relative; width: 46px; height: 42px; display: grid; place-items: end center; padding-bottom: 4px; border-radius: 6px; background: linear-gradient(135deg, var(--a-lt), var(--a-dk)); clip-path: polygon(50% 0, 100% 100%, 0 100%); color: #fff; font: 700 13px var(--mono); }
.rev small { position: absolute; top: -14px; font-size: 9px; color: var(--sub); letter-spacing: 1px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; margin-top: 8px; }
.flow { display: flex; list-style: none; margin: 8px 0 2px; padding: 3px; counter-reset: step; border-radius: 9px; box-shadow: var(--inset-sm); }
.flow li { flex: 1; padding: 4px 2px; text-align: center; font-size: 12px; color: var(--sub); border-radius: 6px; white-space: nowrap; }
.flow li.done { color: var(--g-t); } .flow li.done::before { content: "✓ "; }
.flow li.current { color: #fff; font-weight: 700; background: linear-gradient(180deg, #3570b4, var(--a)); box-shadow: var(--raise-xs); }
.console-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.console-btns .lock { font-size: 11px; }
.cell-actions { white-space: nowrap; } .cell-actions > * { margin-right: 4px; }
.cell-actions button, .cell-actions .btnlike { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
.lists-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.tl-time { color: var(--sub); font-size: 12px; margin-right: 6px; font-family: var(--mono); } .tl-who { display: block; color: var(--sub); font-size: 12px; }

/* ---------- system administration ---------- */
.gov-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gov-card { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; box-shadow: var(--raise-sm); }
.gov-card .w-num { font-size: 20px; }
.org-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; align-items: start; }
.org-grid .mini-block.span-2 { grid-column: span 2; }
.st-dot.PENDING { color: var(--o-t); font-weight: 700; } .st-dot.EXECUTED { color: var(--g-t); } .st-dot.REJECTED, .st-dot.CANCELLED { color: var(--sub); }
tr.pending > td { background: #f3ede1; }

/* ---------- print ---------- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  #pv, .topbar, .banner, #toast, dialog, .tabs, .filter-row, .list-foot, .head-actions, .actions, .doc-pane, .back, .result-banner, .cell-actions, .sort-ind { display: none !important; }
  main { padding: 0; }
  .panel, .table-wrap { box-shadow: none; padding: 0; margin-bottom: 10pt; }
  .case-layout { display: block; }
  a { color: #000; text-decoration: none; }
  body.printing-area > *:not(#print-area) { display: none !important; }
  body.printing-area #print-area { display: block; }
  #print-area h1 { font-size: 15pt; margin: 2pt 0 4pt; } #print-area h2 { font-size: 12pt; margin: 10pt 0 4pt; border-bottom: 1px solid #999; }
  #print-area .print-brand { font-size: 10pt; color: #444; }
  #print-area th, #print-area td { font-size: 9.5pt; padding: 3pt 4pt; border: 1px solid #bbb; }
  .print-kv th { width: 22%; text-align: left; background: #f3f3f3; }
  .clamp { -webkit-line-clamp: unset; display: block; }
  .no-cell .expander { display: none; }
}

/* ---------- 1366 and narrower desktops ---------- */
@media (max-width: 1500px) {
  #pv .pv-note { display: none; }
  .kpi { padding: 6px 8px; gap: 7px; } .knob { width: 34px; height: 34px; font-size: 14px; } .kpi-sub { display: none; } .kpi-lab b { font-size: 13px; }
  .gauge { width: 100px; height: 100px; } .gauge-face { inset: 18px; } .gauge-face b { font-size: 12px; }
  .ov-a, .ov-c { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); }
  .pst { padding: 4px 6px; column-gap: 10px; }
  .data-table { font-size: 13px; } th, td { padding: 5px 7px; }
  /* 1366／1280: 進度 and 最後更新 move under 狀態 / 辦理期限 (still visible in every row; Codex v5 r1 P2-5) */
  td.c-upd, th.c-upd, td.c-pct, th.c-pct { display: none; } td .sub.narrow-only { display: block; }
  .kv.detail { grid-template-columns: 70px minmax(0, 1fr) 70px minmax(0, 1fr); }
  .brand { font-size: 14px; } .seg a, .seg button { padding: 5px 9px; font-size: 13px; }
  #who { max-width: 340px; }
  .dept-layout { grid-template-columns: minmax(0, 1fr) 250px; }
}
@media (max-width: 1180px) { /* 1280×720 screens (about 1256 px usable) keep the two-column desktop layout */
  .case-layout { grid-template-columns: minmax(0, 1fr); } .doc-pane { position: static; height: 70vh; margin-bottom: var(--gap); }
  .dept-layout, .grid-wa, .ov-a, .ov-b, .ov-c { grid-template-columns: minmax(0, 1fr); } .dept-side { position: static; }
  .kpi-strip, .kpi-strip.k8, .kpi-strip.k9 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 900px) { .grid-2, .lists-grid, .kv-grid, .form-grid, .gov-cards, .org-grid, .top-row { grid-template-columns: minmax(0, 1fr); } .org-grid .mini-block.span-2 { grid-column: auto; } .topbar { flex-wrap: wrap; } #nav { order: 3; flex-basis: 100%; overflow-x: auto; } .kpi-strip, .kpi-strip.k8, .kpi-strip.k9 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* width classes for progress fills (0–100 %): no element style attribute is ever written (CSP style-src self) */
.w-0 { width: 0%; } .w-1 { width: 1%; } .w-2 { width: 2%; } .w-3 { width: 3%; } .w-4 { width: 4%; } .w-5 { width: 5%; } .w-6 { width: 6%; } .w-7 { width: 7%; } .w-8 { width: 8%; } .w-9 { width: 9%; } .w-10 { width: 10%; } .w-11 { width: 11%; } .w-12 { width: 12%; } .w-13 { width: 13%; } .w-14 { width: 14%; } .w-15 { width: 15%; } .w-16 { width: 16%; } .w-17 { width: 17%; } .w-18 { width: 18%; } .w-19 { width: 19%; } .w-20 { width: 20%; } .w-21 { width: 21%; } .w-22 { width: 22%; } .w-23 { width: 23%; } .w-24 { width: 24%; } .w-25 { width: 25%; } .w-26 { width: 26%; } .w-27 { width: 27%; } .w-28 { width: 28%; } .w-29 { width: 29%; } .w-30 { width: 30%; } .w-31 { width: 31%; } .w-32 { width: 32%; } .w-33 { width: 33%; } .w-34 { width: 34%; } .w-35 { width: 35%; } .w-36 { width: 36%; } .w-37 { width: 37%; } .w-38 { width: 38%; } .w-39 { width: 39%; } .w-40 { width: 40%; } .w-41 { width: 41%; } .w-42 { width: 42%; } .w-43 { width: 43%; } .w-44 { width: 44%; } .w-45 { width: 45%; } .w-46 { width: 46%; } .w-47 { width: 47%; } .w-48 { width: 48%; } .w-49 { width: 49%; } .w-50 { width: 50%; } .w-51 { width: 51%; } .w-52 { width: 52%; } .w-53 { width: 53%; } .w-54 { width: 54%; } .w-55 { width: 55%; } .w-56 { width: 56%; } .w-57 { width: 57%; } .w-58 { width: 58%; } .w-59 { width: 59%; } .w-60 { width: 60%; } .w-61 { width: 61%; } .w-62 { width: 62%; } .w-63 { width: 63%; } .w-64 { width: 64%; } .w-65 { width: 65%; } .w-66 { width: 66%; } .w-67 { width: 67%; } .w-68 { width: 68%; } .w-69 { width: 69%; } .w-70 { width: 70%; } .w-71 { width: 71%; } .w-72 { width: 72%; } .w-73 { width: 73%; } .w-74 { width: 74%; } .w-75 { width: 75%; } .w-76 { width: 76%; } .w-77 { width: 77%; } .w-78 { width: 78%; } .w-79 { width: 79%; } .w-80 { width: 80%; } .w-81 { width: 81%; } .w-82 { width: 82%; } .w-83 { width: 83%; } .w-84 { width: 84%; } .w-85 { width: 85%; } .w-86 { width: 86%; } .w-87 { width: 87%; } .w-88 { width: 88%; } .w-89 { width: 89%; } .w-90 { width: 90%; } .w-91 { width: 91%; } .w-92 { width: 92%; } .w-93 { width: 93%; } .w-94 { width: 94%; } .w-95 { width: 95%; } .w-96 { width: 96%; } .w-97 { width: 97%; } .w-98 { width: 98%; } .w-99 { width: 99%; } .w-100 { width: 100%; }

/* ---- print watermark (Owner 2026-11-13): 「華新儀錶」 centred on EVERY printed page, pale steel blue-grey, ~13 % opacity ---- */
#print-watermark { display: none; }
@media print {
  #print-watermark { display: block !important; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-30deg); z-index: 2147483647;
    font: 700 120pt "Microsoft JhengHei", "微軟正黑體", sans-serif; color: rgba(111, 130, 150, 0.13); white-space: nowrap; pointer-events: none; letter-spacing: 6pt;
    /* same style as the exported files: a thin white outline outside the glyphs keeps the mark readable on dark / coloured areas */
    -webkit-text-stroke: 3pt rgba(255, 255, 255, 0.26); paint-order: stroke fill; }
  body.printing-area > #print-watermark { display: block !important; }
}

/* ---- 擴充：案件類型、指派／拒絕／裁決 ---- */
.type-mini{display:inline-block;margin-right:6px;padding:0 5px;border:1px solid var(--line,#c9d3dc);border-radius:4px;font-size:11px;line-height:17px;color:#3d5a73;background:#eef3f7;vertical-align:1px}
.tag.type-tag{background:#eef3f7;color:#2f4a60}
.tag.notice-tag{background:#fff5e0;color:#8a5a00}
.alert-reject{border-left:4px solid #c0392b;background:#fdf3f2}
.alert-reject h2{color:#a33025}
.alert-forced{border-left:4px solid #b7791f;background:#fffaf0}
.alert-forced h2{color:#8a5a00}
.flow li.current.rejected{background:#fdecea;color:#a33025;border-color:#e0a59f}
.asg-st{display:inline-block;padding:0 6px;border-radius:4px;font-size:12px;background:#eef1f4}
.asg-st.REJECT_PENDING{background:#fdecea;color:#a33025}
.asg-st.FORCED{background:#fff1d6;color:#8a5a00}
.asg-st.ACCEPTED{background:#e8f5ec;color:#256b3a}
.asg-st.REJECTION_APPROVED,.asg-st.SUPERSEDED,.asg-st.CANCELLED{color:#6b7682}
.ev-note{max-width:420px;white-space:normal;word-break:break-word}
.reject-info{border:1px solid #e0a59f;background:#fdf3f2;border-radius:6px;padding:6px 10px}
.mode-pick{display:flex;flex-wrap:wrap;gap:8px 18px;align-items:flex-start}
.mode-pick .f-label{width:100%}
.mode-pick .radio{display:grid;grid-template-columns:auto 1fr;column-gap:6px;align-items:center;border:1px solid var(--line,#c9d3dc);border-radius:7px;padding:6px 10px;cursor:pointer}
.mode-pick .radio .hint{grid-column:2}
.rec-fields{grid-column:1/-1}
.type-hint{margin:0}

/* ---- 案件類型：範例卡、專屬表單、詳細內容（欄位與表單相同） ---- */
.type-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 8px; }
.type-tabs a { padding: 4px 12px; border-radius: 7px; text-decoration: none; color: var(--sub); font-size: 13px; }
.type-tabs a[aria-selected=true] { color: var(--a-dk); box-shadow: var(--raise-xs); font-weight: 600; }
.sub-h { font-size: 14px; margin: 12px 0 6px; }
.tcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; align-items: start; }
.tcard { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; box-shadow: var(--raise-xs); text-decoration: none; color: inherit; border-left: 4px solid #6f8296; min-width: 0; }
.tcard.add { border-left-color: var(--a-dk, #2f5d86); }
.tcard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample-no { font-size: 14px; }
.sample-flag { font-size: 11px; padding: 0 6px; border-radius: 4px; background: #fff5e0; color: #8a5a00; line-height: 18px; }
.tcard-title { font-weight: 600; overflow-wrap: anywhere; } .tcard-title.small { font-weight: 400; font-size: 12.5px; color: var(--sub); }
.tcard-meta, .tcard-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--sub); }
.tcard-facts i { font-style: normal; color: #7b8794; }
.tcard-go { font-size: 12.5px; color: var(--a-dk, #2f5d86); }
.need { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12.5px; align-items: center; }
.need-f { padding: 0 6px; border-radius: 4px; background: #eef1f4; line-height: 20px; } .need-f.req-f { background: #e6eef6; color: #23405c; }
.type-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.type-row h2 a { color: inherit; }
.type-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.type-mini.sample { background: #fff5e0; color: #8a5a00; border-color: #ecd9ad; }
tr.is-sample td { background: #fffdf6; }
.multi { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 8px; border-radius: 7px; box-shadow: var(--inset-sm); }
.check-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.check-inline input { width: auto; }
.derived-note { font-size: 12.5px; color: var(--sub); border-top: 1px dashed #cfd8e1; padding-top: 6px; }
.derived-note ul { margin: 4px 0 0; }
.kv.rec { grid-template-columns: 132px minmax(0, 1fr); gap: 6px 14px; }
.kv.rec dd.pre, .pre { white-space: pre-wrap; }
.kv.rec dt .req { color: #b4541a; }
.rec-detail .derived { margin-top: 10px; border-top: 1px dashed #cfd8e1; padding-top: 8px; }
.rec-detail .derived h3 { font-size: 13.5px; margin: 0 0 4px; }
.fieldbox { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--sub); }
.form-grid .fieldbox.full { grid-column: 1 / -1; }
label.check-inline { flex-direction: row; color: var(--ink); }
