:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --panel: #ffffff;
  --muted: #667085;
  --text: #111827;
  --line: #d8dee8;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --fail: #991b1b;
  --fail-soft: #fee2e2;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  min-width: 1280px;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #f8fafc;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

.main {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.panel.wide {
  padding: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.connection-panel .panel-header {
  padding: 0 0 12px;
}

.lang-select {
  width: 92px;
  height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.history-panel {
  margin-top: auto;
  padding: 0;
  max-height: 270px;
  overflow: hidden;
}

.history-panel .panel-header {
  padding: 10px 12px;
}

.small-btn {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.ghost {
  background: #fff;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.switches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  min-width: 0;
}

.toggle span {
  white-space: nowrap;
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.history-list {
  max-height: 218px;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 8px;
  align-items: stretch;
}

.history-item {
  height: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
}

.history-name {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-name:hover {
  color: var(--accent);
}

.history-name-input {
  width: 100%;
  height: 26px;
  padding: 4px 7px;
  font-size: 12px;
  border-radius: 6px;
}

.history-copy {
  height: auto;
  min-height: 56px;
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.history-top strong {
  font-size: 12px;
}

.history-url {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-history {
  color: var(--muted);
  text-align: center;
  padding: 18px 0;
  font-size: 12px;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  min-height: 72px;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.summary-item strong {
  display: block;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace {
  display: block;
}

.table-wrap {
  overflow: auto;
}

.models-wrap {
  height: calc(100vh - 174px);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

td {
  word-break: break-word;
}

.model-header {
  align-items: flex-start;
  padding: 12px 14px;
}

.model-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.model-controls input,
.model-controls select {
  height: 36px;
  padding: 8px 10px;
  margin: 0;
}

.model-controls button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.model-controls #searchInput {
  width: 150px;
}

.model-controls #kindFilter {
  width: 112px;
}

.model-controls #containsInput {
  width: 180px;
}

.model-controls #regexInput {
  width: 104px;
}

.model-controls .narrow {
  width: 64px;
}

.inline-toggle {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 9px;
}

.inline-toggle input {
  width: auto;
}

.model-panel th:nth-child(1),
.model-panel td:nth-child(1) {
  width: 42px;
}

.model-panel th:nth-child(2),
.model-panel td:nth-child(2) {
  width: 230px;
}

.model-panel th:nth-child(3),
.model-panel td:nth-child(3) {
  width: 82px;
}

.model-panel th:nth-child(4),
.model-panel td:nth-child(4) {
  width: 82px;
}

.model-panel th:nth-child(5),
.model-panel td:nth-child(5) {
  width: 70px;
}

.model-panel th:nth-child(6),
.model-panel td:nth-child(6) {
  width: 76px;
}

.model-panel th:nth-child(7),
.model-panel td:nth-child(7) {
  width: 160px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  word-break: break-all;
}

.model-panel th:nth-child(8),
.model-panel td:nth-child(8) {
  width: 260px;
}

.check-col {
  width: 46px;
}

.model-name {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.evidence-cell {
  padding-top: 8px;
  padding-bottom: 8px;
}

.evidence {
  max-width: 100%;
  color: var(--text);
}

.pending-evidence {
  color: var(--warn);
}

.text-evidence {
  max-height: 74px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.image-evidence {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: 245px;
  color: var(--accent);
  text-decoration: none;
}

.preview-box {
  width: 92px;
  height: 64px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-box.is-broken::after {
  content: "不可预览";
  color: var(--muted);
  font-size: 12px;
}

.preview-box.is-broken img {
  display: none;
}

.image-evidence span,
.link-evidence {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-evidence {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: 250px;
}

.video-evidence video {
  width: 116px;
  height: 64px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #111827;
}

.task-evidence {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-evidence span {
  color: var(--muted);
  font-size: 12px;
}

.task-evidence code {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.link-evidence {
  display: block;
  max-width: 240px;
  color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  border: 1px solid transparent;
}

.badge.kind-text,
.badge.kind-embedding,
.badge.kind-rerank {
  background: #e0f2fe;
  color: #075985;
}

.badge.kind-image {
  background: #ede9fe;
  color: #5b21b6;
}

.badge.kind-video {
  background: #ffe4e6;
  color: #be123c;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.fail {
  background: var(--fail-soft);
  color: var(--fail);
}

.badge.pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-line {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 12px;
}

tr.is-selected {
  background: #f8fbff;
}
