/* Etikettenvorlagen */
.label-template-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.label-template-picker label {
  width: min(100%, 430px);
}

.label-template-picker .badge {
  align-self: center;
  margin-top: 17px;
}

.label-template-picker .badge[hidden] { display: none; }

.label-editor {
  padding: clamp(12px, 2vw, 24px);
  overflow: visible;
}

.label-editor-toolbar,
.label-file-tools,
.label-save-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.label-editor-toolbar {
  justify-content: space-between;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--cream-2);
  margin-bottom: 18px;
}

.label-png-rotation {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.label-png-rotation select {
  width: auto;
}

.label-save-status {
  color: var(--muted);
  font-size: 13px;
}

.label-save-status.is-dirty {
  color: #81511f;
}

.label-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 304px);
  align-items: start;
  gap: clamp(16px, 2vw, 24px);
}

.label-editor-work,
.label-inspector {
  min-width: 0;
}

.label-board {
  padding: clamp(16px, 2vw, 28px);
  border: 1px solid var(--cream-2);
  border-radius: 13px;
  background: #eee8e0;
}

.label-editor-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 105 / 65;
  background: white;
  box-shadow: 0 3px 12px rgba(45, 33, 24, .17);
  user-select: none;
}

.label-editor-stage canvas,
.label-field-hits {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.label-editor-stage canvas {
  pointer-events: none;
}

.label-field-hits {
  overflow: hidden;
}

.label-field-hit {
  position: absolute;
  z-index: 1;
  padding: 0;
  border: 1px dashed #a55500;
  border-radius: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.label-field-hit:hover {
  background: rgba(241, 136, 21, .10);
}

.label-field-hit.is-selected {
  z-index: 2;
  border-color: transparent;
}

.label-field-hit:focus {
  outline: 0;
}

.label-field-hit:focus-visible {
  box-shadow: inset 0 0 0 2px #a55500;
}

.label-editor-stage.is-dragging .label-field-hit {
  cursor: grabbing;
}

.label-handle-clip,
.label-handle-frame {
  position: absolute;
  pointer-events: none;
}

.label-handle-clip {
  z-index: 3;
  inset: -15px;
  overflow: hidden;
}

.label-handle-frame {
  inset: 15px;
}

.label-field-selection {
  position: absolute;
  outline: 2px solid #b85e00;
  box-shadow: 0 0 0 3px #fff9;
}

.label-resize-handle {
  position: absolute;
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
}

.label-resize-handle::after {
  width: 10px;
  height: 10px;
  border: 2px solid #a55500;
  border-radius: 2px;
  background: white;
  content: "";
}

.label-resize-handle:hover::after,
.label-resize-handle:focus-visible::after {
  background: #ffcd91;
}

.label-resize-handle[data-resize="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.label-resize-handle[data-resize="ne"] { top: 0; left: 100%; cursor: nesw-resize; }
.label-resize-handle[data-resize="sw"] { top: 100%; left: 0; cursor: nesw-resize; }
.label-resize-handle[data-resize="se"] { top: 100%; left: 100%; cursor: nwse-resize; }

.label-tools,
.label-layer-list,
.label-png-selection,
.label-template-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.label-tools { margin-top: 13px; }
.label-layer-list:not(:empty) { margin-top: 11px; }

.label-layer-list button {
  padding: 6px 11px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--brown);
  font-size: 13px;
  font-weight: 800;
}

.label-layer-list button:hover {
  background: var(--cream);
}

.label-layer-list button[aria-pressed="true"] {
  border-color: #c16e18;
  background: #fff0de;
  color: #773c05;
}

.label-png-selection {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.label-png-selection[hidden],
.label-field-selection[hidden] {
  display: none;
}

.label-inspector {
  padding: 14px;
  border: 1px solid var(--cream-2);
  border-radius: 13px;
  background: #fcfaf7;
}

.label-inspector-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 13px;
}

.label-inspector-title h3 { margin: 0; }

.label-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.label-control-grid select,
.label-control-grid input {
  min-width: 0;
  min-height: 39px;
}

.label-control-wide { grid-column: 1 / -1; }

.label-editor-details {
  border-top: 1px solid var(--cream-2);
  margin-top: 14px;
}

.label-editor-details summary {
  padding: 12px 0 2px;
  color: var(--brown);
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
}

.label-editor-details[open] summary { margin-bottom: 10px; }
.label-template-actions { margin-top: 12px; }

.label-editor-empty,
.label-editor-message,
.label-inline-error {
  color: var(--muted);
  font-size: 13px;
}

.label-editor-message { margin: 8px 0 0; }
.label-inline-error { margin: 0; color: var(--red); }

.label-font-specimen {
  margin: 5px 0 0;
  font-size: 19px;
  overflow-wrap: anywhere;
}

@media (max-width: 1020px) {
  .label-editor-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .label-editor-toolbar {
    margin-bottom: 12px;
  }

  .label-save-actions {
    justify-content: space-between;
    width: 100%;
  }

  .label-file-tools .btn,
  .label-save-actions .btn {
    padding-inline: 11px;
    font-size: 14px;
  }
}
