/* ====== Diff view (Side-by-side) ====== */
/* 一行 diff = 左右两列并排（A | B），同步显示 */
.diff-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.diff-table col.diff-col-gutter { width: 52px; }
.diff-table col.diff-col-content { width: auto; }

.diff-head-row th {
  position: sticky; top: 0; z-index: 2;
  padding: 6px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.dark .diff-head-row th {
  color: #9ca3af;
  background: #111827;
  border-bottom-color: #374151;
}
.diff-head-th-a { color: #b91c1c !important; }
.dark .diff-head-th-a { color: #fecaca !important; }
.diff-head-th-b { color: #166534 !important; }
.dark .diff-head-th-b { color: #bbf7d0 !important; }
.diff-head-split { width: 2px; background: #e5e7eb; padding: 0 !important; }
.dark .diff-head-split { background: #374151; }

.diff-row td {
  vertical-align: top;
  padding: 2px 6px;
  border-bottom: 1px solid rgba(229,231,235,0.5);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.dark .diff-row td { border-bottom-color: rgba(55,65,81,0.5); }

.diff-gutter {
  width: 52px;
  font-size: 11px;
  text-align: right;
  color: #9ca3af;
  user-select: none;
  padding-right: 4px !important;
  border-right: 1px solid #e5e7eb !important;
}
.dark .diff-gutter { color: #6b7280; border-right-color: #374151 !important; }

.diff-split-cell { width: 2px; padding: 0 !important; background: #e5e7eb; }
.dark .diff-split-cell { background: #374151; }

/* Side-by-side row backgrounds */
.diff-row-type-same td.diff-cell-a,
.diff-row-type-same td.diff-cell-b { background: transparent; }
.diff-row-type-same td.diff-gutter { background: #fafafa; }
.dark .diff-row-type-same td.diff-gutter { background: #0b1220; }

.diff-row-type-del td.diff-cell-a { background: rgba(239, 68, 68, 0.10); }
.diff-row-type-del td.diff-cell-a { color: inherit; }
.diff-row-type-del td.diff-gutter-a { background: rgba(239, 68, 68, 0.06); color: #dc2626; }
.dark .diff-row-type-del td.diff-cell-a { background: rgba(239, 68, 68, 0.16); }
.dark .diff-row-type-del td.diff-gutter-a { background: rgba(239, 68, 68, 0.08); color: #fca5a5; }

.diff-row-type-add td.diff-cell-b { background: rgba(34, 197, 94, 0.10); }
.diff-row-type-add td.diff-gutter-b { background: rgba(34, 197, 94, 0.06); color: #16a34a; }
.dark .diff-row-type-add td.diff-cell-b { background: rgba(34, 197, 94, 0.16); }
.dark .diff-row-type-add td.diff-gutter-b { background: rgba(34, 197, 94, 0.08); color: #86efac; }

.diff-row-type-mod td.diff-cell-a { background: rgba(245, 158, 11, 0.12); }
.diff-row-type-mod td.diff-cell-b { background: rgba(245, 158, 11, 0.12); }
.diff-row-type-mod td.diff-gutter-a,
.diff-row-type-mod td.diff-gutter-b { background: rgba(245, 158, 11, 0.06); color: #b45309; }
.dark .diff-row-type-mod td.diff-cell-a,
.dark .diff-row-type-mod td.diff-cell-b { background: rgba(245, 158, 11, 0.20); }
.dark .diff-row-type-mod td.diff-gutter-a,
.dark .diff-row-type-mod td.diff-gutter-b { background: rgba(245, 158, 11, 0.08); color: #fcd34d; }

.diff-row-type-empty td.diff-cell-a,
.diff-row-type-empty td.diff-cell-b { background: #f3f4f6; }
.diff-row-type-empty td { color: transparent; }
.dark .diff-row-type-empty td.diff-cell-a,
.dark .diff-row-type-empty td.diff-cell-b { background: #111827; }

/* 右侧缺失对应行 / 左侧缺失对应行 的占位标记（浅灰 - ） */
.diff-placeholder { color: #d1d5db; text-align: center; user-select: none; }
.dark .diff-placeholder { color: #374151; }

/* Inline (word-level) diff highlights inside same-modified cells */
.diff-ins { background: rgba(34, 197, 94, 0.28); border-bottom: 1px solid #16a34a; color: #166534; padding: 0 2px; border-radius: 3px; }
.dark .diff-ins { color: #bbf7d0; border-bottom-color: #22c55e; }
.diff-del-txt { background: rgba(239, 68, 68, 0.28); border-bottom: 1px solid #dc2626; color: #991b1b; padding: 0 2px; border-radius: 3px; text-decoration: line-through; text-decoration-color: #991b1b; }
.dark .diff-del-txt { color: #fecaca; border-bottom-color: #f87171; text-decoration-color: #f87171; }

/* Legend swatches */
.diff-legend { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 4px; border: 1px solid rgba(0,0,0,0.08); }
.dark .diff-legend { border-color: rgba(255,255,255,0.15); }

.diff-stat-card { padding: 0.75rem 0.875rem; border-radius: 0.625rem; border: 1px solid #e5e7eb; background: #f9fafb; }
.dark .diff-stat-card { background: #1f2937; border-color: #374151; }
.diff-stat-card .diff-stat-num { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.diff-stat-card .diff-stat-label { font-size: 0.75rem; color: #6b7280; margin-top: 2px; }
.dark .diff-stat-card .diff-stat-label { color: #9ca3af; }
