/* ToolGuest JSON workbench — the parts Tailwind cannot express: the tree, the
 * type colours and the telemetry strip. Everything else on the page uses the
 * shared utility classes so the seven JSON pages match the rest of the site. */

.jt {
  --jt-line: #e4e4e7;
  --jt-panel: #ffffff;
  --jt-soft: #fafafa;
  --jt-ink: #18181b;
  --jt-mute: #71717a;
  --jt-accent: #4f46e5;
  border: 1px solid var(--jt-line);
  border-radius: 1.25rem;
  background: var(--jt-panel);
  overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(24, 24, 27, 0.35);
}

html.dark .jt {
  --jt-line: rgba(255, 255, 255, 0.09);
  --jt-panel: #0c0c10;
  --jt-soft: rgba(255, 255, 255, 0.03);
  --jt-ink: #f4f4f5;
  --jt-mute: #a1a1aa;
  --jt-accent: #818cf8;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
}

.jt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--jt-line);
  background: var(--jt-soft);
}

.jt-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

.jt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--jt-line);
  background: transparent;
  color: var(--jt-mute);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 0.55rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.jt-btn:hover { background: rgba(79, 70, 229, 0.08); color: var(--jt-ink); }
.jt-btn.is-on { background: var(--jt-ink); border-color: var(--jt-ink); color: var(--jt-panel); }
html.dark .jt-btn.is-on { background: #f4f4f5; border-color: #f4f4f5; color: #0c0c10; }
.jt-btn:focus-visible { outline: 2px solid var(--jt-accent); outline-offset: 2px; }

.jt-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--jt-mute);
}

.jt-field select {
  border: 1px solid var(--jt-line);
  border-radius: 0.5rem;
  background: var(--jt-panel);
  color: var(--jt-ink);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.4rem;
}

.jt-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--jt-mute);
  cursor: pointer;
  user-select: none;
}

.jt-switch input { accent-color: var(--jt-accent); }

.jt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--jt-line);
  background: var(--jt-panel);
}

.jt-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  border: 1px solid var(--jt-line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--jt-mute);
  white-space: nowrap;
}

.jt-chip b { color: var(--jt-ink); font-variant-numeric: tabular-nums; }

.jt-panes { display: grid; grid-template-columns: 1fr; }
@media (min-width: 860px) { .jt-panes { grid-template-columns: 1fr 1fr; } }

.jt-pane { display: flex; flex-direction: column; min-width: 0; }
.jt-pane + .jt-pane { border-top: 1px solid var(--jt-line); }
@media (min-width: 860px) { .jt-pane + .jt-pane { border-top: 0; border-left: 1px solid var(--jt-line); } }
.jt-out { background: var(--jt-soft); }

.jt-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--jt-mute);
}

.jt-pane-head > div { display: flex; gap: 0.25rem; letter-spacing: 0; text-transform: none; }
.jt-pane-head button,
.jt-link {
  border: 0;
  background: transparent;
  color: var(--jt-mute);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.45rem;
  border-radius: 0.4rem;
  cursor: pointer;
}
.jt-pane-head button:hover,
.jt-link:hover { background: rgba(79, 70, 229, 0.1); color: var(--jt-ink); }

.jt-drop { position: relative; display: flex; flex-direction: column; flex: 1; }
.jt-drop.is-drag::after {
  content: "Drop the .json file to load it";
  position: absolute;
  inset: 0.35rem;
  display: grid;
  place-items: center;
  border: 2px dashed var(--jt-accent);
  border-radius: 0.9rem;
  background: rgba(79, 70, 229, 0.08);
  color: var(--jt-ink);
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: none;
}

.jt textarea {
  width: 100%;
  min-height: 300px;
  flex: 1;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--jt-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  padding: 0.25rem 0.9rem 0.75rem;
  outline: none;
  tab-size: 2;
}

.jt textarea::placeholder { color: #a1a1aa; }

.jt-drop-hint {
  margin: 0;
  padding: 0 0.9rem 0.55rem;
  font-size: 0.68rem;
  color: var(--jt-mute);
}

.jt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.9rem;
  border-top: 1px solid var(--jt-line);
  font-size: 0.68rem;
  color: var(--jt-mute);
  font-variant-numeric: tabular-nums;
}

.jt-valid { display: inline-flex; align-items: center; gap: 0.25rem; color: #059669; font-weight: 700; }
html.dark .jt-valid { color: #34d399; }
.jt-saved { color: var(--jt-accent); font-weight: 700; }

.jt-tree {
  min-height: 300px;
  max-height: 520px;
  overflow: auto;
  padding: 0.5rem 0.9rem 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
}

.jt-node { margin: 0.05rem 0; }
.jt-node > summary {
  cursor: pointer;
  list-style: none;
  border-radius: 0.35rem;
  padding: 0.05rem 0.2rem;
}
.jt-node > summary::-webkit-details-marker { display: none; }
.jt-node > summary::before {
  content: "▸";
  display: inline-block;
  width: 0.85rem;
  color: var(--jt-mute);
  transition: transform 0.12s;
}
.jt-node[open] > summary::before { content: "▾"; }
.jt-node > summary:hover { background: rgba(79, 70, 229, 0.08); }
.jt-children {
  margin-left: 0.55rem;
  padding-left: 0.6rem;
  border-left: 1px dashed var(--jt-line);
}

.jt-leaf { padding: 0.02rem 0.2rem 0.02rem 1.05rem; }
.jt-key { color: #7c3aed; }
html.dark .jt-key { color: #c4b5fd; }
.jt-colon { color: var(--jt-mute); }
.jt-type { color: var(--jt-mute); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.jt-count {
  margin-left: 0.4rem;
  font-size: 0.68rem;
  color: var(--jt-mute);
  background: rgba(113, 113, 122, 0.12);
  border-radius: 999px;
  padding: 0.02rem 0.4rem;
}
.jt-str { color: #047857; }
html.dark .jt-str { color: #6ee7b7; }
.jt-num { color: #b45309; }
html.dark .jt-num { color: #fcd34d; }
.jt-bool { color: #1d4ed8; font-weight: 600; }
html.dark .jt-bool { color: #93c5fd; }
.jt-null { color: #be123c; font-style: italic; }
html.dark .jt-null { color: #fda4af; }
.jt-more, .jt-empty { color: var(--jt-mute); font-size: 0.75rem; padding: 0.35rem 0.2rem; }

.jt-error {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(244, 63, 94, 0.25);
  background: rgba(244, 63, 94, 0.07);
  color: #be123c;
  font-size: 0.8rem;
}
html.dark .jt-error { color: #fda4af; }
.jt-error[hidden] { display: none; }
.jt-error strong { display: block; font-size: 0.75rem; font-weight: 700; }
.jt-error p { margin: 0.2rem 0 0; }
.jt-error .jt-hint { opacity: 0.85; }
.jt-error button {
  flex-shrink: 0;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 0.5rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

/* Cluster grid and workflow bar: shared by all seven pages. */
.jt-cluster-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .jt-cluster-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .jt-cluster-grid { grid-template-columns: repeat(3, 1fr); } }

.jt-cluster-card {
  display: block;
  border: 1px solid #e4e4e7;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.6);
  padding: 0.9rem 1rem;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
html.dark .jt-cluster-card { border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.03); }
.jt-cluster-card:hover { transform: translateY(-2px); border-color: #a5b4fc; box-shadow: 0 12px 24px -18px rgba(24, 24, 27, 0.5); }
.jt-cluster-card[aria-current] { border-color: #6366f1; background: rgba(99, 102, 241, 0.07); }
.jt-cluster-card .cc-name { display: block; font-weight: 700; font-size: 0.9rem; color: #18181b; }
html.dark .jt-cluster-card .cc-name { color: #f4f4f5; }
.jt-cluster-card .cc-desc { display: block; margin-top: 0.2rem; font-size: 0.78rem; line-height: 1.5; color: #71717a; }
html.dark .jt-cluster-card .cc-desc { color: #a1a1aa; }

.jt-wf { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.jt-wf a {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #52525b;
  text-decoration: none;
}
html.dark .jt-wf a { border-color: rgba(255, 255, 255, 0.12); color: #d4d4d8; }
.jt-wf a:hover { border-color: #6366f1; color: #4f46e5; }

#toast { opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
#toast[data-show="true"] { opacity: 1; }
