.comparison-code-dialog {
  width: min(88rem, calc(100% - 2rem));
}

.comparison-code-panel {
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.comparison-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem 0;
}

.comparison-tabs button {
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.72);
  padding: 0.55rem 0.8rem;
  background: var(--toolbox-surface);
  color: var(--toolbox-text);
  font-weight: 750;
}

.comparison-tabs button[aria-selected="true"] {
  border-color: var(--toolbox-accent);
  background: var(--toolbox-accent-soft);
}

.comparison-config,
.comparison-tab-panel {
  display: grid;
  gap: 0.8rem;
  padding: 0.8rem;
}

.comparison-config {
  border-bottom: 1px solid var(--toolbox-border);
  background: var(--toolbox-surface-soft);
}

.comparison-config-row,
.comparison-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}

.comparison-config label,
.comparison-limit-grid label,
.comparison-text-field {
  display: grid;
  gap: 0.3rem;
  color: var(--toolbox-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.comparison-config select,
.comparison-config input,
.comparison-config textarea {
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.65);
  padding: 0.5rem 0.6rem;
  background: var(--toolbox-surface);
  color: var(--toolbox-text);
}

.comparison-config textarea {
  min-height: 4.8rem;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.comparison-scan-control {
  display: flex !important;
  align-items: center;
  padding-bottom: 0.5rem;
}

.comparison-variant-grid,
.comparison-side-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.comparison-flag-selector,
.comparison-limit-grid {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.7);
  padding: 0.55rem;
}

.comparison-flag-selector legend,
.comparison-limit-grid legend {
  padding-inline: 0.3rem;
  color: var(--toolbox-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.comparison-flag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.comparison-flag-selector label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--toolbox-border);
  border-radius: 99rem;
  padding: 0.25rem 0.45rem;
  background: var(--toolbox-surface);
}

.comparison-flag-selector span {
  font-size: 0.67rem;
}

.comparison-limit-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(6rem, 1fr));
  gap: 0.5rem;
}

.comparison-subject textarea {
  min-height: 7rem;
}

.comparison-actions p {
  margin: 0;
  color: var(--toolbox-muted);
  font-size: 0.78rem;
}

.comparison-panel-status.status-error,
.comparison-error {
  color: var(--toolbox-danger);
}

.comparison-result {
  display: grid;
  gap: 0.8rem;
}

.comparison-verdict,
.comparison-reasons,
.comparison-differences,
.comparison-alignments,
.generated-code-result {
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.78);
  padding: 0.8rem;
  background: var(--toolbox-surface);
}

.comparison-verdict h3,
.comparison-verdict p,
.comparison-verdict small,
.comparison-reasons h4,
.comparison-differences h4,
.comparison-alignments h4,
.generated-code-result h3,
.generated-code-result p {
  margin: 0;
}

.comparison-verdict {
  display: grid;
  gap: 0.3rem;
  border-left: 4px solid var(--regex-success);
}

.comparison-verdict.verdict-not-comparable {
  border-left-color: var(--regex-warning);
}

.comparison-verdict.verdict-different-for-current-input {
  border-left-color: var(--toolbox-danger);
}

.comparison-verdict p,
.comparison-verdict small,
.comparison-reasons,
.comparison-differences > p,
.comparison-alignments > p,
.generated-code-result li {
  color: var(--toolbox-muted);
  font-size: 0.77rem;
  line-height: 1.5;
}

.comparison-reasons ul,
.generated-code-result ul {
  margin-bottom: 0;
}

.comparison-side-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.78);
  background: var(--toolbox-surface);
}

.comparison-side-card > header,
.generated-code-result > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.7rem;
  border-bottom: 1px solid var(--toolbox-border);
}

.comparison-side-card h4,
.comparison-side-card p {
  margin: 0;
}

.comparison-side-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.comparison-side-card dl > div {
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--toolbox-border);
}

.comparison-side-card dt {
  color: var(--toolbox-muted);
  font-size: 0.67rem;
  font-weight: 750;
  text-transform: uppercase;
}

.comparison-side-card dd {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.76rem;
}

.comparison-side-card details,
.comparison-side-card > .comparison-error {
  padding: 0.55rem 0.7rem;
  font-size: 0.74rem;
}

.comparison-side-card details ul {
  margin-bottom: 0;
}

.comparison-differences,
.comparison-alignments {
  overflow: auto;
}

.comparison-differences h4,
.comparison-alignments h4 {
  margin-bottom: 0.65rem;
}

.comparison-differences td code {
  display: block;
  max-width: 22rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comparison-limit-note {
  margin-bottom: 0 !important;
}

.generated-code-result {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.generated-code-result > p,
.generated-code-result > ul {
  margin-inline: 0.8rem;
}

.generated-code-result pre {
  max-height: 34rem;
  overflow: auto;
  margin: 0;
  border-top: 1px solid var(--toolbox-border);
  padding: 0.8rem;
  background: #111827;
  color: #e5e7eb;
  font-size: 0.72rem;
  line-height: 1.45;
}

.comparison-empty-state {
  margin: 0;
  padding: 1.2rem;
  color: var(--toolbox-muted);
  text-align: center;
}

@media (max-width: 64rem) {
  .comparison-limit-grid {
    grid-template-columns: repeat(3, minmax(6rem, 1fr));
  }
}

@media (max-width: 48rem) {
  .comparison-variant-grid,
  .comparison-side-grid,
  .comparison-side-card dl {
    grid-template-columns: 1fr;
  }

  .comparison-limit-grid {
    grid-template-columns: repeat(2, minmax(6rem, 1fr));
  }
}
