* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  color: #0f172a;
  background: #f1f5f9;
  line-height: 1.45;
}

/* Topbar */
.topbar {
  height: 56px;
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.brand h1 { margin: 0; font-size: 15px; font-weight: 600; }
.brand p { margin: 1px 0 0; font-size: 11px; color: #94a3b8; }

.nav-tabs { display: flex; gap: 8px; }
.nav-tab {
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.14);
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.nav-tab:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-tab.on { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600; }

.top-actions { display: flex; align-items: center; gap: 12px; }
.top-stats { font-size: 12px; color: #cbd5e1; }
.topbar .btn-ghost {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
  text-decoration: none;
}

/* Buttons & Inputs */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: 1px solid #2563eb;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover:not(:disabled) { background: #dbeafe; }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover:not(:disabled) { background: #e2e8f0; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; padding: 9px; }
.link-btn { background: none; border: none; color: #2563eb; font-size: 12px; cursor: pointer; }

.select-sm, .select-md, .select-full {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font-size: 12.5px;
  padding: 5px 8px;
}
.select-full { width: 100%; padding: 7px 9px; }

.muted { color: #64748b; font-size: 12px; }

/* ==================== TAB 1: Annotate Layout ==================== */
.annotate-layout {
  display: grid;
  grid-template-columns: 250px 330px minmax(0, 1fr);
  height: calc(100vh - 56px);
}

.col-samples, .col-items {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.head-actions { display: flex; align-items: center; gap: 6px; }
.upload-opts { padding: 7px 12px; border-bottom: 1px solid #f1f5f9; background: #f8fafc; font-size: 12px; color: #475569; }
.chk-line { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; }

.sample-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sample-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  background: #f8fafc;
  position: relative;
}
.sample-card:hover { border-color: #93c5fd; }
.sample-card.on { background: #eff6ff; border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb; }
.sample-card img { width: 44px; height: 54px; object-fit: cover; border-radius: 5px; background: #e2e8f0; flex-shrink: 0; }
.sample-card-info { flex: 1; min-width: 0; }
.sample-card-title { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sample-card-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.del-sample-btn {
  border: none;
  background: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}
.del-sample-btn:hover { color: #dc2626; }

/* Middle Column: Fullbody & Item Crops */
.fullbody-stage {
  padding: 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
}
.bbox-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.bbox-wrap img {
  max-height: 250px;
  max-width: 100%;
  display: block;
  border-radius: 6px;
}
.bbox-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bbox-rect {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.5);
  border-radius: 3px;
  pointer-events: auto;
  cursor: pointer;
}
.bbox-rect.on {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px #2563eb, inset 0 0 0 1px #fff;
  background: rgba(37, 99, 235, 0.12);
}
.bbox-tag {
  position: absolute;
  top: -18px;
  left: -2px;
  background: #0f172a;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.bbox-rect.on .bbox-tag { background: #2563eb; }

.items-bar {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.item-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
}
.item-card:hover { border-color: #93c5fd; }
.item-card.on { background: #eff6ff; border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb; }
.item-card img { width: 46px; height: 46px; object-fit: contain; background: #f8fafc; border-radius: 5px; border: 1px solid #e2e8f0; flex-shrink: 0; }
.item-card-body { flex: 1; min-width: 0; }
.item-card-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card-cat { font-size: 11px; color: #64748b; font-family: monospace; }

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}
.st-verified { background: #dcfce7; color: #15803d; }
.st-draft { background: #fef3c7; color: #b45309; }
.st-empty { background: #f1f5f9; color: #64748b; }

/* Right Column: Checklist Editor */
.col-editor {
  overflow-y: auto;
  padding: 14px 18px 40px;
}
.editor-main { display: flex; flex-direction: column; gap: 14px; max-width: 1200px; }

.editor-header {
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.editor-imgs { display: flex; gap: 8px; }
.thumb-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  color: #64748b;
}
.thumb-pair img {
  width: 68px;
  height: 76px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.crop-pair img { border-color: #93c5fd; background: #fff; }

.editor-meta { display: flex; flex-direction: column; gap: 7px; }
.meta-row { display: flex; gap: 8px; }
.meta-row label { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: #475569; font-weight: 600; }
.meta-row label.full-width { flex: 100%; }
.meta-row input {
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12.5px;
}

.editor-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.gen-box, .save-box { display: flex; align-items: center; gap: 6px; }

.notice-bar {
  padding: 8px 12px;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 12.5px;
}
.notice-bar.err { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

.editor-section {
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  padding: 14px 16px;
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.sec-head h3 { margin: 0; font-size: 14px; color: #0f172a; }

.obj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px 12px;
}
.obj-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.obj-field label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  display: flex;
  justify-content: space-between;
}
.obj-field label code { color: #94a3b8; font-weight: 400; font-size: 11px; }
.obj-field select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  background: #f8fafc;
}

.reasoning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 12px;
}
.rea-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rea-card.forbid-card { background: #fffbeb; border-color: #fde68a; }
.rea-head { display: flex; justify-content: space-between; align-items: center; }
.rea-head b { font-size: 13px; color: #0f172a; }
.rea-head code { font-size: 11px; color: #64748b; }
.rea-desc { font-size: 11.5px; color: #64748b; margin: 0 0 2px; }
.rea-points { display: flex; flex-direction: column; gap: 5px; }
.rea-point-row { display: flex; gap: 5px; align-items: center; }
.rea-point-row input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12.5px;
  background: #fff;
}
.rea-del-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  border-radius: 5px;
  width: 24px;
  height: 26px;
  cursor: pointer;
}
.rea-del-btn:hover { color: #dc2626; border-color: #fecaca; }

/* ==================== TAB 2: Evaluation Layout ==================== */
.eval-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 20px;
  max-width: 1860px;
  margin: 0 auto;
  align-items: start;
}

.eval-sidebar { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  padding: 14px 16px;
}
.card h3 { margin: 0 0 10px; font-size: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin: 10px 0 4px; }

.model-check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.model-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 12.5px;
}

textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  resize: vertical;
}

.eval-history-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.eval-hist-row {
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.eval-hist-row:hover { border-color: #93c5fd; background: #eff6ff; }

.eval-main, .eval-report { display: flex; flex-direction: column; gap: 14px; }
.empty-box {
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
  color: #64748b;
}

table.metric-table {
  width: 100%;
  border-collapse: collapse;
}
table.metric-table th, table.metric-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 13px;
}
table.metric-table th { background: #f8fafc; color: #334155; font-weight: 600; font-size: 12px; }
.score-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
}
.sc-good { background: #dcfce7; color: #15803d; }
.sc-mid { background: #fef3c7; color: #b45309; }
.sc-bad { background: #fee2e2; color: #dc2626; }

.eval-items-list { display: flex; flex-direction: column; gap: 12px; }
.eval-item-card {
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.eval-item-head {
  padding: 9px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.eval-item-body {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 14px;
}
.eval-caption-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
}
.point-check-list { display: flex; flex-direction: column; gap: 5px; }
.point-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}
.point-row.hit { background: #f0fdf4; }
.point-row.partial { background: #fffbeb; }
.point-row.miss { background: #fef2f2; }
.fp-alert {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 12px;
}
