.studio-edit-page {
  --studio-bp-wide: 1280px;
  --studio-bp-ultra: 1600px;

  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.studio-edit-loading {
  padding: var(--spacing-xl);
  color: var(--color-text-secondary);
}

.studio-edit-top {
  --studio-top-label-h: 1.25rem;
  --studio-top-control-h: 2.75rem;

  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(280px, 1fr) minmax(160px, 220px);
  grid-template-rows: var(--studio-top-label-h) var(--studio-top-control-h) auto;
  grid-template-areas:
    'label-project label-goal label-desc'
    'ctrl-project  ctrl-goal  ctrl-desc'
    'actions       .          .';
  align-items: stretch;
  gap: 6px var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .studio-edit-top {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      'label-project label-project'
      'ctrl-project  ctrl-project'
      'actions       actions'
      'label-goal    label-goal'
      'ctrl-goal     ctrl-goal'
      'label-desc    label-desc'
      'ctrl-desc     ctrl-desc';
  }
}

.studio-edit-top__label {
  display: flex;
  align-items: center;
  min-height: var(--studio-top-label-h);
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-muted);
  line-height: 1.2;
}

.studio-edit-top__label--project {
  grid-area: label-project;
}

.studio-edit-top__label--goal {
  grid-area: label-goal;
}

.studio-edit-top__label--desc {
  grid-area: label-desc;
}

.studio-edit-top__label-text {
  font: inherit;
  color: inherit;
}

.studio-edit-top__label .studio-field-label {
  font: inherit;
  color: inherit;
}

.studio-edit-top__control {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.studio-edit-top__control--project {
  grid-area: ctrl-project;
}

.studio-edit-top__control--goal {
  grid-area: ctrl-goal;
}

.studio-edit-top__control--desc {
  grid-area: ctrl-desc;
}

.studio-edit-top__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-xs);
  padding-top: 2px;
}

.studio-edit-select--project {
  width: 100%;
  min-height: var(--studio-top-control-h);
  box-sizing: border-box;
}

.studio-edit-textarea--goal {
  width: 100%;
  min-height: var(--studio-top-control-h);
  max-height: 5.5rem;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.45;
}

.studio-edit-input--desc {
  width: 100%;
  min-height: var(--studio-top-control-h);
  box-sizing: border-box;
}

.studio-edit-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.studio-edit-label-block {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.studio-edit-select,
.studio-edit-input,
.studio-edit-textarea {
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.studio-edit-select:focus,
.studio-edit-input:focus,
.studio-edit-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

.studio-edit-textarea {
  resize: vertical;
  width: 100%;
}

.studio-edit-textarea--compact {
  min-height: 4rem;
}

.studio-edit-meta-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.studio-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.85rem;
}

.studio-edit-banner.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
}

.studio-edit-banner.error {
  background: var(--color-danger-light);
  color: var(--color-error);
}

.studio-edit-banner-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
}

.studio-edit-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 1600px) {
  .studio-edit-main {
    grid-template-columns: minmax(280px, 340px) 1fr;
  }
}

.studio-edit-nodes {
  border-right: 1px solid var(--color-border-light);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--color-bg-subtle);
}

.studio-edit-nodes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  flex-shrink: 0;
}

.studio-edit-nodes-header__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

.studio-edit-sort-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.studio-edit-sort-btn {
  padding: 3px 8px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.studio-edit-sort-btn + .studio-edit-sort-btn {
  border-left: 1px solid var(--color-border);
}

.studio-edit-sort-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
}

.studio-edit-sort-btn.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

.studio-edit-subtitle {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.studio-edit-add-node {
  padding: 0 var(--spacing-md) var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.studio-edit-node-list {
  list-style: none;
  margin: 0;
  padding: var(--spacing-sm);
  overflow-y: auto;
  flex: 1;
}

.studio-edit-node-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-xs);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  cursor: pointer;
  background: var(--color-bg-secondary);
  transition:
    border-color var(--transition-fast, 0.15s),
    background var(--transition-fast, 0.15s);
}

.studio-edit-node-item:hover {
  border-color: var(--color-border);
  background: var(--color-bg-tertiary);
}

.studio-edit-node-item.selected {
  border-left-color: var(--color-accent);
  border-color: var(--color-border);
  background: var(--color-accent-light);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.studio-edit-node-item.disabled {
  opacity: 0.55;
}

.studio-edit-drag-handle {
  cursor: grab;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  user-select: none;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
}

.studio-edit-drag-handle--muted {
  cursor: default;
  opacity: 0.45;
}

.studio-edit-node-item.no-drag {
  cursor: pointer;
}

.studio-edit-node-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.studio-edit-node-title {
  font-weight: 500;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-edit-node-skill {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.studio-edit-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* —— Right detail panel —— */

.studio-edit-detail {
  overflow-y: auto;
  min-height: 0;
  background: var(--color-bg-primary);
}

.studio-edit-detail:has(> .studio-edit-empty) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-edit-detail-inner {
  box-sizing: border-box;
  width: 100%;
  max-width: min(1400px, 100%);
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-lg) var(--spacing-xl);
}

/* Top meta strip — display name, template, niche (full width above body) */

.studio-edit-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-light);
}

.studio-edit-meta-strip__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 160px;
  max-width: 280px;
}

.studio-edit-meta-strip__hint {
  flex: 1 1 100%;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* Primary center + edge rail (n8n / Retool / Figma pattern) */

.studio-edit-detail-body {
  display: flex;
  gap: var(--spacing-lg);
  align-items: flex-start;
}

.studio-edit-primary {
  flex: 1;
  min-width: 0;
}

.studio-edit-edge-rail {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

@media (max-width: 1280px) and (min-width: 1101px) {
  .studio-edit-edge-rail {
    width: 280px;
  }
}

@media (max-width: 1100px) {
  .studio-edit-detail-body {
    flex-direction: column;
  }

  .studio-edit-edge-rail {
    width: 100%;
  }
}

@media (max-width: 1100px) and (min-width: 480px) {
  .studio-edit-edge-rail {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .studio-edit-edge-rail .studio-edit-edge-card {
    flex: 1 1 280px;
  }
}

.studio-edit-primary-card {
  position: relative;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  border-left: 3px solid var(--color-accent);
  background: var(--color-bg-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.studio-edit-primary-card__badge {
  display: inline-block;
  margin-bottom: var(--spacing-md);
  padding: 2px var(--spacing-sm);
  border-radius: var(--radius-sm, 4px);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-accent-light);
}

.studio-edit-edge-card {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-subtle, var(--color-bg-secondary));
}

.studio-edit-edge-card--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5rem;
}

.studio-edit-edge-empty-tip {
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.4;
}

.studio-edit-field--primary {
  margin-bottom: var(--spacing-md);
}

.studio-edit-field-label--primary {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.studio-edit-textarea--primary {
  min-height: 7rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* FieldLabel — dotted underline + native title tooltip */

.studio-field-label {
  display: inline;
  font: inherit;
  color: inherit;
}

.studio-field-label__text--tip {
  border-bottom: 1px dotted var(--color-text-muted);
  cursor: help;
}

.studio-edit-dp-list--compact {
  margin-top: var(--spacing-sm);
  font-size: 0.82rem;
}

/* Edge rail: variable chips compact */

.studio-var-panel__title,
.studio-wb-insert__title,
.studio-scoring-block__title {
  margin: 0 0 var(--spacing-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.studio-var-panel--compact .studio-var-group__title {
  font-size: 0.72rem;
}

.studio-var-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.studio-var-panel--compact .studio-var-chip__btn {
  font-size: 0.72rem;
  padding: 3px var(--spacing-xs);
}

.studio-wb-insert__fields {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.studio-scoring-block {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border-light);
}

.studio-scoring-block__title {
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.studio-edit-empty {
  margin: 0;
  padding: var(--spacing-lg);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.studio-edit-section {
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-light);
}

.studio-edit-section:last-of-type {
  border-bottom: none;
}

.studio-edit-section-head {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.studio-edit-section-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  opacity: 0.85;
}

.studio-edit-section-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.studio-edit-section-sub {
  display: none;
}

.studio-edit-form-grid {
  display: grid;
  gap: var(--spacing-sm) var(--spacing-md);
}

.studio-edit-form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 520px) {
  .studio-edit-form-grid--2 {
    grid-template-columns: 1fr;
  }
}

.studio-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.studio-edit-field--full {
  grid-column: 1 / -1;
}

.studio-edit-field-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.studio-edit-hint {
  margin: 0 0 var(--spacing-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.studio-edit-hint--inline {
  margin: var(--spacing-xs) 0 0;
}

.studio-edit-hint-muted {
  margin-top: var(--spacing-sm);
  font-style: italic;
}

.studio-edit-switch-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-sm) 0;
  font-size: 0.85rem;
}

.studio-edit-switch-row--compact {
  margin: 0 0 var(--spacing-sm);
}

/* Variable chips */

.studio-var-group {
  margin-bottom: var(--spacing-sm);
}

.studio-var-group:last-child {
  margin-bottom: 0;
}

.studio-var-group__title {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.studio-var-group--auto {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  background: rgba(var(--color-accent-rgb, 59, 130, 246), 0.06);
  border: 1px dashed var(--color-border-light);
}

.studio-var-auto-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.studio-var-manual-hint {
  margin: 0 0 var(--spacing-xs);
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.studio-var-cycle-warn {
  margin: 0 0 var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  font-size: 0.7rem;
  line-height: 1.4;
}

.studio-var-auto-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.studio-var-auto-toggle__meta {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.studio-var-auto-toggle__chevron {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.studio-var-auto-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.studio-var-auto-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
  font-size: 0.68rem;
  cursor: default;
}

.studio-var-auto-chip__label {
  color: var(--color-text-primary);
}

.studio-var-auto-chip__popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 220px;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-elevated, #fff);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  pointer-events: none;
}

.studio-var-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
  cursor: pointer;
  min-width: 0;
}

.studio-var-switch--on {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.studio-var-switch__label {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-var-switch__track {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: var(--color-border);
  transition: background 0.15s ease;
}

.studio-var-switch--on .studio-var-switch__track {
  background: var(--color-accent);
}

.studio-var-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.studio-var-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.studio-var-switch--on .studio-var-switch__thumb {
  transform: translateX(16px);
}

.studio-edit-think-default {
  margin-top: var(--spacing-xs);
}

.studio-var-group__sub {
  display: none;
}

.studio-var-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-xs);
}

@media (max-width: 480px) {
  .studio-var-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1280px) {
  .studio-var-grid:not(.studio-var-grid--compact) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .studio-var-grid:not(.studio-var-grid--compact) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.studio-var-empty {
  grid-column: 1 / -1;
  margin: 0;
}

.studio-var-chip {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
  overflow: hidden;
  transition:
    border-color var(--transition-fast, 0.15s),
    background var(--transition-fast, 0.15s);
}

.studio-var-chip--on {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.studio-var-chip__btn {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-xs) var(--spacing-sm);
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 0.8rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-var-chip__btn:hover {
  color: var(--color-accent);
}

.studio-var-chip--on .studio-var-chip__btn {
  font-weight: 500;
}

.studio-var-chip__opt {
  flex-shrink: 0;
  padding: 0 var(--spacing-xs);
  border: none;
  border-left: 1px solid var(--color-border-light);
  background: var(--color-bg-tertiary);
  font-size: 0.65rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.studio-var-chip__opt--on {
  color: var(--color-accent);
  background: transparent;
}

/* Scoring dimensions */

.studio-dim-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.studio-dim-card {
  display: flex;
  gap: var(--spacing-sm);
  align-items: flex-start;
  padding: var(--spacing-sm);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

.studio-dim-card__fields {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr;
  gap: var(--spacing-sm);
  min-width: 0;
}

@media (max-width: 560px) {
  .studio-dim-card__fields {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1280px) {
  .studio-dim-card__fields {
    grid-template-columns: minmax(120px, 160px) 1fr;
  }
}

.studio-dim-card__remove {
  flex-shrink: 0;
  padding: 4px var(--spacing-xs);
  border: none;
  background: none;
  color: var(--color-danger);
  font-size: 0.72rem;
  cursor: pointer;
}

.studio-dim-card__remove:hover {
  text-decoration: underline;
}

.studio-edit-btn-ghost {
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.studio-edit-btn-ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.studio-edit-detail-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-md);
  margin-top: var(--spacing-sm);
  border-top: 1px solid var(--color-border-light);
}

.studio-edit-dp-list {
  margin: 0;
  padding-left: var(--spacing-lg);
  font-size: 0.85rem;
}

.studio-edit-footer {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.studio-edit-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 0.85rem;
}

.studio-edit-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.studio-edit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.studio-edit-btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

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

.studio-edit-btn-sm {
  padding: 4px var(--spacing-sm);
  font-size: 0.75rem;
}

.studio-edit-btn-danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.studio-edit-preview {
  margin: 0 var(--spacing-lg) var(--spacing-md);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

.studio-edit-preview pre {
  margin: 0;
  padding: var(--spacing-md);
  font-size: 0.75rem;
  overflow: auto;
  max-height: 240px;
}

.studio-edit-preview summary {
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  font-size: 0.85rem;
}

.studio-edit-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.studio-edit-header-icon {
  font-size: 1.25rem;
}

.studio-edit-header-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.studio-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.studio-modal {
  width: min(420px, 92vw);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.studio-modal-title {
  margin: 0 0 var(--spacing-md);
  font-size: 1.1rem;
}

.studio-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}
