.desk-tools .heading {
  align-items: center;
}

.desk-tools kbd,
.desk-palette kbd {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid #d9e2ea;
  border-radius: 5px;
  background: #f3f6f9;
  color: #365467;
  font: 600 .82rem ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.desk-tools .desk-card {
  overflow: clip;
}

.desk-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.desk-tabs button {
  min-height: 49px;
  padding: 0 4px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 650;
  text-align: left;
}

.desk-tabs button:hover {
  color: var(--deep);
}

.desk-tabs button[aria-current] {
  border-bottom-color: var(--blue);
  color: var(--deep);
}

.desk-body {
  padding: clamp(14px, 2vw, 24px);
}

.desk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}

.desk-field {
  display: grid;
  min-width: min(160px, 100%);
  gap: 6px;
  font-size: .92rem;
  font-weight: 640;
}

.desk-field input,
.desk-field select,
.desk-field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid #d5e1e9;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-weight: 400;
}

.desk-field input[type="file"] {
  padding: 5px;
}

.desk-field input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: var(--pale);
  color: var(--deep);
  cursor: pointer;
}

.desk-search {
  flex: 1 1 220px;
  max-width: 440px;
}

.desk-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.desk-list {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.desk-list h3 {
  padding: 13px 14px;
  background: #f7f9fb;
  font-size: .96rem;
}

.desk-list h3 small {
  margin-left: 4px;
  color: var(--muted);
}

.desk-row,
.desk-setting {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.desk-row + .desk-row,
.desk-list h3 + .desk-row,
.desk-setting + .desk-setting {
  border-top: 1px solid var(--line);
}

.desk-row strong,
.desk-row span {
  overflow-wrap: anywhere;
}

.desk-row .btn {
  flex-shrink: 0;
}

.desk-row-actions,
.desk-template-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
}

.desk-template-row p {
  display: -webkit-box;
  max-width: 70ch;
  margin-top: 5px;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.desk-template-title small,
.desk-setting small,
.desk-hint,
.desk-empty,
.desk-transfer p,
.desk-midi p {
  color: var(--muted);
  line-height: 1.5;
}

.desk-hint {
  margin: -3px 0 14px;
}

.desk-empty {
  padding: 14px;
}

.desk-settings {
  max-width: 760px;
}

.desk-setting {
  cursor: pointer;
}

.desk-setting strong,
.desk-setting small {
  display: block;
}

.desk-setting input {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--deep);
}

.desk-variants {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.desk-variant textarea {
  line-height: 1.45;
  resize: vertical;
}

.desk-pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
  max-width: 780px;
}

.desk-pad-tile {
  display: grid;
  align-items: start;
  gap: 6px;
}

.desk-pad-tile > .btn {
  min-height: 63px;
  justify-content: start;
  padding: 12px;
  text-align: left;
  white-space: normal;
  background: #f4f9fd;
}

.desk-pad-bind {
  display: flex;
  gap: 8px;
  color: var(--deep);
  font-size: .86rem;
}

.desk-pad-bind button {
  padding: 6px 0;
}

.desk-pad-bind button:hover {
  text-decoration: underline;
}

.desk-midi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.desk-inline-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.desk-transfer {
  display: grid;
  gap: 24px;
}

.desk-transfer section + section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.desk-transfer p {
  margin: 6px 0 12px;
}

.desk-transfer .desk-toolbar {
  margin-bottom: 0;
}

.desk-import-preview {
  margin-top: 15px;
}

.desk-import-list {
  max-height: 370px;
  margin-bottom: 12px;
  overflow: auto;
}

.desk-import-row {
  justify-content: start;
  align-items: start;
  cursor: pointer;
}

.desk-import-row input {
  flex-shrink: 0;
  margin-top: 6px;
  accent-color: var(--deep);
}

.desk-insert-text {
  white-space: pre-wrap;
}

.desk-error,
.desk-transfer .desk-error {
  color: #a12e46;
}

.desk-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.desk-palette {
  width: min(620px, calc(100% - 30px));
  max-height: min(670px, calc(100dvh - 35px));
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  box-shadow: 0 14px 36px #102e3c2b;
}

.desk-palette-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.desk-palette-heading .ib {
  font-size: 20px;
}

.desk-palette ul {
  max-height: min(400px, 56dvh);
  margin: 10px -2px 0;
  padding: 0 2px;
  overflow: auto;
  list-style: none;
}

.desk-palette li + li {
  margin-top: 3px;
}

.desk-palette li button {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  text-align: left;
}

.desk-palette [aria-selected="true"] button,
.desk-palette li button:hover {
  background: var(--pale);
}

.desk-palette li button > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.desk-palette li small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-result-category {
  flex: 0 0 auto;
  max-width: 40%;
  color: var(--muted);
  font-size: .8rem;
  text-align: right;
}

.desk-palette-status {
  padding: 12px 4px;
  color: var(--muted);
}

.desk-palette-status:empty {
  display: none;
}

.desk-palette-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .8rem;
}

@media (min-width: 761px) {
  .editor-grid.left-handed:not(.wide) {
    grid-template-columns: minmax(260px, 1fr) minmax(0, 1.65fr);
  }

  .editor-grid.left-handed:not(.wide) > .source-card {
    grid-column: 2;
    grid-row: 1;
  }

  .editor-grid.left-handed:not(.wide) > .side-stack {
    grid-column: 1;
    grid-row: 1;
  }
}

@media (max-width: 760px) {
  .desk-tools .desk-palette-key {
    display: none;
  }

  .desk-tabs {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 0 12px;
    overflow-x: auto;
  }

  .desk-tabs button {
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 7px;
  }

  .desk-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .desk-field {
    min-width: 0;
  }

  .desk-search {
    flex-basis: 180px;
  }

  .desk-template-row {
    align-items: start;
    flex-direction: column;
  }

  .desk-palette-footer {
    display: none;
  }
}
