/* 後台：老闆晨報、審核模式、月結一頁完成（v1.1）
   顏色只有兩種意思：紅、橘＝有風險要處理；藍、灰＝一般待辦或商機（續約、詢問不是風險，也不用綠色） */

/* ===================================================================== 共用小標籤 */
.dchip {
  display: inline-flex; align-items: center; max-width: 100%; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--gray-bg); color: var(--gray);
}
.dchip.warn { background: var(--amber-bg); color: var(--amber); }
.dchip.risk { background: var(--red-bg); color: var(--red); }
.dchip.info { background: var(--blue-bg); color: var(--blue); }
.dchip.ok { background: var(--green-bg); color: var(--green); }
.dchips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }

/* ===================================================================== 老闆晨報 */
.morning { display: flex; flex-direction: column; gap: 18px; }
.money-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.money-tile .value { font-size: 25px; }
.money-tile .small { line-height: 1.5; }
/* 右欄 368px：本週派工的「時間｜頭像＋顧問｜客戶簡稱｜未確認」放得下，客戶名稱不會被截成「台北精密…」 */
.morning-grid { display: grid; grid-template-columns: minmax(0, 1fr) 368px; gap: 18px; align-items: start; }
.morning-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1100px) {
  .money-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .morning-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .morning { gap: 14px; }
  .money-strip { gap: 10px; }
  .money-tile { padding: 12px 14px; }
  .money-tile .value { font-size: 19px; }
  .money-tile .label { font-size: 12.5px; }
  .money-tile .small { font-size: 12px; }
  .morning-grid, .morning-side { gap: 14px; }
}

/* ---------- 今天要做的決定 ---------- */
.decide .dsec { border-top: 1px solid var(--line); }
.decide .dsec:first-of-type { border-top: 0; }
.decide .dsec-h { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 20px 4px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.decide .dsec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--icon-muted); flex: none; }
.decide .dsec-t { min-width: 0; }
.decide .dsec-n { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: 0 8px; line-height: 20px; flex: none; }
.decide .tone-risk > .dsec-h { color: var(--red); }
.decide .tone-risk > .dsec-h .dsec-dot { background: var(--danger-fill); }
.decide .tone-warn > .dsec-h { color: var(--amber); }
.decide .tone-warn > .dsec-h .dsec-dot { background: var(--warn-fill); }
.decide .tone-info > .dsec-h .dsec-dot { background: var(--brand); }
.decide .dsec-head-act {
  margin-left: auto; font: inherit; font-size: 13px; font-weight: 500; color: var(--brand); background: none; border: 0;
  padding: 3px 6px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.decide .dsec-head-act:hover { background: var(--brand-50); }
.decide .drow { padding: 10px 20px; border-top: 0; position: relative; }
.decide .drow + .drow { border-top: 1px solid var(--line-2); }
.decide .drow.tone-risk { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--danger-fill) 70%, transparent); }
.decide .drow.tone-warn { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--warn-fill) 75%, transparent); }
.decide .drow .t > span:not(.dchips) { display: block; }
.decide .t .dchips { margin-top: 5px; }
.decide .t .dchip { font-size: 12px; color: var(--gray); }
.decide .t .dchip.warn { color: var(--amber); }
.decide .t .dchip.risk { color: var(--red); }
.decide .t .dchip.info { color: var(--blue); }
.decide .t .dchip.hint { white-space: normal; text-overflow: clip; line-height: 1.5; padding-top: 1px; padding-bottom: 1px; border-radius: 8px; }
/* 每類先列 3 筆，其餘按「顯示其餘 N 項」展開（伺服器只送前幾十筆，再多的到該頁面看） */
.decide .dsec-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 2px 14px 10px; border-top: 1px solid var(--line-2); }
.decide .dsec-more {
  display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 4px 8px; margin: 0; border-radius: 8px;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--brand); background: none; border: 0; cursor: pointer; text-decoration: none;
}
.decide .dsec-more:hover { color: var(--brand-600); background: var(--brand-50); }
.decide .dsec-more:focus-visible { outline-offset: 0; }
.decide .dsec-all { margin-left: auto; font-size: 13px; color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 8px; }
.decide .dsec-all:hover { color: var(--brand); background: var(--brand-50); }
.decide .drow.extra { animation: drow-in .2s var(--ease-out) backwards; }
@keyframes drow-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .decide .drow.extra { animation: none; } }
.decide .dsec:last-child .drow:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 640px) {
  .decide .dsec-h { padding: 12px 14px 2px; flex-wrap: wrap; }
  .decide .dsec-head-act { margin-left: 0; padding-left: 0; flex-basis: 100%; text-align: left; }
  .decide .drow { padding: 10px 14px; }
  .decide .dsec-foot { padding: 2px 8px 8px; }
  .decide .dsec-more { min-height: 40px; }
}

/* 數字卡：右上角的小圖示（應收藍、逾期紅、已收綠、顧問費紫） */
.money-tile .stat-ic { top: 14px; right: 14px; }
@media (max-width: 640px) {
  .money-tile .stat-ic { top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 8px; }
  .money-tile .stat-ic svg { width: 15px; height: 15px; }
  .money-tile:has(> .stat-ic) > .label { padding-right: 32px; }
}

/* 本月顧問時數：頭像＋名字、長條、時數 */
.hrs-list { gap: 10px; }
.hrs-name { flex: none; width: 92px; display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.hrs-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hrs-val { flex: none; width: 58px; }
/* 今天要做的決定：「某位顧問的事」每一列前面放那位顧問的頭像 */
.todo-item .drow-av { flex: none; align-self: flex-start; width: 32px; height: 32px; margin-top: 2px; }
.todo-item span.drow-av svg { color: var(--av7-fg); }
@media (max-width: 640px) {
  .todo-item .drow-av { width: 30px; height: 30px; margin-top: 1px; }
  /* 按鈕列換到下一行時（有兩個按鈕或主要按鈕，見本檔最後），和文字（頭像右邊）對齊 */
  .decide .drow.has-av:has(> .acts > .btn:nth-child(2)) > .acts,
  .decide .drow.has-av:has(> .acts > .btn-primary) > .acts { padding-left: 40px; }
}

/* 桌機：右欄（本週派工、本月顧問時數）比畫面矮時固定在頂端列下方，往下捲決策清單時一直看得到 */
@media (min-width: 1101px) {
  .morning-side.stick { position: sticky; top: 82px; }
}

/* ---------- 本週派工 ---------- */
.wk-list { display: flex; flex-direction: column; }
.wk-day { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line-2); }
.wk-day:first-child { border-top: 0; }
.wk-day.today .wk-label b { color: var(--brand); }
.wk-label { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.wk-label b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.wk-label span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.wk-items { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wk-item { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--ink); text-decoration: none; line-height: 1.45; }
.wk-item:hover { color: var(--brand); }
.wk-time { flex: none; width: 40px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.wk-who { flex: none; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.wk-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.wk-st { flex: none; font-size: 12px; color: var(--muted); }
.wk-none { font-size: 13px; color: var(--placeholder); line-height: 1.45; }
@media (max-width: 640px) { .wk-day { padding: 10px 16px; grid-template-columns: 68px minmax(0, 1fr); } }

/* ===================================================================== 審核模式 */
.review { display: flex; flex-direction: column; }
.rv-top { margin-bottom: 14px; }
.rv-tabs button { padding: 8px 12px; }
.rv-progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.rv-progress b { font-variant-numeric: tabular-nums; color: var(--ink); }
.rv-progress .progress { width: 120px; min-width: 0; }
.rv-filter { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; }
.rv-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: calc(100dvh - 222px); min-height: 520px; }
.rv-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.rv-item {
  display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 12px;
  background: none; font: inherit; text-align: left; color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s;
}
.rv-item:hover { background: var(--hover); }
.rv-item.on { background: var(--brand-50); border-color: var(--brand-200); }
.rv-item-t { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; }
.rv-item-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rv-item-t > span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rv-item-t .rv-amt { margin-left: auto; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.rv-item-s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-item .dchips { margin-top: 2px; }
.rv-item .dchip { max-width: 100%; }
/* 清單每一筆左邊是送審人的頭像（公司支出、未指派：灰色小圖示），右邊是內容 */
.rv-item.has-av { flex-direction: row; align-items: flex-start; gap: 10px; }
.rv-item-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rv-av { flex: none; width: 32px; height: 32px; margin-top: 1px; }
span.rv-av svg, .rv-av-lg svg { color: var(--av7-fg); }
/* 明細標題：大頭像＋姓名・客戶 */
.rv-title-av { display: flex; align-items: center; gap: 12px; }
.rv-title-av > div { min-width: 0; }
.rv-av-lg { flex: none; width: 40px; height: 40px; }
/* 這次審完一批：打勾動畫在上、說明在下 */
.rv-done-tick { display: flex; justify-content: center; padding-top: 44px; }
.rv-done.ticked .empty { padding-top: 14px; }
.rv-done.ticked .empty-ic { display: none; }

.rv-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.rv-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; transition: opacity .12s; }
.rv-body.stale { opacity: .45; pointer-events: none; }
.rv-title h2 { font-size: 19px; overflow-wrap: anywhere; }
.rv-title .small { margin-top: 2px; }
.rv-checks { gap: 6px; }
.rv-checks .dchip { font-size: 12.5px; line-height: 24px; padding: 0 10px; white-space: normal; text-overflow: clip; }
.rv-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--hover); border: 1px solid var(--line-2); }
.rv-box .money-input { width: 170px; }
.rv-exp { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.rv-receipt { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rv-receipt-main {
  position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--sunken); cursor: zoom-in;
}
.rv-receipt-main img { display: block; width: 100%; max-height: 460px; object-fit: contain; background: var(--sunken); }
/* 疊在收據照片上的半透明深色小標：兩種模式都一樣（照片本身不分深淺色） */
.rv-zoom-hint {
  position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  background: rgba(27, 35, 51, .62); color: #fff; font-size: 12px;
}
.rv-pdf { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rv-pdf iframe, .rv-preview iframe { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rv-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.rv-thumbs button {
  width: 54px; height: 54px; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface-2);
  cursor: pointer; font: inherit; font-size: 11px; color: var(--ink-2);
}
.rv-thumbs button.on { border-color: var(--brand); box-shadow: var(--ring); }
.rv-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rv-kv { grid-template-columns: 80px minmax(0, 1fr); }
.rv-files { display: flex; flex-direction: column; gap: 6px; }
.rv-file { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.rv-file > svg { flex: none; color: var(--muted); }
.rv-file-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.rv-file-t b { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-preview img { max-width: 100%; max-height: 460px; border: 1px solid var(--line); border-radius: 12px; cursor: zoom-in; display: block; }
/* 結案資料檔案裡出現其他客戶（2026-12-02 第二輪巡檢 C7e）：檔案下方列出是哪一家、出現在哪裡；核准按鈕上方一行提醒 */
.rv-xc { margin: 0; font-size: 13.5px; line-height: 1.55; }
.rv-xc ul { margin: 4px 0 0; padding-left: 20px; }
.rv-xc li + li { margin-top: 4px; }
.rv-xc .small { overflow-wrap: anywhere; }
.rv-xc-bar { margin: 0; font-size: 13.5px; line-height: 1.5; }
.rv-actbar { flex: none; border-top: 1px solid var(--line-2); background: var(--surface-2); padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.rv-reason { display: flex; flex-direction: column; gap: 8px; }
.rv-reason .chip-pick button { font-size: 12.5px; padding: 3px 11px; }
.rv-btns { display: flex; align-items: center; gap: 10px; }
.rv-btns .grow { flex: 1; }
.rv-btns .btn-success { min-width: 120px; }
.rv-keys { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rv-keys kbd {
  font: 500 11px/1.2 var(--font); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 6px; margin-left: 8px;
}
.rv-keys kbd + kbd { margin-left: 2px; }
@media (hover: none) { .rv-keys { display: none; } }
.rv-done .empty { padding: 56px 20px; }
.rv-done-acts { justify-content: center; margin-top: 14px; }
.rv-mhead { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 6px; padding-top: calc(8px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line-2); background: var(--card); }
.rv-mhead .grow { flex: 1; }
/* 放大看收據：深色半透明底（兩種模式一樣）；收據圖片維持白底，透明背景的收據才看得清楚 */
.rv-zoom {
  position: fixed; inset: 0; z-index: 120; background: rgba(15, 20, 30, .86); display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto; cursor: zoom-out; animation: fade-in .15s ease-out;
}
.rv-zoom img { max-width: none; max-height: none; width: auto; height: auto; min-width: min(100%, 520px); border-radius: 6px; background: #fff; box-shadow: var(--shadow-lg); }
.rv-zoom-x { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; background: rgba(0, 0, 0, .4); padding: 3px 12px; border-radius: 999px; }

/* 桌機筆電：清單窄一點；收據與欄位改上下排 */
@media (max-width: 1280px) {
  .rv-split { grid-template-columns: 270px minmax(0, 1fr); }
  .rv-exp { grid-template-columns: minmax(0, 1fr); }
}
/* 平板、手機：先看清單，點進去全螢幕明細，下方固定按鈕 */
@media (max-width: 960px) {
  .rv-split { display: block; height: auto; min-height: 0; }
  .rv-list { overflow: visible; padding: 4px; }
  .rv-item { padding: 12px; }
  .rv-detail.rv-full {
    position: fixed; inset: 0; z-index: 60; border-radius: 0; border: 0; box-shadow: none;
    height: 100dvh; animation: fade-in .15s ease-out;
  }
  .rv-body { padding: 16px; }
  .rv-actbar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px -8px var(--scroll-shadow); }
  .rv-btns .btn { flex: 1; min-height: 46px; font-size: 15px; }
  .rv-btns .grow { display: none; }
  .rv-progress .progress { width: 64px; }
  .rv-pdf iframe, .rv-preview iframe { height: 60vh; }
}
@media (max-width: 640px) {
  .rv-top { gap: 6px; }
  .rv-top .rv-tabs { order: 1; width: 100%; }
  .rv-top .grow { display: none; }
  .rv-progress { order: 2; }
  .rv-top > .btn { order: 3; margin-left: auto; }
}
body:has(.rv-full) { overflow: hidden; }
/* 大字模式（整個後台放大 --fs-zoom 倍）：用畫面高度算的區塊要除以放大倍數，核准／退回按鈕才不會被擠到畫面外 */
html:is(.fs-l, .fs-xl) .rv-split { height: calc(100dvh / var(--fs-zoom) - 222px); min-height: calc(520px / var(--fs-zoom)); }
@media (max-width: 960px) {
  html:is(.fs-l, .fs-xl) .rv-split { height: auto; min-height: 0; }
  /* 手機全螢幕明細掛在 <body> 下（不在放大的版面裡）：自己放大，高度換算回整個畫面 */
  html:is(.fs-l, .fs-xl) .rv-detail.rv-full { zoom: var(--fs-zoom); height: calc(100dvh / var(--fs-zoom)); }
}
/* 手機全螢幕審核時，提示訊息（含「復原」）改到上方，不要蓋住下面的核准／退回 */
@media (max-width: 640px) {
  body:has(.rv-full) #toast-box { --toast-dy: -10px; top: calc(env(safe-area-inset-top) + 58px); bottom: auto; }
}

/* ===================================================================== 各審核頁的小東西 */
.rec-hint { margin-top: 4px; }
.foot-left { display: inline-flex; align-items: center; gap: 8px; }
.toolbar > .grow { flex: 1; min-width: 0; }
.btn .count-pill { margin-left: 2px; }

/* ===================================================================== 月結一頁完成 */
.mc-top { gap: 12px; flex-wrap: wrap; }
.mc-progress { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 0 20px 14px; }
.mc-status { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.mc-status.warn { color: var(--amber); }
.mc-status.info { color: var(--brand); }
.mc-status.ok { color: var(--green); }
.mc-bar { display: flex; gap: 4px; flex: 1; min-width: 160px; max-width: 360px; margin-left: auto; }
.mc-bar i { flex: 1; height: 6px; border-radius: 999px; background: var(--line); }
.mc-bar i.done { background: var(--mint); }
.mc-bar i.todo { background: color-mix(in srgb, var(--warn-fill) 62%, var(--card)); }
.mc-steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
.mc-step { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.mc-step:last-child { border-bottom: 0; }
.mc-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px;
  font-size: 13px; font-weight: 600; background: var(--line-2); color: var(--ink-2);
}
.mc-step.done .mc-no { background: var(--green-bg); color: var(--green); }
.mc-step.todo .mc-no { background: var(--amber-bg); color: var(--amber); }
.mc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mc-step-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-height: 26px; }
.mc-step-h b { font-size: 14.5px; font-weight: 600; }
.mc-sum { font-size: 13px; color: var(--muted); }
.mc-sum.warn { color: var(--amber); font-weight: 600; }
.mc-step.done .mc-sum { color: var(--green); }
.mc-link { font: inherit; font-size: 13px; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; }
.mc-link:hover { text-decoration: underline; }
.mc-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mc-items li { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; line-height: 1.6; min-width: 0; }
.mc-items li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--warn-fill); transform: translateY(-2px); }
.mc-items li.note::before { background: var(--icon-muted); }
.mc-items li:has(> .mc-link)::before { visibility: hidden; }
.mc-items a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.mc-items a:hover { color: var(--brand); }
.mc-items a .mc-arr { color: var(--brand); margin-left: 6px; }
.mc-items li.note, .mc-items li.note a { color: var(--ink-2); }
.mc-items .dchip { flex: none; }
.mc-close { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-close .input { flex: 1; min-width: 200px; max-width: 420px; }
/* 伺服器不讓月結（總帳還沒跟上）：原因＋「入帳到總帳」按鈕 */
.mc-close-block { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.mc-close-block > span { flex: 1; min-width: 220px; }
.mc-explain { padding: 0 20px 14px; }
@media (max-width: 640px) {
  .mc-progress { padding: 0 16px 12px; }
  .mc-bar { margin-left: 0; max-width: none; flex-basis: 100%; }
  .mc-step { padding: 12px 16px; gap: 10px; }
  .mc-close .input { min-width: 0; flex-basis: 100%; max-width: none; }
  .mc-close .btn { flex: 1; min-height: 40px; }
  .mc-explain { padding: 0 16px 12px; }
}
/* 手機：只有一個「查看」這類次要按鈕的列，按鈕放在右邊就好，不用整排大按鈕（列表比較短，一眼看得完） */
@media (max-width: 640px) {
  .decide .drow { flex-wrap: nowrap; align-items: center; }
  .decide .drow .acts:has(> .btn:only-child:not(.btn-primary)) { width: auto; }
  .decide .drow .acts:has(> .btn:only-child:not(.btn-primary)) .btn { flex: none; padding: 7px 12px; }
  .decide .drow:has(> .acts > .btn:nth-child(2)), .decide .drow:has(> .acts > .btn-primary) { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .mc-top > .grow { flex-basis: 100%; }
  .mc-top > .btn { flex: 1 1 auto; }
}

/* ===================================================================== 本月目標（v1.5）
   進度條：長條＝已達成目標的比例；直線＝照時間進度，今天應該到的位置。長條超過直線＝綠色（超前），還沒到＝橘色（落後） */
.goals { display: flex; flex-direction: column; }
.goal { display: flex; flex-direction: column; gap: 5px; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.goal:first-child { border-top: 0; }
.goal-h { display: flex; align-items: baseline; gap: 8px; }
.goal-l { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.goal-pct { font-size: 13.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.goal-v { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.goal-v b { font-size: 21px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.goal-v span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-bar { position: relative; height: 10px; margin: 5px 0 3px; border-radius: 999px; background: var(--track); }
.goal-fill { position: absolute; left: 0; top: 0; bottom: 0; max-width: 100%; border-radius: 999px; background: var(--warn-fill); transition: width .5s var(--ease-out); }
.goal.ahead .goal-fill { background: var(--mint); }
.goal-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink-2); }
.goal-proj { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.goal-proj .dchip { white-space: normal; }
.goal-add { padding: 0 18px 2px; font-size: 13px; }
.goal-add a { display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; }
.goals-explain { padding: 6px 18px 14px; }
.goals-empty { display: flex; align-items: flex-start; gap: 12px; }
.goals-ic { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.goals-empty-b { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.goals-empty-b b { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.goals-empty-b span { font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.goals-empty-b .btn { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .goal-fill { transition: none; } }

/* ===================================================================== 每週經營摘要（v1.5）
   一句話摘要＋八個數字（各自和前一週比，增減小標籤的樣式在 /assets/charts.js）；右欄窄時兩欄，列印時四欄 */
.wsum-h h3 { display: flex; flex-direction: column; gap: 1px; }
.wsum-range { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.wsum-nav { display: flex; gap: 2px; flex: none; }
.wsum-b { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 14px; transition: opacity .15s; }
.wsum-b.stale { opacity: .5; }
.wsum-say { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--brand-50); color: var(--ink); font-size: 14px; line-height: 1.7; }
.wsum-say > svg { flex: none; margin-top: 4px; color: var(--brand); }
.wsum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 8px; }
.wsum-cell {
  display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--card); color: var(--ink); text-decoration: none; transition: border-color .12s, background .12s;
}
a.wsum-cell:hover { border-color: var(--brand-200); background: var(--hover); color: var(--ink); }
.wsum-l { font-size: 12.5px; color: var(--muted); }
.wsum-l small { margin-left: 4px; font-size: 11.5px; color: var(--placeholder); }
.wsum-v { font-size: 17px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wsum-cell .ch-trend { margin: 2px 0 0; font-size: 12px; gap: 2px 5px; }
.wsum-x { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsum-risk { display: flex; flex-direction: column; gap: 2px; }
.wsum-risk-h { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.wsum-risk-h span { font-weight: 400; color: var(--muted); }
.wsum-risk-row { display: flex; align-items: flex-start; gap: 9px; margin: 0 -8px; padding: 6px 8px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.wsum-risk-row:hover { background: var(--hover); color: var(--ink); }
.wsum-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
.wsum-risk-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.wsum-risk-t b { font-size: 13.5px; font-weight: 600; }
.wsum-risk-t span { font-size: 12.5px; color: var(--muted); }
.wsum-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.wsum-print-head { display: none; }
@media (max-width: 640px) {
  .wsum-b { padding: 12px 14px; }
  .wsum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wsum-nav .btn { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .wsum-b { transition: none; } }

/* 列印「每週經營摘要」：按卡片上的列印鈕時 <html> 加上 print-wsum，只印這張卡——A4 直式、淺色（base.css 的深色只在螢幕上）、四欄數字 */
@page wsum { size: A4 portrait; margin: 14mm 14mm 16mm; }
@media print {
  html.print-wsum body { background: var(--card); }
  html.print-wsum .layout { display: block; min-height: 0; zoom: 1 !important; }
  html.print-wsum .layout > .main { display: block; }
  html.print-wsum :is(.side, .side-mask, .topbar, .acct-banner, .demo-banner, #toast-box) { display: none !important; }
  html.print-wsum .content { padding: 0; max-width: none; }
  html.print-wsum .content > * { animation: none !important; }
  html.print-wsum .morning > :not(.morning-grid),
  html.print-wsum .morning-grid > :not(.morning-side),
  html.print-wsum .morning-side > :not(.wsum) { display: none !important; }
  html.print-wsum :is(.morning, .morning-grid, .morning-side) { display: block; position: static; }
  html.print-wsum .wsum { page: wsum; border: 0; border-radius: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html.print-wsum .wsum-print-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 14px; padding: 0 0 9px; border-bottom: 1.5px solid var(--ink); }
  html.print-wsum .wsum-print-head > div { display: flex; flex-direction: column; gap: 1px; }
  html.print-wsum .wsum-print-head > div:first-child b { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
  html.print-wsum .wsum-print-head > div:first-child span { font-size: 20px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
  html.print-wsum .wsum-print-head > div:last-child { align-items: flex-end; font-size: 12px; color: var(--ink-2); text-align: right; }
  html.print-wsum .wsum-h { display: none; }
  html.print-wsum .wsum-b { padding: 0; gap: 14px; opacity: 1; }
  html.print-wsum .wsum-say { font-size: 14.5px; border: 1px solid var(--brand-100); }
  html.print-wsum .wsum-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  html.print-wsum .wsum-cell { border-color: var(--line-strong); break-inside: avoid; }
  html.print-wsum .wsum-x { white-space: normal; }
  html.print-wsum .wsum-foot .btn { display: none !important; }
  html.print-wsum .wsum details.explain > summary { color: var(--ink-2); font-weight: 600; }
  html.print-wsum .wsum details.explain > summary::before { display: none; }
}

/* ===================================================================== 手機的老闆首頁（v1.5）
   總覽在手機上改成一張張大卡片：每一列至少 56px 高、整列都可以點；最下面「看完整總覽」 */
.boss { display: flex; flex-direction: column; gap: 12px; }
.boss-hi { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
.boss-hi b { font-size: 19px; font-weight: 560; color: var(--ink); }
.boss-hi span { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.boss-sec { overflow: hidden; }
.boss-h { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 8px 2px 16px; }
.boss-h h3 { font-size: 15.5px; font-weight: 600; white-space: nowrap; }
.boss-n { font-size: 13px; color: var(--muted); min-width: 0; }
.boss-more {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: auto; padding: 0 8px 0 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--brand); text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.boss-more:active { background: var(--brand-50); }
.boss-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 16px 12px; }
.boss-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 78px; padding: 8px 4px; border-radius: 14px;
  background: var(--brand-50); color: var(--brand); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.boss-tile:active { background: var(--brand-100); }
.boss-tile b { font-size: 27px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
.boss-tile span { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.boss-tile.zero { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.boss-go { display: flex; justify-content: center; gap: 8px; min-height: 54px; margin: 0 16px 16px; border-radius: 14px; font-size: 16px; }
.boss-done { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; margin: 0 16px 16px; border-radius: 12px; background: var(--green-bg); color: var(--green); font-weight: 600; }
.boss-row {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 9px 16px; border-top: 1px solid var(--line-2);
  color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.boss-row:active { background: var(--press); color: var(--ink); }
.boss-time { flex: none; width: 44px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.boss-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.boss-t b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boss-t span { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.boss-row > .dchip { flex: none; }
.boss-amt { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.boss-amt.neg, .boss-sum .neg { color: var(--red); }
.boss-sum { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 0 16px 10px; font-size: 13.5px; color: var(--ink-2); }
.boss-sum b { font-variant-numeric: tabular-nums; }
.boss-empty { padding: 2px 16px 16px; font-size: 14px; color: var(--muted); }
.boss-chev { flex: none; color: var(--icon-muted); }
.boss-flag { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.boss-flag:active { background: var(--press); }
.boss-flag-ic { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--gray-bg); color: var(--gray); }
.boss-flag-ic.on { background: var(--amber-bg); color: var(--amber); }
.boss-week p { margin: 0; padding: 0 16px 2px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.boss-week .boss-more { display: flex; justify-content: flex-end; margin: 0 8px 6px auto; width: max-content; }
.boss-full { display: flex; justify-content: center; gap: 8px; min-height: 54px; border-radius: 14px; font-size: 15.5px; }
.boss-back { align-self: flex-start; min-height: 40px; margin: -4px 0 -6px -8px; color: var(--brand); }

/* ===================================================================== 公司規則的說明（紀錄審核、審核模式、紀錄明細） */
.notice.rule-note { display: flex; align-items: flex-start; gap: 8px; }
.notice.rule-note > svg { flex: none; margin-top: 3px; }
.notice.rule-note a { margin: 0 3px; }
/* 依規則不能勾選的紀錄：勾選框淡一點，一看就知道按不了（滑過有說明） */
.rec-tbl input[type="checkbox"]:disabled { opacity: .35; cursor: not-allowed; }
