.formatter-dialog {
  width: min(90rem, calc(100% - 2rem));
}

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

.formatter-body {
  display: grid;
  gap: 0.8rem;
  padding: 0.8rem;
}

.formatter-advisory,
.formatter-unavailable,
.formatter-empty,
.formatter-result-note {
  margin: 0;
  color: var(--toolbox-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.formatter-advisory {
  border-left: 3px solid var(--toolbox-accent);
  padding: 0.7rem 0.8rem;
  background: var(--toolbox-accent-soft);
}

.formatter-unavailable {
  margin: 0.8rem;
  border: 1px solid
    color-mix(in srgb, var(--toolbox-danger) 45%, var(--toolbox-border));
  border-radius: calc(var(--toolbox-radius) * 0.72);
  padding: 0.8rem;
  background: color-mix(
    in srgb,
    var(--toolbox-danger) 8%,
    var(--toolbox-surface)
  );
  color: color-mix(in srgb, var(--toolbox-danger) 78%, var(--toolbox-text));
}

.formatter-preview,
.formatter-validation {
  display: grid;
  gap: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.82);
  background: var(--toolbox-surface);
}

.formatter-preview > header,
.formatter-validation > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--toolbox-border);
  background: var(--toolbox-surface-soft);
}

.formatter-preview > header p,
.formatter-preview > header h3,
.formatter-validation > header p,
.formatter-validation > header h3 {
  margin: 0;
}

.formatter-preview > header h3,
.formatter-validation > header h3 {
  font-size: 0.95rem;
}

.formatter-preview > header > span,
.formatter-validation > header > span {
  color: var(--toolbox-muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
}

.formatter-pattern-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0 0.8rem;
}

.formatter-pattern-grid article {
  display: grid;
  min-width: 0;
  gap: 0.4rem;
  color: var(--toolbox-muted);
  font-size: 0.72rem;
}

.formatter-pattern-grid pre {
  min-height: 5rem;
  max-height: 16rem;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.66);
  padding: 0.65rem;
  background: var(--toolbox-surface-soft);
  color: var(--toolbox-text);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.formatter-table-scroll {
  overflow: auto;
  margin: 0 0.8rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.66);
}

.formatter-table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.formatter-table-scroll th,
.formatter-table-scroll td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--toolbox-border);
  text-align: left;
  vertical-align: top;
}

.formatter-table-scroll th {
  position: sticky;
  top: 0;
  background: var(--toolbox-surface-soft);
  color: var(--toolbox-muted);
}

.formatter-table-scroll code {
  overflow-wrap: anywhere;
}

.formatter-table-scroll > p,
.formatter-empty {
  padding: 0.65rem;
}

.formatter-notices {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0 1.8rem 0.8rem 2.2rem;
  color: var(--toolbox-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.formatter-status {
  margin: 0 0.8rem;
  border-left: 3px solid var(--toolbox-accent);
  padding: 0.65rem 0.75rem;
  background: var(--toolbox-surface-soft);
  font-size: 0.76rem;
}

.formatter-status.is-different {
  border-left-color: var(--toolbox-danger);
}

.formatter-status.is-inconclusive {
  border-left-color: var(--regex-warning);
}

.formatter-status p {
  margin: 0.25rem 0 0;
  color: var(--toolbox-danger);
}

.formatter-progress {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.8rem;
  color: var(--toolbox-muted);
  font-size: 0.7rem;
}

.formatter-progress progress {
  width: 100%;
  accent-color: var(--toolbox-accent);
}

.formatter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0 0.8rem 0.8rem;
}

.formatter-result {
  display: grid;
  gap: 0.75rem;
  border-top: 1px solid var(--toolbox-border);
  padding-top: 0.75rem;
}

.formatter-result > dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin: 0;
  padding: 0 0.8rem;
}

.formatter-result > dl > div {
  padding: 0.5rem;
  border-bottom: 1px solid var(--toolbox-border);
}

.formatter-result dt {
  color: var(--toolbox-muted);
  font-size: 0.65rem;
  font-weight: 750;
  text-transform: uppercase;
}

.formatter-result dd {
  margin: 0.15rem 0 0;
  font-size: 0.77rem;
}

.formatter-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.6rem;
  padding: 0 0.8rem;
}

.formatter-check {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  border: 1px solid var(--toolbox-border);
  border-left: 4px solid var(--toolbox-accent);
  border-radius: calc(var(--toolbox-radius) * 0.7);
  padding: 0.65rem;
  background: var(--toolbox-surface-soft);
}

.formatter-check.is-different {
  border-left-color: var(--toolbox-danger);
}

.formatter-check.is-inconclusive {
  border-left-color: var(--regex-warning);
}

.formatter-check header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.formatter-check header span {
  color: var(--toolbox-muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.formatter-check p,
.formatter-check small {
  margin: 0;
  color: var(--toolbox-muted);
  font-size: 0.71rem;
  line-height: 1.45;
}

.formatter-check code {
  overflow-wrap: anywhere;
  font-size: 0.67rem;
}

.formatter-result-note {
  padding: 0 0.8rem;
}

.formatter-differences {
  margin: 0 0.8rem;
  border: 1px solid
    color-mix(in srgb, var(--toolbox-danger) 35%, var(--toolbox-border));
  border-radius: calc(var(--toolbox-radius) * 0.7);
  padding: 0.7rem;
  background: color-mix(
    in srgb,
    var(--toolbox-danger) 6%,
    var(--toolbox-surface)
  );
}

.formatter-differences h4 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
}

.formatter-differences ul {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.25rem;
  color: var(--toolbox-muted);
  font-size: 0.71rem;
  line-height: 1.45;
}

.formatter-confirmation {
  margin: 0 0.8rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.7);
  padding: 0.65rem;
  background: var(--toolbox-surface-soft);
  color: var(--toolbox-muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .formatter-pattern-grid {
    grid-template-columns: 1fr;
  }

  .formatter-progress {
    grid-template-columns: 1fr;
  }
}
