.we-v2-formatter {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.we-v2-formatter .we-v2-workbench__input,
.we-v2-formatter .we-v2-result {
  min-width: 0;
  min-height: 650px;
  display: flex;
  flex-direction: column;
}

.we-v2-formatter-result {
  background: var(--we-v2-surface-soft);
}

.we-v2-formatter-options {
  margin-top: 20px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  border: 1px solid var(--we-v2-line);
  border-radius: var(--we-v2-radius-md);
  background: var(--we-v2-surface-soft);
}

.we-v2-formatter-option .we-v2-control {
  min-height: 44px;
}

.we-v2-formatter-option select {
  height: 42px;
}

.we-v2-formatter-check {
  min-height: 60px;
  padding: 10px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--we-v2-line);
  border-radius: var(--we-v2-radius-sm);
  background: var(--we-v2-surface);
  cursor: pointer;
}

.we-v2-formatter-check input {
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  flex: 0 0 auto;
  accent-color: var(--we-v2-primary);
}

.we-v2-formatter-check span {
  display: grid;
  gap: 3px;
}

.we-v2-formatter-check b {
  color: var(--we-v2-text-soft);
  font-size: 12px;
}

.we-v2-formatter-check small {
  color: var(--we-v2-muted);
  font-size: 10px;
  line-height: 1.45;
}

.we-v2-formatter-editor {
  min-height: 330px;
  margin-top: 18px;
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--we-v2-line-strong);
  border-radius: var(--we-v2-radius-md);
  background: var(--we-v2-surface);
}

.we-v2-formatter-editor:focus-within {
  border-color: var(--we-v2-primary);
  box-shadow: 0 0 0 3px var(--we-v2-primary-ring);
}

.we-v2-formatter-editor > label {
  min-height: 43px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--we-v2-line);
  color: var(--we-v2-text-soft);
  font-size: 12px;
  font-weight: 750;
}

.we-v2-formatter-editor > label span {
  color: var(--we-v2-muted);
  font-size: 10px;
  font-weight: 650;
  text-align: right;
}

.we-v2-formatter-editor textarea {
  width: 100%;
  min-height: 270px;
  padding: 15px;
  flex: 1;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--we-v2-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 2;
}

.we-v2-formatter-editor textarea::placeholder {
  color: var(--we-v2-faint);
}

.we-v2-formatter-editor--output {
  min-height: 360px;
  margin-top: 18px;
}

.we-v2-formatter-editor--output textarea {
  background: #fbfcfe;
}

.we-v2-formatter-actions,
.we-v2-formatter-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.we-v2-formatter-actions {
  margin-top: 12px;
}

.we-v2-formatter-actions button,
.we-v2-formatter-result-actions button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--we-v2-line);
  border-radius: var(--we-v2-radius-sm);
  background: var(--we-v2-surface);
  color: var(--we-v2-text-soft);
  font-size: 11px;
  font-weight: 750;
}

.we-v2-formatter-actions button:hover,
.we-v2-formatter-result-actions button:hover {
  border-color: var(--we-v2-primary-line);
  color: var(--we-v2-primary);
}

.we-v2-formatter-result-actions button:first-child {
  border-color: var(--we-v2-primary);
  background: var(--we-v2-primary);
  color: #fff;
}

.we-v2-formatter-result-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.we-v2-formatter-metrics {
  margin-top: 18px;
}

.we-v2-formatter-metrics dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.we-v2-formatter-status,
.we-v2-formatter-limitation {
  min-height: 44px;
  margin: 12px 0 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--we-v2-radius-sm);
  font-size: 11px;
  line-height: 1.55;
}

.we-v2-formatter-status {
  background: var(--we-v2-success-soft);
  color: var(--we-v2-success);
  font-weight: 700;
}

.we-v2-formatter-status[data-tone="danger"] {
  background: var(--we-v2-danger-soft);
  color: var(--we-v2-danger);
}

.we-v2-formatter-limitation {
  background: var(--we-v2-primary-soft);
  color: var(--we-v2-text-soft);
}

.we-v2-formatter-limitation > span {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--we-v2-primary);
}

.we-v2-svg-preview {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--we-v2-line);
  border-radius: var(--we-v2-radius-md);
  background: var(--we-v2-surface);
}

.we-v2-svg-preview > header {
  min-height: 54px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--we-v2-line);
}

.we-v2-svg-preview h3 {
  margin: 0;
  color: var(--we-v2-text);
  font-size: 13px;
}

.we-v2-svg-preview p {
  margin: 2px 0 0;
  color: var(--we-v2-muted);
  font-size: 10px;
}

.we-v2-svg-preview > header > span {
  width: 19px;
  height: 19px;
  color: var(--we-v2-success);
}

.we-v2-svg-preview iframe {
  width: 100%;
  height: 230px;
  display: block;
  border: 0;
  background: #f8fafc;
}

@media (max-width: 940px) {
  .we-v2-formatter {
    grid-template-columns: 1fr;
  }

  .we-v2-formatter .we-v2-workbench__input,
  .we-v2-formatter .we-v2-result {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .we-v2-formatter-options {
    grid-template-columns: 1fr;
  }

  .we-v2-formatter-editor {
    min-height: 285px;
  }

  .we-v2-formatter-editor textarea {
    min-height: 225px;
  }

  .we-v2-formatter-result-actions {
    width: 100%;
  }

  .we-v2-formatter-result-actions button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .we-v2-formatter * {
    scroll-behavior: auto !important;
  }
}
