.flat-label-panel,
.flat-label-size-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  margin: 12px 0 16px;
  padding: 16px;
  border: 1px solid #b9d0f5;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  box-shadow: 0 12px 30px rgba(31, 101, 214, 0.08);
}

.flat-label-panel[hidden] {
  display: none !important;
}

.flat-label-size-panel[hidden] {
  display: none !important;
}

.flat-label-size-panel {
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
  border-color: #f0cc80;
}

.label-attribute-grid {
  grid-template-columns: minmax(82px, 0.8fr) minmax(82px, 0.8fr) minmax(110px, 1fr) minmax(142px, 1.2fr) minmax(96px, 0.9fr);
  align-items: center;
  gap: 8px;
}

.label-attribute-slot {
  min-width: 0;
  display: grid;
  align-items: center;
  align-self: center;
}

.label-attribute-slot .packaging-quality-panel {
  display: grid;
  margin: 0;
}

.label-attribute-slot .packaging-quality-panel label,
.label-attribute-slot .packaging-language-field {
  margin-bottom: 0;
}

.label-attribute-grid label {
  align-self: center;
  margin-bottom: 0;
  min-width: 0;
}

.label-attribute-grid input,
.label-attribute-grid select {
  width: 100%;
  min-width: 0;
}

.label-output-purpose {
  display: grid;
  gap: 10px;
}

.label-output-purpose-title {
  color: #172033;
  font-weight: 800;
}

.label-purpose-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.label-purpose-button {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #c8d7ee;
  border-radius: 10px;
  background: #ffffff;
  color: #172033;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 6px 16px rgba(31, 101, 214, 0.06);
}

.label-purpose-button:hover {
  border-color: #6ea0f4;
  background: #f6f9ff;
}

.label-purpose-button.active {
  border-color: #1f65d6;
  background: #eaf2ff;
  color: #1459c8;
  box-shadow: inset 0 0 0 1px #1f65d6, 0 8px 20px rgba(31, 101, 214, 0.12);
}

.label-purpose-panel {
  padding: 12px;
  border: 1px solid #d9e4f5;
  border-radius: 12px;
  background: #ffffff;
}

.label-purpose-panel[hidden] {
  display: none !important;
}

.purpose-label-form-host {
  margin-top: 12px;
}

.purpose-label-form-host .flat-label-panel {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.label-layout-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 6px;
  margin-top: 12px;
  min-height: 86px;
  padding: 10px;
  border: 1px solid #d8e4f6;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
}

.label-layout-preview-combined {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.label-layout-preview-front-back {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.label-layout-preview-three-block {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.layout-zone {
  min-width: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 8px;
  border: 1px solid #bcd0ee;
  border-radius: 10px;
  background: #eef5ff;
  color: #16345f;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
}

.label-layout-ratio-zone-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  margin: 0 auto 3px;
  padding: 3px 6px;
  border: 1px solid #b8c8df;
  border-radius: 7px;
  background: #ffffff;
  color: #12345e;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.layout-zone-gap .label-layout-ratio-zone-input,
.layout-zone-safe .label-layout-ratio-zone-input,
.layout-zone-separator .label-layout-ratio-zone-input {
  width: 100%;
}

.layout-zone span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #4f6687;
}

.layout-zone strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
  color: #12345e;
}

.layout-zone-gap,
.layout-zone-safe,
.layout-zone-separator {
  border-style: dashed;
  background: #ffffff;
  color: #6b7890;
}

.layout-zone-front {
  background: #f2f8ff;
}

.layout-zone-back {
  background: #fff8ec;
}

.flat-label-front-text-table {
  display: grid;
  gap: 8px;
  margin: 6px 0 8px;
}

.flat-label-front-text-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.flat-label-front-text-row label {
  min-width: 0;
  margin-bottom: 0;
}

.flat-label-front-text-row input {
  width: 100%;
  min-width: 0;
}

.flat-label-front-text-arrow {
  display: grid;
  place-items: center;
  height: 34px;
  color: #1f65d6;
  font-weight: 900;
}

.flat-label-front-text-remove,
.flat-label-front-text-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #b8cff4;
  border-radius: 8px;
  background: #f5f9ff;
  color: #1459c8;
  font-weight: 800;
}

.flat-label-front-text-remove {
  border-color: #f0c8c8;
  background: #fff7f7;
  color: #b42318;
}

.flat-label-front-text-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .flat-label-front-text-row {
    grid-template-columns: 1fr;
  }

  .flat-label-front-text-arrow {
    height: 18px;
  }

  .flat-label-front-text-remove {
    width: 100%;
  }
}
