.diff-editors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.diff-editor-heading,
.diff-toolbar,
#diff-results-title { scroll-margin-block-start: 16px; }
.diff-results-heading,
.diff-working,
.diff-change-nav,
.diff-pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.diff-editor-heading,
.diff-results-heading,
.diff-toolbar,
.diff-pages {
  justify-content: space-between;
}
.diff-editor-heading {
  margin-bottom: 6px;
  font-weight: 600;
}
.diff-file,
.diff-quiet {
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid var(--ws-ink);
  border-radius: var(--r-xs);
  background: transparent;
  color: inherit;
  font-size: var(--fs-small);
  font-weight: 500;
}
.diff-file {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.diff-file input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
.diff-file:focus-within {
  outline: 3px solid var(--go);
  outline-offset: 3px;
}
.diff-file:hover,
.diff-quiet:not(:disabled):hover,
.diff-fold:hover {
  background: var(--ws-2);
}
.diff-quiet:disabled {
  opacity: .45;
  cursor: default;
}
.diff-editor textarea {
  display: block;
  min-height: 128px;
  line-height: var(--lh-ui);
}
.diff-file-limit {
  margin: 8px 0 16px;
}
.diff-field-error {
  margin: 8px 0 0;
  color: var(--err);
  font-size: var(--fs-small);
}
.diff-input-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
}
.diff-input-preview p {
  margin: 0;
}
.diff-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
  min-width: 0;
  margin: 0;
  padding: 0 0 4px;
  border: 0;
}
.diff-options legend {
  margin-bottom: 2px;
  padding: 0;
  font-size: var(--fs-small);
  font-weight: 600;
}
.diff-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: var(--fs-small);
  cursor: pointer;
}
.diff-options input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ws-ink);
}
.diff-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.diff-working:has(> :not([hidden])) {
  margin-top: 12px;
}
.diff-working p {
  margin: 0;
}
.diff-working progress {
  flex: 1 1 80px;
}
.diff-results {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--ws-line-strong);
}
.diff-results-heading h2 {
  margin: 0;
  font: 400 clamp(1.8rem, 4vw, 2.5rem)/1 var(--font-display);
}
.diff-summary {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.diff-result-area {
  padding: 0;
  border: 0;
}
.diff-results-heading .zt-explain {
  flex-basis: 100%;
  margin: 0;
}
.diff-toolbar {
  margin: 12px 0;
}
.diff-toolbar .zt-segments button {
  font-size: var(--fs-small);
}
.diff-change-nav {
  gap: 8px;
}
.diff-change-nav .zt-hint {
  padding-inline: 4px;
}
.diff-preview {
  position: relative;
  max-height: clamp(18rem, 52vh, 36rem);
  overflow: auto;
  border: 1px solid var(--ws-line-strong);
  border-radius: var(--r-sm);
  overscroll-behavior: contain;
}
.diff-columns,
.diff-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.diff-columns {
  position: sticky;
  z-index: 1;
  top: 0;
  border-bottom: 1px solid var(--ws-line-strong);
  background: var(--ws-2);
  font-weight: 600;
}
.diff-columns span {
  padding: 8px 12px;
}
.diff-row > :first-child,
.diff-columns > :first-child {
  border-inline-end: 1px solid var(--ws-line);
}
.diff-cell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(2.4ch, max-content) 1ch minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 5px 9px;
  font-size: var(--fs-small);
  line-height: 1.5;
}
.diff-line-number {
  color: var(--ws-dim);
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.diff-sign {
  font-weight: 700;
}
.diff-line-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  tab-size: 4;
  text-align: start;
}
.diff-line-note {
  color: var(--ws-dim);
  font-style: italic;
}
.diff-added {
  background: #e6efda;
}
.diff-removed {
  background: #f6e4dc;
}
.diff-added .diff-sign { color: #33651b; }
.diff-removed .diff-sign { color: #a52c13; }
.diff-cell mark {
  background: #d0e5b5;
  color: var(--ws-ink);
  text-decoration: underline;
  text-underline-offset: .18em;
}
.diff-removed mark {
  background: #ecc4b3;
  text-decoration: line-through;
}
.diff-gap {
  background: var(--ws-2);
}
.diff-current {
  border-inline-start: 3px solid var(--ws-line-strong);
}
.diff-current .diff-cell:first-child {
  padding-inline-start: 6px;
}
.diff-fold {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 7px 12px;
  border: 0;
  border-block: 1px solid var(--ws-line);
  background: transparent;
  color: var(--ws-ink);
  font-size: var(--fs-small);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.diff-fold:focus-visible {
  outline-offset: -4px;
}
.diff-pages {
  gap: 8px;
  margin-top: 12px;
}
.diff-export.zt-bar {
  justify-content: flex-end;
}
.diff-export .zt-button {
  min-width: 0;
  padding-inline: 12px;
  text-align: center;
}
.diff-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (min-width: 900px) {
  .diff-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  .diff-export .diff-quiet {
    border-color: var(--ink);
  }
  .diff-export .diff-quiet:hover {
    background: var(--ws);
    color: var(--ws-ink);
  }
  .diff-export .zt-button {
    border-color: var(--ws);
    background: var(--ws);
    color: var(--ws-ink);
  }
}
@media (max-width: 700px) {
  .diff-editors {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .diff-editor textarea {
    height: 104px;
    min-height: 104px;
  }
  .diff-options {
    align-items: stretch;
  }
  .diff-change-nav .zt-hint {
    width: 100%;
    padding: 0;
  }
  .diff-export.zt-bar {
    justify-content: stretch;
  }
  .diff-export > button {
    flex: 1 1 auto;
  }
  .diff-cell {
    gap: 5px;
    padding-inline: 6px;
  }
  .diff-current .diff-cell:first-child {
    padding-inline-start: 3px;
  }
}
@media (forced-colors: active) {
  .diff-current { border-color: Highlight; }
  .diff-cell mark { color: MarkText; background: Mark; }
}

@media (max-width: 700px) {
  .diff-export.zt-bar { grid-template-columns: 1fr auto; }
}

.diff-editor-heading > .zt-hint { flex: 1 0 100%; order: 5; margin: 0; }
.diff-editor-heading > .zt-sample { order: 4; margin-inline-start: auto; }
.diff-editor-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.diff-editor-heading > label:first-child { margin-inline-end: auto; }
