/* 臨時異動頁專用樣式；共用元件見 /styles.css。 */

/* 工具列：月份＋狀態篩選 */
.chg-bar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }

.chg-card { overflow: hidden; }

/* 表格：待確認列用琥珀色左邊條，已確認用綠色並淡化 */
.chg-table td { vertical-align: top; }
.chg-table tbody td:first-child { border-left: 5px solid transparent; }
.chg-table tbody tr.pend { background: linear-gradient(90deg, color-mix(in srgb, var(--amber-s) 68%, transparent), transparent 36%); }
.chg-table tbody tr.pend td:first-child { border-left-color: var(--amber); }
.chg-table tbody tr.okr td:first-child { border-left-color: var(--done); }
.chg-table tbody tr.okr td { color: var(--muted); }
.chg-table tbody tr.okr td strong { color: var(--ink); font-weight: 500; }
.chg-table td strong { display: block; font-weight: 700; white-space: nowrap; }
.chg-table td small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }
.chg-table .c-task strong, .chg-table .c-case strong { white-space: normal; min-width: 4em; }
/* 勾選格：整格都是 label，點格內任何位置只會勾選，不會打開詳情 */
.chg-table .c-chk { width: 44px; padding: 0; }
.chg-table th.c-chk { padding: 0; }
.chg-table td.c-chk { position: relative; }
.chg-check { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 12px; cursor: pointer; }
.chg-check input { flex: none; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.chg-table td.c-chk .chg-check { position: absolute; inset: 0; min-height: 0; padding: 13px 0 0; align-items: flex-start; }
.chg-table .c-diff { min-width: 150px; }
.chg-table .c-why { min-width: 120px; max-width: 220px; font-size: 13px; overflow-wrap: anywhere; }
.chg-table .c-st, .chg-table .c-act { white-space: nowrap; }
.chg-table .c-act { text-align: right; }
.chg-table tr:focus-visible { outline-offset: -3px; }

/* 換人：原派（刪除線）→ 新派 */
.chg-diff { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 700; margin-right: 6px; }
.chg-diff s { color: var(--muted); font-weight: 500; text-decoration-color: color-mix(in srgb, var(--muted) 70%, transparent); }
.chg-diff i { font-style: normal; color: var(--muted); }
.chg-diff b { color: var(--accent-d); }
tr.okr .chg-diff b { color: var(--ink); }

/* 手機：每筆異動改成卡片 */
@media (max-width: 640px) {
  .chg-bar .seg { flex: 1 1 100%; }
  .chg-bar .seg button { flex: 1 1 0; justify-content: center; padding: 6px 8px; }
  .chg-table thead { display: none; }
  .chg-table, .chg-table tbody { display: block; }
  .chg-table tbody tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 4px;
    grid-template-areas: "chk date st" "chk case case" "chk task task" "chk diff diff" "chk why why" "chk who act";
    padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); border-left: 5px solid transparent;
  }
  .chg-table tbody tr:last-child { border-bottom: 0; }
  .chg-table tbody tr.pend { border-left-color: var(--amber); }
  .chg-table tbody tr.okr { border-left-color: var(--done); }
  .chg-table tbody td, .chg-table tbody td:first-child { display: block; padding: 0; border: 0; min-width: 0; max-width: none; }
  /* 勾選格佔滿卡片左側整條（含上下內距），點擊區 40px 寬 */
  .chg-table .c-chk { grid-area: chk; }
  .chg-table tbody td.c-chk { width: 40px; margin: -12px 0; align-self: stretch; }
  .chg-table td.c-chk .chg-check { padding: 12px 0 0 4px; }
  .chg-table .c-date { grid-area: date; display: flex !important; gap: 8px; align-items: baseline; }
  .chg-table .c-case { grid-area: case; display: flex !important; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .chg-table .c-task { grid-area: task; display: flex !important; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .chg-table .c-task strong { font-size: 15px; min-width: 0; }
  .chg-table .c-case strong { min-width: 0; }
  .chg-table .c-diff { grid-area: diff; }
  .chg-table .c-why { grid-area: why; max-width: none; }
  .chg-table .c-why .muted { display: none; }
  .chg-table .c-who { grid-area: who; display: flex !important; gap: 8px; align-items: baseline; align-self: center; }
  .chg-table .c-who strong { font-weight: 500; font-size: 12px; color: var(--muted); }
  .chg-table .c-st { grid-area: st; }
  .chg-table .c-act { grid-area: act; }
  /* 沒有勾選欄時，內容從左邊條旁開始 */
  .chg-table tbody tr:not(:has(.c-chk)) { padding-left: 14px; grid-template-columns: 0 minmax(0, 1fr) auto; column-gap: 0; }
  .chg-table tbody tr:not(:has(.c-chk)) .c-st, .chg-table tbody tr:not(:has(.c-chk)) .c-act { margin-left: 10px; }
}
