.jp-jsonpath-tool {
  display: grid;
  gap: var(--jp-space-4);
}

.jp-jsonpath-input-panel {
  display: grid;
  gap: var(--jp-space-3);
}

.jp-jsonpath-document {
  min-height: 220px;
  resize: vertical;
  font-family: var(--jp-font-mono);
  font-size: 0.9rem;
  line-height: var(--jp-leading-relaxed);
  tab-size: 2;
}

.jp-jsonpath-query {
  display: grid;
  gap: var(--jp-space-2);
}

.jp-jsonpath-help {
  margin: 0;
  color: var(--jp-text-soft);
  font-size: var(--jp-text-xs);
  line-height: var(--jp-leading-relaxed);
}

.jp-jsonpath-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--jp-space-3);
}

.jp-jsonpath-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--jp-text-soft);
  font-size: var(--jp-text-sm);
}

.jp-jsonpath-status.is-error {
  color: var(--jp-danger, #b42318);
}

.jp-jsonpath-status.is-success {
  color: var(--jp-success, #067647);
}

.jp-jsonpath-syntax summary {
  color: var(--jp-text);
  font-weight: var(--jp-weight-semibold);
  cursor: pointer;
}

.jp-jsonpath-syntax p:first-of-type {
  margin-top: var(--jp-space-3);
}

.jp-jsonpath-syntax li + li {
  margin-top: var(--jp-space-2);
}

.jp-jsonpath-syntax code,
.jp-jsonpath-match-path,
.jp-jsonpath-match-value {
  font-family: var(--jp-font-mono);
  overflow-wrap: anywhere;
}

.jp-jsonpath-results {
  display: grid;
  gap: var(--jp-space-3);
}

.jp-jsonpath-results[hidden] {
  display: none;
}

.jp-jsonpath-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--jp-space-3);
}

.jp-jsonpath-results-heading h2,
.jp-jsonpath-results-heading p {
  margin-bottom: 0;
}

.jp-jsonpath-match-list {
  display: grid;
  gap: var(--jp-space-3);
}

.jp-jsonpath-match {
  display: grid;
  gap: var(--jp-space-3);
  min-width: 0;
}

.jp-jsonpath-match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--jp-space-3);
}

.jp-jsonpath-match-header h3 {
  margin: 0;
  font-size: var(--jp-text-sm);
}

.jp-jsonpath-match-path {
  margin: 0;
  color: var(--jp-text-soft);
  font-size: var(--jp-text-xs);
}

.jp-jsonpath-match-value {
  max-height: 300px;
  margin: 0;
  overflow: auto;
  padding: var(--jp-space-3);
  border: 1px solid var(--jp-border);
  border-radius: var(--jp-radius-sm);
  background: var(--jp-surface-soft);
  color: var(--jp-text);
  font-size: var(--jp-text-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.jp-jsonpath-copy-match {
  min-height: 42px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .jp-jsonpath-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .jp-jsonpath-actions .jp-tool-button,
  .jp-jsonpath-results-heading .jp-tool-button {
    width: 100%;
  }

  .jp-jsonpath-results-heading,
  .jp-jsonpath-match-header {
    align-items: stretch;
    flex-direction: column;
  }

  .jp-jsonpath-copy-match {
    align-self: flex-start;
  }
}
