html {
  overflow-y: scroll;
  overflow-x: hidden;
}

.tabs:has(.machine-collapse) {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--body-bg);
  border-bottom: 1px solid var(--hairline-color, #e8e8e8);
}

.machine-collapse {
  order: 1;
  margin-left: auto;
}

.order-machine-wrapper {
  clear: both;
  position: relative;
}

.order-machine {
  padding: 10px 10px 20px 30px;
  border: 1px solid var(--hairline-color, #e8e8e8);
  border-top: none;
  position: relative;

  display: flex;
  flex-flow: column nowrap;
}

.order-machine-section {
  position: absolute;
  background: rgba(0 0 0 / 0.1);
  pointer-events: none;
}

.order-machine .inline-related {
  border: 1px solid var(--hairline-color, #e8e8e8);
  border-bottom: 0;
  margin-top: 15px;
}

.order-machine .inline-related > h3 {
  border-top: none;
  border-bottom: none;
  font-size: 13px;
  font-weight: normal;
  height: 16px;
  padding: 7px;
  margin: 0;
  background-color: var(--darkened-bg, #f8f8f8);
  transition:
    0.15s background,
    0.15s color;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  display: flex;
  flex-flow: row nowrap;
  gap: 2px;
}

h3[draggable] {
  cursor: move;
}

.order-machine h3 .material-icons {
  position: relative;
  top: -4px;
  left: -2px;
  width: 24px;
}

.order-machine .inline-related > h3 > b,
.order-machine h3 .inline_label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.order-machine .inline-related > h3 > b {
  flex: 0 1 auto;
}

.order-machine h3 .inline_label {
  flex: 1 1 0px;
}

/* Replace the broken content type counter for new contents with a "new" label */
.order-machine .last-related .inline_label {
  content: "new";
}

.order-machine .inline-related > fieldset {
  transition:
    display 0.15s allow-discrete,
    height 0.15s ease-out allow-discrete,
    opacity 0.15s;
  height: auto;
  opacity: 1;

  @starting-style {
    /* biome-ignore lint/suspicious/noDuplicateProperties: It's not a duplicate */
    height: 0;
  }
}

.order-machine .inline-related fieldset {
  position: relative;
}

.order-machine .inline-related.selected > h3 {
  color: white;
  background-color: var(--button-bg, #79aec8);
}

.order-machine .inline-related.empty-form {
  display: none; /* Override display: grid; above */
}

.order-machine .inline-related.for-deletion,
.order-machine .inline-related.collapsed {
  border-bottom: 1px solid var(--hairline-color);
}

.order-machine .inline-related:is(.collapsed, .for-deletion) > fieldset {
  display: none;
  height: 0;
  opacity: 0;
}

.order-machine .inline-related.for-deletion > h3::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--error-fg, #ba2121);
  opacity: 0.3;
  pointer-events: none;
}

.machine-message {
  margin: 1.5em 1em 1em;
  text-align: center;
}

.plugin-buttons {
  border: 1px solid var(--hairline-color, #e8e8e8);
  background: var(--darkened-bg, #f8f8f8);
  position: absolute;
  z-index: 1982;
  top: 0;
  left: 0;
  box-shadow: 0 0 3px 0 rgba(0, 0, 50, 0.3);

  padding: 10px 20px 10px 10px;

  --_v: 8;
  display: grid;
  column-gap: 10px;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--_v), min-content);

  opacity: 0;
  visibility: none;
  pointer-events: none;
}

@media screen and (max-width: 767px) {
  .plugin-buttons {
    display: block;
  }
}

.plugin-buttons-visible .plugin-buttons {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.plugin-button {
  margin: 4px 4px;
  padding: 4px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 4px;
  user-select: none;
  break-inside: avoid;
}

.plugin-button-icon {
  width: 24px;
  display: grid;
  place-items: center;
  margin-right: 0.75rem;
}

.collapse-items {
  cursor: pointer;
}

.collapse-items input {
  display: none;
}

.collapse-items .plugin-button {
  padding: 0px 4px;
}

.collapse-items .plugin-button-icon {
  margin-right: 0;
}

.collapse-items .uncollapse-all {
  display: none;
}
.collapse-items input:checked ~ .uncollapse-all {
  display: flex;
}
.collapse-items input:checked ~ .collapse-all {
  display: none;
}

.inline_move_to_region {
  border-color: var(--hairline-color, #e8e8e8);
  font-size: 11px;
  height: 22px;
  margin: -2px 8px -2px auto;
  padding: 0px 1px;
}

.content-editor-hide {
  display: none !important;
}

/* Used when dragging */
.placeholder {
  height: 34px;
  margin: 10px 0 0 0;
  border: none;
  opacity: 0.3;
  background: #79aec8;
}

.order-machine .inline-related {
  position: relative;
}

.order-machine-help {
  font-size: 11px;
  margin-top: -28px;
  margin-bottom: 30px;
}

.fs-dragging {
  opacity: 0.5;
}

.fs-dragover::before {
  content: " ";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 4px;
  background: #79aec8;
}
.fs-dragover--after::before {
  top: auto;
  bottom: -8px;
}

.fs-dragover::after {
  /* Cover fieldset with an overlay so that widgets do not swallow events */
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
}

.order-machine-insert-target {
  position: absolute;
  left: -28px;
  top: -20px;
  font-size: 1.25rem;
  width: 1.25em;
  height: 1.25em;
  line-height: 1.25em;
  border-radius: 99px;
  background: var(--button-bg, #79aec8);
  color: var(--button-fg, #fff);
  box-shadow: 0 0 3px 1px var(--button-fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.5;
}
.order-machine-insert-target.last {
  top: auto;
  bottom: 4px;
  left: 3px;
  z-index: 1;
}
.order-machine-insert-target:hover,
.order-machine-insert-target.selected {
  opacity: 1;
  background: var(--button-hover-bg, #609ab6);
}
.order-machine-insert-target::before {
  content: "+";
  font-weight: bold;
}

.order-machine-hide-insert-targets .order-machine-insert-target {
  display: none;
}

@media screen and (max-width: 767px) {
  /* CSS fix for Django's responsive admin interface (shows fields below the
   * 767px breakpoint despite them being .hidden */
  html .aligned .form-row.hidden {
    display: none;
  }

  html .aligned .form-row > div {
    width: calc(100vw - 90px);
  }

  html .order-machine .form-row {
    padding: 10px;
  }

  .order-machine-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: min-content min-content;
  }
}

@media screen and (min-width: 768px) {
  .submit-row {
    position: sticky;
    bottom: -20px;
  }
}

.order-machine-readonly .plugin-buttons + p,
.order-machine-readonly .order-machine-insert-target,
.order-machine-readonly + .order-machine-help,
.order-machine-readonly .inline-related > h3[draggable]::before {
  display: none;
}

/* =====| OVERRIDES |===== */

/* JAZZMIN  start */

#jazzy-navbar ~ .content-wrapper .order-machine {
  padding-top: 12px;
}

#jazzy-navbar
  ~ .content-wrapper
  .order-machine-wrapper
  .card-header
  > .card-title[draggable]::before {
  content: "drag_indicator";
  /* biome-ignore lint/a11y/useGenericFontNames: no fallback */
  font-family: "Material Icons";
  font-size: 24px;
  position: relative;
  top: 7px;
  left: -2px;
}

#jazzy-navbar ~ .content-wrapper .card .card-body > h6 {
  display: none;
}

#jazzy-navbar ~ .content-wrapper .card .card-body .tabs > .tab {
  border-radius: 4px 4px 0 0;
  background: inherit;
  color: inherit;
}

#jazzy-navbar ~ .content-wrapper .card .card-body .tabs > .active {
  background: rgba(200, 200, 200, 0.2);
}

#jazzy-navbar ~ .content-wrapper .card .card-body .tabs > .active:hover {
  background: rgba(200, 200, 200, 0.5);
}

#jazzy-navbar
  ~ .content-wrapper
  .order-machine-wrapper
  .card-header
  > .card-title[draggable] {
  margin-bottom: 9px;
}

#jazzy-navbar
  ~ .content-wrapper
  .order-machine-wrapper
  .card-header
  > .card-title[draggable]
  + .card-tools.delete {
  margin-top: 7px;
  margin-right: 2px;
}

#jazzy-navbar
  ~ .content-wrapper
  .order-machine-wrapper
  .card-body
  div[id*="cke_id_"] {
  margin-left: 0;
  width: 100% !important;
}

#jazzy-navbar ~ .content-wrapper .order-machine-wrapper .card-header {
  padding: 0 1.25rem;
}

#jazzy-navbar ~ .content-wrapper .order-machine .inline-related {
  border: 0;
  padding: 5px;
  margin-top: 0;
}

#jazzy-navbar ~ .content-wrapper .order-machine-help {
  margin-left: 25px;
}

#jazzy-navbar ~ .content-wrapper .order-machine-wrapper.collapsed {
  margin-right: 34px;
}

/* JAZZMIN end */
