.canvas-editor {
  display: flex;
  flex-direction: column;
  background: var(--ms-color-page-background);
  color: var(--ms-color-foreground);
}

.canvas-editor[data-embedded="true"] {
  height: 100%;
}

.canvas-editor:not([data-embedded="true"]) {
  height: 100vh;
}

.canvas-editor-chrome {
  flex-shrink: 0;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  padding-inline: var(--ms-space-3);
}

.canvas-editor-chrome[data-embedded="true"] {
  height: 44px;
}

.canvas-editor-chrome:not([data-embedded="true"]) {
  height: 56px;
}

.canvas-editor-chrome__content {
  display: flex;
  height: 100%;
  align-items: center;
  gap: var(--ms-space-3);
}

.canvas-editor-chrome__title-area {
  min-width: 0;
  flex: 1;
}

.canvas-editor-chrome__title-row {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
}

.canvas-editor-chrome__name-input {
  height: 32px;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  font-weight: 650;
  line-height: var(--ms-leading-body);
  outline: 0;
}

.canvas-editor-chrome__name-button {
  min-width: 0;
  height: 32px;
  flex: 1;
  overflow: hidden;
  border: 0;
  border-radius: var(--ms-radius-sm);
  background: transparent;
  color: var(--ms-color-foreground);
  cursor: text;
  font-size: var(--ms-text-body);
  font-weight: 650;
  line-height: var(--ms-leading-body);
  outline: 0;
  padding-inline: var(--ms-space-1);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-editor-chrome__name-button:hover,
.canvas-editor-chrome__name-button:focus-visible {
  background: color-mix(in srgb, var(--ms-color-muted) 64%, transparent);
}

.canvas-editor-chrome__type-badge,
.canvas-editor-chrome__metric-badge,
.canvas-editor-chrome__running-badge,
.canvas-editor-chrome__status-badge {
  flex-shrink: 0;
  gap: 6px;
}

.canvas-editor-chrome__type-badge {
  height: 32px;
  padding-inline: var(--ms-space-3);
  font-size: var(--ms-text-label);
  font-weight: 500;
  line-height: var(--ms-leading-label);
}

.canvas-editor-chrome[data-embedded="true"] .canvas-editor-chrome__type-badge {
  height: 28px;
  padding-inline: var(--ms-space-2);
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.canvas-editor-chrome__metric-badge {
  height: 28px;
  border-color: var(--ms-color-border);
  color: var(--ms-color-muted-foreground);
  font-weight: 500;
  line-height: 1;
}

.canvas-editor-chrome__running-badge[data-loading="true"] .canvas-editor-chrome__badge-icon,
.canvas-editor-chrome__status-badge[data-loading="true"] .canvas-editor-chrome__badge-icon,
.canvas-editor-chrome__action-button[data-loading="true"] .canvas-editor-chrome__badge-icon {
  animation: ms-spin 900ms linear infinite;
}

.canvas-editor-chrome__spin-icon {
  animation: ms-spin 900ms linear infinite;
}

.canvas-editor-chrome__metric-badge,
.canvas-editor-chrome__status-badge,
.canvas-editor-chrome__parallel-badge {
  display: none;
}

@media (min-width: 640px) {
  .canvas-editor-chrome__metric-badge,
  .canvas-editor-chrome__status-badge,
  .canvas-editor-chrome__parallel-badge {
    display: inline-flex;
  }
}

.canvas-editor-chrome__stats {
  display: none;
  margin-top: 2px;
  align-items: center;
  gap: var(--ms-space-2);
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

@media (min-width: 768px) {
  .canvas-editor-chrome__stats {
    display: flex;
  }
}

.canvas-editor-chrome__stat-fragment {
  display: inline-flex;
  align-items: center;
  gap: var(--ms-space-2);
}

.canvas-editor-chrome__badge-icon,
.canvas-editor-chrome__icon-button,
.canvas-editor-chrome__action-button {
  flex-shrink: 0;
}

.canvas-editor__main,
.canvas-editor__content {
  display: flex;
  min-height: 0;
  flex: 1;
  gap: var(--ms-space-2);
  overflow: hidden;
}

.canvas-editor__main {
  padding: var(--ms-space-2);
}

.canvas-viewport-pane {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border-radius: var(--ms-radius-panel);
  background: var(--ms-color-page-background);
}

.canvas-viewport-pane[data-drop-active="true"] {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ms-color-primary) 35%, transparent);
}

.canvas-viewport-selection-action {
  pointer-events: auto;
  position: absolute;
  top: 12px;
  left: 12px;
  height: 32px;
  gap: 6px;
  border-radius: var(--ms-radius-sm);
  box-shadow: var(--ms-shadow-sm);
}

.canvas-viewport-bounds-layer {
  pointer-events: none;
  position: absolute;
  z-index: 80;
}

.canvas-viewport-empty-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.canvas-viewport-overlay-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 100;
}

.canvas-viewport-overlay-layer > .canvas-context-menu {
  pointer-events: auto;
}

.canvas-viewport-empty-state {
  max-width: 384px;
  border-style: dashed;
  background: color-mix(in srgb, var(--ms-color-background) 80%, transparent);
  box-shadow: var(--ms-shadow-sm);
  backdrop-filter: none;
}

.canvas-viewport-status {
  pointer-events: none;
  position: absolute;
  top: var(--ms-space-4);
  left: var(--ms-space-4);
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  padding: var(--ms-space-2) var(--ms-space-3);
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
  box-shadow: var(--ms-shadow-sm);
  backdrop-filter: none;
}

.canvas-viewport-status__icon {
  display: inline-flex;
  flex-shrink: 0;
}

.canvas-viewport-status__label {
  min-width: 0;
}

.canvas-palette {
  width: 288px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ms-color-border) 76%, transparent);
  border-radius: var(--ms-radius-panel);
  background: var(--ms-color-surface-raised);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ms-color-foreground) 5%, transparent);
  transition: width 260ms var(--ms-easing-standard);
}

.canvas-palette[data-collapsed="true"] {
  align-self: center;
  width: 48px;
  max-height: 100%;
  border-radius: var(--ms-radius-md);
}

.canvas-palette__inner {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.canvas-palette[data-collapsed="true"] .canvas-palette__inner {
  height: auto;
  max-height: 100%;
  justify-content: center;
}

.canvas-palette__header {
  display: flex;
  height: 48px;
  align-items: center;
  gap: var(--ms-space-2);
  padding-inline: var(--ms-space-3);
}

.canvas-palette__header-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--ms-color-muted-foreground);
}

.canvas-palette__header-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-label);
  font-weight: 650;
  line-height: var(--ms-leading-label);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-palette__collapsed-body,
.canvas-palette__expanded-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.canvas-palette__collapsed-body {
  display: flex;
  width: 100%;
  max-height: 100%;
  flex: 0 1 auto;
  flex-direction: column;
  justify-content: center;
  padding: var(--ms-space-2) 6px;
}

.canvas-palette__expanded-body {
  padding: var(--ms-space-3);
}

.canvas-palette__collapsed-group[data-separated="true"] {
  margin-top: var(--ms-space-2);
  padding-top: var(--ms-space-2);
}

.canvas-palette__collapsed-items,
.canvas-palette__sections,
.canvas-palette-section__items {
  display: grid;
}

.canvas-palette__collapsed-items {
  justify-items: center;
  gap: var(--ms-space-1);
}

.canvas-palette__collapsed-item {
  cursor: grab;
  color: var(--ms-color-muted-foreground);
}

.canvas-palette__collapsed-item:active {
  cursor: grabbing;
}

.canvas-palette__hint {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  margin-bottom: var(--ms-space-3);
  padding: 6px var(--ms-space-2);
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.canvas-palette__hint-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.canvas-palette__sections {
  gap: var(--ms-space-4);
}

.canvas-palette-section__header {
  margin-bottom: var(--ms-space-2);
}

.canvas-palette-section__title,
.canvas-palette-section__description {
  margin: 0;
}

.canvas-palette-section__title {
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-caption);
  font-weight: 650;
  line-height: var(--ms-leading-caption);
}

.canvas-palette-section__description {
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-tiny);
  line-height: var(--ms-leading-tiny);
}

.canvas-palette-section__items {
  gap: 6px;
}

.canvas-palette-item {
  width: 100%;
  min-height: 54px;
  height: auto;
  justify-content: flex-start;
  gap: var(--ms-space-2);
  padding: var(--ms-space-2) 10px;
  text-align: left;
}

.canvas-palette-item .ms-button__content {
  min-width: 0;
  flex: 1;
  justify-content: flex-start;
}

.canvas-palette-item__icon {
  color: var(--ms-color-muted-foreground);
}

.canvas-palette-item:hover .canvas-palette-item__icon {
  color: var(--ms-color-foreground);
}

.canvas-palette-item__body {
  min-width: 0;
  flex: 1;
}

.canvas-palette-item__title,
.canvas-palette-item__description {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-palette-item__title {
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-label);
  font-weight: 500;
  line-height: var(--ms-leading-label);
}

.canvas-palette-item__description {
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-tiny);
  line-height: var(--ms-leading-tiny);
}

.canvas-palette-item__drag {
  display: inline-flex;
  flex-shrink: 0;
  color: color-mix(in srgb, var(--ms-color-muted-foreground) 45%, transparent);
}

.canvas-palette-empty {
  border-style: dashed;
  padding: var(--ms-space-3);
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}
