/* work.css —— 工作台③ + 詳細頁④,疊在 base.css 的純淨現代 App 語言上。 */

/* ---------- 工作台 head ---------- */
.work-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}

/* ---------- 佇列分頁:進行中 / 待判定 / 已結案 / 全部 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px 10px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--primary-strong); border-bottom-color: var(--primary); }
.tab b {
  font-weight: 800;
  font-size: 12px;
  line-height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.tab.on b { background: var(--primary-tint); border-color: transparent; color: var(--primary-strong); }
.tab b.hot { background: var(--st-need_judgement-bg); border-color: transparent; color: var(--st-need_judgement); }

/* 進行中內的狀態快篩 chips */
.status-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.schip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: border-color .15s, color .15s, background .15s;
}
.schip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--ink));
  flex: 0 0 auto;
}
.schip:hover { border-color: var(--ink-faint); color: var(--ink); }
.schip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.schip.on::before { background: #fff; }
.schip b { font-weight: 700; opacity: .75; font-variant-numeric: tabular-nums; }
.schip.st-pending { --dot: var(--st-pending); }
.schip.st-processing { --dot: var(--st-processing); }
.schip.st-need_second_round { --dot: var(--st-need_second_round); }
.schip.st-paused { --dot: var(--st-paused); }

/* 未動天數徽章:問題會發臭,越久越紅 */
.age-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}
.age-badge.hot { background: var(--st-pending-bg); border-color: transparent; color: var(--st-pending); font-weight: 800; }

/* ---------- 進階篩選(收合) ---------- */
.adv-filter { margin-bottom: 10px; }
.adv-filter summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 6px 2px;
  user-select: none;
}
.adv-filter summary:hover { color: var(--ink); }
.adv-filter summary::-webkit-details-marker { display: none; }
.sum-mark {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink-faint);
  transition: transform .15s;
}
.adv-filter[open] .sum-mark { transform: rotate(180deg); }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item label { font-size: 11.5px; }
.filter-item select, .filter-item input { min-width: 132px; min-height: 40px; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

.result-line {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-soft); margin: 6px 2px 14px;
}
.result-line .mono { font-weight: 700; color: var(--ink); }
.mine-toggle {
  min-height: 32px;
  padding: 3px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.mine-toggle:hover { border-color: var(--ink-faint); color: var(--ink); }
.mine-toggle.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- 卡片格 ---------- */
.case-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.case-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  animation-delay: min(calc(var(--i, 0) * 28ms), 420ms);
}
.case-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.case-card:active { transform: translateY(0); }

/* 頂部狀態列:淡色底(來自 .status-X)+ 信號點 + 單號 */
.cc-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 13px;
  font-size: 12.5px;
}
.cc-band-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  white-space: nowrap;
}
.cc-band-label::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.cc-band-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  opacity: .72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-thumb {
  height: 150px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-photo {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .3em;
  color: var(--ink-faint);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 6px 14px;
}
.cc-body { padding: 11px 14px 13px; display: flex; flex-direction: column; gap: 5px; }
.cc-cat { font-weight: 800; font-size: 15px; }
.cc-problem { color: var(--ink-soft); font-size: 13px; min-height: 38px; line-height: 1.5; }
.cc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.cc-rounds { color: var(--ink-soft); font-size: 12px; }
.cc-time { font-size: 11px; color: var(--ink-faint); }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 44px 16px;
}
.empty-stripe { display: none; }
.empty-state p { color: var(--ink-soft); margin: 0 0 16px; }

/* ---------- 詳細頁:標籤頭 ---------- */
.detail-top { display: flex; justify-content: space-between; align-items: center; }
.back-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.back-link:hover { color: var(--ink); }
.next-one { color: var(--primary-strong); }

.detail-label {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 14px;
}
/* 狀態帶:淡色底來自 .status-X */
.dl-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
}
.dl-band-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14.5px;
}
.dl-band-label::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.dl-band-code { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; opacity: .6; }
.dl-main { padding: 14px 18px 16px; }
.dl-code {
  font-family: var(--font-mono);
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0 0 8px;
}
.dl-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.dl-cat {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  padding: 2px 12px;
  border-radius: 999px;
}
/* 問題描述 = 主角 */
.dl-problem { margin: 12px 0 0; font-size: 15.5px; line-height: 1.7; }
.dl-facts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.dl-facts b { color: var(--ink); font-weight: 600; }
.fact-arrow { color: var(--ink-faint); }

/* ---------- 一鍵認領 ---------- */
.claim-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.claim-bar input { max-width: 190px; min-height: 42px; }
.claim-hint { font-size: 12px; color: var(--ink-faint); }

/* ---------- 更多狀態操作(收摺的例外修正) ---------- */
.status-more summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 6px 2px;
  user-select: none;
}
.status-more summary:hover { color: var(--ink); }
.status-more summary::-webkit-details-marker { display: none; }
.status-more[open] .sum-mark { transform: rotate(180deg); }
.status-more .quick-status { margin-top: 10px; }
.quick-status { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-status form { margin: 0; }
.btn-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 15px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn-status::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sc, var(--ink));
  flex: 0 0 auto;
}
.btn-status:hover { border-color: var(--sc); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-status:active { transform: scale(.97); }
.btn-status.st-pending { --sc: var(--st-pending); --scb: var(--st-pending-bg); }
.btn-status.st-processing { --sc: var(--st-processing); --scb: var(--st-processing-bg); }
.btn-status.st-need_second_round { --sc: var(--st-need_second_round); --scb: var(--st-need_second_round-bg); }
.btn-status.st-need_judgement { --sc: var(--st-need_judgement); --scb: var(--st-need_judgement-bg); }
.btn-status.st-completed { --sc: var(--st-completed); --scb: var(--st-completed-bg); }
.btn-status.st-returned_to_flow { --sc: var(--st-returned_to_flow); --scb: var(--st-returned_to_flow-bg); }
.btn-status.st-scrapped { --sc: var(--st-scrapped); --scb: var(--st-scrapped-bg); }
.btn-status.st-paused { --sc: var(--st-paused); --scb: var(--st-paused-bg); }
.btn-status.current {
  background: var(--scb);
  color: var(--sc);
  border-color: transparent;
  font-weight: 800;
  cursor: default;
}

/* ---------- 兩欄 ---------- */
.detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.detail-left, .detail-right { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 基本資料 dl ---------- */
.info-list { display: grid; grid-template-columns: 76px 1fr; gap: 8px 12px; margin: 0; }
.info-list dt { color: var(--ink-faint); font-weight: 700; font-size: 12px; padding-top: 2px; }
.info-list dd { margin: 0; font-size: 14px; }

.edit-form, .photo-form, .round-form { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.check-inline { display: flex; align-items: center; gap: 8px; }
.check-inline input { width: 21px; height: 21px; min-height: auto; accent-color: var(--primary); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.field.disabled, #unresolved-wrap.disabled { opacity: .4; }

/* ---------- 處理一輪:結果三選一卡 + 分支 ---------- */
.oc-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.oc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.oc input { position: absolute; opacity: 0; pointer-events: none; }
.oc:hover { border-color: var(--ink-faint); }
.oc:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-tint);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.oc-t { font-weight: 800; font-size: 14px; }
.oc-d { font-size: 11.5px; color: var(--ink-soft); }
.oc-branch {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.oc-branch .field:last-child { margin-bottom: 4px; }
.close-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.close-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.close-choice input { width: 16px; height: 16px; min-height: auto; accent-color: var(--primary); }
.close-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary-strong);
}
.field-error .oc, .field-error .close-choice { border-color: var(--danger); }
.more-fields { margin-bottom: 10px; }
.more-fields summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 4px 0;
  user-select: none;
}
.more-fields summary::-webkit-details-marker { display: none; }
.more-fields summary::before { content: "▸ "; }
.more-fields[open] > summary::before { content: "▾ "; }

/* ---------- 照片牆 ---------- */
.photo-group { margin-bottom: 14px; }
.photo-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.photo-wall { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-wall.small .photo-item { width: 64px; height: 64px; }
.photo-item {
  position: relative; width: 96px; height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  display: block;
  transition: transform .12s, box-shadow .15s;
}
.photo-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(23, 26, 32, .68); color: #fff; font-size: 11px; padding: 2px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  transition: background .15s, border-color .15s, color .15s;
}
.photo-btn:hover { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-strong); }
.photo-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.photo-preview img {
  width: 72px; height: 72px; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}

/* ---------- 時間軸:左軌 + 里程節點 ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
  position: relative;
  padding: 0 0 18px 44px;
}
.timeline-item:last-child { padding-bottom: 0; }
/* 軌道線由各 item 畫(節點以下),末項不畫 → 線不會突出末節點 */
.timeline-item::before {
  content: "";
  position: absolute;
  left: 13px; top: 32px; bottom: -2px;
  width: 2px;
  background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.tl-node {
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  z-index: 1;
}
.timeline-item.resolved .tl-node {
  background: var(--st-completed-bg);
  border-color: var(--st-completed);
  color: var(--st-completed);
}
.timeline-item.unresolved .tl-node {
  background: var(--st-pending-bg);
  border-color: var(--st-pending);
  color: var(--st-pending);
}
.tl-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--st-pending);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.timeline-item.resolved .tl-card { border-left-color: var(--st-completed); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tl-round { font-weight: 800; font-size: 14px; }
.tl-handler { font-weight: 700; font-size: 13px; }
.tl-time { font-size: 11px; color: var(--ink-faint); margin-left: auto; }
.tl-row { display: flex; gap: 8px; font-size: 14px; margin: 3px 0; line-height: 1.55; }
.tl-row b {
  flex: 0 0 42px;
  color: var(--ink-faint);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  padding-top: 3px;
}
.tl-verdict { align-items: center; }
.badge-ok { color: var(--st-completed); font-weight: 800; }
.badge-no { color: var(--st-pending); font-weight: 800; }
.tl-empty { padding: 8px 0 0 44px; }

/* ---------- 手機 ---------- */
@media (max-width: 860px) {
  .detail-cols { grid-template-columns: 1fr; }
  .oc-group { grid-template-columns: 1fr; }
  .claim-bar input { max-width: none; flex: 1; }
  .filter-item select, .filter-item input { min-width: 120px; }
  .filter-actions { margin-left: 0; width: 100%; }
  .case-grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
  .cc-thumb { height: 118px; }
  .cc-problem { min-height: auto; }
}

/* ---------- 拍照/相簿雙按鈕 + 累積縮圖(可單張移除) ---------- */
.photo-btn-row { display: flex; gap: 8px; }
.photo-btn-row .photo-btn { flex: 1; min-width: 0; }
.photo-preview .thumb {
  position: relative; width: 72px; height: 72px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface-2);
}
.photo-preview .thumb img { width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0; }
.photo-preview .thumb-rm {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(23, 26, 32, .62); color: #fff;
  font-size: 11px; line-height: 20px; cursor: pointer;
}
.photo-preview .thumb-busy {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-faint);
  border: 1px dashed var(--line-strong);
}
