/* ============================================================
   测试用例页
   结构：生成区（固定）+ 主体（左表格 / 右操作栏）
   表格 thead 用 position:sticky 粘在 .tc-body 的滚动容器上，
   不依赖任何 JS 量高度。
   ============================================================ */

.app[data-page="tests"] #chat_head_controls { display: none; }

.tc-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 0;
}

/* ---------- 生成区 ---------- */
.tc-gen {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.tc-gen-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.tc-gen-row { display: flex; gap: 10px; align-items: stretch; }
.tc-gen-row textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.6;
  background: #fff;
}
.tc-gen-row textarea:focus { outline: 2px solid var(--accent-weak); border-color: #c7d2fe; }
.tc-gen-row button { flex: 0 0 auto; align-self: flex-end; height: 36px; padding: 0 16px; }
.tc-gen-state { margin-top: 8px; font-size: 12px; color: var(--text-3); line-height: 1.7; }
.tc-gen-state.ok { color: #047857; }
.tc-gen-state.err { color: var(--danger); }

/* ---------- 主体 ---------- */
.tc-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: start;
  padding-bottom: 16px;
}

.tc-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.tc-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}
.tc-bar .lf { display: inline-flex; align-items: center; gap: 6px; }
.tc-bar select { max-width: 320px; }
.tc-spacer { flex: 1 1 auto; }
.tc-stat { color: var(--text-3); font-variant-numeric: tabular-nums; }

.tc-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.tc-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
}
.tc-chip.on {
  background: var(--accent-weak);
  border-color: #c7d2fe;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- 表格 ---------- */
.tc-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: auto;
}
.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.tc-table th, .tc-table td {
  border-bottom: 1px solid #eef0f4;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
  word-break: break-word;
}
.tc-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.tc-table tbody tr:hover { background: #fcfcfe; }
.tc-table .c-no { width: 58px; color: var(--text-3); }
.tc-table .c-name { width: 200px; font-weight: 600; color: var(--text); }
.tc-table .c-text { color: var(--text-2); }
.tc-table .c-res { width: 116px; }
.tc-table td.c-no { font-variant-numeric: tabular-nums; }

.tc-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
}

.tc-res-sel {
  width: 100%;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}
.tc-res-sel.res-1 { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.tc-res-sel.res-2 { border-color: #c7d2fe; background: #eef2ff; color: #3730a3; }
.tc-res-sel.res-3 { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }

.tc-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  background: #fbfcfe;
}
.tc-empty[hidden] { display: none; }

/* ---------- 右侧操作栏 ---------- */
.tc-side { display: flex; flex-direction: column; gap: 10px; }
.tc-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tc-card-title { font-size: 12px; font-weight: 600; color: var(--text-2); }
.tc-card button { width: 100%; }
.tc-msg { font-size: 12px; color: var(--text-3); line-height: 1.7; min-height: 18px; }
.tc-msg.ok { color: #047857; }
.tc-msg.err { color: var(--danger); }
.tc-tip { font-size: 11px; color: var(--text-3); line-height: 1.8; }

/* ---------- 移动端 ---------- */
@media (max-width: 900px) {
  .tc-body { grid-template-columns: 1fr; }
  .tc-side { flex-direction: row; flex-wrap: wrap; }
  .tc-card { flex: 1 1 240px; }
  .tc-card button { width: auto; flex: 1 1 46%; }
}
@media (max-width: 768px) {
  .tc-panel { padding: 10px 12px 0; }
  .tc-gen-row { flex-direction: column; }
  .tc-gen-row button { align-self: stretch; }
  .tc-table { table-layout: auto; }
  .tc-table .c-name { width: 140px; }
  .tc-table .c-res { width: 100px; }
}
