.top-actions {
  min-width: 0;
  overflow: visible;
}

.top-actions button {
  flex-shrink: 0;
  white-space: nowrap;
}

.save-status-button {
  position: relative;
}

.save-status-button .save-state-mark {
  position: absolute;
  left: 25px;
  top: 23px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--brand-gold);
}

.save-status-button.is-dirty .save-state-mark {
  background: #d58a2c;
}

.top-actions [data-audio-toggle] {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 18px;
}

.top-actions [data-audio-toggle].is-audio-muted::after {
  content: "";
  position: absolute;
  width: 21px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-48deg);
}

.top-actions button:has(.top-action-icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.top-action-icon {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-actions button[data-compact-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  overflow: hidden;
  font-size: 0 !important;
}

.top-actions button[data-compact-icon]::before {
  content: attr(data-compact-icon);
  font-size: 17px;
  line-height: 1;
}

.top-actions button:has(.top-action-icon)::before {
  display: none;
}

.top-actions button:has(.top-action-icon) {
  gap: 0;
}

.top-actions button:has(.top-action-icon) > span {
  display: none;
}

.top-actions .top-action-icon {
  width: 19px;
  height: 19px;
}

.workbench-toolbar.is-compact-actions button[data-compact-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  overflow: hidden;
  font-size: 0 !important;
}

.workbench-toolbar.is-compact-actions button[data-compact-icon]::before {
  content: attr(data-compact-icon);
  font-size: 17px;
  line-height: 1;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .direct-modes {
  grid-template-columns: repeat(3, 38px);
  flex: 0 0 auto;
  width: auto;
  max-width: none;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .direct-modes button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .direct-modes button > span:not(.mode-icon) {
  display: none;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .direct-modes .mode-icon {
  width: 20px;
  flex-basis: 20px;
  font-size: 19px;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .toolbar-icon-groups {
  gap: 3px;
  padding: 3px;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .toolbar-icon-groups button {
  width: 32px;
  min-width: 32px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.workbench-toolbar.workbench-toolbar {
  justify-content: center;
}

body[data-toolbar-alignment="left"] .workbench-toolbar.workbench-toolbar {
  justify-content: flex-start;
}

body[data-toolbar-alignment="right"] .workbench-toolbar.workbench-toolbar {
  justify-content: flex-end;
}

body[data-toolbar-distribution="split"]:not([data-toolbar-placement="left"]):not([data-toolbar-placement="right"]) .workbench-toolbar > .toolbar-icon-groups {
  order: 1;
  margin-right: auto;
}

body[data-toolbar-distribution="split"]:not([data-toolbar-placement="left"]):not([data-toolbar-placement="right"]) .workbench-toolbar > .direct-modes {
  order: 2;
  margin-left: auto;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar {
  position: absolute;
  z-index: 12;
  top: 50%;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 116px;
  max-height: calc(100% - 32px);
  padding: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #d8c9ad;
  border-radius: 7px;
  background: rgba(255, 254, 248, .96);
  box-shadow: 0 5px 18px #402b0926;
  transform: translateY(-50%);
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar { left: 18px; }
body[data-toolbar-placement="right"] .stage > .workbench-toolbar { right: 18px; }

body[data-toolbar-placement="left"] .stage-top { left: 152px; }
body[data-toolbar-placement="right"] .stage-top { right: 152px; }
body[data-toolbar-placement="left"] .view-tools { left: 152px; }
body[data-toolbar-placement="left"] .panel-edge-toggle.left { left: 144px; }
body[data-toolbar-placement="right"] .panel-edge-toggle.right { right: 144px; }

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .direct-modes,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .direct-modes {
  grid-template-columns: 1fr;
  box-sizing: border-box;
  width: 100%;
  padding: 8px 0 0;
  border: 0;
  border-top: 1px solid #d8c9ad;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .direct-modes button,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .direct-modes button {
  padding-inline: 4px;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .toolbar-icon-groups,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .toolbar-icon-groups {
  display: grid;
  box-sizing: border-box;
  width: 100%;
  padding: 0 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .crafter-icon-tools,
body[data-toolbar-placement="left"] .stage > .workbench-toolbar .toolbar-quick-tools,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .crafter-icon-tools,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .toolbar-quick-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 40px));
  justify-content: center;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .toolbar-quick-tools,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .toolbar-quick-tools {
  padding-top: 4px;
  border-top: 1px solid #d8c9ad;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .toolbar-symbol,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .toolbar-symbol {
  margin-inline: auto;
}

body[data-toolbar-placement="left"] .stage > .workbench-toolbar .direct-modes button,
body[data-toolbar-placement="right"] .stage > .workbench-toolbar .direct-modes button {
  text-align: center;
  white-space: nowrap;
}

body[data-toolbar-placement^="stage-above-"] .workspace {
  grid-template-rows: auto minmax(0, 1fr) !important;
}

body[data-toolbar-placement^="stage-above-"] .workspace > .left-panel,
body[data-toolbar-placement^="stage-above-"] .workspace > .right-panel {
  grid-row: 1 / 3;
}

body[data-toolbar-placement^="stage-above-"] .workspace > .stage {
  grid-column: 2;
  grid-row: 2;
}

body[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid #d8c9ad;
  background: #fffef8;
  box-shadow: none;
}

body.workspace-no-left[data-toolbar-placement^="stage-above-"] .workspace > .stage,
body.workspace-no-left[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar,
body.workspace-no-left.workspace-no-right[data-toolbar-placement^="stage-above-"] .workspace > .stage,
body.workspace-no-left.workspace-no-right[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar {
  grid-column: 1;
}

body[data-toolbar-placement="stage-above-left"] .workspace > .workbench-toolbar { justify-content: flex-start; }
body[data-toolbar-placement="stage-above-center"] .workspace > .workbench-toolbar { justify-content: center; }
body[data-toolbar-placement="stage-above-right"] .workspace > .workbench-toolbar { justify-content: flex-end; }

body[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar .direct-modes {
  flex: 1 1 270px;
  max-width: 324px;
}

body[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar .toolbar-icon-groups {
  flex: 0 1 auto;
  max-width: 100%;
}

body[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar .crafter-icon-tools,
body[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar .toolbar-quick-tools {
  flex-wrap: wrap;
  justify-content: center;
}

body[data-toolbar-placement^="stage-above-"] .workspace > .workbench-toolbar .toolbar-symbol {
  margin-inline: auto;
}

@media (max-width: 760px) {
  .workbench-toolbar.workbench-toolbar {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 460px) {
  body:not(.shared-view) > .topbar {
    display: grid;
    grid-template-columns: minmax(0, 40px) 84px minmax(172px, 1fr);
    align-items: center;
    gap: 4px;
  }

  body:not(.shared-view) > .topbar > .brand {
    width: 100%;
    max-width: 40px;
    min-width: 0;
    justify-content: center;
    overflow: hidden;
  }

  body:not(.shared-view) > .topbar > .brand .brand-mark.has-custom-logo {
    max-width: 40px;
  }

  body:not(.shared-view) > .topbar > nav {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    width: 84px;
    gap: 4px;
  }

  body:not(.shared-view) > .topbar > nav > button {
    display: grid;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
  }

  .topbar .top-actions.is-compact {
    display: grid;
    grid-template-columns: repeat(4, 40px);
    flex: 0 0 172px;
    width: 172px;
    align-content: center;
    gap: 4px;
    justify-self: end;
  }

  .topbar .top-actions.is-compact > button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
  }

  .workbench-toolbar.is-compact-actions {
    max-height: none;
    overflow: visible;
  }

  .toolbar-icon-groups .crafter-icon-tools button,
  .toolbar-icon-groups .toolbar-quick-tools button {
    flex-basis: 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
  }
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .direct-modes {
  flex: 0 0 120px;
  width: 120px;
  max-width: 120px;
}

body[data-toolbar-distribution="split"] .workbench-toolbar.is-compact-actions > .toolbar-icon-groups button {
  flex: 0 0 32px;
}

body[data-toolbar-distribution="split"][data-toolbar-placement="left"] .stage > .workbench-toolbar.is-compact-actions > .direct-modes,
body[data-toolbar-distribution="split"][data-toolbar-placement="right"] .stage > .workbench-toolbar.is-compact-actions > .direct-modes {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
}
