/* 成員負荷（組別分析頁 page18 的頁內分頁）
   選擇器一律帶 .twl- 前綴避免污染全域；顏色一律走 CSS 變數，不寫死色碼。 */

/* 成員負荷模式下，隱藏只屬於 Epic 分析的控制項與結果 */
.tana-wrapper[data-mode="workload"] .tana-epic-only,
.tana-wrapper[data-mode="workload"] #tanaResult {
  display: none !important;
}

.tana-page-switch {
  display: flex;
  gap: 8px;
  padding: 0 24px 12px;
}

.tana-page-switch button.active {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: var(--bg-card);
}

.twl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.twl-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.twl-select {
  width: 110px;
}

.twl-note {
  padding: 0 24px 10px;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.twl-note strong {
  font-weight: 500;
  color: var(--warning);
}

.twl-note summary {
  cursor: pointer;
  list-style: none;
}

.twl-note summary::-webkit-details-marker { display: none; }

.twl-info {
  margin-left: 8px;
  color: var(--accent);
}

.twl-note ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.twl-muted {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.twl-status {
  padding: 0 24px 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.twl-status.error {
  color: var(--error);
}

/* 查詢中：狀態列橘字，舊結果調淡且不可點，避免被當成新組別的數字 */
.twl-status.busy {
  color: var(--warning);
  font-weight: 600;
}

.twl-loading :is(.twl-kpis, .twl-overview, .twl-quadrant, .twl-matrix) {
  opacity: 0.35;
  pointer-events: none;
}

.twl-table-wrap {
  padding: 0 24px 20px;
  overflow-x: auto;
}

.twl-table {
  border-collapse: collapse;
  width: auto;
}

.twl-table th {
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
  box-shadow: inset 0 -2px 0 var(--brand-teal);
}

.twl-table td {
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}

.twl-table .twl-left {
  text-align: left;
}

.twl-table td.twl-member {
  font-family: var(--font-main);
  font-weight: 600;
  color: var(--text-primary);
}

.twl-table .twl-avg-col {
  border-left: 2px solid var(--border-color);
  font-weight: 700;
}

.twl-cell {
  cursor: pointer;
  min-width: 84px;
}

.twl-cell:hover {
  outline: 1px solid var(--brand-teal);
}

.twl-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-main);
}

/* 達成率色階：淡底，深淺色主題都讀得到字 */
.twl-good {
  background: color-mix(in srgb, var(--success) 18%, transparent);
}

.twl-mid {
  background: color-mix(in srgb, var(--warning) 20%, transparent);
}

.twl-low {
  background: color-mix(in srgb, var(--error) 18%, transparent);
}

.twl-off,
.twl-empty {
  color: var(--text-muted);
}

.twl-inactive td {
  opacity: 0.6;
}

.twl-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.twl-tag-warn {
  color: var(--warning);
  border-color: var(--warning);
}

.twl-detail {
  padding: 0 24px 20px;
}

.twl-detail-head {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.twl-issue {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.82rem;
}

.twl-issue-mark {
  width: 14px;
  color: var(--text-muted);
}

.twl-issue-done .twl-issue-mark {
  color: var(--success);
}

.twl-issue-sp,
.twl-issue-kind {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
}

.twl-issue-status {
  color: var(--text-muted);
  white-space: nowrap;
}

.twl-issue-title {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 團隊概況 KPI ---- */
.twl-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 4px 24px 16px;
}

.twl-kpi {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
}

.twl-kpi-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.twl-kpi-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.twl-kpi-of {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.twl-good-text { color: var(--success) !important; }
.twl-mid-text { color: var(--warning) !important; }
.twl-low-text { color: var(--error) !important; }

/* ---- 區塊標題與切換鈕 ---- */
.twl-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 24px;
}

.twl-section-title {
  font-weight: 600;
  color: var(--text-primary);
}

.twl-seg {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.twl-seg button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.twl-seg button.active {
  background: var(--brand-teal);
  color: var(--bg-card);
}

/* ---- 成員總覽 ---- */
.twl-overview {
  width: 100%;
}

.twl-overview td {
  padding: 10px;
  vertical-align: middle;
}

.twl-rating {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.twl-rel {
  font-family: var(--font-main);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.twl-rel i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--border-color);
}

.twl-rel i.on {
  background: var(--brand-teal);
}

.twl-spark-line {
  fill: none;
  stroke: var(--brand-teal);
  stroke-width: 1.5;
}

.twl-spark-dot {
  fill: var(--brand-teal);
}

.twl-spark-live {
  fill: var(--bg-card);
  stroke: var(--brand-teal);
  stroke-dasharray: 2 1;
}

.twl-pill {
  display: inline-block;
  min-width: 48px;
  padding: 1px 8px;
  border-radius: 10px;
}

.twl-bar {
  width: 80px;
  height: 6px;
  margin: 0 auto 2px;
  border-radius: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.twl-bar div {
  height: 100%;
}

.twl-bar-good { background: var(--success); }
.twl-bar-low { background: var(--error); }

.twl-plan {
  font-weight: 700;
  color: var(--text-primary);
}

.twl-tag-bad {
  color: var(--error);
  border-color: var(--error);
}

/* ---- 四象限 ---- */
.twl-quadrant {
  padding: 0 24px 16px;
}

.twl-q-svg {
  width: 100%;
  max-width: 640px;
  height: auto;
}

.twl-q-ok { fill: color-mix(in srgb, var(--success) 10%, transparent); }
.twl-q-room { fill: color-mix(in srgb, var(--warning) 10%, transparent); }
.twl-q-bad { fill: color-mix(in srgb, var(--error) 8%, transparent); }

.twl-q-axis { stroke: var(--text-muted); }
.twl-q-mid { stroke: var(--border-color); stroke-dasharray: 4 3; }

.twl-q-zone,
.twl-q-tick {
  font-size: 11px;
  fill: var(--text-muted);
}

.twl-q-dot {
  fill: var(--brand-teal);
  stroke: var(--bg-card);
  stroke-width: 1.5;
}

.twl-q-name {
  font-size: 12px;
  fill: var(--text-primary);
}

/* ---- 逐期明細（收合） ---- */
.twl-matrix {
  border-top: 1px solid var(--border-color);
}

.twl-matrix > summary {
  padding: 12px 24px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
