/* ============================================================================
 * chat.tyurry.com — 任务卡 / 任务泳道
 * 依据 GROKBOT-SPEC.md v2 第 4 节：微信「链接卡片」外观 + Grok Bot 的原地汇报
 *
 * 只作用于 .tc-* 与 .tc-root 内部；不改外壳任何样式。
 * 颜色只用在：左侧 3px 状态竖条、按钮。其余靠字重/留白/1px 线分层。
 * 圆角 6（卡片/按钮 4），间距 4/8 倍数。
 * ========================================================================== */

.tc-root,
.tc-root *,
.tc-card,
.tc-card * {
  box-sizing: border-box;
}

.tc-root,
.tc-card {
  --tc-card-bg: #FFFFFF;
  --tc-line: #E5E5E5;
  --tc-line-soft: #EFEFEF;
  --tc-ink: #1A1A1A;
  --tc-ink-2: #8C8C8C;
  --tc-ink-3: #B3B3B3;
  --tc-terra: #BC5230;
  --tc-ok: #3E7D4F;
  --tc-fail: #C0392B;
  --tc-wait: #C08A2E;
  --tc-lane-bg: #F7F7F7;
  --tc-r-card: 6px;
  --tc-r-btn: 4px;
  --tc-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --tc-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

/* ---------------------------------------------------------------- 任务卡 -- */

.tc-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 10px 12px 0;
  background: var(--tc-card-bg);
  border: 1px solid var(--tc-line);
  border-left: 3px solid var(--tc-terra);
  border-radius: var(--tc-r-card);
  color: var(--tc-ink);
  font-family: var(--tc-serif);
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.tc-card + .tc-card { margin-top: 8px; }

.tc-card[data-status="done"] { border-left-color: var(--tc-ok); }
.tc-card[data-status="failed"] { border-left-color: var(--tc-fail); }
.tc-card[data-status="waiting"] { border-left-color: var(--tc-wait); }

.tc-card [hidden] { display: none !important; }

/* 头部：任务 · 进行中 … 00:42 */
.tc-card-head {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--tc-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--tc-ink-2);
  white-space: nowrap;
}

.tc-card-kind {
  color: var(--tc-ink);
  font-weight: 500;
}

.tc-card-sep { color: var(--tc-ink-3); }

.tc-status { color: var(--tc-ink-2); }

.tc-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--tc-ink-2);
}

/* 正文：任务摘要 */
.tc-prompt {
  margin: 6px 0 0;
  font-family: var(--tc-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tc-ink);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

/* 步骤行：已完成打勾，未完成空心圈 */
.tc-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--tc-sans);
  font-size: 12px;
  line-height: 1.6;
  color: var(--tc-ink-3);
}

.tc-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.tc-step-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  border: 1px solid var(--tc-ink-3);
  border-radius: 50%;
  color: transparent;
  flex: none;
}

.tc-step-mark svg { opacity: 0; }

.tc-step.is-done { color: var(--tc-ink); }

.tc-step.is-done .tc-step-mark {
  border-color: transparent;
  color: var(--tc-ink);
}

.tc-step.is-done .tc-step-mark svg { opacity: 1; }

/* 结论摘要（完成 / 失败时） */
.tc-summary {
  margin: 8px 0 0;
  font-family: var(--tc-sans);
  font-size: 13px;
  line-height: 1.65;
  color: #4F4F4F;
  overflow-wrap: anywhere;
}

.tc-summary--fail { color: var(--tc-fail); }

/* 待确认 */
.tc-ask {
  margin: 8px 0 0;
  padding: 8px;
  border: 1px solid var(--tc-line-soft);
  border-radius: var(--tc-r-card);
  background: #FCFCFC;
}

.tc-ask[hidden] { display: none !important; }

.tc-ask-text {
  margin: 0;
  font-family: var(--tc-sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--tc-ink);
}

.tc-ask-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* 详情（外壳没接管信息窗时的内联展开） */
.tc-detail-panel {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--tc-line-soft);
}

.tc-detail-text {
  margin: 0;
  font-family: var(--tc-sans);
  font-size: 13px;
  line-height: 1.7;
  color: #3A3A3A;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tc-detail-text--fail { color: var(--tc-fail); }

.tc-detail-meta {
  margin: 6px 0 0;
  font-family: var(--tc-sans);
  font-size: 11px;
  line-height: 1.5;
  color: var(--tc-ink-3);
}

/* 底部：分隔线 + agent 名（灰小字） */
.tc-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--tc-line);
  font-family: var(--tc-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--tc-ink-2);
}

.tc-agent {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-foot-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex: none;
}

/* ---------------------------------------------------------------- 按钮 ---- */

.tc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--tc-r-btn);
  background: none;
  color: inherit;
  font-family: var(--tc-sans);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.tc-btn:focus-visible {
  outline: 2px solid rgba(188, 82, 48, .45);
  outline-offset: 2px;
}

.tc-btn[hidden] { display: none !important; }

/* 文字链式：看详情 / 打开会话 */
.tc-btn-link {
  padding: 2px 0;
  color: var(--tc-terra);
  font-size: 12px;
}

.tc-btn-link:hover { color: #9E4227; }

.tc-btn-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.tc-btn-glyph svg { display: block; }

.tc-btn-link svg {
  flex: none;
  transition: transform .15s ease;
}

.tc-btn--open svg { transform: rotate(180deg); }

/* 主按钮：同意 */
.tc-btn-primary {
  height: 28px;
  padding: 0 14px;
  background: var(--tc-terra);
  border-color: var(--tc-terra);
  color: #FFFFFF;
}

.tc-btn-primary:hover { background: #A8482A; border-color: #A8482A; }

/* 次按钮：驳回 */
.tc-btn-quiet {
  height: 28px;
  padding: 0 14px;
  background: #FFFFFF;
  border-color: var(--tc-line);
  color: #4A4A4A;
}

.tc-btn-quiet:hover { border-color: #CFCFCF; color: var(--tc-ink); }

/* ------------------------------------------------------------ 泳道视图 -- */

.tc-root {
  padding: 0;
  color: var(--tc-ink);
  font-family: var(--tc-serif);
}

.tc-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.tc-lane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  background: var(--tc-lane-bg);
  border: 1px solid var(--tc-line-soft);
  border-radius: var(--tc-r-card);
}

.tc-lane-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--tc-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--tc-ink-2);
}

.tc-lane-title {
  margin: 0;
  font-family: var(--tc-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--tc-ink);
}

.tc-lane-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--tc-ink-2);
}

.tc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tc-ink-3);
  flex: none;
}

.tc-lane[data-lane="active"] .tc-dot { background: var(--tc-terra); }
.tc-lane[data-lane="done"] .tc-dot { background: var(--tc-ok); }
.tc-lane[data-lane="failed"] .tc-dot { background: var(--tc-fail); }

.tc-lane-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.tc-lane-body[hidden] { display: none !important; }

.tc-lane-empty {
  margin: 0;
  padding: 4px 2px 8px;
  font-family: var(--tc-sans);
  font-size: 12px;
  line-height: 1.6;
  color: var(--tc-ink-3);
}

.tc-lane-empty[hidden] { display: none !important; }

/* 泳道里的卡：撑满列宽，不再有气泡宽度限制 */
.tc-card--lane {
  max-width: none;
  width: 100%;
}

/* ------------------------------------------------------------ 响应式 ---- */

@media (max-width: 900px) {
  .tc-lanes { grid-template-columns: 1fr; }

  .tc-lane-body { flex-direction: column; }
}

@media (max-width: 420px) {
  .tc-card {
    max-width: none;
    padding: 10px 10px 0;
  }

  .tc-prompt { font-size: 15px; }

  .tc-steps { gap: 2px 8px; }

  .tc-card-head { font-size: 12px; }

  .tc-btn-primary,
  .tc-btn-quiet { height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .tc-btn,
  .tc-btn-link svg { transition: none; }
}
