/* 任务记录（任务中心）：所有渠道共用一张表。
 *
 * 视觉沿用 shell.css 的变量（深色卡 + 细边线），不自带调色板 —— 换主题只改一处。
 * 三件事必须一眼看清：状态（颜色）、来源（徽标）、时长/积分（等宽数字）。
 */
.tc-body { display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------- 顶部说明 + 统计 ---------------------------- */
.tc-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.tc-head-text { flex: 1; min-width: 320px; }
.tc-head-text h2 { font-size: 14px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.tc-head-text p { margin: 0; font-size: 12px; line-height: 1.75; color: var(--text2); max-width: 780px; }
.tc-stat { display: flex; gap: 10px; }
.tc-stat > div {
  min-width: 84px; padding: 9px 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line); text-align: center;
}
.tc-stat b { display: block; font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: .2px; }
.tc-stat span { font-size: 10.5px; color: var(--text3); }

/* ------------------------------- 筛选条 -------------------------------- */
.tc-filters {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
}
.tc-search { flex: 1; min-width: 240px; }
.tc-search svg { width: 14px; height: 14px; color: var(--text3); flex: none; }
.tc-sel {
  height: 30px; padding: 0 8px; border-radius: 8px; font-size: 12px;
  background: var(--pill); color: var(--text); border: 1px solid var(--line);
  outline: none; min-width: 108px;
}
.tc-sel:hover { border-color: var(--line2); }
.tc-sel:focus { border-color: var(--accent); }
.tc-dates { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text3); }
.tc-dates[hidden] { display: none; }
.tc-dates input { min-width: 132px; }

/* 汇总：数字等宽，翻页时不跳 */
.tc-summary { font-size: 11.5px; color: var(--text2); display: flex; gap: 14px; flex-wrap: wrap; }
.tc-summary b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tc-summary i { font-style: normal; color: var(--text3); }

/* -------------------------------- 表格 -------------------------------- */
.tc-table-wrap {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); overflow: hidden;
}
.tc-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tc-table th {
  text-align: left; font-size: 10.5px; font-weight: 500; color: var(--text3);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  letter-spacing: .02em;
}
.tc-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--text); vertical-align: middle;
}
.tc-table tbody tr:last-child td { border-bottom: 0; }
.tc-table tbody tr:hover { background: rgba(255, 255, 255, .022); }
.tc-table .c-id { width: 148px; }
.tc-table .c-time { width: 132px; }
/* 来源列要容得下「云端 ComfyUI」徽标（比「本机 ComfyUI」多一个字），
   太窄会让状态列的字被挤到徽标里，看起来像重叠。 */
.tc-table .c-src { width: 132px; }
.tc-table .c-status { width: 150px; }
.tc-table .c-dur { width: 96px; }
.tc-table .c-cost { width: 72px; }
.tc-table .c-act { width: 204px; }
.tc-ts, .tc-dur, .tc-cost { font-variant-numeric: tabular-nums; }
.tc-ts { color: var(--text2); font-size: 11.5px; white-space: nowrap; }
.tc-dur { color: var(--text2); font-size: 11.5px; white-space: nowrap; }
.tc-cost { color: var(--text2); font-size: 11.5px; }
.tc-empty { text-align: center; color: var(--text3); font-size: 12px; padding: 34px 0 !important; }

/* 任务 ID：等宽 + 可点复制 */
.tc-idbtn {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--text2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
}
.tc-idbtn:hover { color: var(--accent); }
.tc-idbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 名称：主名 + 提示词摘要 */
.tc-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tc-name b { font-size: 12px; font-weight: 500; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.tc-name small { font-size: 11px; color: var(--text3); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.tc-name small.bad { color: #ffb3b3; }

/* 来源徽标 */
.tc-src {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px;
  border: 1px solid var(--line2); color: var(--text2); white-space: nowrap;
}
.tc-src.local { color: #9fd8ff; border-color: rgba(159, 216, 255, .3); background: rgba(159, 216, 255, .08); }
.tc-src.comfy-cloud { color: #8fe6c8; border-color: rgba(143, 230, 200, .35); background: rgba(143, 230, 200, .09); }
.tc-src.external { color: #ffd49b; border-color: rgba(255, 212, 155, .3); background: rgba(255, 212, 155, .08); }
.tc-src.cloud { color: #d8c4ff; border-color: rgba(216, 196, 255, .3); background: rgba(216, 196, 255, .08); }

/* 状态：点 + 文案，颜色只表达成败；运行中的任务再补一句「现在卡在哪」 */
.tc-status-wrap { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.tc-status-line { display: flex; align-items: center; gap: 4px; }
.tc-prog { font-size: 10.5px; color: var(--text3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.tc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; white-space: nowrap; }
.tc-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); flex: none; }
.tc-status.succeeded { color: var(--ok); }
.tc-status.succeeded .dot { background: var(--ok); }
.tc-status.failed { color: var(--danger); }
.tc-status.failed .dot { background: var(--danger); }
.tc-status.running, .tc-status.submitting { color: #ffd49b; }
.tc-status.running .dot, .tc-status.submitting .dot { background: #ffd49b; animation: tc-pulse 1.4s ease-in-out infinite; }
.tc-status.queued { color: var(--text2); }
@keyframes tc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.tc-badge {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 5px;
  font-size: 9.5px; line-height: 15px; color: var(--text3); background: var(--pill);
}
.tc-badge.bad { color: #ffb3b3; background: rgba(255, 92, 92, .12); }

/* 操作 */
.tc-acts { display: flex; gap: 4px; flex-wrap: nowrap; }
.tc-acts .btn { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 7px; white-space: nowrap; }

/* ------------------------------- 分页 -------------------------------- */
.tc-page { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text3); }
.tc-page .spacer { flex: 1; }
.tc-page .btn { height: 26px; padding: 0 10px; font-size: 11.5px; }
.tc-page b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.tc-foot { margin: 2px 0 0; font-size: 11px; line-height: 1.7; color: var(--text3); }
.tc-foot code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text2); }

/* ------------------------------ 详情抽屉 ------------------------------ */
.tc-drawer { position: fixed; inset: 0; z-index: 900; }
.tc-drawer[hidden] { display: none; }
.tc-drawer-mask { position: absolute; inset: 0; background: var(--st-overlay); backdrop-filter: blur(1px); }
.tc-drawer-card {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 86vw);
  background: var(--bg2); border-left: 1px solid var(--line2);
  display: flex; flex-direction: column; box-shadow: -18px 0 48px rgba(0, 0, 0, .45);
  animation: tc-slide .18s ease-out;
}
@keyframes tc-slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.tc-drawer-head {
  display: flex; align-items: flex-start; gap: 10px; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none;
}
.tc-drawer-head b { font-size: 13px; font-weight: 600; }
.tc-dsub { display: block; margin-top: 3px; font-size: 11px; color: var(--text3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tc-drawer-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 30px; }

.tc-sec { margin-bottom: 16px; }
.tc-sec > h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 7px;
  font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: .06em; text-transform: uppercase;
}
.tc-sec > h3 .spacer { flex: 1; }
.tc-kv { display: grid; grid-template-columns: 96px 1fr; gap: 5px 10px; font-size: 12px; }
.tc-kv dt { color: var(--text3); }
.tc-kv dd { margin: 0; color: var(--text); word-break: break-all; }
.tc-kv dd.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

.tc-json {
  margin: 0; padding: 10px 12px; max-height: 300px; overflow: auto;
  background: var(--card2); border: 1px solid var(--line); border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  line-height: 1.6; color: var(--text2); white-space: pre-wrap; word-break: break-word;
}
.tc-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.tc-thumb {
  position: relative; border-radius: 9px; overflow: hidden; background: var(--card2);
  border: 1px solid var(--line); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
}
.tc-thumb img, .tc-thumb video { width: 100%; height: 100%; object-fit: cover; }
.tc-thumb audio { width: 90%; }
.tc-thumb em {
  position: absolute; left: 5px; bottom: 4px; font-style: normal; font-size: 9.5px;
  padding: 0 5px; border-radius: 5px; background: rgba(0, 0, 0, .55); color: #fff;
}

/* 出参：每张缩略图都挂「预览 / 下载」两个显式入口（不再靠点图跳新标签）。
   音频/文本/其他文件不塞 <img>，用图标 + 文件名，避免显示一张破图。 */
.tc-out .tc-out-icon { position: absolute; left: 10px; top: 10px; font-size: 22px; color: var(--text3); }
.tc-out .tc-out-name {
  position: absolute; left: 8px; right: 8px; top: 40px; font-size: 10.5px; line-height: 1.4;
  color: var(--text2); word-break: break-all; overflow: hidden; max-height: 3em;
}
.tc-out em { bottom: 32px; }
.tc-out-acts {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 4px; padding: 5px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .72) 38%);
}
.tc-out-act {
  flex: 1; min-width: 0; height: 22px; padding: 0 3px; border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .28); background: rgba(0, 0, 0, .48);
  color: #fff; font-size: 10.5px; line-height: 20px; text-align: center; text-decoration: none;
  cursor: pointer;
}
.tc-out-act:hover { background: rgba(0, 0, 0, .76); border-color: rgba(255, 255, 255, .55); }

/* 出参预览灯箱：层级压在详情抽屉（z-index 900）之上 */
.tc-preview {
  position: fixed; inset: 0; z-index: 1000; padding: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--st-overlay); backdrop-filter: blur(3px);
}
.tc-preview[hidden] { display: none; }
.tc-preview-card {
  width: min(1040px, 94vw); max-height: 92vh; display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px;
  overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
}
.tc-preview-bar {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.tc-preview-bar b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-preview-bar .spacer, .tc-preview .spacer { flex: 1; }
.tc-preview-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 14px; background: rgba(0, 0, 0, .16);
}
.tc-preview-stage > [hidden] { display: none !important; }
.tc-preview-stage > img, .tc-preview-stage > video {
  max-width: 100%; max-height: calc(92vh - 120px); object-fit: contain;
}
.tc-preview-stage > audio { width: min(560px, 90%); }
.tc-preview-stage > pre {
  margin: 0; width: 100%; max-height: calc(92vh - 120px); overflow: auto; padding: 12px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
  line-height: 1.6; color: var(--text2); white-space: pre-wrap; word-break: break-word;
}
.tc-preview-other { font-size: 13px; color: var(--text2); }

/* 状态流水 */
.tc-timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.tc-timeline li { position: relative; padding: 0 0 12px 18px; font-size: 12px; color: var(--text2); }
.tc-timeline li::before {
  content: ''; position: absolute; left: 0; top: 5px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--line2);
}
.tc-timeline li::after {
  content: ''; position: absolute; left: 3px; top: 14px; bottom: 0; width: 1px; background: var(--line);
}
.tc-timeline li:last-child { padding-bottom: 0; }
.tc-timeline li:last-child::after { display: none; }
.tc-timeline li.succeeded::before { background: var(--ok); }
.tc-timeline li.failed::before { background: var(--danger); }
.tc-timeline li.running::before, .tc-timeline li.submitting::before { background: #ffd49b; }
.tc-timeline time { color: var(--text3); font-size: 11px; margin-right: 8px;
  font-variant-numeric: tabular-nums; }
.tc-timeline b { color: var(--text); font-weight: 500; }

.tc-err {
  padding: 9px 11px; border-radius: 9px; font-size: 12px; line-height: 1.6;
  background: rgba(255, 92, 92, .09); border: 1px solid rgba(255, 92, 92, .25); color: #ffb3b3;
  white-space: pre-wrap; word-break: break-word;
}
.tc-hint { font-size: 11.5px; color: var(--text3); line-height: 1.7; }
.tc-mini { height: 24px; padding: 0 9px; font-size: 11px; border-radius: 7px; }

@media (max-width: 980px) {
  .tc-table .c-src, .tc-table .c-cost { display: none; }
  .tc-stat { width: 100%; }
}
