:root {
  --fg: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f9fafb;
  --primary: #2563eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 18px 22px 40px;
  max-width: 1180px;
  background: #fbfbfc;
  color: var(--fg);
  font: 13px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

h1 { margin: 0; font-size: 19px; }
h2 { margin: 0 0 10px; font-size: 14px; }

/* 折叠展开出来的"行级用例"子行：与主行区分开，看得出是从属于它的明细 */
.case-sub td { background: #f8fafc; font-size: 12px; }

.pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
}

.card {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

button {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

button:hover:not(:disabled) { background: var(--soft); border-color: #d1d5db; }
button:disabled { opacity: .45; cursor: not-allowed; }

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.primary:hover:not(:disabled) { background: #1d4ed8; }

button.danger { border-color: #fca5a5; color: #b91c1c; }
button.danger:hover:not(:disabled) { background: #fef2f2; }

.chk { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.hint.ok { color: #15803d; }
.hint.warn { color: #b45309; }
.hint.err { color: #b91c1c; }

.taskbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

#taskText { font-size: 12px; font-weight: 600; }
#taskText.ok { color: #1d4ed8; }
#taskText.warn { color: #b45309; }

#basisHint:empty { display: none; }

.muted { color: var(--muted); font-size: 12px; }

.code {
  max-height: 340px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font: 11px/1.6 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

details { margin-top: 8px; }

summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--primary);
}

.scroll { max-height: 420px; overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:hover { background: var(--soft); }

.pass { color: #15803d; }
.supplement { color: #1d4ed8; }
.reject { color: #b91c1c; }
.manual { color: #b45309; }

.tag {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 17px;
}

.tag.pass { background: #dcfce7; color: #15803d; }
.tag.supplement { background: #dbeafe; color: #1d4ed8; }
.tag.reject { background: #fee2e2; color: #b91c1c; }
.tag.manual { background: #fef3c7; color: #b45309; }
.tag.none { background: #f3f4f6; color: var(--muted); }
/* 版本标记：同一申请单的多次提交，用于区分各自独立的样本 */
.tag.ver { background: #ede9fe; color: #6d28d9; }

.cell-note { color: var(--muted); font-size: 11px; }

.run {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.run-head {
  display: grid;
  grid-template-columns: 150px 160px 90px 90px 100px 100px;
  gap: 6px;
  padding: 9px 12px;
  background: var(--soft);
  cursor: pointer;
  font-size: 12px;
}

.run-head:hover { background: #f3f4f6; }
.run-head .id { font-weight: 600; }
.run-head .num { color: var(--muted); }

.run-body { padding: 10px 12px; font-size: 12px; }
.run-body table { margin-top: 6px; }
.sub { margin: 10px 0 4px; font-weight: 600; }
.sub.warn { color: #b45309; }

.good { color: #15803d; }
.bad { color: #b91c1c; }

/* ---------- 判定依据编辑 ---------- */

/* 默认收起：提示词与规则加起来上千字，一直展开会把用例列表挤到屏幕外 */
.basis-edit { margin-top: 10px; }

.basis-edit > summary {
  padding: 5px 0;
  font-weight: 600;
}

.basis-edit > summary .edit-mark { margin-left: 8px; font-weight: 400; }

.edit-block { margin-top: 12px; }

.edit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
}

.edit-mark { font-size: 11px; font-weight: 400; }
.edit-mark.warn { color: #b45309; }

/* 编辑区：等宽、可纵向拉高；改动要不要生效由「保存判定依据」决定 */
textarea.edit {
  display: block;
  width: 100%;
  max-height: 340px;
  margin: 0;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}

textarea.edit:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

/* ---------- 二次确认弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, .38);
}

.modal[hidden] { display: none; }

.modal-box {
  width: min(460px, calc(100vw - 40px));
  padding: 16px 18px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
}

/* 详情弹窗要放两张表，宽一些 */
.modal-box.wide { width: min(880px, calc(100vw - 40px)); }

.modal-box h3 { margin: 0 0 10px; font-size: 14px; }

.modal-body {
  font-size: 12px;
  max-height: 62vh;
  overflow-y: auto;
}

.modal-line {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.modal-line .modal-label {
  flex: none;
  width: 56px;
  color: var(--muted);
}

.modal-line.changed { color: #b45309; font-weight: 600; }

.modal-warn {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid #fcd34d;
  border-radius: 7px;
  background: #fffbeb;
  color: #b45309;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

/* ---------- 判定详情 ---------- */

.detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.detail-reason { color: #4b5563; }

.detail-meta {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  color: #4b5563;
}

.detail-meta .detail-label {
  flex: none;
  width: 64px;
  color: var(--muted);
}

.detail-sec {
  margin: 12px 0 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.detail-empty { padding: 4px 0; color: var(--muted); }

.tag.bad { background: #fee2e2; color: #b91c1c; }

/* ---------- 复盘：来源轮次提示 ---------- */

.run-note {
  margin: 8px 0 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: #4b5563;
}

.run-note .warn { margin-top: 4px; color: #b45309; }

/* 长表格默认收起：详情一屏要塞下表单值、材料图与错因记录 */
.detail-fold { margin-top: 12px; }

.detail-fold > summary {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-weight: 600;
  color: var(--muted);
}

.detail-fold[open] > summary { margin-bottom: 2px; }

/* ---------- 复盘：材料缩略图 ---------- */

.thumb-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.thumb { width: 108px; text-align: center; }

.thumb img {
  display: block;
  width: 108px;
  height: 84px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  /* 缩略图请求前的占位底色，避免缩略图墙先白着再跳出来 */
  background: #f3f4f6;
  cursor: zoom-in;
}

.thumb img:hover { border-color: var(--primary); }

.thumb-cap {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 归档记了附件、文件却读不到：如实标出，不留白 */
.thumb.missing {
  padding: 10px 4px;
  border: 1px dashed #fca5a5;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 11px;
}

/* 点开看原图：盖在详情弹窗之上，关掉后弹窗状态不变 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: rgba(17, 24, 39, .82);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 90px);
  border-radius: 6px;
  background: #fff;
}

.lightbox-cap { color: #e5e7eb; font-size: 12px; }

/* 非图片材料（PDF）的文本层：模型当时读到的那段文字，与渲染图一起给人看。
   固定在一角而不是排进 flex 流里——图片的适配尺寸不因此变小 */
.lb-text {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 81;
  max-width: 420px;
  max-height: 42vh;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .96);
  color: #1f2329;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}

/* ---------- 复盘：错因记录 ---------- */

.review-tip { padding: 2px 0; color: var(--muted); }

.review-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}

.review-form select,
.review-form input {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
}

.review-form input { flex: 1 1 260px; min-width: 180px; }

.review-form select:focus,
.review-form input:focus { outline: none; border-color: var(--primary); }

.review-hint { font-size: 11px; color: var(--muted); }
.review-hint.err { color: #b91c1c; }
