/* 主責顧問（專案經理）頁面（v1.5）：我負責的專案、健康燈號、提醒成員
   顏色一律用 /assets/base.css 的變數 */

/* ---------- 專案清單 ---------- */
/* 燈號統計：● 1 個有風險 ● 2 個要注意 */
.mg-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -2px 2px 0; }
.mg-sum-i { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.7; }
.mg-sum-i.h-risk { background: var(--red-bg); color: var(--red); }
.mg-sum-i.h-warn { background: var(--amber-bg); color: var(--amber); }
.mg-sum-i.h-ok { background: var(--green-bg); color: var(--green); }
.mg-sum-tip { font-size: 12.5px; color: var(--muted); margin-left: auto; }

/* 專案卡：上半部整塊點了進專案頁，下面是健康燈號與原因（原因各自是連結，所以不能整張卡片包在一個連結裡） */
.m-card.mg-card { padding: 0; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.mg-card:has(.mg-main:hover) { border-color: var(--brand-200); box-shadow: var(--shadow-md); }
.mg-card .mg-main { display: block; padding: 16px; color: inherit; text-decoration: none !important; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.mg-card .mg-main:only-child { border-radius: var(--radius-lg); }
.mg-card .mg-main:hover { color: inherit; }
.mg-card .mg-main:active { background: var(--hover); }
.mg-card .mg-main:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.mg-card .mg-health { padding: 11px 16px 14px; border-top: 1px solid var(--line-2); }
/* 有風險、要注意的卡片左邊一條色帶，往下滑時一眼看得出來 */
.mg-card.lv-risk { border-color: color-mix(in srgb, var(--red) 34%, var(--line)); box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.mg-card.lv-warn { box-shadow: inset 4px 0 0 var(--amber), var(--shadow); }
.mg-card.lv-risk:has(.mg-main:hover) { box-shadow: inset 4px 0 0 var(--red), var(--shadow-md); }
.mg-card.lv-warn:has(.mg-main:hover) { box-shadow: inset 4px 0 0 var(--amber), var(--shadow-md); }
.mg-card.lv-risk .mg-main, .mg-card.lv-warn .mg-main, .mg-card.lv-risk .mg-health, .mg-card.lv-warn .mg-health { padding-left: 19px; }
.mg-health .health, .mg-hl .health { display: flex; width: 100%; }
/* 正常：燈號旁邊說明「正常」是指哪些（手機上沒有滑鼠提示） */
.mg-health.ok { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.mg-health.ok .health { width: auto; }
.mg-ok-t { font-size: 13px; color: var(--muted); line-height: 1.5; }
/* 原因的連結：字只有一行高，往上下各延伸 10px，手指好按（不改變版面） */
.mg-health .h-reasons a, .mg-hl .h-reasons a { position: relative; }
.mg-health .h-reasons a::after, .mg-hl .h-reasons a::after { content: ""; position: absolute; inset: -10px -4px; }

/* ---------- 專案進度 ---------- */
.mg-detail { display: flex; flex-direction: column; gap: 14px; }
#mg-tabs, #mg-follow, #mg-roadmap { scroll-margin-top: calc(70px + env(safe-area-inset-top)); }

/* 頂端卡片裡的健康燈號 */
.mg-hl { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.mg-hl-k { font-size: 13px; color: var(--muted); }

/* 數字卡點了切到對應的分頁 */
.mg-detail .m-stat { cursor: pointer; }
.mg-detail .m-stat:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 卡片標題列（需要跟進、導入路線圖）：圖示＋標題＋說明＋右邊的按鈕 */
.mg-head { display: flex; align-items: flex-start; gap: 12px; }
.mg-head-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.mg-head-ic.amber { background: var(--amber-bg); color: var(--amber); }
.mg-head-t { flex: 1; min-width: 0; }
.mg-head-t h2 { margin: 0; font-size: 16.5px; font-weight: 600; color: var(--ink); line-height: 1.4; display: flex; align-items: center; gap: 8px; }
.mg-head-t p { margin: 2px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.mg-head > .btn { flex: none; align-self: center; }
.mg-n { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }

/* ---------- 需要跟進（提醒成員） ---------- */
.mg-fg { margin-top: 14px; }
.mg-fg + .mg-fg { padding-top: 14px; border-top: 1px dashed var(--line); }
.mg-fg-h { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; }
.mg-fg-t { display: flex; flex-direction: column; min-width: 0; }
.mg-fg-t b { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.mg-fg-t small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.m-shell .mg-all { flex: none; color: var(--brand); }
.mg-fl { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-fi { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.mg-fi-b { flex: 1; min-width: 0; }
.mg-fi-t { font-weight: 600; color: var(--ink); line-height: 1.45; overflow-wrap: anywhere; }
.mg-fi-s { font-size: 13px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.mg-fi > .btn, .mg-fi > .mg-done, .mg-fi > .mg-fi-na { flex: none; }
.m-shell .mg-remind { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); font-weight: 600; }
.m-shell .mg-remind:hover:not(:disabled) { background: var(--brand-100); border-color: var(--brand-200); color: var(--brand-700); }
.mg-done { display: inline-flex; align-items: center; gap: 4px; max-width: 8.5em; font-size: 13px; font-weight: 500; color: var(--green); line-height: 1.35; text-align: right; }
.mg-done svg { flex: none; }
.mg-fi-na { font-size: 13px; color: var(--muted); }
.mg-more {
  display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 40px; margin-top: 6px; padding: 6px;
  border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--brand); cursor: pointer;
}
.mg-more:hover { background: var(--hover); }

/* ---------- 導入路線圖 ---------- */
.mg-steps { list-style: none; margin: 16px 0 0; padding: 0; }
.mg-steps li { position: relative; display: flex; gap: 12px; padding-bottom: 14px; }
.mg-steps li:last-child { padding-bottom: 0; }
/* 圓點之間的直線（從這一點的下緣連到下一點）：已走過的是綠色 */
.mg-steps li::before { content: ""; position: absolute; left: 12px; top: 24px; bottom: 0; width: 2px; margin-left: -1px; background: var(--line); }
.mg-steps li:last-child::before { display: none; }
.mg-steps li.is-done::before { background: var(--mint); }
.mg-dot {
  position: relative; z-index: 1; flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.mg-steps .is-done .mg-dot { background: var(--mint); border-color: var(--mint); color: var(--card); }
.mg-steps .is-now .mg-dot { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); box-shadow: 0 0 0 4px var(--brand-100); }
.mg-steps .is-done.is-now .mg-dot { background: var(--mint); border-color: var(--mint); color: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 24%, transparent); }
.mg-step-b { flex: 1; min-width: 0; padding-top: 1px; }
.mg-step-t { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.mg-steps .is-todo .mg-step-t { color: var(--muted); }
.mg-steps .is-now .mg-step-t { color: var(--brand); font-weight: 600; }
.mg-steps .is-done.is-now .mg-step-t { color: var(--green); }
.mg-tag { padding: 0 7px; border-radius: 6px; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 600; line-height: 1.75; white-space: nowrap; }
.mg-steps .is-done.is-now .mg-tag { background: var(--green-bg); color: var(--green); }
.mg-step-d { margin: 2px 0 0; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.mg-next { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 11px 12px; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.mg-next.is-empty { background: var(--surface-2); border-style: dashed; border-color: var(--line); }
.mg-next-ic { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); color: var(--brand); }
.mg-next-b { flex: 1; min-width: 0; }
.mg-next-b .k { display: block; font-size: 12.5px; font-weight: 600; color: var(--brand); letter-spacing: .02em; }
.mg-next.is-empty .mg-next-b .k { color: var(--ink-2); }
.mg-next-b p { margin: 2px 0 0; font-size: 14px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.mg-next.is-empty .mg-next-b p { font-size: 13px; color: var(--muted); }
.mg-road-foot { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.mg-road-foot svg { flex: none; margin-top: 3px; }

/* 「更新階段」面板：一個階段一列（點整列就選取） */
.mg-opts { display: flex; flex-direction: column; gap: 6px; }
.mg-opt {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 9px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, background .15s;
}
.mg-opt:hover { border-color: var(--brand-200); }
.mg-opt.on { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }
.mg-opt:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.mg-opt-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.mg-opt.on .mg-opt-n { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); }
.mg-opt-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mg-opt-t b { font-size: 14.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mg-opt-t small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.mg-opt-now { padding: 0 6px; border-radius: 6px; background: var(--track); color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 1.7; }

/* 專案週報入口 */
.m-linkcard.mg-weekly .mg-weekly-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-50); color: var(--brand); }

/* 分頁（紀錄／結案／派工／成員／動態）：五格要擠得下 */
.m-seg.mg-tabs button { padding-left: 2px; padding-right: 2px; white-space: nowrap; }
.m-seg.mg-tabs .seg-n { margin-left: 3px; }
html.fs-xl .m-seg.mg-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25; }
html.fs-xl .m-seg.mg-tabs .seg-n { margin: 2px 0 0; }
.mg-tab-tip { margin: -4px 4px -6px; line-height: 1.6; }
.todo-item .ti-sub.mg-late { color: var(--amber); }
/* 結案資料：「列印交付清單」靠右；客戶已簽收的寫綠色（v1.6） */
.mg-dl-bar { flex-wrap: wrap; }
.mg-dl-bar .mg-dl-print { margin-left: auto; }
.todo-item .ti-sub.ok-text { color: var(--green); }

/* ---------- 專案動態 ---------- */
.mg-act { padding: 6px 14px 14px; }
.mg-act .skel-list { padding: 8px 0; }
.mg-day-sec + .mg-day-sec { margin-top: 4px; }
.mg-day { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.mg-day small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.mg-tl { list-style: none; margin: 0; padding: 0; }
.mg-ev { position: relative; display: flex; align-items: flex-start; gap: 10px; margin: 0 -8px; padding: 9px 8px; border-radius: 10px; }
/* 頭像之間的直線 */
.mg-ev + .mg-ev::before { content: ""; position: absolute; left: 24px; top: -10px; height: 18px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--line-2); }
.mg-ev-av { position: relative; flex: none; width: 32px; height: 32px; }
.mg-ev-sys { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.mg-ev-k { position: absolute; right: -7px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--card); }
.mg-t-blue { background: var(--blue-bg); color: var(--blue); }
.mg-t-green { background: var(--green-bg); color: var(--green); }
.mg-t-amber { background: var(--amber-bg); color: var(--amber); }
.mg-t-red { background: var(--red-bg); color: var(--red); }
.mg-t-purple { background: var(--purple-bg); color: var(--purple); }
.mg-t-brand { background: var(--brand-50); color: var(--brand); }
.mg-t-gray { background: var(--gray-bg); color: var(--gray); }
.mg-ev-b { flex: 1; min-width: 0; }
.mg-ev-text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.mg-ev-text b { color: var(--ink); font-weight: 600; }
.mg-ev-link { color: inherit; text-decoration: none; }
/* 整列都可以點（頭像、時間也算），手機上好按 */
.mg-ev-link::after { content: ""; position: absolute; inset: 0; }
.mg-ev:has(.mg-ev-link):active { background: var(--hover); }
.mg-ev-link:focus-visible { outline: none; }
.mg-ev:has(.mg-ev-link:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }
.mg-ev-link:hover { color: var(--brand); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.mg-ev-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--green-bg); color: var(--green); font-size: 11.5px; font-weight: 600; line-height: 1.7; vertical-align: 1px; }
.mg-ev-sub { margin: 2px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.mg-ev-time { flex: none; padding-top: 2px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mg-act-foot { display: flex; justify-content: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }

@media (prefers-reduced-motion: reduce) {
  .m-card.mg-card, .mg-opt { transition: none; }
}

/* 顧問總控台（v1.11）：資安治理平台的燈號統計，以及每張專案卡裡的一行燈號 */
.grc-sum { padding: 14px 16px; }
.mg-card .grc-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.grc-line b { padding: 1px 9px; border-radius: 999px; font-weight: 500; background: var(--line-2); }
.grc-line.gl-red b { background: var(--red-bg); color: var(--red); }
.grc-line.gl-amber b { background: var(--amber-bg); color: var(--amber); }
.grc-line.gl-green b { background: var(--green-bg); color: var(--green); }
