/* 專案頁（v1.4）：專案總覽、導入階段、動態時間軸
   顏色一律用 /assets/base.css 的變數（深色模式才會正確）；版面依內容區寬度調整（container query），側邊欄收合與否都合適 */

/* ---------- 頁首：專案名稱、狀態、類型，下一行案號・客戶・期間 ---------- */
.pj-head .pj-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.pj-head .pj-title h2 { font-size: 22px; font-weight: 650; letter-spacing: .005em; min-width: 0; overflow-wrap: anywhere; }
.pj-head .pj-type { font-weight: 500; }
.pj-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; margin-top: 5px; font-size: 13.5px; color: var(--muted); }
.pj-code {
  font-variant-numeric: tabular-nums; letter-spacing: .03em; color: var(--ink-2); font-weight: 500;
  background: var(--line-2); border-radius: 6px; padding: 0 8px; line-height: 1.75;
}
.pj-meta-i { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); }
.pj-meta-i svg { flex: none; color: var(--icon-muted); }
a.pj-meta-i:hover { color: var(--brand); }
a.pj-meta-i:hover svg { color: currentColor; }
.pj-tabs { scroll-margin-top: calc(var(--topbar-h, 64px) + 8px); }
/* 「驗收結案」按鈕下面的小字：為什麼還不能結案、結案前要留意什麼（靠右，對著按鈕；手機靠左） */
.pj-close-why { margin: -8px 0 16px; text-align: right; color: var(--muted); line-height: 1.7; }
.pj-close-why b { font-weight: 560; color: var(--ink-2); }
.pj-close-why.blocked b { color: var(--amber-ink); }
.pj-close-why-i { display: block; }
.pj-close-why-i a { margin-left: 6px; white-space: nowrap; }
@media (max-width: 640px) {
  .pj-head .pj-title h2 { font-size: 20px; }
  .pj-meta { gap: 4px 12px; }
  .pj-close-why { text-align: left; }
}

/* ---------- 概況：總覽卡＋左右兩欄 ---------- */
.pj-overview { display: flex; flex-direction: column; gap: 16px; container-type: inline-size; container-name: pj; }
.pj-cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.pj-main, .pj-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pj-cols.solo { grid-template-columns: minmax(0, 1fr); }
.pj-cols.solo .pj-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.pj-cols.solo .pj-danger { grid-column: 1 / -1; }
.pj-kv { grid-template-columns: 76px minmax(0, 1fr); }
.pj-kv .with-av { gap: 7px; }
.pj-danger { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 0 2px; }
@container pj (max-width: 880px) {
  .pj-cols, .pj-cols.solo .pj-side { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 總覽卡（project-hero.js） ---------- */
.pj-hero { overflow: hidden; }
/* 專案健康（v1.5，只有管理者）：卡片最上面一條；要注意＝淡橘底、有風險＝淡紅底，原因列在燈號下面、可以點到對應頁籤 */
.pj-health { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 14px; padding: 12px 22px; border-bottom: 1px solid var(--line-2); }
.pj-health > .pj-k { padding-top: 3px; white-space: nowrap; }
.pj-health .health { flex: 1 1 320px; }
.pj-health .h-reasons { font-size: 14px; }
.pj-health-ok { flex: 1 1 260px; padding-top: 3px; font-size: 13.5px; color: var(--muted); }
.pj-health-note { margin-left: auto; padding-top: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pj-health.pj-h-ok .health { flex: none; }
.pj-health.pj-h-warn { background: color-mix(in srgb, var(--amber) 6%, var(--card)); }
.pj-health.pj-h-risk { background: color-mix(in srgb, var(--red) 6%, var(--card)); }
.pj-hero-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); }
.pj-hz { padding: 20px 22px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pj-hz + .pj-hz { border-left: 1px solid var(--line-2); }
.pj-k { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.pj-k svg { flex: none; color: var(--icon-muted); }
.pj-none { font-size: 14px; color: var(--muted); }
.pj-hz .btn { align-self: flex-start; margin-top: 4px; }

/* 時數用量：圓環＋數字 */
.pj-usage { flex-direction: row; align-items: center; gap: 20px; }
.pj-ring { position: relative; width: 116px; height: 116px; flex: none; }
.pj-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.pj-ring-track { fill: none; stroke: var(--track); stroke-width: 10; }
.pj-ring-bar { fill: none; stroke: var(--brand); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease-out), stroke .3s; }
.pj-ring.warn .pj-ring-bar { stroke: var(--warn-fill); }
.pj-ring.over .pj-ring-bar { stroke: var(--danger-fill); }
.pj-ring.done .pj-ring-bar { stroke: var(--mint); }
.pj-ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.pj-ring-c b { font-size: 26px; font-weight: 520; font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: -.01em; }
.pj-ring-c b small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.pj-ring.over .pj-ring-c b { color: var(--red); }
.pj-ring-c > span { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pj-usage-t { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pj-big { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pj-big small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.pj-line { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.pj-line svg { flex: none; color: var(--icon-muted); }
.pj-line.warn { color: var(--amber); }
.pj-line.warn svg, .pj-line.danger-text svg { color: currentColor; }

/* 下一次輔導：整塊可以點（打開派工） */
a.pj-next { color: inherit; text-decoration: none; transition: background .15s; }
a.pj-next:hover { background: var(--hover); color: inherit; }
a.pj-next:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pj-next-when { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.pj-next-when b { font-size: 17px; font-weight: 650; color: var(--ink); }
.pj-next-when span { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pj-k.live { color: var(--green); font-weight: 600; }
.pj-k.live svg { color: currentColor; }
.pj-next-who { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; color: var(--ink); min-width: 0; }
.pj-next-task { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.pj-next-loc { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
.pj-next-loc svg { flex: none; color: var(--icon-muted); }
.pj-next-loc span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 專案團隊 */
.pj-lead { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.pj-lead-t { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.pj-lead-t b { font-size: 15px; color: var(--ink); }
.pj-lead-t span { font-size: 12.5px; color: var(--muted); }
.pj-others { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pj-others-t { font-size: 13.5px; color: var(--ink-2); min-width: 0; line-height: 1.45; }
.pj-link {
  display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; margin-top: auto; padding: 4px 0 0;
  font: inherit; font-size: 13.5px; color: var(--brand); background: none; border: 0; cursor: pointer; border-radius: 6px;
}
.pj-link:hover { color: var(--brand-600); }

/* 四個關鍵數字（按下去切到對應頁籤） */
.pj-hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-2); background: var(--surface-2); }
.pj-stat {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; min-width: 0; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer; transition: background .15s;
}
.pj-stat + .pj-stat { border-left: 1px solid var(--line-2); }
button.pj-stat:hover { background: var(--hover); }
button.pj-stat:active { background: var(--press); }
button.pj-stat:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pj-stat.is-static { cursor: default; }
.pj-stat-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand); }
.pj-stat-ic svg { width: 18px; height: 18px; }
.pj-stat-ic.blue { background: var(--blue-bg); color: var(--blue); }
.pj-stat-ic.green { background: var(--green-bg); color: var(--green); }
.pj-stat-ic.amber { background: var(--amber-bg); color: var(--amber); }
.pj-stat-ic.red { background: var(--red-bg); color: var(--red); }
.pj-stat-ic.purple { background: var(--purple-bg); color: var(--purple); }
.pj-stat-ic.gray { background: var(--gray-bg); color: var(--gray); }
.pj-stat-t { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.pj-stat-v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.3; }
.pj-stat-v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.pj-stat-s { font-size: 12.5px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }

@container pj (max-width: 980px) {
  .pj-hero-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-usage { grid-column: 1 / -1; border-bottom: 1px solid var(--line-2); }
  .pj-hz + .pj-hz { border-left: 0; }
  .pj-next + .pj-team { border-left: 1px solid var(--line-2); }
}
@container pj (max-width: 760px) {
  .pj-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-stat:nth-child(odd) { border-left: 0; }
  .pj-stat:nth-child(n + 3) { border-top: 1px solid var(--line-2); }
}
@container pj (max-width: 560px) {
  .pj-health { padding: 12px 16px; }
  .pj-health-note { display: none; }
  .pj-hero-top { grid-template-columns: minmax(0, 1fr); }
  .pj-hz { padding: 16px; }
  .pj-next + .pj-team { border-left: 0; border-top: 1px solid var(--line-2); }
  .pj-usage { gap: 16px; }
  .pj-ring { width: 96px; height: 96px; }
  .pj-ring-c b { font-size: 22px; }
  .pj-big { font-size: 23px; }
  .pj-stat { padding: 13px 14px; gap: 10px; }
  .pj-stat-ic { width: 32px; height: 32px; border-radius: 9px; }
  .pj-stat-ic svg { width: 16px; height: 16px; }
  .pj-stat-v { font-size: 20px; }
}

/* ---------- 導入階段（project-stage.js） ---------- */
.pj-auto { font-size: 12.5px; line-height: 1.75; padding: 0 9px; border-radius: 999px; background: var(--gray-bg); color: var(--gray); white-space: nowrap; }
.pj-steps { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); }
.pj-steps > li { position: relative; min-width: 0; }
/* 步驟之間的連接線：已經走過的段落是藍色 */
.pj-steps > li + li::before {
  content: ""; position: absolute; top: 17px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 2px;
  border-radius: 2px; background: var(--line-strong);
}
.pj-steps > li.done + li::before { background: var(--brand); }
.pj-step {
  position: relative; z-index: 1; /* 圓點蓋在連接線上面 */
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 0 4px 2px; margin: 0;
  font: inherit; color: inherit; background: none; border: 0; text-align: center; border-radius: 10px;
}
button.pj-step { cursor: pointer; }
.pj-dot {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--muted);
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; transition: border-color .15s, background .15s, box-shadow .15s;
}
.pj-step-l { font-size: 13px; line-height: 1.4; color: var(--muted); text-wrap: balance; overflow-wrap: anywhere; }
.pj-steps > li.done .pj-dot { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); }
.pj-steps > li.done .pj-step-l { color: var(--ink-2); }
.pj-steps > li.on .pj-dot { border-color: var(--brand); color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 4px var(--brand-100); }
.pj-steps > li.on .pj-step-l { color: var(--ink); font-weight: 600; }
button.pj-step:hover .pj-dot { border-color: var(--brand); }
button.pj-step:hover .pj-step-l { color: var(--ink); }
.pj-stage-now {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 11px 14px; font-size: 14px; line-height: 1.6;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2);
}
.pj-stage-now b { color: var(--ink); }
.pj-now-tag { font-size: 12px; font-weight: 600; line-height: 1.75; padding: 0 8px; border-radius: 999px; background: var(--brand-50); color: var(--brand); }
.pj-now-tag.fin { background: var(--green-bg); color: var(--green); }
.pj-stage-note {
  display: flex; gap: 10px; margin-top: 10px; padding: 11px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--brand-50) 75%, var(--card)); border-left: 3px solid var(--brand);
}
.pj-stage-note > svg { flex: none; margin-top: 3px; color: var(--brand); }
.pj-stage-note.is-empty { background: var(--surface-2); border-left-color: var(--line-strong); }
.pj-stage-note.is-empty > svg { color: var(--icon-muted); }
.pj-note-k { display: block; font-size: 12.5px; color: var(--muted); }
.pj-stage-note p { margin: 2px 0 0; font-size: 14.5px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.pj-stage-note p.muted { color: var(--muted); font-size: 14px; }
.pj-stage-foot { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.pj-stage-foot svg { flex: none; margin-top: 2px; color: var(--icon-muted); }
/* 窄的時候改成直的路線圖 */
@container pj (max-width: 640px) {
  .pj-steps { grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
  /* 連接線剛好接上一個圓點的底和這個圓點的頂（圓點上下各留 4px、步驟之間 12px） */
  .pj-steps > li + li::before { top: -16px; bottom: auto; left: 17px; right: auto; width: 2px; height: 20px; }
  .pj-step { flex-direction: row; text-align: left; gap: 12px; padding: 4px 0; }
  .pj-steps > li + li { margin-top: 12px; }
  .pj-step-l { font-size: 14px; }
}

/* 設定階段的對話框 */
.pj-modal-lead { margin: 0 0 12px; }
.pj-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pj-opt {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s;
}
.pj-opt:hover { border-color: var(--line-strong); background: var(--hover); }
.pj-opt.on { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }
.pj-opt > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pj-opt:has(> input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.pj-opt-n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px;
  border: 1.5px solid var(--line-strong); font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface);
}
.pj-opt.on .pj-opt-n { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); }
.pj-opt-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.pj-opt-t b { font-size: 14.5px; color: var(--ink); }
.pj-opt-t span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.pj-note-field textarea { min-height: 86px; }

/* ---------- 動態時間軸（project-activity.js） ---------- */
.pj-act-bar { padding: 14px 20px 2px; overflow-x: auto; scrollbar-width: none; }
.pj-act-bar::-webkit-scrollbar { display: none; }
.pj-cats { white-space: nowrap; }
.pj-day { display: flex; align-items: center; gap: 8px; margin: 0; padding: 16px 20px 4px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.pj-day small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.pj-day::after { content: ""; flex: 1; height: 1px; background: var(--line-2); margin-left: 4px; }
.pj-tl { list-style: none; margin: 0; padding: 4px 20px 6px; }
.pj-ev { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 7px 0; }
/* 頭像之間的直線（同一天裡連起來） */
.pj-ev::before { content: ""; position: absolute; left: 16px; top: 46px; bottom: -6px; width: 2px; border-radius: 2px; background: var(--line-2); }
.pj-ev:last-child::before { display: none; }
.pj-ev-av { position: relative; width: 34px; height: 34px; display: grid; place-items: center; }
.pj-ev-sys { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.pj-ev-k { position: absolute; right: -6px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--card); }
.pj-ev-body { min-width: 0; padding-top: 5px; }
.pj-ev-text { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); overflow-wrap: anywhere; }
.pj-ev-text b { font-weight: 600; color: var(--ink); }
.pj-ev-link { color: inherit; text-decoration: none; border-radius: 4px; }
/* 整列都可以點（手機上手指好按）：連結的透明延伸蓋住這一則 */
.pj-ev-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 10px; }
.pj-ev-link:hover { color: var(--brand-600); }
.pj-ev-link:hover b { color: inherit; }
.pj-ev:has(.pj-ev-link:hover) .pj-ev-sub { color: var(--ink-2); }
.pj-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; line-height: 1.7; vertical-align: 1px; white-space: nowrap; background: var(--purple-bg); color: var(--purple); }
.pj-ev-sub { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pj-ev-time { padding-top: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* 小圖示的顏色：實心淡色（疊在頭像上也看得清楚） */
.pj-ev-k, .pj-ev-sys { background: color-mix(in srgb, var(--brand) 16%, var(--card)); color: var(--brand); }
.pjt-blue { background: color-mix(in srgb, var(--blue) 16%, var(--card)); color: var(--blue); }
.pjt-green { background: color-mix(in srgb, var(--green) 16%, var(--card)); color: var(--green); }
.pjt-amber { background: color-mix(in srgb, var(--amber) 18%, var(--card)); color: var(--amber); }
.pjt-red { background: color-mix(in srgb, var(--red) 16%, var(--card)); color: var(--red); }
.pjt-purple { background: color-mix(in srgb, var(--purple) 16%, var(--card)); color: var(--purple); }
.pjt-gray { background: color-mix(in srgb, var(--gray) 16%, var(--card)); color: var(--gray); }
.pjt-brand { background: color-mix(in srgb, var(--brand) 16%, var(--card)); color: var(--brand); }
.pj-act-foot { padding: 6px 20px 18px; text-align: center; }
.pj-act > .empty, .pj-act > .skel-list { margin: 0; }
/* 概況裡的精簡版（不用 .preview：finance.css 已經把它用在別的地方，會限制高度） */
.pj-act.pj-compact .pj-tl { padding: 8px 20px 12px; }
.pj-act.pj-compact .pj-ev { grid-template-columns: 30px minmax(0, 1fr) auto; }
.pj-act.pj-compact .pj-ev::before { left: 14px; top: 42px; }
.pj-act.pj-compact .pj-ev-av { width: 30px; height: 30px; }
.pj-act.pj-compact .pj-ev-sys { width: 30px; height: 30px; }
.pj-act.pj-compact .pj-ev-k { width: 16px; height: 16px; right: -6px; bottom: -4px; }
.pj-act.pj-compact .pj-ev-k svg { width: 10px; height: 10px; }
.pj-act.pj-compact .pj-ev-body { padding-top: 3px; }
.pj-act.pj-compact .pj-ev-time { padding-top: 5px; }
.pj-act.pj-compact .pj-day-sec + .pj-day-sec .pj-tl { padding-top: 0; }
/* 窄的時候：時間放到句子下面 */
@media (max-width: 640px) {
  .pj-act-bar { padding: 12px 14px 2px; }
  .pj-day { padding: 14px 14px 4px; }
  .pj-tl, .pj-act.pj-compact .pj-tl { padding-left: 14px; padding-right: 14px; }
  .pj-ev { grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; }
  .pj-act.pj-compact .pj-ev { grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; }
  .pj-ev-time { grid-column: 2; padding-top: 1px; font-size: 12px; }
  .pj-act-foot { padding: 6px 14px 16px; }
}

/* ---------- 週報頁籤（project-weekly.js）：上面選週；左邊是客戶會看到的內容（/client/weekly-doc.css），右邊寫本週重點、分享、歷史 ---------- */
.pw { display: flex; flex-direction: column; gap: 16px; container-type: inline-size; container-name: pw; }
.pw-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 16px; }
.pw-pick { display: flex; align-items: center; gap: 4px; }
.pw-range { min-width: 196px; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.35; }
.pw-range b { font-size: 16px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.pw-range span { font-size: 12.5px; color: var(--muted); min-height: 1.35em; }
.pw-pick .icon-btn:disabled { opacity: .35; }
.pw-st { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px 1px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.75; white-space: nowrap; }
.pw-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pw-st-shared { background: var(--green-bg); color: var(--green); }
.pw-st-draft { background: var(--amber-bg); color: var(--amber); }
.pw-st-none { background: var(--gray-bg); color: var(--gray); }
.pw-st.pw-st-sm { padding: 0 8px 0 7px; font-size: 12px; font-weight: 500; }
.pw-st.pw-st-sm::before { width: 6px; height: 6px; }

.pw-cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.pw-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pw-cap { display: flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 13.5px; color: var(--muted); }
.pw-cap svg { flex: none; color: var(--icon-muted); }
.pw-side { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.pw-shared { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; border-color: color-mix(in srgb, var(--green) 30%, var(--line)); }
.pw-shared-h { display: flex; align-items: center; gap: 12px; }
.pw-shared-ic { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--green-bg); color: var(--green); }
.pw-shared-h > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.pw-shared-h b { font-size: 15px; color: var(--ink); }
.pw-shared-h small { font-size: 13px; color: var(--muted); }
.pw-shared .notice { margin: 0; font-size: 13.5px; }

.pw-edit .card-h h3 label { font: inherit; color: inherit; cursor: pointer; }
.pw-edit .card-b { display: flex; flex-direction: column; gap: 10px; }
.pw-edit textarea { min-height: 168px; line-height: 1.75; }
.pw-count { margin-top: -4px; font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.pw-count.pw-full { color: var(--red); }
.pw-edit .notice { font-size: 13.5px; }
.pw-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.pw-acts .btn { flex: 1 1 auto; }
.pw-hint { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

.pw-n { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.pw-list { list-style: none; margin: 0; padding: 4px 0; max-height: 420px; overflow-y: auto; }
.pw-list li + li { border-top: 1px solid var(--line-2); }
.pw-list button {
  display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 10px 20px; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer; transition: background .12s;
}
.pw-list button:hover { background: var(--hover); }
.pw-list button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pw-list button.pw-on { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.pw-li-t { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.pw-li-t b { font-size: 14.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.pw-list small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.pw-list .pw-ex { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 內容區窄（側邊欄展開的小筆電、手機）：改成上下排，寫本週重點放在預覽上面 */
@container pw (max-width: 900px) {
  .pw-cols { grid-template-columns: minmax(0, 1fr); }
  .pw-side { display: contents; }
  .pw-shared { order: 1; }
  .pw-edit { order: 2; }
  .pw-main { order: 3; }
  .pw-hist { order: 4; }
}
@container pw (max-width: 560px) {
  .pw-bar { padding: 8px 10px; }
  .pw-pick { flex: 1 1 100%; justify-content: space-between; }
  .pw-range { min-width: 0; flex: 1; }
  .pw-pick .icon-btn { min-width: 44px; min-height: 44px; }
  .pw-bar .seg button, .pw-bar .btn-sm, .pw-shared .btn-sm { min-height: 40px; }
  .pw-acts .btn { min-height: 44px; }
}

/* ---------- 預覽客戶專區（client-preview.js，2026-12-02 第二輪巡檢 C2b）：唯讀視窗 ---------- */
.cpv { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cpv-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; }
.cpv-note svg { flex: none; margin-top: 3px; }
.cpv-head h3 { margin: 6px 0 2px; font-size: 19px; overflow-wrap: anywhere; }
.cpv-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 13.5px; }
.cpv-team { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 14px; }
.cpv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.cpv-stats > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-width: 0; }
.cpv-stats .l { font-size: 13px; color: var(--muted); }
.cpv-stats .v { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cpv-stats .v small { margin-left: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.cpv-sec h4, .cpv-tab h4 { margin: 0 0 8px; font-size: 15px; }
.cpv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cpv-list > li { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.cpv-list > li:last-child { border-bottom: 0; }
.cpv-list > li.cpv-row, .cpv-row { flex-direction: row; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cpv-road { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.cpv-road li.done { color: var(--ink-2); }
.cpv-road li.now { color: var(--ink); font-weight: 600; }
.cpv-next { display: flex; gap: 8px; margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--brand-50); }
.cpv-next b { flex: none; }
.cpv-tab { min-height: 120px; }

@media (prefers-reduced-motion: reduce) {
  .pj-ring-bar, .pj-dot, .pj-opt, a.pj-next, .pj-stat, .pw-list button { transition: none; }
}
