*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #110e14;
  --surface: #1c1622;
  --surface-2: #2a1f35;
  --accent: #8f11c3;
  --accent-hover: #a83fd4;
  --accent-subtle: rgba(143, 17, 195, 0.12);
  --purple-alt: #6d2c8b;
  --purple-deep: #5f3187;
  --success: #2ecc71;
  --success-hover: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --danger-bg: rgba(231, 76, 60, 0.15);
  --text: #ede8f0;
  --text-muted: #8a7f96;
  --border: #352a42;
  --radius: 8px;
  --shadow: 0 2px 16px rgba(95, 49, 135, 0.15);

  /* Provenance — where a value came from */
  --prov-file: #6fbf8f;
  --prov-name: #4aa3d8;
  --prov-inferred: #4aa3d8; /* an inference, like a name-derived value */
  --prov-default: #d9a441;
  --prov-edited: #b56ce0;
  --prov-computed: #8a7f96;
  --prov-missing: #e74c3c;

  /* Tool preview canvas */
  --preview-grid: rgba(255, 255, 255, 0.07);
  --preview-axis: #4d90d9;
  --preview-tip: #d9534f;
}

body {
  font-family: 'Avenir', 'Avenir Next', 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.header-logo {
  height: 44px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

header h1 {
  font-size: 1.6rem;
  color: var(--text);
  letter-spacing: 2px;
  font-weight: 300;
  margin-top: 0.5rem;
}

header h1 span {
  color: var(--accent);
  font-weight: 600;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

main {
  flex: 1;
  max-width: 1760px;
  margin: 0 auto;
  padding: 1rem;
  width: 100%;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer .footer-note {
  font-size: 0.78rem;
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.btn-ghost.danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.btn-ghost.open { color: var(--text); border-color: var(--accent); }

.btn-small { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn-large { padding: 1rem 3rem; font-size: 1.2rem; }

/* Upload Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  transition: border-color 0.3s, background 0.3s;
  cursor: pointer;
  background: var(--surface);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.drop-zone-content { pointer-events: none; }
.drop-zone-content .btn { pointer-events: auto; }

.upload-icon { color: var(--text-muted); margin-bottom: 1rem; }
.drop-zone p { margin: 0.5rem 0; }
.drop-hint { color: var(--text-muted); font-size: 0.9rem; }

#upload-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
#upload-status.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}
#upload-status.success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
  border: 1px solid var(--success);
}
#upload-status.loading {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border: 1px solid #3498db;
}

/* ---------------------------------------------------------------- Toolbar */

#workbench-section { margin-top: 1.5rem; }

.toolbar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.toolbar-row + .toolbar-row { margin-top: 0.85rem; }

.library-summary { font-size: 0.95rem; flex: 1; }
.library-summary strong { color: var(--accent-hover); }
.warn-text { color: var(--warning); }
.conflict-text { color: var(--danger); }

.toolbar-actions { display: flex; gap: 0.5rem; }

.search-input {
  flex: 1;
  min-width: 240px;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9rem;
}
.search-input:focus { outline: none; border-color: var(--accent); }

.filter-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-chip {
  padding: 0.35rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--text);
}
.filter-chip.warn.active { border-color: var(--warning); }
.filter-chip.conflict.active { border-color: var(--danger); }
.chip-count {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.35rem;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 0.75rem;
}

.restored-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Library defaults */
.defaults-panel,
.names-panel {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

/* --- What the tool names say ------------------------------------------- */

.names-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.names-summary { flex: 1; font-size: 0.9rem; color: var(--text-muted); }

.names-findings {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.names-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface-2);
  border-left: 3px solid var(--prov-name);
  border-radius: 4px;
  font-size: 0.85rem;
}
.names-row.conflict { border-left-color: var(--danger); }

.names-kind {
  flex: none;
  min-width: 3.9rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.7rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.names-kind.fill { background: rgba(74, 163, 216, 0.18); color: var(--prov-name); }
.names-kind.conflict { background: var(--danger-bg); color: var(--danger); }

.names-tool {
  flex: none;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.names-tool:hover { color: var(--accent-hover); text-decoration: underline; }

.names-detail { flex: 1; color: var(--text-muted); }
.names-detail strong { color: var(--text); font-weight: 600; }
.names-evidence { display: block; font-size: 0.78rem; color: var(--text-muted); }

.names-more { align-self: flex-start; margin-top: 0.3rem; }

/* --- What the library is short of --------------------------------------- */

.missing-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.4rem;
}

.missing-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-left: 3px solid var(--warning);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.missing-row:hover { border-color: var(--accent); }
.missing-row.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.missing-count {
  flex: none;
  min-width: 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--warning);
}
.mark-incomplete {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.7rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}
.mark-incomplete code {
  background: var(--surface-2);
  padding: 0 0.25rem;
  border-radius: 3px;
}
.mark-incomplete-count { color: var(--warning); }

.missing-field { font-weight: 600; }
.missing-detail {
  flex: 1;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.settings-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.setting-item label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.setting-item input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.95rem;
}
.setting-item input:focus { outline: none; border-color: var(--accent); }
.setting-item.full-width { grid-column: 1 / -1; }

/* Scoped bulk apply */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.bulk-label { color: var(--text-muted); font-size: 0.9rem; }
.bulk-select,
.bulk-value {
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9rem;
}
.bulk-value { width: 130px; }
.bulk-value-host { display: inline-flex; align-items: center; gap: 0.35rem; }

/* -------------------------------------------------------------- Workbench */

.workbench {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr) 360px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 1400px) {
  .workbench { grid-template-columns: 300px minmax(0, 1fr); }
  .pane-preview { grid-column: 1 / -1; }
  .preview-graphic { max-width: 420px; margin: 0 auto; }
}
@media (max-width: 900px) {
  .workbench { grid-template-columns: 1fr; }
}

.pane {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  min-width: 0;
}
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.pane-header h2 { font-size: 1.05rem; font-weight: 600; }
.pane-empty { color: var(--text-muted); padding: 2rem 1rem; text-align: center; }

/* Tree */
.check-all { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.tree-body { max-height: 68vh; overflow-y: auto; }
.tree-empty { color: var(--text-muted); font-size: 0.9rem; padding: 1rem 0; }

.tree-folder { margin-bottom: 0.4rem; }
.tree-folder-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: var(--surface-2);
  border: none;
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.tree-folder-header:hover { background: rgba(143, 17, 195, 0.18); }
.tree-caret { color: var(--text-muted); font-size: 0.7rem; width: 0.8rem; }
.tree-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-folder-count { color: var(--text-muted); font-size: 0.78rem; }
.tree-folder-warn {
  background: var(--warning);
  color: #221a06;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 0.35rem;
}

.tree-list { list-style: none; margin: 0.15rem 0 0 0.5rem; }
.tree-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-left: 2px solid transparent;
}
.tree-item.active { background: var(--accent-subtle); border-left-color: var(--accent); }
.tree-item.attention { border-left-color: var(--warning); }
.tree-item.active.attention { border-left-color: var(--accent); }
.tree-item:hover { background: rgba(255,255,255,0.04); }
.tree-check { accent-color: var(--accent); margin-left: 0.25rem; }

.tree-item-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.35rem 0.4rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.tree-item.excluded .tree-item-btn { color: var(--text-muted); text-decoration: line-through; }
/* Two lines per row: the name, then type / diameter / angle in muted text. */
.tree-item-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.tree-name,
.tree-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-type { color: var(--text-muted); font-size: 0.78rem; }

.tool-icon { width: 14px; height: 14px; fill: var(--accent-hover); flex-shrink: 0; }
.tree-item.excluded .tool-icon { fill: var(--text-muted); }

.tree-flag {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 0.35rem;
}
.tree-flag.warn { background: var(--warning); color: #221a06; }
.tree-flag.conflict { background: var(--danger); color: #fff; }
.tree-flag.edited { background: transparent; color: var(--prov-edited); }
.tree-flag.skip { background: var(--surface-2); color: var(--text-muted); font-weight: 400; }

/* Inspector */
.inspector-header { align-items: flex-start; }
.inspector-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.inspector-actions { display: flex; align-items: center; gap: 0.6rem; }
.include-toggle { font-size: 0.85rem; display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.include-toggle input { accent-color: var(--accent); }

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: var(--surface-2);
  border-radius: 12px;
  font-weight: normal;
}

.inspector-banner {
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: 4px;
  font-size: 0.85rem;
  background: var(--danger-bg);
  border: 1px solid rgba(231, 76, 60, 0.4);
}
.inspector-banner.rescued {
  background: rgba(46, 204, 113, 0.12);
  border-color: rgba(46, 204, 113, 0.4);
}

.prop-group { margin-bottom: 1.25rem; }
.prop-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.4rem;
}
.prop-group h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* Feed-rate display unit. Presentation only — the file is always mm/sec. */
.rate-unit-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.rate-unit-picker select {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.12rem 0.3rem;
}

.prop-head,
.prop-row {
  display: grid;
  grid-template-columns: 116px minmax(90px, 1fr) 58px minmax(150px, 1.1fr) auto;
  align-items: center;
  gap: 0.5rem;
}
.prop-head {
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  padding: 0.2rem 0.35rem 0.45rem;
}

.prop-row {
  padding: 0.28rem 0.35rem;
  border-radius: 4px;
}
.prop-row:hover { background: rgba(255,255,255,0.03); }
.prop-row.prov-missing { background: rgba(231, 76, 60, 0.09); }

.prop-label { font-size: 0.85rem; color: var(--text-muted); }
.prop-row.prov-missing .prop-label,
.prop-row.prov-edited .prop-label { color: var(--text); }

.prop-source {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prop-source.na { color: var(--border); font-style: italic; }
.prop-source.none { color: var(--prov-missing); }
.src-hint { color: var(--prov-name); font-size: 0.75rem; }

.prop-arrow {
  text-align: center;
  color: var(--border);
  font-size: 0.8rem;
}
.prop-arrow.converted { color: var(--prov-name); font-size: 0.68rem; }

.editor { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.prop-input {
  flex: 1;
  min-width: 70px;
  padding: 0.3rem 0.45rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.prop-input:focus { outline: none; border-color: var(--accent); }
textarea.prop-input { resize: vertical; font-family: inherit; width: 100%; }
.prop-row.prov-missing .prop-input { border-color: rgba(231, 76, 60, 0.55); }
.prop-row.prov-edited .prop-input { border-color: var(--prov-edited); }

.editor-unit { color: var(--text-muted); font-size: 0.78rem; }
.editor-stored {
  flex-basis: 100%;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.prop-meta { display: flex; align-items: center; gap: 0.25rem; justify-content: flex-end; }
.prov-chip {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  white-space: nowrap;
  border: 1px solid currentColor;
  opacity: 0.85;
}
.prov-chip.prov-file { color: var(--prov-file); }
.prov-chip.prov-name { color: var(--prov-name); }
.prov-chip.prov-inferred { color: var(--prov-inferred); font-style: italic; }
.prov-chip.prov-default { color: var(--prov-default); }
.prov-chip.prov-edited { color: var(--prov-edited); }
.prov-chip.prov-computed { color: var(--prov-computed); }
.prov-chip.prov-missing { color: var(--prov-missing); font-weight: 700; }

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 0.1rem 0.32rem;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn.spread:hover { color: var(--prov-edited); border-color: var(--prov-edited); }

/* Preview pane */
.preview-graphic {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.tool-svg { display: block; width: 100%; height: auto; }
.tp-label {
  fill: var(--text);
  font-size: 12px;
  font-family: 'Avenir', 'Segoe UI', sans-serif;
}
.tp-label-dim { fill: var(--text-muted); font-size: 11px; }
.tp-legend-box { fill: var(--surface); stroke: var(--border); }

.preview-stats { margin-top: 0.85rem; }
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.28rem 0.2rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stat-key { color: var(--text-muted); }
.stat-val { font-variant-numeric: tabular-nums; }
.stat-row.warn .stat-val { color: var(--warning); font-weight: 600; }
.stat-row.computed .stat-val { color: var(--prov-computed); }
.stat-warning {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(243, 156, 18, 0.12);
  border: 1px solid rgba(243, 156, 18, 0.4);
  border-radius: 4px;
  color: var(--warning);
  font-size: 0.78rem;
}

/* A hint, not a control: the drag affordance is not otherwise discoverable. */
.tree-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-basis: 100%;
}
.tree-hint kbd {
  background: var(--surface-2);
  border-radius: 3px;
  padding: 0 0.25rem;
  font-size: 0.72rem;
}

/* Dragging a tool into a folder. The two drop states read differently on
   purpose: a copy is additive, a move is not. */
.tree-folder-header.drop-move {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.tree-folder-header.drop-copy {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--success, #3fb950);
}
.tree-item-btn[draggable="true"] { cursor: grab; }
.tree-item-btn[draggable="true"]:active { cursor: grabbing; }
.tree-flag.copy { color: var(--text-muted); }

/* One row per loaded library, in the Libraries panel. */
.library-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.library-row:last-child { border-bottom: none; }
.library-name { font-weight: 600; flex: 1; word-break: break-all; }
.library-format {
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 0.78rem;
}
.library-count { color: var(--text-muted); white-space: nowrap; }

/* -------------------------------------------------------- Download & JSON */

#download-section {
  margin-top: 1.5rem;
  text-align: center;
  padding: 1rem;
}

/* Which tools leave in the file. Sits above the button so the size of the
   download is read before it is clicked. */
.export-scope-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.json-panel { margin-top: 1.25rem; text-align: left; }
.json-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.35rem 0;
}
.json-toggle::before { content: '▶ '; font-size: 0.7rem; }
.json-toggle.open::before { content: '▼ '; }
.json-toggle:hover { color: var(--text); }

.category-group { margin-bottom: 0.75rem; }
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.category-header:hover { background: rgba(143, 17, 195, 0.15); }
.category-header .count { color: var(--text-muted); font-size: 0.8rem; }
.category-header .arrow { transition: transform 0.2s; color: var(--text-muted); }
.category-header.collapsed .arrow { transform: rotate(-90deg); }
.category-json {
  background: var(--bg);
  padding: 0.75rem;
  border-radius: 0 0 4px 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(150%);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  z-index: 50;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Utility */
.hidden { display: none !important; }
