.viewer {
  overflow: hidden;
  --viewer-inline-pad: clamp(0.875rem, 2vw, 1.25rem);
  --viewer-block-pad: clamp(0.875rem, 1.5vw, 1rem);
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: var(--viewer-block-pad) var(--viewer-inline-pad) 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--d-border) 70%, transparent);
}

.toolbarMeta {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--d-text);
  line-height: 1.4;
}

.summaryRow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.875rem var(--viewer-inline-pad) 0.75rem;
}

.tabButton {
  border-radius: 999px;
}

.metaChip {
  font-size: 0.75rem;
}

.pane {
  min-width: 0;
  padding: 0 var(--viewer-inline-pad) var(--viewer-block-pad);
}

.jsonPane {
  overflow-x: auto;
  font-size: 0.875rem;
  font-family: var(--d-font-mono, ui-monospace, monospace);
  padding-bottom: calc(var(--viewer-block-pad) * 0.25);
  counter-reset: json-line;
}

.row {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.6;
  counter-increment: json-line;
}

.lineNum {
  display: inline-block;
  width: 2rem;
  margin-right: 1rem;
  text-align: right;
  color: var(--d-text-muted);
  opacity: 0.55;
  font-size: 0.75rem;
  user-select: none;
  flex: none;
}

.lineNum::before {
  content: counter(json-line);
}

.content {
  min-width: 0;
  flex: 1;
  word-break: break-word;
}

.depth0 { padding-left: 0; }
.depth1 { padding-left: 1.25rem; }
.depth2 { padding-left: 2.5rem; }
.depth3 { padding-left: 3.75rem; }
.depth4 { padding-left: 5rem; }
.depth5 { padding-left: 6.25rem; }
.depth6 { padding-left: 7.5rem; }

.toggleButton {
  background: transparent;
  border: none;
  color: var(--d-text-muted);
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.toggleButton:hover {
  color: var(--d-text);
}

.tokenKey {
  color: var(--d-coral);
}

.tokenString {
  color: var(--d-amber);
}

.tokenNumber {
  color: var(--d-cyan);
}

.tokenBoolean {
  color: var(--d-green);
}

.tokenNull {
  color: var(--d-text-muted);
  font-style: italic;
}

.tokenPunctuation {
  color: var(--d-text);
}

.outlineGrid {
  display: grid;
  gap: 0.75rem;
}

.stackGrid {
  display: grid;
  gap: 0.875rem;
}

.outlineItem {
  border: 1px solid color-mix(in srgb, var(--d-border) 70%, transparent);
  border-radius: var(--d-radius);
  padding: 0.75rem 0.875rem;
  background: color-mix(in srgb, var(--d-surface) 92%, transparent);
}

.outlineKey {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--d-text);
}

.outlineMeta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--d-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.commandCard {
  border: 1px solid color-mix(in srgb, var(--d-border) 70%, transparent);
  border-radius: var(--d-radius);
  padding: 0.875rem 1rem;
  display: grid;
  gap: 0.625rem;
  background: color-mix(in srgb, var(--d-surface) 92%, transparent);
}

.commandHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.commandLabel {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--d-text);
}

.commandHint {
  font-size: 0.75rem;
  color: var(--d-text-muted);
  line-height: 1.5;
}

.commandCode {
  font-family: var(--d-font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--d-amber);
  padding: 0.75rem;
  border-radius: var(--d-radius);
  background: color-mix(in srgb, var(--d-bg) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--d-border) 70%, transparent);
  word-break: break-word;
  white-space: pre-wrap;
}

.evidenceCard {
  border: 1px solid color-mix(in srgb, var(--d-border) 70%, transparent);
  border-radius: var(--d-radius);
  padding: 0.875rem 1rem;
  display: grid;
  gap: 0.625rem;
  background: color-mix(in srgb, var(--d-surface) 92%, transparent);
}

.evidenceTitle {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--d-text);
}

.evidenceList {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--d-text-muted);
  line-height: 1.5;
}

.footer {
  padding-top: 0.75rem;
  padding-right: var(--viewer-inline-pad);
  padding-bottom: var(--viewer-block-pad);
  padding-left: var(--viewer-inline-pad);
  border-top: 1px solid color-mix(in srgb, var(--d-border) 70%, transparent);
  font-size: 0.75rem;
  color: var(--d-text-muted);
}

@media (max-width: 768px) {
  .viewer {
    --viewer-inline-pad: 0.75rem;
    --viewer-block-pad: 0.75rem;
  }

  .toolbar {
    flex-direction: column;
  }

  .lineNum {
    width: 1.5rem;
    margin-right: 0.75rem;
  }

  .depth1 { padding-left: 0.75rem; }
  .depth2 { padding-left: 1.5rem; }
  .depth3 { padding-left: 2.25rem; }
  .depth4 { padding-left: 3rem; }
  .depth5 { padding-left: 3.75rem; }
  .depth6 { padding-left: 4.5rem; }
}
