.preset-grid-icon {
  display: inline-grid;
  grid-template-columns: repeat(3, 3px);
  grid-auto-rows: 3px;
  gap: 2px;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.preset-grid-icon::before {
  content: "";
  width: 3px;
  height: 3px;
  background: currentColor;
  box-shadow: 5px 0 currentColor, 10px 0 currentColor, 0 5px currentColor, 5px 5px currentColor, 10px 5px currentColor, 0 10px currentColor, 5px 10px currentColor, 10px 10px currentColor;
}

.composer .preset-trigger {
  border-color: #85480f;
  background: #2d2014;
  color: #ff9a2a;
}

.composer .preset-trigger[hidden] {
  display: none !important;
}

.composer .preset-trigger:hover {
  border-color: #d36b10;
  background: #3b2514;
}

.preset-modal {
  z-index: 80;
}

.preset-modal.open {
  display: block;
}

.preset-modal > .modal-backdrop {
  background: rgba(0, 0, 0, .28);
  backdrop-filter: none;
}

.preset-modal .preset-panel {
  position: fixed;
  left: calc(232px + (100vw - 232px) / 2);
  top: 48px;
  z-index: 82;
  width: min(960px, calc(100vw - 280px));
  max-height: calc(100vh - 225px);
  transform: translateX(-50%);
  padding: 0;
  border: 1px solid #353638;
  border-radius: 18px;
  background: #151616;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .72);
  overflow: hidden;
}

.preset-modal .preset-header {
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid #303132;
}

.preset-modal .preset-header > div {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c7c9ca;
}

.preset-modal .preset-header strong {
  color: #f1f1f1;
  font-size: 15px;
}

.preset-modal .preset-header button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #909294;
  font-size: 22px;
}

.preset-modal .preset-tabs {
  height: 58px;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid #303132;
}

.preset-modal .preset-tabs button {
  min-width: 84px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #c6c7c8;
  font-size: 13px;
  font-weight: 600;
}

.preset-modal .preset-tabs button.active {
  border-color: #8f480d;
  background: #372111;
  color: #ff9a29;
}

.preset-modal .preset-tabs .manage {
  min-width: 60px;
  margin-left: auto;
  color: #ff9a29;
}

.preset-modal .preset-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 350px);
  min-height: 174px;
  padding: 18px;
  overflow-y: auto;
  scrollbar-color: #5b5e61 transparent;
  scrollbar-width: thin;
}

.preset-modal .preset-list::-webkit-scrollbar {
  width: 7px;
}

.preset-modal .preset-list::-webkit-scrollbar-thumb {
  border-radius: 7px;
  background: #5b5e61;
}

.preset-modal .preset-item {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 62px;
  padding: 11px 48px 10px 14px;
  border: 1px solid #383a3b;
  border-radius: 12px;
  background: #202020;
  color: #e8e8e8;
  text-align: left;
  cursor: pointer;
}

.preset-modal .preset-item:hover,
.preset-modal .preset-item:focus-visible {
  border-color: #a55312;
  background: #25221f;
  outline: none;
}

.preset-modal .preset-item strong {
  overflow: hidden;
  color: #f0f0f0;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-modal .preset-item span {
  display: block;
  overflow: hidden;
  color: #a8aaac;
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-modal .preset-item em {
  position: absolute;
  right: 13px;
  top: 22px;
  color: #ff9324;
  font-size: 10px;
  font-style: normal;
  opacity: 0;
}

.preset-modal .preset-item:hover em {
  opacity: 1;
}

.preset-empty,
.preset-loading {
  display: grid;
  place-items: center;
  min-height: 170px;
  color: #85888b;
  font-size: 12px;
  text-align: center;
}

.preset-modal .preset-manager {
  position: fixed;
  left: calc(232px + (100vw - 232px) / 2);
  top: 50%;
  z-index: 84;
  width: min(900px, calc(100vw - 280px));
  height: min(620px, calc(100vh - 70px));
  transform: translate(-50%, -50%);
}

.preset-modal .preset-manager .manager-body {
  min-height: 0;
  overflow: hidden;
}

.preset-modal .preset-manager .manager-editor {
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: #5b5e61 transparent;
  scrollbar-width: thin;
}

.preset-modal .preset-manager .manager-actions {
  position: sticky;
  z-index: 3;
  bottom: -31px;
  margin: 24px -32px -31px;
  padding: 14px 32px;
  border-top: 1px solid #303640;
  background: rgba(16, 20, 28, .97);
  backdrop-filter: blur(8px);
}

.manager-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-manager .manager-header #presetHeaderSave {
  width: auto;
  height: 32px;
  padding: 0 15px;
  border: 1px solid #d8761d;
  border-radius: 8px;
  background: #ed7e1d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.preset-manager .manager-header #presetHeaderSave:disabled {
  opacity: .55;
  cursor: wait;
}

.preset-manager .manager-sidebar-head {
  padding: 0 16px 18px;
}

.preset-manager .manager-sidebar-head > div {
  display: grid;
  gap: 5px;
}

.preset-manager .managed-preset {
  padding-left: 16px;
  padding-right: 72px;
}

.preset-manager .managed-preset-delete {
  position: absolute;
  right: 10px;
  top: 18px;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #b1b3b5;
  font-size: 11px;
  cursor: pointer;
}

.preset-manager .managed-preset-delete:hover {
  color: #ff795e;
}

.preset-manager .preset-scope-field select {
  width: 180px;
  height: 38px;
  border: 1px solid #343a44;
  border-radius: 9px;
  background: #171b22;
  color: #e7e9ec;
  padding: 0 10px;
}

@media (max-width: 900px) {
  .preset-modal .preset-panel,
  .preset-modal .preset-manager {
    left: calc(190px + (100vw - 190px) / 2);
    width: calc(100vw - 218px);
  }
}

@media (max-width: 650px) {
  .preset-modal .preset-panel,
  .preset-modal .preset-manager {
    left: calc(58px + (100vw - 58px) / 2);
    width: calc(100vw - 78px);
  }

  .preset-modal .preset-panel {
    top: 14px;
    max-height: calc(100vh - 150px);
  }

  .preset-modal .preset-tabs {
    gap: 2px;
    padding: 0 8px;
  }

  .preset-modal .preset-tabs button {
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
  }

  .preset-modal .preset-list {
    max-height: calc(100vh - 280px);
    padding: 10px;
  }

  .preset-modal .preset-item {
    padding-right: 14px;
  }

  .preset-modal .preset-item em {
    display: none;
  }

  .preset-modal .preset-manager {
    height: calc(100vh - 26px);
  }

  .preset-manager .manager-editor textarea {
    height: 190px;
  }
}
