* { box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: #1f2937;
  background: #fafafa;
  line-height: 1.55;
}
.top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 0 20px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  color: #1e3a8a;
  text-decoration: none;
}
.sub { color: #6b7280; font-size: 13px; }
.topnav { margin-left: auto; display: flex; gap: 16px; }
.topnav a {
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { color: #1e40af; border-bottom-color: #1e40af; }
.nowrap { white-space: nowrap; }
.warn-inline { color: #b45309; font-size: 12px; }
.btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.danger:hover { background: #991b1b; border-color: #991b1b; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 18px; }
.card h3 { font-size: 15px; color: #475569; margin-top: 0; }

.muted { color: #94a3b8; font-size: 12px; }
.warn {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.upload-form { display: flex; flex-direction: column; gap: 14px; }
.upload-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.upload-form label span { color: #475569; font-weight: 500; }
.upload-form input[type="file"],
.upload-form input[type="number"],
.upload-form select {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.upload-form .inline { display: flex; gap: 14px; }
.upload-form .inline label { flex: 1; }

.btn {
  display: inline-block;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  color: #1f2937;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: #1e40af; }
.btn.primary { background: #1e40af; color: #fff; border-color: #1e40af; }
.btn.primary:hover { background: #1e3a8a; }
.btn.small { padding: 4px 10px; font-size: 12px; }

.review-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.review-table th, .review-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}
.review-table th { color: #475569; background: #f8fafc; }

.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
}
.status-queued { background: #e0e7ff; color: #3730a3; }
.status-running { background: #fef3c7; color: #92400e; }
.status-done { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #f3f4f6; color: #6b7280; }

.review-head { display: flex; justify-content: space-between; align-items: center; }

.phases {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.phase {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
}
.phase-label { font-size: 12px; color: #334155; font-weight: 500; }
.phase-status { font-size: 11px; color: #6b7280; text-transform: uppercase; margin-top: 2px; }
.phase-progress { font-size: 14px; font-weight: 600; color: #1e40af; margin-top: 4px; }
.phase-detail { margin-top: 4px; font-size: 11px; }
.phase-pending { opacity: 0.6; }
.phase-running { border-color: #fbbf24; background: #fef3c7; }
.phase-done { border-color: #10b981; background: #d1fae5; }
.phase-failed { border-color: #dc2626; background: #fee2e2; }
.phase-skipped { opacity: 0.5; border-style: dashed; }

.log-tail {
  max-height: 280px;
  overflow-y: auto;
  background: #1e293b;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 6px;
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 12px;
  line-height: 1.5;
}
.log-line { padding: 1px 0; white-space: pre-wrap; }

code {
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: "SF Mono", monospace;
}

/* ── Standard detail: clause groups & sub-cards (report 同款样式) ──── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.norm-mandatory   { background: #fee2e2; color: #991b1b; }
.norm-recommended { background: #fef3c7; color: #92400e; }
.norm-informative { background: #e0e7ff; color: #3730a3; }
.norm-descriptive { background: #f3f4f6; color: #4b5563; }
.sev-critical { background: #fca5a5; color: #7f1d1d; }
.sev-major    { background: #fdba74; color: #7c2d12; }
.sev-minor    { background: #e5e7eb; color: #374151; }

.bbox-ok-badge   { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #d1fae5; color: #065f46; font-weight: 600; }
.bbox-miss-badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #f3f4f6; color: #9ca3af; }

.page-link {
  display: inline-block;
  padding: 1px 8px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.page-link:hover { background: #bfdbfe; }

.dreq-count { background: #e0e7ff; color: #3730a3; padding: 1px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; }

.clause-groups { display: flex; flex-direction: column; gap: 24px; margin-top: 8px; }

.clause-group {
  border-top: 2px solid #cbd5e1;
  padding-top: 14px;
}
.clause-group:first-child { border-top: none; padding-top: 0; }

.clause-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.clause-group-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clause-group-num {
  font-size: 16px;
  font-weight: 700;
  background: #1e3a8a;
  color: #fff;
  padding: 3px 12px;
  border-radius: 4px;
  font-family: "SF Mono", monospace;
}
.clause-group-meta { display: flex; align-items: center; gap: 8px; }

.sub-list { display: flex; flex-direction: column; gap: 12px; }

.sub-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.sub-head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.sub-id-badge {
  font-weight: 700;
  font-family: "SF Mono", monospace;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 10px;
  border-radius: 4px;
}

.verify-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
}
.verify-ok   { background: #d1fae5; color: #065f46; }
.verify-fail { background: #fee2e2; color: #991b1b; }

.sub-body { padding: 14px; }
.std-side { min-width: 0; }
.std-side h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.sub-req {
  font-weight: 700;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-all;
}

.clause-full { margin-top: 12px; }
.clause-full-label {
  font-size: 11px;
  color: #1e40af;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.clause-full-text {
  padding: 10px 12px;
  background: #f8fafc;
  border-left: 3px solid #1e40af;
  font-size: 13px;
  color: #111827;
  font-weight: 500;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.std-thumb {
  margin-top: 12px;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 4px;
  border: 1px dashed #94a3b8;
}
.std-thumb-label {
  font-size: 11px;
  color: #1e40af;
  font-weight: 500;
  margin-bottom: 4px;
}
.std-thumb img {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  display: block;
  margin-bottom: 4px;
  background: #fff;
  min-height: 60px;
}
.std-thumb a {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  color: #1e40af;
  text-decoration: none;
}
.std-thumb a:hover { text-decoration: underline; }

.sub-empty {
  padding: 10px 14px;
  font-size: 12px;
  border: 1px dashed #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
}
.sub-empty .empty-label {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 11px;
  margin-right: 8px;
  background: #e0e7ff;
  color: #3730a3;
  vertical-align: middle;
}
.sub-empty .empty-tip { color: #64748b; }

.empty-terms .empty-label       { background: #e0e7ff; color: #3730a3; }
.empty-nref .empty-label        { background: #e0f2fe; color: #075985; }
.empty-scope .empty-label       { background: #f0fdf4; color: #166534; }
.empty-appendix-inf .empty-label{ background: #f3f4f6; color: #4b5563; }
.empty-foreword .empty-label    { background: #f3f4f6; color: #4b5563; }
.empty-desc .empty-label        { background: #f5f3ff; color: #6b21a8; }
.empty-defn .empty-label        { background: #ecfdf5; color: #065f46; }
.empty-ref .empty-label         { background: #eff6ff; color: #1e40af; }
.empty-anomaly                  { background: #fffbeb; border-color: #fbbf24; }
.empty-anomaly .empty-label     { background: #fef3c7; color: #92400e; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  .phases { grid-template-columns: repeat(3, 1fr); }
  .upload-form .inline { flex-direction: column; }
}
@media (max-width: 600px) {
  .phases { grid-template-columns: repeat(2, 1fr); }
}
