/* 「今天」首頁。只用既有 CSS 變數，不新增顏色。
   清單每列用固定欄位：名稱（可伸縮）｜金額｜狀態標籤｜動作按鈕。各段共用同一組欄寬變數，所以金額、標籤、按鈕會排成直線。 */

/* 在「今天」分頁隱藏案件分頁專屬的面板與頂端小標籤（切到其他分頁就恢復，不影響它們原本的行為） */
body.mode-today #jumpBar,
body.mode-today #keyPanel,
body.mode-today #awardPanel,
body.mode-today #eventsPanel,
body.mode-today #todoPanel,
body.mode-today #syncPanel,
body.mode-today #pipelineReviewPanel,
body.mode-today #tenderJobBar,
body.mode-today #overviewFold,
body.mode-today #unitAddRow,
body.mode-today .duo,
body.mode-today .searchbar,
body.mode-today .boardhd,
body.mode-today #stageTabs,
body.mode-today #board,
body.mode-today #visitBadgeBtn{display:none!important}
#dueList details.dt-tier,#eventsPanel{scroll-margin-top:calc(var(--hdr-h,60px) + 12px)}

#todayWrap{--th-amt:120px;--th-tag:100px;--th-btn:80px;--th-gap:6px;--th-acts:calc(var(--th-btn) * 4 + var(--th-gap) * 3)}
.th-wrap{max-width:1100px;margin:0 auto}

/* 標題列 */
.th-head{display:flex;align-items:center;gap:12px;margin:2px 0 14px;flex-wrap:wrap}
.th-head h2{margin:0;font-size:20px;font-weight:800;letter-spacing:.01em}
.th-date{color:var(--muted);font-size:14px;font-family:var(--mono)}
.th-add{margin-left:auto;position:relative}
.th-addbtn{list-style:none;display:inline-flex;align-items:center;justify-content:center;min-width:80px;padding:0 16px;border-radius:var(--radius-sm);
  background:var(--primary);color:#fff;font-size:14px;font-weight:700;cursor:pointer;border:1px solid var(--primary)}
.th-addbtn::-webkit-details-marker{display:none}
.th-addbtn::before{content:"+";font-size:18px;line-height:1;margin-right:6px;font-weight:600}
.th-addbtn:hover{background:var(--primary-ink)}
.th-addmenu{position:absolute;right:0;top:calc(100% + 6px);z-index:20;min-width:160px;display:flex;flex-direction:column;padding:6px;gap:4px;
  background:var(--surface);border:1px solid var(--line-strong);border-radius:var(--radius-sm);box-shadow:var(--shadow-lg)}
.th-addmenu button{text-align:left;border:0;background:transparent;padding:0 12px;font-size:14px;min-height:40px}
.th-addmenu button:hover{background:var(--surface-2)}

/* 摘要卡 */
.th-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:14px}
.th-card{display:flex;flex-direction:column;gap:2px;text-align:left;min-width:0;padding:12px 14px;border-radius:var(--radius);
  background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);color:var(--ink);font-weight:400;min-height:104px}
button.th-card{cursor:pointer}
button.th-card:hover{border-color:var(--line-strong);background:var(--surface-2)}
.th-card.warn{border-color:color-mix(in srgb,var(--amber) 45%,var(--line))}
.th-card.warn .th-card-big{color:var(--amber)}
.th-card-t{font-size:13px;font-weight:700;color:var(--muted);letter-spacing:.04em}
.th-card-big{font-size:30px;font-weight:700;line-height:1.2;margin-top:2px}
.th-card-big small{font-size:14px;font-weight:500;margin-left:3px;color:var(--muted)}
.th-card-big.th-idle{font-size:16px;font-weight:600;color:var(--muted);margin-top:6px;font-family:var(--font)}
.th-card-sub{font-size:13px;color:var(--muted)}
.th-job .tj-sub{display:block;font-size:13px;opacity:.9}
.th-job{font-size:14px;line-height:1.45;margin-top:4px;min-width:0;overflow-wrap:anywhere}
.th-job.captcha,.th-job.confirm{color:var(--primary-ink);font-weight:700}
.th-job.failed{color:var(--danger)}
.th-job .tj-prog{margin-top:4px}
.th-ev{font-size:13px;line-height:1.4;margin-top:4px;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
.th-ev.bad{color:var(--danger)}
.th-ev-t{font-family:var(--mono);color:var(--muted);margin-right:6px}

/* 清單 */
.th-list{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.th-sec+.th-sec{border-top:1px solid var(--line)}
.th-sec>h3,.th-sec>summary>h3{display:flex;align-items:baseline;gap:8px;margin:0;padding:12px 14px 6px;font-size:15px;font-weight:700}
.th-sec>summary{list-style:none;cursor:pointer;display:block;min-height:40px}
.th-sec>summary::-webkit-details-marker{display:none}
.th-sec>summary>h3::before{content:"▸";color:var(--muted);width:1em;font-size:13px}
.th-sec[open]>summary>h3::before{content:"▾"}
.th-sec .cnt{font-family:var(--mono);font-size:13px;font-weight:600;color:var(--muted);background:var(--surface-2);padding:1px 8px;border-radius:20px}
.th-hint{font-size:13px;font-weight:400;color:var(--muted)}
.th-empty{padding:6px 14px 14px;color:var(--muted);font-size:14px}
.th-more{display:block;width:calc(100% - 20px);margin:4px 10px 10px;min-height:40px;font-size:13px;font-weight:600;color:var(--primary-ink);background:var(--surface-2);border-color:var(--line)}

.th-row{display:grid;grid-template-columns:minmax(0,1fr) var(--th-amt) var(--th-tag) var(--th-acts);column-gap:12px;align-items:center;
  padding:8px 14px;border-top:1px solid var(--line);cursor:pointer}
.th-sec>h3+.th-row,.th-sec>summary+.th-row{border-top:0}
.th-row:hover{background:var(--surface-2)}
.th-row:focus-visible{outline:2px solid var(--primary);outline-offset:-2px}
.th-sug{cursor:default}
.th-who{min-width:0}
.th-name{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.th-name b{font-weight:700}
.th-sub{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:1.5em}
.th-amt{text-align:right;font-size:14px;min-width:0;white-space:nowrap}
.th-amt .chip{display:inline-block}
.th-tag{text-align:center}
.th-tag .chip{display:block;width:100%;text-align:center;padding-left:0;padding-right:0}
.th-acts{width:var(--th-acts);min-width:0}
/* 動作按鈕：沿用 row-actions.js 產生的 .rowacts，覆寫成固定欄寬、靠右 */
.th-acts .rowacts{flex:none;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--th-gap);margin:0}
.th-acts .rowacts button{flex:0 0 var(--th-btn);width:var(--th-btn);height:40px;min-width:0;padding:0 4px;font-size:13px;font-weight:600;
  border-radius:var(--radius-sm);white-space:nowrap}
.th-acts .rowacts button.pri{background:var(--primary-soft);border-color:transparent;color:var(--primary-ink)}
.th-acts .rowacts button.warn{color:var(--danger)}

/* 中等寬度：按鈕折成兩排（兩欄），欄位仍對齊 */
@media (max-width:1000px){
  #todayWrap{--th-acts:calc(var(--th-btn) * 2 + var(--th-gap));--th-amt:104px;--th-tag:92px}
  .th-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
}
/* 手機：單欄。名稱＋標籤一行、說明＋金額一行、按鈕一行（四等分、靠右） */
@media (max-width:700px){
  #todayWrap{--th-acts:100%}
  .th-head{flex-wrap:nowrap;gap:8px}
  .th-head h2{font-size:18px;white-space:nowrap}
  .th-date{font-size:13px;min-width:0;flex:1 1 auto}
  .th-addbtn{min-width:72px;padding:0 12px}
  .th-cards{gap:8px}
  .th-card{padding:10px 12px;min-height:88px}
  .th-job-card{grid-column:1/-1;min-height:0}
  .th-ev-card{grid-column:1/-1;min-height:0}
  .th-row{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"name tag" "sub amt" "acts acts";column-gap:10px;row-gap:2px;padding:10px 12px}
  .th-who{display:contents}
  .th-name{grid-area:name}
  .th-sub{grid-area:sub}
  .th-amt{grid-area:amt}
  .th-tag{grid-area:tag;width:var(--th-tag);justify-self:end}
  .th-tag:empty{display:none}
  .th-acts{grid-area:acts;margin-top:6px}
  .th-acts .rowacts{flex-wrap:nowrap}
  .th-acts .rowacts button{flex:0 0 calc((100% - var(--th-gap) * 3) / 4);width:calc((100% - var(--th-gap) * 3) / 4);padding:0 2px}
  .th-more{width:calc(100% - 16px);margin:4px 8px 10px}
  .th-sec>h3,.th-sec>summary>h3{flex-wrap:wrap;padding:10px 12px 4px}
  #modeToggle button[role="tab"]:not(#_){font-size:13px;padding:0 2px}  /* 底部分頁列多了「今天」，六顆要擠得下 */
}
