body.diff-page {
  min-width: 1200px;
  background: #ffffff;
}

.diff-page .site-wrap {
  width: 1200px;
}

.diff-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.18fr);
  gap: 12px;
  margin-bottom: 12px;
}

.diff-grid > .panel {
  min-width: 0;
}

.diff-input-body {
  display: flex;
  flex-direction: column;
}

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

.diff-textarea {
  min-height: 224px;
  font-size: 14px;
}

.diff-input-meta {
  margin-top: 8px;
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sample-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-mid);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.sample-chip:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.btn {
  gap: 6px;
}

.btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sample-chip .btn-icon {
  width: 12px;
  height: 12px;
  opacity: 0.9;
}

.diff-summary-panel .panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diff-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 9px;
  background: #ffffff;
}

.metric-card-add {
  background: #ecfdf3;
  border-color: #bbf7d0;
}

.metric-card-del {
  background: #fef2f2;
  border-color: #fecaca;
}

.metric-label {
  margin: 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.metric-value {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-main);
}

.diff-legend-block {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
}

.legend-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-main);
}

.diff-legend {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 12px;
  color: var(--ink-mid);
}

.legend-add {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.legend-del {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.legend-same {
  background: #f8fafc;
}

.diff-lead {
  margin: 0;
  color: var(--ink-mid);
  font-size: 13px;
  line-height: 1.6;
}

.diff-viz-actions {
  display: flex;
}

.diff-viz-ad-wrap {
  margin-bottom: 8px;
  display: flex;
  justify-content: stretch;
}

.diff-viz-ad {
  width: 100%;
  min-height: 90px;
}

.diff-viz-actions .btn-primary {
  width: 100%;
}

.diff-view-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.diff-result-summary {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.result-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 46px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.result-chip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mid);
}

.result-chip-value {
  font-size: 18px;
  font-weight: 700;
}

.result-chip-add {
  border-color: #86efac;
  background: #ecfdf3;
}

.result-chip-add .result-chip-value {
  color: #166534;
}

.result-chip-del {
  border-color: #fca5a5;
  background: #fef2f2;
}

.result-chip-del .result-chip-value {
  color: #991b1b;
}

.diff-view-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
}

.diff-view-title {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-mid);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.diff-view-content {
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
  word-break: break-word;
}

.diff-token-add {
  background: #dcfce7;
  color: #166534;
  border-radius: 4px;
  padding: 0 1px;
}

.diff-token-del {
  background: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: #dc2626;
  border-radius: 4px;
  padding: 0 1px;
}

.diff-token-same {
  color: var(--ink-main);
}

.diff-sub-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.diff-table-panel .panel-body {
  padding-top: 12px;
}

.diff-table-section {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
}

.table-note {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--ink-muted);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: auto;
}

.diff-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.diff-table th,
.diff-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  font-size: 12px;
  text-align: center;
}

.diff-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--ink-mid);
  font-weight: 600;
  z-index: 1;
}

.diff-table tr:last-child td {
  border-bottom: 0;
}

.diff-table td.token-cell {
  text-align: left;
  color: var(--ink-main);
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-table td.type-cell {
  font-weight: 700;
}

.diff-table td.type-cell.add {
  color: #166534;
}

.diff-table td.type-cell.del {
  color: #991b1b;
}

.empty-box {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
}

@media (max-width: 1199px) {
  body.diff-page {
    min-width: 0;
  }

  .diff-page .site-wrap {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  body.diff-page {
    min-width: 0;
  }

  .diff-page .site-wrap {
    width: 100%;
    min-width: 0;
    padding: 0 10px 20px;
  }

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

  .diff-textarea {
    min-height: 176px;
  }

  .diff-summary-grid,
  .diff-view-grid,
  .diff-result-summary,
  .diff-sub-actions {
    grid-template-columns: 1fr;
  }
}
